function shortcode_callback($atts, $content = null, $function_name)
    {
        $type = $this->shortcode_atts['type'];
        $specialty_columns = $this->shortcode_atts['specialty_columns'];
        $saved_specialty_column_type = $this->shortcode_atts['saved_specialty_column_type'];
        global $et_specialty_column_type, $et_pb_column_backgrounds, $et_pb_column_paddings, $et_pb_column_inner_backgrounds, $et_pb_column_inner_paddings, $et_pb_columns_counter, $et_pb_columns_inner_counter, $keep_column_padding_mobile, $et_pb_column_parallax, $et_pb_column_css, $et_pb_column_inner_css, $et_pb_column_paddings_mobile;
        if ('et_pb_column_inner' !== $function_name) {
            $et_specialty_column_type = $type;
            $array_index = $et_pb_columns_counter;
            $backgrounds_array = $et_pb_column_backgrounds;
            $paddings_array = $et_pb_column_paddings;
            $paddings_mobile_array = $et_pb_column_paddings_mobile;
            $column_css_array = $et_pb_column_css;
            $et_pb_columns_counter++;
        } else {
            $array_index = $et_pb_columns_inner_counter;
            $backgrounds_array = $et_pb_column_inner_backgrounds;
            $paddings_array = $et_pb_column_inner_paddings;
            $column_css_array = $et_pb_column_inner_css;
            $et_pb_columns_inner_counter++;
            $paddings_mobile_array = isset($et_pb_column_inner_paddings_mobile);
        }
        $background_color = isset($backgrounds_array[$array_index][0]) ? $backgrounds_array[$array_index][0] : '';
        $background_img = isset($backgrounds_array[$array_index][1]) ? $backgrounds_array[$array_index][1] : '';
        $padding_values = isset($paddings_array[$array_index]) ? $paddings_array[$array_index] : array();
        $padding_mobile_values = isset($paddings_mobile_array[$array_index]) ? $paddings_mobile_array[$array_index] : array();
        $parallax_method = isset($et_pb_column_parallax[$array_index][0]) && 'on' === $et_pb_column_parallax[$array_index][0] ? $et_pb_column_parallax[$array_index][1] : '';
        $custom_css_class = isset($column_css_array['css_class'][$array_index]) ? ' ' . $column_css_array['css_class'][$array_index] : '';
        $custom_css_id = isset($column_css_array['css_id'][$array_index]) ? $column_css_array['css_id'][$array_index] : '';
        $custom_css_before = isset($column_css_array['custom_css_before'][$array_index]) ? $column_css_array['custom_css_before'][$array_index] : '';
        $custom_css_main = isset($column_css_array['custom_css_main'][$array_index]) ? $column_css_array['custom_css_main'][$array_index] : '';
        $custom_css_after = isset($column_css_array['custom_css_after'][$array_index]) ? $column_css_array['custom_css_after'][$array_index] : '';
        if ('' !== $background_color && 'rgba(0,0,0,0)' !== $background_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%', 'declaration' => sprintf('background-color:%s;', esc_attr($background_color))));
        }
        if ('' !== $background_img && '' === $parallax_method) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%', 'declaration' => sprintf('background-image:url(%s);', esc_attr($background_img))));
        }
        if (!empty($padding_values)) {
            foreach ($padding_values as $position => $value) {
                if ('' !== $value) {
                    $element_style = array('selector' => '%%order_class%%', 'declaration' => sprintf('%1$s:%2$s;', esc_html($position), esc_html(et_builder_process_range_value($value))));
                    if ('on' !== $keep_column_padding_mobile) {
                        $element_style['media_query'] = ET_Builder_Element::get_media_query('min_width_981');
                    }
                    ET_Builder_Element::set_style($function_name, $element_style);
                }
            }
        }
        if (!empty($padding_mobile_values['tablet']) || !empty($padding_values['phone'])) {
            $padding_mobile_values_processed = array();
            foreach (array('tablet', 'phone') as $device) {
                if (empty($padding_mobile_values[$device])) {
                    continue;
                }
                $padding_mobile_values_processed[$device] = array('padding-top' => isset($padding_mobile_values[$device][0]) ? $padding_mobile_values[$device][0] : '', 'padding-right' => isset($padding_mobile_values[$device][1]) ? $padding_mobile_values[$device][1] : '', 'padding-bottom' => isset($padding_mobile_values[$device][2]) ? $padding_mobile_values[$device][2] : '', 'padding-left' => isset($padding_mobile_values[$device][3]) ? $padding_mobile_values[$device][3] : '');
            }
            if (!empty($padding_mobile_values_processed)) {
                et_pb_generate_responsive_css($padding_mobile_values_processed, '.et_pb_row > .et_pb_column%%order_class%%', '', $function_name);
            }
        }
        if ('' !== $custom_css_before) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%:before', 'declaration' => trim($custom_css_before)));
        }
        if ('' !== $custom_css_main) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%', 'declaration' => trim($custom_css_main)));
        }
        if ('' !== $custom_css_after) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%:after', 'declaration' => trim($custom_css_after)));
        }
        if ('et_pb_column_inner' === $function_name) {
            if ('1_1' === $type) {
                $type = '4_4';
            }
            $et_specialty_column_type = '' !== $saved_specialty_column_type ? $saved_specialty_column_type : $et_specialty_column_type;
            switch ($et_specialty_column_type) {
                case '1_2':
                    if ('1_2' === $type) {
                        $type = '1_4';
                    }
                    break;
                case '2_3':
                    if ('1_2' === $type) {
                        $type = '1_3';
                    }
                    break;
                case '3_4':
                    if ('1_2' === $type) {
                        $type = '3_8';
                    } else {
                        if ('1_3' === $type) {
                            $type = '1_4';
                        }
                    }
                    break;
            }
        }
        $inner_class = 'et_pb_column_inner' === $function_name ? ' et_pb_column_inner' : '';
        $class = 'et_pb_column_' . $type . $inner_class . $custom_css_class;
        $class = ET_Builder_Element::add_module_order_class($class, $function_name);
        $inner_content = do_shortcode(et_pb_fix_shortcodes($content));
        $class .= '' == trim($inner_content) ? ' et_pb_column_empty' : '';
        $class .= 'et_pb_column_inner' !== $function_name && '' !== $specialty_columns ? ' et_pb_specialty_column' : '';
        $output = sprintf('<div class="et_pb_column %1$s%3$s"%5$s>
				%4$s
				%2$s
			</div> <!-- .et_pb_column -->', esc_attr($class), $inner_content, '' !== $parallax_method ? ' et_pb_section_parallax' : '', '' !== $background_img && '' !== $parallax_method ? sprintf('<div class="et_parallax_bg%2$s" style="background-image: url(%1$s);"></div>', esc_attr($background_img), 'off' === $parallax_method ? ' et_pb_parallax_css' : '') : '', '' !== $custom_css_id ? sprintf(' id="%1$s"', esc_attr($custom_css_id)) : '');
        return $output;
    }
