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
[11500] Fix | Delete
// $css_element might be an array, for example to apply the css for placeholders
[11501] Fix | Delete
if ( is_array( $css_element ) ) {
[11502] Fix | Delete
foreach( $css_element as $selector ) {
[11503] Fix | Delete
if ( $is_hover ) {
[11504] Fix | Delete
$selector = self::$_->array_get( $option_settings, 'css.hover', $this->add_hover_to_selectors( $selector, $is_hover ) );
[11505] Fix | Delete
}
[11506] Fix | Delete
[11507] Fix | Delete
self::set_style( $function_name, array(
[11508] Fix | Delete
'selector' => $selector,
[11509] Fix | Delete
'declaration' => rtrim( $style ),
[11510] Fix | Delete
'priority' => $this->_style_priority,
[11511] Fix | Delete
) );
[11512] Fix | Delete
[11513] Fix | Delete
$this->maybe_push_element_to_letter_spacing_fix_list( $selector, array( 'body.safari ', 'body.iphone ', 'body.uiwebview ' ), rtrim( $style ), $default_letter_spacing );
[11514] Fix | Delete
}
[11515] Fix | Delete
} else {
[11516] Fix | Delete
if ( $is_hover ) {
[11517] Fix | Delete
$css_element = self::$_->array_get( $option_settings, 'css.hover', $this->add_hover_to_selectors( $css_element, $is_hover ) );
[11518] Fix | Delete
}
[11519] Fix | Delete
[11520] Fix | Delete
self::set_style( $function_name, array(
[11521] Fix | Delete
'selector' => $css_element,
[11522] Fix | Delete
'declaration' => rtrim( $style ),
[11523] Fix | Delete
'priority' => $this->_style_priority,
[11524] Fix | Delete
) );
[11525] Fix | Delete
[11526] Fix | Delete
$this->maybe_push_element_to_letter_spacing_fix_list( $css_element, array( 'body.safari ', 'body.iphone ', 'body.uiwebview ' ), rtrim( $style ), $default_letter_spacing );
[11527] Fix | Delete
[11528] Fix | Delete
if ( $is_placeholder ) {
[11529] Fix | Delete
self::set_style( $function_name, array(
[11530] Fix | Delete
'selector' => $this->_maybe_add_hover_to_order_class( $css_element . '::-webkit-input-placeholder', $is_hover ),
[11531] Fix | Delete
'declaration' => rtrim( $style ),
[11532] Fix | Delete
'priority' => $this->_style_priority,
[11533] Fix | Delete
) );
[11534] Fix | Delete
[11535] Fix | Delete
self::set_style( $function_name, array(
[11536] Fix | Delete
'selector' => $this->_maybe_add_hover_to_order_class( $css_element . '::-moz-placeholder', $is_hover ),
[11537] Fix | Delete
'declaration' => rtrim( $style ),
[11538] Fix | Delete
'priority' => $this->_style_priority,
[11539] Fix | Delete
) );
[11540] Fix | Delete
[11541] Fix | Delete
self::set_style( $function_name, array(
[11542] Fix | Delete
'selector' => $this->_maybe_add_hover_to_order_class( $css_element . '::-ms-input-placeholder', $is_hover ),
[11543] Fix | Delete
'declaration' => rtrim( $style ),
[11544] Fix | Delete
'priority' => $this->_style_priority,
[11545] Fix | Delete
) );
[11546] Fix | Delete
}
[11547] Fix | Delete
}
[11548] Fix | Delete
}
[11549] Fix | Delete
}
[11550] Fix | Delete
[11551] Fix | Delete
// process mobile options
[11552] Fix | Delete
foreach( $mobile_options_slugs as $mobile_option ) {
[11553] Fix | Delete
$current_option_name = "{$option_name}_{$mobile_option}";
[11554] Fix | Delete
[11555] Fix | Delete
if ( isset( $font_options[ $current_option_name ] ) && '' !== $font_options[ $current_option_name ] ) {
[11556] Fix | Delete
$current_desktop_option = $this->remove_suffix($mobile_option);
[11557] Fix | Delete
$current_last_edited_slug = "{$option_name}_{$current_desktop_option}_last_edited";
[11558] Fix | Delete
$current_last_edited = isset( $font_options[ $current_last_edited_slug ] ) ? $font_options[ $current_last_edited_slug ] : '';
[11559] Fix | Delete
$current_responsive_status = et_pb_get_responsive_status( $current_last_edited );
[11560] Fix | Delete
[11561] Fix | Delete
// Don't print mobile styles if responsive UI isn't toggled on
[11562] Fix | Delete
if ( ! $current_responsive_status ) {
[11563] Fix | Delete
continue;
[11564] Fix | Delete
}
[11565] Fix | Delete
[11566] Fix | Delete
$current_media_query = false === strpos( $mobile_option, 'phone' ) ? 'max_width_980' : 'max_width_767';
[11567] Fix | Delete
$main_option_name = str_replace( array( '_tablet', '_phone' ), '', $mobile_option );
[11568] Fix | Delete
[11569] Fix | Delete
// 1. Generate CSS property.
[11570] Fix | Delete
$css_property = str_replace( '_', '-', $main_option_name );
[11571] Fix | Delete
if ( 'text_color' === $main_option_name ) {
[11572] Fix | Delete
$css_property = 'color';
[11573] Fix | Delete
}
[11574] Fix | Delete
[11575] Fix | Delete
// 2. Custom important.
[11576] Fix | Delete
$css_option_name = 'font-size' === $css_property ? 'size' : $css_property;
[11577] Fix | Delete
$important = in_array( $css_option_name, $important_options ) || $use_global_important ? ' !important' : '';
[11578] Fix | Delete
[11579] Fix | Delete
// As default, text color should be important on tablet and phone.
[11580] Fix | Delete
if ( 'text_color' === $main_option_name ) {
[11581] Fix | Delete
$important = ' !important';
[11582] Fix | Delete
}
[11583] Fix | Delete
[11584] Fix | Delete
// Allow specific selector tablet and mobile, simply add _tablet or _phone suffix
[11585] Fix | Delete
if ( isset( $option_settings['css'][ $mobile_option ] ) && "" !== $option_settings['css'][ $mobile_option ] ) {
[11586] Fix | Delete
$selector = $option_settings['css'][ $mobile_option ];
[11587] Fix | Delete
} elseif ( 'text_color' === $main_option_name && ! empty( $option_settings['css']['color'] ) ) {
[11588] Fix | Delete
// We define custom selector for text color as 'color', not 'text_color'.
[11589] Fix | Delete
$selector = $option_settings['css']['color'];
[11590] Fix | Delete
} elseif ( isset( $option_settings['css'][ $main_option_name ] ) || isset( $option_settings['css']['main'] ) ) {
[11591] Fix | Delete
$selector = isset( $option_settings['css'][ $main_option_name ] ) ? $option_settings['css'][ $main_option_name ] : $option_settings['css']['main'];
[11592] Fix | Delete
} elseif ( et_builder_has_limitation( 'use_limited_main' ) && ! empty( $option_settings['css']['limited_main'] ) ) {
[11593] Fix | Delete
$selector = $option_settings['css']['limited_main'];
[11594] Fix | Delete
} else {
[11595] Fix | Delete
$selector = $this->main_css_element;
[11596] Fix | Delete
}
[11597] Fix | Delete
[11598] Fix | Delete
// 3. Process value based on property name.
[11599] Fix | Delete
$text_range_inputs = array( 'font_size', 'line_height', 'letter_spacing' );
[11600] Fix | Delete
$processed_value = $font_options[ $current_option_name ];
[11601] Fix | Delete
if ( in_array( $main_option_name, $text_range_inputs ) ) {
[11602] Fix | Delete
$processed_value = et_builder_process_range_value( $font_options[ $current_option_name ] );
[11603] Fix | Delete
}
[11604] Fix | Delete
[11605] Fix | Delete
// 4. Declare CSS property, value, and important status.
[11606] Fix | Delete
if ( 'font' === $main_option_name ) {
[11607] Fix | Delete
$global_font_name = $this->get_global_setting_name( $current_option_name );
[11608] Fix | Delete
$global_font_value = ET_Global_Settings::get_value( $global_font_name );
[11609] Fix | Delete
$declaration = et_builder_set_element_font( $processed_value, ( '' !== $important ), $global_font_value );
[11610] Fix | Delete
} else {
[11611] Fix | Delete
$declaration = sprintf(
[11612] Fix | Delete
'%1$s: %2$s%3$s;',
[11613] Fix | Delete
esc_html( $css_property ),
[11614] Fix | Delete
esc_html( $processed_value ),
[11615] Fix | Delete
esc_html( $important )
[11616] Fix | Delete
);
[11617] Fix | Delete
}
[11618] Fix | Delete
[11619] Fix | Delete
// Reset font style: italic/normal, uppercase/normal/smallcaps, underline/
[11620] Fix | Delete
// linethrough. There is a case where a font option group inherit font style
[11621] Fix | Delete
// value from another font option group. Most of the time, we can't toggle
[11622] Fix | Delete
// on/off the inherited options.
[11623] Fix | Delete
if ( 'font' === $main_option_name ) {
[11624] Fix | Delete
$processed_prev_value = et_pb_responsive_options()->get_default_value( $this->props, $current_option_name );
[11625] Fix | Delete
$reset_declaration = et_builder_set_reset_font_style( $processed_value, $processed_prev_value, '' !== $important );
[11626] Fix | Delete
$declaration .= ! empty( $reset_declaration ) ? $reset_declaration : '';
[11627] Fix | Delete
}
[11628] Fix | Delete
[11629] Fix | Delete
// $selector might be an array, for example to apply the css for placeholders
[11630] Fix | Delete
if ( is_array( $selector ) ) {
[11631] Fix | Delete
foreach( $selector as $selector_item ) {
[11632] Fix | Delete
self::set_style( $function_name, array(
[11633] Fix | Delete
'selector' => $selector_item,
[11634] Fix | Delete
'declaration' => $declaration,
[11635] Fix | Delete
'priority' => $this->_style_priority,
[11636] Fix | Delete
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
[11637] Fix | Delete
) );
[11638] Fix | Delete
}
[11639] Fix | Delete
} else {
[11640] Fix | Delete
self::set_style( $function_name, array(
[11641] Fix | Delete
'selector' => $selector,
[11642] Fix | Delete
'declaration' => $declaration,
[11643] Fix | Delete
'priority' => $this->_style_priority,
[11644] Fix | Delete
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
[11645] Fix | Delete
) );
[11646] Fix | Delete
[11647] Fix | Delete
if( ! empty( $selector ) && in_array( $mobile_option, array( 'letter_spacing_phone', 'letter_spacing_tablet' ) ) ) {
[11648] Fix | Delete
switch( $mobile_option ) {
[11649] Fix | Delete
case 'letter_spacing_phone':
[11650] Fix | Delete
$css_prefix = 'body.iphone ';
[11651] Fix | Delete
break;
[11652] Fix | Delete
case 'letter_spacing_tablet':
[11653] Fix | Delete
$css_prefix = 'body.uiwebview ';
[11654] Fix | Delete
break;
[11655] Fix | Delete
}
[11656] Fix | Delete
$this->maybe_push_element_to_letter_spacing_fix_list( $selector, $css_prefix, $declaration, $default_letter_spacing );
[11657] Fix | Delete
}
[11658] Fix | Delete
[11659] Fix | Delete
if ( $is_placeholder ) {
[11660] Fix | Delete
self::set_style( $function_name, array(
[11661] Fix | Delete
'selector' => $selector . '::-webkit-input-placeholder',
[11662] Fix | Delete
'declaration' => $declaration,
[11663] Fix | Delete
'priority' => $this->_style_priority,
[11664] Fix | Delete
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
[11665] Fix | Delete
) );
[11666] Fix | Delete
[11667] Fix | Delete
self::set_style( $function_name, array(
[11668] Fix | Delete
'selector' => $selector . '::-moz-placeholder',
[11669] Fix | Delete
'declaration' => $declaration,
[11670] Fix | Delete
'priority' => $this->_style_priority,
[11671] Fix | Delete
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
[11672] Fix | Delete
) );
[11673] Fix | Delete
[11674] Fix | Delete
self::set_style( $function_name, array(
[11675] Fix | Delete
'selector' => $selector . '::-ms-input-placeholder',
[11676] Fix | Delete
'declaration' => $declaration,
[11677] Fix | Delete
'priority' => $this->_style_priority,
[11678] Fix | Delete
'media_query' => ET_Builder_Element::get_media_query( $current_media_query ),
[11679] Fix | Delete
) );
[11680] Fix | Delete
}
[11681] Fix | Delete
}
[11682] Fix | Delete
}
[11683] Fix | Delete
}
[11684] Fix | Delete
[11685] Fix | Delete
$sub_toggle = isset( $option_settings['sub_toggle'] ) ? $option_settings['sub_toggle'] : '';
[11686] Fix | Delete
[11687] Fix | Delete
// Ignore the process if the current module is Text since the process will be handled
[11688] Fix | Delete
// by the module itself.
[11689] Fix | Delete
if ( 'et_pb_text' !== $function_name ) {
[11690] Fix | Delete
[11691] Fix | Delete
// Build sub toggle selector.
[11692] Fix | Delete
$sub_toggle_selector = '';
[11693] Fix | Delete
if ( et_builder_has_limitation( 'use_limited_main' ) && ! empty( $option_settings['css']['limited_main'] ) ) {
[11694] Fix | Delete
$sub_toggle_selector = $option_settings['css']['limited_main'];
[11695] Fix | Delete
} elseif ( isset( $option_settings['css']['main'] ) ) {
[11696] Fix | Delete
$sub_toggle_selector = $option_settings['css']['main'];
[11697] Fix | Delete
}
[11698] Fix | Delete
[11699] Fix | Delete
// Additional ul and ol option slugs.
[11700] Fix | Delete
if ( in_array( $sub_toggle, array( 'ul', 'ol' ) ) ) {
[11701] Fix | Delete
$list_selector = '' !== $sub_toggle_selector ? $sub_toggle_selector : "{$this->main_css_element} {$sub_toggle}";
[11702] Fix | Delete
[11703] Fix | Delete
// Option ul / ol type.
[11704] Fix | Delete
$list_type_name = "{$option_name}_type";
[11705] Fix | Delete
$is_list_type_responsive = et_pb_responsive_options()->is_responsive_enabled( $this->props, $list_type_name );
[11706] Fix | Delete
$list_type_values = array(
[11707] Fix | Delete
'desktop' => esc_html( et_pb_responsive_options()->get_any_value( $this->props, $list_type_name, '', false, 'desktop' ) ),
[11708] Fix | Delete
'tablet' => $is_list_type_responsive ? esc_html( et_pb_responsive_options()->get_any_value( $this->props, "{$list_type_name}_tablet" ) ) : '',
[11709] Fix | Delete
'phone' => $is_list_type_responsive ? esc_html( et_pb_responsive_options()->get_any_value( $this->props, "{$list_type_name}_tablet" ) ) : '',
[11710] Fix | Delete
);
[11711] Fix | Delete
[11712] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $list_type_values, $list_selector, 'list-style-type', $function_name, ' !important;', 'select' );
[11713] Fix | Delete
[11714] Fix | Delete
// Option ul / ol position.
[11715] Fix | Delete
$list_position_name = "{$option_name}_position";
[11716] Fix | Delete
$is_list_position_responsive = et_pb_responsive_options()->is_responsive_enabled( $this->props, $list_position_name );
[11717] Fix | Delete
$list_position_values = array(
[11718] Fix | Delete
'desktop' => esc_html( et_pb_responsive_options()->get_any_value( $this->props, $list_position_name ) ),
[11719] Fix | Delete
'tablet' => $is_list_position_responsive ? esc_html( et_pb_responsive_options()->get_any_value( $this->props, "{$list_position_name}_tablet" ) ) : '',
[11720] Fix | Delete
'phone' => $is_list_position_responsive ? esc_html( et_pb_responsive_options()->get_any_value( $this->props, "{$list_position_name}_phone" ) ) : '',
[11721] Fix | Delete
);
[11722] Fix | Delete
[11723] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $list_position_values, $list_selector, 'list-style-position', $function_name, '', 'select' );
[11724] Fix | Delete
[11725] Fix | Delete
// Option ul / ol indent.
[11726] Fix | Delete
$list_indent_name = "{$option_name}_item_indent";
[11727] Fix | Delete
$is_list_indent_responsive = et_pb_responsive_options()->is_responsive_enabled( $this->props, $list_indent_name );
[11728] Fix | Delete
$list_indent_values = array(
[11729] Fix | Delete
'desktop' => esc_html( et_pb_responsive_options()->get_any_value( $this->props, $list_indent_name ) ),
[11730] Fix | Delete
'tablet' => $is_list_indent_responsive ? esc_html( et_pb_responsive_options()->get_any_value( $this->props, "{$list_indent_name}_tablet" ) ) : '',
[11731] Fix | Delete
'phone' => $is_list_indent_responsive ? esc_html( et_pb_responsive_options()->get_any_value( $this->props, "{$list_indent_name}_phone" ) ) : '',
[11732] Fix | Delete
);
[11733] Fix | Delete
[11734] Fix | Delete
$list_item_indent_selector = et_()->array_get( $option_settings, 'css.item_indent', $list_selector );
[11735] Fix | Delete
[11736] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $list_indent_values, $list_item_indent_selector, 'padding-left', $function_name, ' !important;' );
[11737] Fix | Delete
}
[11738] Fix | Delete
[11739] Fix | Delete
// Additional quote option slugs.
[11740] Fix | Delete
if ( 'quote' === $sub_toggle ) {
[11741] Fix | Delete
$quote_selector = '' !== $sub_toggle_selector ? $sub_toggle_selector : "{$this->main_css_element} blockquote";
[11742] Fix | Delete
[11743] Fix | Delete
// Option quote border weight.
[11744] Fix | Delete
$border_weight_name = "{$option_name}_border_weight";
[11745] Fix | Delete
$is_border_weight_responsive = et_pb_responsive_options()->is_responsive_enabled( $this->props, $border_weight_name );
[11746] Fix | Delete
$border_weight_values = array(
[11747] Fix | Delete
'desktop' => esc_html( et_pb_responsive_options()->get_any_value( $this->props, $border_weight_name ) ),
[11748] Fix | Delete
'tablet' => $is_border_weight_responsive ? esc_html( et_pb_responsive_options()->get_any_value( $this->props, "{$border_weight_name}_tablet" ) ) : '',
[11749] Fix | Delete
'phone' => $is_border_weight_responsive ? esc_html( et_pb_responsive_options()->get_any_value( $this->props, "{$border_weight_name}_phone" ) ) : '',
[11750] Fix | Delete
);
[11751] Fix | Delete
[11752] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $border_weight_values, $quote_selector, 'border-width', $function_name );
[11753] Fix | Delete
[11754] Fix | Delete
// Option quote border weight on hover.
[11755] Fix | Delete
$border_weight_hover_value = et_pb_hover_options()->get_value( $border_weight_name, $this->props );
[11756] Fix | Delete
[11757] Fix | Delete
if ( '' !== $border_weight_hover_value && et_builder_is_hover_enabled( $border_weight_name, $this->props ) ) {
[11758] Fix | Delete
self::set_style( $function_name, array(
[11759] Fix | Delete
'selector' => "{$quote_selector}:hover",
[11760] Fix | Delete
'declaration' => sprintf(
[11761] Fix | Delete
'border-width: %1$s%2$s;',
[11762] Fix | Delete
esc_html( et_builder_process_range_value( $border_weight_hover_value ) ),
[11763] Fix | Delete
esc_html( $important )
[11764] Fix | Delete
),
[11765] Fix | Delete
) );
[11766] Fix | Delete
}
[11767] Fix | Delete
[11768] Fix | Delete
// Option quote border color.
[11769] Fix | Delete
$border_color_name = "{$option_name}_border_color";
[11770] Fix | Delete
$is_border_color_responsive = et_pb_responsive_options()->is_responsive_enabled( $this->props, $border_color_name );
[11771] Fix | Delete
$border_color_values = array(
[11772] Fix | Delete
'desktop' => esc_html( et_pb_responsive_options()->get_any_value( $this->props, $border_color_name ) ),
[11773] Fix | Delete
'tablet' => $is_border_color_responsive ? esc_html( et_pb_responsive_options()->get_any_value( $this->props, "{$border_color_name}_tablet" ) ) : '',
[11774] Fix | Delete
'phone' => $is_border_color_responsive ? esc_html( et_pb_responsive_options()->get_any_value( $this->props, "{$border_color_name}_phone" ) ) : '',
[11775] Fix | Delete
);
[11776] Fix | Delete
[11777] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $border_color_values, $quote_selector, 'border-color', $function_name, '', 'color' );
[11778] Fix | Delete
[11779] Fix | Delete
// Option quote border weight on hover.
[11780] Fix | Delete
$border_color_hover_value = et_pb_hover_options()->get_value( $border_color_name, $this->props );
[11781] Fix | Delete
[11782] Fix | Delete
if ( '' !== $border_color_hover_value && et_builder_is_hover_enabled( $border_color_name, $this->props ) ) {
[11783] Fix | Delete
self::set_style( $function_name, array(
[11784] Fix | Delete
'selector' => "{$quote_selector}:hover",
[11785] Fix | Delete
'declaration' => sprintf(
[11786] Fix | Delete
'border-color: %1$s%2$s;',
[11787] Fix | Delete
esc_html( $border_color_hover_value ),
[11788] Fix | Delete
esc_html( $important )
[11789] Fix | Delete
),
[11790] Fix | Delete
) );
[11791] Fix | Delete
}
[11792] Fix | Delete
}
[11793] Fix | Delete
}
[11794] Fix | Delete
}
[11795] Fix | Delete
// sets ligatures disabling for all selectors
[11796] Fix | Delete
// from the list $this->letter_spacing_fix_selectors
[11797] Fix | Delete
foreach ($this->letter_spacing_fix_selectors as $selector_with_prefix) {
[11798] Fix | Delete
self::set_style( $function_name, array(
[11799] Fix | Delete
'selector' => $selector_with_prefix,
[11800] Fix | Delete
'declaration' => 'font-variant-ligatures: no-common-ligatures;',
[11801] Fix | Delete
'priority' => $this->_style_priority
[11802] Fix | Delete
) );
[11803] Fix | Delete
}
[11804] Fix | Delete
}
[11805] Fix | Delete
[11806] Fix | Delete
/**
[11807] Fix | Delete
* Maybe push element to the letter spacing fix list
[11808] Fix | Delete
*
[11809] Fix | Delete
* @since 4.4.7 Checks a element for the having of the letter-spacing property,
[11810] Fix | Delete
* adds a prefix to all its selectors, push prefixed selector
[11811] Fix | Delete
* to the array ($this->letter_spacing_fix_selectors) of elements
[11812] Fix | Delete
* that need to have ligature fix (same elements will be overridden).
[11813] Fix | Delete
*
[11814] Fix | Delete
* @param string $selector CSS selector of the current element.
[11815] Fix | Delete
* @param array $css_prefixes array or string of CSS prefixes which will be added to the current element selector.
[11816] Fix | Delete
* @param string $declaration CSS declaration of the current element.
[11817] Fix | Delete
* @param string $default_letter_spacing default letter-spacing value at the current element.
[11818] Fix | Delete
*/
[11819] Fix | Delete
function maybe_push_element_to_letter_spacing_fix_list( $selector, $css_prefixes, $declaration, $default_letter_spacing ) {
[11820] Fix | Delete
if ( false === strpos( trim( $declaration ), 'letter-spacing' ) || empty( $css_prefixes ) || empty( $selector ) ) {
[11821] Fix | Delete
return;
[11822] Fix | Delete
}
[11823] Fix | Delete
[11824] Fix | Delete
$selectors = ! is_array( $selector ) ? array( $selector ) : $selector;
[11825] Fix | Delete
[11826] Fix | Delete
foreach ( $selectors as $selector ) {
[11827] Fix | Delete
if ( empty( $selector ) ) {
[11828] Fix | Delete
continue;
[11829] Fix | Delete
}
[11830] Fix | Delete
[11831] Fix | Delete
$css_value = str_replace( 'letter-spacing', '', $declaration );
[11832] Fix | Delete
$css_value = preg_replace( '/[^a-zA-Z0-9]/', '', $css_value );
[11833] Fix | Delete
[11834] Fix | Delete
if ( ! is_array( $css_prefixes ) ) {
[11835] Fix | Delete
$css_prefixes = array( $css_prefixes );
[11836] Fix | Delete
}
[11837] Fix | Delete
[11838] Fix | Delete
foreach ( $css_prefixes as $css_prefix ) {
[11839] Fix | Delete
$selector_with_prefix = '';
[11840] Fix | Delete
$selector_elements = explode( ',', $selector );
[11841] Fix | Delete
[11842] Fix | Delete
if ( is_array( $selector_elements ) && count( $selector_elements ) > 0 ) {
[11843] Fix | Delete
$selector_with_prefix = implode( ',', preg_filter( '/^/', $css_prefix, $selector_elements ) );
[11844] Fix | Delete
}
[11845] Fix | Delete
[11846] Fix | Delete
if ( ! empty( $selector_with_prefix ) ) {
[11847] Fix | Delete
$hash_id_for_fix_selectors = crc32( $selector_with_prefix );
[11848] Fix | Delete
[11849] Fix | Delete
// Checking: if the current value of the sector is the default,
[11850] Fix | Delete
// given that the default value can be set in a different css-unit
[11851] Fix | Delete
// (px, em, rem... etc) than the current value
[11852] Fix | Delete
// (for example, the predefined default value can be '0px', while the current selector value is '0em')
[11853] Fix | Delete
$maybe_selector_has_default_value = 0 === intval( $default_letter_spacing ) && 0 === intval( $css_value ) || ( $css_value === $default_letter_spacing );
[11854] Fix | Delete
[11855] Fix | Delete
if ( ! ( $maybe_selector_has_default_value ) ) {
[11856] Fix | Delete
$this->letter_spacing_fix_selectors[ $hash_id_for_fix_selectors ] = $selector_with_prefix;
[11857] Fix | Delete
} elseif ( isset ( $this->letter_spacing_fix_selectors[ $hash_id_for_fix_selectors ] ) ) {
[11858] Fix | Delete
// If the selector has a default value, should delete it from
[11859] Fix | Delete
// array of selectors ($this->letter_spacing_fix_selectors) that need to be fixed,
[11860] Fix | Delete
// if it was added earlier.
[11861] Fix | Delete
unset( $this->letter_spacing_fix_selectors[ $hash_id_for_fix_selectors ] );
[11862] Fix | Delete
}
[11863] Fix | Delete
}
[11864] Fix | Delete
}
[11865] Fix | Delete
}
[11866] Fix | Delete
}
[11867] Fix | Delete
[11868] Fix | Delete
/**
[11869] Fix | Delete
* Process background CSS styles.
[11870] Fix | Delete
*
[11871] Fix | Delete
* @since 3.23 Add responsive support.
[11872] Fix | Delete
*
[11873] Fix | Delete
* @param string $function_name Module slug.
[11874] Fix | Delete
*/
[11875] Fix | Delete
function process_advanced_background_options( $function_name ) {
[11876] Fix | Delete
// Disable if module doesn't set advanced_fields property and has no VB support
[11877] Fix | Delete
if ( ! $this->has_vb_support() && ! $this->has_advanced_fields ) {
[11878] Fix | Delete
return;
[11879] Fix | Delete
}
[11880] Fix | Delete
[11881] Fix | Delete
if ( ! self::$_->array_get( $this->advanced_fields, 'background', false ) ) {
[11882] Fix | Delete
return;
[11883] Fix | Delete
}
[11884] Fix | Delete
[11885] Fix | Delete
// Reset processed background
[11886] Fix | Delete
if ( $this->save_processed_background ) {
[11887] Fix | Delete
$this->processed_background = array();
[11888] Fix | Delete
}
[11889] Fix | Delete
[11890] Fix | Delete
$settings = $this->advanced_fields['background'];
[11891] Fix | Delete
$important = isset( $settings['css']['important'] ) && $settings['css']['important'] ? ' !important' : '';
[11892] Fix | Delete
[11893] Fix | Delete
// Possible values for use_background_* variables are true, false, or 'fields_only'
[11894] Fix | Delete
$has_background_color_toggle_options = $this->advanced_fields['background']['has_background_color_toggle'];
[11895] Fix | Delete
$use_background_color_gradient_options = $this->advanced_fields['background']['use_background_color_gradient'];
[11896] Fix | Delete
$use_background_image_options = $this->advanced_fields['background']['use_background_image'];
[11897] Fix | Delete
$use_background_color_options = $this->advanced_fields['background']['use_background_color'];
[11898] Fix | Delete
$use_background_color_reset_options = self::$_->array_get( $this->advanced_fields, 'background.use_background_color_reset', true );
[11899] Fix | Delete
[11900] Fix | Delete
// Place to store processed background. It will be compared with the smaller device background
[11901] Fix | Delete
// processed value to avoid rendering the same styles.
[11902] Fix | Delete
$processed_background_color = '';
[11903] Fix | Delete
$processed_background_image = '';
[11904] Fix | Delete
$gradient_properties_desktop = array();
[11905] Fix | Delete
$processed_background_blend = '';
[11906] Fix | Delete
$background_color_gradient_overlays_image_desktop = 'off';
[11907] Fix | Delete
[11908] Fix | Delete
// Store background images status because the process is extensive.
[11909] Fix | Delete
$background_image_status = array(
[11910] Fix | Delete
'desktop' => false,
[11911] Fix | Delete
'tablet' => false,
[11912] Fix | Delete
'phone' => false,
[11913] Fix | Delete
);
[11914] Fix | Delete
[11915] Fix | Delete
// Background Desktop, Tablet, and Phone.
[11916] Fix | Delete
foreach ( et_pb_responsive_options()->get_modes() as $device ) {
[11917] Fix | Delete
$is_desktop = 'desktop' === $device;
[11918] Fix | Delete
$suffix = ! $is_desktop ? "_{$device}" : '';
[11919] Fix | Delete
$style = '';
[11920] Fix | Delete
[11921] Fix | Delete
$has_background_color_gradient = false;
[11922] Fix | Delete
$has_background_image = false;
[11923] Fix | Delete
$has_background_gradient_and_image = false;
[11924] Fix | Delete
$is_background_color_gradient_disabled = false;
[11925] Fix | Delete
$is_background_image_disabled = false;
[11926] Fix | Delete
[11927] Fix | Delete
// Ensure responsive settings is enabled on mobile.
[11928] Fix | Delete
if ( ! $is_desktop && ! et_pb_responsive_options()->is_responsive_enabled( $this->props, 'background' ) ) {
[11929] Fix | Delete
continue;
[11930] Fix | Delete
}
[11931] Fix | Delete
[11932] Fix | Delete
$background_image_style = '';
[11933] Fix | Delete
$background_color_style = '';
[11934] Fix | Delete
$background_images = array();
[11935] Fix | Delete
$background_color_gradient_overlays_image = 'off';
[11936] Fix | Delete
[11937] Fix | Delete
// A. Background Gradient.
[11938] Fix | Delete
if ( $use_background_color_gradient_options && 'fields_only' !== $use_background_color_gradient_options ) {
[11939] Fix | Delete
$use_background_color_gradient = et_pb_responsive_options()->get_inheritance_background_value( $this->props, 'use_background_color_gradient', $device, 'background', $this->fields_unprocessed );
[11940] Fix | Delete
[11941] Fix | Delete
// 1. Ensure gradient color is active.
[11942] Fix | Delete
if ( 'on' === $use_background_color_gradient ) {
[11943] Fix | Delete
$background_color_gradient_overlays_image = et_pb_responsive_options()->get_any_value( $this->props, "background_color_gradient_overlays_image{$suffix}", '', true );
[11944] Fix | Delete
[11945] Fix | Delete
$gradient_properties = array(
[11946] Fix | Delete
'type' => et_pb_responsive_options()->get_any_value( $this->props, "background_color_gradient_type{$suffix}", '', true ),
[11947] Fix | Delete
'direction' => et_pb_responsive_options()->get_any_value( $this->props, "background_color_gradient_direction{$suffix}", '', true ),
[11948] Fix | Delete
'radial_direction' => et_pb_responsive_options()->get_any_value( $this->props, "background_color_gradient_direction_radial{$suffix}", '', true ),
[11949] Fix | Delete
'color_start' => et_pb_responsive_options()->get_any_value( $this->props, "background_color_gradient_start{$suffix}", '', true ),
[11950] Fix | Delete
'color_end' => et_pb_responsive_options()->get_any_value( $this->props, "background_color_gradient_end{$suffix}", '', true ),
[11951] Fix | Delete
'start_position' => et_pb_responsive_options()->get_any_value( $this->props, "background_color_gradient_start_position{$suffix}", '', true ),
[11952] Fix | Delete
'end_position' => et_pb_responsive_options()->get_any_value( $this->props, "background_color_gradient_end_position{$suffix}", '', true ),
[11953] Fix | Delete
);
[11954] Fix | Delete
[11955] Fix | Delete
// Will be used as default of Gradient hover.
[11956] Fix | Delete
if ( $is_desktop ) {
[11957] Fix | Delete
$gradient_properties_desktop = $gradient_properties;
[11958] Fix | Delete
$background_color_gradient_overlays_image_desktop = $background_color_gradient_overlays_image;
[11959] Fix | Delete
}
[11960] Fix | Delete
[11961] Fix | Delete
// Save background gradient into background images list.
[11962] Fix | Delete
$background_gradient = $this->get_gradient( $gradient_properties );
[11963] Fix | Delete
$background_images[] = $background_gradient;
[11964] Fix | Delete
[11965] Fix | Delete
// Save resulted gradient into property for later usage
[11966] Fix | Delete
if ( $this->save_processed_background ) {
[11967] Fix | Delete
et_()->array_set( $this->processed_background, "{$device}.gradient", $background_gradient );
[11968] Fix | Delete
}
[11969] Fix | Delete
[11970] Fix | Delete
// Flag to inform BG Color if current module has Gradient.
[11971] Fix | Delete
$has_background_color_gradient = true;
[11972] Fix | Delete
} else if ( 'off' === $use_background_color_gradient ) {
[11973] Fix | Delete
$is_background_color_gradient_disabled = true;
[11974] Fix | Delete
}
[11975] Fix | Delete
}
[11976] Fix | Delete
[11977] Fix | Delete
// B. Background Image.
[11978] Fix | Delete
if ( $use_background_image_options && 'fields_only' !== $use_background_image_options ) {
[11979] Fix | Delete
$background_image = et_pb_responsive_options()->get_inheritance_background_value( $this->props, 'background_image', $device, 'background', $this->fields_unprocessed );
[11980] Fix | Delete
$parallax = et_pb_responsive_options()->get_any_value( $this->props, "parallax{$suffix}", 'off' );
[11981] Fix | Delete
[11982] Fix | Delete
// Featured image as background is in higher priority.
[11983] Fix | Delete
if ( $this->featured_image_background ) {
[11984] Fix | Delete
$featured_image = self::$_->array_get( $this->props, 'featured_image', '' );
[11985] Fix | Delete
$featured_placement = self::$_->array_get( $this->props, 'featured_placement', '' );
[11986] Fix | Delete
$featured_image_src_obj = wp_get_attachment_image_src( get_post_thumbnail_id( self::_get_main_post_id() ), 'full' );
[11987] Fix | Delete
$featured_image_src = isset( $featured_image_src_obj[0] ) ? $featured_image_src_obj[0] : '';
[11988] Fix | Delete
[11989] Fix | Delete
if ( 'on' === $featured_image && 'background' === $featured_placement && '' !== $featured_image_src ) {
[11990] Fix | Delete
$background_image = $featured_image_src;
[11991] Fix | Delete
}
[11992] Fix | Delete
}
[11993] Fix | Delete
[11994] Fix | Delete
// BG image and parallax status.
[11995] Fix | Delete
$is_background_image_active = '' !== $background_image && 'on' !== $parallax;
[11996] Fix | Delete
$background_image_status[ $device ] = $is_background_image_active;
[11997] Fix | Delete
[11998] Fix | Delete
// 1. Ensure image exists and parallax is off.
[11999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function