: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$current_theme = et_core_get_theme_info( 'Name' );
if ( ! in_array( $current_theme, array_keys( $themes ) ) ) {
$theme_version = et_core_get_theme_info( 'Version' );
if ( version_compare( $theme_version, $themes[ $current_theme ], '<' ) ) {
add_action( 'after_setup_theme', 'ET_Core_Logger::disable_php_notices', 9 );
add_action( 'after_setup_theme', 'ET_Core_Logger::enable_php_notices', 11 );
set_transient( 'et_core_needs_old_theme_patch', true, DAY_IN_SECONDS );
if ( ! function_exists( 'et_core_patch_core_3061' ) ):
function et_core_patch_core_3061() {
if ( '3.0.61' !== ET_CORE_VERSION ) {
if ( ! ET_Core_PageResource::can_write_to_filesystem() ) {
return; // Should we display a notice in the dashboard?
$old_file = ET_CORE_PATH . 'init.php';
$new_file = dirname( __FILE__ ) . '/init.php';
ET_Core_PageResource::startup();
if ( ! ET_Core_PageResource::$wpfs ) {
ET_Core_PageResource::$wpfs->copy( $new_file, $old_file, true, 0644 );
et_core_clear_transients();
if ( ! function_exists( 'et_core_register_admin_assets' ) ) :
* Register Core admin assets.
function et_core_register_admin_assets() {
wp_register_style( 'et-core-admin', ET_CORE_URL . 'admin/css/core.css', array(), ET_CORE_VERSION );
wp_register_script( 'et-core-admin', ET_CORE_URL . 'admin/js/core.js', array(
wp_localize_script( 'et-core-admin', 'etCore', array(
'ajaxurl' => is_ssl() ? admin_url( 'admin-ajax.php' ) : admin_url( 'admin-ajax.php', 'http' ),
'modalTempContentCheck' => esc_html__( 'Got it, thanks!', ET_CORE_TEXTDOMAIN ),
// enqueue common scripts as well
et_core_register_common_assets();
add_action( 'admin_enqueue_scripts', 'et_core_register_admin_assets' );
if ( ! function_exists( 'et_core_register_common_assets' ) ) :
* Register and Enqueue Common Core assets.
function et_core_register_common_assets() {
// common.js needs to be located at footer after waypoint, fitvid, & magnific js to avoid broken javascript on Facebook in-app browser
wp_register_script( 'et-core-common', ET_CORE_URL . 'admin/js/common.js', array( 'jquery' ), ET_CORE_VERSION, true );
wp_enqueue_script( 'et-core-common' );
// common.js needs to be loaded after waypoint, fitvid, & magnific js to avoid broken javascript on Facebook in-app browser, hence the 15 priority
add_action( 'wp_enqueue_scripts', 'et_core_register_common_assets', 15 );
if ( ! function_exists( 'et_core_noconflict_styles_gform' ) ) :
* Register Core styles with Gravity Forms so that they're enqueued when running on no-conflict mode
function et_core_noconflict_styles_gform( $styles ) {
$styles[] = 'et-core-admin';
add_filter( 'gform_noconflict_styles', 'et_core_noconflict_scripts_gform' );
if ( ! function_exists( 'et_core_noconflict_scripts_gform' ) ) :
* Register Core scripts with Gravity Forms so that they're enqueued when running on no-conflict mode
function et_core_noconflict_scripts_gform( $scripts ) {
$scripts[] = 'et-core-admin';
$scripts[] = 'et-core-common';
add_filter( 'gform_noconflict_scripts', 'et_core_noconflict_scripts_gform' );
if ( ! function_exists( 'et_core_security_check' ) ):
* Check if current user can perform an action and/or verify a nonce value. die() if not authorized.
* - Check if user can 'manage_options': `et_core_security_check();`
* - Verify a nonce value: `et_core_security_check( '', 'nonce_name' );`
* - Check if user can 'something' and verify a nonce value: `self::do_security_check( 'something', 'nonce_name' );`
* @param string $user_can The name of the capability to check with `current_user_can()`.
* @param string $nonce_action The name of the nonce action to check (excluding '_nonce').
* @param string $nonce_key The key to use to lookup nonce value in `$nonce_location`. Default
* is the value of `$nonce_action` with '_nonce' appended to it.
* @param string $nonce_location Where the nonce is stored (_POST|_GET|_REQUEST). Default: _POST.
* @param bool $die Whether or not to `die()` on failure. Default is `true`.
* @return bool|null Whether or not the checked passed if `$die` is `false`.
function et_core_security_check( $user_can = 'manage_options', $nonce_action = '', $nonce_key = '', $nonce_location = '_POST', $die = true ) {
$user_can = (string) $user_can;
$nonce_action = (string) $nonce_action;
$nonce_key = (string) $nonce_key;
if ( empty( $nonce_key ) && false === strpos( $nonce_action, '_nonce' ) ) {
$nonce_key = $nonce_action . '_nonce';
} else if ( empty( $nonce_key ) ) {
$nonce_key = $nonce_action;
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
switch( $nonce_location ) {
$nonce_location = $_POST;
$nonce_location = $_REQUEST;
return $die ? et_core_die() : false;
if ( is_numeric( $user_can ) ) {
// Numeric values are deprecated in current_user_can(). We do not accept them here.
} else if ( '' !== $nonce_action && empty( $nonce_location[ $nonce_key ] ) ) {
// A nonce value is required when a nonce action is provided.
} else if ( '' === $user_can && '' === $nonce_action ) {
// At least one of a capability OR a nonce action is required.
} else if ( '' !== $user_can && ! current_user_can( $user_can ) ) {
// Capability check failed.
} else if ( '' !== $nonce_action && ! wp_verify_nonce( $nonce_location[ $nonce_key ], $nonce_action ) ) {
// Nonce verification failed.
if ( $die && ! $passed ) {
if ( ! function_exists( 'et_core_security_check_passed' ) ):
* Wrapper for {@see et_core_security_check()} that disables `die()` on failure.
* @see et_core_security_check() for parameter documentation.
* @return bool Whether or not the security check passed.
function et_core_security_check_passed( $user_can = 'manage_options', $nonce_action = '', $nonce_key = '', $nonce_location = '_POST' ) {
return et_core_security_check( $user_can, $nonce_action, $nonce_key, $nonce_location, false );
if ( ! function_exists( 'et_core_setup' ) ) :
* @since 3.0.60 The `$url` param is deprecated.
* @param string $deprecated Deprecated parameter.
function et_core_setup( $deprecated = '' ) {
if ( defined( 'ET_CORE_PATH' ) ) {
$core_path = _et_core_normalize_path( trailingslashit( dirname( __FILE__ ) ) );
$theme_dir = _et_core_normalize_path( trailingslashit( realpath( get_template_directory() ) ) );
if ( 0 === strpos( $core_path, $theme_dir ) ) {
$url = get_template_directory_uri() . '/core/';
$url = plugin_dir_url( __FILE__ );
define( 'ET_CORE_PATH', $core_path );
define( 'ET_CORE_URL', $url );
define( 'ET_CORE_TEXTDOMAIN', 'et-core' );
load_theme_textdomain( 'et-core', ET_CORE_PATH . 'languages/' );
et_core_maybe_set_updated();
register_shutdown_function( 'ET_Core_PageResource::shutdown' );
if ( is_admin() || ! empty( $_GET['et_fb'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
add_action( 'admin_enqueue_scripts', 'et_core_load_main_styles' );
et_core_maybe_patch_old_theme();
if ( ! function_exists( 'et_force_edge_compatibility_mode' ) ) :
function et_force_edge_compatibility_mode() {
echo '<meta http-equiv="X-UA-Compatible" content="IE=edge">';
add_action( 'et_head_meta', 'et_force_edge_compatibility_mode' );
if ( ! function_exists( 'et_get_allowed_localization_html_elements' ) ) :
function et_get_allowed_localization_html_elements() {
$allowlisted_attributes = array(
$allowlisted_attributes = apply_filters( 'et_allowed_localization_html_attributes', $allowlisted_attributes );
$elements = apply_filters( 'et_allowed_localization_html_elements', $elements );
foreach ( $elements as $tag => $attributes ) {
$elements[ $tag ] = array_merge( $attributes, $allowlisted_attributes );
if ( ! function_exists( 'et_get_safe_localization' ) ) :
function et_get_safe_localization( $string ) {
return apply_filters( 'et_get_safe_localization', wp_kses( $string, et_get_allowed_localization_html_elements() ) );
if ( ! function_exists( 'et_get_theme_version' ) ) :
function et_get_theme_version() {
$theme_info = wp_get_theme();
if ( is_child_theme() ) {
$theme_info = wp_get_theme( $theme_info->parent_theme );
$theme_version = $theme_info->display( 'Version' );
if ( ! function_exists( 'et_new_core_setup') ):
function et_new_core_setup() {
$has_php_52x = -1 === version_compare( PHP_VERSION, '5.3' );
require_once ET_CORE_PATH . 'components/Updates.php';
require_once ET_CORE_PATH . 'components/init.php';
require_once ET_CORE_PATH . 'php_functions.php';
require_once ET_CORE_PATH . 'wp_functions.php';
spl_autoload_register( 'et_core_autoloader', true );
spl_autoload_register( 'et_core_autoloader', true, true );
// Initialize top-level components "group"
$hook = did_action( 'plugins_loaded' ) ? 'after_setup_theme' : 'plugins_loaded';
add_action( $hook, 'et_core_init', 9999999 );
if ( ! function_exists( 'et_core_add_crossorigin_attribute' ) ):
function et_core_add_crossorigin_attribute( $tag, $handle, $src ) {
if ( ! $handle || ! in_array( $handle, array( 'react', 'react-dom' ) ) ) {
return sprintf( '<script src="%1$s" crossorigin></script>', esc_attr( $src ) ); // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
if ( ! function_exists( 'et_core_get_version_from_filesystem' ) ):
* Get the core version from the filesystem.
* This is necessary in cases such as Version Rollback where you cannot use
* a constant from memory as it is outdated or you wish to get the version
* not from the active (latest) core but from a different one.
* @param string $core_directory
function et_core_get_version_from_filesystem( $core_directory ) {
$version_file = $core_directory . DIRECTORY_SEPARATOR . '_et_core_version.php';
if ( ! file_exists( $version_file ) ) {
if ( ! function_exists( 'et_core_replace_enqueued_style' ) ):
* Replace a style's src if it is enqueued.
* @param boolean $regex Use regex to match and replace the style src.
function et_core_replace_enqueued_style( $old_src, $new_src, $regex = false ) {
if ( empty( $styles->registered ) ) {
foreach ( $styles->registered as $style_handle => $style ) {
$match = $regex ? preg_match( $old_src, $style->src ) : $old_src === $style->src;
$style_src = $regex ? preg_replace( $old_src, $new_src, $style->src ) : $new_src;
$style_deps = isset( $style->deps ) ? $style->deps : array();
$style_ver = isset( $style->ver ) ? $style->ver : false;
$style_media = isset( $style->args ) ? $style->args : 'all';
// Deregister first, so the handle can be re-enqueued.
wp_deregister_style( $style_handle );
// Enqueue the same handle with the new src.
wp_enqueue_style( $style_handle, $style_src, $style_deps, $style_ver, $style_media );
if ( ! function_exists( 'et_core_is_safe_mode_active' ) ):
* Check whether the Support Center's Safe Mode is active
* @param false|string $product The ET theme or plugin checking for Safe Mode status.
* @see ET_Core_SupportCenter::toggle_safe_mode
function et_core_is_safe_mode_active($product=false) {
// If we're checking against a particular product, return false if the product-specific usermeta doesn't match
$product = esc_attr( $product );
if ( $product === get_user_meta( get_current_user_id(), '_et_support_center_safe_mode_product', true ) ) {
if ( 'on' === get_user_meta( get_current_user_id(), '_et_support_center_safe_mode', true ) ) {
if ( ! function_exists( 'et_core_load_component' ) ) :
* =============================
* ----->>> DEPRECATED! <<<-----
* =============================
* This function loads Core components. Components are only loaded once, even if they are called many times.
* Admin components/functions are automatically wrapped in an is_admin() check.
* @deprecated Component classes are now loaded automatically upon first use. Portability was the only component
* ever loaded by this function, so it now only handles that single use-case (for backwards compatibility).
* @param string|array $components Name of the Core component(s) to include as and indexed array.
* @return bool Always return true.
function et_core_load_component( $components ) {
static $portability_loaded = false;
if ( $portability_loaded || empty( $components ) ) {
$is_jetpack = isset( $_SERVER['HTTP_USER_AGENT'] ) && false !== strpos( $_SERVER['HTTP_USER_AGENT'], 'Jetpack' );
if ( ! $is_jetpack && ! is_admin() && empty( $_GET['et_fb'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
if ( ! class_exists( 'ET_Core_Portability', false ) ) {
include_once ET_CORE_PATH . 'components/Cache.php';
include_once ET_CORE_PATH . 'components/Portability.php';
return $portability_loaded = true;
* Is WooCommerce plugin active?
* @return bool True - if the plugin is active
if ( ! function_exists( 'et_is_woocommerce_plugin_active' ) ):
function et_is_woocommerce_plugin_active() {
return class_exists( 'WooCommerce' );