Beispiel #1
2
    function shortcode_callback($atts, $content = null, $function_name)
    {
        /**
         * Cached $wp_filter so it can be restored at the end of the callback.
         * This is needed because this callback uses the_content filter / calls a function
         * which uses the_content filter. WordPress doesn't support nested filter
         */
        global $wp_filter;
        $wp_filter_cache = $wp_filter;
        $module_id = $this->shortcode_atts['module_id'];
        $module_class = $this->shortcode_atts['module_class'];
        $show_arrows = $this->shortcode_atts['show_arrows'];
        $show_pagination = $this->shortcode_atts['show_pagination'];
        $parallax = $this->shortcode_atts['parallax'];
        $parallax_method = $this->shortcode_atts['parallax_method'];
        $auto = $this->shortcode_atts['auto'];
        $auto_speed = $this->shortcode_atts['auto_speed'];
        $auto_ignore_hover = $this->shortcode_atts['auto_ignore_hover'];
        $top_padding = $this->shortcode_atts['top_padding'];
        $body_font_size = $this->shortcode_atts['body_font_size'];
        $bottom_padding = $this->shortcode_atts['bottom_padding'];
        $remove_inner_shadow = $this->shortcode_atts['remove_inner_shadow'];
        $hide_content_on_mobile = $this->shortcode_atts['hide_content_on_mobile'];
        $hide_cta_on_mobile = $this->shortcode_atts['hide_cta_on_mobile'];
        $show_image_video_mobile = $this->shortcode_atts['show_image_video_mobile'];
        $background_position = $this->shortcode_atts['background_position'];
        $background_size = $this->shortcode_atts['background_size'];
        $posts_number = $this->shortcode_atts['posts_number'];
        $include_categories = $this->shortcode_atts['include_categories'];
        $show_more_button = $this->shortcode_atts['show_more_button'];
        $more_text = $this->shortcode_atts['more_text'];
        $content_source = $this->shortcode_atts['content_source'];
        $background_color = $this->shortcode_atts['background_color'];
        $show_image = $this->shortcode_atts['show_image'];
        $image_placement = $this->shortcode_atts['image_placement'];
        $background_image = $this->shortcode_atts['background_image'];
        $background_layout = $this->shortcode_atts['background_layout'];
        $use_bg_overlay = $this->shortcode_atts['use_bg_overlay'];
        $bg_overlay_color = $this->shortcode_atts['bg_overlay_color'];
        $use_text_overlay = $this->shortcode_atts['use_text_overlay'];
        $text_overlay_color = $this->shortcode_atts['text_overlay_color'];
        $orderby = $this->shortcode_atts['orderby'];
        $show_meta = $this->shortcode_atts['show_meta'];
        $button_custom = $this->shortcode_atts['custom_button'];
        $custom_icon = $this->shortcode_atts['button_icon'];
        $use_manual_excerpt = $this->shortcode_atts['use_manual_excerpt'];
        $excerpt_length = $this->shortcode_atts['excerpt_length'];
        $text_border_radius = $this->shortcode_atts['text_border_radius'];
        $dot_nav_custom_color = $this->shortcode_atts['dot_nav_custom_color'];
        $arrows_custom_color = $this->shortcode_atts['arrows_custom_color'];
        $top_padding_tablet = $this->shortcode_atts['top_padding_tablet'];
        $top_padding_phone = $this->shortcode_atts['top_padding_phone'];
        $bottom_padding_tablet = $this->shortcode_atts['bottom_padding_tablet'];
        $bottom_padding_phone = $this->shortcode_atts['bottom_padding_phone'];
        $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name);
        $hide_on_mobile_class = self::HIDE_ON_MOBILE;
        if ('' !== $top_padding || '' !== $top_padding_tablet || '' !== $top_padding_phone) {
            $padding_values = array('desktop' => $top_padding, 'tablet' => $top_padding_tablet, 'phone' => $top_padding_phone);
            et_pb_generate_responsive_css($padding_values, '%%order_class%% .et_pb_slide_description', 'padding-top', $function_name);
        }
        if ('' !== $bottom_padding || '' !== $bottom_padding_tablet || '' !== $bottom_padding_phone) {
            $padding_values = array('desktop' => $bottom_padding, 'tablet' => $bottom_padding_tablet, 'phone' => $bottom_padding_phone);
            et_pb_generate_responsive_css($padding_values, '%%order_class%% .et_pb_slide_description', 'padding-bottom', $function_name);
        }
        if ('' !== $bottom_padding || '' !== $top_padding) {
            ET_Builder_Module::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide_description', 'declaration' => 'padding-right: 0; padding-left: 0;'));
        }
        if ('default' !== $background_position && 'off' === $parallax) {
            $processed_position = str_replace('_', ' ', $background_position);
            ET_Builder_Module::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide', 'declaration' => sprintf('background-position: %1$s;', esc_html($processed_position))));
        }
        if ('default' !== $background_size && 'off' === $parallax) {
            ET_Builder_Module::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide', 'declaration' => sprintf('-moz-background-size: %1$s;
					-webkit-background-size: %1$s;
					background-size: %1$s;', esc_html($background_size))));
            if ('initial' === $background_size) {
                ET_Builder_Module::set_style($function_name, array('selector' => 'body.ie %%order_class%% .et_pb_slide', 'declaration' => sprintf('-moz-background-size: %1$s;
						-webkit-background-size: %1$s;
						background-size: %1$s;', 'auto')));
            }
        }
        if ('' !== $background_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_post_slider', 'declaration' => sprintf('background-color: %1$s;', esc_html($background_color))));
        }
        if ('' !== $background_image) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%, %%order_class%%.et_pb_bg_layout_dark, %%order_class%%.et_pb_bg_layout_light', 'declaration' => sprintf('background-image: url(%1$s);', esc_url($background_image))));
        }
        if ('on' === $use_bg_overlay && '' !== $bg_overlay_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide .et_pb_slide_overlay_container', 'declaration' => sprintf('background-color: %1$s;', esc_html($bg_overlay_color))));
        }
        if ('on' === $use_text_overlay && '' !== $text_overlay_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide .et_pb_slide_title, %%order_class%% .et_pb_slide .et_pb_slide_content', 'declaration' => sprintf('background-color: %1$s;', esc_html($text_overlay_color))));
        }
        if ('' !== $text_border_radius) {
            $border_radius_value = et_builder_process_range_value($text_border_radius);
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_slider_with_text_overlay h2.et_pb_slide_title', 'declaration' => sprintf('-webkit-border-top-left-radius: %1$s;
					-webkit-border-top-right-radius: %1$s;
					-moz-border-radius-topleft: %1$s;
					-moz-border-radius-topright: %1$s;
					border-top-left-radius: %1$s;
					border-top-right-radius: %1$s;', esc_html($border_radius_value))));
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_slider_with_text_overlay .et_pb_slide_content', 'declaration' => sprintf('-webkit-border-bottom-right-radius: %1$s;
					-webkit-border-bottom-left-radius: %1$s;
					-moz-border-radius-bottomright: %1$s;
					-moz-border-radius-bottomleft: %1$s;
					border-bottom-right-radius: %1$s;
					border-bottom-left-radius: %1$s;', esc_html($border_radius_value))));
        }
        $fullwidth = 'et_pb_fullwidth_post_slider' === $function_name ? 'on' : 'off';
        $class = '';
        $class .= 'off' === $fullwidth ? ' et_pb_slider_fullwidth_off' : '';
        $class .= 'off' === $show_arrows ? ' et_pb_slider_no_arrows' : '';
        $class .= 'off' === $show_pagination ? ' et_pb_slider_no_pagination' : '';
        $class .= 'on' === $parallax ? ' et_pb_slider_parallax' : '';
        $class .= 'on' === $auto ? ' et_slider_auto et_slider_speed_' . esc_attr($auto_speed) : '';
        $class .= 'on' === $auto_ignore_hover ? ' et_slider_auto_ignore_hover' : '';
        $class .= 'on' === $remove_inner_shadow ? ' et_pb_slider_no_shadow' : '';
        $class .= 'on' === $show_image_video_mobile ? ' et_pb_slider_show_image' : '';
        $class .= ' et_pb_post_slider_image_' . $image_placement;
        $class .= 'on' === $use_bg_overlay ? ' et_pb_slider_with_overlay' : '';
        $class .= 'on' === $use_text_overlay ? ' et_pb_slider_with_text_overlay' : '';
        $data_dot_nav_custom_color = '' !== $dot_nav_custom_color ? sprintf(' data-dots_color="%1$s"', esc_attr($dot_nav_custom_color)) : '';
        $data_arrows_custom_color = '' !== $arrows_custom_color ? sprintf(' data-arrows_color="%1$s"', esc_attr($arrows_custom_color)) : '';
        $args = array('posts_per_page' => (int) $posts_number);
        if ('' !== $include_categories) {
            $args['cat'] = $include_categories;
        }
        if ('date_desc' !== $orderby) {
            switch ($orderby) {
                case 'date_asc':
                    $args['orderby'] = 'date';
                    $args['order'] = 'ASC';
                    break;
                case 'title_asc':
                    $args['orderby'] = 'title';
                    $args['order'] = 'ASC';
                    break;
                case 'title_desc':
                    $args['orderby'] = 'title';
                    $args['order'] = 'DESC';
                    break;
                case 'rand':
                    $args['orderby'] = 'rand';
                    break;
            }
        }
        ob_start();
        query_posts($args);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                $slide_class = 'off' !== $show_image && in_array($image_placement, array('left', 'right')) && has_post_thumbnail() ? ' et_pb_slide_with_image' : '';
                $slide_class .= " et_pb_bg_layout_{$background_layout}";
                ?>
			<div class="et_pb_slide et_pb_media_alignment_center<?php 
                echo esc_attr($slide_class);
                ?>
" <?php 
                if ('on' !== $parallax && 'off' !== $show_image && 'background' === $image_placement) {
                    printf('style="background-image:url(%1$s)"', esc_url(wp_get_attachment_url(get_post_thumbnail_id())));
                }
                echo $data_dot_nav_custom_color;
                echo $data_arrows_custom_color;
                ?>
>
				<?php 
                if ('on' === $parallax && 'off' !== $show_image && 'background' === $image_placement) {
                    ?>
					<div class="et_parallax_bg<?php 
                    if ('off' === $parallax_method) {
                        echo ' et_pb_parallax_css';
                    }
                    ?>
" style="background-image: url(<?php 
                    echo esc_url(wp_get_attachment_url(get_post_thumbnail_id()));
                    ?>
);"></div>
				<?php 
                }
                ?>
				<?php 
                if ('on' === $use_bg_overlay) {
                    ?>
					<div class="et_pb_slide_overlay_container"></div>
				<?php 
                }
                ?>
				<div class="et_pb_container clearfix">
					<?php 
                if ('off' !== $show_image && has_post_thumbnail() && !in_array($image_placement, array('background', 'bottom'))) {
                    ?>
						<div class="et_pb_slide_image">
							<?php 
                    the_post_thumbnail();
                    ?>
						</div>
					<?php 
                }
                ?>
					<div class="et_pb_slide_description">
						<h2 class="et_pb_slide_title"><a href="<?php 
                esc_url(the_permalink());
                ?>
"><?php 
                the_title();
                ?>
</a></h2>
						<div class="et_pb_slide_content <?php 
                if ('on' === $hide_content_on_mobile) {
                    echo esc_attr($hide_on_mobile_class);
                }
                ?>
">
							<?php 
                if ('off' !== $show_meta) {
                    printf('<p class="post-meta">%1$s | %2$s | %3$s | %4$s</p>', et_get_safe_localization(sprintf(__('by %s', 'et_builder'), '<span class="author vcard">' . et_pb_get_the_author_posts_link() . '</span>')), et_get_safe_localization(sprintf(__('%s', 'et_builder'), '<span class="published">' . esc_html(get_the_date()) . '</span>')), get_the_category_list(', '), sprintf(esc_html(_nx('1 Comment', '%s Comments', get_comments_number(), 'number of comments', 'et_builder')), number_format_i18n(get_comments_number())));
                }
                ?>
							<?php 
                $post_content = get_the_content();
                // do not display the content if it contains Blog, Post Slider, Fullwidth Post Slider, or Portfolio modules to avoid infinite loops
                if (!has_shortcode($post_content, 'et_pb_blog') && !has_shortcode($post_content, 'et_pb_portfolio') && !has_shortcode($post_content, 'et_pb_post_slider') && !has_shortcode($post_content, 'et_pb_fullwidth_post_slider')) {
                    if ('on' === $content_source) {
                        global $more;
                        $post_content = et_strip_shortcodes($post_content);
                        // page builder doesn't support more tag, so display the_content() in case of post made with page builder
                        if (et_pb_is_pagebuilder_used(get_the_ID())) {
                            $more = 1;
                            echo apply_filters('the_content', $post_content);
                        } else {
                            $more = null;
                            echo apply_filters('the_content', et_strip_shortcodes(get_the_content(esc_html__('read more...', 'et_builder'))));
                        }
                    } else {
                        if (has_excerpt() && 'off' !== $use_manual_excerpt) {
                            the_excerpt();
                        } else {
                            truncate_post(intval($excerpt_length), true, '', true);
                        }
                    }
                } else {
                    if (has_excerpt()) {
                        the_excerpt();
                    }
                }
                ?>
						</div>
						<?php 
                if ('off' !== $show_more_button && '' !== $more_text) {
                    printf('<a href="%1$s" class="et_pb_more_button et_pb_button%4$s%5$s"%3$s>%2$s</a>', esc_url(get_permalink()), esc_html($more_text), '' !== $custom_icon && 'on' === $button_custom ? sprintf(' data-icon="%1$s"', esc_attr(et_pb_process_font_icon($custom_icon))) : '', '' !== $custom_icon && 'on' === $button_custom ? ' et_pb_custom_button_icon' : '', 'on' === $hide_cta_on_mobile ? esc_attr(" {$hide_on_mobile_class}") : '');
                }
                ?>
					</div> <!-- .et_pb_slide_description -->
					<?php 
                if ('off' !== $show_image && has_post_thumbnail() && 'bottom' === $image_placement) {
                    ?>
						<div class="et_pb_slide_image">
							<?php 
                    the_post_thumbnail();
                    ?>
						</div>
					<?php 
                }
                ?>
				</div> <!-- .et_pb_container -->
			</div> <!-- .et_pb_slide -->
		<?php 
            }
            // end while
            wp_reset_query();
        }
        // end if
        $content = ob_get_contents();
        ob_end_clean();
        $output = sprintf('<div%3$s class="et_pb_module et_pb_slider et_pb_post_slider%1$s%4$s">
				<div class="et_pb_slides">
					%2$s
				</div> <!-- .et_pb_slides -->
			</div> <!-- .et_pb_slider -->
			', $class, $content, '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : '', '' !== $module_class ? sprintf(' %1$s', esc_attr($module_class)) : '');
        // Restore $wp_filter
        $wp_filter = $wp_filter_cache;
        unset($wp_filter_cache);
        return $output;
    }
