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/Divi/includes/builder/plugin-c...
File: divi_layout_injector.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[2] Fix | Delete
exit; // Exit if accessed directly
[3] Fix | Delete
}
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Plugin compatibility for Divi Layout Injector
[7] Fix | Delete
*
[8] Fix | Delete
* @since 3.0.62
[9] Fix | Delete
*
[10] Fix | Delete
* @link https://elegantmarketplace.com/downloads/divi-layout-injector
[11] Fix | Delete
*/
[12] Fix | Delete
class ET_Builder_Plugin_Compat_Divi_Layout_Injector extends ET_Builder_Plugin_Compat_Base {
[13] Fix | Delete
/**
[14] Fix | Delete
* Constructor
[15] Fix | Delete
*/
[16] Fix | Delete
function __construct() {
[17] Fix | Delete
$this->plugin_id = 'divi_layout_injector/divi_layout_injector.php';
[18] Fix | Delete
[19] Fix | Delete
$this->init_hooks();
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Hook methods to WordPress
[24] Fix | Delete
*
[25] Fix | Delete
* @return void
[26] Fix | Delete
*/
[27] Fix | Delete
function init_hooks() {
[28] Fix | Delete
// Bail if there's no version found
[29] Fix | Delete
if ( ! $this->get_plugin_version() ) {
[30] Fix | Delete
return;
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
add_action( 'wp', array( $this, 'maybe_disable_in_tb' ) );
[34] Fix | Delete
add_action( 'wp', array( $this, 'maybe_filter_builder_used' ), 9 );
[35] Fix | Delete
add_action( 'updated_option', array( $this, 'updated_option_cb' ), 10, 3 );
[36] Fix | Delete
add_action( 'updated_post_meta', array( $this, 'updated_post_meta_cb' ), 10, 4 );
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Disable layout injection when editing TB layouts.
[41] Fix | Delete
*
[42] Fix | Delete
* @since 4.0
[43] Fix | Delete
*/
[44] Fix | Delete
function maybe_disable_in_tb() {
[45] Fix | Delete
if ( et_builder_tb_enabled() ) {
[46] Fix | Delete
remove_action( 'get_header', 'sb_divi_fe_record_start', 1 );
[47] Fix | Delete
remove_filter('the_content', 'sb_divi_fe_content');
[48] Fix | Delete
remove_action( 'wp_footer', 'sb_divi_fe_footer_end' );
[49] Fix | Delete
}
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
function maybe_filter_builder_used() {
[53] Fix | Delete
$types = array( 'layout', 'page' );
[54] Fix | Delete
$will_inject = is_404() && in_array( get_option( 'sb_divi_fe_404_type', 'layout' ), $types );
[55] Fix | Delete
[56] Fix | Delete
if ( is_404() ) {
[57] Fix | Delete
$override_header = et_theme_builder_overrides_layout( ET_THEME_BUILDER_HEADER_LAYOUT_POST_TYPE );
[58] Fix | Delete
$override_body = et_theme_builder_overrides_layout( ET_THEME_BUILDER_BODY_LAYOUT_POST_TYPE );
[59] Fix | Delete
$override_footer = et_theme_builder_overrides_layout( ET_THEME_BUILDER_FOOTER_LAYOUT_POST_TYPE );
[60] Fix | Delete
[61] Fix | Delete
// Remove 404 page redirect if 404 page built in Theme Builder.
[62] Fix | Delete
if ( $override_header || $override_body || $override_footer ) {
[63] Fix | Delete
remove_action( 'template_redirect', 'sb_divi_fe_404' );
[64] Fix | Delete
remove_action( 'get_header', 'sb_divi_fe_record_start', 1 );
[65] Fix | Delete
remove_filter('the_content', 'sb_divi_fe_content');
[66] Fix | Delete
remove_action( 'wp_footer', 'sb_divi_fe_footer_end' );
[67] Fix | Delete
}
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
if ( ! $will_inject ) {
[71] Fix | Delete
$will_inject = $this->will_inject_layout();
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
if ( $will_inject ) {
[75] Fix | Delete
add_filter( 'et_core_is_builder_used_on_current_request', '__return_true', 10, 0 );
[76] Fix | Delete
}
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
function updated_option_cb( $option, $old_value, $value ) {
[80] Fix | Delete
if ( 0 === strpos( $option, 'sb_divi_fe' ) ) {
[81] Fix | Delete
ET_Core_PageResource::remove_static_resources( 'all', 'all' );
[82] Fix | Delete
}
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
function updated_post_meta_cb( $meta_id, $object_id, $meta_key, $_meta_value ) {
[86] Fix | Delete
if ( 'sb_divi_fe_layout_overrides' === $meta_key ) {
[87] Fix | Delete
ET_Core_PageResource::remove_static_resources( $object_id, 'all' );
[88] Fix | Delete
}
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
function will_inject_layout() {
[92] Fix | Delete
$locations = array( 'pre-header', 'post-menu', 'pre-content', 'post-content', 'pre-footer' );
[93] Fix | Delete
[94] Fix | Delete
foreach ( $locations as $location ) {
[95] Fix | Delete
if ( sb_divi_fe_get_layout( $location ) ) {
[96] Fix | Delete
return true;
[97] Fix | Delete
}
[98] Fix | Delete
}
[99] Fix | Delete
[100] Fix | Delete
return false;
[101] Fix | Delete
}
[102] Fix | Delete
}
[103] Fix | Delete
[104] Fix | Delete
new ET_Builder_Plugin_Compat_Divi_Layout_Injector();
[105] Fix | Delete
[106] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function