Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/core
File: init.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Load Elegant Themes Core.
[2] Fix | Delete
*
[3] Fix | Delete
* @package \ET\Core
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
[7] Fix | Delete
if ( defined( 'ET_CORE' ) ) {
[8] Fix | Delete
// Core has already been loaded.
[9] Fix | Delete
return;
[10] Fix | Delete
}
[11] Fix | Delete
[12] Fix | Delete
define( 'ET_CORE', true );
[13] Fix | Delete
[14] Fix | Delete
[15] Fix | Delete
if ( ! function_exists( '_et_core_find_latest' ) ) :
[16] Fix | Delete
/**
[17] Fix | Delete
* Find the latest version of Core currently available.
[18] Fix | Delete
*
[19] Fix | Delete
* @since 3.0.60
[20] Fix | Delete
*
[21] Fix | Delete
* @return string $core_path Absolute path to the latest version of core.
[22] Fix | Delete
*/
[23] Fix | Delete
function _et_core_find_latest( $return = 'path' ) {
[24] Fix | Delete
static $latest_core_path = null;
[25] Fix | Delete
static $latest_core_version = null;
[26] Fix | Delete
[27] Fix | Delete
if ( 'path' === $return && null !== $latest_core_path ) {
[28] Fix | Delete
return $latest_core_path;
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
if ( 'version' === $return && null !== $latest_core_version ) {
[32] Fix | Delete
return $latest_core_version;
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
$this_core_path = _et_core_normalize_path( dirname( __FILE__ ) );
[36] Fix | Delete
$content_dir = _et_core_normalize_path( WP_CONTENT_DIR );
[37] Fix | Delete
[38] Fix | Delete
include $this_core_path . '/_et_core_version.php';
[39] Fix | Delete
[40] Fix | Delete
$latest_core_path = $this_core_path;
[41] Fix | Delete
$latest_core_version = $ET_CORE_VERSION;
[42] Fix | Delete
[43] Fix | Delete
unset( $ET_CORE_VERSION );
[44] Fix | Delete
[45] Fix | Delete
$version_files = array_merge(
[46] Fix | Delete
(array) glob( "{$content_dir}/themes/*/core/_et_core_version.php" ),
[47] Fix | Delete
(array) glob( "{$content_dir}/plugins/*/core/_et_core_version.php" )
[48] Fix | Delete
);
[49] Fix | Delete
[50] Fix | Delete
foreach ( $version_files as $version_file ) {
[51] Fix | Delete
$version_file = _et_core_normalize_path( $version_file );
[52] Fix | Delete
[53] Fix | Delete
if ( ! is_file( $version_file ) || 0 === strpos( $version_file, $this_core_path ) ) {
[54] Fix | Delete
continue;
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
include_once $version_file;
[58] Fix | Delete
[59] Fix | Delete
if ( ! isset( $ET_CORE_VERSION ) ) {
[60] Fix | Delete
continue;
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
$is_greater_than = version_compare( $ET_CORE_VERSION, $latest_core_version, '>' );
[64] Fix | Delete
[65] Fix | Delete
if ( $is_greater_than && _et_core_path_belongs_to_active_product( $version_file ) ) {
[66] Fix | Delete
$latest_core_path = _et_core_normalize_path( dirname( $version_file ) );
[67] Fix | Delete
$latest_core_version = $ET_CORE_VERSION;
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
unset( $ET_CORE_VERSION );
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
if ( 'version' === $return ) {
[74] Fix | Delete
return $latest_core_version;
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
return $latest_core_path;
[78] Fix | Delete
}
[79] Fix | Delete
endif;
[80] Fix | Delete
[81] Fix | Delete
[82] Fix | Delete
if ( ! function_exists( '_et_core_path_belongs_to_active_product' ) ):
[83] Fix | Delete
/**
[84] Fix | Delete
* @private
[85] Fix | Delete
* @internal
[86] Fix | Delete
*/
[87] Fix | Delete
function _et_core_path_belongs_to_active_product( $path ) {
[88] Fix | Delete
global $wp_customize;
[89] Fix | Delete
[90] Fix | Delete
include_once ABSPATH . 'wp-admin/includes/plugin.php';
[91] Fix | Delete
[92] Fix | Delete
$theme_dir = _et_core_normalize_path( get_template_directory() );
[93] Fix | Delete
[94] Fix | Delete
// When previewing a theme the `get_template_directory()` doesn't return the directory of the previewed theme
[95] Fix | Delete
// since this function will be called earlier (before `WP_Customize_Manager` manipulates the active theme)
[96] Fix | Delete
// when loaded from plugins (e.g bloom)
[97] Fix | Delete
if ( is_a( $wp_customize, 'WP_Customize_Manager' ) && ! $wp_customize->is_theme_active() ) {
[98] Fix | Delete
$template = $wp_customize->get_template();
[99] Fix | Delete
$theme_root = get_theme_root( $template );
[100] Fix | Delete
$preview_template_directory = apply_filters( 'template_directory', "$theme_root/$template", $template, $theme_root );
[101] Fix | Delete
$theme_dir = _et_core_normalize_path( $preview_template_directory );
[102] Fix | Delete
}
[103] Fix | Delete
[104] Fix | Delete
if ( 0 === strpos( $path, $theme_dir ) ) {
[105] Fix | Delete
return true;
[106] Fix | Delete
}
[107] Fix | Delete
[108] Fix | Delete
if ( false !== strpos( $path, '/divi-builder/' ) ) {
[109] Fix | Delete
return is_plugin_active( 'divi-builder/divi-builder.php' );
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
if ( false !== strpos( $path, '/bloom/' ) ) {
[113] Fix | Delete
return is_plugin_active( 'bloom/bloom.php' );
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
if ( false !== strpos( $path, '/monarch/' ) ) {
[117] Fix | Delete
return is_plugin_active( 'monarch/monarch.php' );
[118] Fix | Delete
}
[119] Fix | Delete
[120] Fix | Delete
return false;
[121] Fix | Delete
}
[122] Fix | Delete
endif;
[123] Fix | Delete
[124] Fix | Delete
[125] Fix | Delete
if ( ! function_exists( '_et_core_load_latest' ) ):
[126] Fix | Delete
function _et_core_load_latest() {
[127] Fix | Delete
if ( defined( 'ET_CORE_VERSION' ) ) {
[128] Fix | Delete
return;
[129] Fix | Delete
}
[130] Fix | Delete
[131] Fix | Delete
$core_path = get_transient( 'et_core_path' );
[132] Fix | Delete
$version_file = $core_path ? file_exists( $core_path . '/_et_core_version.php' ) : false;
[133] Fix | Delete
$have_core_path = $core_path && $version_file && ! defined( 'ET_DEBUG' );
[134] Fix | Delete
[135] Fix | Delete
if ( $have_core_path && _et_core_path_belongs_to_active_product( $core_path ) ) {
[136] Fix | Delete
$core_version = get_transient( 'et_core_version' );
[137] Fix | Delete
$core_path_changed = false;
[138] Fix | Delete
} else {
[139] Fix | Delete
$core_path = _et_core_find_latest();
[140] Fix | Delete
$core_version = _et_core_find_latest( 'version' );
[141] Fix | Delete
$core_path_changed = true;
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
/**
[145] Fix | Delete
* Overrides ET_CORE_PATH right before its loaded.
[146] Fix | Delete
*
[147] Fix | Delete
* @since 3.0.68
[148] Fix | Delete
*
[149] Fix | Delete
* @param bool|string $core_path_override The absolute path to the core that should be loaded.
[150] Fix | Delete
*/
[151] Fix | Delete
$core_path_override = apply_filters( 'et_core_path_override', false );
[152] Fix | Delete
[153] Fix | Delete
if ( $core_path_override ) {
[154] Fix | Delete
$core_path = $core_path_override;
[155] Fix | Delete
} else if ( $core_path_changed ) {
[156] Fix | Delete
set_transient( 'et_core_path', $core_path, DAY_IN_SECONDS );
[157] Fix | Delete
set_transient( 'et_core_version', $core_version, DAY_IN_SECONDS );
[158] Fix | Delete
}
[159] Fix | Delete
[160] Fix | Delete
define( 'ET_CORE_VERSION', $core_version );
[161] Fix | Delete
[162] Fix | Delete
require_once $core_path . '/functions.php';
[163] Fix | Delete
}
[164] Fix | Delete
endif;
[165] Fix | Delete
[166] Fix | Delete
[167] Fix | Delete
if ( ! function_exists( '_et_core_normalize_path' ) ):
[168] Fix | Delete
/**
[169] Fix | Delete
* @private
[170] Fix | Delete
* @internal
[171] Fix | Delete
*/
[172] Fix | Delete
function _et_core_normalize_path( $path ) {
[173] Fix | Delete
return $path ? str_replace( '\\', '/', $path ) : '';
[174] Fix | Delete
}
[175] Fix | Delete
endif;
[176] Fix | Delete
[177] Fix | Delete
[178] Fix | Delete
_et_core_load_latest();
[179] Fix | Delete
[180] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function