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/wp-conte.../themes/Divi/core/componen.../mu-plugi...
File: SupportCenterSafeModeDisableChildThemes.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Plugin Name: Elegant Themes Support Center :: Safe Mode Child Theme Disabler
[2] Fix | Delete
* Plugin URI: http://www.elegantthemes.com
[3] Fix | Delete
* Description: When the ET Support Center's Safe Mode is activated, this Must-Use Plugin will temporarily disable any active child themes for that user.
[4] Fix | Delete
* Author: Elegant Themes
[5] Fix | Delete
* Author URI: http://www.elegantthemes.com
[6] Fix | Delete
* License: GPLv2 or later
[7] Fix | Delete
*
[8] Fix | Delete
* @package ET\Core\SupportCenter\SafeModeDisableChildThemes
[9] Fix | Delete
* @author Elegant Themes <http://www.elegantthemes.com>
[10] Fix | Delete
* @license GNU General Public License v2 <http://www.gnu.org/licenses/gpl-2.0.html>
[11] Fix | Delete
*/
[12] Fix | Delete
[13] Fix | Delete
// Quick exit if accessed directly
[14] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[15] Fix | Delete
exit;
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* Disable Child Theme (if Safe Mode is active)
[20] Fix | Delete
*
[21] Fix | Delete
* The `is_child_theme()` function returns TRUE if a child theme is active. Parent theme info can be gathered from
[22] Fix | Delete
* the child theme's settings, so in the case of an active child theme we can capture the parent theme's info and
[23] Fix | Delete
* temporarily push the parent theme as active (similar to how WP lets the user preview a theme before activation).
[24] Fix | Delete
*
[25] Fix | Delete
* @since 3.20
[26] Fix | Delete
* @since 3.23 Moved from `ET_Core_SupportCenter::maybe_disable_child_theme()` for an improved Safe Mode experience.
[27] Fix | Delete
*
[28] Fix | Delete
* @param $current_theme
[29] Fix | Delete
*
[30] Fix | Delete
* @return false|string
[31] Fix | Delete
*/
[32] Fix | Delete
function et_safe_mode_maybe_disable_child_theme( $current_theme ) {
[33] Fix | Delete
// Verbose logging: only log if `wp-config.php` has defined `ET_DEBUG='support_center'`
[34] Fix | Delete
$DEBUG_ET_SUPPORT_CENTER = defined( 'ET_DEBUG' ) && 'support_center' === ET_DEBUG;
[35] Fix | Delete
[36] Fix | Delete
if ( ! isset( $_COOKIE['et-support-center-safe-mode'] ) ) {
[37] Fix | Delete
if ( $DEBUG_ET_SUPPORT_CENTER ) {
[38] Fix | Delete
error_log( 'ET Support Center :: Safe Mode: No cookie found' );
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
return $current_theme;
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
$verify = get_option( 'et-support-center-safe-mode-verify' );
[45] Fix | Delete
[46] Fix | Delete
if ( ! $verify ) {
[47] Fix | Delete
if ( $DEBUG_ET_SUPPORT_CENTER ) {
[48] Fix | Delete
error_log( 'ET Support Center :: Safe Mode: No option found to verify cookie' );
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
return $current_theme;
[52] Fix | Delete
}
[53] Fix | Delete
[54] Fix | Delete
if ( $_COOKIE['et-support-center-safe-mode'] !== $verify ) {
[55] Fix | Delete
if ( $DEBUG_ET_SUPPORT_CENTER ) {
[56] Fix | Delete
error_log( 'ET Support Center :: Safe Mode: Cookie/Option mismatch' );
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
return $current_theme;
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
$template = get_option( 'template' );
[63] Fix | Delete
[64] Fix | Delete
if ( $template !== $current_theme ) {
[65] Fix | Delete
return $template;
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
return $current_theme;
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
add_filter( 'template', 'et_safe_mode_maybe_disable_child_theme' );
[72] Fix | Delete
add_filter( 'stylesheet', 'et_safe_mode_maybe_disable_child_theme' );
[73] Fix | Delete
[74] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function