: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
require_once 'module/field/Factory.php';
class ET_Builder_Settings {
protected static $_BUILDER_SETTINGS_FIELDS;
protected static $_BUILDER_SETTINGS_VALUES;
protected static $_PAGE_SETTINGS_FIELDS;
protected static $_PAGE_SETTINGS_FIELDS_META_KEY_MAP = array();
protected static $_PAGE_SETTINGS_IS_DEFAULT = array();
protected static $_PAGE_SETTINGS_VALUES;
* @var ET_Builder_Settings
protected static $_instance;
public function __construct() {
if ( null !== self::$_instance ) {
wp_die( esc_html( get_class( $this ) . 'is a singleton class. You cannot create a another instance.' ) );
$this->_register_callbacks();
protected static function _get_ab_testing_fields() {
'et_pb_enable_ab_testing' => array(
'type' => 'yes_no_button',
'on' => __( 'On', 'et_builder' ),
'off' => __( 'Off', 'et_builder' ),
'id' => 'et_pb_enable_ab_testing',
'label' => esc_html__( 'Enable Split Testing', 'et_builder' ),
'class' => 'et-pb-visible',
'et_pb_ab_bounce_rate_limit',
'et_pb_ab_stats_refresh_interval',
'et_pb_enable_shortcode_tracking',
'toggle_slug' => 'ab_testing',
'et_pb_ab_bounce_rate_limit' => array(
'id' => 'et_pb_ab_bounce_rate_limit',
'label' => esc_html__( 'Bounce Rate Limit', 'et_builder' ),
'range_settings' => array(
'depends_show_if' => 'on',
'mobile_options' => false,
'et_pb_enable_ab_testing',
'toggle_slug' => 'ab_testing',
'et_pb_ab_stats_refresh_interval' => array(
'id' => 'et_pb_ab_stats_refresh_interval',
'label' => esc_html__( 'Stats refresh interval', 'et_builder' ),
'depends_show_if' => 'on',
'hourly' => esc_html__( 'Hourly', 'et_builder' ),
'daily' => esc_html__( 'Daily', 'et_builder' ),
'et_pb_enable_ab_testing',
'toggle_slug' => 'ab_testing',
'et_pb_enable_shortcode_tracking' => array(
'type' => 'yes_no_button',
'on' => __( 'On', 'et_builder' ),
'off' => __( 'Off', 'et_builder' ),
'id' => 'et_pb_enable_shortcode_tracking',
'label' => esc_html__( 'Shortcode Tracking', 'et_builder' ),
'depends_show_if' => 'on',
'et_pb_ab_current_shortcode',
'et_pb_enable_ab_testing',
'toggle_slug' => 'ab_testing',
'et_pb_ab_current_shortcode' => array(
'id' => 'et_pb_ab_current_shortcode',
'label' => esc_html__( 'Shortcode for Tracking:', 'et_builder' ),
'readonly' => 'readonly',
'depends_show_if' => 'on',
'et_pb_enable_shortcode_tracking',
'toggle_slug' => 'ab_testing',
'et_pb_ab_subjects' => array(
'id' => 'et_pb_ab_subjects',
'toggle_slug' => 'ab_testing',
protected static function _get_builder_settings_fields() {
$builder_settings_fields = array(
'et_pb_static_css_file' => self::_get_static_css_generation_field( 'builder' ),
'et_pb_css_in_footer' => array(
'type' => 'yes_no_button',
'id' => 'et_pb_css_in_footer',
'label' => esc_html__( 'Output Styles Inline', 'et_builder' ),
'description' => esc_html__( 'With previous versions of the builder, css styles for the modules\' design settings were output inline in the footer. Enable this option to restore that behavior.', 'et_builder' ),
'on' => __( 'On', 'et_builder' ),
'off' => __( 'Off', 'et_builder' ),
'validation_type' => 'simple_text',
'tab_slug' => 'advanced',
'toggle_slug' => 'performance',
'et_pb_product_tour_global' => array(
'type' => 'yes_no_button',
'id' => 'et_pb_product_tour_global',
'label' => esc_html__( 'Product Tour', 'et_builder' ),
'description' => esc_html__( 'If enabled Product Tour will be started automatically when Visual Builder launched for the first time', 'et_builder' ),
'on' => __( 'On', 'et_builder' ),
'off' => __( 'Off', 'et_builder' ),
'validation_type' => 'simple_text',
'tab_slug' => 'advanced',
'toggle_slug' => 'product_tour',
'et_enable_bfb' => array(
'type' => 'yes_no_button',
'label' => esc_html__( 'Enable The Latest Divi Builder Experience', 'et_builder' ),
'description' => esc_html__( 'Disabling this option will load the legacy Divi Builder interface when editing a post using the classic WordPress post editor. The legacy builder lacks many features and interface improvements, but it can still be used if you are experiencing trouble with the new interface.', 'et_builder' ),
'on' => __( 'On', 'et_builder' ),
'off' => __( 'Off', 'et_builder' ),
'validation_type' => 'simple_text',
'tab_slug' => 'advanced',
'toggle_slug' => 'enable_bfb',
'main_setting_name' => 'et_bfb_settings',
'sub_setting_name' => 'enable_bfb',
'et_enable_classic_editor' => array(
'type' => 'yes_no_button',
'id' => 'et_enable_classic_editor',
'label' => esc_html__( 'Enable Classic Editor', 'et_builder' ),
'description' => esc_html__( 'Use Classic Editor instead of Gutenberg / Block Editor', 'et_builder' ),
'on' => __( 'On', 'et_builder' ),
'off' => __( 'Off', 'et_builder' ),
'validation_type' => 'simple_text',
'tab_slug' => 'advanced',
'toggle_slug' => 'enable_classic_editor',
'et_pb_post_type_integration' => array(
'type' => 'checkbox_list',
'id' => 'et_pb_post_type_integration',
'label' => esc_html__( 'Enable Divi Builder On Post Types', 'et_builder' ),
'description' => esc_html__( 'By default, the Divi Builder is only accessible on standard post types. This option lets you enable the builder on any custom post type currently registered on your website, however the builder may not be compatible with all custom post types.', 'et_builder' ),
'options' => 'ET_Builder_Settings::get_registered_post_type_options',
'default' => self::_get_post_type_options_defaults(),
'validation_type' => 'on_off_array',
'et_save_values' => true,
'tab_slug' => 'post_type_integration',
'toggle_slug' => 'performance',
// Remove "Enable Classic Editor" options for versions of WordPress
// that don't have the Gutenberg editor.
if ( version_compare( $GLOBALS['wp_version'], '5.0-beta', '<' ) ) {
unset( $builder_settings_fields['et_enable_classic_editor'] );
return $builder_settings_fields;
protected static function _get_builder_settings_in_epanel_format() {
$tabs = self::get_tabs( 'builder' );
$fields = self::get_fields( 'builder' );
$result[] = array( 'name' => 'wrap-builder', 'type' => 'contenttab-wrapstart' );
$result[] = array( 'type' => 'subnavtab-start' );
foreach ( $tabs as $tab_slug => $tab_name ) {
$tab_content_started = false;
foreach ( $fields as $field_name => $field_info ) {
if ( $field_info['tab_slug'] !== $tab_slug ) {
if ( ! $tab_content_started ) {
$result[] = array( 'name' => "builder-{$index}", 'type' => 'subnav-tab', 'desc' => $tab_name );
$tab_content[] = array( 'name' => "builder-{$index}", 'type' => 'subcontent-start' );
$tab_content_started = true;
$field_type = $field_info['type'];
if ( 'yes_no_button' === $field_type ) {
$field_type = 'checkbox2';
$tab_content[] = array_merge( $field_info, array(
'name' => $field_info['label'],
'std' => $field_info['default'],
'desc' => $field_info['description'],
'is_builder_field' => true,
if ( $tab_content_started ) {
$tab_content[] = array( 'name' => "builder-{$index}", 'type' => 'subcontent-end' );
$result[] = array( 'type' => 'subnavtab-end' );
$result = array_merge( $result, $tab_content );
$result[] = array( 'name' => 'wrap-builder', 'type' => 'contenttab-wrapend' );
protected static function _get_builder_settings_values() {
'et_pb_static_css_file' => et_get_option( 'et_pb_static_css_file', 'on' ),
'et_pb_css_in_footer' => et_get_option( 'et_pb_css_in_footer', 'off' ),
protected static function _get_page_settings_fields( $post_type = 'post' ) {
$overflow = ET_Builder_Module_Fields_Factory::get( 'Overflow' );
if ( et_pb_is_allowed( 'ab_testing' ) ) {
$fields = self::_get_ab_testing_fields();
$overflow_fields = $overflow->get_fields( array(
'tab_slug' => 'advanced',
'toggle_slug' => 'visibility',
foreach ( $overflow_fields as $field => &$definition ) {
$definition['id'] = $field;
$fields = array_merge( $fields, $overflow_fields );
$fields = array_merge( $fields, array(
'et_pb_custom_css' => array(
'id' => 'et_pb_custom_css',
'label' => et_builder_i18n( 'Custom CSS' ),
'tab_slug' => 'advanced',
'toggle_slug' => 'custom_css',
'et_pb_color_palette' => array(
'type' => 'colorpalette',
'id' => 'et_pb_color_palette',
'label' => esc_html__( 'Color Picker Color Pallete', 'et_builder' ),
'default' => implode( '|', et_pb_get_default_color_palette() ),
'toggle_slug' => 'color_palette',
'et_pb_page_gutter_width' => array(
'id' => 'et_pb_page_gutter_width',
'meta_key' => '_et_pb_gutter_width',
'label' => esc_html__( 'Gutter Width', 'et_builder' ),
'range_settings' => array(
'default' => (string) et_get_option( 'gutter_width', '3' ),
'mobile_options' => false,
'validate_unit' => false,
'toggle_slug' => 'spacing',
'et_pb_light_text_color' => array(
'id' => 'et_pb_light_text_color',
'label' => esc_html__( 'Light Text Color', 'et_builder' ),
'et_pb_dark_text_color' => array(
'id' => 'et_pb_dark_text_color',
'label' => esc_html__( 'Dark Text Color', 'et_builder' ),
'et_pb_post_settings_title' => array(
'id' => 'et_pb_post_settings_title',
'post_field' => 'post_title',
'label' => et_builder_i18n( 'Title' ),
'toggle_slug' => 'main_content',
'et_pb_post_settings_excerpt' => array(
'id' => 'et_pb_post_settings_excerpt',
'post_field' => 'post_excerpt',
'label' => 'product' === $post_type ? esc_html__( 'Short Description', 'et_builder' ) : esc_html__( 'Excerpt', 'et_builder' ),
'toggle_slug' => 'main_content',
'et_pb_post_settings_image' => array(
'id' => 'et_pb_post_settings_image',
'meta_key' => '_thumbnail_id',
// This meta must not be updated during save_post or it will overwrite
// the value set in the WP edit page....
'label' => 'product' === $post_type ? esc_html__( 'Product Image', 'et_builder' ) : esc_html__( 'Featured Image', 'et_builder' ),
'upload_button_text' => esc_attr__( 'Select', 'et_builder' ),
'choose_text' => esc_attr__( 'Set featured image', 'et_builder' ),
'update_text' => esc_attr__( 'Set As Image', 'et_builder' ),
'toggle_slug' => 'main_content',
'et_pb_post_settings_categories' => array(
'id' => 'et_pb_post_settings_categories',
'label' => esc_html__( 'Categories', 'et_builder' ),
'option_category' => 'basic_option',
'taxonomy_name' => 'category',
'renderer_options' => array(
'toggle_slug' => 'main_content',
'depends_on_post_type' => array( 'post' ),
'et_pb_post_settings_tags' => array(
'id' => 'et_pb_post_settings_tags',
'label' => esc_html__( 'Tags', 'et_builder' ),
'option_category' => 'basic_option',
'taxonomy_name' => 'post_tag',
'renderer_options' => array(
'toggle_slug' => 'main_content',
'depends_on_post_type' => array( 'post' ),
'et_pb_post_settings_project_categories' => array(
'id' => 'et_pb_post_settings_project_categories',
'label' => esc_html__( 'Categories', 'et_builder' ),
'option_category' => 'basic_option',
'post_type' => 'project',
'taxonomy_name' => 'project_category',
'renderer_options' => array(
'toggle_slug' => 'main_content',
'depends_on_post_type' => array( 'project' ),
'et_pb_post_settings_project_tags' => array(
'id' => 'et_pb_post_settings_project_tags',
'label' => esc_html__( 'Tags', 'et_builder' ),
'option_category' => 'basic_option',
'post_type' => 'project',
'taxonomy_name' => 'project_tag',
'renderer_options' => array(
'toggle_slug' => 'main_content',
'depends_on_post_type' => array( 'project' ),
'et_pb_content_area_background_color' => array(
'id' => 'et_pb_content_area_background_color',
'label' => esc_html__( 'Content Area Background Color', 'et_builder' ),
'default' => 'rgba(255,255,255,0)',
'toggle_slug' => 'background',
'depends_on_post_type' => array( 'page' ),
'et_pb_section_background_color' => array(
'id' => 'et_pb_section_background_color',
'label' => esc_html__( 'Section Background Color', 'et_builder' ),
'toggle_slug' => 'background',
'et_pb_page_z_index' => array(
'id' => 'et_pb_page_z_index',
'range_settings' => array(
'label' => esc_html__( 'Z Index', 'et_builder' ),
'tab_slug' => 'advanced',
'toggle_slug' => 'position',