function processShortcodeCounterListItem($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $Validation = new PBValidation();
        if ($Validation->isEmpty($attribute['name'])) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['value'], 0, 99999, false)) {
            return $html;
        }
        $lineCharacterAfter = null;
        $lineCharacterBefore = null;
        if ($Validation->isNotEmpty($this->character['before'])) {
            $lineCharacterBefore = '<span' . PBHelper::createClassAttribute(array('pb-counter-list-value-character-before')) . '>' . esc_html($this->character['before']) . '</span>';
        }
        if ($Validation->isNotEmpty($this->character['after'])) {
            $lineCharacterAfter = '<span' . PBHelper::createClassAttribute(array('pb-counter-list-value-character-after')) . '>' . esc_html($this->character['after']) . '</span>';
        }
        $html = '
			<li class="pb-value-' . (int) $attribute['value'] . '">
				<span class="pb-counter-list-label">' . esc_html($attribute['name']) . '</span>
				<span class="pb-counter-list-value">
					' . $lineCharacterBefore . '
					<span class="pb-counter-list-value-value">' . (int) $attribute['value'] . '</span>
					' . $lineCharacterAfter . '
				</span>
				<span class="pb-counter-list-foreground"></span>
				<span class="pb-counter-list-background"></span>
			</li>
		';
        return PBHelper::formatHTML($html);
    }
    function processShortcodeAccordion($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $Easing = new PBEasing();
        $Validation = new PBValidation();
        if (!$Validation->isNumber($attribute['active'], 0, 999)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['disabled'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['collapsible'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['close_at_start'])) {
            return $html;
        }
        if (!array_key_exists($attribute['height_style'], $this->heightStyle)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['animation_enable'])) {
            return $html;
        }
        if (!$Validation->isNotEmpty($attribute['animation_duration'], 0, 99999)) {
            return $html;
        }
        if (!array_key_exists($attribute['animation_easing'], $Easing->easingType)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['header_font_size'], 0, 100)) {
            return $html;
        }
        $key = array('active', 'disabled', 'collapsible', 'height_style', 'close_at_start', 'animation_enable', 'animation_duration', 'animation_easing');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        $option['header_important_default'] = PBComponentData::get($this->getComponentId(), 'header_important_default');
        $id = PBHelper::createId('pb_accordion');
        $class = array('pb-accordion', 'pb-clear-fix', $attribute['css_class']);
        PBComponentData::set('accordion', 'header_font_size', $attribute['header_font_size'], true);
        $html = '
			<div' . PBHelper::createClassAttribute($class) . ' id="' . esc_attr($id) . '">
				' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$("#' . $id . '").PBAccordion(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
    }
    function processShortcodeSitemap($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $Validation = new PBValidation();
        $argument = array();
        if ($Validation->isNotEmpty($attribute['post_type'])) {
            $argument['post_type'] = explode(',', $attribute['post_type']);
        }
        if ($Validation->isNotEmpty($attribute['post_status'])) {
            $argument['post_status'] = explode(',', $attribute['post_status']);
        }
        if ($Validation->isNotEmpty($attribute['post__in'])) {
            $argument['post__in'] = explode(',', $attribute['post__in']);
        }
        if ($Validation->isNotEmpty($attribute['post__not_in'])) {
            $argument['post__not_in'] = explode(',', $attribute['post__not_in']);
        }
        if ($Validation->isNotEmpty($attribute['posts_per_page'])) {
            $argument['posts_per_page'] = $attribute['posts_per_page'] == -2 ? -1 : $attribute['posts_per_page'];
        }
        if ($Validation->isNotEmpty($attribute['orderby'])) {
            $argument['orderby'] = $attribute['orderby'];
        }
        if ($Validation->isNotEmpty($attribute['order'])) {
            $argument['order'] = $attribute['order'];
        }
        $query = new WP_Query($argument);
        if ($query === false) {
            return $html;
        }
        if ($query->post_count == 0) {
            return $html;
        }
        $class = array(array('pb-sitemap'), array('pb-reset-list'));
        if (array_key_exists($attribute['bullet'], $this->bullet['file'])) {
            array_push($class[0], 'pb-sitemap-bullet-list', 'pb-sitemap-bullet-list-' . PBHelper::createHash($attribute['bullet']));
        }
        global $post;
        $bPost = $post;
        while ($query->have_posts()) {
            $query->the_post();
            $html .= '
				<li id="post-' . get_the_ID() . '" class="' . implode(' ', get_post_class()) . '">
					<a href="' . get_the_permalink() . '">' . get_the_title() . '</a>
				</li>
			';
        }
        $post = $bPost;
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . '>
				<ul' . PBHelper::createClassAttribute($class[1]) . '>' . $html . '</ul>
			</div>
		';
        return PBHelper::formatHTML($html);
    }
 function processShortcodeList($attribute, $content, $tag)
 {
     $attribute = $this->processAttribute($tag, $attribute);
     $Validation = new PBValidation();
     $classBullet = null;
     if ($Validation->isNotEmpty($attribute['bullet'])) {
         $classBullet = 'pb-list-' . PBHelper::createHash($attribute['bullet']);
     }
     $class = array('pb-list', $classBullet, $attribute['css_class']);
     $html = '<div' . PBHelper::createClassAttribute($class) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</div>';
     return PBHelper::formatHTML($html, $content);
 }
    function processShortcodeList($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $Validation = new PBValidation();
        if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'gr') {
            $classBullet = null;
            if ($Validation->isNotEmpty($attribute['bullet'])) {
                $classBullet = 'pb-list-icon-name-' . PBHelper::createHash($attribute['bullet']);
            }
            $class = array('pb-list', 'pb-list-icon-type-gr', $classBullet, $attribute['css_class']);
        } else {
            $class = array('pb-list', 'pb-list-icon-type-fa', $attribute['css_class']);
        }
        $id = PBHelper::createId('pb_list');
        $html = '<div' . PBHelper::createClassAttribute($class) . ' id="' . esc_attr($id) . '">' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</div>';
        if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'fa' && $Validation->isNotEmpty($attribute['font_icon_name'])) {
            $option = array();
            $option['icon_type'] = 'fa';
            if ($Validation->isNotEmpty($attribute['font_icon_name'])) {
                $option['font_icon_name'] = $attribute['font_icon_name'];
            }
            if ($Validation->isColor($attribute['font_icon_color'])) {
                $option['font_icon_color'] = $attribute['font_icon_color'];
            }
            if ($Validation->isNumber($attribute['font_icon_size'], 1, 200)) {
                $option['font_icon_size'] = $attribute['font_icon_size'];
            }
            $html .= '
				<div class="pb-script-tag">
					<script type="text/javascript">
						jQuery(document).ready(function($)
						{
							$(\'#' . $id . '\').PBList(' . json_encode($option) . ');
						});
					</script>
				</div>
			';
        }
        return PBHelper::formatHTML($html, $content);
    }
