Linux heracles.o2switch.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
/
home
/
ophq1335
/
www
/
wp-content
/
plugins
/
divi-modules-pro
/
includes
/
/home/ophq1335/www/wp-content/plugins/divi-modules-pro/includes/loader.php
<?php if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } if ( !class_exists('DMPRO_Builder_Module') ) { abstract class DMPRO_Builder_Module extends ET_Builder_Module { public function __construct() { parent::__construct(); $this->init_hooks(); } function init_hooks() { add_filter( 'the_content', array( $this, 'process_dmpro_shortcodes' ), 1 ); } function process_dmpro_shortcodes( $content ) { if ( is_singular() && in_the_loop() && is_main_query() ) { if ( strpos( $content, "[dmpro_carousel_child" ) !== false ) { $content = $this->parse_dmpro_noncontent_fields( $content, 'dmpro_carousel_child' ); } } if ( is_singular() && is_main_query() ) { if ( strpos( $content, "[dmpro_timeline_item" ) !== false ) { $content = $this->parse_dmpro_noncontent_fields( $content, 'dmpro_timeline_item' ); } } return $content; } function parse_dmpro_noncontent_fields( $content, $shortcode ) { $shortcode_start = '[' . $shortcode; $shortcode_start_len = strlen( $shortcode_start ); $shortcode_end = '[/' . $shortcode . ']'; $shortcode_end_len = strlen( $shortcode_end ); $offset = 0; $positions = array(); $parsed_content = $content; while ( ( $pos = strpos($content, $shortcode_start, $offset) ) !== false ) { $offset = $pos + 1; $positions[] = $pos; } foreach ( $positions as $pos ) { $content_from_shortcode_pos = substr( $content, $pos ); $shortcode_end_pos = strpos( $content_from_shortcode_pos, $shortcode_end ); $shortcode_content = substr( $content_from_shortcode_pos, 0, $shortcode_end_pos + $shortcode_end_len ); $parsed_shortcode_content = $this->encode_html_octags( $shortcode_content ); $parsed_content = str_replace( $shortcode_content, $parsed_shortcode_content, $parsed_content ); } return $parsed_content; } function encode_html_octags( $content ) { $trans = array( '<' => '#dmpro#lt;', '>' => '#dmpro#gt;' ); $parsed_content = strtr( $content, $trans ); return $parsed_content; } function decode_html_octags( $content ) { $trans = array( '#dmpro#lt;' => '<', '#dmpro#gt;' => '>' ); $parsed_content = strtr( $content, $trans ); return $parsed_content; } function replace_html_entities( $text ) { $replace_htmlentities = array( '”' => '', '″' => '', ); $text = strtr( $text, $replace_htmlentities ); return $text; } function replace_encoded_quotes( $text ) { $text = str_replace( array( '“', '”', '″', '%22' ), '"', $text ); return $text; } function filter_fix_shortcode( $text ) { if ( false !== strpos( $text, '%91' ) && false !== strpos( $text, '%93' ) ) { $text = str_replace( array( '%91', '%93' ), array( '[', ']' ), $text ); } if ( false !== strpos( $text, '[' ) && false !== strpos( $text, ']' ) ) { $text = str_replace( array( '[', ']' ), array( '[', ']' ), $text ); } return $text; } function animations_entrance() { return array( 'none' => esc_html__('None', DMPRO_TEXTDOMAIN), 'Back entrances' => array( 'backInDown' => esc_html__('Back In Down', DMPRO_TEXTDOMAIN), 'backInLeft' => esc_html__('Back In Left', DMPRO_TEXTDOMAIN), 'backInRight' => esc_html__('Back In Right', DMPRO_TEXTDOMAIN), 'backInUp' => esc_html__('Back In Up', DMPRO_TEXTDOMAIN) ), 'Bouncing' => array( 'bounceIn' => esc_html__('Bounce In', DMPRO_TEXTDOMAIN), 'bounceInDown' => esc_html__('Bounce In Down', DMPRO_TEXTDOMAIN), 'bounceInLeft' => esc_html__('Bounce In Left', DMPRO_TEXTDOMAIN), 'bounceInRight' => esc_html__('Bounce In Right', DMPRO_TEXTDOMAIN), 'bounceInUp' => esc_html__('Bounce In Up', DMPRO_TEXTDOMAIN) ), 'Fading' => array( 'fadeIn' => esc_html__('Fade In', DMPRO_TEXTDOMAIN), 'fadeInDown' => esc_html__('Fade In Down', DMPRO_TEXTDOMAIN), 'fadeInLeft' => esc_html__('Fade In Left', DMPRO_TEXTDOMAIN), 'fadeInRight' => esc_html__('Fade In Right', DMPRO_TEXTDOMAIN), 'fadeInUp' => esc_html__('Fade In Up', DMPRO_TEXTDOMAIN), 'fadeInTopLeft' => esc_html__('Fade In Top Left', DMPRO_TEXTDOMAIN), 'fadeInTopRight' => esc_html__('Fade In Top Right', DMPRO_TEXTDOMAIN), 'fadeInBottomLeft' => esc_html__('Fade In Bottom Left', DMPRO_TEXTDOMAIN), 'fadeInBottomRight' => esc_html__('Fade In Bottom Right', DMPRO_TEXTDOMAIN) ), 'Flippers' => array( 'flipInX' => esc_html__('Flip In X', DMPRO_TEXTDOMAIN), 'flipInY' => esc_html__('Flip In Y', DMPRO_TEXTDOMAIN) ), 'Lightspeed' => array( 'lightSpeedInRight' => esc_html__('LightSpeed In Right', DMPRO_TEXTDOMAIN), 'lightSpeedInLeft' => esc_html__('LightSpeed In Left', DMPRO_TEXTDOMAIN) ), 'Rotating' => array( 'rotateIn' => esc_html__('Rotate In', DMPRO_TEXTDOMAIN), 'rotateInDownLeft' => esc_html__('Rotate In Down Left', DMPRO_TEXTDOMAIN), 'rotateInDownRight' => esc_html__('Rotate In Down Right', DMPRO_TEXTDOMAIN), 'rotateInUpLeft' => esc_html__('Rotate In Up Left', DMPRO_TEXTDOMAIN), 'rotateInUpRight' => esc_html__('Rotate In Up Right', DMPRO_TEXTDOMAIN) ), 'Specials' => array( 'jackInTheBox' => esc_html__('Jack In The Box', DMPRO_TEXTDOMAIN), 'rollIn' => esc_html__('Roll In', DMPRO_TEXTDOMAIN), 'rollOut' => esc_html__('Roll Out', DMPRO_TEXTDOMAIN) ), 'Zooming' => array( 'zoomIn' => esc_html__('Zoom In', DMPRO_TEXTDOMAIN), 'zoomInDown' => esc_html__('Zoom In Down', DMPRO_TEXTDOMAIN), 'zoomInLeft' => esc_html__('Zoom In Left', DMPRO_TEXTDOMAIN), 'zoomInRight' => esc_html__('Zoom In Right', DMPRO_TEXTDOMAIN), 'zoomInUp' => esc_html__('Zoom In Up', DMPRO_TEXTDOMAIN) ) ); } protected function generate_full_background( $module_fields, $settings ) { $background_field_name = $settings['background_field_name']; $base_name = $settings['base_name']; $tab_slug = $settings['tab_slug']; $toggle_slug = $settings['toggle_slug']; $module_fields[ $background_field_name ][ 'background_fields' ] = array_merge( $module_fields[ $background_field_name ][ 'background_fields' ], self::generate_background_additional_options( $module_fields, $background_field_name, $base_name, $tab_slug, $toggle_slug ) ); $module_fields = array_merge($module_fields, $this->generate_background_options( $base_name, 'skip', $tab_slug, $toggle_slug, $background_field_name )); $module_fields = array_merge($module_fields, $this->generate_background_options( $base_name, 'pattern', $tab_slug, $toggle_slug, $background_field_name )); $module_fields = array_merge($module_fields, $this->generate_background_options( $base_name, 'mask', $tab_slug, $toggle_slug, $background_field_name )); // Add "Fit video to screen" field $module_fields = $this->add_fitvideotoscreen_field( $base_name, $module_fields, $tab_slug, $toggle_slug, $background_field_name ); // Hide required fields to allow pattern and mask fields work in custom Divi fields $module_fields = $this->hide_required_patternmask_fields( $base_name, $module_fields ); return $module_fields; } protected function add_fitvideotoscreen_field( $base_name, $module_fields = array(), $tab_slug = '', $toggle_slug = '', $background_field_name = '' ) { if ( empty( $module_fields ) || empty( $tab_slug ) || empty( $toggle_slug ) || empty( $background_field_name ) || !isset( $module_fields[ $background_field_name ] ) ) { return $module_fields; } $attr_prefix = "{$base_name}_"; $module_fields[ $background_field_name ][ 'background_fields' ][ $attr_prefix . 'video_fit_to_screen' ] = array( 'label' => esc_html__( 'Fit video to screen', DMPRO_TEXTDOMAIN ), 'type' => 'yes_no_button', 'background_tab' => 'video', 'priority' => 455, 'tab_slug' => $tab_slug, 'toggle_slug' => $toggle_slug, 'description' => 'Force video to fill 100% of background', 'option_category' => 'configuration', 'options' => array( 'off' => esc_html__( 'No', DMPRO_TEXTDOMAIN ), 'on' => esc_html__( 'Yes', DMPRO_TEXTDOMAIN ), ), 'mobile_options' => true, 'default' => 'on', 'default_on_front' => 'on' ); $module_fields[ $attr_prefix . 'video_fit_to_screen' ] = $module_fields[ $background_field_name ][ 'background_fields' ][ $attr_prefix . 'video_fit_to_screen']; $module_fields[ $attr_prefix . 'video_fit_to_screen' ]['tab_slug'] = ''; return $module_fields; } protected function hide_required_patternmask_fields( $base_name, $module_fields = array() ) { $attr_prefix = "{$base_name}_"; if ( empty( $module_fields ) || !isset( $module_fields[ $attr_prefix . 'enable_pattern_style'] ) ) { return $module_fields; } $module_fields[ $attr_prefix . 'enable_pattern_style']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'pattern_style']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'pattern_color']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'pattern_transform']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'pattern_size']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'pattern_width']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'pattern_height']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'pattern_repeat_origin']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'pattern_horizontal_offset']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'pattern_vertical_offset']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'pattern_repeat']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'pattern_blend_mode']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'enable_mask_style']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'mask_style']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'mask_color']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'mask_transform']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'mask_aspect_ratio']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'mask_size']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'mask_width']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'mask_height']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'mask_position']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'mask_horizontal_offset']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'mask_vertical_offset']['tab_slug'] = ''; $module_fields[ $attr_prefix . 'mask_blend_mode']['tab_slug'] = ''; return $module_fields; } protected function generate_background_additional_options( $module_fields, $background_field_name, $base_name, $tab_slug, $toggle_slug, $defaults = '' ) { if ( $defaults == '' ) { $defaults = array( 'use_background_color' => true, 'use_background_color_gradient' => true, 'use_background_image' => true, 'use_background_video' => true, 'use_background_color_reset' => true, 'use_background_pattern' => true, 'use_background_mask' => true, ); } $module_fields[ $background_field_name ] = wp_parse_args( $module_fields[$background_field_name ], $defaults ); $additional_options = array(); if ( $module_fields[ $background_field_name ]['use_background_color'] ) { $additional_options = array_merge( $additional_options, $this->generate_background_options( $base_name, 'color', $tab_slug, $toggle_slug, $background_field_name ) ); } if ( $module_fields[ $background_field_name ]['use_background_color_gradient'] ) { $additional_options = array_merge( $additional_options, $this->generate_background_options( $base_name, 'gradient', $tab_slug, $toggle_slug, null ) ); } if ( $module_fields[ $background_field_name ]['use_background_image'] ) { $additional_options = array_merge( $additional_options, $this->generate_background_options( $base_name, 'image', $tab_slug, $toggle_slug, null ) ); } if ( $module_fields[ $background_field_name ]['use_background_video'] ) { $additional_options = array_merge( $additional_options, $this->generate_background_options( $base_name, 'video', $tab_slug, $toggle_slug, null ) ); } if ( $module_fields[ $background_field_name ]['use_background_pattern'] ) { $additional_options = array_merge( $additional_options, $this->generate_background_options( $base_name, 'pattern', $tab_slug, $toggle_slug ) ); } if ( $module_fields[ $background_field_name ]['use_background_mask'] ) { $additional_options = array_merge( $additional_options, $this->generate_background_options( $base_name, 'mask', $tab_slug, $toggle_slug ) ); } return $additional_options; } /** * Process video, pattern and mask background CSS styles. * */ protected function let_process_advanced_background_styles( $css_parent, $function_name, $base_prop_name ) { $css_element = $css_parent; $pattern_selector = ET_Builder_Element::add_suffix_to_selectors( ' > .et_pb_background_pattern', $css_element ); $mask_selector = ET_Builder_Element::add_suffix_to_selectors( ' > .et_pb_background_mask', $css_element ); $css_element_pattern = $pattern_selector; $css_element_mask = $mask_selector; $css_element_hover = ''; $args = array( 'base_prop_name' => $base_prop_name, 'props' => $this->props, 'selector' => $css_element, 'selector_pattern' => $css_element_pattern, 'selector_mask' => $css_element_mask, 'selector_hover' => $css_element_hover, 'function_name' => $function_name, 'fields_definition' => $this->fields_unprocessed, 'important' => ' !important', 'has_background_color_toggle' => false, 'use_background_color' => true, 'use_background_color_gradient' => true, 'use_background_image' => true, 'use_background_video' => true, 'use_background_pattern' => true, 'use_background_mask' => true, 'use_background_color_reset' => true, ); // Process gradient $this->process_background( $css_parent, $base_prop_name, $function_name ); // Process background style. et_pb_background_options()->get_background_style( $args ); } protected function process_background( $class_name, $base_name, $render_slug ) { $props = $this->props; $attr_prefix = "{$base_name}_"; $background_options = et_pb_background_options(); $use_bg_gradient = $props["{$base_name}_use_color_gradient"]; $bg_overlays_image = $props["{$base_name}_color_gradient_overlays_image"]; $has_bg_gradient = false; $has_bg_image = false; $preview_modes = array( '_phone', '_tablet', '' ); foreach ( $preview_modes as $suffix ) { $background_images = []; $background_style = ''; $hover_suffix = et_pb_hover_options()->get_suffix(); $sticky_suffix = et_pb_sticky_options()->get_suffix(); $is_hover = $hover_suffix === $suffix; $is_sticky = $sticky_suffix === $suffix; // Prepare preview mode. $mode = '' !== $suffix ? str_replace( '_', '', $suffix ) : 'desktop'; $mode = $is_hover ? 'hover' : $mode; $mode = $is_sticky ? 'sticky' : $mode; if ( 'on' === $use_bg_gradient ) { // Get inherited background value. $background_image = et_pb_responsive_options()->get_inheritance_background_value( $props, "{$attr_prefix}image", $mode, $base_name, $this->fields_unprocessed ); $gradient_overlays_image = et_pb_responsive_options()->get_any_value( $props, "{$base_name}_color_gradient_overlays_image{$suffix}", '', true ); $background_gradient_blend = et_pb_responsive_options()->get_any_value( $props, "{$base_name}_blend{$suffix}", 'normal', true ); if ( $is_hover || $is_sticky ) { $gradient_overlays_image = et_pb_hover_options()->get_raw_value( "{$base_name}_color_gradient_overlays_image", $props, $gradient_overlays_image ); $background_gradient_blend = et_pb_hover_options()->get_raw_value( "{$base_name}_blend", $props, $background_gradient_blend ); $gradient_properties_desktop = $background_options->get_gradient_properties( $props, $base_name, '' ); $gradient_properties = $background_options->get_gradient_mode_properties( $mode, $props, $base_name, $gradient_properties_desktop ); } else { $gradient_properties = $background_options->get_gradient_properties( $props, $base_name, $suffix ); } $background_gradient_style = $background_options->get_gradient_style( $gradient_properties ); if ( !empty( $background_gradient_style ) ) { $background_images[] = $background_gradient_style; } $has_bg_gradient = true; } $bg_image = $this->props["{$base_name}_image"]; $is_bg_image_active = '' !== $bg_image; if ($is_bg_image_active) { $has_bg_image = true; $bg_size = $this->props["{$base_name}_size"]; $bg_position = $this->props["{$base_name}_position"]; $bg_repeat = $this->props["{$base_name}_repeat"]; $bg_blend = $this->props["{$base_name}_blend"]; if ('' !== $bg_size) { $background_style .= sprintf( 'background-size: %1$s !important; ', et_core_sanitized_previously($bg_size) ); } if ('' !== $bg_position) { $background_style .= sprintf( 'background-position: %1$s !important; ', et_core_sanitized_previously(str_replace('_', ' ', $bg_position)) ); } if ('' !== $bg_repeat) { $background_style .= sprintf( 'background-repeat: %1$s !important; ', et_core_sanitized_previously($bg_repeat) ); } if ('' !== $bg_blend) { $background_style .= sprintf( 'background-blend-mode: %1$s !important;', et_core_sanitized_previously($bg_blend) ); } $background_images[] = sprintf('url(%1$s)', et_core_sanitized_previously($bg_image)); } if ( !empty($background_images) ) { if ('on' !== $bg_overlays_image) { $background_images = array_reverse($background_images); } $background_style .= sprintf( 'background-image: %1$s !important;', et_core_sanitized_previously(join(', ', $background_images)) ); } if ( !$has_bg_gradient || !$has_bg_image ) { $background_color = $this->props["{$base_name}_color"]; if ( '' !== $background_color ) { $background_style .= sprintf( 'background-color: %1$s !important; ', et_core_sanitized_previously($background_color) ); } } if ( '' !== $background_style ) { $element_style = [ 'selector' => "{$class_name}", 'declaration' => rtrim($background_style), ]; if ( $mode === 'tablet' ) { $element_style['media_query'] = ET_Builder_Element::get_media_query( 'max_width_980' ); } if ( $mode === 'phone' ) { $element_style['media_query'] = ET_Builder_Element::get_media_query( 'max_width_767' ); } ET_Builder_Element::set_style( $render_slug, $element_style ); } } } protected function get_background_video( $base_name, $render_slug, $main_css_element ) { $attr_prefix = "{$base_name}_"; // Bail early if Background video isn't set if ( $this->props[ $attr_prefix . 'enable_video_mp4' ] !== 'on' && $this->props[ $attr_prefix . 'enable_video_mp4_tablet' ] !== 'on' && $this->props[ $attr_prefix . 'enable_video_mp4_phone' ] !== 'on' ) { return ''; } $output = ET_Builder_Element::video_background( null, $base_name ); $prop_background_last_edit = $attr_prefix . 'last_edited'; $prop_bg_video_pause_outside_viewport = $attr_prefix . 'video_pause_outside_viewport'; $prop_bg_allow_player_pause = $attr_prefix . 'allow_player_pause'; $unset_last_edit = false; $unset_video_pause_outside_viewport_tablet = false; $unset_allow_player_pause_tablet = false; if ( $this->props[ $attr_prefix . 'enable_video_mp4_tablet' ] === 'on' ) { $video_background_tablet = array( "{$attr_prefix}video_mp4_tablet" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_mp4_tablet" ), "{$attr_prefix}video_webm_tablet" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_webm_tablet" ), "{$attr_prefix}video_width_tablet" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_width_tablet", '', true ), "{$attr_prefix}video_height_tablet" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_height_tablet", '', true ), 'computed_variables' => array( 'base_name' => $base_name, 'device' => 'tablet', ), ); $prop_bg_video_pause_outside_viewport_tablet = $attr_prefix . 'video_pause_outside_viewport_tablet'; $prop_bg_allow_player_pause_tablet = $attr_prefix . 'allow_player_pause_tablet'; if ( !isset( $this->props[ $prop_background_last_edit ] ) || ( isset( $this->props[ $prop_background_last_edit ] ) && $this->props[ $prop_background_last_edit ] === '' ) ) { $unset_last_edit = true; $this->props[ $prop_background_last_edit ] = 'on|desktop|tablet'; } if ( isset( $this->props[ $prop_bg_video_pause_outside_viewport ] ) && ( !isset( $this->props[ $prop_bg_video_pause_outside_viewport_tablet ] ) || ( isset( $this->props[ $prop_bg_video_pause_outside_viewport_tablet ] ) && $this->props[ $prop_bg_video_pause_outside_viewport_tablet ] === '' ) ) ) { $this->props[ $prop_bg_video_pause_outside_viewport_tablet ] = $this->props[ $prop_bg_video_pause_outside_viewport ]; } if ( isset( $this->props[ $prop_bg_video_pause_outside_viewport ] ) && ( !isset( $this->props[ $prop_bg_allow_player_pause_tablet ] ) || ( isset( $this->props[ $prop_bg_allow_player_pause_tablet ] ) && $this->props[ $prop_bg_allow_player_pause_tablet ] === '' ) ) ) { $this->props[ $prop_bg_allow_player_pause_tablet ] = $this->props[ $prop_bg_allow_player_pause ]; } } if ( $this->props[ $attr_prefix . 'enable_video_mp4_phone' ] === 'on' ) { $video_background_phone = array( "{$attr_prefix}video_mp4_phone" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_mp4_phone" ), "{$attr_prefix}video_webm_phone" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_webm_phone" ), "{$attr_prefix}video_width_phone" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_width_phone", '', true ), "{$attr_prefix}video_height_phone" => et_pb_responsive_options()->get_any_value( $this->props, "{$attr_prefix}video_height_phone", '', true ), 'computed_variables' => array( 'base_name' => $base_name, 'device' => 'phone', ), ); $prop_bg_video_pause_outside_viewport_phone = $attr_prefix . 'video_pause_outside_viewport_phone'; $prop_bg_allow_player_pause_phone = $attr_prefix . 'allow_player_pause_phone'; if ( !isset( $this->props[ $prop_background_last_edit ] ) || ( isset( $this->props[ $prop_background_last_edit ] ) && $this->props[ $prop_background_last_edit ] === '' ) ) { $unset_last_edit = true; $this->props[ $prop_background_last_edit ] = 'on|desktop|tablet|phone'; } if ( isset( $this->props[ $prop_bg_video_pause_outside_viewport ] ) && ( !isset( $this->props[ $prop_bg_video_pause_outside_viewport_phone ] ) || ( isset( $this->props[ $prop_bg_video_pause_outside_viewport_phone ] ) && $this->props[ $prop_bg_video_pause_outside_viewport_phone ] === '' ) ) ) { $this->props[ $prop_bg_video_pause_outside_viewport_phone ] = $this->props[ $prop_bg_video_pause_outside_viewport ]; } if ( isset( $this->props[ $prop_bg_video_pause_outside_viewport ] ) && ( !isset( $this->props[ $prop_bg_allow_player_pause_phone ] ) || ( isset( $this->props[ $prop_bg_allow_player_pause_phone ] ) && $this->props[ $prop_bg_allow_player_pause_phone ] === '' ) ) ) { $this->props[ $prop_bg_allow_player_pause_phone ] = $this->props[ $prop_bg_allow_player_pause ]; } } self::set_style( $render_slug, array( 'selector' => $this->main_css_element . '_module .dmpro_popup_wrapper .et_pb_section_video_bg .mejs-video,' . $this->main_css_element . '_module .dmpro_popup_wrapper .et_pb_section_video_bg .mejs-mediaelement,' . $this->main_css_element . '_module .dmpro_popup_wrapper .et_pb_section_video_bg video', 'declaration' => 'min-width:100% !important; min-height:100% !important; height:100% !important; margin:0 !important;', ) ); self::set_style( $render_slug, array( 'selector' => $this->main_css_element . '_module .dmpro_popup_wrapper .et_pb_section_video_bg .mejs-video', 'declaration' => 'left:0;', ) ); if ( $this->props[ 'popup_overlay_bg_video_fit_to_screen' ] === 'on' ) { self::set_style( $render_slug, array( 'selector' => $this->main_css_element . '_module .dmpro_popup_wrapper > .et_pb_section_video_bg video', 'declaration' => 'object-fit:fill !important;', ) ); } if ( $this->props[ 'popup_bg_video_fit_to_screen' ] === 'on' ) { self::set_style( $render_slug, array( 'selector' => $this->main_css_element . '_module .dmpro_popup_inner_wrap > .et_pb_section_video_bg video', 'declaration' => 'object-fit:fill !important;', ) ); } if ( $this->props[ 'popup_header_bg_video_fit_to_screen' ] === 'on' ) { self::set_style( $render_slug, array( 'selector' => $this->main_css_element . '_module .dmpro_popup_header > .et_pb_section_video_bg video', 'declaration' => 'object-fit:fill !important;', ) ); } if ( $this->props[ 'popup_body_bg_video_fit_to_screen' ] === 'on' ) { self::set_style( $render_slug, array( 'selector' => $this->main_css_element . '_module .dmpro_popup_body > .et_pb_section_video_bg video', 'declaration' => 'object-fit:fill !important;', ) ); } if ( $this->props[ 'popup_footer_bg_video_fit_to_screen' ] === 'on' ) { self::set_style( $render_slug, array( 'selector' => $this->main_css_element . '_module .dmpro_popup_footer > .et_pb_section_video_bg video', 'declaration' => 'object-fit:fill !important;', ) ); } $output = ET_Builder_Element::video_background( null, $base_name ); if ( $unset_last_edit === true ) { unset( $this->props[ $prop_background_last_edit ] ); } if ( $unset_video_pause_outside_viewport_tablet === true ) { unset( $this->props[ $prop_bg_video_pause_outside_viewport_tablet ] ); } if ( $unset_allow_player_pause_tablet === true ) { unset( $this->props[ $prop_bg_allow_player_pause_tablet ] ); } return $output; } /** * Generate markup for background pattern. * * @since 4.15.0 * * @param array $args Props. * @param string $base_name Background base name. * * @return string Background pattern markup. */ protected function get_background_pattern( $args = array(), $base_name = 'background' ) { $props = ! empty( $args ) ? (array) $args : $this->props; $modes = array( 'desktop', 'hover', 'sticky', 'tablet', 'phone' ); $is_active = false; foreach ( $modes as $mode ) { // Checks whether pattern style is enabled and has value. $style_name = et_pb_responsive_options()->get_inheritance_background_value( $props, "{$base_name}_pattern_style", $mode, $base_name, $this->fields_unprocessed ); if ( ! empty( $style_name ) ) { // We need to render pattern element. $is_active = true; break; } } $output = ''; if ( $is_active ) { $class_name = array( 'et_pb_background_pattern', ); $output = sprintf( '<span class="%1$s"></span>', implode( ' ', array_map( 'esc_attr', $class_name ) ) ); } return $output; } /** * Generate markup for background mask. * * @since 4.15.0 * * @param array $args Props. * @param string $base_name Background base name. * * @return string Background mask markup. */ protected function get_background_mask( $args = array(), $base_name = 'background' ) { $props = ! empty( $args ) ? (array) $args : $this->props; $modes = array( 'desktop', 'hover', 'sticky', 'tablet', 'phone' ); $is_active = false; foreach ( $modes as $mode ) { // Checks whether mask style is enabled and has value. $style_name = et_pb_responsive_options()->get_inheritance_background_value( $props, "{$base_name}_mask_style", $mode, $base_name, $this->fields_unprocessed ); if ( ! empty( $style_name ) ) { // We need to render mask element. $is_active = true; break; } } $output = ''; if ( $is_active ) { $class_name = array( 'et_pb_background_mask', ); $output = sprintf( '<span class="%1$s"></span>', implode( ' ', array_map( 'esc_attr', $class_name ) ) ); } return $output; } protected function generate_styles_tab_image_icon_width( $render_slug, $icon_selector, $image_icon_width_selector ) { $tab_image_icon = $this->props['tab_image_icon']; $image = $this->props['tab_image_select']; $image_icon_width = isset( $this->props['image_icon_width'] ) ? $this->props['image_icon_width'] : ''; $image_icon_width_tablet = isset( $this->props['image_icon_width_tablet'] ) ? $this->props['image_icon_width_tablet'] : ''; $image_icon_width_phone = isset( $this->props['image_icon_width_phone'] ) ? $this->props['image_icon_width_phone'] : ''; $image_icon_width_last_edited = isset( $this->props['image_icon_width_last_edited'] ) ? $this->props['image_icon_width_last_edited'] : ''; $image_pathinfo = pathinfo( $image ); $is_image_svg = isset( $image_pathinfo['extension'] ) ? 'svg' === $image_pathinfo['extension'] : false; if ( 'icon' === $tab_image_icon ) { // Icon Font Size $this->generate_styles( array( 'base_attr_name' => 'image_icon_width', 'selector' => $icon_selector, 'css_property' => 'font-size', 'render_slug' => $render_slug, 'type' => 'range', ) ); } elseif ( 'image' === $tab_image_icon ) { $image_icon_width_prop = $is_image_svg || false !== strpos( $image_icon_width, 'px' ) ? 'width' : 'max-width'; $this->generate_styles( array( 'base_attr_name' => 'image_icon_width', 'selector' => $image_icon_width_selector, 'css_property' => $image_icon_width_prop, 'render_slug' => $render_slug, 'type' => 'input', 'sticky' => false, 'responsive' => false ) ); } if ( 'image' === $tab_image_icon && ( '' !== $image_icon_width_tablet || '' !== $image_icon_width_phone || '' !== $image_icon_width || '' !== $image_icon_width_sticky || $is_image_svg ) ) { $is_size_px = false; // If size is given in px, we want to override parent width if ( false !== strpos( $image_icon_width, 'px' ) || false !== strpos( $image_icon_width_tablet, 'px' ) || false !== strpos( $image_icon_width_phone, 'px' ) ) { $is_size_px = true; } // SVG image overwrite. SVG image needs its value to be explicit if ( '' === $image_icon_width && $is_image_svg ) { $image_icon_width = '100%'; } // Image max width selector. $image_icon_width_selectors = array(); $image_icon_width_reset_selectors = array(); $image_icon_width_reset_values = array(); // Add image max width desktop selector if user sets different image/icon placement setting. if ( ! empty( $image_icon_width_selectors ) ) { $image_icon_width_selectors['desktop'] = $image_icon_width_selector; } $image_icon_width_property = ( $is_image_svg || $is_size_px ) ? 'width' : 'max-width'; $image_icon_width_responsive_active = et_pb_get_responsive_status( $image_icon_width_last_edited ); $image_icon_width_values = array( 'desktop' => $image_icon_width, 'tablet' => $image_icon_width_responsive_active ? $image_icon_width_tablet : '', 'phone' => $image_icon_width_responsive_active ? $image_icon_width_phone : '', ); $main_image_icon_width_selector = $image_icon_width_selector; // Overwrite image max width if there are image max width selectors for different devices. if ( ! empty( $image_icon_width_selectors ) ) { $main_image_icon_width_selector = $image_icon_width_selectors; if ( ! empty( $image_icon_width_selectors['tablet'] ) && empty( $image_icon_width_values['tablet'] ) ) { $image_icon_width_values['tablet'] = $image_icon_width_responsive_active ? esc_attr( et_pb_responsive_options()->get_any_value( $this->props, 'image_icon_width_tablet', '100%', true ) ) : esc_attr( $image_icon_width ); } if ( ! empty( $image_icon_width_selectors['phone'] ) && empty( $image_icon_width_values['phone'] ) ) { $image_icon_width_values['phone'] = $image_icon_width_responsive_active ? esc_attr( et_pb_responsive_options()->get_any_value( $this->props, 'image_icon_width_phone', '100%', true ) ) : esc_attr( $image_icon_width ); } } et_pb_responsive_options()->generate_responsive_css( $image_icon_width_values, $main_image_icon_width_selector, $image_icon_width_property, $render_slug ); } } protected function generate_special_responsive_styles( $render_slug, $field_name, $field_values, $field_css_selector, $css_property ) { $responsive_values = et_pb_responsive_options()->get_property_values( $this->props, $field_name ); if ( '' !== $responsive_values['tablet'] || '' !== $responsive_values['phone'] || '' !== $responsive_values['desktop'] ) { $css_values = array(); foreach ( $responsive_values as $breakpoint => $vw ) { $css_values[ $breakpoint ] = et_()->array_get( $field_values, $vw, '' ); } et_pb_responsive_options()->generate_responsive_css( $css_values, $field_css_selector, $css_property, $render_slug, '', 'align' ); } } /** * Gets Multi view attributes to the Outer wrapper. * * Since we do not have control over the WooCommerce Breadcrumb markup, we inject Multi view * attributes on to the Outer wrapper. * * @return string */ public function get_multi_view_attrs() { $multi_view = et_pb_multi_view_options( $this ); $multi_view_attrs = $multi_view->render_attrs( array( 'attrs' => array( 'data-include_tabs' => '{{include_tabs}}', ), 'target' => '%%order_class%%', ) ); return $multi_view_attrs; } /** * Get a list of post type Divi layouts (et_pb_layout) * * @return array */ public function get_divi_layouts( $field_type = 'select' ) { $args = array( 'post_type' => ET_BUILDER_LAYOUT_POST_TYPE, 'posts_per_page' => -1, 'post_status' => 'publish', 'meta_query' => array( array( 'key' => '_et_pb_predefined_layout', 'value' => 'on', 'compare' => 'NOT EXISTS', ), ), ); $list_layout = array(); if ( $field_type === 'select' ) { $list_layout[0] = esc_html__( 'Select a layout', DMPRO_TEXTDOMAIN ); } $results = new WP_Query( $args ); if ( $results->have_posts() ) { foreach ( $results->get_posts() as $p ) { $list_layout[ intval( $p->ID ) ] = ucwords( esc_html( $p->post_title ) ); } } return $list_layout; } public function process_custom_content( $content ) { $content = et_pb_fix_shortcodes( $content, $this->use_raw_content ); // Line breaks should be converted before do_shortcode to avoid legit rendered shortcode // line breaks being trimmed into one line and causing issue like broken javascript code. if ( $this->use_raw_content ) { $content = et_builder_convert_line_breaks( et_builder_replace_code_content_entities( $content ) ); } $content = et_maybe_enable_embed_shortcode( $content, true ); $content = do_shortcode( $content ); return $content; } /** * Force load Divi font styles. * * @param array $assets_list Current global assets on the list. * * @return array */ public function load_divi_fonts( $assets_list, $assets_args = [], $instance = null ) { $assets_prefix = et_get_dynamic_assets_path(); if ( ! isset( $assets_list['et_icons_all'] ) ) { $assets_list['et_icons_all'] = array( 'css' => "{$assets_prefix}/css/icons_all.css", ); } if ( ! isset( $assets_list['et_icons_fa'] ) ) { $assets_list['et_icons_fa'] = array( 'css' => "{$assets_prefix}/css/icons_fa_all.css", ); } return $assets_list; } } } if(get_dmpro_option('dmpro_before_after')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/BeforeAfter/BeforeAfter.php'; } if(get_dmpro_option('dmpro_breadcrumbs')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/BreadCrumb/BreadCrumb.php'; } if(get_dmpro_option('dmpro_buttons_grid')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/ButtonGridiron/ButtonGridiron.php'; require_once DMPRO_PLUGIN_DIR . 'includes/modules/ButtonGridiron_Child/ButtonGridiron_Child.php'; } if(get_dmpro_option('dmpro_carousel')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/Carousel/Carousel.php'; require_once DMPRO_PLUGIN_DIR . 'includes/modules/Carousel_Child/Carousel_Child.php'; } if(get_dmpro_option('dmpro_content_toggle')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/ContentToggle/ContentToggle.php'; } if(get_dmpro_option('dmpro_countdown_timer')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/CountDownTimer/CountDownTimer.php'; } if(get_dmpro_option('dmpro_flipbox')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/FlipBox/FlipBox.php'; } if(get_dmpro_option('dmpro_hoverbox')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/ImageHoverBox/ImageHoverBox.php'; } if(get_dmpro_option('dmpro_image_hotspot')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/HotSpot/HotSpot.php'; require_once DMPRO_PLUGIN_DIR . 'includes/modules/HotSpot_Child/HotSpot_Child.php'; } if(get_dmpro_option('dmpro_masonry_gallery')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/Masonry/Masonry.php'; } if(get_dmpro_option('dmpro_price_list')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/RestaurantMenu/RestaurantMenu.php'; require_once DMPRO_PLUGIN_DIR . 'includes/modules/RestaurantMenu_Child/RestaurantMenu_Child.php'; } if(get_dmpro_option('dmpro_popup')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/Popup/Popup.php'; } if(get_dmpro_option('dmpro_timeline')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/TimeLine/TimeLine.php'; require_once DMPRO_PLUGIN_DIR . 'includes/modules/TimeLineItem/TimeLineItem.php'; } if(get_dmpro_option('dmpro_advanced_tabs')) { require_once DMPRO_PLUGIN_DIR . 'includes/modules/AdvancedTabs/AdvancedTabs.php'; require_once DMPRO_PLUGIN_DIR . 'includes/modules/AdvancedTabs_Tab/AdvancedTabs_Tab.php'; }