示例#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;
    }
    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;
    }
示例#3
0
function et_fb_backend_helpers()
{
    global $post, $paged;
    $layout_type = '';
    $post_type = isset($post->post_type) ? $post->post_type : false;
    $post_id = isset($post->ID) ? $post->ID : false;
    $post_status = isset($post->post_status) ? $post->post_status : false;
    if ('et_pb_layout' === $post_type) {
        $layout_type = et_fb_get_layout_type($post_id);
    }
    $google_fonts = array_merge(array('Default' => array()), et_builder_get_google_fonts());
    $current_user = wp_get_current_user();
    $current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    $export_url = add_query_arg(array('et_core_portability' => true, 'context' => 'et_builder', 'name' => 'temp_name', 'nonce' => wp_create_nonce('et_core_portability_nonce')), admin_url());
    $fb_modules_array = apply_filters('et_fb_modules_array', ET_Builder_Element::get_modules_array($post_type, true, true));
    $helpers = array('debug' => true, 'postId' => $post_id, 'postStatus' => $post_status, 'postType' => $post_type, 'layoutType' => $layout_type, 'publishCapability' => is_page() && !current_user_can('publish_pages') || !is_page() && !current_user_can('publish_posts') ? 'no_publish' : 'publish', 'shortcodeObject' => array(), 'ajaxUrl' => admin_url('admin-ajax.php'), 'tinymceSkinUrl' => ET_FB_ASSETS_URI . '/vendors/tinymce-skin', 'tinymceCSSFiles' => esc_url(includes_url('js/tinymce') . '/skins/wordpress/wp-content.css'), 'images_uri' => ET_BUILDER_URI . '/images', 'generalFields' => array(), 'advancedFields' => array(), 'customCssFields' => array(), 'moduleParentShortcodes' => ET_Builder_Element::get_parent_shortcodes($post_type), 'moduleChildShortcodes' => ET_Builder_Element::get_child_shortcodes($post_type), 'moduleChildSlugs' => ET_Builder_Element::get_child_slugs($post_type), 'moduleRawContentShortcodes' => ET_Builder_Element::get_raw_content_shortcodes($post_type), 'modules' => $fb_modules_array, 'modulesCount' => count($fb_modules_array), 'modulesWithChildren' => ET_Builder_Element::get_shortcodes_with_children($post_type), 'structureModules' => ET_Builder_Element::get_structure_modules($post_type), 'et_builder_css_media_queries' => ET_Builder_Element::get_media_quries('for_js'), 'commentsModuleMarkup' => et_fb_get_comments_markup(), 'shortcode_tags' => et_fb_shortcode_tags(), 'getFontIconSymbols' => et_pb_get_font_icon_symbols(), 'failureNotification' => et_builder_get_failure_notification_modal(), 'exitNotification' => et_builder_get_exit_notification_modal(), 'getTaxonomies' => apply_filters('et_fb_taxonomies', array('category' => get_categories(), 'project_category' => get_categories(array('taxonomy' => 'project_category')), 'product_category' => class_exists('WooCommerce') ? get_terms('product_cat') : '')), 'googleAPIKey' => et_pb_is_allowed('theme_options') ? get_option('et_google_api_settings') : '', 'googleFontsList' => array_keys($google_fonts), 'googleFonts' => $google_fonts, 'gutterWidth' => et_get_option('gutter_width', 3), 'fontIcons' => et_pb_get_font_icon_symbols(), 'fontIconsDown' => et_pb_get_font_down_icon_symbols(), 'widgetAreas' => et_builder_get_widget_areas_list(), 'site_url' => get_site_url(), 'etBuilderAccentColor' => et_builder_accent_color(), 'gmt_offset_string' => et_pb_get_gmt_offset_string(), 'et_builder_fonts_data' => et_builder_get_fonts(), 'currentUserDisplayName' => $current_user->display_name, 'locale' => get_locale(), 'roleSettings' => et_pb_get_role_settings(), 'currentRole' => et_pb_get_current_user_role(), 'exportUrl' => $export_url, 'urls' => array('loginFormUrl' => esc_url(site_url('wp-login.php', 'login_post')), 'forgotPasswordUrl' => esc_url(wp_lostpassword_url()), 'logoutUrl' => esc_url(wp_logout_url()), 'logoutUrlRedirect' => esc_url(wp_logout_url($current_url)), 'themeOptionsUrl' => esc_url(et_pb_get_options_page_link()), 'builderPreviewStyle' => ET_BUILDER_URI . '/styles/preview.css'), 'nonces' => array('moduleContactFormSubmit' => wp_create_nonce('et-pb-contact-form-submit'), 'et_admin_load' => wp_create_nonce('et_admin_load_nonce'), 'computedProperty' => wp_create_nonce('et_pb_process_computed_property_nonce'), 'renderShortcode' => wp_create_nonce('et_pb_render_shortcode_nonce'), 'backendHelper' => wp_create_nonce('et_fb_backend_helper_nonce'), 'renderSave' => wp_create_nonce('et_fb_save_nonce'), 'prepareShortcode' => wp_create_nonce('et_fb_prepare_shortcode_nonce'), 'processImportedData' => wp_create_nonce('et_fb_process_imported_data_nonce'), 'retrieveLibraryModules' => wp_create_nonce('et_fb_retrieve_library_modules_nonce'), 'saveLibraryModules' => wp_create_nonce('et_fb_save_library_modules_nonce'), 'preview' => wp_create_nonce('et_pb_preview_nonce')), 'conditionalTags' => et_fb_conditional_tag_params(), 'currentPage' => et_fb_current_page_params(), 'appPreferences' => et_fb_app_preferences(), 'classNames' => array('hide_on_mobile_class' => 'et-hide-mobile'), 'columnLayouts' => et_builder_get_columns(), 'pageSettingsFields' => et_pb_get_builder_settings_configurations(), 'pageSettingsValues' => et_pb_get_builder_settings_values(), 'splitTestSubjects' => false !== ($all_subjects_raw = get_post_meta($post_id, '_et_pb_ab_subjects', true)) ? explode(',', $all_subjects_raw) : array(), 'defaults' => array('contactFormInputs' => et_fb_process_shortcode(sprintf('[et_pb_contact_field field_title="%1$s" field_type="input" field_id="Name" required_mark="on" fullwidth_field="off" /][et_pb_contact_field field_title="%2$s" field_type="email" field_id="Email" required_mark="on" fullwidth_field="off" /][et_pb_contact_field field_title="%3$s" field_type="text" field_id="Message" required_mark="on" fullwidth_field="on" /]', esc_attr__('Name', 'et_builder'), esc_attr__('Email Address', 'et_builder'), esc_attr__('Message', 'et_builder')))), 'all_modules_default_attrs' => ET_Builder_Element::get_all_modules_default_fields($post_type), 'saveModuleLibraryCategories' => et_fb_prepare_library_cats(), 'columnSettingFields' => array('advanced' => array('bg_img_%s' => array('label' => esc_html__('Column %s Background Image', 'et_builder'), 'type' => 'upload', 'option_category' => 'basic_option', 'upload_button_text' => esc_attr__('Upload an image', 'et_builder'), 'choose_text' => esc_attr__('Choose a Background Image', 'et_builder'), 'update_text' => esc_attr__('Set As Background', 'et_builder'), 'description' => esc_html__('If defined, this image will be used as the background for this module. To remove a background image, simply delete the URL from the settings field.', 'et_builder'), 'tab_slug' => 'advanced'), 'parallax_%s' => array('label' => esc_html__('Column %s Parallax Effect', 'et_builder'), 'type' => 'yes_no_button', 'option_category' => 'configuration', 'options' => array('on' => esc_html__('Yes', 'et_builder'), 'off' => esc_html__('No', 'et_builder')), 'affects' => array('parallax_method_%s'), 'description' => esc_html__('Here you can choose whether or not use parallax effect for the featured image', 'et_builder'), 'tab_slug' => 'advanced'), 'parallax_method_%s' => array('label' => esc_html__('Column %s Parallax Method', 'et_builder'), 'type' => 'select', 'option_category' => 'configuration', 'options' => array('off' => esc_html__('CSS', 'et_builder'), 'on' => esc_html__('True Parallax', 'et_builder')), 'depends_show_if' => 'on', 'depends_to' => array('parallax_%s'), 'description' => esc_html__('Here you can choose which parallax method to use for the featured image', 'et_builder'), 'tab_slug' => 'advanced'), 'background_color_%s' => array('label' => esc_html__('Column %s Background Color', 'et_builder'), 'type' => 'color-alpha', 'custom_color' => true, 'tab_slug' => 'advanced'), 'padding_%s' => array('label' => esc_html__('Column %s Custom Padding', 'et_builder'), 'type' => 'custom_padding', 'mobile_options' => true, 'option_category' => 'layout', 'description' => esc_html__('Adjust padding to specific values, or leave blank to use the default padding.', 'et_builder'), 'tab_slug' => 'advanced')), 'css' => array('module_id_%s' => array('label' => esc_html__('Column %s CSS ID', 'et_builder'), 'type' => 'text', 'option_category' => 'configuration', 'tab_slug' => 'custom_css', 'option_class' => 'et_pb_custom_css_regular'), 'module_class_%s' => array('label' => esc_html__('Column %s CSS Class', 'et_builder'), 'type' => 'text', 'option_category' => 'configuration', 'tab_slug' => 'custom_css', 'option_class' => 'et_pb_custom_css_regular'), 'custom_css_before_%s' => array('label' => esc_html__('Column %s before', 'et_builder'), 'no_space_before_selector' => true, 'selector' => ':before'), 'custom_css_main_%s' => array('label' => esc_html__('Column %s Main Element', 'et_builder')), 'custom_css_after_%s' => array('label' => esc_html__('Column %s After', 'et_builder'), 'no_space_before_selector' => true, 'selector' => ':after'))));
    // Internationalization.
    $helpers['i18n'] = array('modules' => array('audio' => array('meta' => _x('by <strong>%1$s</strong>', 'Audio Module meta information', 'et_builder')), 'contactForm' => array('thankYou' => esc_html__('Thanks for contacting us', 'et_builder'), 'submit' => esc_attr__('Submit', 'et_builder')), 'countdownTimer' => array('dayFull' => esc_html__('Day(s)', 'et_builder'), 'dayShort' => esc_html__('Day', 'et_builder'), 'hourFull' => esc_html__('Hour(s)', 'et_builder'), 'hourShort' => esc_html__('Hrs', 'et_builder'), 'minuteFull' => esc_html__('Minute(s)', 'et_builder'), 'minuteShort' => esc_html__('Min', 'et_builder'), 'secondFull' => esc_html__('Second(s)', 'et_builder'), 'secondShort' => esc_html__('Sec', 'et_builder')), 'signup' => array('emailAddress' => esc_attr__('Email Address', 'et_builder'), 'firstName' => esc_attr__('First Name', 'et_builder'), 'lastName' => esc_attr__('Last Name', 'et_builder'), 'name' => esc_attr__('Name', 'et_builder'), 'email' => esc_attr__('Email', 'et_builder')), 'filterablePortfolio' => array('all' => esc_html__('All', 'et_builder')), 'login' => array('loginAs' => sprintf(esc_html__('Login as %s', 'et_builder'), $current_user->display_name), 'login' => esc_html__('Login', 'et_builder'), 'logout' => esc_html__('Log out', 'et_builder'), 'forgotPassword' => esc_html__('Forgot your password?', 'et_builder'), 'username' => esc_html__('Username', 'et_builder'), 'password' => esc_html__('Password', 'et_builder')), 'search' => array('submitButtonText' => esc_html__('Search', 'et_builder'), 'searchfor' => esc_html__('Search for:', 'et_builder')), 'fullwidthPostSlider' => array('by' => esc_html('by ', 'et_builder'))), 'saveButtonText' => esc_attr__('Save', 'et_builder'), 'saveDraftButtonText' => esc_attr__('Save Draft', 'et_builder'), 'publishButtonText' => is_page() && !current_user_can('publish_pages') || !is_page() && !current_user_can('publish_posts') ? esc_attr__('Submit', 'et_builder') : esc_attr__('Publish', 'et_builder'), 'controls' => array('tinymce' => array('visual' => esc_html__('Visual', 'et_builder'), 'text' => esc_html__('Text', 'et_builder')), 'moduleItem' => array('addNew' => esc_html__('Add New Item', 'et_builder')), 'upload' => array('buttonText' => esc_html__('Upload', 'et_builder')), 'insertMedia' => array('buttonText' => esc_html__('Add Media', 'et_builder'), 'modalTitleText' => esc_html__('Insert Media', 'et_builder')), 'inputMargin' => array('top' => esc_html__('Top', 'et_builder'), 'right' => esc_html__('Right', 'et_builder'), 'bottom' => esc_html__('Bottom', 'et_builder'), 'left' => esc_html__('Left', 'et_builder')), 'colorpicker' => array('clear' => esc_html__('Clear', 'et_builder')), 'uploadGallery' => array('uploadButtonText' => esc_html__('Update Gallery', 'et_builder')), 'centerMap' => array('updateMapButtonText' => esc_html__('Find', 'et_builder'), 'geoCodeError' => esc_html__('Geocode was not successful for the following reason', 'et_builder'), 'geoCodeError_2' => esc_html__('Geocoder failed due to', 'et_builder'), 'noResults' => esc_html__('No results found', 'et_builder'), 'mapPinAddressInvalid' => esc_html__('Invalid Pin and address data. Please try again.', 'et_builder')), 'tabs' => array('general' => esc_html__('General', 'et_builder'), 'design' => esc_html__('Design', 'et_builder'), 'css' => esc_html__('CSS', 'et_builder')), 'additionalButton' => array('changeApiKey' => esc_html__('Change API Key', 'et_builder'), 'generateImageUrlFromVideo' => esc_html__('Generate From Video', 'et_builder'))), 'rightClickMenuItems' => array('undo' => esc_html__('Undo', 'et_builder'), 'redo' => esc_html__('Redo', 'et_builder'), 'lock' => esc_html__('Lock', 'et_builder'), 'unlock' => esc_html__('Unlock', 'et_builder'), 'copy' => esc_html__('Copy', 'et_builder'), 'paste' => esc_html__('Paste', 'et_builder'), 'copyStyle' => esc_html__('Copy Style', 'et_builder'), 'pasteStyle' => esc_html__('Paste Style', 'et_builder'), 'disable' => esc_html__('Disable', 'et_builder'), 'enable' => esc_html__('Enable', 'et_builder'), 'save' => esc_html__('Save to Library', 'et_builder'), 'moduleType' => array('module' => esc_html__('Module', 'et_builder'), 'row' => esc_html__('Row', 'et_builder'), 'section' => esc_html__('Section', 'et_builder')), 'disableGlobal' => esc_html__('Disable Global', 'et_builder')), 'tooltips' => array('insertModule' => esc_html__('Insert Module', 'et_builder'), 'insertColumn' => esc_html__('Insert Columns', 'et_builder'), 'insertSection' => esc_html__('Insert Section', 'et_builder'), 'insertRow' => esc_html__('Insert Row', 'et_builder'), 'newModule' => esc_html__('New Module', 'et_builder'), 'newRow' => esc_html__('New Row', 'et_builder'), 'newSection' => esc_html__('New Section', 'et_builder'), 'addFromLibrary' => esc_html__('Add From Library', 'et_builder'), 'addToLibrary' => esc_html__('Add to Library', 'et_builder'), 'loading' => esc_html__('loading...', 'et_builder'), 'regular' => esc_html__('Regular', 'et_builder'), 'fullwidth' => esc_html__('Fullwidth', 'et_builder'), 'specialty' => esc_html__('Specialty', 'et_builder'), 'changeRow' => esc_html__('Choose Layout', 'et_builder'), 'clearLayout' => esc_html__('Clear Layout', 'et_builder'), 'clearLayoutText' => esc_html__('All of your current page content will be lost. Do you wish to proceed?', 'et_builder'), 'yes' => esc_html__('Yes', 'et_builder'), 'loadLayout' => esc_html__('Load From Library', 'et_builder'), 'predefinedLayout' => esc_html__('Predefined Layouts', 'et_builder'), 'replaceLayout' => esc_html__('Replace existing content.', 'et_builder'), 'search' => esc_html__('Search', 'et_builder') . '...', 'portability' => esc_html__('Portability', 'et_builder'), 'export' => esc_html__('Export', 'et_builder'), 'import' => esc_html__('Import', 'et_builder'), 'exportText' => esc_html__('Exporting your Divi Builder Layout will create a JSON file that can be imported into a different website.', 'et_builder'), 'exportName' => esc_html__('Export File Name', 'et_builder'), 'exportButton' => esc_html__('Export Divi Builder Layout', 'et_builder'), 'importText' => esc_html__('Importing a previously-exported Divi Builder Layout file will overwrite all content currently on this page.', 'et_builder'), 'importField' => esc_html__('Select File To Import', 'et_builder'), 'importBackUp' => esc_html__('Download backup before importing', 'et_builder'), 'importButton' => esc_html__('Import Divi Builder Layout', 'et_builder'), 'noFile' => esc_html__('No File Selected', 'et_builder'), 'chooseFile' => esc_html__('Choose File', 'et_builder')), 'saveModuleLibraryAttrs' => array('general' => esc_html__('Include General Settings', 'et_builder'), 'advanced' => esc_html__('Include Advanced Design Settings', 'et_builder'), 'css' => esc_html__('Include Custom CSS', 'et_builder'), 'selectCategoriesText' => esc_html__('Select category(ies) for new template or type a new name ( optional )', 'et_builder'), 'templateName' => esc_html__('Template Name', 'et_builder'), 'selectiveSync' => esc_html__('Selective Sync', 'et_builder'), 'selectiveError' => esc_html__('Please select at least 1 tab to save', 'et_builder'), 'globalTitle' => esc_html__('Save as Global', 'et_builder'), 'globalText' => esc_html__('Make this a global item', 'et_builder'), 'createCatText' => esc_html__('Create New Category', 'et_builder'), 'addToCatText' => esc_html__('Add To Categories', 'et_builder'), 'descriptionText' => esc_html__('Here you can add the current item to your Divi Library for later use.', 'et_builder'), 'descriptionTextLayout' => esc_html__('Save your current page to the Divi Library for later use.', 'et_builder'), 'saveText' => esc_html__('Save to Library', 'et_builder'), 'allCategoriesText' => esc_html__('All Categories', 'et_builder')), 'modals' => array('tabItemTitles' => array('general' => esc_html__('General', 'et_builder'), 'design' => esc_html__('Design', 'et_builder'), 'css' => esc_html__('CSS', 'et_builder')), 'pageSettings' => array('title' => esc_html__('Page Settings', 'et_builder'))), 'history' => array('modal' => array('title' => esc_html__('Editing History', 'et_builder'), 'tabs' => array('states' => esc_html__('History States', 'et_builder'))), 'meta' => et_pb_history_localization()), 'help' => array('modal' => array('title' => esc_html__('Divi Builder Helper', 'et_builder'), 'tabs' => array('shortcut' => esc_html__('Shortcuts', 'et_builder'))), 'shortcuts' => array('page_title' => esc_html__('Page Shortcuts', 'et_builder'), 'page' => array('undo' => array('kbd' => array('super', 'z'), 'desc' => esc_html__('Undo', 'et_builder')), 'redo' => array('kbd' => array('super', 'y'), 'desc' => esc_html__('Redo', 'et_builder')), 'save' => array('kbd' => array('super', 's'), 'desc' => esc_html__('Save Page', 'et_builder')), 'save_as_draft' => array('kbd' => array('super', 'shift', 's'), 'desc' => esc_html__('Save Page As Draft', 'et_builder')), 'exit' => array('kbd' => array('super', 'e'), 'desc' => esc_html__('Exit Visual Builder', 'et_builder')), 'exit_to_backend_builder' => array('kbd' => array('super', 'shift', 'e'), 'desc' => esc_html__('Exit To Backend Builder', 'et_builder')), 'toggle_settings_bar' => array('kbd' => array('t'), 'desc' => esc_html__('Toggle Settings Bar', 'et_builder')), 'open_page_settings' => array('kbd' => array('o'), 'desc' => esc_html__('Open Page Settings', 'et_builder')), 'open_history' => array('kbd' => array('h'), 'desc' => esc_html__('Open History Window', 'et_builder')), 'open_portability' => array('kbd' => array('p'), 'desc' => esc_html__('Open Portability Window', 'et_builder')), 'zoom_in' => array('kbd' => array('super', '+'), 'desc' => esc_html__('Responsive Zoom In', 'et_builder')), 'zoom_out' => array('kbd' => array('super', '-'), 'desc' => esc_html__('Responsive Zoom Out', 'et_builder')), 'help' => array('kbd' => array('?'), 'desc' => esc_html__('List All Shortcuts', 'et_builder'))), 'inline_title' => esc_html__('Inline Editor Shortcuts', 'et_builder'), 'inline' => array('escape' => array('kbd' => array('esc'), 'desc' => esc_html__('Exit Inline Editor', 'et_builder'))), 'module_title' => esc_html__('Module Shortcuts', 'et_builder'), 'module' => array('module_copy' => array('kbd' => array('super', 'c'), 'desc' => esc_html__('Copy Module', 'et_builder')), 'module_cut' => array('kbd' => array('super', 'x'), 'desc' => esc_html__('Cut Module', 'et_builder')), 'module_paste' => array('kbd' => array('super', 'v'), 'desc' => esc_html__('Paste Module', 'et_builder')), 'module_copy_styles' => array('kbd' => array('super', 'alt', 'c'), 'desc' => esc_html__('Copy Module Styles', 'et_builder')), 'module_paste_styles' => array('kbd' => array('super', 'alt', 'v'), 'desc' => esc_html__('Paste Module Styles', 'et_builder')), 'module_lock' => array('kbd' => array('l'), 'desc' => esc_html__('Lock Module', 'et_builder')), 'module_disable' => array('kbd' => array('d'), 'desc' => esc_html__('Disable Module', 'et_builder')), 'drag_auto_copy' => array('kbd' => array('alt', 'module move'), 'desc' => esc_html__('Move and copy module into dropped location', 'et_builder')), 'column_change_structure' => array('kbd' => array('c', array('1', '2', '3', '4')), 'desc' => esc_html__('Change Column Structure', 'et_builder')), 'row_make_fullwidth' => array('kbd' => array('r', 'f'), 'desc' => esc_html__('Make Row Fullwidth', 'et_builder')), 'row_edit_gutter' => array('kbd' => array('g', array('1', '2', '3', '4')), 'desc' => esc_html__('Change Gutter Width', 'et_builder')), 'add_new_row' => array('kbd' => array('r', array('1', '2', '3', '4')), 'desc' => esc_html__('Add New Row', 'et_builder')), 'add_new_section' => array('kbd' => array('s', array('1', '2', '3')), 'desc' => esc_html__('Add New Section', 'et_builder')), 'resize_padding_auto_opposite' => array('kbd' => array('shift', 'Drag Padding'), 'desc' => esc_html__('Restrict padding to 10px increments', 'et_builder')), 'resize_padding_limited' => array('kbd' => array('alt', 'Drag Padding'), 'desc' => esc_html__('Padding limited to opposing value', 'et_builder')), 'resize_padding_10' => array('kbd' => array('shift', 'alt', 'Drag Padding'), 'desc' => esc_html__('Mirror padding on both sides', 'et_builder')), 'increase_padding_row' => array('kbd' => array('r', array('left', 'right', 'up', 'down')), 'desc' => esc_html__('Increase Row Padding', 'et_builder')), 'decrease_padding_row' => array('kbd' => array('r', 'alt', array('left', 'right', 'up', 'down')), 'desc' => esc_html__('Decrease Row Padding', 'et_builder')), 'increase_padding_section' => array('kbd' => array('s', array('left', 'right', 'up', 'down')), 'desc' => esc_html__('Increase Section Padding', 'et_builder')), 'decrease_padding_section' => array('kbd' => array('s', 'alt', array('left', 'right', 'up', 'down')), 'desc' => esc_html__('Decrease Section Padding', 'et_builder')), 'increase_padding_row_10' => array('kbd' => array('r', 'shift', array('left', 'right', 'up', 'down')), 'desc' => esc_html__('Increase Row Padding By 10px', 'et_builder')), 'decrease_padding_row_10' => array('kbd' => array('r', 'alt', 'shift', array('left', 'right', 'up', 'down')), 'desc' => esc_html__('Decrease Row Padding By 10px', 'et_builder')), 'increase_padding_section_10' => array('kbd' => array('s', 'shift', array('left', 'right', 'up', 'down')), 'desc' => esc_html__('Increase Section Padding By 10px', 'et_builder')), 'decrease_padding_section_10' => array('kbd' => array('s', 'alt', 'shift', array('left', 'right', 'up', 'down')), 'desc' => esc_html__('Decrease Section Padding By 10px', 'et_builder'))), 'modal_title' => esc_html__('Modal Shortcuts', 'et_builder'), 'modal' => array('escape' => array('kbd' => array('esc'), 'desc' => esc_html__('Close Modal', 'et_builder')), 'save_changes' => array('kbd' => array('enter'), 'desc' => esc_html__('Save Changes', 'et_builder')), 'undo' => array('kbd' => array('super', 'z'), 'desc' => esc_html__('Undo', 'et_builder')), 'redo' => array('kbd' => array('super', 'shift', 'z'), 'desc' => esc_html__('Redo', 'et_builder')), 'switch_tabs' => array('kbd' => array('shift', 'tab'), 'desc' => esc_html__('Switch Tabs', 'et_builder')), 'toggle_expand' => array('kbd' => array('super', 'enter'), 'desc' => esc_html__('Expand Modal Fullscreen', 'et_builder')), 'toggle_snap' => array('kbd' => array('super', array('left', 'right')), 'desc' => esc_html__('Snap Modal Left / Right', 'et_builder'))))), 'sortable' => array('has_no_ab_permission' => esc_html__('You do not have permission to edit the module, row or section in this split test.', 'et_builder'), 'cannot_move_goal_into_subject' => esc_html__('A split testing goal cannot be moved inside of a split testing subject. To perform this action you must first end your split test.', 'et_builder'), 'cannot_move_subject_into_goal' => esc_html__('A split testing subject cannot be moved inside of a split testing goal. To perform this action you must first end your split test.', 'et_builder'), 'cannot_move_row_goal_out_from_subject' => esc_html__('Once set, a goal that has been placed inside a split testing subject cannot be moved outside the split testing subject. You can end your split test and start a new one if you would like to make this change.', 'et_builder'), 'section_only_row_dragged_away' => esc_html__('The section should have at least one row.', 'et_builder'), 'global_module_alert' => esc_html__('You cannot add global modules into global sections or rows', 'et_builder'), 'cannot_move_module_goal_out_from_subject' => esc_html__('Once set, a goal that has been placed inside a split testing subject cannot be moved outside the split testing subject. You can end your split test and start a new one if you would like to make this change.', 'et_builder'), 'stop_dropping_3_col_row' => esc_html__('3 column row can\'t be used in this column.', 'et_builder')), 'tooltip' => array('pageSettingsBar' => array('responsive' => array('zoom' => esc_html__('Zoom Out', 'et_builder'), 'desktop' => esc_html__('Desktop View', 'et_builder'), 'tablet' => esc_html__('Tablet View', 'et_builder'), 'phone' => esc_html__('Phone View', 'et_builder')), 'main' => array('loadLibrary' => esc_html__('Load From Library', 'et_builder'), 'saveToLibrary' => esc_html__('Save To Library', 'et_builder'), 'clearLayout' => esc_html__('Clear Layout', 'et_builder'), 'pageSettingsModal' => esc_html__('Page Settings', 'et_builder'), 'history' => esc_html__('Editing History', 'et_builder'), 'portability' => esc_html__('Portability', 'et_builder'), 'open' => esc_html__('Expand Settings', 'et_builder'), 'close' => esc_html__('Collapse Settings', 'et_builder')), 'save' => array('saveDraft' => esc_html__('Save as Draft', 'et_builder'), 'save' => esc_html__('Save', 'et_builder'), 'publish' => esc_html__('Publish', 'et_builder'))), 'modal' => array('expandModal' => esc_html__('Expand Modal', 'et_builder'), 'contractModal' => esc_html__('Contract Modal', 'et_builder'), 'resize' => esc_html__('Resize Modal', 'et_builder'), 'snapModal' => esc_html__('Snap to Left', 'et_builder'), 'separateModal' => esc_html__('Separate Modal', 'et_builder'), 'redo' => esc_html__('Redo', 'et_builder'), 'undo' => esc_html__('Undo', 'et_builder'), 'cancel' => esc_html__('Discard All Changes', 'et_builder'), 'save' => esc_html__('Save Changes', 'et_builder')), 'inlineEditor' => array('back' => esc_html__('Go Back', 'et_builder'), 'increaseFontSize' => esc_html__('Decrease Font Size', 'et_builder'), 'decreaseFontSize' => esc_html__('Increase Font Size', 'et_builder'), 'bold' => esc_html__('Bold Text', 'et_builder'), 'italic' => esc_html__('Italic Text', 'et_builder'), 'underline' => esc_html__('Underline Text', 'et_builder'), 'link' => esc_html__('Insert Link', 'et_builder'), 'quote' => esc_html__('Insert Quote', 'et_builder'), 'alignment' => esc_html__('Text Alignment', 'et_builder'), 'centerText' => esc_html__('Center Text', 'et_builder'), 'rightText' => esc_html__('Right Text', 'et_builder'), 'leftText' => esc_html__('Left Text', 'et_builder'), 'justifyText' => esc_html__('Justify Text', 'et_builder'), 'list' => esc_html__('List Settings', 'et_builder'), 'indent' => esc_html__('Indent List', 'et_builder'), 'undent' => esc_html__('Undent List', 'et_builder'), 'orderedList' => esc_html__('Insert Ordered List', 'et_builder'), 'unOrderedList' => esc_html__('Insert Unordered List', 'et_builder'), 'text' => esc_html__('Text Settings', 'et_builder'), 'textColor' => esc_html__('Text Color', 'et_builder'), 'heading' => array('one' => esc_html__('Insert Heading One', 'et_builder'), 'two' => esc_html__('Insert Heading Two', 'et_builder'), 'three' => esc_html__('Insert Heading Three', 'et_builder'), 'four' => esc_html__('Insert Heading Four', 'et_builder'))), 'section' => array('tab' => array('move' => esc_html__('Move Section', 'et_builder'), 'settings' => esc_html__('Section Settings', 'et_builder'), 'duplicate' => esc_html__('Duplicate Section', 'et_builder'), 'addToLibrary' => esc_html__('Save Section To Library', 'et_builder'), 'delete' => esc_html__('Delete Section', 'et_builder')), 'addButton' => esc_html__('Add New Section', 'et_builder')), 'row' => array('tab' => array('move' => esc_html__('Move Row', 'et_builder'), 'settings' => esc_html__('Row Settings', 'et_builder'), 'duplicate' => esc_html__('Duplicate Row', 'et_builder'), 'addToLibrary' => esc_html__('Save Row To Library', 'et_builder'), 'delete' => esc_html__('Delete Row', 'et_builder'), 'update' => esc_html__('Change Column Structure', 'et_builder')), 'addButton' => esc_html__('Add New Row', 'et_builder')), 'module' => array('tab' => array('move' => esc_html__('Move Module', 'et_builder'), 'settings' => esc_html__('Module Settings', 'et_builder'), 'duplicate' => esc_html__('Duplicate Module', 'et_builder'), 'addToLibrary' => esc_html__('Save Module To Library', 'et_builder'), 'delete' => esc_html__('Delete Module', 'et_builder')), 'addButton' => esc_html__('Add New Module', 'et_builder'))), 'unsavedConfirmation' => esc_html__('Unsaved changes will be lost if you leave the Divi Builder at this time.', 'et_builder'), 'libraryLoadError' => esc_html__('Error loading Library items from server. Please refresh the page and try again.', 'et_builder'));
    // Pass helpers via localization.
    wp_localize_script('et-frontend-builder', 'ETBuilderBackend', $helpers);
}
示例#4
0
 static function set_order_class($function_name)
 {
     if (!isset(self::$modules_order)) {
         self::$modules_order = array();
     }
     self::$modules_order[$function_name] = isset(self::$modules_order[$function_name]) ? (int) self::$modules_order[$function_name] + 1 : 0;
 }
