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
}
[7000] Fix | Delete
}
[7001] Fix | Delete
[7002] Fix | Delete
return $fields;
[7003] Fix | Delete
}
[7004] Fix | Delete
[7005] Fix | Delete
public function get_transition_height_fields_css_props( $prefix = '' ) {
[7006] Fix | Delete
$options = self::$_->array_get( $this->advanced_fields, 'height' );
[7007] Fix | Delete
[7008] Fix | Delete
if ( ! is_array( $options ) ) {
[7009] Fix | Delete
return array();
[7010] Fix | Delete
}
[7011] Fix | Delete
[7012] Fix | Delete
$height = et_pb_height_options( $prefix );
[7013] Fix | Delete
$max_height = et_pb_max_height_options( $prefix );
[7014] Fix | Delete
$selector = self::$_->array_get( $options, 'css.main', '%%order_class%%' );
[7015] Fix | Delete
[7016] Fix | Delete
return array(
[7017] Fix | Delete
$height->get_field() => array( 'height' => $selector ),
[7018] Fix | Delete
$max_height->get_field() => array( 'max-height' => $selector ),
[7019] Fix | Delete
);
[7020] Fix | Delete
}
[7021] Fix | Delete
[7022] Fix | Delete
public function get_transition_image_fields_css_props() {
[7023] Fix | Delete
$fields = array();
[7024] Fix | Delete
$fields = array_merge( $this->get_transition_filters_fields_css_props( 'image' ), $fields );
[7025] Fix | Delete
$fields = array_merge( $this->get_transition_borders_fields_css_props( 'image' ), $fields );
[7026] Fix | Delete
$fields = array_merge( $this->get_transition_box_shadow_fields_css_props( 'image' ), $fields );
[7027] Fix | Delete
[7028] Fix | Delete
return $fields;
[7029] Fix | Delete
}
[7030] Fix | Delete
[7031] Fix | Delete
public function get_transition_button_fields_css_props() {
[7032] Fix | Delete
$buttons = self::$_->array_get( $this->advanced_fields, 'button', array() );
[7033] Fix | Delete
$fields = array();
[7034] Fix | Delete
[7035] Fix | Delete
if ( empty( $buttons ) ) {
[7036] Fix | Delete
return array();
[7037] Fix | Delete
}
[7038] Fix | Delete
[7039] Fix | Delete
foreach ( $buttons as $key => $button ) {
[7040] Fix | Delete
$selector = self::$_->array_get( $button, 'css.main', '%%order_class%%' );
[7041] Fix | Delete
[7042] Fix | Delete
$field = array(
[7043] Fix | Delete
"{$key}_text_color" => array( 'color' => $selector, ),
[7044] Fix | Delete
"{$key}_text_size" => array(
[7045] Fix | Delete
'font-size' => $selector,
[7046] Fix | Delete
'line-height' => $selector,
[7047] Fix | Delete
'padding' => $selector,
[7048] Fix | Delete
),
[7049] Fix | Delete
"{$key}_bg_color" => array( 'background-color' => $selector, ),
[7050] Fix | Delete
"{$key}_border_width" => array( 'border' => $selector, ),
[7051] Fix | Delete
"{$key}_border_color" => array( 'border' => $selector, ),
[7052] Fix | Delete
"{$key}_border_radius" => array( 'border-radius' => $selector, ),
[7053] Fix | Delete
"{$key}_letter_spacing" => array( 'letter-spacing' => $selector, ),
[7054] Fix | Delete
"{$key}text_shadow_horizontal_length" => array( 'text-shadow' => $selector, ),
[7055] Fix | Delete
"{$key}text_shadow_vertical_length" => array( 'text-shadow' => $selector, ),
[7056] Fix | Delete
"{$key}text_shadow_blur_strength" => array( 'text-shadow' => $selector, ),
[7057] Fix | Delete
"{$key}text_shadow_color" => array( 'text-shadow' => $selector, ),
[7058] Fix | Delete
"box_shadow_style_$key" => array(
[7059] Fix | Delete
'box-shadow' => implode( ', ',
[7060] Fix | Delete
array(
[7061] Fix | Delete
$selector,
[7062] Fix | Delete
$this->add_suffix_to_selectors( ' > .box-shadow-overlay', $selector ),
[7063] Fix | Delete
) ),
[7064] Fix | Delete
),
[7065] Fix | Delete
);
[7066] Fix | Delete
[7067] Fix | Delete
$fields = array_merge( $fields, $field );
[7068] Fix | Delete
}
[7069] Fix | Delete
[7070] Fix | Delete
return $fields;
[7071] Fix | Delete
}
[7072] Fix | Delete
[7073] Fix | Delete
/**
[7074] Fix | Delete
* Get transition form field CSS props.
[7075] Fix | Delete
*
[7076] Fix | Delete
* @since 3.23
[7077] Fix | Delete
*
[7078] Fix | Delete
* @return array Selector for each fields.
[7079] Fix | Delete
*/
[7080] Fix | Delete
public function get_transition_form_field_fields_css_props() {
[7081] Fix | Delete
$fields_input = self::$_->array_get( $this->advanced_fields, 'form_field', array() );
[7082] Fix | Delete
$fields = array();
[7083] Fix | Delete
[7084] Fix | Delete
// Ensure fields input is exist.
[7085] Fix | Delete
if ( empty( $fields_input ) ) {
[7086] Fix | Delete
return array();
[7087] Fix | Delete
}
[7088] Fix | Delete
[7089] Fix | Delete
foreach ( $fields_input as $key => $form_field ) {
[7090] Fix | Delete
$selector = self::$_->array_get( $form_field, 'css.main', '%%order_class%% input' );
[7091] Fix | Delete
$placeholders = "$selector::placeholder, $selector::-webkit-input-placeholder, $selector::-moz-placeholder, $selector::-ms-input-placeholder";
[7092] Fix | Delete
[7093] Fix | Delete
// Set all individual fields that need transition during hover event.
[7094] Fix | Delete
$fields = array_merge( $fields, array(
[7095] Fix | Delete
"{$key}_background_color" => array( 'background-color' => $selector ),
[7096] Fix | Delete
"{$key}_text_color" => array( 'color' => implode( ', ', array( $placeholders, $selector ) ) ),
[7097] Fix | Delete
"{$key}_focus_background_color" => array( 'background-color' => $selector ),
[7098] Fix | Delete
"{$key}_focus_text_color" => array( 'color' => implode( ', ', array( $placeholders, $selector ) ) ),
[7099] Fix | Delete
"{$key}_custom_margin" => array( 'margin' => $selector ),
[7100] Fix | Delete
"{$key}_custom_padding" => array( 'padding' => $selector ),
[7101] Fix | Delete
) );
[7102] Fix | Delete
[7103] Fix | Delete
// Merge group fields such as borders, box shadow, and text shadow.
[7104] Fix | Delete
$fields = array_merge(
[7105] Fix | Delete
$fields,
[7106] Fix | Delete
$this->get_transition_borders_fields_css_props( $key ),
[7107] Fix | Delete
$this->get_transition_borders_fields_css_props( "{$key}_focus" ),
[7108] Fix | Delete
$this->get_transition_box_shadow_fields_css_props( $key )
[7109] Fix | Delete
);
[7110] Fix | Delete
}
[7111] Fix | Delete
[7112] Fix | Delete
return $fields;
[7113] Fix | Delete
}
[7114] Fix | Delete
[7115] Fix | Delete
public function get_transition_gutter_fields_css_props() {
[7116] Fix | Delete
$gutter_selector = 'et_pb_section' === $this->slug ? '%%order_class%% .et_pb_gutter_hover *' : '%%order_class%%.et_pb_gutter_hover *';
[7117] Fix | Delete
[7118] Fix | Delete
// animate width, padding and margin if gutter width has hover options
[7119] Fix | Delete
return array(
[7120] Fix | Delete
'gutter_width' => array(
[7121] Fix | Delete
'width' => $gutter_selector,
[7122] Fix | Delete
'margin' => $gutter_selector,
[7123] Fix | Delete
'padding' => $gutter_selector,
[7124] Fix | Delete
)
[7125] Fix | Delete
);
[7126] Fix | Delete
}
[7127] Fix | Delete
[7128] Fix | Delete
/**
[7129] Fix | Delete
* Get CSS fields transition.
[7130] Fix | Delete
*
[7131] Fix | Delete
* @since 3.23 Add form field options group and background image on the fields list.
[7132] Fix | Delete
*/
[7133] Fix | Delete
public function get_transition_fields_css_props() {
[7134] Fix | Delete
$default = $this->main_css_element;
[7135] Fix | Delete
$text_main = self::$_->array_get( $this->advanced_fields, 'text.css.main', $default );
[7136] Fix | Delete
[7137] Fix | Delete
$fields = array(
[7138] Fix | Delete
'background_layout' => array( 'color' => $text_main, ),
[7139] Fix | Delete
'background' => array(
[7140] Fix | Delete
'background-color' => self::$_->array_get( $this->advanced_fields,
[7141] Fix | Delete
'background.css.main',
[7142] Fix | Delete
$default ),
[7143] Fix | Delete
'background-image' => self::$_->array_get( $this->advanced_fields,
[7144] Fix | Delete
'background.css.main',
[7145] Fix | Delete
$default ),
[7146] Fix | Delete
),
[7147] Fix | Delete
'max_width' => array( 'max-width' => $default, ),
[7148] Fix | Delete
'width' => array( 'width' => $default, ),
[7149] Fix | Delete
'text_color' => array(
[7150] Fix | Delete
'color' => self::$_->array_get( $this->advanced_fields,
[7151] Fix | Delete
'text.css.color',
[7152] Fix | Delete
$text_main ),
[7153] Fix | Delete
),
[7154] Fix | Delete
);
[7155] Fix | Delete
[7156] Fix | Delete
$fields = array_merge( $this->get_transition_filters_fields_css_props(), $fields );
[7157] Fix | Delete
$fields = array_merge( $this->get_transition_box_shadow_fields_css_props(), $fields );
[7158] Fix | Delete
$fields = array_merge( $this->get_transition_text_shadow_fields_css_props(), $fields );
[7159] Fix | Delete
$fields = array_merge( $this->get_transition_image_fields_css_props(), $fields );
[7160] Fix | Delete
$fields = array_merge( $this->get_transition_borders_fields_css_props(), $fields );
[7161] Fix | Delete
$fields = array_merge( $this->get_transition_margin_padding_fields_css_props(), $fields );
[7162] Fix | Delete
$fields = array_merge( $this->get_transition_button_fields_css_props(), $fields );
[7163] Fix | Delete
$fields = array_merge( $this->get_transition_form_field_fields_css_props(), $fields );
[7164] Fix | Delete
$fields = array_merge( $this->get_transition_font_fields_css_props(), $fields );
[7165] Fix | Delete
$fields = array_merge( $this->get_transition_gutter_fields_css_props(), $fields );
[7166] Fix | Delete
$fields = array_merge( $this->get_transition_height_fields_css_props(), $fields );
[7167] Fix | Delete
$fields = array_merge( $this->get_transition_transform_css_props(), $fields );
[7168] Fix | Delete
$fields = array_merge( $this->get_transition_position_css_props(), $fields );
[7169] Fix | Delete
[7170] Fix | Delete
return apply_filters( 'et_builder_hover_transitions_map', $fields );
[7171] Fix | Delete
}
[7172] Fix | Delete
[7173] Fix | Delete
/**
[7174] Fix | Delete
* Add link options fields to all modules
[7175] Fix | Delete
*
[7176] Fix | Delete
* @since 3.15.1
[7177] Fix | Delete
*/
[7178] Fix | Delete
protected function _add_link_options_fields() {
[7179] Fix | Delete
// Link Options are added by default if module has partial or full VB support
[7180] Fix | Delete
if ( $this->has_vb_support() ) {
[7181] Fix | Delete
$this->advanced_fields['link_options'] = self::$_->array_get( $this->advanced_fields, 'link_options', array() );
[7182] Fix | Delete
} else if ( ! $this->has_advanced_fields ) {
[7183] Fix | Delete
// Disable if module doesn't set advanced_fields property and has no VB support
[7184] Fix | Delete
return;
[7185] Fix | Delete
}
[7186] Fix | Delete
[7187] Fix | Delete
// Set link_options to false to disable Link options.
[7188] Fix | Delete
if ( false === self::$_->array_get( $this->advanced_fields, 'link_options' ) ) {
[7189] Fix | Delete
return;
[7190] Fix | Delete
}
[7191] Fix | Delete
[7192] Fix | Delete
// Link options settings have to be array
[7193] Fix | Delete
if ( ! is_array( self::$_->array_get( $this->advanced_fields, 'link_options' ) ) ) {
[7194] Fix | Delete
return;
[7195] Fix | Delete
}
[7196] Fix | Delete
[7197] Fix | Delete
$this->settings_modal_toggles['general']['toggles']['link_options'] = array(
[7198] Fix | Delete
'title' => et_builder_i18n( 'Link' ),
[7199] Fix | Delete
'priority' => 70,
[7200] Fix | Delete
);
[7201] Fix | Delete
[7202] Fix | Delete
$additional_options = array();
[7203] Fix | Delete
[7204] Fix | Delete
$i18n =& self::$i18n;
[7205] Fix | Delete
[7206] Fix | Delete
if ( ! isset( $i18n['link'] ) ) {
[7207] Fix | Delete
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
[7208] Fix | Delete
$i18n['link'] = array(
[7209] Fix | Delete
'url' => array(
[7210] Fix | Delete
'label' => esc_html__( 'Module Link URL', 'et_builder' ),
[7211] Fix | Delete
'description' => esc_html__( 'When clicked the module will link to this URL.', 'et_builder' ),
[7212] Fix | Delete
),
[7213] Fix | Delete
'target' => array(
[7214] Fix | Delete
'label' => esc_html__( 'Module Link Target', 'et_builder' ),
[7215] Fix | Delete
'description' => esc_html__( 'Here you can choose whether or not your link opens in a new window', 'et_builder' ),
[7216] Fix | Delete
'options' => array(
[7217] Fix | Delete
'off' => esc_html__( 'In The Same Window', 'et_builder' ),
[7218] Fix | Delete
'on' => esc_html__( 'In The New Tab', 'et_builder' ),
[7219] Fix | Delete
),
[7220] Fix | Delete
),
[7221] Fix | Delete
);
[7222] Fix | Delete
// phpcs:enable
[7223] Fix | Delete
}
[7224] Fix | Delete
[7225] Fix | Delete
// Translate the whole label as a phrase instead of replacing placeholder with section / row / module translation
[7226] Fix | Delete
// Less error prone for translator and the translation. Phrase might be structured differently in some language
[7227] Fix | Delete
switch ( $this->slug ) {
[7228] Fix | Delete
case 'et_pb_section':
[7229] Fix | Delete
$url_label = esc_html__( 'Section Link URL', 'et_builder' );
[7230] Fix | Delete
$target_label = esc_html__( 'Section Link Target', 'et_builder' );
[7231] Fix | Delete
break;
[7232] Fix | Delete
[7233] Fix | Delete
case 'et_pb_row':
[7234] Fix | Delete
case 'et_pb_row_inner':
[7235] Fix | Delete
$url_label = esc_html__( 'Row Link URL', 'et_builder' );
[7236] Fix | Delete
$target_label = esc_html__( 'Row Link Target', 'et_builder' );
[7237] Fix | Delete
break;
[7238] Fix | Delete
case 'et_pb_column':
[7239] Fix | Delete
case 'et_pb_column_inner':
[7240] Fix | Delete
$url_label = esc_html__( 'Column Link URL', 'et_builder' );
[7241] Fix | Delete
$target_label = esc_html__( 'Column Link Target', 'et_builder' );
[7242] Fix | Delete
break;
[7243] Fix | Delete
default:
[7244] Fix | Delete
$url_label = $i18n['link']['url']['label'];
[7245] Fix | Delete
$target_label = $i18n['link']['target']['label'];
[7246] Fix | Delete
break;
[7247] Fix | Delete
}
[7248] Fix | Delete
[7249] Fix | Delete
$additional_options['link_option_url'] = array(
[7250] Fix | Delete
'label' => $url_label,
[7251] Fix | Delete
'description' => $i18n['link']['url']['description'],
[7252] Fix | Delete
'type' => 'text',
[7253] Fix | Delete
'option_category' => 'configuration',
[7254] Fix | Delete
'toggle_slug' => 'link_options',
[7255] Fix | Delete
'dynamic_content' => 'url',
[7256] Fix | Delete
);
[7257] Fix | Delete
[7258] Fix | Delete
$additional_options['link_option_url_new_window'] = array(
[7259] Fix | Delete
'label' => $target_label,
[7260] Fix | Delete
'description' => $i18n['link']['target']['description'],
[7261] Fix | Delete
'type' => 'select',
[7262] Fix | Delete
'option_category' => 'configuration',
[7263] Fix | Delete
'options' => array(
[7264] Fix | Delete
'off' => $i18n['link']['target']['options']['off'],
[7265] Fix | Delete
'on' => $i18n['link']['target']['options']['on'],
[7266] Fix | Delete
),
[7267] Fix | Delete
'toggle_slug' => 'link_options',
[7268] Fix | Delete
'default_on_front' => 'off',
[7269] Fix | Delete
);
[7270] Fix | Delete
[7271] Fix | Delete
$this->_additional_fields_options = array_merge( $this->_additional_fields_options, $additional_options );
[7272] Fix | Delete
}
[7273] Fix | Delete
[7274] Fix | Delete
/**
[7275] Fix | Delete
* Get transition style.
[7276] Fix | Delete
*
[7277] Fix | Delete
* @since 3.23 Add $device parameter to support responsive settings.
[7278] Fix | Delete
*
[7279] Fix | Delete
* @param array $props
[7280] Fix | Delete
* @param string $device
[7281] Fix | Delete
*
[7282] Fix | Delete
* @return void
[7283] Fix | Delete
*/
[7284] Fix | Delete
public function get_transition_style( array $props = array(), $device = 'desktop' ) {
[7285] Fix | Delete
$duration = et_pb_transition_options()->get_duration( $this->props, $device );
[7286] Fix | Delete
$easing = et_pb_transition_options()->get_easing( $this->props, $device );
[7287] Fix | Delete
$delay = et_pb_transition_options()->get_delay( $this->props, $device );
[7288] Fix | Delete
$transition_css = array();
[7289] Fix | Delete
[7290] Fix | Delete
foreach ( $props as $prop ) {
[7291] Fix | Delete
$transition_css[] = sprintf(
[7292] Fix | Delete
'%1$s %2$s %3$s %4$s',
[7293] Fix | Delete
esc_attr( $prop ),
[7294] Fix | Delete
esc_attr( $duration ),
[7295] Fix | Delete
esc_attr( $easing ),
[7296] Fix | Delete
esc_attr( $delay )
[7297] Fix | Delete
);
[7298] Fix | Delete
}
[7299] Fix | Delete
[7300] Fix | Delete
return 'transition: ' . implode( ', ', $transition_css ) . ';';
[7301] Fix | Delete
}
[7302] Fix | Delete
[7303] Fix | Delete
function setup_hover_transitions( $function_name ) {
[7304] Fix | Delete
[7305] Fix | Delete
// List of all property names and their respective CSS property names
[7306] Fix | Delete
$transitions_map = $this->get_transition_fields_css_props();
[7307] Fix | Delete
[7308] Fix | Delete
$selectors = array();
[7309] Fix | Delete
$transitions = array();
[7310] Fix | Delete
$hover = et_pb_hover_options();
[7311] Fix | Delete
$hover_suffix = $hover->get_suffix();
[7312] Fix | Delete
$enabled_suffix = $hover->get_enabled_suffix();
[7313] Fix | Delete
[7314] Fix | Delete
// We need to loop transitions array so cases of prefixed prop names can also be caught
[7315] Fix | Delete
foreach ( $transitions_map as $prop_name => $css_props ) {
[7316] Fix | Delete
$key_hover = "{$prop_name}{$hover_suffix}";
[7317] Fix | Delete
$key_enabled = "{$prop_name}{$enabled_suffix}";
[7318] Fix | Delete
[7319] Fix | Delete
// Background is a special case because it also contains the "background_color" property
[7320] Fix | Delete
if ( 'background' === $prop_name ) {
[7321] Fix | Delete
// We can continue if hover background color is not set because it is the only animatable property
[7322] Fix | Delete
$hover_background_color_field = $hover->get_hover_field( "background_color" );
[7323] Fix | Delete
[7324] Fix | Delete
if ( empty( $this->props[$hover_background_color_field] ) ) {
[7325] Fix | Delete
continue;
[7326] Fix | Delete
}
[7327] Fix | Delete
} else if ( empty( $this->props[ $key_hover ] ) ) {
[7328] Fix | Delete
// Continue if {property_name}__hover is empty (ie. no hover value is set)
[7329] Fix | Delete
continue;
[7330] Fix | Delete
}
[7331] Fix | Delete
[7332] Fix | Delete
// Continue if {property_name}__hover_enabled is not defined/"on"
[7333] Fix | Delete
if ( empty( $this->props[ $key_enabled ] ) || 0 !== strpos( $this->props[ $key_enabled ], 'on' ) ) {
[7334] Fix | Delete
continue;
[7335] Fix | Delete
}
[7336] Fix | Delete
[7337] Fix | Delete
// Add the CSS property for the transition
[7338] Fix | Delete
$transitions = array_merge( $transitions, array_keys( $css_props ) );
[7339] Fix | Delete
foreach ( $css_props as $selector ) {
[7340] Fix | Delete
$selector = is_array( $selector ) ? $selector : array( $selector );
[7341] Fix | Delete
$selectors = array_merge( $selectors, $selector );
[7342] Fix | Delete
}
[7343] Fix | Delete
}
[7344] Fix | Delete
[7345] Fix | Delete
// Don't apply transitions if none are needed
[7346] Fix | Delete
if ( empty( $transitions ) ) {
[7347] Fix | Delete
return;
[7348] Fix | Delete
}
[7349] Fix | Delete
[7350] Fix | Delete
$transition_style = $this->get_transition_style( $transitions );
[7351] Fix | Delete
self::set_style( $function_name, array(
[7352] Fix | Delete
'selector' => implode( ', ', array_unique( $selectors ) ),
[7353] Fix | Delete
'declaration' => esc_html( $transition_style )
[7354] Fix | Delete
) );
[7355] Fix | Delete
[7356] Fix | Delete
// Tablet.
[7357] Fix | Delete
$transition_style_tablet = $this->get_transition_style( $transitions, 'tablet' );
[7358] Fix | Delete
if ( $transition_style_tablet !== $transition_style ) {
[7359] Fix | Delete
self::set_style( $function_name, array(
[7360] Fix | Delete
'selector' => implode( ', ', array_unique( $selectors ) ),
[7361] Fix | Delete
'declaration' => esc_html( $transition_style_tablet ),
[7362] Fix | Delete
'media_query' => ET_Builder_Element::get_media_query( 'max_width_980' ),
[7363] Fix | Delete
) );
[7364] Fix | Delete
}
[7365] Fix | Delete
[7366] Fix | Delete
// Phone.
[7367] Fix | Delete
$transition_style_phone = $this->get_transition_style( $transitions, 'phone' );
[7368] Fix | Delete
if ( $transition_style_phone !== $transition_style || $transition_style_phone !== $transition_style_tablet ) {
[7369] Fix | Delete
self::set_style( $function_name, array(
[7370] Fix | Delete
'selector' => implode( ', ', array_unique( $selectors ) ),
[7371] Fix | Delete
'declaration' => esc_html( $transition_style_phone ),
[7372] Fix | Delete
'media_query' => ET_Builder_Element::get_media_query( 'max_width_767' ),
[7373] Fix | Delete
) );
[7374] Fix | Delete
}
[7375] Fix | Delete
}
[7376] Fix | Delete
[7377] Fix | Delete
protected function _add_custom_css_fields() {
[7378] Fix | Delete
if ( isset( $this->custom_css_tab ) && ! $this->custom_css_tab ) {
[7379] Fix | Delete
return;
[7380] Fix | Delete
}
[7381] Fix | Delete
[7382] Fix | Delete
$custom_css_fields_processed = array();
[7383] Fix | Delete
$current_module_unique_class = '.' . $this->slug . '_' . "<%= typeof( module_order ) !== 'undefined' ? module_order : '<span class=\"et_pb_module_order_placeholder\"></span>' %>";
[7384] Fix | Delete
$main_css_element_output = isset( $this->main_css_element ) ? $this->main_css_element : '%%order_class%%';
[7385] Fix | Delete
$main_css_element_output = str_replace( '%%order_class%%', $current_module_unique_class, $main_css_element_output );
[7386] Fix | Delete
[7387] Fix | Delete
$custom_css_default_options = array(
[7388] Fix | Delete
'before' => array(
[7389] Fix | Delete
'label' => et_builder_i18n( 'Before' ),
[7390] Fix | Delete
'selector' => ':before',
[7391] Fix | Delete
'no_space_before_selector' => true,
[7392] Fix | Delete
),
[7393] Fix | Delete
'main_element' => array(
[7394] Fix | Delete
'label' => et_builder_i18n( 'Main Element' ),
[7395] Fix | Delete
),
[7396] Fix | Delete
'after' => array(
[7397] Fix | Delete
'label' => et_builder_i18n( 'After' ),
[7398] Fix | Delete
'selector' => ':after',
[7399] Fix | Delete
'no_space_before_selector' => true,
[7400] Fix | Delete
),
[7401] Fix | Delete
);
[7402] Fix | Delete
$custom_css_fields = apply_filters( 'et_default_custom_css_fields', $custom_css_default_options );
[7403] Fix | Delete
[7404] Fix | Delete
if ( $this->custom_css_fields = $this->get_custom_css_fields_config() ) {
[7405] Fix | Delete
$custom_css_fields = array_merge( $custom_css_fields, $this->custom_css_fields );
[7406] Fix | Delete
}
[7407] Fix | Delete
[7408] Fix | Delete
$this->custom_css_fields = apply_filters( 'et_custom_css_fields_' . $this->slug, $custom_css_fields );
[7409] Fix | Delete
[7410] Fix | Delete
// optional settings names in custom css options
[7411] Fix | Delete
$additional_option_slugs = array( 'description', 'priority' );
[7412] Fix | Delete
[7413] Fix | Delete
foreach ( $custom_css_fields as $slug => $option ) {
[7414] Fix | Delete
$selector_value = isset( $option['selector'] ) ? $option['selector'] : '';
[7415] Fix | Delete
$selector_contains_module_class = false !== strpos( $selector_value, '%%order_class%%' ) ? true : false;
[7416] Fix | Delete
$selector_output = '' !== $selector_value ? str_replace( '%%order_class%%', $current_module_unique_class, $option['selector'] ) : '';
[7417] Fix | Delete
$custom_css_fields_processed[ "custom_css_{$slug}" ] = array(
[7418] Fix | Delete
'label' => sprintf(
[7419] Fix | Delete
'%1$s:<span>%2$s%3$s%4$s</span>',
[7420] Fix | Delete
$option['label'],
[7421] Fix | Delete
! $selector_contains_module_class ? $main_css_element_output : '',
[7422] Fix | Delete
! isset( $option['no_space_before_selector'] ) && isset( $option['selector'] ) ? ' ' : '',
[7423] Fix | Delete
$selector_output
[7424] Fix | Delete
),
[7425] Fix | Delete
'type' => 'custom_css',
[7426] Fix | Delete
'tab_slug' => 'custom_css',
[7427] Fix | Delete
'toggle_slug' => 'custom_css',
[7428] Fix | Delete
'option_category' => 'layout',
[7429] Fix | Delete
'no_colon' => true,
[7430] Fix | Delete
);
[7431] Fix | Delete
[7432] Fix | Delete
// update toggle slug and option category for $this->custom_css_fields
[7433] Fix | Delete
$this->custom_css_fields[ $slug ]['toggle_slug'] = 'custom_css';
[7434] Fix | Delete
$this->custom_css_fields[ $slug ]['option_category'] = 'layout';
[7435] Fix | Delete
[7436] Fix | Delete
// add optional settings if needed
[7437] Fix | Delete
foreach ( $additional_option_slugs as $option_slug ) {
[7438] Fix | Delete
if ( isset( $option[ $option_slug ] ) ) {
[7439] Fix | Delete
$custom_css_fields_processed[ "custom_css_{$slug}" ][ $option_slug ] = $option[ $option_slug ];
[7440] Fix | Delete
}
[7441] Fix | Delete
}
[7442] Fix | Delete
}
[7443] Fix | Delete
[7444] Fix | Delete
if ( ! empty( $custom_css_fields_processed ) ) {
[7445] Fix | Delete
$this->fields_unprocessed = array_merge( $this->fields_unprocessed, $custom_css_fields_processed );
[7446] Fix | Delete
}
[7447] Fix | Delete
[7448] Fix | Delete
$i18n =& self::$i18n;
[7449] Fix | Delete
[7450] Fix | Delete
if ( ! isset( $i18n['css'] ) ) {
[7451] Fix | Delete
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
[7452] Fix | Delete
$i18n['css'] = array(
[7453] Fix | Delete
'classes' => esc_html__( 'CSS ID &amp; Classes', 'et_builder' ),
[7454] Fix | Delete
);
[7455] Fix | Delete
// phpcs:enable
[7456] Fix | Delete
}
[7457] Fix | Delete
[7458] Fix | Delete
$default_custom_css_toggles = array(
[7459] Fix | Delete
'classes' => $i18n['css']['classes'],
[7460] Fix | Delete
'custom_css' => et_builder_i18n( 'Custom CSS' ),
[7461] Fix | Delete
);
[7462] Fix | Delete
[7463] Fix | Delete
$this->_add_settings_modal_toggles( 'custom_css', $default_custom_css_toggles );
[7464] Fix | Delete
}
[7465] Fix | Delete
[7466] Fix | Delete
protected function _add_settings_modal_toggles( $tab_slug, $toggles_array ) {
[7467] Fix | Delete
if ( ! isset( $this->settings_modal_toggles[ $tab_slug ] ) ) {
[7468] Fix | Delete
$this->settings_modal_toggles[ $tab_slug ] = array();
[7469] Fix | Delete
}
[7470] Fix | Delete
[7471] Fix | Delete
if ( ! isset( $this->settings_modal_toggles[ $tab_slug ]['toggles'] ) ) {
[7472] Fix | Delete
$this->settings_modal_toggles[ $tab_slug ]['toggles'] = array();
[7473] Fix | Delete
}
[7474] Fix | Delete
[7475] Fix | Delete
// get the only toggles which do not exist.
[7476] Fix | Delete
$processed_toggles = array_diff_key( $toggles_array, $this->settings_modal_toggles[ $tab_slug ]['toggles'] );
[7477] Fix | Delete
[7478] Fix | Delete
$this->settings_modal_toggles[ $tab_slug ]['toggles'] = array_merge( $this->settings_modal_toggles[ $tab_slug ]['toggles'], $processed_toggles );
[7479] Fix | Delete
}
[7480] Fix | Delete
[7481] Fix | Delete
/**
[7482] Fix | Delete
* Add settings under sub toggles.
[7483] Fix | Delete
*
[7484] Fix | Delete
* @since 3.23
[7485] Fix | Delete
* @since 3.26.7 Add support to set custom icons on sub toggles.
[7486] Fix | Delete
*
[7487] Fix | Delete
* @param string $tab_slug Current tab slug.
[7488] Fix | Delete
* @param string $toggle_slug Current toggle slug.
[7489] Fix | Delete
* @param array $sub_toggle_items Sub toggles settings need to be added.
[7490] Fix | Delete
* @param boolean $tabbed_subtoggles Tabbed sub toggle status.
[7491] Fix | Delete
* @param boolean $bb_icons_support BB icons support status.
[7492] Fix | Delete
*/
[7493] Fix | Delete
protected function _add_settings_modal_sub_toggles( $tab_slug, $toggle_slug, $sub_toggle_items, $tabbed_subtoggles = false, $bb_icons_support = false ) {
[7494] Fix | Delete
// Ensure tab slug is exist.
[7495] Fix | Delete
if ( ! isset( $this->settings_modal_toggles[ $tab_slug ] ) ) {
[7496] Fix | Delete
$this->settings_modal_toggles[ $tab_slug ] = array();
[7497] Fix | Delete
}
[7498] Fix | Delete
[7499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function