Exemplo n.º 2
0
function et_pb_map_pin($atts, $content = null)
{
    global $et_pb_tab_titles;
    extract(shortcode_atts(array('title' => '', 'pin_address_lat' => '', 'pin_address_lng' => ''), $atts));
    $content = do_shortcode(et_pb_fix_shortcodes($content));
    $output = sprintf('<div class="et_pb_map_pin" data-lat="%1$s" data-lng="%2$s" data-title="%3$s">
			%4$s
		</div>', esc_attr($pin_address_lat), esc_attr($pin_address_lng), esc_html($title), '' != $content ? sprintf('<div class="infowindow">%1$s</div>', $content) : '');
    return $output;
}
Exemplo n.º 3
0
 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);
     if (empty($this->template_name)) {
         return $output;
     }
     return $this->shortcode_output();
 }
Exemplo n.º 4
0
    function shortcode_callback($atts, $content = null, $function_name)
    {
        global $et_pb_pricing_tables_num, $et_pb_pricing_tables_icon;
        $featured = $this->shortcode_atts['featured'];
        $title = $this->shortcode_atts['title'];
        $subtitle = $this->shortcode_atts['subtitle'];
        $currency = $this->shortcode_atts['currency'];
        $per = $this->shortcode_atts['per'];
        $sum = $this->shortcode_atts['sum'];
        $button_url = $this->shortcode_atts['button_url'];
        $button_text = $this->shortcode_atts['button_text'];
        $button_custom = $this->shortcode_atts['custom_button'];
        $custom_icon = $this->shortcode_atts['button_icon'];
        $et_pb_pricing_tables_num++;
        $module_class = ET_Builder_Element::add_module_order_class('', $function_name);
        $custom_table_icon = 'on' === $button_custom && '' !== $custom_icon ? $custom_icon : $et_pb_pricing_tables_icon;
        if ('' !== $button_url && '' !== $button_text) {
            $button_text = sprintf('<a class="et_pb_pricing_table_button et_pb_button%4$s" href="%1$s"%3$s>%2$s</a>', esc_url($button_url), esc_html($button_text), '' !== $custom_table_icon ? sprintf(' data-icon="%1$s"', esc_attr(et_pb_process_font_icon($custom_table_icon))) : '', '' !== $custom_table_icon ? ' et_pb_custom_button_icon' : '');
        }
        $output = sprintf('<div class="et_pb_pricing_table%1$s%9$s">
				<div class="et_pb_pricing_heading">
					%2$s
					%3$s
				</div> <!-- .et_pb_pricing_heading -->
				<div class="et_pb_pricing_content_top">
					<span class="et_pb_et_price">%6$s%7$s%8$s</span>
				</div> <!-- .et_pb_pricing_content_top -->
				<div class="et_pb_pricing_content">
					<ul class="et_pb_pricing">
						%4$s
					</ul>
				</div> <!-- .et_pb_pricing_content -->
				%5$s
			</div>', 'off' !== $featured ? ' et_pb_featured_table' : '', '' !== $title ? sprintf('<h2 class="et_pb_pricing_title">%1$s</h2>', esc_html($title)) : '', '' !== $subtitle ? sprintf('<span class="et_pb_best_value">%1$s</span>', esc_html($subtitle)) : '', do_shortcode(et_pb_fix_shortcodes(et_pb_extract_items($content))), $button_text, '' !== $currency ? sprintf('<span class="et_pb_dollar_sign">%1$s</span>', esc_html($currency)) : '', '' !== $sum ? sprintf('<span class="et_pb_sum">%1$s</span>', esc_html($sum)) : '', '' !== $per ? sprintf('<span class="et_pb_frequency">/%1$s</span>', esc_html($per)) : '', esc_attr($module_class));
        return $output;
    }
Exemplo n.º 5
0
function et_pb_fix_builder_shortcodes($content)
{
    // if the builder is used for the page, get rid of random p tags
    if (is_singular() && 'on' === get_post_meta(get_the_ID(), '_et_pb_use_builder', true)) {
        $content = et_pb_fix_shortcodes($content);
    }
    return $content;
}
Exemplo n.º 6
0
 function et_get_first_video()
 {
     $first_video = '';
     $custom_fields = get_post_custom();
     $video_width = (int) apply_filters('et_blog_video_width', 1080);
     $video_height = (int) apply_filters('et_blog_video_height', 630);
     foreach ($custom_fields as $key => $custom_field) {
         if (0 !== strpos($key, '_oembed_')) {
             continue;
         }
         $first_video = $custom_field[0];
         $first_video = preg_replace('/<embed /', '<embed wmode="transparent" ', $first_video);
         $first_video = preg_replace('/<\\/object>/', '<param name="wmode" value="transparent" /></object>', $first_video);
         $first_video = preg_replace("/width=\"[0-9]*\"/", "width={$video_width}", $first_video);
         $first_video = preg_replace("/height=\"[0-9]*\"/", "height={$video_height}", $first_video);
         break;
     }
     if ('' === $first_video && has_shortcode(get_the_content(), 'video')) {
         $regex = get_shortcode_regex();
         preg_match("/{$regex}/s", get_the_content(), $match);
         $first_video = preg_replace("/width=\"[0-9]*\"/", "width=\"{$video_width}\"", $match[0]);
         $first_video = preg_replace("/height=\"[0-9]*\"/", "height=\"{$video_height}\"", $first_video);
         add_filter('the_content', 'et_delete_post_video');
         $first_video = do_shortcode(et_pb_fix_shortcodes($first_video));
     }
     return '' !== $first_video ? $first_video : false;
 }
Exemplo n.º 7
0
    function shortcode_callback($atts, $content = null, $function_name)
    {
        $type = $this->shortcode_atts['type'];
        $specialty_columns = $this->shortcode_atts['specialty_columns'];
        $saved_specialty_column_type = $this->shortcode_atts['saved_specialty_column_type'];
        global $et_specialty_column_type, $et_pb_column_backgrounds, $et_pb_column_paddings, $et_pb_column_inner_backgrounds, $et_pb_column_inner_paddings, $et_pb_columns_counter, $et_pb_columns_inner_counter;
        if ('et_pb_column_inner' !== $function_name) {
            $et_specialty_column_type = $type;
            $array_index = $et_pb_columns_counter;
            $backgrounds_array = $et_pb_column_backgrounds;
            $paddings_array = $et_pb_column_paddings;
            $et_pb_columns_counter++;
        } else {
            $array_index = $et_pb_columns_inner_counter;
            $backgrounds_array = $et_pb_column_inner_backgrounds;
            $paddings_array = $et_pb_column_inner_paddings;
            $et_pb_columns_inner_counter++;
        }
        $background_color = isset($backgrounds_array[$array_index][0]) ? $backgrounds_array[$array_index][0] : '';
        $background_img = isset($backgrounds_array[$array_index][1]) ? $backgrounds_array[$array_index][1] : '';
        $padding_values = isset($paddings_array[$array_index]) ? $paddings_array[$array_index] : array();
        if ('' !== $background_color && 'rgba(0,0,0,0)' !== $background_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%', 'declaration' => sprintf('background-color:%s;', esc_attr($background_color))));
        }
        if ('' !== $background_img) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%', 'declaration' => sprintf('background-image:url(%s);', esc_attr($background_img))));
        }
        if (!empty($padding_values)) {
            foreach ($padding_values as $position => $value) {
                if ('' !== $value) {
                    ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%', 'declaration' => sprintf('%1$s:%2$s;', esc_html($position), esc_html(et_builder_process_range_value($value)))));
                }
            }
        }
        if ('et_pb_column_inner' === $function_name) {
            $et_specialty_column_type = '' !== $saved_specialty_column_type ? $saved_specialty_column_type : $et_specialty_column_type;
            switch ($et_specialty_column_type) {
                case '1_2':
                    if ('1_2' === $type) {
                        $type = '1_4';
                    }
                    break;
                case '2_3':
                    if ('1_2' === $type) {
                        $type = '1_3';
                    }
                    break;
                case '3_4':
                    if ('1_2' === $type) {
                        $type = '3_8';
                    } else {
                        if ('1_3' === $type) {
                            $type = '1_4';
                        }
                    }
                    break;
            }
        }
        $inner_class = 'et_pb_column_inner' === $function_name ? ' et_pb_column_inner' : '';
        $class = 'et_pb_column_' . $type . $inner_class;
        $inner_content = do_shortcode(et_pb_fix_shortcodes($content));
        $class .= '' == trim($inner_content) ? ' et_pb_column_empty' : '';
        $class = ET_Builder_Element::add_module_order_class($class, $function_name);
        $class .= 'et_pb_column_inner' !== $function_name && '' !== $specialty_columns ? ' et_pb_specialty_column' : '';
        $output = sprintf('<div class="et_pb_column %1$s">
				%2$s
			</div> <!-- .et_pb_column -->', esc_attr($class), $inner_content);
        return $output;
    }
Exemplo n.º 8
0
 function et_get_first_video()
 {
     $first_video = '';
     $video_width = (int) apply_filters('et_blog_video_width', 1080);
     $video_height = (int) apply_filters('et_blog_video_height', 630);
     preg_match_all('|^\\s*https?://[^\\s"]+\\s*$|im', get_the_content(), $urls);
     foreach ($urls[0] as $url) {
         $oembed = wp_oembed_get(esc_url($url));
         if (!$oembed) {
             continue;
         }
         $first_video = $oembed;
         $first_video = preg_replace('/<embed /', '<embed wmode="transparent" ', $first_video);
         $first_video = preg_replace('/<\\/object>/', '<param name="wmode" value="transparent" /></object>', $first_video);
         $first_video = preg_replace("/width=\"[0-9]*\"/", "width={$video_width}", $first_video);
         $first_video = preg_replace("/height=\"[0-9]*\"/", "height={$video_height}", $first_video);
         break;
     }
     if ('' === $first_video && has_shortcode(get_the_content(), 'video')) {
         $regex = get_shortcode_regex();
         preg_match("/{$regex}/s", get_the_content(), $match);
         $first_video = preg_replace("/width=\"[0-9]*\"/", "width=\"{$video_width}\"", $match[0]);
         $first_video = preg_replace("/height=\"[0-9]*\"/", "height=\"{$video_height}\"", $first_video);
         add_filter('the_content', 'et_delete_post_video');
         $first_video = do_shortcode(et_pb_fix_shortcodes($first_video));
     }
     return '' !== $first_video ? $first_video : false;
 }
Exemplo n.º 9
0
function extra_tax_layout()
{
    $layout = extra_get_tax_layout();
    if (!empty($layout)) {
        echo do_shortcode(et_pb_fix_shortcodes($layout));
    } else {
        require locate_template('index-content.php');
    }
}
 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();
 }
Exemplo n.º 11
0
 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();
 }