示例#5
0
/**
 * Generates the array of allowed modules in jQuery Array format
 * @return string
 */
function et_pb_allowed_modules_list($role = '')
{
    $saved_capabilities = et_pb_get_role_settings();
    $role = '' === $role ? et_pb_get_current_user_role() : $role;
    // add all the modules into capabilities array of we don't have saved roles for modules yet.
    if (empty($saved_capabilities[$role])) {
        $all_modules_array = json_decode(ET_Builder_Element::get_modules_js_array('page'), true);
        $module_capabilies = array();
        foreach ($all_modules_array as $module => $module_details) {
            if (!in_array($module_details['label'], array('et_pb_section', 'et_pb_row', 'et_pb_row_inner', 'et_pb_column'))) {
                $module_capabilies[$module_details['label']] = 'on';
            }
        }
        $saved_modules_capabilities = $module_capabilies;
    } else {
        $saved_modules_capabilities = $saved_capabilities[$role];
    }
    $alowed_modules = "[";
    foreach ($saved_modules_capabilities as $capability => $cap_state) {
        if (false !== strpos($capability, 'et_pb_') && 'off' !== $cap_state) {
            $alowed_modules .= "'" . $capability . "',";
        }
    }
    $alowed_modules .= "]";
    return $alowed_modules;
}
 function et_pb_add_builder_page_js_css()
 {
     global $typenow;
     // we need some post data when editing saved templates.
     if ('et_pb_layout' === $typenow) {
         $template_scope = wp_get_object_terms(get_the_ID(), 'scope');
         $is_global_template = !empty($template_scope[0]) ? $template_scope[0]->slug : 'regular';
         $post_id = get_the_ID();
     } else {
         $is_global_template = '';
         $post_id = '';
     }
     // we need this data to create the filter when adding saved modules
     $layout_categories = get_terms('layout_category');
     $layout_cat_data = array();
     $layout_cat_data_json = '';
     if (is_array($layout_categories) && !empty($layout_categories)) {
         foreach ($layout_categories as $category) {
             $layout_cat_data[] = array('slug' => $category->slug, 'name' => $category->name);
         }
     }
     if (!empty($layout_cat_data)) {
         $layout_cat_data_json = json_encode($layout_cat_data);
     }
     wp_enqueue_script('jquery-ui-core');
     wp_enqueue_script('underscore');
     wp_enqueue_script('backbone');
     wp_enqueue_script('google-maps-api', esc_url(add_query_arg(array('v' => 3, 'sensor' => 'false'), is_ssl() ? 'https://maps-api-ssl.google.com/maps/api/js' : 'http://maps.google.com/maps/api/js')), array(), '3', true);
     wp_enqueue_script('wp-color-picker');
     wp_enqueue_style('wp-color-picker');
     wp_enqueue_script('wp-color-picker-alpha', ET_BUILDER_URI . '/scripts/ext/wp-color-picker-alpha.min.js', array('jquery', 'wp-color-picker'), ET_BUILDER_VERSION, true);
     wp_enqueue_script('et_pb_admin_date_js', ET_BUILDER_URI . '/scripts/ext/jquery-ui-1.10.4.custom.min.js', array('jquery'), ET_BUILDER_VERSION, true);
     wp_enqueue_script('et_pb_admin_date_addon_js', ET_BUILDER_URI . '/scripts/ext/jquery-ui-timepicker-addon.js', array('et_pb_admin_date_js'), ET_BUILDER_VERSION, true);
     wp_enqueue_script('validation', ET_BUILDER_URI . '/scripts/ext/jquery.validate.js', array('jquery'), ET_BUILDER_VERSION, true);
     wp_enqueue_script('minicolors', ET_BUILDER_URI . '/scripts/ext/jquery.minicolors.js', array('jquery'), ET_BUILDER_VERSION, true);
     wp_enqueue_script('et_pb_admin_js', ET_BUILDER_URI . '/scripts/builder.js', array('jquery', 'jquery-ui-core', 'underscore', 'backbone'), ET_BUILDER_VERSION, true);
     wp_localize_script('et_pb_admin_js', 'et_pb_options', array('debug' => true, 'ajaxurl' => admin_url('admin-ajax.php'), 'et_load_nonce' => wp_create_nonce('et_load_nonce'), 'images_uri' => ET_BUILDER_URI . '/images', 'post_type' => $typenow, 'et_builder_module_parent_shortcodes' => ET_Builder_Element::get_parent_shortcodes($typenow), 'et_builder_module_child_shortcodes' => ET_Builder_Element::get_child_shortcodes($typenow), 'et_builder_module_raw_content_shortcodes' => ET_Builder_Element::get_raw_content_shortcodes($typenow), 'et_builder_modules' => ET_Builder_Element::get_modules_js_array($typenow), 'default_initial_column_type' => apply_filters('et_builder_default_initial_column_type', '4_4'), 'default_initial_text_module' => apply_filters('et_builder_default_initial_text_module', 'et_pb_text'), 'section_only_row_dragged_away' => __('The section should have at least one row.', 'et_builder'), 'fullwidth_module_dragged_away' => __('Fullwidth module can\'t be used outside of the Fullwidth Section.', 'et_builder'), 'stop_dropping_3_col_row' => __('3 column row can\'t be used in this column.', 'et_builder'), 'preview_image' => __('Preview', 'et_builder'), 'empty_admin_label' => __('Module', 'et_builder'), 'video_module_image_error' => __('Still images cannot be generated from this video service and/or this video format', 'et_builder'), 'geocode_error' => __('Geocode was not successful for the following reason', 'et_builder'), 'geocode_error_2' => __('Geocoder failed due to', 'et_builder'), 'no_results' => __('No results found', 'et_builder'), 'all_tab_options_hidden' => __('No available options for this configuration.', 'et_builder'), 'update_global_module' => __('You\'re about to update global module. This change will be applied to all pages where you use this module. Press OK if you want to update this module', 'et_builder'), 'global_row_alert' => __('You cannot add global rows into global sections', 'et_builder'), 'global_module_alert' => __('You cannot add global modules into global sections or rows', 'et_builder'), 'all_cat_text' => __('All Categories', 'et_builder'), 'is_global_template' => $is_global_template, 'template_post_id' => $post_id, 'layout_categories' => $layout_cat_data_json));
     wp_enqueue_style('et_pb_admin_css', ET_BUILDER_URI . '/styles/style.css', array(), ET_BUILDER_VERSION);
     wp_enqueue_style('et_pb_admin_date_css', ET_BUILDER_URI . '/styles/jquery-ui-1.10.4.custom.css', array(), ET_BUILDER_VERSION);
 }
    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;
    }
