: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( ! defined( 'ET_BUILDER_OPTIMIZE_TEMPLATES' ) ) {
define( 'ET_BUILDER_OPTIMIZE_TEMPLATES', true );
define( 'ET_BUILDER_AJAX_TEMPLATES_AMOUNT', apply_filters( 'et_pb_templates_loading_amount', ET_BUILDER_OPTIMIZE_TEMPLATES ? 20 : 10 ) );
add_action( 'init', array( 'ET_Builder_Element', 'set_media_queries' ), 11 );
add_action( 'wp_footer', array( 'ET_Builder_Element', 'enqueue_scroll_effects_fields' ), 11 );
* Base class for all builder elements.
class ET_Builder_Element {
public $use_raw_content = false;
public $fields = array();
public $has_advanced_fields;
* See {@see deprecations.php}
protected static $_deprecations;
* Unprocessed attributes.
protected $attrs_unprocessed = array();
protected $content_unprocessed = '';
* Settings used to render the module's output.
* @since 3.1 Renamed from `$shortcode_atts` to `$props`.
* What appears inside the element. For structure elements, this will contain children
* elements. For parent modules, this will include child modules.
* @since 3.1 Renamed from `$shortcode_content` to `$content`.
* Configuration for module's wrapper and inner wrapper
public $wrapper_settings = array();
public $fields_unprocessed = array();
public $main_css_element;
public $custom_css_fields = array();
public $child_title_fallback_var;
public $post_types = array();
public $main_tabs = array();
public $used_tabs = array();
public $vb_support = 'off';
public $dbl_quote_exception_options = array( 'et_pb_font_icon', 'et_pb_button_one_icon', 'et_pb_button_two_icon', 'et_pb_button_icon', 'et_pb_content' );
public $settings_modal_tabs = array();
public $settings_modal_toggles = array();
public $featured_image_background = false;
public $classname = array();
public $help_videos = array();
public static $settings_migrations_initialized = false;
public static $setting_advanced_styles = false;
public static $uses_module_classname = array();
protected static $_fields_unprocessed = array();
protected static $_default_props = array();
// Slugs of modules for which an option template has been rebuilt.
protected static $_has_rebuilt_option_template = array();
private static $_cache = false;
private static $_unique_bb_keys_map = array();
private static $_unique_bb_keys_values = array();
private static $_unique_bb_strip = array( "\t", "\r", "\n" );
public static $_scroll_effects_fields = array(
* Number of times {@see self::render()} has been executed.
* Number of times {@see self::render()} has been executed for the shop module.
private static $_shop_render_count = 0;
* Slug of a module whose render count should also be bumped when this module's is bumped.
protected $_bumps_render_count;
* Priority number applied to some CSS rules.
protected $_style_priority;
// only needed for BB + hover
protected $is_background = false;
private $_is_official_module;
private $_is_woocommerce_module;
// uses for ligatures disabling at elements with letter-spacing CSS property
private $letter_spacing_fix_selectors = array();
* Holds module styles for the current request.
private static $styles = array();
private static $internal_modules_styles = array();
private static $prepare_internal_styles = false;
private static $internal_modules_counter = 10000;
private static $media_queries = array();
private static $modules = array();
private static $parent_modules = array();
private static $child_modules = array();
private static $woocommerce_modules = array();
private static $current_module_index = 0;
private static $structure_modules = array();
private static $structure_module_slugs = array();
private static $_module_slugs_by_post_type = array();
private static $module_icons = array();
private static $module_help_videos = array();
private static $parent_motion_effects = array();
* A stack of the current active theme builder layout post type.
protected static $theme_builder_layout = array();
// Compile list of modules that has rich editor option
protected static $has_content_modules = array();
private static $loading_backbone_templates = false;
* @var ET_Core_Data_Utils
protected static $_ = null;
* @var ET_Core_PageResource
public static $advanced_styles_manager = null;
* @var ET_Core_Data_Utils
public static $data_utils = null;
* @var ET_Builder_Module_Helper_OptionTemplate
public static $option_template = null;
public static $field_dependencies = array();
public static $can_reset_element_indexes = true;
const DEFAULT_PRIORITY = 10;
const HIDE_ON_MOBILE = 'et-hide-mobile';
protected $module_credits;
* Store various indices for modules etc.
* Module Indices By Post Type
* @type array $post_type {
* @type int|int[] $index_type Current index value(s) {
* Index Values By Module Slug
* @type int $slug Index value
protected static $_indices = array();
const INDEX_SECTION = 'section';
const INDEX_ROW_INNER = 'row_inner';
const INDEX_COLUMN = 'column';
const INDEX_COLUMN_INNER = 'column_inner';
const INDEX_MODULE = 'module';
const INDEX_MODULE_ITEM = 'module_item';
const INDEX_MODULE_ORDER = 'module_order';
const INDEX_INNER_MODULE_ORDER = 'inner_module_order';
* @var ET_Builder_Global_Presets_Settings
protected static $global_presets_manager = null;
* Flag whether the module is rendering.
protected $is_rendering = false;
* List of props keys that need to inherit the value
* Intended to be used in ET_Builder_Module_Helper_MultiViewOptions helper
public $mv_inherited_props = array();
* Background related values generated by process_advanced_background_options()
* Disabled by default; activated by setting $save_processed_background property to true
* Only gradient related value is saved right now; more can be added later if needed
protected $processed_background = array();
protected $save_processed_background = false;
* Holds active position origin/location for all devices.
protected $position_locations = array();
* Module settings that are exposed so layout block previewer can correctly render it
* despites tweaks performed to make block preview correctly aligned
protected static $layout_block_assistive_settings = array();
self::$current_module_index++;
if ( ! self::$_deprecations ) {
self::$_deprecations = require_once ET_BUILDER_DIR . 'deprecations.php';
self::$_deprecations = self::$_deprecations['classes']['\ET_Builder_Module_Blurb'];
if ( ! self::$settings_migrations_initialized ) {
self::$settings_migrations_initialized = true;
require_once 'module/settings/Migration.php';
ET_Builder_Module_Settings_Migration::init();
add_filter( 'the_content', array( get_class( $this ), 'reset_element_indexes' ), 9999 );
add_filter( 'et_builder_render_layout', array( get_class( $this ), 'reset_element_indexes' ), 9999 );
if ( self::$loading_backbone_templates || et_admin_backbone_templates_being_loaded() ) {
if ( ! self::$loading_backbone_templates ) {
self::$loading_backbone_templates = true;
$start_from = (int) sanitize_text_field( $_POST['et_templates_start_from'] );
$post_type = sanitize_text_field( $_POST['et_post_type'] );
if ( 'layout' === $post_type ) {
// need - 2 to include the et_pb_section and et_pb_row modules
$start_from = ET_Builder_Element::get_modules_count( 'page' ) - 2;
$current_module_index = self::$current_module_index - 1;
if ( ! ( $current_module_index >= $start_from && $current_module_index < ( ET_BUILDER_AJAX_TEMPLATES_AMOUNT + $start_from ) ) ) {
if ( null === self::$advanced_styles_manager && ! is_admin() && ! et_fb_is_enabled() ) {
$result = self::setup_advanced_styles_manager();
self::$advanced_styles_manager = $result['manager'];
if ( $result['add_hooks'] ) {
// Schedule callback to run in the footer so we can pass the module design styles to the page resource.
add_action( 'wp_footer', array( 'ET_Builder_Element', 'set_advanced_styles' ), 19 );
// Add filter for the resource data so we can prevent theme customizer css from being
// included with the builder css inline on first-load (since its in the head already).
add_filter( 'et_core_page_resource_get_data', array( 'ET_Builder_Element', 'filter_page_resource_data' ), 10, 3 );
if ( null === self::$data_utils ) {
self::$_ = self::$data_utils = ET_Core_Data_Utils::instance();
if ( null === self::$global_presets_manager ) {
self::$global_presets_manager = ET_Builder_Global_Presets_Settings::instance();
if ( null === self::$option_template ) {
self::$option_template = et_pb_option_template();
$this->settings_modal_tabs = $this->get_settings_modal_tabs();
$this->settings_modal_toggles = $this->get_settings_modal_toggles();
$this->custom_css_fields = $this->get_custom_css_fields_config();
$this->_set_advanced_fields_config();
$current_class = get_class( $this );
$this->_is_official_module = self::_is_official_module( $current_class );
$this->_is_woocommerce_module = self::_is_woocommerce_module( $current_class );
$this->make_options_filterable();
if ( et_fb_is_builder_ajax() ) {
// Ensure `et_fb_is_enabled` returns true while setting fields to avoid
// 3rd party modules using the function to generate different
// definitions when they are updated via the AJAX call.
add_filter( 'et_fb_is_enabled', '__return_true' );
remove_filter( 'et_fb_is_enabled', '__return_true' );
$this->set_factory_objects();
$this->_additional_fields_options = array();
// Use module cache compression only when we sure we can also decompress.
$use_compression = function_exists( 'gzinflate' ) && function_exists( 'gzdeflate' );
// Disable compression when debugging.
if ( function_exists( 'et_builder_definition_sort' ) ) {
$use_compression = false;
if ( ! empty( self::$_cache[ $slug ] ) ) {
// We got sum cache, let's use it.
$cache = self::$_cache[ $slug ];
$fields_unprocessed = array();
$fields_map = $cache['fields_unprocessed'];
// Since arrays in PHP 5.x require more memory, we have to rely (again)
// on COW (copy on write) to limit RAM usage....
if ( is_array( $fields_map ) ) {
// Old cache storage format (array)
foreach ( $fields_map as $field => $key ) {
$fields_unprocessed[ $field ] = self::$_fields_unprocessed[ $key ];
// New cache storage format (string) key1,field1\n ... keyN,fieldN
// Decompress data when possible.
if ( $use_compression ) {
$fields_map = gzinflate( $fields_map );
$fields_map = explode( "\n", $fields_map );
foreach ( $fields_map as $data ) {
list ( $key, $field ) = explode( ':', $data );
$fields_unprocessed[ $field ] = self::$_fields_unprocessed[ $key ];
$this->has_advanced_fields = ! empty( $cache['advanced_fields'] );
$this->advanced_fields = $cache['advanced_fields'];
$this->fields_unprocessed = $fields_unprocessed;
$this->settings_modal_toggles = $cache['settings_modal_toggles'];
$this->custom_css_fields = $cache['custom_css_fields'];
// Claim some RAM not needed anymore.
unset( self::$_cache[ $slug ] );
// Compute expensive stuff.
$this->_add_additional_fields();
$this->_add_custom_css_fields();
$this->_maybe_add_global_defaults();
$this->_finalize_all_fields();
// Consider caching only official modules.
if ( $this->_is_official_module && false !== self::$_cache ) {
// We got no cache, let's create it.
$fields_unprocessed = '';
// Since arrays in PHP 5.x require more memory, we can't store
// fields_unprocessed as is but have to replace values with hashes
// when saving the cache and reverse the process when loading it.
foreach( $this->fields_unprocessed as $field => $definition ) {
$key = md5( serialize( $definition ) );
$fields_unprocessed .= "$key:$field\n";
$fields_unprocessed = trim( $fields_unprocessed );
// Compress data when possible.
if ( $use_compression ) {
$fields_unprocessed = gzdeflate( $fields_unprocessed );
self::$_cache[ $slug ] = array(
'advanced_fields' => $this->advanced_fields,
'fields_unprocessed' => $fields_unprocessed,
'settings_modal_toggles' => $this->settings_modal_toggles,
'custom_css_fields' => $this->custom_css_fields,
if ( ! isset( $this->main_css_element ) ) {
$this->main_css_element = '%%order_class%%';
$this->_render_count = 0;
$this->type = isset( $this->type ) ? $this->type : '';
$this->_style_priority = (int) self::DEFAULT_PRIORITY;
if ( isset( $this->type ) && 'child' === $this->type ) {
$this->_style_priority = $this->_style_priority + 1;