Beispiel #2
0
    function shortcode_callback($atts, $content = null, $function_name)
    {
        $module_id = $this->shortcode_atts['module_id'];
        $module_class = $this->shortcode_atts['module_class'];
        $show_arrows = $this->shortcode_atts['show_arrows'];
        $show_pagination = $this->shortcode_atts['show_pagination'];
        $parallax = $this->shortcode_atts['parallax'];
        $parallax_method = $this->shortcode_atts['parallax_method'];
        $auto = $this->shortcode_atts['auto'];
        $auto_speed = $this->shortcode_atts['auto_speed'];
        $auto_ignore_hover = $this->shortcode_atts['auto_ignore_hover'];
        $top_padding = $this->shortcode_atts['top_padding'];
        $bottom_padding = $this->shortcode_atts['bottom_padding'];
        $remove_inner_shadow = $this->shortcode_atts['remove_inner_shadow'];
        $show_image_video_mobile = $this->shortcode_atts['show_image_video_mobile'];
        $background_position = $this->shortcode_atts['background_position'];
        $background_size = $this->shortcode_atts['background_size'];
        global $et_pb_slider_has_video, $et_pb_slider_parallax, $et_pb_slider_parallax_method, $et_pb_slider_hide_mobile, $et_pb_slider_custom_icon;
        $content = $this->shortcode_content;
        $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name);
        if ('' !== $top_padding) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide_description', 'declaration' => sprintf('padding-top: %1$s;', esc_html(et_builder_process_range_value($top_padding)))));
        }
        if ('' !== $bottom_padding) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide_description', 'declaration' => sprintf('padding-bottom: %1$s;', esc_html(et_builder_process_range_value($bottom_padding)))));
        }
        if ('default' !== $background_position && 'off' === $parallax) {
            $processed_position = str_replace('_', ' ', $background_position);
            ET_Builder_Module::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide', 'declaration' => sprintf('background-position: %1$s;', esc_html($processed_position))));
        }
        if ('default' !== $background_size && 'off' === $parallax) {
            ET_Builder_Module::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide', 'declaration' => sprintf('-moz-background-size: %1$s;
					-webkit-background-size: %1$s;
					background-size: %1$s;', esc_html($background_size))));
        }
        $fullwidth = 'et_pb_fullwidth_slider' === $function_name ? 'on' : 'off';
        $class = '';
        $class .= 'off' === $fullwidth ? ' et_pb_slider_fullwidth_off' : '';
        $class .= 'off' === $show_arrows ? ' et_pb_slider_no_arrows' : '';
        $class .= 'off' === $show_pagination ? ' et_pb_slider_no_pagination' : '';
        $class .= 'on' === $parallax ? ' et_pb_slider_parallax' : '';
        $class .= 'on' === $auto ? ' et_slider_auto et_slider_speed_' . esc_attr($auto_speed) : '';
        $class .= 'on' === $auto_ignore_hover ? ' et_slider_auto_ignore_hover' : '';
        $class .= 'on' === $remove_inner_shadow ? ' et_pb_slider_no_shadow' : '';
        $class .= 'on' === $show_image_video_mobile ? ' et_pb_slider_show_image' : '';
        $output = sprintf('<div%4$s class="et_pb_module et_pb_slider%1$s%3$s%5$s">
				<div class="et_pb_slides">
					%2$s
				</div> <!-- .et_pb_slides -->
			</div> <!-- .et_pb_slider -->
			', $class, $content, $et_pb_slider_has_video ? ' et_pb_preload' : '', '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : '', '' !== $module_class ? sprintf(' %1$s', esc_attr($module_class)) : '');
        return $output;
    }
 function _shortcode_callback($atts, $content = null, $function_name)
 {
     $this->shortcode_atts = shortcode_atts($this->get_shortcode_fields(), $atts);
     $this->_decode_double_quotes();
     $this->_maybe_remove_default_atts_values();
     $global_shortcode_content = false;
     // If the section/row/module is disabled, hide it
     if (isset($this->shortcode_atts['disabled']) && 'on' === $this->shortcode_atts['disabled']) {
         return;
     }
     //override module attributes for global module
     if (!empty($this->shortcode_atts['global_module'])) {
         $global_content = et_pb_load_global_module($this->shortcode_atts['global_module']);
         if ('' !== $global_content) {
             $global_atts = shortcode_parse_atts($global_content);
             foreach ($this->shortcode_atts as $single_attr => $value) {
                 if (isset($global_atts[$single_attr])) {
                     $this->shortcode_atts[$single_attr] = $global_atts[$single_attr];
                 }
             }
             if (false !== strpos($this->shortcode_atts['saved_tabs'], 'general') || 'all' === $this->shortcode_atts['saved_tabs']) {
                 $global_shortcode_content = et_pb_extract_shortcode_content($global_content, $function_name);
             }
         }
     }
     self::set_order_class($function_name);
     $this->pre_shortcode_content();
     $content = false !== $global_shortcode_content ? $global_shortcode_content : $content;
     $this->shortcode_content = !(isset($this->is_structure_element) && $this->is_structure_element) ? do_shortcode(et_pb_fix_shortcodes($content, $this->decode_entities)) : '';
     $this->shortcode_atts();
     $output = $this->shortcode_callback($atts, $content, $function_name);
     $this->_shortcode_callback_num++;
     $this->process_additional_options($function_name);
     $this->process_custom_css_options($function_name);
     // Hide module on specific screens if needed
     if (isset($this->shortcode_atts['disabled_on']) && '' !== $this->shortcode_atts['disabled_on']) {
         $disabled_on_array = explode('|', $this->shortcode_atts['disabled_on']);
         $i = 0;
         $current_media_query = 'max_width_767';
         foreach ($disabled_on_array as $value) {
             if ('on' === $value) {
                 ET_Builder_Module::set_style($function_name, array('selector' => '%%order_class%%', 'declaration' => 'display: none !important;', 'media_query' => ET_Builder_Element::get_media_query($current_media_query)));
             }
             $i++;
             $current_media_query = 1 === $i ? '768_980' : 'min_width_981';
         }
     }
     if (empty($this->template_name)) {
         return $output;
     }
     return $this->shortcode_output();
 }
 function _shortcode_callback($atts, $content = null, $function_name, $parent_address = '', $global_parent = '', $global_parent_type = '')
 {
     global $et_fb_processing_shortcode_object;
     $this->shortcode_atts = shortcode_atts($this->get_shortcode_fields(), $atts);
     $this->_decode_double_quotes();
     $this->_maybe_remove_default_atts_values();
     $global_shortcode_content = false;
     $ab_testing_enabled = et_is_ab_testing_active();
     $hide_subject_module = false;
     $post_id = apply_filters('et_is_ab_testing_active_post_id', get_the_ID());
     // If the section/row/module is disabled, hide it
     if (isset($this->shortcode_atts['disabled']) && 'on' === $this->shortcode_atts['disabled'] && !$et_fb_processing_shortcode_object) {
         return;
     }
     // need to perform additional check and some modifications in case AB testing enabled
     if ($ab_testing_enabled) {
         // check if ab testing enabled for this module and if it shouldn't be displayed currently
         if (!$et_fb_processing_shortcode_object && !$this->_is_display_module($this->shortcode_atts) && !et_pb_detect_cache_plugins()) {
             return;
         }
         // add class to the AB testing subject if needed
         if (isset($this->shortcode_atts['ab_subject_id']) && '' !== $this->shortcode_atts['ab_subject_id']) {
             $subject_class = sprintf(' et_pb_ab_subject et_pb_ab_subject_id-%1$s_%2$s', esc_attr($post_id), esc_attr($this->shortcode_atts['ab_subject_id']));
             $this->shortcode_atts['module_class'] = isset($this->shortcode_atts['module_class']) && '' !== $this->shortcode_atts['module_class'] ? $this->shortcode_atts['module_class'] . $subject_class : $subject_class;
             if (et_pb_detect_cache_plugins()) {
                 $hide_subject_module = true;
             }
         }
         // add class to the AB testing goal if needed
         if (isset($this->shortcode_atts['ab_goal']) && 'on' === $this->shortcode_atts['ab_goal']) {
             $goal_class = sprintf(' et_pb_ab_goal et_pb_ab_goal_id-%1$s', esc_attr($post_id));
             $this->shortcode_atts['module_class'] = isset($this->shortcode_atts['module_class']) && '' !== $this->shortcode_atts['module_class'] ? $this->shortcode_atts['module_class'] . $goal_class : $goal_class;
         }
     }
     //override module attributes for global module
     if (!empty($this->shortcode_atts['global_module'])) {
         $global_content = et_pb_load_global_module($this->shortcode_atts['global_module']);
         if ('' !== $global_content) {
             $global_atts = shortcode_parse_atts($global_content);
             foreach ($this->shortcode_atts as $single_attr => $value) {
                 if (isset($global_atts[$single_attr])) {
                     $this->shortcode_atts[$single_attr] = $global_atts[$single_attr];
                 }
             }
             if (false !== strpos($this->shortcode_atts['saved_tabs'], 'general') || 'all' === $this->shortcode_atts['saved_tabs']) {
                 $global_shortcode_content = et_pb_extract_shortcode_content($global_content, $function_name);
             }
         }
     }
     self::set_order_class($function_name);
     $this->pre_shortcode_content();
     $content = false !== $global_shortcode_content ? $global_shortcode_content : $content;
     if ($et_fb_processing_shortcode_object) {
         $this->shortcode_content = et_pb_fix_shortcodes($content, $this->decode_entities);
     } else {
         $this->shortcode_content = !(isset($this->is_structure_element) && $this->is_structure_element) ? do_shortcode(et_pb_fix_shortcodes($content, $this->decode_entities)) : '';
     }
     $this->shortcode_atts();
     $this->process_additional_options($function_name);
     $this->process_custom_css_options($function_name);
     // load inline fonts if needed
     if (isset($this->shortcode_atts['inline_fonts'])) {
         $this->process_inline_fonts_option($this->shortcode_atts['inline_fonts']);
     }
     // Prepare shortcode for the frontend building if enabled.
     $shortcode_callback = $et_fb_processing_shortcode_object ? '_shortcode_passthru_callback' : 'shortcode_callback';
     $output = $this->{$shortcode_callback}($atts, $content, $function_name, $parent_address, $global_parent, $global_parent_type);
     $this->_shortcode_callback_num++;
     // Hide module on specific screens if needed
     if (isset($this->shortcode_atts['disabled_on']) && '' !== $this->shortcode_atts['disabled_on']) {
         $disabled_on_array = explode('|', $this->shortcode_atts['disabled_on']);
         $i = 0;
         $current_media_query = 'max_width_767';
         foreach ($disabled_on_array as $value) {
             if ('on' === $value) {
                 ET_Builder_Module::set_style($function_name, array('selector' => '%%order_class%%', 'declaration' => 'display: none !important;', 'media_query' => ET_Builder_Element::get_media_query($current_media_query)));
             }
             $i++;
             $current_media_query = 1 === $i ? '768_980' : 'min_width_981';
         }
     }
     if ($hide_subject_module) {
         $previous_subjects_cache = get_post_meta($post_id, 'et_pb_subjects_cache', true);
         if (empty($previous_subjects_cache)) {
             $previous_subjects_cache = array();
         }
         if (empty($this->template_name)) {
             $previous_subjects_cache[$this->shortcode_atts['ab_subject_id']] = $output;
         } else {
             $previous_subjects_cache[$this->shortcode_atts['ab_subject_id']] = $this->shortcode_output();
         }
         // update the subjects cache in post meta to use it later
         update_post_meta($post_id, 'et_pb_subjects_cache', $previous_subjects_cache);
         // generate the placeholder to output on front-end instead of actual content
         $subject_placeholder = sprintf('<div class="et_pb_subject_placeholder et_pb_subject_placeholder_id_%1$s" style="display: none;"></div>', esc_attr($this->shortcode_atts['ab_subject_id']));
         return $subject_placeholder;
     }
     if (empty($this->template_name)) {
         return $output;
     }
     return $this->shortcode_output();
 }