Esempio n. 6
0
    function processShortcodeClassItem($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $Layout = new PBLayout();
        $Background = new PBBackground();
        $Validation = new PBValidation();
        if ($Validation->isEmpty($content)) {
            return $html;
        }
        $class = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($this->currentLayout, $this->currentIndex));
        $style = array();
        if ($Validation->isNotEmpty($attribute['image_url'])) {
            $style['background-image'] = 'url(\'' . $attribute['image_url'] . '\')';
        }
        if ($Validation->isNotEmpty($attribute['image_position'])) {
            $style['background-position'] = $attribute['image_position'];
        }
        if (array_key_exists($attribute['image_repeat'], $Background->backgroundRepeat)) {
            $style['background-repeat'] = $attribute['image_repeat'];
        }
        if (array_key_exists($attribute['image_size_a'], $Background->backgroundSize)) {
            if (in_array($attribute['image_size_a'], array('length', 'percentage'))) {
                if ($Validation->isNotEmpty($attribute['image_size_b'])) {
                    $style['background-size'] = $attribute['image_size_b'];
                }
            } else {
                $style['background-size'] = $attribute['image_size_a'];
            }
        }
        $html = '
			<li' . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '>
				<div>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</div>
			</li>
		';
        $this->currentIndex++;
        return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
    }
    function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
    {
        $this->iconClass = null;
        $Validation = new PBValidation();
        if ($depth == 0) {
            $this->icon = $object->icon;
            $this->mega_menu_layout_column_index = 0;
            $this->mega_menu_enable = $object->mega_menu_enable;
            $this->mega_menu_layout = $object->mega_menu_layout;
            if ($object->icon != '-1') {
                $this->iconClass = 'pb-menu-icon pb-menu-icon-' . PBHelper::createHash($object->icon);
            }
        }
        $linkClass = array();
        if ($Validation->isNotEmpty($object->target)) {
            array_push($linkClass, 'pb-window-target-blank');
        }
        if ($this->mega_menu_enable == 1) {
            if ($depth == 0 || $depth == 2) {
                $output .= '<li class="' . join(' ', (array) $object->classes) . ($depth == 0 ? ' sf-mega-enable-1' : null) . ' ' . $this->iconClass . ' ' . '">';
            }
            if ($depth == 1) {
                $Layout = new PBLayout();
                $class = array('sf-mega-section', 'pb-layout-' . $Layout->getLayoutColumnCSSClass($this->mega_menu_layout, $this->mega_menu_layout_column_index));
                $output .= '
					<div' . PBHelper::createClassAttribute($class) . '>
				';
                $this->mega_menu_layout_column_index++;
            }
            if ($depth == 1) {
                $output .= '
					<span class="sf-mega-header">' . esc_html($object->title) . '</span>
				';
            } else {
                $output .= '
					<a href="' . esc_attr($object->url) . '"' . PBHelper::createClassAttribute($linkClass) . '><span></span>' . $object->title . '</a>
				';
            }
        } else {
            $output .= '
				<li class="' . join(' ', (array) $object->classes) . ($depth == 0 ? ' sf-mega-enable-0' : null) . ' ' . $this->iconClass . ' ' . '">
					<a href="' . esc_attr($object->url) . '"' . PBHelper::createClassAttribute($linkClass) . '><span></span>' . $object->title . '</a>
			';
        }
    }
 function processShortcodeHeader($attribute, $content, $tag)
 {
     $attribute = $this->processAttribute($tag, $attribute);
     $html = null;
     $style = array();
     $Font = new PBFont();
     $Header = new PBHeader();
     $Validation = new PBValidation();
     if ($Validation->isEmpty($content)) {
         return $html;
     }
     if (!array_key_exists($attribute['important'], $Header->important)) {
         return $html;
     }
     if (!$Validation->isBool($attribute['underline_enable'])) {
         return $html;
     }
     if ($Validation->isNumber($attribute['font_size'], 1, 200, true)) {
         $style['font-size'] = $attribute['font_size'] . 'px';
     }
     if (array_key_exists($attribute['font_weight'], $Font->weight)) {
         $style['font-weight'] = $attribute['font_weight'];
     }
     if (array_key_exists($attribute['font_style'], $Font->style)) {
         $style['font-style'] = $attribute['font_style'];
     }
     if ($Validation->isColor($attribute['font_color'])) {
         $style['color'] = PBColor::getColor($attribute['font_color']);
     }
     if ($Validation->isColor($attribute['background_color'])) {
         $style['background-color'] = PBColor::getColor($attribute['background_color']);
     }
     if ($Validation->isNotEmpty($attribute['line_height'])) {
         $style['line-height'] = $attribute['line_height'];
     }
     if ($Validation->isNumber($attribute['text_indent'], 0, 999)) {
         $style['text-indent'] = $attribute['text_indent'] . 'px';
     }
     $class = array(array('pb-header', $attribute['css_class']), array('pb-header-content'), array('pb-header-underline'));
     $html = '<h' . (int) $attribute['important'] . PBHelper::createClassAttribute($class[0]) . PBHelper::createStyleAttribute($style) . '><span' . PBHelper::createClassAttribute($class[1]) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</span>' . ($attribute['underline_enable'] == 1 ? '<span' . PBHelper::createClassAttribute($class[2]) . '></span>' : null) . '</h' . (int) $attribute['important'] . '>';
     return PBHelper::formatHTML($html, $content);
 }
    function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
    {
        $level = null;
        $Validation = new PBValidation();
        for ($i = 0; $i < $depth; $i++) {
            $level .= '--';
        }
        if (!is_null($level)) {
            $level .= ' ';
        }
        $linkClass = array();
        if ($Validation->isNotEmpty($object->target)) {
            array_push($linkClass, 'pb-window-target-blank');
        }
        $output .= '
			<li class="' . join(' ', (array) $object->classes) . '">
				<a href="' . esc_attr($object->url) . '"' . PBHelper::createClassAttribute($linkClass) . '>' . $level . $object->title . '</a>
			</li>
		';
    }
    function processShortcodeBlockquote($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $Validation = new PBValidation();
        if ($Validation->isEmpty($content)) {
            return $html;
        }
        $class = array('pb-blockquote', $attribute['css_class']);
        if ($Validation->isNotEmpty($attribute['author'])) {
            $html = '<div class="pb-blockquote-author">&mdash; ' . $attribute['author'] . '</div>';
        }
        $html = '
			<div' . PBHelper::createClassAttribute($class) . '>
				<blockquote>
					' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
				</blockquote>
				' . $html . '
			</div>
		';
        return PBHelper::formatHTML($html, PBHelper::formatContent($content));
    }
    function processShortcodeBox($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $option = array();
        $style = array(array(), array());
        $Border = new PBBorder();
        $Validation = new PBValidation();
        /***/
        if (!$Validation->isBool($attribute['icon_enable'])) {
            return $html;
        }
        if (!array_key_exists($attribute['icon_size'], $this->icon)) {
            return $html;
        }
        if (!array_key_exists($attribute['icon_position'], $this->iconPosition)) {
            return $html;
        }
        /***/
        if ($Validation->isColor($attribute['background_color'])) {
            $style[0]['background-color'] = PBColor::getColor($attribute['background_color']);
        }
        if (array_key_exists($attribute['border_top_style'], $Border->style)) {
            $style[0]['border-top-style'] = $attribute['border_top_style'];
        }
        if ($Validation->isNumber($attribute['border_top_width'], 0, 999)) {
            $style[0]['border-top-width'] = $attribute['border_top_width'] . 'px';
        }
        if ($Validation->isColor($attribute['border_top_color'])) {
            $style[0]['border-top-color'] = PBColor::getColor($attribute['border_top_color']);
        }
        if ($Validation->isNumber($attribute['border_top_radius'], 0, 999)) {
            $style[0]['-webkit-border-top-left-radius'] = $attribute['border_top_radius'] . 'px';
            $style[0]['-moz-border-radius-topleft'] = $attribute['border_top_radius'] . 'px';
            $style[0]['border-top-left-radius'] = $attribute['border_top_radius'] . 'px';
        }
        if (array_key_exists($attribute['border_right_style'], $Border->style)) {
            $style[0]['border-right-style'] = $attribute['border_right_style'];
        }
        if ($Validation->isNumber($attribute['border_right_width'], 0, 999)) {
            $style[0]['border-right-width'] = $attribute['border_right_width'] . 'px';
        }
        if ($Validation->isColor($attribute['border_right_color'])) {
            $style[0]['border-right-color'] = PBColor::getColor($attribute['border_right_color']);
        }
        if ($Validation->isNumber($attribute['border_right_radius'], 0, 999)) {
            $style[0]['-webkit-border-top-right-radius'] = $attribute['border_right_radius'] . 'px';
            $style[0]['-moz-border-radius-topright'] = $attribute['border_right_radius'] . 'px';
            $style[0]['border-top-right-radius'] = $attribute['border_right_radius'] . 'px';
        }
        if (array_key_exists($attribute['border_bottom_style'], $Border->style)) {
            $style[0]['border-bottom-style'] = $attribute['border_bottom_style'];
        }
        if ($Validation->isNumber($attribute['border_bottom_width'], 0, 999)) {
            $style[0]['border-bottom-width'] = $attribute['border_bottom_width'] . 'px';
        }
        if ($Validation->isColor($attribute['border_bottom_color'])) {
            $style[0]['border-bottom-color'] = PBColor::getColor($attribute['border_bottom_color']);
        }
        if ($Validation->isNumber($attribute['border_bottom_radius'], 0, 999)) {
            $style[0]['-webkit-border-bottom-right-radius'] = $attribute['border_bottom_radius'] . 'px';
            $style[0]['-moz-border-radius-bottomright'] = $attribute['border_bottom_radius'] . 'px';
            $style[0]['border-bottom-right-radius'] = $attribute['border_bottom_radius'] . 'px';
        }
        if (array_key_exists($attribute['border_left_style'], $Border->style)) {
            $style[0]['border-left-style'] = $attribute['border_left_style'];
        }
        if ($Validation->isNumber($attribute['border_left_width'], 0, 999)) {
            $style[0]['border-left-width'] = $attribute['border_left_width'] . 'px';
        }
        if ($Validation->isColor($attribute['border_left_color'])) {
            $style[0]['border-left-color'] = PBColor::getColor($attribute['border_left_color']);
        }
        if ($Validation->isNumber($attribute['border_left_radius'], 0, 999)) {
            $style[0]['-webkit-border-bottom-left-radius'] = $attribute['border_left_radius'] . 'px';
            $style[0]['-moz-border-radius-bottomleft'] = $attribute['border_left_radius'] . 'px';
            $style[0]['border-bottom-left-radius'] = $attribute['border_left_radius'] . 'px';
        }
        if ($Validation->isNumber($attribute['padding_top'], 0, 999)) {
            $style[0]['padding-top'] = $attribute['padding_top'] . 'px';
        }
        if ($Validation->isNumber($attribute['padding_right'], 0, 999)) {
            $style[0]['padding-right'] = $attribute['padding_right'] . 'px';
        }
        if ($Validation->isNumber($attribute['padding_bottom'], 0, 999)) {
            $style[0]['padding-bottom'] = $attribute['padding_bottom'] . 'px';
        }
        if ($Validation->isNumber($attribute['padding_left'], 0, 999)) {
            $style[0]['padding-left'] = $attribute['padding_left'] . 'px';
        }
        if ($Validation->isColor($attribute['text_color_link'])) {
            $option['out']['color'] = PBColor::getColor($attribute['text_color_link']);
        }
        if ($Validation->isColor($attribute['text_color_link_hover'])) {
            $option['in']['color'] = PBColor::getColor($attribute['text_color_link_hover']);
        }
        $id = PBHelper::createId('pb_box');
        $class[0] = array('pb-box', 'pb-clear-fix', $attribute['css_class']);
        if ($attribute['icon_enable'] == 1) {
            array_push($class[0], 'pb-box-icon');
            array_push($class[0], 'pb-box-icon-size-' . $attribute['icon_size']);
            array_push($class[0], 'pb-box-icon-position-' . $attribute['icon_position']);
            array_push($class[0], 'pb-box-icon-' . PBHelper::createHash($attribute['icon']));
            if ($Validation->isNotEmpty($attribute['icon_background_position'])) {
                $style[1]['background-position'] = $attribute['icon_background_position'];
            }
        }
        $class[1] = array('pb-box-inner');
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . PBHelper::createStyleAttribute($style[0]) . ' id="' . $id . '">
				<div' . PBHelper::createClassAttribute($class[1]) . PBHelper::createStyleAttribute($style[1]) . '>
				' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
				</div>
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($) 
					{
						$(\'#' . $id . '\').PBBox(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
    }
    function processShortcodeSitemap($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $Validation = new PBValidation();
        $argument = array();
        if ($Validation->isNotEmpty($attribute['post_type'])) {
            $argument['post_type'] = explode(',', $attribute['post_type']);
        }
        if ($Validation->isNotEmpty($attribute['post_status'])) {
            $argument['post_status'] = explode(',', $attribute['post_status']);
        }
        if ($Validation->isNotEmpty($attribute['post__in'])) {
            $argument['post__in'] = explode(',', $attribute['post__in']);
        }
        if ($Validation->isNotEmpty($attribute['post__not_in'])) {
            $argument['post__not_in'] = explode(',', $attribute['post__not_in']);
        }
        if ($Validation->isNotEmpty($attribute['posts_per_page'])) {
            $argument['posts_per_page'] = $attribute['posts_per_page'] == -2 ? -1 : $attribute['posts_per_page'];
        }
        if ($Validation->isNotEmpty($attribute['orderby'])) {
            $argument['orderby'] = $attribute['orderby'];
        }
        if ($Validation->isNotEmpty($attribute['order'])) {
            $argument['order'] = $attribute['order'];
        }
        $query = new WP_Query($argument);
        if ($query === false) {
            return $html;
        }
        if ($query->post_count == 0) {
            return $html;
        }
        $class = array(array('pb-sitemap'), array('pb-reset-list'));
        if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'gr') {
            if (array_key_exists($attribute['bullet'], $this->bullet['file'])) {
                array_push($class[0], 'pb-sitemap-icon-type-gr', 'pb-sitemap-icon-name-' . PBHelper::createHash($attribute['bullet']));
            }
        }
        $iconHTML = null;
        if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'fa') {
            if ($Validation->isNotEmpty($attribute['font_icon_name'])) {
                $style = array();
                if ($Validation->isColor($attribute['font_icon_color'])) {
                    $style['color'] = PBColor::getColor($attribute['font_icon_color']);
                }
                if ($Validation->isNumber($attribute['font_icon_size'], 1, 200)) {
                    $style['font-size'] = $attribute['font_icon_size'] . 'px';
                }
                array_push($class[0], 'pb-sitemap-icon-type-fa');
                $iconHTML = '<i class="fa fa-' . esc_attr($attribute['font_icon_name']) . '"' . PBHelper::createStyleAttribute($style) . '></i>';
            }
        }
        global $post;
        $bPost = $post;
        while ($query->have_posts()) {
            $query->the_post();
            $html .= '
				<li id="post-' . get_the_ID() . '" class="' . implode(' ', get_post_class()) . '">
					' . $iconHTML . '
					<a href="' . get_the_permalink() . '">' . preg_replace('/\\<br\\/\\>/', ' ', get_the_title()) . '</a>
				</li>
			';
        }
        $post = $bPost;
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . '>
				<ul' . PBHelper::createClassAttribute($class[1]) . '>' . $html . '</ul>
			</div>
		';
        return PBHelper::formatHTML($html);
    }
    function processShortcodeSocialIcon($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $style = array();
        $social = array();
        $Window = new PBWindow();
        $Validation = new PBValidation();
        if (!array_key_exists($attribute['target'], $Window->linkTarget)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['native_color_enable'])) {
            return $html;
        }
        foreach ($this->social as $index => $value) {
            $url = 'profile_' . $index . '_url';
            $order = 'profile_' . $index . '_order';
            PBHelper::removeUIndex($attribute, $url, $order);
            if (!$Validation->isURL($attribute[$url])) {
                continue;
            }
            $orderValue = (int) $attribute[$order];
            $socialData = array('id' => $index, 'url' => $attribute[$url], 'name' => $value[1]);
            if ($Validation->isNumber($attribute[$order], 0, 99)) {
                if (isset($social[$orderValue])) {
                    array_push($social, $socialData);
                } else {
                    $social[$orderValue] = $socialData;
                }
            } else {
                array_push($social, $socialData);
            }
        }
        ksort($social);
        if (!count($social)) {
            return;
        }
        $option = array('in' => array(), 'out' => array());
        if ($Validation->isNumber($attribute['width'], 0, 999)) {
            $style['width'] = $attribute['width'] . 'px';
        }
        if ($Validation->isNumber($attribute['height'], 0, 999)) {
            $style['height'] = $attribute['height'] . 'px';
        }
        if (PBComponentData::get($this->getComponentId(), 'icon_type') !== 'gr') {
            if ($Validation->isNumber($attribute['font_icon_size'], 1, 200)) {
                $style['font-size'] = $attribute['font_icon_size'] . 'px';
            }
        }
        $borderRadius = null;
        if ($Validation->isNumber($attribute['border_radius_top_left'], 0, 999)) {
            $borderRadius .= ' ' . $attribute['border_radius_top_left'] . 'px';
        }
        if ($Validation->isNumber($attribute['border_radius_top_right'], 0, 999)) {
            $borderRadius .= ' ' . $attribute['border_radius_top_right'] . 'px';
        }
        if ($Validation->isNumber($attribute['border_radius_bottom_right'], 0, 999)) {
            $borderRadius .= ' ' . $attribute['border_radius_bottom_right'] . 'px';
        }
        if ($Validation->isNumber($attribute['border_radius_bottom_left'], 0, 999)) {
            $borderRadius .= ' ' . $attribute['border_radius_bottom_left'] . 'px';
        }
        if ($Validation->isNotEmpty($borderRadius)) {
            $borderRadius = trim($borderRadius);
            $style['-webkit-border-radius'] = $borderRadius;
            $style['-moz-border-radius'] = $borderRadius;
            $style['border-radius'] = $borderRadius;
        }
        if ($Validation->isNumber($attribute['border_width'], 0, 999)) {
            $style['border-style'] = 'solid';
            $style['border-width'] = $attribute['border_width'] . 'px';
            $option['out']['border-width'] = $style['border-width'];
            $option['out']['border-style'] = 'solid';
        }
        if ($Validation->isColor($attribute['bg_color'])) {
            $style['background-color'] = PBColor::getColor($attribute['bg_color']);
            $option['out']['background-color'] = $style['background-color'];
        }
        if (PBComponentData::get($this->getComponentId(), 'icon_type') == 'fa') {
            if ($Validation->isColor($attribute['icon_color'])) {
                $style['color'] = PBColor::getColor($attribute['icon_color']);
                $option['out']['color'] = $style['color'];
            }
        }
        if ($Validation->isColor($attribute['border_color'])) {
            $style['border-color'] = PBColor::getColor($attribute['border_color']);
            $option['out']['border-color'] = $style['border-color'];
        }
        if ($Validation->isNumber($attribute['border_width_hover'], 0, 999)) {
            $option['in']['border-width'] = $attribute['border_width_hover'] . 'px';
            $option['in']['border-style'] = 'solid';
        }
        if ($Validation->isColor($attribute['bg_color_hover'])) {
            $option['in']['background-color'] = PBColor::getColor($attribute['bg_color_hover']);
        }
        if (PBComponentData::get($this->getComponentId(), 'icon_type') == 'fa') {
            if ($Validation->isColor($attribute['font_icon_color_hover'])) {
                $option['in']['color'] = PBColor::getColor($attribute['font_icon_color_hover']);
            }
        }
        if ($Validation->isColor($attribute['border_color_hover'])) {
            $option['in']['border-color'] = PBColor::getColor($attribute['border_color_hover']);
        }
        foreach ($social as $index => $value) {
            $class = array('pb-social-icon-' . $value['id']);
            $iconHTML = null;
            if (PBComponentData::get($this->getComponentId(), 'icon_type') == 'fa') {
                $iconHTML = '<i class="fa fa-' . esc_html($value['name']) . '"></i>';
            }
            array_push($class, $Window->getTargetCSSClass($attribute['target']));
            $html .= '
				<li><a href="' . esc_attr($value['url']) . '"' . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style) . '>' . $iconHTML . '</a></li>
			';
        }
        $id = PBHelper::createId('pb_social_icon');
        $class = array('pb-social-icon');
        if ($attribute['native_color_enable'] == 1) {
            array_push($class, 'pb-social-icon-color-native');
        }
        if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'gr') {
            array_push($class, 'pb-social-icon-type-gr');
        } elseif (PBComponentData::get($this->getComponentId(), 'icon_type') === 'fa') {
            array_push($class, 'pb-social-icon-type-fa');
        }
        array_push($class, 'pb-reset-list', 'pb-clear-fix', $attribute['css_class']);
        $html = '
			<ul' . PBHelper::createClassAttribute($class) . ' id="' . esc_attr($id) . '">
				' . $html . '
			</ul>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$(\'#' . $id . '\').PBSocialIcon(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html);
    }
