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
$background_hover_style .= sprintf(
[14500] Fix | Delete
'background-size: %1$s; ',
[14501] Fix | Delete
esc_html( $background_size_hover )
[14502] Fix | Delete
);
[14503] Fix | Delete
}
[14504] Fix | Delete
[14505] Fix | Delete
// Position.
[14506] Fix | Delete
$background_position_hover = et_pb_hover_options()->get_raw_value( "{$background_prefix}position", $this->props );
[14507] Fix | Delete
$background_position_desktop = self::$_->array_get( $this->props, "{$background_prefix}position", '' );
[14508] Fix | Delete
$is_same_background_position = $background_position_hover === $background_position_desktop;
[14509] Fix | Delete
if ( empty( $background_position_hover ) && ! empty( $background_position_desktop ) ) {
[14510] Fix | Delete
$background_position_hover = $background_position_desktop;
[14511] Fix | Delete
}
[14512] Fix | Delete
[14513] Fix | Delete
if ( ! empty( $background_position_hover ) && ! $is_same_background_position ) {
[14514] Fix | Delete
$background_hover_style .= sprintf(
[14515] Fix | Delete
'background-position: %1$s; ',
[14516] Fix | Delete
esc_html( str_replace( '_', ' ', $background_position_hover ) )
[14517] Fix | Delete
);
[14518] Fix | Delete
}
[14519] Fix | Delete
[14520] Fix | Delete
// Repeat.
[14521] Fix | Delete
$background_repeat_hover = et_pb_hover_options()->get_raw_value( "{$background_prefix}repeat", $this->props );
[14522] Fix | Delete
$background_repeat_desktop = self::$_->array_get( $this->props, "{$background_prefix}repeat", '' );
[14523] Fix | Delete
$is_same_background_repeat = $background_repeat_hover === $background_repeat_desktop;
[14524] Fix | Delete
if ( empty( $background_repeat_hover ) && ! empty( $background_repeat_desktop ) ) {
[14525] Fix | Delete
$background_repeat_hover = $background_repeat_desktop;
[14526] Fix | Delete
}
[14527] Fix | Delete
[14528] Fix | Delete
if ( ! empty( $background_repeat_hover ) && ! $is_same_background_repeat ) {
[14529] Fix | Delete
$background_hover_style .= sprintf(
[14530] Fix | Delete
'background-repeat: %1$s; ',
[14531] Fix | Delete
esc_html( $background_repeat_hover )
[14532] Fix | Delete
);
[14533] Fix | Delete
}
[14534] Fix | Delete
[14535] Fix | Delete
// Blend.
[14536] Fix | Delete
$background_blend_hover = et_pb_hover_options()->get_raw_value( "{$background_prefix}blend", $this->props );
[14537] Fix | Delete
$background_blend_default = self::$_->array_get( $this->fields_unprocessed, "{$background_prefix}blend.default", '' );
[14538] Fix | Delete
$background_blend_desktop = self::$_->array_get( $this->props, "{$background_prefix}blend", '' );
[14539] Fix | Delete
$is_same_background_blend = $background_blend_hover === $background_blend_desktop;
[14540] Fix | Delete
if ( empty( $background_blend_hover ) && ! empty( $background_blend_desktop ) ) {
[14541] Fix | Delete
$background_blend_hover = $background_blend_desktop;
[14542] Fix | Delete
}
[14543] Fix | Delete
[14544] Fix | Delete
if ( ! empty( $background_blend_hover ) ) {
[14545] Fix | Delete
if ( ! $is_same_background_blend ) {
[14546] Fix | Delete
$background_hover_style .= sprintf(
[14547] Fix | Delete
'background-blend-mode: %1$s; ',
[14548] Fix | Delete
esc_html( $background_blend_hover )
[14549] Fix | Delete
);
[14550] Fix | Delete
}
[14551] Fix | Delete
[14552] Fix | Delete
// Force background-color: initial;
[14553] Fix | Delete
if ( $has_background_color_gradient_hover && $has_background_image_hover && $background_blend_hover !== $background_blend_default ) {
[14554] Fix | Delete
$has_background_gradient_and_image_hover = true;
[14555] Fix | Delete
$background_hover_style .= 'background-color: initial !important;';
[14556] Fix | Delete
}
[14557] Fix | Delete
}
[14558] Fix | Delete
[14559] Fix | Delete
// Only append background image when the image exists.
[14560] Fix | Delete
$background_images_hover[] = sprintf( 'url(%1$s)', esc_html( $background_image_hover ) );
[14561] Fix | Delete
} else if ( '' === $background_image_hover ) {
[14562] Fix | Delete
$is_background_image_hover_disabled = true;
[14563] Fix | Delete
}
[14564] Fix | Delete
[14565] Fix | Delete
if ( ! empty( $background_images_hover ) ) {
[14566] Fix | Delete
// The browsers stack the images in the opposite order to what you'd expect.
[14567] Fix | Delete
if ( 'on' !== $background_color_gradient_overlays_image_hover ) {
[14568] Fix | Delete
$background_images_hover = array_reverse( $background_images_hover );
[14569] Fix | Delete
}
[14570] Fix | Delete
[14571] Fix | Delete
$background_hover_style .= sprintf(
[14572] Fix | Delete
'background-image: %1$s !important;',
[14573] Fix | Delete
esc_html( join( ', ', $background_images_hover ) )
[14574] Fix | Delete
);
[14575] Fix | Delete
} else if ( $is_background_color_gradient_hover_disabled && $is_background_image_hover_disabled ) {
[14576] Fix | Delete
$background_hover_style .= 'background-image: initial !important;';
[14577] Fix | Delete
}
[14578] Fix | Delete
[14579] Fix | Delete
// Background Color Hover.
[14580] Fix | Delete
if ( ! $has_background_gradient_and_image_hover ) {
[14581] Fix | Delete
$background_color_hover = et_pb_responsive_options()->get_inheritance_background_value( $this->props, "{$background_prefix}color", 'hover', $background_base_name, $this->fields_unprocessed );
[14582] Fix | Delete
$background_color_hover = '' !== $background_color_hover ? $background_color_hover : 'transparent';
[14583] Fix | Delete
[14584] Fix | Delete
if ( '' !== $background_color_hover ) {
[14585] Fix | Delete
$background_hover_style .= sprintf(
[14586] Fix | Delete
'background-color: %1$s !important; ',
[14587] Fix | Delete
esc_html( $background_color_hover )
[14588] Fix | Delete
);
[14589] Fix | Delete
}
[14590] Fix | Delete
}
[14591] Fix | Delete
[14592] Fix | Delete
// Print background hover gradient and image styles.
[14593] Fix | Delete
if ( '' !== $background_hover_style ) {
[14594] Fix | Delete
$background_hover_style_attrs = array(
[14595] Fix | Delete
'selector' => $css_element_processed . ':hover',
[14596] Fix | Delete
'declaration' => rtrim( $background_hover_style ),
[14597] Fix | Delete
'priority' => $this->_style_priority,
[14598] Fix | Delete
);
[14599] Fix | Delete
[14600] Fix | Delete
self::set_style( $function_name, $background_hover_style_attrs );
[14601] Fix | Delete
}
[14602] Fix | Delete
}
[14603] Fix | Delete
}
[14604] Fix | Delete
}
[14605] Fix | Delete
}
[14606] Fix | Delete
[14607] Fix | Delete
/**
[14608] Fix | Delete
* Process form field options into correct CSS styles.
[14609] Fix | Delete
*
[14610] Fix | Delete
* Fields will be processed here (name, mode, custom selector):
[14611] Fix | Delete
*
[14612] Fix | Delete
* - Background Color -> Hover -> Form field selector
[14613] Fix | Delete
* - Background Focus Color -> Hover -> Form field focus selector
[14614] Fix | Delete
* - Text Color -> Hover -> Form field & placeholder selector
[14615] Fix | Delete
* - Text Focus Color -> Hover -> Form field & placeholder focus selector
[14616] Fix | Delete
*
[14617] Fix | Delete
* @since 3.23
[14618] Fix | Delete
*
[14619] Fix | Delete
* @param string $function_name Module slug.
[14620] Fix | Delete
*/
[14621] Fix | Delete
function process_advanced_form_field_options( $function_name ) {
[14622] Fix | Delete
// Disable if module doesn't set advanced_fields property and has no VB support.
[14623] Fix | Delete
if ( ! $this->has_advanced_fields ) {
[14624] Fix | Delete
return;
[14625] Fix | Delete
}
[14626] Fix | Delete
[14627] Fix | Delete
// Ensure form field exist on advanced fields.
[14628] Fix | Delete
if ( ! self::$_->array_get( $this->advanced_fields, 'form_field', false ) ) {
[14629] Fix | Delete
return;
[14630] Fix | Delete
}
[14631] Fix | Delete
[14632] Fix | Delete
// Fetch every single form field instances.
[14633] Fix | Delete
foreach ( $this->advanced_fields['form_field'] as $option_name => $option_settings ) {
[14634] Fix | Delete
// 1.a. Build main element selector.
[14635] Fix | Delete
$element_selector = ! empty( $option_settings['css']['main'] ) ? $option_settings['css']['main'] : "{$this->main_css_element} .input";
[14636] Fix | Delete
if ( et_builder_has_limitation( 'use_limited_main' ) && ! empty( $option_settings['css']['limited_main'] ) ) {
[14637] Fix | Delete
$element_selector = $option_settings['css']['limited_main'];
[14638] Fix | Delete
}
[14639] Fix | Delete
[14640] Fix | Delete
// 1.b. Build pseudo element selector.
[14641] Fix | Delete
$element_hover_selector = ! empty( $option_settings['css']['hover'] ) ? $option_settings['css']['hover'] : "{$element_selector}:hover";
[14642] Fix | Delete
$element_focus_selector = ! empty( $option_settings['css']['focus'] ) ? $option_settings['css']['focus'] : "{$element_selector}:focus";
[14643] Fix | Delete
$element_focus_hover_selector = ! empty( $option_settings['css']['focus_hover'] ) ? $option_settings['css']['focus_hover'] : "{$element_selector}:focus:hover";
[14644] Fix | Delete
[14645] Fix | Delete
// 1.c. Build custom form field selector.
[14646] Fix | Delete
$bg_color_selector = ! empty( $option_settings['css']['background_color'] ) ? $option_settings['css']['background_color'] : $element_selector;
[14647] Fix | Delete
$bg_color_hover_selector = ! empty( $option_settings['css']['background_color_hover'] ) ? $option_settings['css']['background_color_hover'] : $element_hover_selector;
[14648] Fix | Delete
$bg_color_focus_selector = ! empty( $option_settings['css']['focus_background_color'] ) ? $option_settings['css']['focus_background_color'] : $element_focus_selector;
[14649] Fix | Delete
$bg_color_focus_hover_selector = ! empty( $option_settings['css']['focus_background_color_hover'] ) ? $option_settings['css']['focus_background_color_hover'] : $element_focus_hover_selector;
[14650] Fix | Delete
[14651] Fix | Delete
$text_color_selector = ! empty( $option_settings['css']['form_text_color'] ) ? $option_settings['css']['form_text_color'] : $element_selector;
[14652] Fix | Delete
$text_color_hover_selector = ! empty( $option_settings['css']['form_text_color_hover'] ) ? $option_settings['css']['form_text_color_hover'] : $element_hover_selector;
[14653] Fix | Delete
$text_color_focus_selector = ! empty( $option_settings['css']['focus_text_color'] ) ? $option_settings['css']['focus_text_color'] : $element_focus_selector;
[14654] Fix | Delete
$text_color_focus_hover_selector = ! empty( $option_settings['css']['focus_text_color_hover'] ) ? $option_settings['css']['focus_text_color_hover'] : $element_focus_hover_selector;
[14655] Fix | Delete
[14656] Fix | Delete
$placeholder_option = self::$_->array_get( $option_settings, 'placeholder', true );
[14657] Fix | Delete
$base_selector = false !== strpos( $element_selector, ',' ) ? "{$this->main_css_element} .input" : $element_selector;
[14658] Fix | Delete
[14659] Fix | Delete
$placeholder_selector = ! empty( $option_settings['css']['placeholder'] ) ? $option_settings['css']['placeholder'] : "{$base_selector}::placeholder, {$base_selector}::-webkit-input-placeholder, {$base_selector}::-moz-placeholder, {$base_selector}::-ms-input-placeholder";
[14660] Fix | Delete
$placeholder_hover_selector = ! empty( $option_settings['css']['placeholder_hover'] ) ? $option_settings['css']['placeholder_hover'] : "{$base_selector}:hover::placeholder, {$base_selector}:hover::-webkit-input-placeholder, {$base_selector}:hover::-moz-placeholder, {$base_selector}:hover::-ms-input-placeholder";
[14661] Fix | Delete
$placeholder_focus_selector = ! empty( $option_settings['css']['placeholder_focus'] ) ? $option_settings['css']['placeholder_focus'] : "{$base_selector}:focus::placeholder, {$base_selector}:focus::-webkit-input-placeholder, {$base_selector}:focus::-moz-placeholder, {$base_selector}:focus::-ms-input-placeholder";
[14662] Fix | Delete
$placeholder_focus_hover_selector = ! empty( $option_settings['css']['placeholder_focus_hover'] ) ? $option_settings['css']['placeholder_focus_hover'] : "{$base_selector}:focus:hover::placeholder, {$base_selector}:focus:hover::-webkit-input-placeholder, {$base_selector}:focus:hover::-moz-placeholder, {$base_selector}:focus:hover::-ms-input-placeholder";
[14663] Fix | Delete
[14664] Fix | Delete
// 2. Default important status.
[14665] Fix | Delete
$force_global_important = et_builder_has_limitation( 'force_use_global_important' );
[14666] Fix | Delete
$important_list = isset( $option_settings['css']['important'] ) ? $option_settings['css']['important'] : array();
[14667] Fix | Delete
[14668] Fix | Delete
// 3.a.1. Field Background Color.
[14669] Fix | Delete
$is_field_bg_color_responsive = et_pb_responsive_options()->is_responsive_enabled( $this->props, "{$option_name}_background_color" );
[14670] Fix | Delete
$field_bg_color_values = array(
[14671] Fix | Delete
'desktop' => esc_attr( et_pb_responsive_options()->get_any_value( $this->props, "{$option_name}_background_color" ) ),
[14672] Fix | Delete
'tablet' => $is_field_bg_color_responsive ? esc_attr( et_pb_responsive_options()->get_any_value( $this->props, "{$option_name}_background_color_tablet" ) ) : '',
[14673] Fix | Delete
'phone' => $is_field_bg_color_responsive ? esc_attr( et_pb_responsive_options()->get_any_value( $this->props, "{$option_name}_background_color_phone" ) ) : '',
[14674] Fix | Delete
);
[14675] Fix | Delete
[14676] Fix | Delete
$field_bg_color_important = $force_global_important || in_array( 'background_color', $important_list, true ) ? ' !important;' : '';
[14677] Fix | Delete
[14678] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $field_bg_color_values, $bg_color_selector, 'background-color', $function_name, $field_bg_color_important, 'color' );
[14679] Fix | Delete
[14680] Fix | Delete
// 3.a.2. Field Background Hover Color.
[14681] Fix | Delete
$field_bg_color_hover = $this->get_hover_value("{$option_name}_background_color" );
[14682] Fix | Delete
if ( ! empty( $field_bg_color_hover ) ) {
[14683] Fix | Delete
self::set_style( $function_name, array(
[14684] Fix | Delete
'selector' => $bg_color_hover_selector,
[14685] Fix | Delete
'declaration' => sprintf( 'background-color:%1$s%2$s;', $field_bg_color_hover, $field_bg_color_important ),
[14686] Fix | Delete
) );
[14687] Fix | Delete
}
[14688] Fix | Delete
[14689] Fix | Delete
// 3.b.1. Field Focus Background Color.
[14690] Fix | Delete
$is_field_focus_bg_color_responsive = et_pb_responsive_options()->is_responsive_enabled( $this->props, "{$option_name}_focus_background_color" );
[14691] Fix | Delete
$field_focus_bg_color_values = array(
[14692] Fix | Delete
'desktop' => esc_attr( et_pb_responsive_options()->get_any_value( $this->props, "{$option_name}_focus_background_color" ) ),
[14693] Fix | Delete
'tablet' => $is_field_focus_bg_color_responsive ? esc_attr( et_pb_responsive_options()->get_any_value( $this->props, "{$option_name}_focus_background_color_tablet" ) ) : '',
[14694] Fix | Delete
'phone' => $is_field_focus_bg_color_responsive ? esc_attr( et_pb_responsive_options()->get_any_value( $this->props, "{$option_name}_focus_background_color_phone" ) ) : '',
[14695] Fix | Delete
);
[14696] Fix | Delete
[14697] Fix | Delete
$field_focus_bg_color_important = $force_global_important || in_array( 'focus_background_color', $important_list, true ) ? ' !important' : '';
[14698] Fix | Delete
[14699] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $field_focus_bg_color_values, $bg_color_focus_selector, 'background-color', $function_name, $field_focus_bg_color_important, 'color' );
[14700] Fix | Delete
[14701] Fix | Delete
// 3.b.2. Field Focus Background Hover Color.
[14702] Fix | Delete
$field_focus_bg_color_hover = $this->get_hover_value("{$option_name}_focus_background_color" );
[14703] Fix | Delete
if ( ! empty( $field_focus_bg_color_hover ) ) {
[14704] Fix | Delete
self::set_style( $function_name, array(
[14705] Fix | Delete
'selector' => $bg_color_focus_hover_selector,
[14706] Fix | Delete
'declaration' => sprintf( 'background-color:%1$s%2$s;', $field_focus_bg_color_hover, $field_focus_bg_color_important ),
[14707] Fix | Delete
) );
[14708] Fix | Delete
}
[14709] Fix | Delete
[14710] Fix | Delete
// 3.c.1. Field Text Color.
[14711] Fix | Delete
$is_field_text_color_responsive = et_pb_responsive_options()->is_responsive_enabled( $this->props, "{$option_name}_text_color" );
[14712] Fix | Delete
$field_text_color_values = array(
[14713] Fix | Delete
'desktop' => esc_attr( et_pb_responsive_options()->get_any_value( $this->props, "{$option_name}_text_color" ) ),
[14714] Fix | Delete
'tablet' => $is_field_text_color_responsive ? esc_attr( et_pb_responsive_options()->get_any_value( $this->props, "{$option_name}_text_color_tablet" ) ) : '',
[14715] Fix | Delete
'phone' => $is_field_text_color_responsive ? esc_attr( et_pb_responsive_options()->get_any_value( $this->props, "{$option_name}_text_color_phone" ) ) : '',
[14716] Fix | Delete
);
[14717] Fix | Delete
[14718] Fix | Delete
$field_text_color_important = in_array( 'form_text_color', $important_list ) ? ' !important' : '';
[14719] Fix | Delete
$text_color_selector = $placeholder_option ? "{$text_color_selector}, {$placeholder_selector}" : $text_color_selector;
[14720] Fix | Delete
[14721] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $field_text_color_values, $text_color_selector, 'color', $function_name, $field_text_color_important, 'color' );
[14722] Fix | Delete
[14723] Fix | Delete
// 3.c.2. Field Text Color.
[14724] Fix | Delete
$field_text_color_hover = $this->get_hover_value("{$option_name}_text_color" );
[14725] Fix | Delete
if ( ! empty( $field_text_color_hover ) ) {
[14726] Fix | Delete
$text_color_hover_selector = $placeholder_option ? "{$text_color_hover_selector}, {$placeholder_hover_selector}" : $text_color_hover_selector;
[14727] Fix | Delete
self::set_style( $function_name, array(
[14728] Fix | Delete
'selector' => $text_color_hover_selector,
[14729] Fix | Delete
'declaration' => sprintf( 'color:%1$s%2$s;', $field_text_color_hover, $field_text_color_important ),
[14730] Fix | Delete
) );
[14731] Fix | Delete
}
[14732] Fix | Delete
[14733] Fix | Delete
// 3.d.1. Field Focus Text Color.
[14734] Fix | Delete
$is_field_focus_text_color_responsive = et_pb_responsive_options()->is_responsive_enabled( $this->props, "{$option_name}_focus_text_color" );
[14735] Fix | Delete
$field_focus_text_color_values = array(
[14736] Fix | Delete
'desktop' => esc_attr( et_pb_responsive_options()->get_any_value( $this->props, "{$option_name}_focus_text_color" ) ),
[14737] Fix | Delete
'tablet' => $is_field_focus_text_color_responsive ? esc_attr( et_pb_responsive_options()->get_any_value( $this->props, "{$option_name}_focus_text_color_tablet" ) ) : '',
[14738] Fix | Delete
'phone' => $is_field_focus_text_color_responsive ? esc_attr( et_pb_responsive_options()->get_any_value( $this->props, "{$option_name}_focus_text_color_phone" ) ) : '',
[14739] Fix | Delete
);
[14740] Fix | Delete
[14741] Fix | Delete
$text_color_focus_selector = $placeholder_option ? "{$text_color_focus_selector}, {$placeholder_focus_selector}" : $text_color_focus_selector;
[14742] Fix | Delete
$field_focus_text_color_important = in_array( 'form_text_color', $important_list ) ? ' !important' : '';
[14743] Fix | Delete
[14744] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $field_focus_text_color_values, $text_color_focus_selector, 'color', $function_name, $field_focus_text_color_important, 'color' );
[14745] Fix | Delete
[14746] Fix | Delete
// 3.d.2. Field Focus Text Hover Color.
[14747] Fix | Delete
$field_focus_text_color_hover = $this->get_hover_value("{$option_name}_focus_text_color" );
[14748] Fix | Delete
if ( ! empty( $field_focus_text_color_hover ) ) {
[14749] Fix | Delete
$text_color_focus_hover_selector = $placeholder_option ? "{$text_color_focus_hover_selector}, {$placeholder_focus_hover_selector}" : $text_color_focus_hover_selector;
[14750] Fix | Delete
self::set_style( $function_name, array(
[14751] Fix | Delete
'selector' => $text_color_focus_hover_selector,
[14752] Fix | Delete
'declaration' => sprintf( 'color:%1$s%2$s;', $field_focus_text_color_hover, $field_focus_text_color_important ),
[14753] Fix | Delete
) );
[14754] Fix | Delete
}
[14755] Fix | Delete
}
[14756] Fix | Delete
}
[14757] Fix | Delete
[14758] Fix | Delete
function process_custom_css_fields( $function_name ) {
[14759] Fix | Delete
if ( empty( $this->custom_css_fields ) ) {
[14760] Fix | Delete
return false;
[14761] Fix | Delete
}
[14762] Fix | Delete
[14763] Fix | Delete
foreach ( $this->custom_css_fields as $slug => $option ) {
[14764] Fix | Delete
$css = $this->props["custom_css_{$slug}"];
[14765] Fix | Delete
$order_class = isset( $this->main_css_element ) && count( explode( ' ', $this->main_css_element ) ) === 1 ? $selector = $this->main_css_element : '%%order_class%%';
[14766] Fix | Delete
$selector = ! empty( $option['selector'] ) ? $option['selector'] : '';
[14767] Fix | Delete
[14768] Fix | Delete
if ( false === strpos( $selector, '%%order_class%%' ) ) {
[14769] Fix | Delete
if ( ! ( isset( $option['no_space_before_selector'] ) && $option['no_space_before_selector'] ) && '' !== $selector ) {
[14770] Fix | Delete
$selector = " {$selector}";
[14771] Fix | Delete
}
[14772] Fix | Delete
[14773] Fix | Delete
$selector = "{$order_class}{$selector}";
[14774] Fix | Delete
}
[14775] Fix | Delete
[14776] Fix | Delete
if ( et_pb_responsive_options()->is_responsive_enabled( $this->props, "custom_css_{$slug}" ) ) {
[14777] Fix | Delete
$responsive_values = et_pb_responsive_options()->get_property_values( $this->props, "custom_css_{$slug}" );
[14778] Fix | Delete
[14779] Fix | Delete
// Desktop mode custom CSS.
[14780] Fix | Delete
if ( '' !== $css ) {
[14781] Fix | Delete
self::set_style( $function_name, array(
[14782] Fix | Delete
'selector' => $selector,
[14783] Fix | Delete
'declaration' => trim( $css ),
[14784] Fix | Delete
'media_query' => empty( $responsive_values['tablet'] ) ? null : ET_Builder_Element::get_media_query( 'min_width_981' ),
[14785] Fix | Delete
) );
[14786] Fix | Delete
}
[14787] Fix | Delete
[14788] Fix | Delete
// Tablet mode custom CSS.
[14789] Fix | Delete
$tablet_css = et_pb_responsive_options()->get_tablet_value( "custom_css_{$slug}", $this->props );
[14790] Fix | Delete
if ( ! empty( $tablet_css ) ) {
[14791] Fix | Delete
self::set_style( $function_name, array(
[14792] Fix | Delete
'selector' => $selector,
[14793] Fix | Delete
'declaration' => trim( $tablet_css ),
[14794] Fix | Delete
'media_query' => empty( $responsive_values['phone'] ) ? ET_Builder_Element::get_media_query( 'max_width_980' ) : ET_Builder_Element::get_media_query( '768_980' ),
[14795] Fix | Delete
) );
[14796] Fix | Delete
}
[14797] Fix | Delete
[14798] Fix | Delete
// Phone mode custom CSS.
[14799] Fix | Delete
$phone_css = et_pb_responsive_options()->get_phone_value( "custom_css_{$slug}", $this->props );
[14800] Fix | Delete
if ( ! empty( $phone_css ) ) {
[14801] Fix | Delete
self::set_style( $function_name, array(
[14802] Fix | Delete
'selector' => $selector,
[14803] Fix | Delete
'declaration' => trim( $phone_css ),
[14804] Fix | Delete
'media_query' => ET_Builder_Element::get_media_query( 'max_width_767' ),
[14805] Fix | Delete
) );
[14806] Fix | Delete
}
[14807] Fix | Delete
} else {
[14808] Fix | Delete
// Non responsive mode custom CSS.
[14809] Fix | Delete
if ( '' !== $css ) {
[14810] Fix | Delete
self::set_style( $function_name, array(
[14811] Fix | Delete
'selector' => $selector,
[14812] Fix | Delete
'declaration' => trim( $css ),
[14813] Fix | Delete
) );
[14814] Fix | Delete
}
[14815] Fix | Delete
}
[14816] Fix | Delete
[14817] Fix | Delete
// Hover mode custom CSS.
[14818] Fix | Delete
if ( et_pb_hover_options()->is_enabled( "custom_css_{$slug}", $this->props ) ) {
[14819] Fix | Delete
$hover_css = et_pb_hover_options()->get_value( "custom_css_{$slug}", $this->props );
[14820] Fix | Delete
[14821] Fix | Delete
if ( ! empty( $hover_css ) ) {
[14822] Fix | Delete
self::set_style( $function_name, array(
[14823] Fix | Delete
'selector' => $this->add_hover_to_selectors( $selector ),
[14824] Fix | Delete
'declaration' => trim( $hover_css ),
[14825] Fix | Delete
) );
[14826] Fix | Delete
}
[14827] Fix | Delete
}
[14828] Fix | Delete
}
[14829] Fix | Delete
}
[14830] Fix | Delete
[14831] Fix | Delete
/**
[14832] Fix | Delete
* Process box shadow CSS styles.
[14833] Fix | Delete
*
[14834] Fix | Delete
* @since 3.23 Add responsive support. Pass device attributes and make sure no duplicate styles
[14835] Fix | Delete
* are rendered.
[14836] Fix | Delete
*
[14837] Fix | Delete
* @param string $function_name Module slug.
[14838] Fix | Delete
*/
[14839] Fix | Delete
function process_box_shadow( $function_name ) {
[14840] Fix | Delete
/**
[14841] Fix | Delete
* @var ET_Builder_Module_Field_BoxShadow $box_shadow
[14842] Fix | Delete
*/
[14843] Fix | Delete
$box_shadow = ET_Builder_Module_Fields_Factory::get( 'BoxShadow' );
[14844] Fix | Delete
[14845] Fix | Delete
$advanced_fields = self::$_->array_get( $this->advanced_fields, 'box_shadow', array( 'default' => array() ) );
[14846] Fix | Delete
[14847] Fix | Delete
if ( ! $advanced_fields ) {
[14848] Fix | Delete
return '';
[14849] Fix | Delete
}
[14850] Fix | Delete
[14851] Fix | Delete
// A module can have multiple advanced box shadow fields (i.e. default + button's box shadow) which are
[14852] Fix | Delete
// generated by advanced button fields
[14853] Fix | Delete
foreach ( $advanced_fields as $option_name => $option_settings ) {
[14854] Fix | Delete
// Enable module to explicitly disable box shadow fields (box shadow is automatically)
[14855] Fix | Delete
// added to all module by default
[14856] Fix | Delete
if ( false === $option_settings ) {
[14857] Fix | Delete
continue;
[14858] Fix | Delete
}
[14859] Fix | Delete
[14860] Fix | Delete
// Prepare attribute for getting box shadow's css declaration
[14861] Fix | Delete
$declaration_args = array(
[14862] Fix | Delete
'suffix' => $option_name === 'default' ? '' : "_{$option_name}",
[14863] Fix | Delete
'important' => self::$_->array_get( $option_settings, 'css.important', false ),
[14864] Fix | Delete
);
[14865] Fix | Delete
[14866] Fix | Delete
// Enable module to conditionally print box shadow styling if particular attribute(s) have specific value.
[14867] Fix | Delete
// This works in 'OR' logic. Once an attribute doesn't match the value, this box shadow styling is skipped
[14868] Fix | Delete
$show_if = self::$_->array_get( $option_settings, 'css.show_if', array() );
[14869] Fix | Delete
[14870] Fix | Delete
if ( ! empty( $show_if ) ) {
[14871] Fix | Delete
$show_if_skip = false;
[14872] Fix | Delete
[14873] Fix | Delete
foreach ( $show_if as $show_if_attr_name => $show_if_attr_value ) {
[14874] Fix | Delete
$attr_value = self::$_->array_get( $this->props, $show_if_attr_name, '' );
[14875] Fix | Delete
[14876] Fix | Delete
// Skip printing this box shadow value once one of the attribute value doesn't
[14877] Fix | Delete
// match with given value
[14878] Fix | Delete
if ( $attr_value !== $show_if_attr_value ) {
[14879] Fix | Delete
$show_if_skip = true;
[14880] Fix | Delete
break;
[14881] Fix | Delete
}
[14882] Fix | Delete
}
[14883] Fix | Delete
[14884] Fix | Delete
if ( $show_if_skip ) {
[14885] Fix | Delete
continue;
[14886] Fix | Delete
}
[14887] Fix | Delete
}
[14888] Fix | Delete
[14889] Fix | Delete
// Enable module to conditionally print box shadow styling if particular attribute(s) doesn't have
[14890] Fix | Delete
// specific value. This works on 'OR' logic. Once an attribute matches the supplied value, this
[14891] Fix | Delete
// box shadow styling is skipped
[14892] Fix | Delete
$show_if_not = self::$_->array_get( $option_settings, 'css.show_if_not', array() );
[14893] Fix | Delete
[14894] Fix | Delete
if ( ! empty( $show_if_not ) ) {
[14895] Fix | Delete
$show_if_not_skip = false;
[14896] Fix | Delete
[14897] Fix | Delete
foreach ( $show_if_not as $show_if_not_attr_name => $show_if_not_attr_value ) {
[14898] Fix | Delete
$attr_value = self::$_->array_get( $this->props, $show_if_not_attr_name, '' );
[14899] Fix | Delete
[14900] Fix | Delete
// Skip printing this box value once this attribute value matches the given value
[14901] Fix | Delete
if ( $attr_value === $show_if_not_attr_value ) {
[14902] Fix | Delete
$show_if_not_skip = true;
[14903] Fix | Delete
break;
[14904] Fix | Delete
}
[14905] Fix | Delete
}
[14906] Fix | Delete
[14907] Fix | Delete
if ( $show_if_not_skip ) {
[14908] Fix | Delete
continue;
[14909] Fix | Delete
}
[14910] Fix | Delete
}
[14911] Fix | Delete
[14912] Fix | Delete
$overlay = self::$_->array_get( $option_settings, 'css.overlay', false );
[14913] Fix | Delete
$has_video_bg = ! empty( $atts['background_video_mp4'] ) || ! empty( $atts['background_video_webm'] );
[14914] Fix | Delete
$inset = $box_shadow->is_inset( $box_shadow->get_value( $this->props, $declaration_args ) );
[14915] Fix | Delete
$inset_hover = $box_shadow->is_inset( $box_shadow->get_value(
[14916] Fix | Delete
$this->props,
[14917] Fix | Delete
array_merge( $declaration_args, array( 'hover' => true ) )
[14918] Fix | Delete
) );
[14919] Fix | Delete
$selector = self::$_->array_get( $option_settings, 'css.main', '%%order_class%%' );
[14920] Fix | Delete
[14921] Fix | Delete
// Default box shadow affects module while other affects group element it belongs to (ie image, button, etc)
[14922] Fix | Delete
$hover_selector = 'default' === $option_name ? $this->add_hover_to_order_class( $selector ) : $this->add_hover_to_selectors( $selector );
[14923] Fix | Delete
[14924] Fix | Delete
// Custom box shadow hover selector.
[14925] Fix | Delete
$custom_hover = self::$_->array_get( $option_settings, 'css.hover', '' );
[14926] Fix | Delete
if ( '' !== $custom_hover ) {
[14927] Fix | Delete
$hover_selector = $custom_hover;
[14928] Fix | Delete
}
[14929] Fix | Delete
[14930] Fix | Delete
// Render box shadow styles for esponsive settings.
[14931] Fix | Delete
$prev_declaration = '';
[14932] Fix | Delete
foreach( et_pb_responsive_options()->get_modes() as $device ) {
[14933] Fix | Delete
// Add device argument.
[14934] Fix | Delete
$device_declaration_args = array_merge( $declaration_args, array( 'device' => $device ) );
[14935] Fix | Delete
[14936] Fix | Delete
// Get box-shadow styles.
[14937] Fix | Delete
if ( ( $inset && 'inset' === $overlay ) || 'always' === $overlay || $has_video_bg ) {
[14938] Fix | Delete
$box_shadow_style = $box_shadow->get_overlay_style(
[14939] Fix | Delete
$function_name,
[14940] Fix | Delete
$selector,
[14941] Fix | Delete
$this->props,
[14942] Fix | Delete
$device_declaration_args
[14943] Fix | Delete
);
[14944] Fix | Delete
} else {
[14945] Fix | Delete
$box_shadow_style = $box_shadow->get_style(
[14946] Fix | Delete
$selector,
[14947] Fix | Delete
$this->props,
[14948] Fix | Delete
$device_declaration_args
[14949] Fix | Delete
);
[14950] Fix | Delete
}
[14951] Fix | Delete
[14952] Fix | Delete
// Compare current device declaration and previous declaration to avoid
[14953] Fix | Delete
// duplicate rendered styles. Or don't render if current declaration is
[14954] Fix | Delete
// empty string.
[14955] Fix | Delete
$declaration = isset( $box_shadow_style['declaration'] ) ? $box_shadow_style['declaration'] : '';
[14956] Fix | Delete
if ( $prev_declaration === $declaration || empty( $declaration ) ) {
[14957] Fix | Delete
continue;
[14958] Fix | Delete
}
[14959] Fix | Delete
[14960] Fix | Delete
$prev_declaration = $declaration;
[14961] Fix | Delete
[14962] Fix | Delete
// Set media query for tablet and phone.
[14963] Fix | Delete
if ( 'desktop' !== $device ) {
[14964] Fix | Delete
$breakpoint = 'tablet' === $device ? 'max_width_980' : 'max_width_767';
[14965] Fix | Delete
$media_query = ET_Builder_Element::get_media_query( $breakpoint );
[14966] Fix | Delete
$box_shadow_style['media_query'] = $media_query;
[14967] Fix | Delete
}
[14968] Fix | Delete
[14969] Fix | Delete
self::set_style(
[14970] Fix | Delete
$function_name,
[14971] Fix | Delete
$box_shadow_style
[14972] Fix | Delete
);
[14973] Fix | Delete
}
[14974] Fix | Delete
[14975] Fix | Delete
if ( ( $inset_hover && 'inset' == $overlay ) || 'always' == $overlay || $has_video_bg ) {
[14976] Fix | Delete
self::set_style(
[14977] Fix | Delete
$function_name,
[14978] Fix | Delete
$box_shadow->get_overlay_style(
[14979] Fix | Delete
$function_name,
[14980] Fix | Delete
$hover_selector,
[14981] Fix | Delete
$this->props,
[14982] Fix | Delete
array_merge( $declaration_args, array( 'hover' => true ) )
[14983] Fix | Delete
)
[14984] Fix | Delete
);
[14985] Fix | Delete
} else {
[14986] Fix | Delete
self::set_style(
[14987] Fix | Delete
$function_name,
[14988] Fix | Delete
$box_shadow->get_style(
[14989] Fix | Delete
$hover_selector,
[14990] Fix | Delete
$this->props,
[14991] Fix | Delete
array_merge( $declaration_args, array( 'hover' => true ) )
[14992] Fix | Delete
)
[14993] Fix | Delete
);
[14994] Fix | Delete
}
[14995] Fix | Delete
}
[14996] Fix | Delete
}
[14997] Fix | Delete
[14998] Fix | Delete
function make_options_filterable() {
[14999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function