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 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 lineCreateHTML($dataLine) { $html = null; $Layout = new PBLayout(); $columnCount = $Layout->getLayoutColumnCount($dataLine['data']['layout']); for ($i = 0; $i < $columnCount; $i++) { $componentCount = count($dataLine['column'][$i]['component']); $html .= ' <li class="pb-content-column ' . $Layout->getLayoutColumnCSSClass($dataLine['data']['layout'], $i) . '" id="' . $dataLine['column'][$i]['data']['id'] . '"> <div class="pb-content-column-box"> <div class="pb-content-column-bar pb-clear-fix"> <a href="#" class="pb-content-button pb-content-remove-button" title="' . esc_attr__('Remove all components in this column', PLUGIN_PAGE_BUILDER_DOMAIN) . '"></a> </div> <ul class="pb-reset-list pb-clear-fix"> '; if ($componentCount) { foreach ($dataLine['column'][$i]['component'] as $value) { $html .= $this->componentCreateHTML($value); } } $html .= ' </ul> <div class="pb-content-column-box-caption" style="display:' . ($componentCount ? 'none' : 'block') . '"> <div>' . __('To start creating content,<br/>drag and drop component here', PLUGIN_PAGE_BUILDER_DOMAIN) . '</div> </div> </div> </li> '; } $html = ' <li class="pb-content-line" id="' . $dataLine['data']['id'] . '"> <div class="pb-content-line-bar pb-clear-fix"> <a href="#" class="pb-content-button pb-content-remove-button" title="' . esc_attr__('Remove this layout', PLUGIN_PAGE_BUILDER_DOMAIN) . '"></a> <a href="#" class="pb-content-button pb-content-edit-button" title="' . esc_attr__('Edit this layout', PLUGIN_PAGE_BUILDER_DOMAIN) . '"></a> <a href="#" class="pb-content-button pb-content-clone-button" title="' . esc_attr__('Clone this layout', PLUGIN_PAGE_BUILDER_DOMAIN) . '"></a> <a href="#" class="pb-content-button pb-content-move-up-button" title="' . esc_attr__('Move up/down this layout', PLUGIN_PAGE_BUILDER_DOMAIN) . '"></a> </div> <ul class="pb-content-layout pb-reset-list pb-clear-fix layout-' . $dataLine['data']['layout'] . '"> ' . $html . ' </ul> </li> '; return $html; }
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 processShortcodeContactFormLayoutLine($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $html = null; $Layout = new PBLayout(); $Validation = new PBValidation(); if (!$Layout->isLayout($attribute['layout'])) { return $html; } $columnCount = $Layout->getLayoutColumnCount($attribute['layout']); for ($i = 1; $i <= $columnCount; $i++) { $fieldHTML = null; if (!$Validation->isEmpty($attribute['column_' . $i . '_name'])) { $field = mb_split(',', $attribute['column_' . $i . '_name']); foreach ($field as $fieldValue) { $this->fieldCounter++; $class = array('pb-clear-fix', 'pb-contact-form-field'); $fieldHTML .= ' <div' . PBHelper::createClassAttribute($class) . '>' . $this->createField($fieldValue) . '</div> '; } } $class = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($attribute['layout'], $i - 1), $attribute['column_' . $i . '_css_class']); $html .= ' <li' . PBHelper::createClassAttribute($class) . '>' . $fieldHTML . '</li> '; } $class = array('pb-reset-list', 'pb-clear-fix', $Layout->getLayoutCSSClass($attribute['layout'])); $html = ' <ul' . PBHelper::createClassAttribute($class) . '> ' . $html . ' </ul> '; return PBHelper::formatHTML($html); }
function processShortcodeClassItemAttribute($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $i = 0; $html = null; $Layout = new PBLayout(); $Validation = new PBValidation(); if ($Validation->isEmpty($content)) { return $html; } $line = mb_split("\n", $content); foreach ($line as $value) { $attribute = mb_split(':', $value); if (!isset($attribute[0]) || !isset($attribute[1])) { continue; } if ($Validation->isEmpty($attribute[0]) || $Validation->isEmpty($attribute[1])) { continue; } $html .= ' <li' . PBHelper::createClassAttribute(array('pb-layout-' . $Layout->getLayoutColumnCSSClass('50x50', $i))) . '> <div class="pb-class-item-attribute-value">' . $attribute[1] . '</div> <div class="pb-class-item-attribute-name">' . $attribute[0] . '</div> </li> '; $i++; } if ($Validation->isEmpty($html)) { return $html; } $class = array('pb-reset-list', 'pb-clear-fix', 'pb-class-item-attribute', $Layout->getLayoutCSSClass('50x50'), 'pb-layout-responsive-0'); $html = ' <ul' . PBHelper::createClassAttribute($class) . '> ' . $html . ' </ul> '; return PBHelper::formatHTML($html); }
function processShortcodePricingPlanItem($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 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 processShortcodeFeatureItem($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $html = null; $Layout = new PBLayout(); $this->attrItemURL = $attribute['item_url']; $this->attrItemURLTarget = $attribute['item_url_target']; if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'gr') { if (!array_key_exists($attribute['item_icon'], $this->icon[$this->attrIconSize]['file'])) { return $html; } } $position = $this->attrLayoutColumnIndex % 2 == 0 ? 'even' : 'odd'; $class = array(array('pb-layout-' . $Layout->getLayoutColumnCSSClass($this->attrLayout, $this->attrLayoutColumnIndex), 'pb-feature-element-' . $position), array('pb-feature-icon')); if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'gr') { array_push($class[1], 'pb-feature-icon-' . PBHelper::createHash($attribute['item_icon'])); } $style = $this->style[$position]; $element = array(null, null, null); $element[0] = '<div' . PBHelper::createClassAttribute($class[1]) . PBHelper::createStyleAttribute($style) . '>'; if (PBComponentData::get($this->getComponentId(), 'icon_type') === 'fa') { $styleFontIcon = array(); if (array_key_exists('color', $style)) { $styleFontIcon['color'] = $style['color']; } $element[1] = '<i class="fa fa-' . esc_attr($attribute['item_icon']) . '"' . PBHelper::createStyleAttribute($styleFontIcon) . '></i>'; } $element[2] = '</div>'; $html = ' <li' . PBHelper::createClassAttribute($class[0]) . '> <div> ' . ($this->attrIconPosition != 'bottom' ? join('', $element) : '') . ' ' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . ' ' . ($this->attrIconPosition == 'bottom' ? join('', $element) : '') . ' </div> </li> '; $this->attrLayoutColumnIndex++; return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false)); }
function processShortcodeRecentPost($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $html = null; $Layout = new PBLayout(); $Validation = new PBValidation(); $ImageHover = new PBImageHover(); if (!PBFile::isWPImage($attribute['image_size'])) { return $html; } if (!array_key_exists($attribute['layout'], $this->layout)) { return $html; } if (!array_key_exists($attribute['template'], $this->template)) { return $html; } if (!$Validation->isNumber($attribute['post_count'], 1, 999)) { return $html; } if (!$Validation->isBool($attribute['preloader_enable'])) { 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['date_enable'])) { return $html; } if (!$Validation->isBool($attribute['image_enable'])) { return $html; } if (!$Validation->isBool($attribute['header_enable'])) { return $html; } if (!$Validation->isBool($attribute['author_enable'])) { return $html; } if (!$Validation->isBool($attribute['excerpt_enable'])) { return $html; } if (!$Validation->isBool($attribute['category_enable'])) { return $html; } $option = array(); $key = array('hover_type', 'hover_enable', 'preloader_enable'); foreach ($key as $index) { $option[$index] = $attribute[$index]; } $data = $this->getPost($attribute); if ($data === false) { return null; } if (!count($data->posts)) { return null; } $i = 0; global $post; $bPost = $post; while ($data->have_posts()) { $data->the_post(); $class = array('pb-layout-' . $Layout->getLayoutColumnCSSClass($attribute['layout'], $i)); $meta = array('date' => null, 'comment_count' => null, 'image' => null, 'header' => null, 'excerpt' => null, 'meta' => null); if ($attribute['date_enable']) { $meta['date'] = '<div class="pb-recent-post-date">' . get_the_date() . '</div>'; } if ($attribute['image_enable']) { if (has_post_thumbnail()) { $commentCountHTML = null; if ($attribute['template'] == 1) { if ($attribute['comment_count_enable'] == 1 && comments_open(get_the_id())) { $commentCount = wp_count_comments(get_the_id()); $commentCountHTML = '<div class="pb-recent-post-comment-count"><span class="pb-recent-post-comment-count-value">' . $commentCount->approved . '</span><span class="pb-recent-post-comment-count-arrow"></span></div>'; } } $classImage = array(array('pb-recent-post-image', 'pb-image-box'), array('pb-image')); if ($attribute['preloader_enable'] == 1) { array_push($classImage[0], 'pb-image-preloader', 'pb-image-preloader-animation-enable'); } if ($attribute['hover_enable'] == 1) { array_push($classImage[0], 'pb-image-hover', 'pb-image-hover-type-' . $attribute['hover_type']); } if ($attribute['hover_enable'] == 1) { $meta['image'] = '<a href="' . get_permalink(get_the_ID()) . '"' . PBHelper::createClassAttribute($classImage[1]) . '>' . get_the_post_thumbnail(get_the_ID(), $attribute['image_size']) . '<span><span><span></span></span></span></a>'; } else { $meta['image'] = '<div' . PBHelper::createClassAttribute($classImage[1]) . '>' . get_the_post_thumbnail(get_the_ID(), $attribute['image_size']) . '</div>'; } $meta['image'] = '<div' . PBHelper::createClassAttribute($classImage[0]) . '>' . $meta['image'] . $commentCountHTML . '</div>'; } } if ($attribute['header_enable']) { $meta['header'] = '<h' . PBComponentData::get($this->getComponentId(), 'header_important_default') . ' class="pb-recent-post-header"><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></h' . PBComponentData::get($this->getComponentId(), 'header_important_default') . '>'; } if ($attribute['excerpt_enable']) { $meta['excerpt'] = '<div class="pb-recent-post-excerpt">' . get_the_excerpt() . '</div>'; } if ($attribute['author_enable'] || $attribute['category_enable'] || $attribute['template'] == 2 && $attribute['comment_count_enable'] == 1 && comments_open(get_the_id())) { $authorHTML = null; $categoryHTML = null; $commentCountHTML = null; if ($attribute['author_enable']) { $authorHTML = '<div class="pb-recent-post-meta-author">' . get_the_author() . '</div>'; } $category = get_the_category(get_the_ID()); $count = count($category); if ($count) { foreach ($category as $index => $value) { $separator = $index == $count - 1 ? '' : ', '; $title = $Validation->isEmpty($value->description) ? sprintf(__('View all posts filed under %s', PLUGIN_PAGE_BUILDER_DOMAIN), $value->name) : strip_tags(apply_filters('category_description', $value->description, $value)); $categoryHTML .= '<li><a href="' . get_category_link($value->term_id) . '" title="' . esc_attr($title) . '">' . esc_html($value->name) . '</a>' . $separator . '</li>'; } $categoryHTML = '<div class="pb-recent-post-meta-category"><ul class="pb-reset-list">' . $categoryHTML . '</ul></div>'; } if ($attribute['template'] == 2) { if ($attribute['comment_count_enable'] == 1 && comments_open(get_the_id())) { $commentCount = wp_count_comments(get_the_id()); $commentCountHTML = '<div class="pb-recent-post-meta-comment-count">' . __(sprintf('%d Comments', $commentCount->approved), PLUGIN_PAGE_BUILDER_DOMAIN) . '</div>'; } } $meta['meta'] = '<div class="pb-recent-post-meta pb-clear-fix">' . $authorHTML . $categoryHTML . $commentCountHTML . '</div>'; } $templateHTML = array(); $templateOrder = array('date', 'image', 'header', 'excerpt', 'meta'); if ($attribute['template'] == 2) { $templateOrder = array('image', 'header', 'date', 'excerpt', 'meta'); } foreach ($templateOrder as $value) { if (isset($meta[$value])) { $templateHTML[$value] = $meta[$value]; } } $html .= '<li' . PBHelper::createClassAttribute($class) . '><div>' . implode($templateHTML) . '</div></li>'; $i++; } wp_reset_query(); $post = $bPost; $id = PBHelper::createId('pb_recent_post'); $class = array(); $class[0] = array('pb-recent-post', 'pb-recent-post-template-' . $attribute['template'], $attribute['css_class']); $class[1] = array('pb-clear-fix', 'pb-reset-list', $Layout->getLayoutCSSClass($attribute['layout'])); $html = ' <div' . PBHelper::createClassAttribute($class[0]) . ' id="' . $id . '"> <ul' . PBHelper::createClassAttribute($class[1]) . '> ' . $html . ' </ul> </div> <div class="pb-script-tag"> <script type="text/javascript"> jQuery(document).ready(function($) { $("#' . $id . '").PBRecentPost(' . json_encode($option) . '); }); </script> </div> '; 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 processShortcodeFeatureItem($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $html = null; $Layout = new PBLayout(); $this->attrItemURL = $attribute['item_url']; $this->attrItemURLTarget = $attribute['item_url_target']; if (!array_key_exists($attribute['item_icon'], $this->icon[$this->attrIconSize]['file'])) { return $html; } $position = $this->layoutAttrColumnIndex % 2 == 0 ? 'even' : 'odd'; $class = array(array('pb-layout-' . $Layout->getLayoutColumnCSSClass($this->layoutAttr, $this->layoutAttrColumnIndex), 'pb-feature-element-' . $position), array('pb-feature-icon', 'pb-feature-icon-' . PBHelper::createHash($attribute['item_icon']))); $style = $this->style[$position]; $html = ' <li' . PBHelper::createClassAttribute($class[0]) . '> <div> ' . ($this->attrIconPosition != 'bottom' ? '<div' . PBHelper::createClassAttribute($class[1]) . PBHelper::createStyleAttribute($style) . '></div>' : '') . ' ' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . ' ' . ($this->attrIconPosition == 'bottom' ? '<div' . PBHelper::createClassAttribute($class[1]) . PBHelper::createStyleAttribute($style) . '></div>' : '') . ' </div> </li> '; $this->layoutAttrColumnIndex++; return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false)); }
function processShortcodeTestimonialItem($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $Layout = new PBLayout(); $html = null; $class = array(array('pb-layout-' . $Layout->getLayoutColumnCSSClass($this->layout, $this->layoutColumnIndex)), array('pb-testimonial-cite-up')); $html = ' <li' . PBHelper::createClassAttribute($class[0]) . '> <div> <div' . PBHelper::createClassAttribute($class[1]) . '></div> ' . PLUGIN_PAGE_BUILDER_SHORTCODE_CONTENT . ' </div> </li> '; $this->layoutColumnIndex++; return PBHelper::formatHTML($html, PBHelper::formatContent($content, true, false, false)); }
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)); }