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
File: extensions.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/* Store registered sidebars so we can get them before wp_registered_sidebars is initialized to use them in theme options */
[2] Fix | Delete
[3] Fix | Delete
add_action( 'admin_init', 'herald_check_sidebars' );
[4] Fix | Delete
[5] Fix | Delete
if ( !function_exists( 'herald_check_sidebars' ) ):
[6] Fix | Delete
function herald_check_sidebars() {
[7] Fix | Delete
global $wp_registered_sidebars;
[8] Fix | Delete
if ( !empty( $wp_registered_sidebars ) ) {
[9] Fix | Delete
update_option( 'herald_registered_sidebars', $wp_registered_sidebars );
[10] Fix | Delete
}
[11] Fix | Delete
}
[12] Fix | Delete
endif;
[13] Fix | Delete
[14] Fix | Delete
[15] Fix | Delete
/* Change customize link to lead to theme options instead of live customizer */
[16] Fix | Delete
[17] Fix | Delete
add_filter( 'wp_prepare_themes_for_js', 'herald_change_customize_link' );
[18] Fix | Delete
[19] Fix | Delete
if ( !function_exists( 'herald_change_customize_link' ) ):
[20] Fix | Delete
function herald_change_customize_link( $themes ) {
[21] Fix | Delete
if ( array_key_exists( 'herald', $themes ) ) {
[22] Fix | Delete
$themes['herald']['actions']['customize'] = admin_url( 'admin.php?page=herald_options' );
[23] Fix | Delete
}
[24] Fix | Delete
return $themes;
[25] Fix | Delete
}
[26] Fix | Delete
endif;
[27] Fix | Delete
[28] Fix | Delete
[29] Fix | Delete
/* Change default arguments of flickr widget plugin */
[30] Fix | Delete
[31] Fix | Delete
add_filter( 'mks_flickr_widget_modify_defaults', 'herald_flickr_widget_defaults' );
[32] Fix | Delete
[33] Fix | Delete
if ( !function_exists( 'herald_flickr_widget_defaults' ) ):
[34] Fix | Delete
function herald_flickr_widget_defaults( $defaults ) {
[35] Fix | Delete
[36] Fix | Delete
$defaults['t_width'] = 93;
[37] Fix | Delete
$defaults['t_height'] = 93;
[38] Fix | Delete
return $defaults;
[39] Fix | Delete
}
[40] Fix | Delete
endif;
[41] Fix | Delete
[42] Fix | Delete
[43] Fix | Delete
/* Change default arguments of author widget plugin */
[44] Fix | Delete
[45] Fix | Delete
add_filter( 'mks_author_widget_modify_defaults', 'herald_author_widget_defaults' );
[46] Fix | Delete
[47] Fix | Delete
if ( !function_exists( 'herald_author_widget_defaults' ) ):
[48] Fix | Delete
function herald_author_widget_defaults( $defaults ) {
[49] Fix | Delete
$defaults['avatar_size'] = 80;
[50] Fix | Delete
return $defaults;
[51] Fix | Delete
}
[52] Fix | Delete
endif;
[53] Fix | Delete
[54] Fix | Delete
[55] Fix | Delete
/* Change default arguments of social widget plugin */
[56] Fix | Delete
[57] Fix | Delete
add_filter( 'mks_social_widget_modify_defaults', 'herald_social_widget_defaults' );
[58] Fix | Delete
[59] Fix | Delete
if ( !function_exists( 'herald_social_widget_defaults' ) ):
[60] Fix | Delete
function herald_social_widget_defaults( $defaults ) {
[61] Fix | Delete
$defaults['size'] = 44;
[62] Fix | Delete
$defaults['style'] = 'circle';
[63] Fix | Delete
return $defaults;
[64] Fix | Delete
}
[65] Fix | Delete
endif;
[66] Fix | Delete
[67] Fix | Delete
[68] Fix | Delete
/* Show admin notices */
[69] Fix | Delete
[70] Fix | Delete
add_action( 'admin_init', 'herald_check_installation' );
[71] Fix | Delete
[72] Fix | Delete
if ( !function_exists( 'herald_check_installation' ) ):
[73] Fix | Delete
function herald_check_installation() {
[74] Fix | Delete
add_action( 'admin_notices', 'herald_welcome_msg', 1 );
[75] Fix | Delete
add_action( 'admin_notices', 'herald_update_msg', 1 );
[76] Fix | Delete
add_action( 'admin_notices', 'herald_required_plugins_msg', 1 );
[77] Fix | Delete
}
[78] Fix | Delete
endif;
[79] Fix | Delete
[80] Fix | Delete
[81] Fix | Delete
/* Show welcome message and quick tips after theme activation */
[82] Fix | Delete
if ( !function_exists( 'herald_welcome_msg' ) ):
[83] Fix | Delete
function herald_welcome_msg() {
[84] Fix | Delete
[85] Fix | Delete
if ( get_option( 'herald_welcome_box_displayed' ) || get_option( 'merlin_herald_completed' ) ) {
[86] Fix | Delete
return false;
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
update_option( 'herald_theme_version', HERALD_THEME_VERSION );
[90] Fix | Delete
include_once get_parent_theme_file_path( '/core/admin/welcome-panel.php' );
[91] Fix | Delete
[92] Fix | Delete
}
[93] Fix | Delete
endif;
[94] Fix | Delete
[95] Fix | Delete
[96] Fix | Delete
/* Show message box after theme update */
[97] Fix | Delete
if ( !function_exists( 'herald_update_msg' ) ):
[98] Fix | Delete
function herald_update_msg() {
[99] Fix | Delete
[100] Fix | Delete
if ( !get_option( 'herald_welcome_box_displayed' ) && !get_option( 'merlin_herald_completed' ) ) {
[101] Fix | Delete
return false;
[102] Fix | Delete
}
[103] Fix | Delete
[104] Fix | Delete
$prev_version = get_option( 'herald_theme_version' );
[105] Fix | Delete
$cur_version = HERALD_THEME_VERSION;
[106] Fix | Delete
if ( $prev_version === false ) { $prev_version = '0.0.0'; }
[107] Fix | Delete
[108] Fix | Delete
if ( version_compare( $cur_version, $prev_version, '>' ) ) {
[109] Fix | Delete
include_once get_parent_theme_file_path( '/core/admin/update-panel.php' );
[110] Fix | Delete
}
[111] Fix | Delete
}
[112] Fix | Delete
endif;
[113] Fix | Delete
[114] Fix | Delete
[115] Fix | Delete
[116] Fix | Delete
/**
[117] Fix | Delete
* Display message if required plugins are not installed and activated
[118] Fix | Delete
*
[119] Fix | Delete
* @since 1.0
[120] Fix | Delete
*/
[121] Fix | Delete
[122] Fix | Delete
if ( !function_exists( 'herald_required_plugins_msg' ) ):
[123] Fix | Delete
function herald_required_plugins_msg() {
[124] Fix | Delete
[125] Fix | Delete
if ( !get_option( 'herald_welcome_box_displayed' ) && !get_option( 'merlin_herald_completed' ) ) {
[126] Fix | Delete
return false;
[127] Fix | Delete
}
[128] Fix | Delete
[129] Fix | Delete
if ( !herald_is_redux_active() ) {
[130] Fix | Delete
$class = 'notice notice-error';
[131] Fix | Delete
$message = wp_kses_post( sprintf( __( 'Important: Redux Framework plugin is required to run your theme options panel. Please visit <a href="%s">recommended plugins page</a> to install it.', 'herald' ), admin_url( 'admin.php?page=install-required-plugins' ) ) );
[132] Fix | Delete
printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
}
[136] Fix | Delete
endif;
[137] Fix | Delete
[138] Fix | Delete
[139] Fix | Delete
/* White label WP Review plugin - remove banner from options */
[140] Fix | Delete
[141] Fix | Delete
add_filter( 'wp_review_remove_branding', '__return_true' );
[142] Fix | Delete
[143] Fix | Delete
[144] Fix | Delete
/* Remove WP review for pages */
[145] Fix | Delete
[146] Fix | Delete
add_filter( 'wp_review_excluded_post_types', 'herald_wp_review_exclude_post_types' );
[147] Fix | Delete
[148] Fix | Delete
if ( !function_exists( 'herald_wp_review_exclude_post_types' ) ):
[149] Fix | Delete
function herald_wp_review_exclude_post_types( $excluded ) {
[150] Fix | Delete
$excluded[] = 'page';
[151] Fix | Delete
return $excluded;
[152] Fix | Delete
}
[153] Fix | Delete
endif;
[154] Fix | Delete
[155] Fix | Delete
/* Remove WP review notice */
[156] Fix | Delete
[157] Fix | Delete
remove_action('admin_notices', 'wp_review_admin_notice');
[158] Fix | Delete
[159] Fix | Delete
[160] Fix | Delete
/* Remove WP review jQuery UI from admin pages */
[161] Fix | Delete
[162] Fix | Delete
add_action('admin_enqueue_scripts', 'herald_wp_review_exclude_admin_scripts', 99 );
[163] Fix | Delete
[164] Fix | Delete
if ( !function_exists( 'herald_wp_review_exclude_admin_scripts' ) ):
[165] Fix | Delete
function herald_wp_review_exclude_admin_scripts() {
[166] Fix | Delete
[167] Fix | Delete
if( herald_is_wp_review_active() ) {
[168] Fix | Delete
wp_dequeue_style( 'plugin_name-admin-ui-css' );
[169] Fix | Delete
wp_dequeue_style( 'wp-review-admin-ui-css' );
[170] Fix | Delete
}
[171] Fix | Delete
[172] Fix | Delete
wp_dequeue_style( 'jquery-ui.js' );
[173] Fix | Delete
[174] Fix | Delete
}
[175] Fix | Delete
endif;
[176] Fix | Delete
[177] Fix | Delete
[178] Fix | Delete
/**
[179] Fix | Delete
* Check for Additional CSS in Theme Options and transfer it to Customize -> Additional CSS
[180] Fix | Delete
*
[181] Fix | Delete
* @return void
[182] Fix | Delete
* @since 1.0.5
[183] Fix | Delete
*/
[184] Fix | Delete
add_action('admin_init','herald_patch_additional_css');
[185] Fix | Delete
[186] Fix | Delete
if ( !function_exists( 'herald_patch_additional_css' ) ) :
[187] Fix | Delete
function herald_patch_additional_css() {
[188] Fix | Delete
[189] Fix | Delete
$additional_css = herald_get_option( 'additional_css' );
[190] Fix | Delete
[191] Fix | Delete
if ( empty( $additional_css ) ) {
[192] Fix | Delete
return false;
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
global $herald_settings;
[196] Fix | Delete
[197] Fix | Delete
$herald_settings = get_option( 'herald_settings' );
[198] Fix | Delete
[199] Fix | Delete
$herald_settings['additional_css'] = '';
[200] Fix | Delete
[201] Fix | Delete
update_option( 'herald_settings', $herald_settings ) ;
[202] Fix | Delete
[203] Fix | Delete
$customize_css = wp_get_custom_css_post();
[204] Fix | Delete
[205] Fix | Delete
if ( !empty( $customize_css ) && !is_wp_error( $customize_css ) ) {
[206] Fix | Delete
$additional_css .= $customize_css->post_content;
[207] Fix | Delete
}
[208] Fix | Delete
[209] Fix | Delete
wp_update_custom_css_post($additional_css);
[210] Fix | Delete
}
[211] Fix | Delete
endif;
[212] Fix | Delete
[213] Fix | Delete
/**
[214] Fix | Delete
* Filter for social share option fields
[215] Fix | Delete
*
[216] Fix | Delete
* @param array $args - Array of default fields
[217] Fix | Delete
* @return array
[218] Fix | Delete
* @since 2.1.4
[219] Fix | Delete
*/
[220] Fix | Delete
add_filter( 'meks_ess_modify_options_fields', 'herald_social_share_option_fields_filter' );
[221] Fix | Delete
[222] Fix | Delete
if ( !function_exists( 'herald_social_share_option_fields_filter' ) ):
[223] Fix | Delete
function herald_social_share_option_fields_filter( $args ) {
[224] Fix | Delete
[225] Fix | Delete
unset( $args['location'] );
[226] Fix | Delete
unset( $args['post_type'] );
[227] Fix | Delete
unset( $args['label_share'] );
[228] Fix | Delete
[229] Fix | Delete
return $args;
[230] Fix | Delete
}
[231] Fix | Delete
endif;
[232] Fix | Delete
[233] Fix | Delete
/**
[234] Fix | Delete
* Patching for social share platforms for meks easy share plugin
[235] Fix | Delete
*
[236] Fix | Delete
* @return void
[237] Fix | Delete
* @since 2.1.4
[238] Fix | Delete
*/
[239] Fix | Delete
add_action('admin_init','herald_patch_social_share_platforms');
[240] Fix | Delete
[241] Fix | Delete
if ( !function_exists( 'herald_patch_social_share_platforms' ) ) :
[242] Fix | Delete
function herald_patch_social_share_platforms() {
[243] Fix | Delete
[244] Fix | Delete
$social_platforms = herald_get_option( 'social_share' );
[245] Fix | Delete
[246] Fix | Delete
if ( empty( $social_platforms ) ) {
[247] Fix | Delete
return false;
[248] Fix | Delete
}
[249] Fix | Delete
[250] Fix | Delete
global $herald_settings;
[251] Fix | Delete
$herald_settings = get_option( 'herald_settings' );
[252] Fix | Delete
[253] Fix | Delete
$herald_settings['social_share'] = '';
[254] Fix | Delete
update_option( 'herald_settings', $herald_settings ) ;
[255] Fix | Delete
[256] Fix | Delete
$new_platforms = array();
[257] Fix | Delete
[258] Fix | Delete
foreach ( $social_platforms as $platform => $value ) {
[259] Fix | Delete
if ( $value == '1' ) {
[260] Fix | Delete
$new_platforms['platforms'][] = $platform;
[261] Fix | Delete
}
[262] Fix | Delete
}
[263] Fix | Delete
[264] Fix | Delete
update_option( 'meks_ess_settings', $new_platforms );
[265] Fix | Delete
[266] Fix | Delete
}
[267] Fix | Delete
endif;
[268] Fix | Delete
[269] Fix | Delete
[270] Fix | Delete
/**
[271] Fix | Delete
* Add Meks dashboard widget
[272] Fix | Delete
*
[273] Fix | Delete
* @since 1.0
[274] Fix | Delete
*/
[275] Fix | Delete
[276] Fix | Delete
add_action( 'wp_dashboard_setup', 'herald_add_dashboard_widgets' );
[277] Fix | Delete
[278] Fix | Delete
if ( !function_exists( 'herald_add_dashboard_widgets' ) ):
[279] Fix | Delete
function herald_add_dashboard_widgets() {
[280] Fix | Delete
add_meta_box( 'herald_dashboard_widget', 'Meks - WordPress Themes & Plugins', 'herald_dashboard_widget_cb', 'dashboard', 'side', 'high' );
[281] Fix | Delete
}
[282] Fix | Delete
endif;
[283] Fix | Delete
[284] Fix | Delete
[285] Fix | Delete
/**
[286] Fix | Delete
* Meks dashboard widget
[287] Fix | Delete
*
[288] Fix | Delete
* @since 1.0
[289] Fix | Delete
*/
[290] Fix | Delete
if ( !function_exists( 'herald_dashboard_widget_cb' ) ):
[291] Fix | Delete
function herald_dashboard_widget_cb() {
[292] Fix | Delete
[293] Fix | Delete
$transient = 'herald_mksaw';
[294] Fix | Delete
$hide = '<style>#herald_dashboard_widget{display:none;}</style>';
[295] Fix | Delete
[296] Fix | Delete
$data = get_transient( $transient );
[297] Fix | Delete
[298] Fix | Delete
if ( $data == 'error' ) {
[299] Fix | Delete
echo $hide;
[300] Fix | Delete
return;
[301] Fix | Delete
}
[302] Fix | Delete
[303] Fix | Delete
if ( !empty( $data ) ) {
[304] Fix | Delete
echo $data;
[305] Fix | Delete
return;
[306] Fix | Delete
}
[307] Fix | Delete
[308] Fix | Delete
$url = 'https://demo.mekshq.com/mksaw.php';
[309] Fix | Delete
$args = array( 'body' => array( 'key' => md5( 'meks' ), 'theme' => 'herald' ) );
[310] Fix | Delete
$response = wp_remote_post( $url, $args );
[311] Fix | Delete
[312] Fix | Delete
if ( is_wp_error( $response ) ) {
[313] Fix | Delete
set_transient( $transient, 'error', DAY_IN_SECONDS );
[314] Fix | Delete
echo $hide;
[315] Fix | Delete
return;
[316] Fix | Delete
}
[317] Fix | Delete
[318] Fix | Delete
$json = wp_remote_retrieve_body( $response );
[319] Fix | Delete
[320] Fix | Delete
if ( empty( $json ) ) {
[321] Fix | Delete
set_transient( $transient, 'error', DAY_IN_SECONDS );
[322] Fix | Delete
echo $hide;
[323] Fix | Delete
return;
[324] Fix | Delete
}
[325] Fix | Delete
[326] Fix | Delete
$json = json_decode( $json );
[327] Fix | Delete
[328] Fix | Delete
if ( !isset( $json->data ) ) {
[329] Fix | Delete
set_transient( $transient, 'error', DAY_IN_SECONDS );
[330] Fix | Delete
echo $hide;
[331] Fix | Delete
return;
[332] Fix | Delete
}
[333] Fix | Delete
[334] Fix | Delete
set_transient( $transient, $json->data, DAY_IN_SECONDS );
[335] Fix | Delete
echo $json->data;
[336] Fix | Delete
[337] Fix | Delete
}
[338] Fix | Delete
endif;
[339] Fix | Delete
[340] Fix | Delete
?>
[341] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function