Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder
File: class-et-builder-element.php
// Ensure toggles is exist.
[7500] Fix | Delete
if ( ! isset( $this->settings_modal_toggles[ $tab_slug ]['toggles'] ) ) {
[7501] Fix | Delete
$this->settings_modal_toggles[ $tab_slug ]['toggles'] = array();
[7502] Fix | Delete
}
[7503] Fix | Delete
[7504] Fix | Delete
// Stop the process here if the toggle slug doesn't exist. It should exist before we add
[7505] Fix | Delete
// sub toggles.
[7506] Fix | Delete
if ( ! isset( $this->settings_modal_toggles[ $tab_slug ]['toggles'][ $toggle_slug ] ) ) {
[7507] Fix | Delete
return;
[7508] Fix | Delete
}
[7509] Fix | Delete
[7510] Fix | Delete
// Don't replace existing sub toggles.
[7511] Fix | Delete
$toggle = $this->settings_modal_toggles[ $tab_slug ]['toggles'][ $toggle_slug ];
[7512] Fix | Delete
$sub_toggles = isset( $toggle['sub_toggles'] ) ? $toggle['sub_toggles'] : array();
[7513] Fix | Delete
if ( ! empty( $sub_toggles ) ) {
[7514] Fix | Delete
return;
[7515] Fix | Delete
}
[7516] Fix | Delete
[7517] Fix | Delete
// Set sub toggles.
[7518] Fix | Delete
$this->settings_modal_toggles[ $tab_slug ]['toggles'][ $toggle_slug ]['sub_toggles'] = $sub_toggle_items;
[7519] Fix | Delete
[7520] Fix | Delete
// Set tabbed sub toggles status.
[7521] Fix | Delete
if ( $tabbed_subtoggles ) {
[7522] Fix | Delete
$this->settings_modal_toggles[ $tab_slug ]['toggles'][ $toggle_slug ]['tabbed_subtoggles'] = $tabbed_subtoggles;
[7523] Fix | Delete
}
[7524] Fix | Delete
[7525] Fix | Delete
// Set BB icons support status.
[7526] Fix | Delete
if ( $bb_icons_support ) {
[7527] Fix | Delete
$this->settings_modal_toggles[ $tab_slug ]['toggles'][ $toggle_slug ]['bb_icons_support'] = $bb_icons_support;
[7528] Fix | Delete
}
[7529] Fix | Delete
}
[7530] Fix | Delete
[7531] Fix | Delete
private function _get_fields() {
[7532] Fix | Delete
$this->fields = array();
[7533] Fix | Delete
[7534] Fix | Delete
$this->fields = $this->fields_unprocessed;
[7535] Fix | Delete
[7536] Fix | Delete
$this->fields = $this->process_fields( $this->fields );
[7537] Fix | Delete
[7538] Fix | Delete
$this->fields = apply_filters( 'et_builder_module_fields_' . $this->slug, $this->fields );
[7539] Fix | Delete
[7540] Fix | Delete
foreach ( $this->fields as $field_name => $field ) {
[7541] Fix | Delete
$this->fields[ $field_name ] = apply_filters('et_builder_module_fields_' . $this->slug . '_field_' . $field_name, $field );
[7542] Fix | Delete
[7543] Fix | Delete
// Option template replaces field's array configuration into string which refers to
[7544] Fix | Delete
// saved template data & template id
[7545] Fix | Delete
if ( is_array( $this->fields[ $field_name ] ) ) {
[7546] Fix | Delete
$this->fields[ $field_name ]['name'] = $field_name;
[7547] Fix | Delete
}
[7548] Fix | Delete
}
[7549] Fix | Delete
[7550] Fix | Delete
return $this->fields;
[7551] Fix | Delete
}
[7552] Fix | Delete
[7553] Fix | Delete
/**
[7554] Fix | Delete
* Checks if the field value equals its default value
[7555] Fix | Delete
*
[7556] Fix | Delete
* @param string $name Field name.
[7557] Fix | Delete
* @param mixed $value Field value.
[7558] Fix | Delete
*
[7559] Fix | Delete
* @return bool
[7560] Fix | Delete
*/
[7561] Fix | Delete
protected function _is_field_default( $name, $value ) {
[7562] Fix | Delete
if ( ! isset( $this->fields_unprocessed[ $name ] ) ) {
[7563] Fix | Delete
// field does not exist
[7564] Fix | Delete
return false;
[7565] Fix | Delete
}
[7566] Fix | Delete
[7567] Fix | Delete
$field = $this->fields_unprocessed[ $name ];
[7568] Fix | Delete
$default = self::$_->array_get( $field, 'default', '' );
[7569] Fix | Delete
$default_on_front = self::$_->array_get( $field, 'default_on_front', 'not_found' );
[7570] Fix | Delete
[7571] Fix | Delete
if ( 'not_found' !== $default_on_front ) {
[7572] Fix | Delete
return $default_on_front === $value;
[7573] Fix | Delete
}
[7574] Fix | Delete
[7575] Fix | Delete
if ( is_array( $default ) && ! empty( $default[0] ) && is_array( $default[1] ) ) {
[7576] Fix | Delete
// This is a conditional default. Let's try to resolve it.
[7577] Fix | Delete
list ( $depend_field, $conditional_defaults ) = $default;
[7578] Fix | Delete
[7579] Fix | Delete
$default_key = self::$_->array_get( $this->props, $depend_field, key( $conditional_defaults ) );
[7580] Fix | Delete
$default = self::$_->array_get( $conditional_defaults, $default_key, null );
[7581] Fix | Delete
}
[7582] Fix | Delete
[7583] Fix | Delete
return $default === $value;
[7584] Fix | Delete
}
[7585] Fix | Delete
[7586] Fix | Delete
// intended to be overridden as needed
[7587] Fix | Delete
function process_fields( $fields ) {
[7588] Fix | Delete
return apply_filters( 'et_pb_module_processed_fields', $fields, $this->slug );
[7589] Fix | Delete
}
[7590] Fix | Delete
[7591] Fix | Delete
/**
[7592] Fix | Delete
* Get the settings fields data for this element.
[7593] Fix | Delete
*
[7594] Fix | Delete
* @since 1.0
[7595] Fix | Delete
* @todo Finish documenting return value's structure.
[7596] Fix | Delete
*
[7597] Fix | Delete
* @return array[] {
[7598] Fix | Delete
* Settings Fields
[7599] Fix | Delete
*
[7600] Fix | Delete
* @type mixed[] $setting_field_key {
[7601] Fix | Delete
* Setting Field Data
[7602] Fix | Delete
*
[7603] Fix | Delete
* @type string $type Setting field type.
[7604] Fix | Delete
* @type string $id CSS id for the setting.
[7605] Fix | Delete
* @type string $label Text label for the setting. Translatable.
[7606] Fix | Delete
* @type string $description Description for the settings. Translatable.
[7607] Fix | Delete
* @type string $class Optional. Css class for the settings.
[7608] Fix | Delete
* @type string[] $affects Optional. The keys of all settings that depend on this setting.
[7609] Fix | Delete
* @type string[] $depends_on Optional. The keys of all settings that this setting depends on.
[7610] Fix | Delete
* @type string $depends_show_if Optional. Only show this setting when the settings
[7611] Fix | Delete
* on which it depends has a value equal to this.
[7612] Fix | Delete
* @type string $depends_show_if_not Optional. Only show this setting when the settings
[7613] Fix | Delete
* on which it depends has a value that is not equal to this.
[7614] Fix | Delete
* ...
[7615] Fix | Delete
* }
[7616] Fix | Delete
* ...
[7617] Fix | Delete
* }
[7618] Fix | Delete
*/
[7619] Fix | Delete
function get_fields() { return array(); }
[7620] Fix | Delete
[7621] Fix | Delete
/**
[7622] Fix | Delete
* Returns props value by provided key, if the value is empty, returns the default value
[7623] Fix | Delete
*
[7624] Fix | Delete
* @param string $prop
[7625] Fix | Delete
* @param mixed $default
[7626] Fix | Delete
*
[7627] Fix | Delete
* @return mixed|null
[7628] Fix | Delete
*/
[7629] Fix | Delete
public function prop( $prop, $default = null ) {
[7630] Fix | Delete
return et_builder_module_prop( $prop, $this->props, $default );
[7631] Fix | Delete
}
[7632] Fix | Delete
[7633] Fix | Delete
/**
[7634] Fix | Delete
* Get module defined fields + automatically generated fields
[7635] Fix | Delete
*
[7636] Fix | Delete
* @since 3.23 Add auto generate responsive settings suffix based on mobile_options parameter.
[7637] Fix | Delete
*
[7638] Fix | Delete
* @internal Added to make get_fields() lighter. Initially added during BFB's 3rd party support
[7639] Fix | Delete
*
[7640] Fix | Delete
* @return array
[7641] Fix | Delete
*/
[7642] Fix | Delete
function get_complete_fields() {
[7643] Fix | Delete
$fields = $this->get_fields();
[7644] Fix | Delete
[7645] Fix | Delete
$responsive_suffixes = array( 'tablet', 'phone', 'last_edited' );
[7646] Fix | Delete
[7647] Fix | Delete
// Loop fields and modify it if needed
[7648] Fix | Delete
foreach ( $fields as $field_name => $field ) {
[7649] Fix | Delete
// Automatically generate responsive fields
[7650] Fix | Delete
$supports_responsive = ( isset( $field['responsive'] ) && $field['responsive'] ) || ( isset( $field['mobile_options'] ) && $field['mobile_options'] );
[7651] Fix | Delete
if ( $supports_responsive ) {
[7652] Fix | Delete
// Get tab and toggle slugs value
[7653] Fix | Delete
$tab_slug = isset( $field['tab_slug'] ) ? $field['tab_slug'] : '';
[7654] Fix | Delete
$toggle_slug = isset( $field['toggle_slug'] ) ? $field['toggle_slug'] : '';
[7655] Fix | Delete
[7656] Fix | Delete
foreach ( $responsive_suffixes as $responsive_suffix ) {
[7657] Fix | Delete
$responsive_field_name = "{$field_name}_{$responsive_suffix}";
[7658] Fix | Delete
[7659] Fix | Delete
$fields[ $responsive_field_name ] = array(
[7660] Fix | Delete
'type' => 'skip',
[7661] Fix | Delete
'tab_slug' => $tab_slug,
[7662] Fix | Delete
'toggle_slug' => $toggle_slug,
[7663] Fix | Delete
);
[7664] Fix | Delete
}
[7665] Fix | Delete
}
[7666] Fix | Delete
}
[7667] Fix | Delete
[7668] Fix | Delete
// Add general fields for modules including Columns.
[7669] Fix | Delete
if ( ( ! isset( $this->type ) || 'child' !== $this->type ) || in_array( $this->slug, array( 'et_pb_column', 'et_pb_column_inner' ) ) ) {
[7670] Fix | Delete
$i18n =& self::$i18n;
[7671] Fix | Delete
[7672] Fix | Delete
if ( ! isset( $i18n['complete'] ) ) {
[7673] Fix | Delete
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
[7674] Fix | Delete
$i18n['complete'] = array(
[7675] Fix | Delete
'section' => esc_html__( 'section', 'et_builder' ),
[7676] Fix | Delete
'row' => esc_html__( 'row', 'et_builder' ),
[7677] Fix | Delete
'module' => esc_html__( 'module', 'et_builder' ),
[7678] Fix | Delete
'disabled' => array(
[7679] Fix | Delete
'label' => esc_html__( 'Disable on', 'et_builder' ),
[7680] Fix | Delete
'description' => esc_html__( 'This will disable the %1$s on selected devices', 'et_builder' ),
[7681] Fix | Delete
),
[7682] Fix | Delete
'admin' => array(
[7683] Fix | Delete
'description' => esc_html__( 'This will change the label of the module in the builder for easy identification.', 'et_builder' ),
[7684] Fix | Delete
),
[7685] Fix | Delete
'id' => array(
[7686] Fix | Delete
'label' => esc_html__( 'CSS ID', 'et_builder' ),
[7687] Fix | Delete
'description' => esc_html__( "Assign a unique CSS ID to the element which can be used to assign custom CSS styles from within your child theme or from within Divi's custom CSS inputs.", 'et_builder' ),
[7688] Fix | Delete
),
[7689] Fix | Delete
'class' => array(
[7690] Fix | Delete
'label' => esc_html__( 'CSS Class', 'et_builder' ),
[7691] Fix | Delete
'description' => esc_html__( "Assign any number of CSS Classes to the element, separated by spaces, which can be used to assign custom CSS styles from within your child theme or from within Divi's custom CSS inputs.", 'et_builder' ),
[7692] Fix | Delete
),
[7693] Fix | Delete
'' => array(),
[7694] Fix | Delete
);
[7695] Fix | Delete
// phpcs:enable
[7696] Fix | Delete
}
[7697] Fix | Delete
[7698] Fix | Delete
$disabled_on_fields = array();
[7699] Fix | Delete
[7700] Fix | Delete
$slug_labels = array(
[7701] Fix | Delete
'et_pb_section' => $i18n['complete']['section'],
[7702] Fix | Delete
'et_pb_row' => $i18n['complete']['row'],
[7703] Fix | Delete
);
[7704] Fix | Delete
[7705] Fix | Delete
$disable_label = isset( $slug_labels[ $this->slug ] ) ? $slug_labels[ $this->slug ] : $i18n['complete']['module'];
[7706] Fix | Delete
[7707] Fix | Delete
$disabled_on_fields = array(
[7708] Fix | Delete
'disabled_on' => array(
[7709] Fix | Delete
'label' => $i18n['complete']['disabled']['label'],
[7710] Fix | Delete
'description' => sprintf( $i18n['complete']['disabled']['description'], $disable_label ),
[7711] Fix | Delete
'type' => 'multiple_checkboxes',
[7712] Fix | Delete
'options' => array(
[7713] Fix | Delete
'phone' => et_builder_i18n( 'Phone' ),
[7714] Fix | Delete
'tablet' => et_builder_i18n( 'Tablet' ),
[7715] Fix | Delete
'desktop' => et_builder_i18n( 'Desktop' ),
[7716] Fix | Delete
),
[7717] Fix | Delete
'additional_att' => 'disable_on',
[7718] Fix | Delete
'option_category' => 'configuration',
[7719] Fix | Delete
'tab_slug' => 'custom_css',
[7720] Fix | Delete
'toggle_slug' => 'visibility',
[7721] Fix | Delete
),
[7722] Fix | Delete
);
[7723] Fix | Delete
[7724] Fix | Delete
$common_general_fields = array(
[7725] Fix | Delete
'admin_label' => array(
[7726] Fix | Delete
'label' => et_builder_i18n( 'Admin Label' ),
[7727] Fix | Delete
'description' => $i18n['complete']['admin']['description'],
[7728] Fix | Delete
'type' => 'text',
[7729] Fix | Delete
'option_category' => 'configuration',
[7730] Fix | Delete
'toggle_slug' => 'admin_label',
[7731] Fix | Delete
),
[7732] Fix | Delete
'module_id' => array(
[7733] Fix | Delete
'label' => $i18n['complete']['id']['label'],
[7734] Fix | Delete
'description' => $i18n['complete']['id']['description'],
[7735] Fix | Delete
'type' => 'text',
[7736] Fix | Delete
'option_category' => 'configuration',
[7737] Fix | Delete
'tab_slug' => 'custom_css',
[7738] Fix | Delete
'toggle_slug' => 'classes',
[7739] Fix | Delete
'option_class' => 'et_pb_custom_css_regular',
[7740] Fix | Delete
),
[7741] Fix | Delete
'module_class' => array(
[7742] Fix | Delete
'label' => $i18n['complete']['class']['label'],
[7743] Fix | Delete
'description' => $i18n['complete']['class']['description'],
[7744] Fix | Delete
'type' => 'text',
[7745] Fix | Delete
'option_category' => 'configuration',
[7746] Fix | Delete
'tab_slug' => 'custom_css',
[7747] Fix | Delete
'toggle_slug' => 'classes',
[7748] Fix | Delete
'option_class' => 'et_pb_custom_css_regular',
[7749] Fix | Delete
),
[7750] Fix | Delete
);
[7751] Fix | Delete
[7752] Fix | Delete
$general_fields = array_merge( $disabled_on_fields, $common_general_fields );
[7753] Fix | Delete
[7754] Fix | Delete
$fields = array_merge( $fields, apply_filters( 'et_builder_module_general_fields', $general_fields ) );
[7755] Fix | Delete
}
[7756] Fix | Delete
[7757] Fix | Delete
return $fields;
[7758] Fix | Delete
}
[7759] Fix | Delete
[7760] Fix | Delete
/**
[7761] Fix | Delete
* Get configuration for module's advanced fields. This method is meant to be overridden in module classes.
[7762] Fix | Delete
*
[7763] Fix | Delete
* @since 3.1
[7764] Fix | Delete
*
[7765] Fix | Delete
* @return array[] {@see self::$advanced_fields}
[7766] Fix | Delete
*/
[7767] Fix | Delete
public function get_advanced_fields_config() {
[7768] Fix | Delete
return $this->advanced_fields;
[7769] Fix | Delete
}
[7770] Fix | Delete
[7771] Fix | Delete
/**
[7772] Fix | Delete
* Get configuration for module's custom css fields. This method is meant to be overridden in module classes.
[7773] Fix | Delete
*
[7774] Fix | Delete
* @since 3.1
[7775] Fix | Delete
*
[7776] Fix | Delete
* @return array[] {@see self::$custom_css_fields}
[7777] Fix | Delete
*/
[7778] Fix | Delete
public function get_custom_css_fields_config() {
[7779] Fix | Delete
return $this->custom_css_fields;
[7780] Fix | Delete
}
[7781] Fix | Delete
[7782] Fix | Delete
/**
[7783] Fix | Delete
* Returns Global Presets settings
[7784] Fix | Delete
*/
[7785] Fix | Delete
public static function get_global_presets() {
[7786] Fix | Delete
return self::$global_presets_manager->get_global_presets();
[7787] Fix | Delete
}
[7788] Fix | Delete
[7789] Fix | Delete
/**
[7790] Fix | Delete
* Get custom tabs for the module's settings modal. This method is meant to be overridden in module classes.
[7791] Fix | Delete
*
[7792] Fix | Delete
* @since 3.1
[7793] Fix | Delete
*
[7794] Fix | Delete
* @return array[] {@see self::$settings_modal_tabs}
[7795] Fix | Delete
*/
[7796] Fix | Delete
public function get_settings_modal_tabs() {
[7797] Fix | Delete
return $this->settings_modal_tabs;
[7798] Fix | Delete
}
[7799] Fix | Delete
[7800] Fix | Delete
/**
[7801] Fix | Delete
* Get toggles for the module's settings modal. This method is meant to be overridden in module classes.
[7802] Fix | Delete
*
[7803] Fix | Delete
* @since 3.1
[7804] Fix | Delete
*
[7805] Fix | Delete
* @return array[] {@see self::$settings_modal_toggles}
[7806] Fix | Delete
*/
[7807] Fix | Delete
public function get_settings_modal_toggles() {
[7808] Fix | Delete
return $this->settings_modal_toggles;
[7809] Fix | Delete
}
[7810] Fix | Delete
[7811] Fix | Delete
/**
[7812] Fix | Delete
* Generate column fields.
[7813] Fix | Delete
*
[7814] Fix | Delete
* @param number $column_number number of column
[7815] Fix | Delete
* @param array $base_fields base fields for column
[7816] Fix | Delete
*
[7817] Fix | Delete
* @return array column fields
[7818] Fix | Delete
*/
[7819] Fix | Delete
function get_column_fields( $column_number = 1, $base_fields = array() ) {
[7820] Fix | Delete
$fields = array();
[7821] Fix | Delete
[7822] Fix | Delete
// Loop column's base fields
[7823] Fix | Delete
foreach ( $base_fields as $field_name => $field ) {
[7824] Fix | Delete
// Loop (number of column) times
[7825] Fix | Delete
for ( $index = 1; $index <= $column_number; $index++ ) {
[7826] Fix | Delete
// Some attribute's id is not located at the bottom of the attribute name
[7827] Fix | Delete
if ( isset( $field['has_custom_index_location'] ) && $field['has_custom_index_location'] ) {
[7828] Fix | Delete
$column_name = str_replace( '%column_index%', $index, $field_name );
[7829] Fix | Delete
} else {
[7830] Fix | Delete
$column_name = "{$field_name}_{$index}";
[7831] Fix | Delete
}
[7832] Fix | Delete
[7833] Fix | Delete
$fields[ $column_name ] = array(
[7834] Fix | Delete
'type' => 'skip',
[7835] Fix | Delete
);
[7836] Fix | Delete
[7837] Fix | Delete
// Most column field is an empty-type attribute. Non-empty attribute are likely
[7838] Fix | Delete
// attribute for computed field which needs to have suffix ID
[7839] Fix | Delete
if ( ! empty( $field ) ) {
[7840] Fix | Delete
// Append suffix to the module variable
[7841] Fix | Delete
foreach ( $field as $attr_name => $attr_value ) {
[7842] Fix | Delete
if ( 'has_custom_index_location' === $attr_name ) {
[7843] Fix | Delete
continue;
[7844] Fix | Delete
}
[7845] Fix | Delete
[7846] Fix | Delete
if ( is_array( $attr_value ) && 'computed_callback' !== $attr_name ) {
[7847] Fix | Delete
$attr_value = $this->_append_suffix( $attr_value, $index );
[7848] Fix | Delete
}
[7849] Fix | Delete
[7850] Fix | Delete
$fields[ $column_name ][ $attr_name ] = $attr_value;
[7851] Fix | Delete
}
[7852] Fix | Delete
}
[7853] Fix | Delete
}
[7854] Fix | Delete
}
[7855] Fix | Delete
[7856] Fix | Delete
return $fields;
[7857] Fix | Delete
}
[7858] Fix | Delete
[7859] Fix | Delete
/**
[7860] Fix | Delete
* Append suffix to simple array value
[7861] Fix | Delete
*
[7862] Fix | Delete
* @param array $values array value
[7863] Fix | Delete
* @param string $suffix intended suffix for output's array
[7864] Fix | Delete
*
[7865] Fix | Delete
* @return array suffixed value
[7866] Fix | Delete
*/
[7867] Fix | Delete
function _append_suffix( $values, $suffix ) {
[7868] Fix | Delete
$output = array();
[7869] Fix | Delete
[7870] Fix | Delete
foreach ( $values as $value ) {
[7871] Fix | Delete
$output[] = "{$value}_{$suffix}";
[7872] Fix | Delete
}
[7873] Fix | Delete
[7874] Fix | Delete
return $output;
[7875] Fix | Delete
}
[7876] Fix | Delete
[7877] Fix | Delete
/**
[7878] Fix | Delete
* Returns module style priority.
[7879] Fix | Delete
*
[7880] Fix | Delete
* @return int
[7881] Fix | Delete
*/
[7882] Fix | Delete
function get_style_priority() {
[7883] Fix | Delete
return $this->_style_priority;
[7884] Fix | Delete
}
[7885] Fix | Delete
[7886] Fix | Delete
function get_post_type() {
[7887] Fix | Delete
global $post, $et_builder_post_type;
[7888] Fix | Delete
[7889] Fix | Delete
if ( isset( $_POST['et_post_type'] ) && ! $et_builder_post_type ) { // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
[7890] Fix | Delete
$et_builder_post_type = sanitize_text_field( $_POST['et_post_type'] );
[7891] Fix | Delete
}
[7892] Fix | Delete
[7893] Fix | Delete
if ( is_a( $post, 'WP_POST' ) && ( is_admin() || ! isset( $et_builder_post_type ) ) ) {
[7894] Fix | Delete
return $post->post_type;
[7895] Fix | Delete
} else {
[7896] Fix | Delete
$layout_type = self::get_theme_builder_layout_type();
[7897] Fix | Delete
[7898] Fix | Delete
if ( $layout_type ) {
[7899] Fix | Delete
return $layout_type;
[7900] Fix | Delete
}
[7901] Fix | Delete
[7902] Fix | Delete
return isset( $et_builder_post_type ) ? $et_builder_post_type : 'post';
[7903] Fix | Delete
}
[7904] Fix | Delete
}
[7905] Fix | Delete
[7906] Fix | Delete
static function optimize_bb_chunk( $content ) {
[7907] Fix | Delete
if ( ! ET_BUILDER_OPTIMIZE_TEMPLATES ) {
[7908] Fix | Delete
return $content;
[7909] Fix | Delete
}
[7910] Fix | Delete
return str_replace( self::$_unique_bb_strip, '', $content );
[7911] Fix | Delete
}
[7912] Fix | Delete
[7913] Fix | Delete
static function get_unique_bb_key( $content ) {
[7914] Fix | Delete
if ( ! ET_BUILDER_OPTIMIZE_TEMPLATES ) {
[7915] Fix | Delete
return $content;
[7916] Fix | Delete
}
[7917] Fix | Delete
$content = self::optimize_bb_chunk( $content );
[7918] Fix | Delete
if ( isset( self::$_unique_bb_keys_map[ $content ] ) ) {
[7919] Fix | Delete
$key = self::$_unique_bb_keys_map[ $content ];
[7920] Fix | Delete
} else {
[7921] Fix | Delete
self::$_unique_bb_keys_values[] = $content;
[7922] Fix | Delete
$key = count( self::$_unique_bb_keys_values ) - 1;
[7923] Fix | Delete
self::$_unique_bb_keys_map[ $content ] = $key;
[7924] Fix | Delete
}
[7925] Fix | Delete
$content = "<!-- $key -->";
[7926] Fix | Delete
return $content;
[7927] Fix | Delete
}
[7928] Fix | Delete
[7929] Fix | Delete
function wrap_settings_option( $option_output, $field, $name = '' ) {
[7930] Fix | Delete
// Option template convert array field into string id; return early to prevent error
[7931] Fix | Delete
if ( is_string( $field ) ) {
[7932] Fix | Delete
return self::get_unique_bb_key( $option_output );
[7933] Fix | Delete
}
[7934] Fix | Delete
[7935] Fix | Delete
$depends = false;
[7936] Fix | Delete
$new_depends = isset( $field['show_if'] ) || isset( $field['show_if_not'] );
[7937] Fix | Delete
$depends_attr = '';
[7938] Fix | Delete
[7939] Fix | Delete
if ( ! $new_depends && ( isset( $field['depends_show_if'] ) || isset( $field['depends_show_if_not'] ) ) ) {
[7940] Fix | Delete
$depends = true;
[7941] Fix | Delete
if ( isset( $field['depends_show_if_not'] ) ) {
[7942] Fix | Delete
$depends_show_if_not = is_array( $field['depends_show_if_not'] ) ? implode( ',', $field['depends_show_if_not'] ) : $field['depends_show_if_not'];
[7943] Fix | Delete
[7944] Fix | Delete
$depends_attr = sprintf( ' data-depends_show_if_not="%s"', esc_attr( $depends_show_if_not ) );
[7945] Fix | Delete
} else {
[7946] Fix | Delete
$depends_attr = sprintf( ' data-depends_show_if="%s"', esc_attr( $field['depends_show_if'] ) );
[7947] Fix | Delete
}
[7948] Fix | Delete
}
[7949] Fix | Delete
[7950] Fix | Delete
if ( isset( $field['depends_on_responsive'] ) ) {
[7951] Fix | Delete
$depends_attr .= sprintf( ' data-depends_on_responsive="%s"', esc_attr( implode( ',', $field['depends_on_responsive'] ) ) );
[7952] Fix | Delete
}
[7953] Fix | Delete
[7954] Fix | Delete
// Overriding background color's attribute, turning it into appropriate background attributes
[7955] Fix | Delete
if ( isset( $field['type'] ) && isset( $field['name' ] ) && 'background_color' === $field['name'] && ! self::$_->array_get( $field, 'skip_background_ui' ) ) {
[7956] Fix | Delete
$field['type'] = 'background';
[7957] Fix | Delete
[7958] Fix | Delete
// Removing depends default variable which hides background color for unified background field UI
[7959] Fix | Delete
if ( isset( $field['depends_show_if'] ) ) {
[7960] Fix | Delete
unset( $field['depends_show_if'] );
[7961] Fix | Delete
}
[7962] Fix | Delete
}
[7963] Fix | Delete
[7964] Fix | Delete
$output = sprintf(
[7965] Fix | Delete
'%6$s<div class="et-pb-option et-pb-option--%10$s%1$s%2$s%3$s%8$s%9$s%12$s%13$s"%4$s tabindex="-1" data-option_name="%11$s">%5$s</div>%7$s',
[7966] Fix | Delete
( ! empty( $field['type'] ) && 'tiny_mce' === $field['type'] ? ' et-pb-option-main-content' : '' ),
[7967] Fix | Delete
$depends || $new_depends ? ' et-pb-depends' : '',
[7968] Fix | Delete
( ! empty( $field['type'] ) && 'hidden' === $field['type'] ? ' et_pb_hidden' : '' ),
[7969] Fix | Delete
( $depends ? $depends_attr : '' ),
[7970] Fix | Delete
"\n\t\t\t\t" . $option_output . "\n\t\t\t",
[7971] Fix | Delete
"\t",
[7972] Fix | Delete
"\n\n\t\t",
[7973] Fix | Delete
( ! empty( $field['type'] ) && 'hidden' === $field['type'] ? esc_attr( sprintf( ' et-pb-option-%1$s', $field['name'] ) ) : '' ),
[7974] Fix | Delete
( ! empty( $field['option_class'] ) ? ' ' . $field['option_class'] : '' ),
[7975] Fix | Delete
isset( $field['type'] ) ? esc_attr( $field['type'] ) : '',
[7976] Fix | Delete
esc_attr( $field['name'] ),
[7977] Fix | Delete
isset( $field['specialty_only'] ) && 'yes' === $field['specialty_only'] ? ' et-pb-specialty-only-option' : '',
[7978] Fix | Delete
$new_depends ? ' et-pb-new-depends' : ''
[7979] Fix | Delete
);
[7980] Fix | Delete
[7981] Fix | Delete
if ( ! empty( $field['hover'] ) ) {
[7982] Fix | Delete
if ( 'tabs' === $field['hover'] ) {
[7983] Fix | Delete
$this->last_hover_tab_field = $name;
[7984] Fix | Delete
}
[7985] Fix | Delete
$hover = $this->last_hover_tab_field;
[7986] Fix | Delete
if ( $hover ) {
[7987] Fix | Delete
$begin = '<div class="et-pb-option ';
[7988] Fix | Delete
$pos = strpos( $output, $begin );
[7989] Fix | Delete
if ( $pos >= 0 ) {
[7990] Fix | Delete
$output = substr_replace(
[7991] Fix | Delete
$output,
[7992] Fix | Delete
"<div data-depends_hover=\"$hover\" class=\"et-pb-option-standard et-pb-option ",
[7993] Fix | Delete
$pos,
[7994] Fix | Delete
strlen( $begin )
[7995] Fix | Delete
);
[7996] Fix | Delete
}
[7997] Fix | Delete
}
[7998] Fix | Delete
}
[7999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function