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 processShortcodeLayoutColumn($attribute, $content, $tag) { $Layout = new PBLayout(); $attribute = $this->processAttribute($tag, $attribute); $index = PBComponentData::get('layout', 'index'); $layout = PBComponentData::get('layout', 'layout'); $class = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($layout, $index)); $html = ' <li' . PBHelper::createClassAttribute($class) . '> <div class="pb-space-line"></div> <div>' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . '</div> </li> '; PBComponentData::set('layout', 'index', $index + 1); return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false)); }
function createCSS($code = null, $retina = false) { $CSS = new PBCSS(); $key = $retina ? 'icon_url_retina' : 'icon_url'; $codeCurrent = null; foreach ($this->social as $index => $value) { $codeCurrent .= $CSS->create(array('selector' => array('ul.pb-social-icon>li>a.pb-social-icon-' . $index), 'property' => array('background-image' => PBComponentData::get($this->getComponentId(), $key) . $value[1]))); } if ($retina) { $codeCurrent = $CSS->getRetinaMediaQuery($codeCurrent); } $code .= $codeCurrent; if (PBData::get('retina_ready') == 1 && !$retina) { $this->createCSS($code, true); return; } PBComponentData::set($this->getComponentId(), 'css', $code); }
function createCSS($code = null, $retina = false) { $CSS = new PBCSS(); $url = $retina ? $this->icon_url_retina : $this->icon_url; $codeCurrent = null; foreach ($this->icon_file as $value) { $codeCurrent .= $CSS->create(array('selector' => array('.pb-button>a>span.pb-button-box>span.pb-button-icon.pb-button-icon-' . PBHelper::createHash($value)), 'property' => array('background-image' => $url . $value))); } if ($retina) { $codeCurrent = $CSS->getRetinaMediaQuery($codeCurrent); } $code .= $codeCurrent; if (PBData::get('retina_ready') == 1 && !$retina) { $this->createCSS($code, true); return; } PBComponentData::set($this->getComponentId(), 'css', $code); }
function createCSS($code = null, $retina = false) { $CSS = new PBCSS(); $key = $retina ? 'url_retina' : 'url'; $codeCurrent = null; foreach ((array) $this->bullet['file'] as $file) { $codeCurrent .= $CSS->create(array('selector' => array('.pb-pricing-plan .pb-pricing-plan-item-feature-list.pb-pricing-plan-item-feature-list-' . PBHelper::createHash($file) . ' ul li'), 'property' => array('background-image' => $this->bullet[$key] . $file))); } if ($retina) { $codeCurrent = $CSS->getRetinaMediaQuery($codeCurrent); } $code .= $codeCurrent; if (PBData::get('retina_ready') == 1 && !$retina) { $this->createCSS($code, true); return; } PBComponentData::set($this->getComponentId(), 'css', $code); }
function createCSS($code = null, $retina = false) { $CSS = new PBCSS(); $key = $retina ? 'url_retina' : 'url'; $codeCurrent = null; foreach ($this->icon as $iconSize => $iconFile) { foreach ($iconFile['file'] as $iconName) { $codeCurrent .= $CSS->create(array('selector' => array('.pb-box.pb-box-icon.pb-box-icon-size-' . $iconSize . '.pb-box-icon-' . PBHelper::createHash($iconName) . '>.pb-box-inner'), 'property' => array('background-image' => $this->icon[$iconSize][$key] . $iconName))); } } if ($retina) { $codeCurrent = $CSS->getRetinaMediaQuery($codeCurrent); } $code .= $codeCurrent; if (PBData::get('retina_ready') == 1 && !$retina) { $this->createCSS($code, true); return; } PBComponentData::set($this->getComponentId(), 'css', $code); }
function createCSS($code = null, $retina = false) { if (PBComponentData::get($this->getComponentId(), 'icon_type') !== 'gr') { return; } $CSS = new PBCSS(); $key = $retina ? 'url_retina' : 'url'; $codeCurrent = null; foreach ($this->bullet['file'] as $file) { $codeCurrent .= $CSS->create(array('selector' => array($this->bullet['css_class'] . ' div.pb-list.pb-list-icon-name-' . PBHelper::createHash($file) . ' ul li'), 'property' => array('background-image' => $this->bullet[$key] . $file))); } if ($retina) { $codeCurrent = $CSS->getRetinaMediaQuery($codeCurrent); } $code .= $codeCurrent; if (PBData::get('retina_ready') == 1 && !$retina) { $this->createCSS($code, true); return; } PBComponentData::set($this->getComponentId(), 'css', $code); }
PBComponentData::set('notice', 'first_line_header_important_default', '6'); PBComponentData::set('notice', 'icon_path', get_template_directory() . '/media/image/public/icon_feature/small/'); PBComponentData::set('notice', 'icon_url', get_template_directory_uri() . '/media/image/public/icon_feature/small/'); PBComponentData::set('notice', 'icon_url_retina', get_template_directory_uri() . '/media/image/public/2x/icon_feature/small/'); /******************************************************************************/ PBComponentData::set('pricing_plan', 'bullet', array('url' => get_template_directory_uri() . '/media/image/public/icon_bullet/', 'url_retina' => get_template_directory_uri() . '/media/image/public/2x/icon_bullet/', 'path' => get_template_directory() . '/media/image/public/icon_bullet/')); /******************************************************************************/ PBComponentData::set('recent_post', 'image_default', 'image-525-315'); PBComponentData::set('recent_post', 'image_hover_type_default', 'fade'); PBComponentData::set('recent_post', 'template_default', '2'); PBComponentData::set('recent_post', 'header_important_default', '5'); /******************************************************************************/ PBComponentData::set('social_icon', 'icon_path', get_template_directory() . '/media/image/public/icon_social/'); PBComponentData::set('social_icon', 'icon_url', get_template_directory_uri() . '/media/image/public/icon_social/'); PBComponentData::set('social_icon', 'icon_url_retina', get_template_directory_uri() . '/media/image/public/2x/icon_social/'); PBComponentData::set('social_icon', 'icon_type', 'gr'); /******************************************************************************/ PBComponentData::set('sitemap', 'bullet', array('url' => get_template_directory_uri() . '/media/image/public/icon_bullet/', 'url_retina' => get_template_directory_uri() . '/media/image/public/2x/icon_bullet/', 'path' => get_template_directory() . '/media/image/public/icon_bullet/')); PBComponentData::set('sitemap', 'icon_type', 'gr'); /******************************************************************************/ PBComponentData::set('team', 'image_default', 'image-525-560'); PBComponentData::set('team', 'image_hover_type_default', 'fade'); PBComponentData::set('team', 'image_text_caption_header_tag', 'h6'); PBComponentData::set('team', 'social_icon_path', get_template_directory() . '/media/image/public/icon_social/'); PBComponentData::set('team', 'social_icon_url', get_template_directory_uri() . '/media/image/public/icon_social/'); PBComponentData::set('team', 'social_icon_url_retina', get_template_directory_uri() . '/media/image/public/2x/icon_social/'); /******************************************************************************/ PBComponentData::set('zaccordion', 'image_default', 'image-1050-770'); /******************************************************************************/ PBData::set('css_class', array(array('value' => 'pb-top-0', 'description' => 'Reset top margin'), array('value' => 'pb-bottom-0', 'description' => 'Reset top margin'), array('value' => 'pb-margin-top-0', 'description' => 'Set a 0px top margin'), array('value' => 'pb-margin-top-10', 'description' => 'Set a 10px top margin'), array('value' => 'pb-margin-top-20', 'description' => 'Set a 20px top margin'), array('value' => 'pb-margin-top-30', 'description' => 'Set a 30px top margin'), array('value' => 'pb-margin-top-40', 'description' => 'Set a 40px top margin'), array('value' => 'pb-margin-top-50', 'description' => 'Set a 50px top margin'), array('value' => 'pb-margin-top-60', 'description' => 'Set a 60px top margin'), array('value' => 'pb-margin-top-70', 'description' => 'Set a 70px top margin'), array('value' => 'pb-margin-top-80', 'description' => 'Set a 80px top margin'), array('value' => 'pb-margin-top-90', 'description' => 'Set a 90px top margin'), array('value' => 'pb-margin-top-100', 'description' => 'Set a 100px top margin'), array('value' => 'pb-margin-bottom-0', 'description' => 'Set a 0px bottom margin'), array('value' => 'pb-margin-bottom-10', 'description' => 'Set a 10px bottom margin'), array('value' => 'pb-margin-bottom-20', 'description' => 'Set a 20px bottom margin'), array('value' => 'pb-margin-bottom-30', 'description' => 'Set a 30px bottom margin'), array('value' => 'pb-margin-bottom-40', 'description' => 'Set a 40px bottom margin'), array('value' => 'pb-margin-bottom-50', 'description' => 'Set a 50px bottom margin'), array('value' => 'pb-margin-bottom-60', 'description' => 'Set a 60px bottom margin'), array('value' => 'pb-margin-bottom-70', 'description' => 'Set a 70px bottom margin'), array('value' => 'pb-margin-bottom-80', 'description' => 'Set a 80px bottom margin'), array('value' => 'pb-margin-bottom-90', 'description' => 'Set a 90px bottom margin'), array('value' => 'pb-margin-bottom-100', 'description' => 'Set a 100px bottom margin'), array('value' => 'pb-margin-left-0', 'description' => 'Set a 0px left margin'), array('value' => 'pb-margin-left-10', 'description' => 'Set a 10px left margin'), array('value' => 'pb-margin-left-20', 'description' => 'Set a 20px left margin'), array('value' => 'pb-margin-left-30', 'description' => 'Set a 30px left margin'), array('value' => 'pb-margin-left-40', 'description' => 'Set a 40px left margin'), array('value' => 'pb-margin-left-50', 'description' => 'Set a 50px left margin'), array('value' => 'pb-margin-left-60', 'description' => 'Set a 60px left margin'), array('value' => 'pb-margin-left-70', 'description' => 'Set a 70px left margin'), array('value' => 'pb-margin-left-80', 'description' => 'Set a 80px left margin'), array('value' => 'pb-margin-left-90', 'description' => 'Set a 90px left margin'), array('value' => 'pb-margin-left-100', 'description' => 'Set a 100px left margin'), array('value' => 'pb-margin-right-0', 'description' => 'Set a 0px right margin'), array('value' => 'pb-margin-right-10', 'description' => 'Set a 10px right margin'), array('value' => 'pb-margin-right-20', 'description' => 'Set a 20px right margin'), array('value' => 'pb-margin-right-30', 'description' => 'Set a 30px right margin'), array('value' => 'pb-margin-right-40', 'description' => 'Set a 40px right margin'), array('value' => 'pb-margin-right-50', 'description' => 'Set a 50px right margin'), array('value' => 'pb-margin-right-60', 'description' => 'Set a 60px right margin'), array('value' => 'pb-margin-right-70', 'description' => 'Set a 70px right margin'), array('value' => 'pb-margin-right-80', 'description' => 'Set a 80px right margin'), array('value' => 'pb-margin-right-90', 'description' => 'Set a 90px right margin'), array('value' => 'pb-margin-right-100', 'description' => 'Set a 100px right margin'), array('value' => 'pb-position-absolute', 'description' => 'Set element absolute'), array('value' => 'pb-position-relative', 'description' => 'Set element relative'), array('value' => 'pb-float-left', 'description' => 'Add left float'), array('value' => 'pb-float-right', 'description' => 'Add right float'), array('value' => 'theme-section-padding-top', 'description' => 'Add default (80px) top padding to the layout'), array('value' => 'theme-section-padding-bottom', 'description' => 'Add default (80px) bottom padding to the layout'), array('value' => 'theme-section-white', 'description' => 'Create selected component in white version'))); /******************************************************************************/
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)); }