Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/herald/core/admin/metaboxe...
File: post.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Load post metaboxes
[3] Fix | Delete
*
[4] Fix | Delete
* Callback function for post metaboxes load
[5] Fix | Delete
*
[6] Fix | Delete
* @since 1.0
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
if ( !function_exists( 'herald_load_post_metaboxes' ) ) :
[10] Fix | Delete
function herald_load_post_metaboxes() {
[11] Fix | Delete
[12] Fix | Delete
/* Layout metabox */
[13] Fix | Delete
add_meta_box(
[14] Fix | Delete
'herald_layout',
[15] Fix | Delete
esc_html__( 'Post Layout', 'herald' ),
[16] Fix | Delete
'herald_layout_metabox',
[17] Fix | Delete
'post',
[18] Fix | Delete
'side',
[19] Fix | Delete
'default'
[20] Fix | Delete
);
[21] Fix | Delete
[22] Fix | Delete
/* Sidebar metabox */
[23] Fix | Delete
add_meta_box(
[24] Fix | Delete
'herald_sidebar',
[25] Fix | Delete
esc_html__( 'Sidebar', 'herald' ),
[26] Fix | Delete
'herald_sidebar_metabox',
[27] Fix | Delete
'post',
[28] Fix | Delete
'side',
[29] Fix | Delete
'default'
[30] Fix | Delete
);
[31] Fix | Delete
[32] Fix | Delete
/* Meta bar metabox */
[33] Fix | Delete
add_meta_box(
[34] Fix | Delete
'herald_meta_bar',
[35] Fix | Delete
esc_html__( 'Meta bar', 'herald' ),
[36] Fix | Delete
'herald_meta_bar_metabox',
[37] Fix | Delete
'post',
[38] Fix | Delete
'side',
[39] Fix | Delete
'default'
[40] Fix | Delete
);
[41] Fix | Delete
[42] Fix | Delete
/* Display metabox */
[43] Fix | Delete
add_meta_box(
[44] Fix | Delete
'herald_display',
[45] Fix | Delete
esc_html__( 'Display', 'herald' ),
[46] Fix | Delete
'herald_display_metabox',
[47] Fix | Delete
'post',
[48] Fix | Delete
'side',
[49] Fix | Delete
'default'
[50] Fix | Delete
);
[51] Fix | Delete
[52] Fix | Delete
}
[53] Fix | Delete
endif;
[54] Fix | Delete
[55] Fix | Delete
[56] Fix | Delete
/**
[57] Fix | Delete
* Save post meta
[58] Fix | Delete
*
[59] Fix | Delete
* Callback function to save post meta data
[60] Fix | Delete
*
[61] Fix | Delete
* @since 1.0
[62] Fix | Delete
*/
[63] Fix | Delete
[64] Fix | Delete
if ( !function_exists( 'herald_save_post_metaboxes' ) ) :
[65] Fix | Delete
function herald_save_post_metaboxes( $post_id, $post ) {
[66] Fix | Delete
[67] Fix | Delete
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
[68] Fix | Delete
return;
[69] Fix | Delete
[70] Fix | Delete
if ( isset( $_POST['herald_post_nonce'] ) ) {
[71] Fix | Delete
if ( !wp_verify_nonce( $_POST['herald_post_nonce'], __FILE__ ) )
[72] Fix | Delete
return;
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
[76] Fix | Delete
if ( $post->post_type == 'post' && isset( $_POST['herald'] ) ) {
[77] Fix | Delete
$post_type = get_post_type_object( $post->post_type );
[78] Fix | Delete
if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
[79] Fix | Delete
return $post_id;
[80] Fix | Delete
[81] Fix | Delete
$herald_meta = array();
[82] Fix | Delete
[83] Fix | Delete
if( isset( $_POST['herald']['use_sidebar'] ) && $_POST['herald']['use_sidebar'] != 'inherit' ){
[84] Fix | Delete
$herald_meta['use_sidebar'] = $_POST['herald']['use_sidebar'];
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
if( isset( $_POST['herald']['sidebar'] ) && $_POST['herald']['sidebar'] != 'inherit' ){
[88] Fix | Delete
$herald_meta['sidebar'] = $_POST['herald']['sidebar'];
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
if( isset( $_POST['herald']['sticky_sidebar'] ) && $_POST['herald']['sticky_sidebar'] != 'inherit' ){
[92] Fix | Delete
$herald_meta['sticky_sidebar'] = $_POST['herald']['sticky_sidebar'];
[93] Fix | Delete
}
[94] Fix | Delete
[95] Fix | Delete
if( isset( $_POST['herald']['layout'] ) && $_POST['herald']['layout'] != 'inherit' ){
[96] Fix | Delete
$herald_meta['layout'] = $_POST['herald']['layout'];
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
if( isset( $_POST['herald']['meta_bar_position'] ) && $_POST['herald']['meta_bar_position'] != 'inherit' ){
[100] Fix | Delete
$herald_meta['meta_bar_position'] = $_POST['herald']['meta_bar_position'];
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
[104] Fix | Delete
$display = array('fimg' ,'headline' ,'tags' ,'author' ,'sticky_bar' ,'related', 'ad_above', 'ad_below');
[105] Fix | Delete
foreach($display as $key){
[106] Fix | Delete
if( isset( $_POST['herald']['display'][$key] ) && $_POST['herald']['display'][$key] != 'inherit' ){
[107] Fix | Delete
$herald_meta['display'][$key] = $_POST['herald']['display'][$key];
[108] Fix | Delete
}
[109] Fix | Delete
}
[110] Fix | Delete
[111] Fix | Delete
[112] Fix | Delete
if(!empty($herald_meta)){
[113] Fix | Delete
update_post_meta( $post_id, '_herald_meta', $herald_meta );
[114] Fix | Delete
} else {
[115] Fix | Delete
delete_post_meta( $post_id, '_herald_meta');
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
}
[119] Fix | Delete
}
[120] Fix | Delete
endif;
[121] Fix | Delete
[122] Fix | Delete
[123] Fix | Delete
/**
[124] Fix | Delete
* Layout metabox
[125] Fix | Delete
*
[126] Fix | Delete
* Callback function to create layout metabox
[127] Fix | Delete
*
[128] Fix | Delete
* @since 1.0
[129] Fix | Delete
*/
[130] Fix | Delete
[131] Fix | Delete
if ( !function_exists( 'herald_layout_metabox' ) ) :
[132] Fix | Delete
function herald_layout_metabox( $object, $box ) {
[133] Fix | Delete
[134] Fix | Delete
$herald_meta = herald_get_post_meta( $object->ID );
[135] Fix | Delete
$layouts = herald_get_single_layouts( true );
[136] Fix | Delete
?>
[137] Fix | Delete
<ul class="herald-img-select-wrap">
[138] Fix | Delete
<?php foreach ( $layouts as $id => $layout ): ?>
[139] Fix | Delete
<li>
[140] Fix | Delete
<?php $selected_class = $id == $herald_meta['layout'] ? ' selected': ''; ?>
[141] Fix | Delete
<img src="<?php echo esc_url($layout['img']); ?>" title="<?php echo esc_attr($layout['title']); ?>" class="herald-img-select<?php echo esc_attr($selected_class); ?>">
[142] Fix | Delete
<span><?php echo esc_html( $layout['title'] ); ?></span>
[143] Fix | Delete
<input type="radio" class="herald-hidden" name="herald[layout]" value="<?php echo esc_attr($id); ?>" <?php checked( $id, $herald_meta['layout'] );?>/> </label>
[144] Fix | Delete
</li>
[145] Fix | Delete
<?php endforeach; ?>
[146] Fix | Delete
</ul>
[147] Fix | Delete
[148] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose a layout', 'herald' ); ?></p>
[149] Fix | Delete
[150] Fix | Delete
<?php
[151] Fix | Delete
}
[152] Fix | Delete
endif;
[153] Fix | Delete
[154] Fix | Delete
[155] Fix | Delete
[156] Fix | Delete
/**
[157] Fix | Delete
* Sidebar metabox
[158] Fix | Delete
*
[159] Fix | Delete
* Callback function to create sidebar metabox
[160] Fix | Delete
*
[161] Fix | Delete
* @since 1.0
[162] Fix | Delete
*/
[163] Fix | Delete
[164] Fix | Delete
if ( !function_exists( 'herald_sidebar_metabox' ) ) :
[165] Fix | Delete
function herald_sidebar_metabox( $object, $box ) {
[166] Fix | Delete
[167] Fix | Delete
if($object->post_type == 'post'){
[168] Fix | Delete
$herald_meta = herald_get_post_meta( $object->ID );
[169] Fix | Delete
} else {
[170] Fix | Delete
$herald_meta = herald_get_page_meta( $object->ID );
[171] Fix | Delete
}
[172] Fix | Delete
[173] Fix | Delete
$sidebars_lay = herald_get_sidebar_layouts( true );
[174] Fix | Delete
$sidebars = herald_get_sidebars_list( true );
[175] Fix | Delete
?>
[176] Fix | Delete
<ul class="herald-img-select-wrap">
[177] Fix | Delete
<?php foreach ( $sidebars_lay as $id => $layout ): ?>
[178] Fix | Delete
<li>
[179] Fix | Delete
<?php $selected_class = $id == $herald_meta['use_sidebar'] ? ' selected': ''; ?>
[180] Fix | Delete
<img src="<?php echo esc_url($layout['img']); ?>" title="<?php echo esc_attr($layout['title']); ?>" class="herald-img-select<?php echo esc_attr($selected_class); ?>">
[181] Fix | Delete
<span><?php echo esc_html( $layout['title'] ); ?></span>
[182] Fix | Delete
<input type="radio" class="herald-hidden" name="herald[use_sidebar]" value="<?php echo esc_attr($id); ?>" <?php checked( $id, $herald_meta['use_sidebar'] );?>/> </label>
[183] Fix | Delete
</li>
[184] Fix | Delete
<?php endforeach; ?>
[185] Fix | Delete
</ul>
[186] Fix | Delete
[187] Fix | Delete
<p class="description"><?php esc_html_e( 'Display sidebar', 'herald' ); ?></p>
[188] Fix | Delete
[189] Fix | Delete
<?php if ( !empty( $sidebars ) ): ?>
[190] Fix | Delete
[191] Fix | Delete
<p><select name="herald[sidebar]" class="widefat">
[192] Fix | Delete
<?php foreach ( $sidebars as $id => $name ): ?>
[193] Fix | Delete
<option value="<?php echo esc_attr($id); ?>" <?php selected( $id, $herald_meta['sidebar'] );?>><?php echo esc_html( $name ); ?></option>
[194] Fix | Delete
<?php endforeach; ?>
[195] Fix | Delete
</select></p>
[196] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose standard sidebar to display', 'herald' ); ?></p>
[197] Fix | Delete
[198] Fix | Delete
<p><select name="herald[sticky_sidebar]" class="widefat">
[199] Fix | Delete
<?php foreach ( $sidebars as $id => $name ): ?>
[200] Fix | Delete
<option value="<?php echo esc_attr($id); ?>" <?php selected( $id, $herald_meta['sticky_sidebar'] );?>><?php echo esc_html( $name ); ?></option>
[201] Fix | Delete
<?php endforeach; ?>
[202] Fix | Delete
</select></p>
[203] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose sticky sidebar to display', 'herald' ); ?></p>
[204] Fix | Delete
[205] Fix | Delete
<?php endif; ?>
[206] Fix | Delete
<?php
[207] Fix | Delete
}
[208] Fix | Delete
endif;
[209] Fix | Delete
[210] Fix | Delete
/**
[211] Fix | Delete
* Meta bar metabox
[212] Fix | Delete
*
[213] Fix | Delete
* Callback function to create meta bar metabox
[214] Fix | Delete
*
[215] Fix | Delete
* @since 1.3
[216] Fix | Delete
*/
[217] Fix | Delete
[218] Fix | Delete
if ( !function_exists( 'herald_meta_bar_metabox' ) ) :
[219] Fix | Delete
function herald_meta_bar_metabox( $object, $box ) {
[220] Fix | Delete
[221] Fix | Delete
$herald_meta = herald_get_post_meta( $object->ID );
[222] Fix | Delete
$layouts = herald_get_meta_bar_layouts( true );
[223] Fix | Delete
?>
[224] Fix | Delete
<ul class="herald-img-select-wrap">
[225] Fix | Delete
<?php foreach ( $layouts as $id => $layout ): ?>
[226] Fix | Delete
<li>
[227] Fix | Delete
<?php $selected_class = $id == $herald_meta['meta_bar_position'] ? ' selected': ''; ?>
[228] Fix | Delete
<img src="<?php echo esc_url($layout['img']); ?>" title="<?php echo esc_attr($layout['title']); ?>" class="herald-img-select<?php echo esc_attr($selected_class); ?>">
[229] Fix | Delete
<span><?php echo esc_html( $layout['title'] ); ?></span>
[230] Fix | Delete
<input type="radio" class="herald-hidden" name="herald[meta_bar_position]" value="<?php echo esc_attr($id); ?>" <?php checked( $id, $herald_meta['meta_bar_position'] );?>/> </label>
[231] Fix | Delete
</li>
[232] Fix | Delete
<?php endforeach; ?>
[233] Fix | Delete
</ul>
[234] Fix | Delete
[235] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose meta bar layout', 'herald' ); ?></p>
[236] Fix | Delete
[237] Fix | Delete
<?php
[238] Fix | Delete
}
[239] Fix | Delete
endif;
[240] Fix | Delete
[241] Fix | Delete
/**
[242] Fix | Delete
* Display options metabox
[243] Fix | Delete
*
[244] Fix | Delete
* Callback function to create display ptions metabox
[245] Fix | Delete
*
[246] Fix | Delete
* @since 1.3
[247] Fix | Delete
*/
[248] Fix | Delete
[249] Fix | Delete
if ( !function_exists( 'herald_display_metabox' ) ) :
[250] Fix | Delete
function herald_display_metabox( $object, $box ) {
[251] Fix | Delete
[252] Fix | Delete
$herald_meta = herald_get_post_meta( $object->ID );
[253] Fix | Delete
[254] Fix | Delete
$meta = $herald_meta['display'];
[255] Fix | Delete
[256] Fix | Delete
$options = array(
[257] Fix | Delete
'fimg' => esc_html( 'Featured Image', 'herald'),
[258] Fix | Delete
'headline' => esc_html( 'Headline (excerpt)', 'herald'),
[259] Fix | Delete
'tags' => esc_html( 'Tags', 'herald'),
[260] Fix | Delete
'author' => esc_html( 'Author Area', 'herald'),
[261] Fix | Delete
'sticky_bar' => esc_html( 'Sticky Bottom Bar', 'herald'),
[262] Fix | Delete
'related' => esc_html( 'Related posts', 'herald'),
[263] Fix | Delete
'ad_above' => esc_html( 'Ad above content', 'herald'),
[264] Fix | Delete
'ad_below' => esc_html( 'Ad below content', 'herald'),
[265] Fix | Delete
);
[266] Fix | Delete
[267] Fix | Delete
$values = array(
[268] Fix | Delete
'inherit' => esc_html( 'Inherit', 'herald'),
[269] Fix | Delete
1 => esc_html( 'On', 'herald'),
[270] Fix | Delete
0 => esc_html( 'Off', 'herald'),
[271] Fix | Delete
);
[272] Fix | Delete
[273] Fix | Delete
foreach($options as $id => $option): ?>
[274] Fix | Delete
[275] Fix | Delete
<p><label><?php echo esc_html( $option ); ?>:</label> <select name="herald[display][<?php echo esc_attr($id); ?>]" class="alignright">
[276] Fix | Delete
<?php foreach($values as $value => $title): ?>
[277] Fix | Delete
<?php if( in_array( $id, array( 'ad_below', 'ad_above' ) ) && $value === 'inherit') {
[278] Fix | Delete
continue;
[279] Fix | Delete
} ?>
[280] Fix | Delete
<option value="<?php echo esc_attr($value); ?>" <?php selected($meta[$id], $value); ?>><?php echo esc_html( $title ); ?></option>
[281] Fix | Delete
<?php endforeach; ?>
[282] Fix | Delete
</select></p>
[283] Fix | Delete
[284] Fix | Delete
<?php endforeach; ?>
[285] Fix | Delete
[286] Fix | Delete
<p class="description"><?php esc_html_e( 'Optionally override global display options for single posts', 'herald' ); ?></p>
[287] Fix | Delete
[288] Fix | Delete
<?php
[289] Fix | Delete
}
[290] Fix | Delete
endif;
[291] Fix | Delete
?>
[292] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function