示例#8
0
/**
 * Generates the array of allowed modules in jQuery Array format
 * @return string
 */
function et_pb_allowed_modules_list($role = '')
{
    global $typenow;
    $saved_capabilities = et_pb_get_role_settings();
    $role = '' === $role ? et_pb_get_current_user_role() : $role;
    $all_modules_array = ET_Builder_Element::get_modules_array($typenow);
    $saved_modules_capabilities = array();
    if (!empty($saved_capabilities[$role])) {
        $saved_modules_capabilities = $saved_capabilities[$role];
    }
    // add all the modules into capabilities array if we don't have saved roles for the module yet.
    foreach ($all_modules_array as $module => $module_details) {
        if (!in_array($module_details['label'], array('et_pb_section', 'et_pb_row', 'et_pb_row_inner', 'et_pb_column'))) {
            if (!isset($saved_modules_capabilities[$module_details['label']])) {
                $saved_modules_capabilities[$module_details['label']] = 'on';
            }
        }
    }
    ksort($saved_modules_capabilities);
    $alowed_modules = "[";
    foreach ($saved_modules_capabilities as $capability => $cap_state) {
        if (false !== strpos($capability, 'et_pb_') && 'off' !== $cap_state) {
            $alowed_modules .= "'" . $capability . "',";
        }
    }
    $alowed_modules .= "]";
    return $alowed_modules;
}
示例#9
0
文件: functions.php 项目: smoobs/gft
function et_pb_generate_responsive_css($values_array, $css_selector, $css_property, $function_name, $additional_css = '')
{
    if (!empty($values_array)) {
        foreach ($values_array as $device => $current_value) {
            if ('' === $current_value) {
                continue;
            }
            $declaration = '';
            // value can be provided as a string or array in following format - array( 'property_1' => 'value_1', 'property_2' => 'property_2', ... , 'property_n' => 'value_n' )
            if (is_array($current_value) && !empty($current_value)) {
                foreach ($current_value as $this_property => $this_value) {
                    if ('' === $this_value) {
                        continue;
                    }
                    $declaration .= sprintf('%1$s: %2$s%3$s', $this_property, esc_html(et_builder_process_range_value($this_value)), '' !== $additional_css ? $additional_css : ';');
                }
            } else {
                $declaration = sprintf('%1$s: %2$s%3$s', $css_property, esc_html(et_builder_process_range_value($current_value)), '' !== $additional_css ? $additional_css : ';');
            }
            if ('' === $declaration) {
                continue;
            }
            $style = array('selector' => $css_selector, 'declaration' => $declaration);
            if ('desktop' !== $device) {
                $current_media_query = 'tablet' === $device ? 'max_width_980' : 'max_width_767';
                $style['media_query'] = ET_Builder_Element::get_media_query($current_media_query);
            }
            ET_Builder_Element::set_style($function_name, $style);
        }
    }
}
示例#10
0
    function shortcode_callback($atts, $content = null, $function_name)
    {
        $module_id = $this->shortcode_atts['module_id'];
        $module_class = $this->shortcode_atts['module_class'];
        $fullwidth = $this->shortcode_atts['fullwidth'];
        $posts_number = $this->shortcode_atts['posts_number'];
        $include_categories = $this->shortcode_atts['include_categories'];
        $show_title = $this->shortcode_atts['show_title'];
        $show_categories = $this->shortcode_atts['show_categories'];
        $show_pagination = $this->shortcode_atts['show_pagination'];
        $background_layout = $this->shortcode_atts['background_layout'];
        $zoom_icon_color = $this->shortcode_atts['zoom_icon_color'];
        $hover_overlay_color = $this->shortcode_atts['hover_overlay_color'];
        $hover_icon = $this->shortcode_atts['hover_icon'];
        global $paged;
        $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name);
        if ('' !== $zoom_icon_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_overlay:before', 'declaration' => sprintf('color: %1$s !important;', esc_html($zoom_icon_color))));
        }
        if ('' !== $hover_overlay_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_overlay', 'declaration' => sprintf('background-color: %1$s;', esc_html($hover_overlay_color))));
        }
        $container_is_closed = false;
        $args = array('posts_per_page' => (int) $posts_number, 'post_type' => 'staff');
        $et_paged = is_front_page() ? get_query_var('page') : get_query_var('paged');
        if (is_front_page()) {
            $paged = $et_paged;
        }
        if ('' !== $include_categories) {
            $args['tax_query'] = array(array('taxonomy' => 'project_category', 'field' => 'id', 'terms' => explode(',', $include_categories), 'operator' => 'IN'));
        }
        if (!is_search()) {
            $args['paged'] = $et_paged;
        }
        $main_post_class = sprintf('et_pb_portfolio_item%1$s', 'on' !== $fullwidth ? ' et_pb_grid_item' : '');
        ob_start();
        query_posts($args);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                ?>

				<div id="post-<?php 
                the_ID();
                ?>