Esempio n. 14
0
    function processShortcodeTeam($attribute, $content, $tag)
    {
        $html = null;
        $teamHTML = null;
        $option = array();
        $attribute = $this->processAttribute($tag, $attribute);
        $Window = new PBWindow();
        $Easing = new PBEasing();
        $Layout = new PBLayout();
        $Validation = new PBValidation();
        $ImageHover = new PBImageHover();
        $data = $this->getTeam($attribute);
        if ($data === false) {
            return;
        }
        if (!count($data->posts)) {
            return;
        }
        if (!array_key_exists($attribute['template'], $this->template)) {
            return $html;
        }
        if (!array_key_exists($attribute['layout'], $this->layout)) {
            return $html;
        }
        if (!PBFile::isWPImage($attribute['image_size'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['hover_enable'])) {
            return $html;
        }
        if (!array_key_exists($attribute['hover_type'], $ImageHover->type)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['preloader_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['skill_list_waypoint_enable'])) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['skill_list_waypoint_duration'], 0, 99999)) {
            return $html;
        }
        if (!array_key_exists($attribute['skill_list_waypoint_easing'], $Easing->easingType)) {
            return $html;
        }
        $key = array('hover_type', 'hover_enable', 'preloader_enable', 'skill_list_waypoint_enable', 'skill_list_waypoint_easing', 'skill_list_waypoint_duration', 'skill_list_waypoint_offset_trigger');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        $layoutCurrent = '100';
        if ($attribute['template'] == 2) {
            $layoutCurrent = '50x50';
        } elseif ($attribute['template'] == 3) {
            $layoutCurrent = $attribute['layout'];
        }
        global $post;
        $bPost = $post;
        $i = 0;
        while ($data->have_posts()) {
            global $post;
            $data->the_post();
            $full = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), $attribute['image_size']);
            if ($full == false || $thumbnail == false) {
                continue;
            }
            $meta = PBMeta::get($post);
            PBHelper::removeUIndex($meta, 'team_social', 'team_skill');
            /***/
            $class = array(array(), array());
            $class[0] = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($layoutCurrent, $i));
            $class[1] = array('pb-image-box', 'pb-image-preloader-animation-enable');
            $class[2] = array('pb-image');
            if ($attribute['preloader_enable'] == 1) {
                array_push($class[1], 'pb-image-preloader');
            }
            if ($attribute['hover_enable'] == 1) {
                array_push($class[1], 'pb-image-hover', 'pb-image-hover-type-' . $attribute['hover_type'], 'pb-image-type-image');
            }
            /***/
            $textHTML = null;
            if ($Validation->isNotEmpty($meta['team_first_name']) || $Validation->isNotEmpty($meta['team_second_name'])) {
                $textHTML .= '<h3 class="pb-team-text-box-member-name">' . trim($meta['team_first_name'] . ' ' . $meta['team_second_name']) . '</h3>';
            }
            if ($Validation->isNotEmpty($meta['team_position'])) {
                $textHTML .= '<div class="pb-team-text-box-member-position">' . $meta['team_position'] . '</div>';
            }
            /***/
            $socialHTML = null;
            if (is_array($meta['team_social'])) {
                $social = PBHelper::orderArrayByElement($meta['team_social'], 'team_social_order');
                foreach ($social as $index => $value) {
                    if (!array_key_exists($value['team_social_name'], $this->social)) {
                        continue;
                    }
                    $socialHTML .= '
						<li>
							<a href="' . esc_attr($value['team_social_url']) . '" class="pb-team-social-icon-' . $value['team_social_name'] . ' ' . $Window->getTargetCSSClass('_blank') . '"></a>
						</li>
					';
                }
                if ($Validation->isNotEmpty($socialHTML)) {
                    $socialHTML = '
						<ul class="pb-team-social-icon-box pb-reset-list pb-clear-fix">
							' . $socialHTML . '
						</ul>
					';
                }
            }
            /***/
            $skillHTML = null;
            if (is_array($meta['team_skill'])) {
                $skill = PBHelper::orderArrayByElement($meta['team_skill'], 'team_skill_order');
                foreach ($skill as $index => $value) {
                    if (!$Validation->isNumber($value['team_skill_level'], 0, 100)) {
                        continue;
                    }
                    $skillHTML .= '
						<div class="pb-team-skill pb-value-' . (int) $value['team_skill_level'] . '">
							<span class="pb-team-skill-label">' . esc_html($value['team_skill_name']) . '</span>
							<span class="pb-team-skill-value">
								<span class="pb-team-skill-value-value">' . (int) $value['team_skill_level'] . '</span>
								<span class="pb-team-skill-value-character-after">%</span>
							</span>
							<span class="pb-team-skill-foreground"></span>
							<span class="pb-team-skill-background"></span>						
						</div>
					';
                }
                if ($Validation->isNotEmpty($skillHTML)) {
                    $skillHTML = '
						<div class="pb-team-skill-box">
							' . $skillHTML . '
						</div>
					';
                }
            }
            /***/
            $imageTextHTML = null;
            if ($Validation->isNotEmpty($meta['team_first_name']) || $Validation->isNotEmpty($meta['team_second_name'])) {
                $imageTextHTML .= '<' . PBComponentData::get($this->getComponentId(), 'image_text_caption_header_tag') . ' class="pb-image-text-caption">' . trim($meta['team_first_name'] . ' ' . $meta['team_second_name']) . '</' . PBComponentData::get($this->getComponentId(), 'image_text_caption_header_tag') . '>';
            }
            if ($Validation->isNotEmpty($meta['team_position'])) {
                $imageTextHTML .= '<div class="pb-image-text-description">' . $meta['team_position'] . '</div>';
            }
            if ($Validation->isNotEmpty($imageTextHTML)) {
                $imageTextHTML = '<div class="pb-image-text">' . $imageTextHTML . '</div>';
            }
            /***/
            $imageHTML = null;
            if ($attribute['hover_enable'] == 1) {
                $imageHTML = '<a href="' . $full[0] . '"' . PBHelper::createClassAttribute($class[2]) . '><img src="' . $thumbnail[0] . '" alt=""/><span><span><span></span></span></span></a>';
            } else {
                $imageHTML = '<div' . PBHelper::createClassAttribute($class[2]) . '><img src="' . $thumbnail[0] . '" alt=""/></div>';
            }
            if ($Validation->isNotEmpty($imageTextHTML)) {
                array_push($class[1], 'pb-image-text-enable');
            }
            $imageBoxHTML = '<div' . PBHelper::createClassAttribute($class[1]) . '>' . $imageHTML . $imageTextHTML . '</div>';
            /***/
            $teamHTML .= '
				<li' . PBHelper::createClassAttribute($class[0]) . '>
			';
            switch ($attribute['template']) {
                case 1:
                    $teamHTML .= '<div class="pb-layout-33x66 pb-clear-fix"><div class="pb-layout-column-left">' . $imageBoxHTML . $socialHTML . '</div><div class="pb-layout-column-right"><div class="pb-team-text-box">' . $textHTML . apply_filters('the_content', do_shortcode(get_the_content())) . '</div>' . $skillHTML . '</div></div>';
                    break;
                case 2:
                    $teamHTML .= '<div class="pb-layout-50x50 pb-clear-fix"><div class="pb-layout-column-left">' . $imageBoxHTML . '</div><div class="pb-layout-column-right"><div class="pb-team-quote-box"></div><div class="pb-team-text-box">' . apply_filters('the_content', do_shortcode(get_the_content())) . '</div>' . $socialHTML . '</div></div>';
                    break;
                case 3:
                    $teamHTML .= '<div>' . $imageBoxHTML . $socialHTML . '</div>';
                    break;
            }
            $teamHTML .= '
				</li>
			';
            $i++;
        }
        wp_reset_query();
        $post = $bPost;
        if ($Validation->isEmpty($teamHTML)) {
            return;
        }
        $id = PBHelper::createId('pb_team');
        $class = array();
        $class[0] = array('pb-team', 'pb-team-template-' . $attribute['template'], 'pb-clear-fix', $attribute['css_class']);
        $class[1] = array('pb-layout-' . $layoutCurrent, 'pb-reset-list', 'pb-clear-fix');
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . ' id="' . $id . '">
				<ul' . PBHelper::createClassAttribute($class[1]) . '>
					' . $teamHTML . '
				</ul>			
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$(\'#' . $id . '\').PBTeam(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return $html;
    }
 function processShortcodeFeatureItemHeader($attribute, $content, $tag)
 {
     $attribute = $this->processAttribute($tag, $attribute);
     $html = null;
     $Window = new PBWindow();
     $Validation = new PBValidation();
     if ($Validation->isEmpty($content)) {
         return $html;
     }
     if (!array_key_exists($this->attrItemURLTarget, $Window->linkTarget)) {
         return $html;
     }
     $content = do_shortcode($content);
     if ($Validation->isNotEmpty($this->attrItemURL)) {
         $class = array($Window->getTargetCSSClass($this->attrItemURLTarget));
         $content = '<a href="' . esc_attr($this->attrItemURL) . '"' . PBHelper::createClassAttribute($class) . '>' . $content . '</a>';
     }
     $class = array('pb-feature-header');
     $html = '<h' . PBComponentData::get($this->getComponentId(), 'header_important_default') . PBHelper::createClassAttribute($class) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</h' . PBComponentData::get($this->getComponentId(), 'header_important_default') . '>';
     return PBHelper::formatHTML($html, $content);
 }
    function processShortcodeFlexSlider($attribute, $content, $tag)
    {
        $Easing = new PBEasing();
        $attribute = $this->processAttribute($tag, $attribute);
        $option = array();
        $class = array(array(), array(), array(), array());
        $html = null;
        $imageHTML = null;
        $imageBoxHTML = null;
        $Validation = new PBValidation();
        $file = PBFile::getImage(explode(',', $attribute['image']));
        if ($file === false) {
            return $html;
        }
        if (!count($file->posts)) {
            return $html;
        }
        if (!PBFile::isWPImage($attribute['image_size'])) {
            return $html;
        }
        if (!array_key_exists($attribute['easing'], $Easing->easingType)) {
            return $html;
        }
        if (!array_key_exists($attribute['animation'], $this->animation)) {
            return $html;
        }
        if (!array_key_exists($attribute['direction'], $this->direction)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['preloader_enable'])) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['start_at'], 0, 999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['init_delay'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['slideshow_speed'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['animation_speed'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['touch'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['reverse'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['use_css'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['keyboard'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['slideshow'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['randomize'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['mousewheel'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['control_nav'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['direction_nav'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['smooth_height'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['animation_loop'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['pause_on_hover'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['pause_on_action'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['multiple_keyboard'])) {
            return $html;
        }
        $key = array('easing', 'animation', 'direction', 'start_at', 'init_delay', 'slideshow_speed', 'animation_speed', 'preloader_enable', 'touch', 'use_css', 'reverse', 'keyboard', 'slideshow', 'randomize', 'mousewheel', 'control_nav', 'direction_nav', 'smooth_height', 'pause_on_hover', 'animation_loop', 'pause_on_action', 'multiple_keyboard');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        if ($attribute['preloader_enable'] == 1) {
            array_push($class[0], 'pb-image-box', 'pb-image-preloader');
        }
        array_push($class[1], 'pb-image');
        global $post;
        $bPost = $post;
        while ($file->have_posts()) {
            $file->the_post();
            $src = wp_get_attachment_image_src(get_the_ID(), $attribute['image_size']);
            $url = null;
            $meta = PBMeta::get($post->ID);
            PBHelper::removeUIndex($meta, 'media_library_url');
            if ($Validation->isNotEmpty($attribute['url'])) {
                $url = $attribute['url'];
            } elseif ($Validation->isNotEmpty($meta['media_library_url'])) {
                $url = $meta['media_library_url'];
            }
            if ($Validation->isNotEmpty($url)) {
                $imageHTML = '<a href="' . esc_attr($url) . '"><img src="' . $src[0] . '" alt=""/></a>';
            } else {
                $imageHTML = '<img src="' . $src[0] . '" alt="" data-thumb="' . $src[0] . '"/>';
            }
            $imageBoxHTML .= '
				<li' . PBHelper::createClassAttribute($class[0]) . '>
					<div' . PBHelper::createClassAttribute($class[1]) . '>' . $imageHTML . '</div>
				</li>
			';
        }
        wp_reset_query();
        $post = $bPost;
        $id = PBHelper::createId('pb_flex_slider');
        array_push($class[2], 'pb-flex-slider', $attribute['css_class']);
        if ($attribute['preloader_enable'] == 1) {
            array_push($class[2], 'pb-preloader');
        }
        array_push($class[3], 'pb-reset-list', 'slides');
        $html = '
			<div' . PBHelper::createClassAttribute($class[2]) . ' id="' . $id . '">
				<ul' . PBHelper::createClassAttribute($class[3]) . '>
					' . $imageBoxHTML . '
				</ul>
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$(\'#' . $id . '\').PBFlexSlider(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html);
    }
Esempio n. 17
0
    function processShortcodeLayout($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $Border = new PBBorder();
        $Layout = new PBLayout();
        $Background = new PBBackground();
        $Validation = new PBValidation();
        $style = array();
        $option = array();
        if (!$Layout->isLayout($attribute['layout'])) {
            return;
        }
        if (!$Layout->isLayoutLine($attribute['layout_line'])) {
            return;
        }
        if (!$Validation->isBool($attribute['bg_parallax_enable'])) {
            return;
        }
        if (!$Validation->isBool($attribute['bg_parallax_mobile_enable'])) {
            return;
        }
        if (!$Validation->isNumber($attribute['bg_parallax_speed'], 0, 100)) {
            return;
        }
        if ($Validation->isColor($attribute['bg_color'])) {
            $style['background-color'] = PBColor::getColor($attribute['bg_color']);
        }
        if ($Validation->isNotEmpty($attribute['bg_position'])) {
            $style['background-position'] = $attribute['bg_position'];
        }
        if ($Validation->isNotEmpty($attribute['bg_repeat'])) {
            $style['background-repeat'] = $attribute['bg_repeat'];
        }
        if ($Validation->isNotEmpty($attribute['bg_image'])) {
            $style['background-image'] = 'url(\'' . $attribute['bg_image'] . '\')';
        }
        if ($Validation->isNotEmpty($attribute['bg_size_a'])) {
            if (array_key_exists($attribute['bg_size_a'], $Background->backgroundSize)) {
                if (in_array($attribute['bg_size_a'], array('length', 'percentage'))) {
                    if ($Validation->isNotEmpty($attribute['bg_size_b'])) {
                        $style['background-size'] = $attribute['bg_size_b'];
                    }
                } else {
                    $style['background-size'] = $attribute['bg_size_a'];
                }
            }
        }
        if (!$Validation->isBool($attribute['video_loop'])) {
            return;
        }
        if (!$Validation->isBool($attribute['video_muted'])) {
            return;
        }
        if (!$Validation->isBool($attribute['video_autoplay'])) {
            return;
        }
        if (!$Validation->isBool($attribute['video_control'])) {
            return;
        }
        if ($Validation->isNotEmpty($attribute['padding_top'])) {
            $style['padding-top'] = (int) $attribute['padding_top'] . 'px';
        }
        if ($Validation->isNotEmpty($attribute['padding_right'])) {
            $style['padding-right'] = (int) $attribute['padding_right'] . 'px';
        }
        if ($Validation->isNotEmpty($attribute['padding_bottom'])) {
            $style['padding-bottom'] = (int) $attribute['padding_bottom'] . 'px';
        }
        if ($Validation->isNotEmpty($attribute['padding_left'])) {
            $style['padding-left'] = (int) $attribute['padding_left'] . 'px';
        }
        if (array_key_exists($attribute['border_top_style'], $Border->style)) {
            $style['border-top-style'] = $attribute['border_top_style'];
        }
        if ($Validation->isNumber($attribute['border_top_width'], 0, 999)) {
            $style['border-top-width'] = $attribute['border_top_width'] . 'px';
        }
        if ($Validation->isColor($attribute['border_top_color'])) {
            $style['border-top-color'] = PBColor::getColor($attribute['border_top_color']);
        }
        if (array_key_exists($attribute['border_right_style'], $Border->style)) {
            $style['border-right-style'] = $attribute['border_right_style'];
        }
        if ($Validation->isNumber($attribute['border_right_width'], 0, 999)) {
            $style['border-right-width'] = $attribute['border_right_width'] . 'px';
        }
        if ($Validation->isColor($attribute['border_right_color'])) {
            $style['border-right-color'] = PBColor::getColor($attribute['border_right_color']);
        }
        if (array_key_exists($attribute['border_bottom_style'], $Border->style)) {
            $style['border-bottom-style'] = $attribute['border_bottom_style'];
        }
        if ($Validation->isNumber($attribute['border_bottom_width'], 0, 999)) {
            $style['border-bottom-width'] = $attribute['border_bottom_width'] . 'px';
        }
        if ($Validation->isColor($attribute['border_bottom_color'])) {
            $style['border-bottom-color'] = PBColor::getColor($attribute['border_bottom_color']);
        }
        if (array_key_exists($attribute['border_left_style'], $Border->style)) {
            $style['border-left-style'] = $attribute['border_left_style'];
        }
        if ($Validation->isNumber($attribute['border_left_width'], 0, 999)) {
            $style['border-left-width'] = $attribute['border_left_width'] . 'px';
        }
        if ($Validation->isColor($attribute['border_left_color'])) {
            $style['border-left-color'] = PBColor::getColor($attribute['border_left_color']);
        }
        /***/
        $MobileDetect = new Mobile_Detect();
        $mobile = (int) $MobileDetect->isMobile();
        /***/
        $videoHTML = null;
        $video = $Validation->isNotEmpty($attribute['video_format_webm']) || $Validation->isNotEmpty($attribute['video_format_ogg']) || $Validation->isNotEmpty($attribute['video_format_mp4']);
        if ($video && $attribute['video_mobile_enable'] != 1) {
            PBInclude::includeClass(PLUGIN_PAGE_BUILDER_LIBRARY_PATH . 'mobileDetect/Mobile_Detect.php', array('Mobile_Detect'));
            if ($mobile) {
                $video = false;
            }
        }
        if ($video) {
            $sourceHTML = null;
            $videoControlHTML = null;
            $videoAttributeHTML = null;
            if ($Validation->isNotEmpty($attribute['video_format_mp4'])) {
                $sourceHTML .= '<source type="video/mp4" src="' . esc_attr($attribute['video_format_mp4']) . '" />';
            }
            if ($Validation->isNotEmpty($attribute['video_format_webm'])) {
                $sourceHTML .= '<source type="video/webm" src="' . esc_attr($attribute['video_format_webm']) . '" />';
            }
            if ($Validation->isNotEmpty($attribute['video_format_ogg'])) {
                $sourceHTML .= '<source type="video/ogg" src="' . esc_attr($attribute['video_format_ogg']) . '" />';
            }
            if ($attribute['video_loop']) {
                $videoAttributeHTML .= ' loop';
            }
            if ($attribute['video_muted']) {
                $videoAttributeHTML .= ' muted';
            }
            if ($attribute['video_autoplay']) {
                $videoAttributeHTML .= ' autoplay';
            }
            if ($attribute['video_control'] == 1) {
                $videoControlHTML = '
					<div class="pb-line-video-control">
						<a href="#" class="pb-line-video-control-toggle-play pb-line-video-control-toggle-play-' . ($attribute['video_autoplay'] == 1 ? 'on' : 'off') . '"></a>
						<a href="#" class="pb-line-video-control-toggle-sound pb-line-video-control-toggle-sound-' . ($attribute['video_muted'] == 1 ? 'off' : 'on') . '"></a>
					</div>
				';
            }
            $videoHTML = '
				<div class="pb-line-video">
					<video preload="auto"' . $videoAttributeHTML . '>
						' . $sourceHTML . '
					</video>
				</div>
				' . $videoControlHTML . '
			';
        }
        /***/
        $overlay = false;
        $overlayHTML = null;
        if ($Validation->isColor($attribute['overlay_color'])) {
            $overlay = true;
            $overlayHTML = '<div class="pb-line-overlay" style="background-color:' . PBColor::getColor($attribute['overlay_color']) . '"></div>';
        }
        /***/
        $class = array(array('pb-line', 'pb-clear-fix', $attribute['css_class'], $video || $overlay ? 'pb-line-include-video' : null), array('pb-layout', $Layout->getLayoutCSSClass($attribute['layout']), 'pb-reset-list', 'pb-clear-fix'));
        if (in_array($attribute['layout_line'], array('boxed'))) {
            $class[0][] = 'pb-main';
        }
        if (in_array($attribute['layout_line'], array('boxed', 'wide', ''))) {
            $class[1][] = 'pb-main';
        }
        $key = array('bg_parallax_speed', 'bg_parallax_enable', 'bg_parallax_mobile_enable');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        $id = PBHelper::createId('pb_line');
        $css = esc_attr($attribute['css_group']);
        if ($Validation->isNotEmpty($css)) {
            array_push($class[0], 'pb-line-css-group-' . $css);
        }
        PBComponentData::set('layout', 'index', 0);
        PBComponentData::set('layout', 'layout', $attribute['layout']);
        $html = '
			<div id="' . $id . '" ' . PBHelper::createClassAttribute($class[0]) . PBHelper::createStyleAttribute($style) . '>
				' . $videoHTML . '
				' . $overlayHTML . '
				<ul' . PBHelper::createClassAttribute($class[1]) . '>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</ul>
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$("#' . $id . '").PBLayout(' . json_encode($option) . ',' . $mobile . ');
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
    }
 function createCSSFile()
 {
     $content = null;
     $component = PBData::get('component');
     $Validation = new PBValidation();
     foreach ($component as $componentName => $componentData) {
         $className = 'PBComponent' . $this->formatName($componentName);
         $Component = new $className();
         if (method_exists($Component, 'createCSS')) {
             $Component->createCSS();
             $css = PBComponentData::get($componentName, 'css');
             if ($Validation->isNotEmpty($css)) {
                 $content .= $css . "\n\n";
             }
         }
     }
     $file = PBData::get('theme_path_multisite_style') . 'PB.Frontend.css';
     $WPFileSystem = new PBWPFileSystem();
     if ($WPFileSystem->put_contents($file, $content, 0755) === false) {
         return false;
     }
     return true;
 }
    function processShortcodeGallery($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $elementHTML = null;
        $Layout = new PBLayout();
        $Validation = new PBValidation();
        $ImageHover = new PBImageHover();
        $file = PBFile::getImage(explode(',', $attribute['image']));
        if ($file === false) {
            return $html;
        }
        if (!count($file->posts)) {
            return $html;
        }
        if (!PBFile::isWPImage($attribute['image_size'])) {
            return $html;
        }
        if (!array_key_exists($attribute['layout'], $this->layout)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['hover_enable'])) {
            return $html;
        }
        if (!array_key_exists($attribute['hover_type'], $ImageHover->type)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['caption_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['preloader_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['description_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['layout_full_width_enable'])) {
            return $html;
        }
        $key = array('hover_type', 'hover_enable', 'preloader_enable', 'layout_full_width_enable');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        $id = PBHelper::createId('pb_gallery');
        global $post;
        $bPost = $post;
        $i = 0;
        while ($file->have_posts()) {
            global $post;
            $file->the_post();
            $full = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), $attribute['image_size']);
            $meta = PBMeta::get($post);
            PBHelper::removeUIndex($meta, 'media_library_video_url', 'media_library_url');
            $class = array();
            $class[0] = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($attribute['layout'], $i));
            $class[1] = array('pb-image-box');
            $class[2] = array('pb-image');
            if ($attribute['preloader_enable'] == 1) {
                array_push($class[1], 'pb-image-preloader', 'pb-image-preloader-animation-enable');
            }
            if ($attribute['hover_enable'] == 1) {
                array_push($class[1], 'pb-image-hover', 'pb-image-hover-type-' . $attribute['hover_type']);
            }
            /****/
            $imageTextHTML = null;
            if ($Validation->isNotEmpty($post->post_excerpt) && $attribute['caption_enable'] == 1) {
                $imageTextHTML .= '<' . PBComponentData::get($this->getComponentId(), 'image_text_caption_header_tag') . ' class="pb-image-text-caption">' . get_the_excerpt() . '</' . PBComponentData::get($this->getComponentId(), 'image_text_caption_header_tag') . '>';
            }
            if ($Validation->isNotEmpty($post->post_content) && $attribute['description_enable'] == 1) {
                $imageTextHTML .= '<div class="pb-image-text-description">' . get_the_content() . '</div>';
            }
            if ($Validation->isNotEmpty($imageTextHTML)) {
                $imageTextHTML = '<div class="pb-image-text">' . $imageTextHTML . '</div>';
            }
            if ($Validation->isNotEmpty($imageTextHTML)) {
                $imageTextHTML .= '<div class="pb-image-text-fancybox"><b>' . get_the_excerpt() . '</b> ' . get_the_content() . '</div>';
            }
            /****/
            $url = null;
            $rel = null;
            if ($Validation->isVideoURL($meta['media_library_video_url'])) {
                $url = $meta['media_library_video_url'];
                array_push($class[1], 'pb-image-type-video');
            } elseif ($Validation->isURL($meta['media_library_url'])) {
                $url = $meta['media_library_url'];
                array_push($class[1], 'pb-image-type-link');
            } else {
                $rel = $id;
                $url = $full[0];
                array_push($class[1], 'pb-image-type-image');
            }
            /****/
            $imageHTML = null;
            if ($attribute['hover_enable'] == 1) {
                $imageHTML = '<a href="' . $url . '"' . PBHelper::createClassAttribute($class[2]) . ($Validation->isEmpty($rel) ? null : ' data-fancybox-group="' . esc_attr($rel) . '"') . '><img src="' . $thumbnail[0] . '" alt=""/><span><span><span></span></span></span></a>';
            } else {
                $imageHTML = '<div' . PBHelper::createClassAttribute($class[2]) . '><img src="' . $thumbnail[0] . '" alt=""/></div>';
            }
            /****/
            if ($Validation->isNotEmpty($imageTextHTML)) {
                array_push($class[1], 'pb-image-text-enable');
            }
            $elementHTML .= '<li' . PBHelper::createClassAttribute($class[0]) . '><div' . PBHelper::createClassAttribute($class[1]) . '>' . $imageHTML . $imageTextHTML . '</div></li>';
            $i++;
        }
        wp_reset_query();
        $post = $bPost;
        $class = array();
        $class[0] = array('pb-gallery', 'pb-clear-fix', $attribute['css_class']);
        $class[1] = array($Layout->getLayoutCSSClass($attribute['layout']), 'pb-reset-list', 'pb-clear-fix');
        if ($attribute['layout_full_width_enable'] == 1) {
            array_push($class[1], 'pb-layout-full-width');
        }
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . ' id="' . $id . '">
				<ul' . PBHelper::createClassAttribute($class[1]) . '>
					' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
				</ul>			
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$(\'#' . $id . '\').PBGallery(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html, $elementHTML);
    }
 function createField($name)
 {
     $html = null;
     $Validation = new PBValidation();
     $data = $this->getFieldData($name);
     if ($data === false) {
         return $html;
     }
     $argument = array();
     $argumentString = null;
     $argument['id'] = $data['id'];
     $argument['name'] = $data['id'];
     foreach ($argument as $index => $value) {
         $argumentString .= ' ' . $index . '="' . esc_attr($value) . '"';
     }
     switch ($data['type']) {
         case 'text':
             $html = '<input type="text"' . $argumentString . '/>';
             break;
         case 'email':
             $html = '<input type="text"' . $argumentString . '/>';
             break;
         case 'submit':
             $html = '<input type="submit" value="' . esc_attr($data['label']) . '"' . $argumentString . '/>';
             break;
         case 'select':
             $option = preg_split('/;/', $data['value']);
             foreach ($option as $value) {
                 if ($Validation->isNotEmpty($value)) {
                     $html .= '<option value="' . esc_attr($value) . '">' . esc_html($value) . '</option>';
                 }
             }
             $html = '<select' . $argumentString . '>' . $html . '</select>';
             break;
         case 'textarea':
             $html = '<textarea rows="1" cols="1"' . $argumentString . '></textarea>';
             break;
     }
     if (in_array($data['type'], array('text', 'textarea', 'email'))) {
         $html = '<label for="' . $argument['id'] . '" class="pb-infield-label">' . esc_html($data['label']) . '</label>' . $html;
     }
     return PBHelper::formatHTML($html);
 }
    function processShortcodeCounterBoxItem($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $Layout = new PBLayout();
        $Validation = new PBValidation();
        if (!$Validation->isNumber($attribute['value'], 0, 99999, false)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['text_counter_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['graphic_counter_enable'])) {
            return $html;
        }
        /***/
        $characterAfterHtml = null;
        $characterBeforeHtml = null;
        if ($Validation->isNotEmpty($attribute['character_before'])) {
            $characterBeforeHtml = '<span' . PBHelper::createClassAttribute(array('pb-counter-box-text-counter-character-before')) . '>' . $attribute['character_before'] . '</span>';
        }
        if ($Validation->isNotEmpty($attribute['character_after'])) {
            $characterAfterHtml = '<span' . PBHelper::createClassAttribute(array('pb-counter-box-text-counter-character-after')) . '>' . $attribute['character_after'] . '</span>';
        }
        $class = array('pb-counter-box-text-counter');
        if ($attribute['text_counter_enable'] == 0) {
            array_push($class, 'pb-hidden');
        }
        $counterTextHtml = '
			<div' . PBHelper::createClassAttribute($class) . '>
				' . $characterBeforeHtml . '
				<span' . PBHelper::createClassAttribute(array('pb-counter-box-text-counter-value')) . '></span>
				' . $characterAfterHtml . '
			</div>
		';
        /***/
        $class = array('pb-counter-box-graphic-counter');
        if ($attribute['graphic_counter_enable'] == 0) {
            array_push($class, 'pb-hidden');
        }
        $counterGraphicHtml = '
			<div' . PBHelper::createClassAttribute($class) . '>
				<div' . PBHelper::createClassAttribute(array('pb-counter-box-graphic-counter-background')) . '></div>
				<div' . PBHelper::createClassAttribute(array('pb-counter-box-graphic-counter-foreground')) . '></div>
			</div>
		';
        /***/
        $class = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($this->layout, $this->layoutColumnIndex), 'pb-value-' . (int) $attribute['value']);
        $html = '
			<li' . PBHelper::createClassAttribute($class) . '>
				<div>
					' . $counterTextHtml . '
					' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
					' . $counterGraphicHtml . '
				</div>
			</li>
		';
        $this->layoutColumnIndex++;
        return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
    }
    function processShortcodeNotice($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $html = null;
        $Validation = new PBValidation();
        $style = array(array(), array());
        if ($Validation->isColor($attribute['box_bg_color'])) {
            $style[1]['background-color'] = PBColor::getColor($attribute['box_bg_color']);
        }
        if ($Validation->isNumber($attribute['box_border_top_width'], 0, 9999)) {
            $style[1]['border-top-width'] = $attribute['box_border_top_width'] . 'px';
        }
        if ($Validation->isColor($attribute['box_border_top_color'])) {
            $style[1]['border-top-color'] = PBColor::getColor($attribute['box_border_top_color']);
        }
        if ($Validation->isNumber($attribute['box_border_right_width'], 0, 9999)) {
            $style[1]['border-right-width'] = $attribute['box_border_right_width'] . 'px';
        }
        if ($Validation->isColor($attribute['box_border_right_color'])) {
            $style[1]['border-right-color'] = PBColor::getColor($attribute['box_border_right_color']);
        }
        if ($Validation->isNumber($attribute['box_border_bottom_width'], 0, 9999)) {
            $style[1]['border-bottom-width'] = $attribute['box_border_bottom_width'] . 'px';
        }
        if ($Validation->isColor($attribute['box_border_bottom_color'])) {
            $style[1]['border-bottom-color'] = PBColor::getColor($attribute['box_border_bottom_color']);
        }
        if ($Validation->isNumber($attribute['box_border_left_width'], 0, 9999)) {
            $style[1]['border-left-width'] = $attribute['box_border_left_width'] . 'px';
        }
        if ($Validation->isColor($attribute['box_border_left_color'])) {
            $style[1]['border-left-color'] = PBColor::getColor($attribute['box_border_left_color']);
        }
        $class = array('pb-notice', $attribute['css_class']);
        $id = PBHelper::createId('pb_notice');
        $timelineHTML = null;
        $closeButtonHTML = null;
        /***/
        if ($Validation->isNotEmpty($attribute['icon'])) {
            array_push($class, 'pb-notice-icon', 'pb-notice-icon-' . PBHelper::createHash($attribute['icon']));
            if ($Validation->isColor($attribute['icon_bg_color'])) {
                $style[0]['background-color'] = PBColor::getColor($attribute['icon_bg_color']);
            }
        }
        /***/
        if ($attribute['timeline_enable'] == 1 && $attribute['timeline_time_to_close'] > 0) {
            $tStyle = array(array(), array());
            $tClass = array('pb-notice-timeline');
            if ($Validation->isNumber($attribute['timeline_height'], 0, 9999)) {
                $tStyle[0]['height'] = $attribute['timeline_height'] . 'px';
            }
            if ($Validation->isColor($attribute['timeline_bg_color'])) {
                $tStyle[1]['background-color'] = PBColor::getColor($attribute['timeline_bg_color']);
            }
            array_push($class, 'pb-notice-time-to-close-' . (int) $attribute['timeline_time_to_close']);
            $timelineHTML = '
				<div' . PBHelper::createClassAttribute($tClass) . PBHelper::createStyleAttribute($tStyle[0]) . '>
					<div' . PBHelper::createStyleAttribute($tStyle[1]) . '></div>
				</div>
			';
        }
        /***/
        $tStyle = array();
        $tClass = array('pb-notice-close-button');
        if ($Validation->isColor($attribute['close_button_text_color'])) {
            $tStyle['color'] = PBColor::getColor($attribute['close_button_text_color']);
        }
        $label = $Validation->isNotEmpty($timelineHTML) ? sprintf(__('Close within <span>%s</span> seconds', PLUGIN_PAGE_BUILDER_DOMAIN), $attribute['timeline_time_to_close']) : __('Close', PLUGIN_PAGE_BUILDER_DOMAIN);
        if ($attribute['close_button_enable'] != 1) {
            $tStyle['display'] = 'none';
        }
        $closeButtonHTML = '
			<div><a href="#"' . PBHelper::createClassAttribute($tClass) . PBHelper::createStyleAttribute($tStyle) . '>' . $label . '</a></div>
		';
        /***/
        $html = '
			<div' . PBHelper::createClassAttribute($class) . PBHelper::createStyleAttribute($style[0]) . ' id="' . esc_attr($id) . '">
				<div class="pb-notice-content"' . PBHelper::createStyleAttribute($style[1]) . '>
					' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '
					' . $timelineHTML . '
					' . $closeButtonHTML . '
				</div>
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($) 
					{
						$("#' . $id . '").PBNotice();
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false));
    }
    function processShortcodeZAccordion($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $Image = new PBImage();
        $Easing = new PBEasing();
        $Validation = new PBValidation();
        $html = null;
        $imageHTML = null;
        $imageBoxHTML = null;
        $option = array();
        if (!array_key_exists($attribute['data_source'], $this->dataSource)) {
            return $html;
        }
        if ($attribute['data_source'] == 1) {
            $query = PBFile::getImage(explode(',', $attribute['image']));
            if ($query === false) {
                return $html;
            }
            if (!count($query->posts)) {
                return $html;
            }
        } else {
            $argument = array('meta_query' => array(array('key' => '_thumbnail_id')));
            if ($Validation->isNotEmpty($attribute['post_type'])) {
                $argument['post_type'] = explode(',', $attribute['post_type']);
            }
            if ($Validation->isNotEmpty($attribute['post_status'])) {
                $argument['post_status'] = explode(',', $attribute['post_status']);
            }
            if ($Validation->isNotEmpty($attribute['post__in'])) {
                $argument['post__in'] = explode(',', $attribute['post__in']);
            }
            if ($Validation->isNotEmpty($attribute['post__not_in'])) {
                $argument['post__not_in'] = explode(',', $attribute['post__not_in']);
            }
            if ($Validation->isNotEmpty($attribute['posts_per_page'])) {
                $argument['posts_per_page'] = $attribute['posts_per_page'] == -2 ? -1 : $attribute['posts_per_page'];
            }
            if ($Validation->isNotEmpty($attribute['orderby'])) {
                $argument['orderby'] = $attribute['orderby'];
            }
            if ($Validation->isNotEmpty($attribute['order'])) {
                $argument['order'] = $attribute['order'];
            }
            $query = new WP_Query($argument);
            if ($query === false) {
                return $html;
            }
            if ($query->post_count == 0) {
                return $html;
            }
        }
        if (!PBFile::isWPImage($attribute['image_size'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['preloader_enable'])) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['starting_slide'], 0, 999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['timeout'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['speed'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['auto'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['pause'])) {
            return $html;
        }
        if (!array_key_exists($attribute['easing'], $Easing->easingType)) {
            return $html;
        }
        if (!array_key_exists($attribute['trigger'], $this->tabOpenTriggerEvent)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['display_slide_title'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['display_slide_excerpt'])) {
            return $html;
        }
        $imageSize = $Image->getImageDimension($attribute['image_size']);
        if ($imageSize === false) {
            return $html;
        }
        $key = array('preloader_enable', 'starting_slide', 'timeout', 'speed', 'auto', 'pause', 'easing', 'trigger', 'display_slide_title', 'display_slide_excerpt');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        $option['width'] = $imageSize['width'];
        $option['height'] = $imageSize['height'];
        $class = array(array(), array(), array(), array());
        array_push($class[0], 'pb-zaccordion', $attribute['css_class']);
        array_push($class[1], 'pb-reset-list');
        if ($attribute['preloader_enable'] == 1) {
            array_push($class[1], 'pb-preloader');
            array_push($class[2], 'pb-image-box', 'pb-image-preloader');
        }
        array_push($class[3], 'pb-image');
        global $post;
        $bPost = $post;
        while ($query->have_posts()) {
            $query->the_post();
            $url = null;
            if ($attribute['data_source'] == 1) {
                $meta = PBMeta::get($post->ID);
                PBHelper::removeUIndex($meta, 'media_library_url');
                if ($Validation->isNotEmpty($attribute['url'])) {
                    $url = $attribute['url'];
                } elseif ($Validation->isNotEmpty($meta['media_library_url'])) {
                    $url = $meta['media_library_url'];
                }
                $src = wp_get_attachment_image_src(get_the_ID(), $attribute['image_size']);
            } else {
                $url = get_the_permalink();
                $src = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $attribute['image_size']);
            }
            $captionHTML = null;
            if ($attribute['display_slide_title'] == 1) {
                $captionHTML .= '<span' . PBHelper::createClassAttribute(array('pb-zaccordion-caption-box-title')) . '>' . ($attribute['data_source'] == 1 ? strip_tags(get_the_excerpt()) : get_the_title()) . '</span>';
            }
            if ($attribute['display_slide_excerpt'] == 1) {
                $captionHTML .= '<span' . PBHelper::createClassAttribute(array('pb-zaccordion-caption-box-excerpt')) . '>' . ($attribute['data_source'] == 1 ? get_the_content() : strip_tags(get_the_excerpt())) . '</span>';
            }
            if ($Validation->isNotEmpty($captionHTML)) {
                $captionHTML = '<span' . PBHelper::createClassAttribute(array('pb-zaccordion-caption-box"')) . '>' . $captionHTML . '</span>';
            }
            $imageHTML = null;
            if ($Validation->isNotEmpty($url)) {
                $imageHTML = '<a href="' . esc_attr($url) . '"' . PBHelper::createClassAttribute($class[3]) . '><img src="' . $src[0] . '" alt=""/>' . $captionHTML . '</a>';
            } else {
                $imageHTML = '<img src="' . $src[0] . '" alt="" data-thumb="' . $src[0] . '"/>' . $captionHTML;
            }
            $imageBoxHTML .= '
				<li>
					<div' . PBHelper::createClassAttribute($class[2]) . '>' . $imageHTML . '</div>
				</li>
			';
        }
        wp_reset_query();
        $post = $bPost;
        $id = PBHelper::createId('accordion');
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . '>
				<ul' . PBHelper::createClassAttribute($class[1]) . ' id="' . $id . '">
					' . $imageBoxHTML . '
				</ul>
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$(\'#' . $id . '\').PBZAccordion(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html);
    }
 function getPost($attribute)
 {
     $argument = array('post_type' => 'post', 'ignore_sticky_posts' => true, 'category_name' => $attribute['category'], 'posts_per_page' => $attribute['post_count'], 'orderby' => 'date', 'order' => 'desc');
     $Validation = new PBValidation();
     if ($Validation->isNotEmpty($attribute['post_id'])) {
         $argument['post__in'] = explode(',', $attribute['post_id']);
     }
     $query = new WP_Query($argument);
     if ($query === false) {
         return;
     }
     return $query;
 }
    function processShortcodeNivoSlider($attribute, $content, $tag)
    {
        $attribute = $this->processAttribute($tag, $attribute);
        $option = array();
        $html = null;
        $imageHTML = null;
        $imageBoxHTML = null;
        $paginationHTML = null;
        $Validation = new PBValidation();
        $file = PBFile::getImage(explode(',', $attribute['image']));
        if ($file === false) {
            return $html;
        }
        if (!count($file->posts)) {
            return $html;
        }
        if (!PBFile::isWPImage($attribute['image_size'])) {
            return $html;
        }
        if (!array_key_exists($attribute['transition_effect'], $this->effect)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['count_slice'], 0, 999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['count_column'], 0, 999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['count_row'], 0, 999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['transition_speed'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['pause_time'], 0, 99999)) {
            return $html;
        }
        if (!$Validation->isNumber($attribute['start_slide'], 0, 999)) {
            return $html;
        }
        if (!$Validation->isBool($attribute['preloader_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['direction_navigation_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['control_navigation_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['control_navigation_thumbs_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['pause_on_hover'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['manual_advance_enable'])) {
            return $html;
        }
        if (!$Validation->isBool($attribute['random_start_enable'])) {
            return $html;
        }
        $key = array('transition_effect', 'count_slice', 'count_column', 'count_row', 'transition_speed', 'pause_time', 'start_slide', 'preloader_enable', 'direction_navigation_enable', 'control_navigation_enable', 'control_navigation_thumbs_enable', 'pause_on_hover', 'manual_advance_enable', 'random_start_enable');
        foreach ($key as $index) {
            $option[$index] = $attribute[$index];
        }
        $class = array(array(), array());
        if ($attribute['preloader_enable'] == 1) {
            array_push($class[0], 'pb-image-box', 'pb-image-preloader');
        }
        array_push($class[1], 'pb-image');
        global $post;
        $bPost = $post;
        while ($file->have_posts()) {
            $file->the_post();
            $src = wp_get_attachment_image_src(get_the_ID(), $attribute['image_size']);
            $url = null;
            $meta = PBMeta::get($post->ID);
            PBHelper::removeUIndex($meta, 'media_library_url');
            if ($Validation->isNotEmpty($attribute['url'])) {
                $url = $attribute['url'];
            } elseif ($Validation->isNotEmpty($meta['media_library_url'])) {
                $url = $meta['media_library_url'];
            }
            if ($Validation->isNotEmpty($url)) {
                $imageHTML = '<a href="' . esc_attr($url) . '"><img src="' . $src[0] . '" alt=""/></a>';
            } else {
                $imageHTML = '<img src="' . $src[0] . '" alt="" data-thumb="' . $src[0] . '"/>';
            }
            $imageBoxHTML .= '
				<div' . PBHelper::createClassAttribute($class[0]) . '>
					<div' . PBHelper::createClassAttribute($class[1]) . '>' . $imageHTML . '</div>
				</div>
			';
        }
        wp_reset_query();
        $post = $bPost;
        $id = PBHelper::createId('pb_nivo_slider');
        $class = array(array(), array());
        array_push($class[0], 'pb-nivo-slider', $attribute['css_class']);
        if ($attribute['preloader_enable'] == 1) {
            array_push($class[1], 'pb-preloader');
        }
        $html = '
			<div' . PBHelper::createClassAttribute($class[0]) . '>
				<div' . PBHelper::createClassAttribute($class[1]) . ' id="' . $id . '">
					' . $imageBoxHTML . '
					' . $paginationHTML . '
				</div>
			</div>
			<div class="pb-script-tag">
				<script type="text/javascript">
					jQuery(document).ready(function($)
					{
						$(\'#' . $id . '\').PBNivoSlider(' . json_encode($option) . ');
					});
				</script>
			</div>
		';
        return PBHelper::formatHTML($html);
    }
Esempio n. 26
0
 function validateProperty($property)
 {
     $data = array();
     $Validation = new PBValidation();
     foreach ($property as $name => $value) {
         $unit = 'px';
         if (is_array($value)) {
             if (isset($value['unit'])) {
                 $unit = $value['unit'];
             }
             if (isset($value['value'])) {
                 $value = $value['value'];
             }
         }
         switch ($name) {
             case 'left':
             case 'width':
             case 'height':
             case 'font-size':
             case 'padding-top':
             case 'padding-left':
             case 'padding-right':
             case 'padding-bottom':
                 if ($Validation->isNumber($value, 0, 9999)) {
                     $data[$name] = $value . $unit;
                 }
                 break;
             case 'top':
             case 'margin-top':
             case 'margin-left':
             case 'margin-right':
             case 'margin-bottom':
                 if ($Validation->isNumber($value, -9999, 9999)) {
                     $data[$name] = $value . $unit;
                 }
                 break;
             case 'color':
             case 'border-color':
             case 'border-top-color':
             case 'border-right-color':
             case 'border-bottom-color':
             case 'border-left-color':
             case 'outline-color':
             case 'background-color':
                 $value = PBColor::getColor($value);
                 if ($Validation->isNotEmpty($value)) {
                     $data[$name] = $value;
                 }
                 break;
             case 'font-family':
                 foreach ((array) $value as $family) {
                     if ($Validation->isNotEmpty($family)) {
                         PBHelper::removeUIndex($data, $name);
                         if ($Validation->isNotEmpty($data[$name])) {
                             $data[$name] .= ',';
                         }
                         $data[$name] .= '\'' . $family . '\'';
                     }
                 }
                 break;
             case 'font-style':
                 if (isset($this->fontStyle[$value])) {
                     $data[$name] = $value;
                 }
                 break;
             case 'font-weight':
                 if (isset($this->fontWeight[$value])) {
                     $data[$name] = $value;
                 }
                 break;
             case 'display':
             case 'background':
             case 'background-repeat':
             case 'background-position':
                 if ($Validation->isNotEmpty($value)) {
                     $data[$name] = $value;
                 }
                 break;
             case 'background-image':
                 if ($Validation->isNotEmpty($value)) {
                     $data[$name] = 'url(\'' . $value . '\')';
                 }
                 break;
         }
     }
     return $data;
 }
Esempio n. 27
0
    function create()
    {
        $html = null;
        $element = array();
        $panelHTML = array();
        $Validation = new PBValidation();
        foreach ($this->componentData['structure']['element'] as $elementData) {
            $panelId = $elementData['ui']['panel'];
            $multiId = $elementData['ui']['multi'];
            $groupId = $elementData['ui']['group'];
            $element[$panelId][$multiId][$groupId][] = $elementData;
        }
        foreach ($element as $panelId => $panelData) {
            foreach ($panelData as $multiId => $multiData) {
                if ($multiId != 0) {
                    if (!isset($panelHTML[$panelId])) {
                        $panelHTML[$panelId] = null;
                    }
                    $elementMultiId = array();
                    foreach ($multiData as $groupData) {
                        foreach ($groupData as $elementData) {
                            $elementMultiId[$elementData['id']] = $elementData['id'];
                        }
                    }
                    $count = 1;
                    foreach ($elementMultiId as $elementMultiIdId) {
                        if (array_key_exists($elementMultiIdId, $this->componentValue)) {
                            $count = count($this->componentValue[$elementMultiIdId]) > $count ? count($this->componentValue[$elementMultiIdId]) : $count;
                        }
                    }
                    for ($j = 0; $j < $count; $j++) {
                        $elementHTML = null;
                        $i = 0;
                        $fieldCount = 0;
                        foreach ($multiData as $groupId => $groupData) {
                            foreach ($groupData as $elementData) {
                                if ($this->displayField($elementData['visibility'])) {
                                    if ($groupId == 0) {
                                        $fieldCount += count($groupData);
                                    } else {
                                        $fieldCount++;
                                    }
                                    break;
                                }
                            }
                        }
                        foreach ($multiData as $groupId => $groupData) {
                            if ($groupId != 0) {
                                $html = null;
                                foreach ($groupData as $elementData) {
                                    if (!$this->displayField($elementData['visibility'])) {
                                        continue;
                                    }
                                    $id = $elementData['id'];
                                    PBHelper::removeUIndex($this->componentValue[$id], $j);
                                    $html .= '
										<div>
											' . $this->createFieldLegend($elementData['ui']['text']['label']) . '
											' . $this->createField($elementData, $this->componentValue[$id][$j]) . '
										</div>
									';
                                }
                                PBHelper::removeUIndex($this->componentData['structure']['ui']['group'][$groupId], 'header', 'subheader');
                                if ($Validation->isNotEmpty($html)) {
                                    $i++;
                                    $elementHTML .= '
										<li>
											' . $this->createGroupHeader($this->componentData['structure']['ui']['group'][$groupId]['header']) . '
											' . $this->createGroupSubheader($this->componentData['structure']['ui']['group'][$groupId]['header'], $this->componentData['structure']['ui']['group'][$groupId]['subheader']) . '
											' . $html . '
											' . ($i == $fieldCount ? '<a href="#" class="pb-link-remove">' . __('Remove') . '</a>' : null) . '
										</li>
									';
                                }
                            } else {
                                foreach ($groupData as $elementData) {
                                    if (!$this->displayField($elementData['visibility'])) {
                                        continue;
                                    }
                                    $i++;
                                    $id = $elementData['id'];
                                    PBHelper::removeUIndex($this->componentValue[$id], $j);
                                    $elementHTML .= '
										<li>
											' . $this->createGroupHeader($elementData['ui']['text']['header']) . '
											' . $this->createGroupSubheader($elementData['ui']['text']['header'], $elementData['ui']['text']['subheader']) . '
											<div>
												' . $this->createFieldLegend($elementData['ui']['text']['label']) . '
												' . $this->createField($elementData, $this->componentValue[$id][$j]) . '
											</div>
											' . ($i == $fieldCount ? '<a href="#" class="pb-link-remove">' . __('Remove') . '</a>' : null) . '
										</li>
									';
                                }
                            }
                        }
                        if ($Validation->isNotEmpty($elementHTML)) {
                            $panelHTML[$panelId] .= '
								<div>
									<h3>' . $this->componentData['structure']['ui']['multi'][$multiId]['header'] . '</h3>
									<ul class="pb-field-list">	
										' . $elementHTML . '
									</ul>
								</div>
							';
                        }
                    }
                    if ($Validation->isNotEmpty($panelHTML[$panelId])) {
                        $panelHTML[$panelId] = '
							<li>
								<div class="pb-multi-field">
									' . $panelHTML[$panelId] . '
								</div>
								<a href="#" class="pb-link-add">' . __('Add new', PLUGIN_PAGE_BUILDER_DOMAIN) . '</a>
							</li>
						';
                    }
                } else {
                    foreach ($multiData as $groupId => $groupData) {
                        if (!isset($panelHTML[$panelId])) {
                            $panelHTML[$panelId] = null;
                        }
                        if ($groupId != 0) {
                            $elementHTML = null;
                            foreach ($groupData as $elementData) {
                                if (!$this->displayField($elementData['visibility'])) {
                                    continue;
                                }
                                $id = $elementData['id'];
                                PBHelper::removeUIndex($this->componentValue, $id);
                                $elementHTML .= '
									<div>
										' . $this->createFieldLegend($elementData['ui']['text']['label']) . '
										' . $this->createField($elementData, $this->componentValue[$id]) . '
									</div>
								';
                            }
                            PBHelper::removeUIndex($this->componentData['structure']['ui']['group'][$groupId], 'header', 'subheader');
                            if ($Validation->isNotEmpty($elementHTML)) {
                                $panelHTML[$panelId] .= '
									<li>
										' . $this->createGroupHeader($this->componentData['structure']['ui']['group'][$groupId]['header']) . '
										' . $this->createGroupSubheader($this->componentData['structure']['ui']['group'][$groupId]['header'], $this->componentData['structure']['ui']['group'][$groupId]['subheader']) . '
										' . $elementHTML . '
									</li>
								';
                            }
                        } else {
                            foreach ($groupData as $elementData) {
                                if (!$this->displayField($elementData['visibility'])) {
                                    continue;
                                }
                                $id = $elementData['id'];
                                PBHelper::removeUIndex($this->componentValue, $id);
                                $panelHTML[$panelId] .= '
									<li>
										' . $this->createGroupHeader($elementData['ui']['text']['header']) . '
										' . $this->createGroupSubheader($elementData['ui']['text']['header'], $elementData['ui']['text']['subheader']) . '
										<div>
											' . $this->createFieldLegend($elementData['ui']['text']['label']) . '
											' . $this->createField($elementData, $this->componentValue[$id]) . '
										</div>
									</li>
								';
                            }
                        }
                    }
                }
            }
        }
        if (PBHelper::isArray($this->componentData['structure'], array('ui', 'panel'))) {
            $tabBar = null;
            $tabContent = null;
            foreach ($panelHTML as $index => $value) {
                $tabBar .= '
					<li>
						<a href="#tab-' . $index . '">' . $this->componentData['structure']['ui']['panel'][$index]['header'] . '</a>
					</li>
				';
                $tabContent .= '
					<div id="tab-' . $index . '">
						<div>
							<ul class="pb-reset-list pb-field-list">
								' . $value . '
							</ul>
						</div>
					</div>
				';
            }
            $html = '
				<div class="pb-tab">
				
					<ul>
						' . $tabBar . '
					</ul>
					
					' . $tabContent . '

				</div>
			';
        } else {
            $html = '
				<ul class="pb-reset-list pb-field-list">
					' . $panelHTML[0] . '
				</ul>
			';
        }
        $html = '
			<div class="pb">
				<form name="pb-component-edit-form" id="pb-component-edit-form" action="">
					' . $html . '
				</form>
			</div>
		';
        return $html;
    }
 function composeArrayShortcode(&$tree, $path, $id, $value)
 {
     $Validation = new PBValidation();
     if ($Validation->isEmpty($path)) {
         return;
     }
     $path = mb_split('\\/', $path);
     $pathNext = join('/', array_slice($path, 1));
     $firstLetter = mb_substr($path[0], 0, 1);
     if (in_array($firstLetter, array('*', '@'))) {
         $name = mb_substr($path[0], 1);
     }
     $arrayNext = array('content' => null, 'children' => array(), 'parameter' => array());
     if ($firstLetter == '*') {
         if (is_array($value)) {
             $i = 0;
             foreach ($value as $b) {
                 if (!array_key_exists($name, $tree['children'])) {
                     $tree['children'][$name] = array();
                 }
                 if (!array_key_exists($i, $tree['children'][$name])) {
                     $tree['children'][$name][$i] = $arrayNext;
                 }
                 $this->composeArrayShortcode($tree['children'][$name][$i], $pathNext, $id, $b);
                 $i++;
             }
         }
     } elseif ($firstLetter == '@') {
         if ($path[0] == '@content') {
             $tree['content'] = $value;
         } else {
             if (is_array($value)) {
                 $value = join(',', $value);
             }
             if ($Validation->isNotEmpty($value)) {
                 $name = $path[0] == '@param' ? $id : $name;
                 $tree['parameter'][$name] = $value;
             }
         }
     } else {
         $name = $path[0];
         if (!array_key_exists($name, $tree['children'])) {
             $tree['children'][$name] = $arrayNext;
         }
         $this->composeArrayShortcode($tree['children'][$name], $pathNext, $id, $value);
     }
 }