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
* @param string $selector
[16500] Fix | Delete
* @param string $css_prop
[16501] Fix | Delete
*/
[16502] Fix | Delete
public function generate_responsive_hover_style( $option, $selector, $css_prop ) {
[16503] Fix | Delete
$responsive = et_pb_responsive_options();
[16504] Fix | Delete
$hover = et_pb_hover_options();
[16505] Fix | Delete
[16506] Fix | Delete
$values = $responsive->get_property_values( $this->props, $option );
[16507] Fix | Delete
$hover_value = $hover->get_value( $option, $this->props );
[16508] Fix | Delete
[16509] Fix | Delete
$responsive->generate_responsive_css( $values, $selector, $css_prop, $this->slug, '', 'color' );
[16510] Fix | Delete
[16511] Fix | Delete
if ( $hover_value ) {
[16512] Fix | Delete
self::set_style( $this->slug, array(
[16513] Fix | Delete
'selector' => $hover->add_hover_to_selectors( $selector ),
[16514] Fix | Delete
'declaration' => "{$css_prop}: $hover_value;"
[16515] Fix | Delete
) );
[16516] Fix | Delete
}
[16517] Fix | Delete
}
[16518] Fix | Delete
[16519] Fix | Delete
protected static function _set_style( $function_name, $style ) {
[16520] Fix | Delete
$declaration = rtrim($style['declaration']);
[16521] Fix | Delete
if ( empty($declaration) ) {
[16522] Fix | Delete
// Do not add empty declarations
[16523] Fix | Delete
return;
[16524] Fix | Delete
}
[16525] Fix | Delete
$builder_post_types = et_builder_get_builder_post_types();
[16526] Fix | Delete
$allowed_post_types = apply_filters( 'et_builder_set_style_allowed_post_types', $builder_post_types );
[16527] Fix | Delete
[16528] Fix | Delete
if ( $builder_post_types !== $allowed_post_types ) {
[16529] Fix | Delete
$matches = array_intersect( $allowed_post_types, array_keys( self::$_module_slugs_by_post_type ) );
[16530] Fix | Delete
$allowed = false;
[16531] Fix | Delete
[16532] Fix | Delete
foreach ( $matches as $post_type ) {
[16533] Fix | Delete
if ( ! isset( self::$_module_slugs_by_post_type[ $post_type ] ) ) {
[16534] Fix | Delete
continue;
[16535] Fix | Delete
}
[16536] Fix | Delete
[16537] Fix | Delete
if ( in_array( $function_name, self::$_module_slugs_by_post_type[ $post_type ] ) ) {
[16538] Fix | Delete
$allowed = true;
[16539] Fix | Delete
break;
[16540] Fix | Delete
}
[16541] Fix | Delete
}
[16542] Fix | Delete
[16543] Fix | Delete
if ( ! $allowed ) {
[16544] Fix | Delete
return;
[16545] Fix | Delete
}
[16546] Fix | Delete
}
[16547] Fix | Delete
[16548] Fix | Delete
global $et_pb_rendering_column_content;
[16549] Fix | Delete
[16550] Fix | Delete
// do not process all the styles if FB enabled. Only those for modules without fb support and styles for the internal modules from Blog/Slider
[16551] Fix | Delete
$main_query_post = ET_Post_Stack::get_main_post();
[16552] Fix | Delete
$main_query_post_id = null !== $main_query_post ? $main_query_post->ID : 0;
[16553] Fix | Delete
$editing_current_post = et_fb_is_enabled() && self::get_layout_id() === $main_query_post_id;
[16554] Fix | Delete
if ( $editing_current_post && ! in_array( $function_name, self::get_fb_unsupported_modules() ) && ! $et_pb_rendering_column_content ) {
[16555] Fix | Delete
return;
[16556] Fix | Delete
}
[16557] Fix | Delete
[16558] Fix | Delete
$order_class_name = self::get_module_order_class( $function_name );
[16559] Fix | Delete
[16560] Fix | Delete
$selector = str_replace( '%%order_class%%', ".{$order_class_name}", $style['selector'] );
[16561] Fix | Delete
$selector = str_replace( '%order_class%', ".{$order_class_name}", $selector );
[16562] Fix | Delete
[16563] Fix | Delete
// %%parent_class%% only works if child module's slug is `parent_slug` + _item suffix. If child module slug
[16564] Fix | Delete
// use different slug structure, %%parent_class%% should not be used
[16565] Fix | Delete
if ( false !== strpos( $selector, '%%parent_class%%' ) ) {
[16566] Fix | Delete
$parent_class = str_replace( '_item', '', $function_name );
[16567] Fix | Delete
$selector = str_replace( '%%parent_class%%', ".{$parent_class}", $selector );
[16568] Fix | Delete
}
[16569] Fix | Delete
[16570] Fix | Delete
$selector = strip_tags( apply_filters( 'et_pb_set_style_selector', $selector, $function_name ) );
[16571] Fix | Delete
$selector = et_builder_maybe_wrap_css_selectors( $selector, false );
[16572] Fix | Delete
[16573] Fix | Delete
// New lines are saved as || in CSS Custom settings, remove them
[16574] Fix | Delete
$declaration = preg_replace( '/(\|\|)/i', '', $declaration );
[16575] Fix | Delete
[16576] Fix | Delete
$media_query = isset( $style[ 'media_query' ] ) ? $style[ 'media_query' ] : 'general';
[16577] Fix | Delete
$internal = $et_pb_rendering_column_content && self::$prepare_internal_styles;
[16578] Fix | Delete
$style_key = self::get_style_key();
[16579] Fix | Delete
$styles = self::get_style_array( $internal );
[16580] Fix | Delete
[16581] Fix | Delete
// prepare styles for internal content. Used in Blog/Slider modules if they contain Divi modules
[16582] Fix | Delete
if ( isset( $styles[ $media_query ][ $selector ]['declaration'] ) ) {
[16583] Fix | Delete
$styles[ $media_query ][ $selector ]['declaration'] = sprintf(
[16584] Fix | Delete
'%1$s %2$s',
[16585] Fix | Delete
$styles[ $media_query ][ $selector ]['declaration'],
[16586] Fix | Delete
$declaration
[16587] Fix | Delete
);
[16588] Fix | Delete
} else {
[16589] Fix | Delete
$styles[ $media_query ][ $selector ]['declaration'] = $declaration;
[16590] Fix | Delete
}
[16591] Fix | Delete
[16592] Fix | Delete
if ( isset( $style['priority'] ) ) {
[16593] Fix | Delete
$styles[ $media_query ][ $selector ]['priority'] = (int) $style['priority'];
[16594] Fix | Delete
}
[16595] Fix | Delete
[16596] Fix | Delete
if ( $internal ) {
[16597] Fix | Delete
self::$internal_modules_styles[ $style_key ] = $styles;
[16598] Fix | Delete
} else {
[16599] Fix | Delete
self::$styles[ $style_key ] = $styles;
[16600] Fix | Delete
}
[16601] Fix | Delete
}
[16602] Fix | Delete
[16603] Fix | Delete
static function get_module_order_class( $function_name ) {
[16604] Fix | Delete
global $et_pb_rendering_column_content, $et_pb_predefined_module_index;
[16605] Fix | Delete
[16606] Fix | Delete
// determine whether we need to get the internal module class or regular
[16607] Fix | Delete
$get_inner_module_class = $et_pb_rendering_column_content;
[16608] Fix | Delete
[16609] Fix | Delete
if ( $get_inner_module_class ) {
[16610] Fix | Delete
if ( self::_get_index( array( self::INDEX_INNER_MODULE_ORDER, $function_name ) ) === -1 ) {
[16611] Fix | Delete
return false;
[16612] Fix | Delete
}
[16613] Fix | Delete
} else {
[16614] Fix | Delete
if ( self::_get_index( array( self::INDEX_MODULE_ORDER, $function_name ) ) === -1 ) {
[16615] Fix | Delete
return false;
[16616] Fix | Delete
}
[16617] Fix | Delete
}
[16618] Fix | Delete
[16619] Fix | Delete
if ( isset( $et_pb_predefined_module_index ) && $et_pb_predefined_module_index ) {
[16620] Fix | Delete
$shortcode_order_num = $et_pb_predefined_module_index;
[16621] Fix | Delete
} else {
[16622] Fix | Delete
$shortcode_order_num = $get_inner_module_class ? self::_get_index( array( self::INDEX_INNER_MODULE_ORDER, $function_name ) ) : self::_get_index( array( self::INDEX_MODULE_ORDER, $function_name ) );
[16623] Fix | Delete
}
[16624] Fix | Delete
[16625] Fix | Delete
$theme_builder_suffix = self::_get_theme_builder_order_class_suffix();
[16626] Fix | Delete
$order_class_name = sprintf( '%1$s_%2$s%3$s', $function_name, $shortcode_order_num, $theme_builder_suffix );
[16627] Fix | Delete
[16628] Fix | Delete
return $order_class_name;
[16629] Fix | Delete
}
[16630] Fix | Delete
[16631] Fix | Delete
static function set_order_class( $function_name ) {
[16632] Fix | Delete
global $et_pb_rendering_column_content;
[16633] Fix | Delete
[16634] Fix | Delete
// determine whether we need to update the internal module class or regular
[16635] Fix | Delete
$process_inner_module_class = $et_pb_rendering_column_content;
[16636] Fix | Delete
[16637] Fix | Delete
if ( $process_inner_module_class ) {
[16638] Fix | Delete
$current_inner_index = self::_get_index( array( self::INDEX_INNER_MODULE_ORDER, $function_name ) );
[16639] Fix | Delete
[16640] Fix | Delete
self::_set_index(
[16641] Fix | Delete
array( self::INDEX_INNER_MODULE_ORDER, $function_name ),
[16642] Fix | Delete
$current_inner_index > -1 ? $current_inner_index + 1 : self::$internal_modules_counter
[16643] Fix | Delete
);
[16644] Fix | Delete
} else {
[16645] Fix | Delete
self::_set_index(
[16646] Fix | Delete
array( self::INDEX_MODULE_ORDER, $function_name ),
[16647] Fix | Delete
self::_get_index( array( self::INDEX_MODULE_ORDER, $function_name ) ) + 1
[16648] Fix | Delete
);
[16649] Fix | Delete
}
[16650] Fix | Delete
}
[16651] Fix | Delete
[16652] Fix | Delete
static function add_module_order_class( $module_class, $function_name ) {
[16653] Fix | Delete
$order_class_name = self::get_module_order_class( $function_name );
[16654] Fix | Delete
[16655] Fix | Delete
return "{$module_class} {$order_class_name}";
[16656] Fix | Delete
}
[16657] Fix | Delete
[16658] Fix | Delete
/**
[16659] Fix | Delete
* Generate video background markup.
[16660] Fix | Delete
*
[16661] Fix | Delete
* @since 3.23 Add support for responsive settings.
[16662] Fix | Delete
*
[16663] Fix | Delete
* @param array $args Background values.
[16664] Fix | Delete
* @param string $base_name Background base name.
[16665] Fix | Delete
* @return string Video background string value.
[16666] Fix | Delete
*/
[16667] Fix | Delete
function video_background( $args = array(), $base_name = 'background' ) {
[16668] Fix | Delete
$attr_prefix = "{$base_name}_";
[16669] Fix | Delete
$custom_prefix = 'background' === $base_name ? '' : "{$base_name}_";
[16670] Fix | Delete
$module_attrs = $this->props;
[16671] Fix | Delete
[16672] Fix | Delete
// Default background class for each devices.
[16673] Fix | Delete
$background_video_class = '';
[16674] Fix | Delete
$background_video_class_tablet = 'et_pb_section_video_bg_tablet';
[16675] Fix | Delete
$background_video_class_phone = 'et_pb_section_video_bg_phone';
[16676] Fix | Delete
$background_video_class_hover = 'et_pb_section_video_bg_hover';
[16677] Fix | Delete
[16678] Fix | Delete
// Hover and Responsive Status.
[16679] Fix | Delete
$hover_enabled = self::$_->array_get( $this->props, "{$base_name}__hover_enabled", 'off' );
[16680] Fix | Delete
$is_background_hover = 'on' === $hover_enabled;
[16681] Fix | Delete
$is_background_mobile = et_pb_responsive_options()->is_responsive_enabled( $this->props, $base_name );
[16682] Fix | Delete
[16683] Fix | Delete
if ( ! empty( $args ) ) {
[16684] Fix | Delete
$background_video = self::get_video_background( $args );
[16685] Fix | Delete
$background_video_tablet = '';
[16686] Fix | Delete
$background_video_phone = '';
[16687] Fix | Delete
$background_video_hover = '';
[16688] Fix | Delete
[16689] Fix | Delete
$pause_outside_viewport = self::$_->array_get( $args, "{$attr_prefix}video_pause_outside_viewport", 'off' );
[16690] Fix | Delete
$allow_player_pause = self::$_->array_get( $args, "{$custom_prefix}allow_player_pause", 'off' );
[16691] Fix | Delete
[16692] Fix | Delete
} else {
[16693] Fix | Delete
$background_videos = array();
[16694] Fix | Delete
[16695] Fix | Delete
// Desktop.
[16696] Fix | Delete
$default_args = array(
[16697] Fix | Delete
"{$attr_prefix}video_mp4" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_mp4" ),
[16698] Fix | Delete
"{$attr_prefix}video_webm" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_webm" ),
[16699] Fix | Delete
"{$attr_prefix}video_width" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_width", '', true ),
[16700] Fix | Delete
"{$attr_prefix}video_height" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_height", '', true ),
[16701] Fix | Delete
'computed_variables' => array(
[16702] Fix | Delete
'base_name' => $base_name,
[16703] Fix | Delete
),
[16704] Fix | Delete
);
[16705] Fix | Delete
[16706] Fix | Delete
// Collecting background videos.
[16707] Fix | Delete
$background_videos['desktop'] = self::get_video_background( $default_args );
[16708] Fix | Delete
$module_attrs["video_{$base_name}_values"] = $background_videos;
[16709] Fix | Delete
[16710] Fix | Delete
// Get video and display status.
[16711] Fix | Delete
$background_video_status = et_pb_responsive_options()->get_inheritance_background_value( $module_attrs, "video_{$base_name}_values", 'desktop', $base_name, $this->fields_unprocessed );
[16712] Fix | Delete
$background_video = self::$_->array_get( $background_video_status, 'video', '' );
[16713] Fix | Delete
$background_display = self::$_->array_get( $background_video_status, 'display', '' );
[16714] Fix | Delete
[16715] Fix | Delete
// Hover.
[16716] Fix | Delete
$background_video_hover = '';
[16717] Fix | Delete
$background_display_hover = '';
[16718] Fix | Delete
if ( $is_background_hover ) {
[16719] Fix | Delete
$hover_args = array(
[16720] Fix | Delete
"{$attr_prefix}video_mp4__hover" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_mp4__hover" ),
[16721] Fix | Delete
"{$attr_prefix}video_webm__hover" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_webm__hover" ),
[16722] Fix | Delete
"{$attr_prefix}video_width__hover" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_width__hover", '', true ),
[16723] Fix | Delete
"{$attr_prefix}video_height__hover" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_height__hover", '', true ),
[16724] Fix | Delete
'computed_variables' => array(
[16725] Fix | Delete
'base_name' => $base_name,
[16726] Fix | Delete
'device' => '_hover',
[16727] Fix | Delete
),
[16728] Fix | Delete
);
[16729] Fix | Delete
[16730] Fix | Delete
// Collecting background videos.
[16731] Fix | Delete
$background_videos['hover'] = self::get_video_background( $hover_args );
[16732] Fix | Delete
$module_attrs["video_{$base_name}_values"] = $background_videos;
[16733] Fix | Delete
[16734] Fix | Delete
// Get video and display status.
[16735] Fix | Delete
$background_video_status_hover = et_pb_responsive_options()->get_inheritance_background_value( $module_attrs, "video_{$base_name}_values", 'hover', $base_name, $this->fields_unprocessed );
[16736] Fix | Delete
$background_video_hover = self::$_->array_get( $background_video_status_hover, 'video', '' );
[16737] Fix | Delete
$background_display_hover = self::$_->array_get( $background_video_status_hover, 'display', '' );
[16738] Fix | Delete
[16739] Fix | Delete
}
[16740] Fix | Delete
[16741] Fix | Delete
// Tablet and Phone.
[16742] Fix | Delete
$background_video_tablet = '';
[16743] Fix | Delete
$background_display_tablet = '';
[16744] Fix | Delete
$background_video_phone = '';
[16745] Fix | Delete
$background_display_phone = '';
[16746] Fix | Delete
if ( $is_background_mobile ) {
[16747] Fix | Delete
$tablet_args = array(
[16748] Fix | Delete
"{$attr_prefix}video_mp4_tablet" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_mp4_tablet" ),
[16749] Fix | Delete
"{$attr_prefix}video_webm_tablet" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_webm_tablet" ),
[16750] Fix | Delete
"{$attr_prefix}video_width_tablet" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_width_tablet", '', true ),
[16751] Fix | Delete
"{$attr_prefix}video_height_tablet" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_height_tablet", '', true ),
[16752] Fix | Delete
'computed_variables' => array(
[16753] Fix | Delete
'base_name' => $base_name,
[16754] Fix | Delete
'device' => 'tablet',
[16755] Fix | Delete
),
[16756] Fix | Delete
);
[16757] Fix | Delete
[16758] Fix | Delete
$phone_args = array(
[16759] Fix | Delete
"{$attr_prefix}video_mp4_phone" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_mp4_phone" ),
[16760] Fix | Delete
"{$attr_prefix}video_webm_phone" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_webm_phone" ),
[16761] Fix | Delete
"{$attr_prefix}video_width_phone" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_width_phone", '', true ),
[16762] Fix | Delete
"{$attr_prefix}video_height_phone" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_height_phone", '', true ),
[16763] Fix | Delete
'computed_variables' => array(
[16764] Fix | Delete
'base_name' => $base_name,
[16765] Fix | Delete
'device' => 'phone',
[16766] Fix | Delete
),
[16767] Fix | Delete
);
[16768] Fix | Delete
[16769] Fix | Delete
// Collecting background videos.
[16770] Fix | Delete
$background_videos['tablet'] = self::get_video_background( $tablet_args );
[16771] Fix | Delete
$background_videos['phone'] = self::get_video_background( $phone_args );
[16772] Fix | Delete
$module_attrs["video_{$base_name}_values"] = $background_videos;
[16773] Fix | Delete
[16774] Fix | Delete
// Get video and display status.
[16775] Fix | Delete
$background_video_status_tablet = et_pb_responsive_options()->get_inheritance_background_value( $module_attrs, "video_{$base_name}_values", 'tablet', $base_name, $this->fields_unprocessed );
[16776] Fix | Delete
$background_video_tablet = self::$_->array_get( $background_video_status_tablet, 'video', '' );
[16777] Fix | Delete
$background_display_tablet = self::$_->array_get( $background_video_status_tablet, 'display', '' );
[16778] Fix | Delete
[16779] Fix | Delete
$background_video_status_phone = et_pb_responsive_options()->get_inheritance_background_value( $module_attrs, "video_{$base_name}_values", 'phone', $base_name, $this->fields_unprocessed );
[16780] Fix | Delete
$background_video_phone = self::$_->array_get( $background_video_status_phone, 'video', '' );
[16781] Fix | Delete
$background_display_phone = self::$_->array_get( $background_video_status_phone, 'display', '' );
[16782] Fix | Delete
}
[16783] Fix | Delete
[16784] Fix | Delete
// Set background video and class. Inherit is used to avoid rendering the same video.
[16785] Fix | Delete
if ( '' !== $background_display_phone ) {
[16786] Fix | Delete
if ( 'hide' === $background_display_phone ) {
[16787] Fix | Delete
$background_video_class = 'et_pb_section_video_bg_desktop_tablet';
[16788] Fix | Delete
$background_video_class_tablet = 'et_pb_section_video_bg_tablet_only';
[16789] Fix | Delete
} else if ( 'inherit' === $background_display_phone ) {
[16790] Fix | Delete
$background_video_phone = '';
[16791] Fix | Delete
}
[16792] Fix | Delete
}
[16793] Fix | Delete
[16794] Fix | Delete
if ( '' !== $background_display_tablet ) {
[16795] Fix | Delete
if ( 'hide' === $background_display_tablet ) {
[16796] Fix | Delete
$background_video_class = 'et_pb_section_video_bg_desktop_only';
[16797] Fix | Delete
} else if ( 'inherit' === $background_display_tablet ) {
[16798] Fix | Delete
$background_video_tablet = '';
[16799] Fix | Delete
}
[16800] Fix | Delete
}
[16801] Fix | Delete
[16802] Fix | Delete
if ( '' !== $background_display_hover ) {
[16803] Fix | Delete
if ( 'inherit' === $background_display_hover ) {
[16804] Fix | Delete
$background_video_class .= ' et_pb_section_video_bg_hover_inherit';
[16805] Fix | Delete
$background_video_hover = '';
[16806] Fix | Delete
}
[16807] Fix | Delete
}
[16808] Fix | Delete
}
[16809] Fix | Delete
[16810] Fix | Delete
$video_background = '';
[16811] Fix | Delete
[16812] Fix | Delete
// Desktop.
[16813] Fix | Delete
if ( $background_video ) {
[16814] Fix | Delete
// Video on desktop properties.
[16815] Fix | Delete
$pause_outside_viewport = self::$_->array_get( $this->props, "{$attr_prefix}video_pause_outside_viewport", '' );
[16816] Fix | Delete
$allow_player_pause = self::$_->array_get( $this->props, "{$custom_prefix}allow_player_pause", 'off' );
[16817] Fix | Delete
[16818] Fix | Delete
$video_background .= sprintf(
[16819] Fix | Delete
'<span class="et_pb_section_video_bg %2$s %3$s%4$s">
[16820] Fix | Delete
%1$s
[16821] Fix | Delete
</span>',
[16822] Fix | Delete
$background_video,
[16823] Fix | Delete
$background_video_class,
[16824] Fix | Delete
( 'on' === $allow_player_pause ? ' et_pb_allow_player_pause' : '' ),
[16825] Fix | Delete
( 'off' === $pause_outside_viewport ? ' et_pb_video_play_outside_viewport' : '' )
[16826] Fix | Delete
);
[16827] Fix | Delete
}
[16828] Fix | Delete
[16829] Fix | Delete
// Hover.
[16830] Fix | Delete
if ( $is_background_hover ) {
[16831] Fix | Delete
if ( $background_video_hover ) {
[16832] Fix | Delete
// Video on hover properties.
[16833] Fix | Delete
$pause_outside_viewport_hover = self::$_->array_get( $this->props, "{$attr_prefix}video_pause_outside_viewport__hover", '' );
[16834] Fix | Delete
$allow_player_pause_hover = self::$_->array_get( $this->props, "{$custom_prefix}allow_player_pause__hover", 'off' );
[16835] Fix | Delete
[16836] Fix | Delete
$video_background .= sprintf(
[16837] Fix | Delete
'<span class="et_pb_section_video_bg %2$s %3$s%4$s">
[16838] Fix | Delete
%1$s
[16839] Fix | Delete
</span>',
[16840] Fix | Delete
$background_video_hover,
[16841] Fix | Delete
$background_video_class_hover,
[16842] Fix | Delete
( 'on' === $allow_player_pause_hover ? ' et_pb_allow_player_pause' : '' ),
[16843] Fix | Delete
( 'off' === $pause_outside_viewport_hover ? ' et_pb_video_play_outside_viewport' : '' )
[16844] Fix | Delete
);
[16845] Fix | Delete
}
[16846] Fix | Delete
[16847] Fix | Delete
$this->add_classname( 'et_pb_section_video_on_hover' );
[16848] Fix | Delete
}
[16849] Fix | Delete
[16850] Fix | Delete
// Tablet.
[16851] Fix | Delete
if ( $background_video_tablet && $is_background_mobile ) {
[16852] Fix | Delete
// Video on tablet properties.
[16853] Fix | Delete
$pause_outside_viewport_tablet = self::$_->array_get( $this->props, "{$attr_prefix}video_pause_outside_viewport_tablet", '' );
[16854] Fix | Delete
$allow_player_pause_tablet = self::$_->array_get( $this->props, "{$custom_prefix}allow_player_pause_tablet", 'off' );
[16855] Fix | Delete
[16856] Fix | Delete
$video_background .= sprintf(
[16857] Fix | Delete
'<span class="et_pb_section_video_bg %2$s %3$s%4$s">
[16858] Fix | Delete
%1$s
[16859] Fix | Delete
</span>',
[16860] Fix | Delete
$background_video_tablet,
[16861] Fix | Delete
$background_video_class_tablet,
[16862] Fix | Delete
( 'on' === $allow_player_pause_tablet ? ' et_pb_allow_player_pause' : '' ),
[16863] Fix | Delete
( 'off' === $pause_outside_viewport_tablet ? ' et_pb_video_play_outside_viewport' : '' )
[16864] Fix | Delete
);
[16865] Fix | Delete
}
[16866] Fix | Delete
[16867] Fix | Delete
// Phone.
[16868] Fix | Delete
if ( $background_video_phone && $is_background_mobile ) {
[16869] Fix | Delete
// Video on phone properties.
[16870] Fix | Delete
$pause_outside_viewport_phone = self::$_->array_get( $this->props, "{$attr_prefix}video_pause_outside_viewport_phone", '' );
[16871] Fix | Delete
$allow_player_pause_phone = self::$_->array_get( $this->props, "{$custom_prefix}allow_player_pause_phone", 'off' );
[16872] Fix | Delete
[16873] Fix | Delete
$video_background .= sprintf(
[16874] Fix | Delete
'<span class="et_pb_section_video_bg %2$s %3$s%4$s">
[16875] Fix | Delete
%1$s
[16876] Fix | Delete
</span>',
[16877] Fix | Delete
$background_video_phone,
[16878] Fix | Delete
$background_video_class_phone,
[16879] Fix | Delete
( 'on' === $allow_player_pause_phone ? ' et_pb_allow_player_pause' : '' ),
[16880] Fix | Delete
( 'off' === $pause_outside_viewport_phone ? ' et_pb_video_play_outside_viewport' : '' )
[16881] Fix | Delete
);
[16882] Fix | Delete
}
[16883] Fix | Delete
[16884] Fix | Delete
// Added classname for module wrapper
[16885] Fix | Delete
if ( '' !== $video_background ) {
[16886] Fix | Delete
wp_enqueue_style( 'wp-mediaelement' );
[16887] Fix | Delete
wp_enqueue_script( 'wp-mediaelement' );
[16888] Fix | Delete
$this->add_classname( array( 'et_pb_section_video', 'et_pb_preload' ) );
[16889] Fix | Delete
}
[16890] Fix | Delete
[16891] Fix | Delete
return $video_background;
[16892] Fix | Delete
}
[16893] Fix | Delete
[16894] Fix | Delete
function get_parallax_image_background( $base_name = 'background' ) {
[16895] Fix | Delete
$attr_prefix = "{$base_name}_";
[16896] Fix | Delete
$custom_prefix = 'background' === $base_name ? '' : "{$base_name}_";
[16897] Fix | Delete
[16898] Fix | Delete
$parallax_processed = array();
[16899] Fix | Delete
$parallax_background = '';
[16900] Fix | Delete
$hover_suffix = et_pb_hover_options()->get_suffix();
[16901] Fix | Delete
$preview_modes = array( $hover_suffix, '_phone', '_tablet', '' );
[16902] Fix | Delete
[16903] Fix | Delete
// Featured Image as Background.
[16904] Fix | Delete
$featured_image = '';
[16905] Fix | Delete
$featured_placement = '';
[16906] Fix | Delete
$featured_image_src = '';
[16907] Fix | Delete
if ( $this->featured_image_background ) {
[16908] Fix | Delete
$featured_image = self::$_->array_get( $this->props, 'featured_image', '' );
[16909] Fix | Delete
$featured_placement = self::$_->array_get( $this->props, 'featured_placement', '' );
[16910] Fix | Delete
$featured_image_src_obj = wp_get_attachment_image_src( get_post_thumbnail_id( self::_get_main_post_id() ), 'full' );
[16911] Fix | Delete
$featured_image_src = isset( $featured_image_src_obj[0] ) ? $featured_image_src_obj[0] : '';
[16912] Fix | Delete
}
[16913] Fix | Delete
[16914] Fix | Delete
foreach( $preview_modes as $suffix ) {
[16915] Fix | Delete
$is_hover = $hover_suffix === $suffix;
[16916] Fix | Delete
[16917] Fix | Delete
// A. Bail early if hover or responsive settings disabled on mobile/hover.
[16918] Fix | Delete
if ( '' !== $suffix ) {
[16919] Fix | Delete
// Ensure responsive settings is enabled on mobile.
[16920] Fix | Delete
if ( ! $is_hover && ! et_pb_responsive_options()->is_responsive_enabled( $this->props, $base_name ) ) {
[16921] Fix | Delete
continue;
[16922] Fix | Delete
}
[16923] Fix | Delete
[16924] Fix | Delete
// Ensure hover settings is enabled.
[16925] Fix | Delete
if ( $is_hover && ! et_pb_hover_options()->is_enabled( $base_name, $this->props ) ) {
[16926] Fix | Delete
continue;
[16927] Fix | Delete
}
[16928] Fix | Delete
}
[16929] Fix | Delete
[16930] Fix | Delete
// Prepare preview mode.
[16931] Fix | Delete
$mode = '' !== $suffix ? str_replace( '_', '', $suffix ) : 'desktop';
[16932] Fix | Delete
$mode = $is_hover ? 'hover' : $mode;
[16933] Fix | Delete
[16934] Fix | Delete
// B.1. Get inherited background value.
[16935] Fix | Delete
$background_image = et_pb_responsive_options()->get_inheritance_background_value( $this->props, "{$attr_prefix}image", $mode, $base_name, $this->fields_unprocessed );
[16936] Fix | Delete
$parallax = $is_hover ? et_pb_hover_options()->get_raw_value( "{$custom_prefix}parallax", $this->props ) : et_pb_responsive_options()->get_any_value( $this->props, "{$custom_prefix}parallax{$suffix}", '', true );
[16937] Fix | Delete
$parallax_method = $is_hover ? et_pb_hover_options()->get_raw_value( "{$custom_prefix}parallax_method", $this->props ) : et_pb_responsive_options()->get_any_value( $this->props, "{$custom_prefix}parallax_method{$suffix}", '', true );
[16938] Fix | Delete
[16939] Fix | Delete
// B.2. Set default value for parallax and parallax method on hover when they are empty.
[16940] Fix | Delete
if ( $is_hover ) {
[16941] Fix | Delete
$parallax = empty( $parallax ) ? et_pb_responsive_options()->get_any_value( $this->props, "{$custom_prefix}parallax", '', true ) : $parallax;
[16942] Fix | Delete
$parallax_method = empty( $parallax_method ) ? et_pb_responsive_options()->get_any_value( $this->props, "{$custom_prefix}parallax_method", '', true ) : $parallax_method;
[16943] Fix | Delete
}
[16944] Fix | Delete
[16945] Fix | Delete
// B.3. Override background image with featured image if needed.
[16946] Fix | Delete
if ( 'on' === $featured_image && 'background' === $featured_placement && '' !== $featured_image_src ) {
[16947] Fix | Delete
$background_image = $featured_image_src;
[16948] Fix | Delete
}
[16949] Fix | Delete
[16950] Fix | Delete
// C.1. Parallax BG Class to inform if other modes exist.
[16951] Fix | Delete
$parallax_classname = array();
[16952] Fix | Delete
if ( ( '_tablet' === $suffix || '' === $suffix ) && in_array( '_phone', $parallax_processed ) ) {
[16953] Fix | Delete
$parallax_classname[] = 'et_parallax_bg_phone_exist';
[16954] Fix | Delete
}
[16955] Fix | Delete
[16956] Fix | Delete
if ( '' === $suffix && in_array( '_tablet', $parallax_processed ) ) {
[16957] Fix | Delete
$parallax_classname[] = 'et_parallax_bg_tablet_exist';
[16958] Fix | Delete
}
[16959] Fix | Delete
[16960] Fix | Delete
if ( in_array( $hover_suffix, $parallax_processed ) ) {
[16961] Fix | Delete
$parallax_classname[] = 'et_parallax_bg_hover_exist';
[16962] Fix | Delete
}
[16963] Fix | Delete
[16964] Fix | Delete
// C.2. Set up parallax class and wrapper.
[16965] Fix | Delete
if ( '' !== $background_image && 'on' === $parallax ) {
[16966] Fix | Delete
$parallax_classname[] = 'et_parallax_bg';
[16967] Fix | Delete
[16968] Fix | Delete
if ( 'off' === $parallax_method ) {
[16969] Fix | Delete
$parallax_classname[] = 'et_pb_parallax_css';
[16970] Fix | Delete
}
[16971] Fix | Delete
[16972] Fix | Delete
// Parallax BG Class with suffix.
[16973] Fix | Delete
if ( '' !== $suffix ) {
[16974] Fix | Delete
$parallax_classname[] = "et_parallax_bg{$suffix}";
[16975] Fix | Delete
}
[16976] Fix | Delete
[16977] Fix | Delete
$parallax_background .= sprintf(
[16978] Fix | Delete
'<span class="et_parallax_bg_wrap"><span
[16979] Fix | Delete
class="%1$s"
[16980] Fix | Delete
style="background-image: url(%2$s);"
[16981] Fix | Delete
></span></span>',
[16982] Fix | Delete
esc_attr( implode( ' ', $parallax_classname ) ),
[16983] Fix | Delete
esc_url( $background_image )
[16984] Fix | Delete
);
[16985] Fix | Delete
[16986] Fix | Delete
// set `.et_parallax_bg_wrap` border-radius.
[16987] Fix | Delete
et_set_parallax_bg_wrap_border_radius( $this->props, $this->slug, $this->main_css_element );
[16988] Fix | Delete
}
[16989] Fix | Delete
[16990] Fix | Delete
// C.3. Hover parallax class.
[16991] Fix | Delete
if ( '' !== $background_image && $is_hover ) {
[16992] Fix | Delete
$this->add_classname( 'et_pb_section_parallax_hover' );
[16993] Fix | Delete
}
[16994] Fix | Delete
[16995] Fix | Delete
array_push( $parallax_processed, $suffix );
[16996] Fix | Delete
}
[16997] Fix | Delete
[16998] Fix | Delete
// Added classname for module wrapper
[16999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function