" <?php 
                post_class($main_post_class);
                ?>
>

			<?php 
                $thumb = '';
                $width = 'on' === $fullwidth ? 1080 : 400;
                $width = (int) apply_filters('et_pb_portfolio_image_width', $width);
                $height = 'on' === $fullwidth ? 9999 : 284;
                $height = (int) apply_filters('et_pb_portfolio_image_height', $height);
                $classtext = 'on' === $fullwidth ? 'et_pb_post_main_image' : '';
                $titletext = get_the_title();
                $thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Blogimage');
                $thumb = $thumbnail["thumb"];
                if ('' !== $thumb) {
                    ?>
					<a href="<?php 
                    the_permalink();
                    ?>
">
					<?php 
                    if ('on' !== $fullwidth) {
                        ?>
						<span class="et_portfolio_image">
					<?php 
                    }
                    ?>
							<?php 
                    print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height);
                    ?>
					<?php 
                    if ('on' !== $fullwidth) {
                        $data_icon = '' !== $hover_icon ? sprintf(' data-icon="%1$s"', esc_attr(et_pb_process_font_icon($hover_icon))) : '';
                        printf('<span class="et_overlay%1$s"%2$s></span>', '' !== $hover_icon ? ' et_pb_inline_icon' : '', $data_icon);
                        ?>
						</span>
					<?php 
                    }
                    ?>
					</a>
			<?php 
                }
                ?>

				<?php 
                if ('on' === $show_title) {
                    ?>
					<h2><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h2>
					<h3>et_pb_position</h3>
				<?php 
                }
                ?>

				<?php 
                if ('on' === $show_categories) {
                    ?>
					<p class="post-meta"><?php 
                    echo get_the_term_list(get_the_ID(), 'project_category', '', ', ');
                    ?>
</p>
				<?php 
                }
                ?>

				</div> <!-- .et_pb_portfolio_item -->
	<?php 
            }
            if ('on' === $show_pagination && !is_search()) {
                echo '</div> <!-- .et_pb_portfolio -->';
                $container_is_closed = true;
                if (function_exists('wp_pagenavi')) {
                    wp_pagenavi();
                } else {
                    get_template_part('includes/navigation', 'index');
                }
            }
            wp_reset_query();
        } else {
            get_template_part('includes/no-results', 'index');
        }
        $posts = ob_get_contents();
        ob_end_clean();
        $class = " et_pb_module et_pb_bg_layout_{$background_layout}";
        $output = sprintf('<div%5$s class="%1$s%3$s%6$s">
				%2$s
			%4$s', 'on' === $fullwidth ? 'et_pb_portfolio' : 'et_pb_portfolio_grid clearfix', $posts, esc_attr($class), !$container_is_closed ? '</div> <!-- .et_pb_portfolio -->' : '', '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : '', '' !== $module_class ? sprintf(' %1$s', esc_attr($module_class)) : '');
        return $output;
    }