Beispiel #5
0
    function shortcode_callback($atts, $content = null, $function_name)
    {
        $this->shortcode_atts['ads'] = self::$ads_data;
        self::$ads_data = array();
        // reset
        $border_style = $this->get_border_style_output();
        if (!empty($border_style)) {
            $this->shortcode_atts['border_style'] = $border_style;
            $this->shortcode_atts['border_class'] = 'bordered';
        } else {
            $this->shortcode_atts['border_style'] = '';
            $this->shortcode_atts['border_class'] = '';
        }
        $this->shortcode_atts['header_text_color'] = $this->shortcode_atts['header_text_color'];
        $this->shortcode_atts['module_class'] = ET_Builder_Element::add_module_order_class($this->shortcode_atts['module_class'], $this->slug);
        // Adding styling classes to module
        if (!empty($this->shortcode_atts['remove_drop_shadow']) && 'on' === $this->shortcode_atts['remove_drop_shadow']) {
            $this->shortcode_atts['module_class'] = $this->shortcode_atts['module_class'] . ' et_pb_no_drop_shadow';
        }
        // Print styling for general options
        if (isset($this->shortcode_atts['border_radius']) && '' !== $this->shortcode_atts['border_radius']) {
            ET_Builder_Module::set_style($this->slug, array('selector' => '%%order_class%%.et_pb_extra_module', 'declaration' => sprintf('-moz-border-radius: %1$s;
					-webkit-border-radius: %1$s;
					border-radius: %1$s;', esc_html($this->shortcode_atts['border_radius']))));
        }
        if (isset($this->shortcode_atts['max_width']) && '' !== $this->shortcode_atts['max_width']) {
            ET_Builder_Module::set_style($this->slug, array('selector' => '%%order_class%%', 'declaration' => sprintf('max-width: %1$s;', esc_html(et_builder_process_range_value($this->shortcode_atts['max_width'])))));
        }
    }