' ); if ( $is_greater_than && _et_core_path_belongs_to_active_product( $version_file ) ) { $latest_core_path = _et_core_normalize_path( dirname( $version_file ) ); $latest_core_version = $ET_CORE_VERSION; } unset( $ET_CORE_VERSION ); } if ( 'version' === $return ) { return $latest_core_version; } return $latest_core_path; } endif; if ( ! function_exists( '_et_core_path_belongs_to_active_product' ) ): /** * @private * @internal */ function _et_core_path_belongs_to_active_product( $path ) { include_once ABSPATH . 'wp-admin/includes/plugin.php'; $theme_dir = _et_core_normalize_path( get_template_directory() ); if ( 0 === strpos( $path, $theme_dir ) ) { return true; } if ( false !== strpos( $path, '/divi-builder/' ) ) { return is_plugin_active( 'divi-builder/divi-builder.php' ); } if ( false !== strpos( $path, '/bloom/' ) ) { return is_plugin_active( 'bloom/bloom.php' ); } if ( false !== strpos( $path, '/monarch/' ) ) { return is_plugin_active( 'monarch/monarch.php' ); } return false; } endif; if ( ! function_exists( '_et_core_load_latest' ) ): function _et_core_load_latest() { if ( defined( 'ET_CORE_VERSION' ) ) { return; } $core_path = get_site_transient( 'et_core_path' ); $version_file = $core_path ? file_exists( $core_path . '/_et_core_version.php' ) : false; $have_core_path = $core_path && $version_file && ! defined( 'ET_DEBUG' ); if ( $have_core_path && _et_core_path_belongs_to_active_product( $core_path ) ) { $core_version = get_site_transient( 'et_core_version' ); $core_path_changed = false; } else { $core_path = _et_core_find_latest(); $core_version = _et_core_find_latest( 'version' ); $core_path_changed = true; } /** * Overrides ET_CORE_PATH right before its loaded. * * @since 3.0.68 * * @param bool|string $core_path_override The absolute path to the core that should be loaded. */ $core_path_override = apply_filters( 'et_core_path_override', false ); if ( $core_path_override ) { $core_path = $core_path_override; } else if ( $core_path_changed ) { set_site_transient( 'et_core_path', $core_path, DAY_IN_SECONDS ); set_site_transient( 'et_core_version', $core_version, DAY_IN_SECONDS ); } define( 'ET_CORE_VERSION', $core_version ); require_once $core_path . '/functions.php'; } endif; if ( ! function_exists( '_et_core_normalize_path' ) ): /** * @private * @internal */ function _et_core_normalize_path( $path ) { return $path ? str_replace( '\\', '/', $path ) : ''; } endif; _et_core_load_latest();