示例#11
0
function et_pb_get_backbone_template()
{
    if (!wp_verify_nonce($_POST['et_admin_load_nonce'], 'et_admin_load_nonce')) {
        die(-1);
    }
    if (!current_user_can('edit_posts')) {
        die(-1);
    }
    $module_slugs = json_decode(str_replace('\\', '', sanitize_text_field($_POST['et_modules_slugs'])));
    $post_type = sanitize_text_field($_POST['et_post_type']);
    // get the portion of templates for specified slugs
    $result = json_encode(ET_Builder_Element::get_modules_templates($post_type, $module_slugs->missing_modules_array));
    die($result);
}
示例#12
0
 function shortcode_callback($atts, $content = null, $function_name)
 {
     $this->shortcode_atts['ad_html'] = $this->shortcode_content;
     $this->shortcode_atts['module_class'] = ET_Builder_Element::add_module_order_class('', $this->slug);
     ET_Builder_Module_Ads::add_child_data($this->shortcode_atts);
 }
示例#13
0
function et_fb_retrieve_builder_data()
{
    if (!isset($_POST['et_fb_helper_nonce']) || !wp_verify_nonce($_POST['et_fb_helper_nonce'], 'et_fb_backend_helper_nonce')) {
        die(-1);
    }
    if (!current_user_can('edit_posts')) {
        die(-1);
    }
    $post_type = !empty($_POST['et_post_type']) ? sanitize_text_field($_POST['et_post_type']) : 'post';
    $post_id = !empty($_POST['et_post_id']) ? sanitize_text_field($_POST['et_post_id']) : '';
    $layout_type = !empty($_POST['et_layout_type']) ? sanitize_text_field($_POST['et_layout_type']) : '';
    $fields_data = array();
    $fields_data['custom_css'] = ET_Builder_Element::get_custom_css_fields($post_type);
    $fields_data['advanced_fields'] = ET_Builder_Element::get_advanced_fields($post_type);
    $fields_data['general_fields'] = ET_Builder_Element::get_general_fields($post_type);
    $post_data = get_post($post_id);
    $post_content = $post_data->post_content;
    switch ($layout_type) {
        case 'module':
            $use_fullwidth_section = false !== strpos($post_content, '[et_pb_fullwidth_') ? true : false;
            if (!$use_fullwidth_section) {
                $post_content = sprintf('[et_pb_row][et_pb_column type="4_4"]%1$s[/et_pb_column][/et_pb_row]', $post_content);
            }
            $post_content = sprintf('[et_pb_section%2$s]%1$s[/et_pb_section]', $post_content, $use_fullwidth_section ? ' fullwidth="on"' : '');
            break;
        case 'row':
            $post_content = '[et_pb_section]' . $post_content . '[/et_pb_section]';
            break;
    }
    $fields_data['shortcode_object'] = et_fb_process_shortcode($post_content);
    die(json_encode($fields_data));
}
    function shortcode_callback($atts, $content = null, $function_name)
    {
        $title = $this->shortcode_atts['title'];
        $module_id = $this->shortcode_atts['module_id'];
        $module_class = $this->shortcode_atts['module_class'];
        $fullwidth = $this->shortcode_atts['fullwidth'];
        $include_categories = $this->shortcode_atts['include_categories'];
        $posts_number = $this->shortcode_atts['posts_number'];
        $show_title = $this->shortcode_atts['show_title'];
        $show_date = $this->shortcode_atts['show_date'];
        $background_layout = $this->shortcode_atts['background_layout'];
        $auto = $this->shortcode_atts['auto'];
        $auto_speed = $this->shortcode_atts['auto_speed'];
        $zoom_icon_color = $this->shortcode_atts['zoom_icon_color'];
        $hover_overlay_color = $this->shortcode_atts['hover_overlay_color'];
        $hover_icon = $this->shortcode_atts['hover_icon'];
        $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name);
        if ('' !== $zoom_icon_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_overlay:before', 'declaration' => sprintf('color: %1$s !important;', esc_html($zoom_icon_color))));
        }
        if ('' !== $hover_overlay_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_overlay', 'declaration' => sprintf('background-color: %1$s;
					border-color: %1$s;', esc_html($hover_overlay_color))));
        }
        $args = array();
        if (is_numeric($posts_number) && $posts_number > 0) {
            $args['posts_per_page'] = $posts_number;
        } else {
            $args['nopaging'] = true;
        }
        if ('' !== $include_categories) {
            $args['tax_query'] = array(array('taxonomy' => 'project_category', 'field' => 'id', 'terms' => explode(',', $include_categories), 'operator' => 'IN'));
        }
        $projects = et_divi_get_projects($args);
        ob_start();
        if ($projects->post_count > 0) {
            while ($projects->have_posts()) {
                $projects->the_post();
                ?>
				<div id="post-<?php 
                the_ID();
                ?>
" <?php 
                post_class('et_pb_portfolio_item et_pb_grid_item ');
                ?>
>
				<?php 
                $thumb = '';
                $width = 320;
                $width = (int) apply_filters('et_pb_portfolio_image_width', $width);
                $height = 241;
                $height = (int) apply_filters('et_pb_portfolio_image_height', $height);
                list($thumb_src, $thumb_width, $thumb_height) = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), array($width, $height));
                $orientation = $thumb_height > $thumb_width ? 'portrait' : 'landscape';
                if ('' !== $thumb_src) {
                    ?>
						<div class="et_pb_portfolio_image <?php 
                    echo esc_attr($orientation);
                    ?>
">
							<a href="<?php 
                    the_permalink();
                    ?>
">
								<img src="<?php 
                    echo esc_attr($thumb_src);
                    ?>
" alt="<?php 
                    echo esc_attr(get_the_title());
                    ?>
"/>
								<div class="meta">
								<?php 
                    $data_icon = '' !== $hover_icon ? sprintf(' data-icon="%1$s"', esc_attr(et_pb_process_font_icon($hover_icon))) : '';
                    printf('<span class="et_overlay%1$s"%2$s>%3$s</span>', '' !== $hover_icon ? ' et_pb_inline_icon' : '', $data_icon, the_excerpt());
                    ?>
									<?php 
                    if ('on' === $show_title) {
                        ?>
										<h3><?php 
                        the_title();
                        ?>
</h3>
									<?php 
                    }
                    ?>

									<?php 
                    if ('on' === $show_date) {
                        ?>
										<p class="post-meta"><?php 
                        echo get_the_date();
                        ?>
</p>
									<?php 
                    }
                    ?>
								</div>
							</a>
						</div>
				<?php 
                }
                ?>
				</div>
				<?php 
            }
        }
        wp_reset_postdata();
        $posts = ob_get_clean();
        $class = " et_pb_module et_pb_bg_layout_{$background_layout}";
        $output = sprintf('<div%4$s class="et_pb_fullwidth_portfolio %1$s%3$s%5$s" data-auto-rotate="%6$s" data-auto-rotate-speed="%7$s">
				%8$s
				<div class="et_pb_portfolio_items clearfix" data-portfolio-columns="">
					%2$s
				</div><!-- .et_pb_portfolio_items -->
			</div> <!-- .et_pb_fullwidth_portfolio -->', 'on' === $fullwidth ? 'et_pb_fullwidth_portfolio_carousel' : 'et_pb_fullwidth_portfolio_grid clearfix', $posts, esc_attr($class), '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : '', '' !== $module_class ? sprintf(' %1$s', esc_attr($module_class)) : '', '' !== $auto && in_array($auto, array('on', 'off')) ? esc_attr($auto) : 'off', '' !== $auto_speed && is_numeric($auto_speed) ? esc_attr($auto_speed) : '7000', '' !== $title ? sprintf('<h2>%s</h2>', esc_html($title)) : '');
        return $output;
    }
示例#15
-1
    function shortcode_callback($atts, $content = null, $function_name)
    {
        $module_id = $this->shortcode_atts['module_id'];
        $module_class = $this->shortcode_atts['module_class'];
        $title = $this->shortcode_atts['title'];
        $meta = $this->shortcode_atts['meta'];
        $author = $this->shortcode_atts['author'];
        $date = $this->shortcode_atts['date'];
        $date_format = $this->shortcode_atts['date_format'];
        $categories = $this->shortcode_atts['categories'];
        $comments = $this->shortcode_atts['comments'];
        $featured_image = $this->shortcode_atts['featured_image'];
        $featured_placement = $this->shortcode_atts['featured_placement'];
        $parallax_effect = $this->shortcode_atts['parallax_effect'];
        $parallax_method = $this->shortcode_atts['parallax_method'];
        $text_orientation = $this->shortcode_atts['text_orientation'];
        $text_color = $this->shortcode_atts['text_color'];
        $text_background = $this->shortcode_atts['text_background'];
        $text_bg_color = $this->shortcode_atts['text_bg_color'];
        $module_bg_color = $this->shortcode_atts['module_bg_color'];
        // display the shortcode only on singlular pages
        if (!is_singular()) {
            return;
        }
        $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name);
        $output = '';
        $featured_image_output = '';
        $parallax_background_contaier = '';
        if ('on' === $featured_image && ('above' === $featured_placement || 'below' === $featured_placement)) {
            $featured_image_output = sprintf('<div class="et_pb_title_featured_container">%1$s</div>', get_the_post_thumbnail(get_the_ID(), 'large'));
        }
        if ('on' === $title) {
            if (is_et_pb_preview() && isset($_POST['post_title']) && wp_verify_nonce($_POST['et_pb_preview_nonce'], 'et_pb_preview_nonce')) {
                $post_title = sanitize_text_field(wp_unslash($_POST['post_title']));
            } else {
                $post_title = get_the_title();
            }
            $output .= sprintf('<h1>%s</h1>', $post_title);
        }
        if ('on' === $meta) {
            $meta_array = array();
            foreach (array('author', 'date', 'categories', 'comments') as $single_meta) {
                if ('on' === ${$single_meta} && ('categories' !== $single_meta || 'categories' === $single_meta && is_singular('post'))) {
                    $meta_array[] = $single_meta;
                }
            }
            $output .= sprintf('<p class="et_pb_title_meta_container">%1$s</p>', et_pb_postinfo_meta($meta_array, $date_format, esc_html__('0 comments', 'et_builder'), esc_html__('1 comment', 'et_builder'), '% ' . esc_html__('comments', 'et_builder')));
        }
        if ('on' === $featured_image && 'background' === $featured_placement) {
            $featured_image_src = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
            ET_Builder_Element::set_style($function_name, array('selector' => sprintf('%%order_class%% %1$s', 'on' === $parallax_effect ? '.et_parallax_bg' : ''), 'declaration' => sprintf('background-image: url("%1$s");', esc_url($featured_image_src[0]))));
            if ('on' === $parallax_effect) {
                $parallax_background_contaier = sprintf('<div class="et_parallax_bg%1$s"></div>', 'on' === $parallax_method ? ' et_pb_parallax_css' : '');
            }
        }
        if ('on' === $text_background) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_pb_title_container', 'declaration' => sprintf('background-color: %1$s; padding: 1em 1.5em;', esc_html($text_bg_color))));
        }
        ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%', 'declaration' => sprintf('text-align: %1$s;', esc_html($text_orientation))));
        $background_layout = 'dark' === $text_color ? 'light' : 'dark';
        $module_class .= ' et_pb_bg_layout_' . $background_layout;
        $module_class .= 'above' === $featured_placement ? ' et_pb_image_above' : '';
        $module_class .= 'below' === $featured_placement ? ' et_pb_image_below' : '';
        ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%', 'declaration' => sprintf('background-color: %1$s;', esc_html($module_bg_color))));
        $output = sprintf('<div%3$s class="et_pb_module et_pb_post_title %2$s%4$s">
				%5$s
				%6$s
				<div class="et_pb_title_container">
					%1$s
				</div>
				%7$s
			</div>', $output, '' !== $module_class ? sprintf(' %1$s', esc_attr($module_class)) : '', '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : '', 'on' === $featured_image && 'background' === $featured_placement ? ' et_pb_featured_bg' : '', $parallax_background_contaier, 'on' === $featured_image && 'above' === $featured_placement ? $featured_image_output : '', 'on' === $featured_image && 'below' === $featured_placement ? $featured_image_output : '');
        return $output;
    }