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); }
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 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); }
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 processShortcodeSupersized($attribute, $content, $tag) { $attribute = $this->processAttribute($tag, $attribute); $html = null; $Validation = new PBValidation(); $file = PBFile::getImage(explode(',', $attribute['image'])); if ($file === false) { return $html; } if (!count($file->posts)) { return $html; } if (!$Validation->isBool($attribute['autoplay'])) { return $html; } if (!$Validation->isBool($attribute['fit_always'])) { return $html; } if (!$Validation->isBool($attribute['fit_landscape'])) { return $html; } if (!$Validation->isBool($attribute['fit_portrait'])) { return $html; } if (!$Validation->isBool($attribute['horizontal_center'])) { return $html; } if (!$Validation->isBool($attribute['vertical_center'])) { return $html; } if (!$Validation->isNumber($attribute['min_width'], 0, 99999)) { return $html; } if (!$Validation->isNumber($attribute['min_height'], 0, 99999)) { return $html; } if (!$Validation->isBool($attribute['image_protect'])) { return $html; } if (!$Validation->isBool($attribute['keyboard_nav'])) { return $html; } if (!$Validation->isBool($attribute['new_window'])) { return $html; } if (!$Validation->isBool($attribute['pause_hover'])) { return $html; } if (!$Validation->isBool($attribute['random'])) { return $html; } if (!$Validation->isNumber($attribute['start_slide'], 0, 99999)) { return $html; } if (!$Validation->isBool($attribute['stop_loop'])) { return $html; } if (!array_key_exists($attribute['performance'], $this->performance)) { return $html; } if (!array_key_exists($attribute['transition'], $this->transition)) { return $html; } if (!$Validation->isNumber($attribute['transition_speed'], 0, 99999)) { return $html; } if (!$Validation->isNumber($attribute['slide_interval'], 0, 99999)) { return $html; } $option = array(); $key = array('autoplay', 'fit_always', 'fit_landscape', 'fit_portrait', 'horizontal_center', 'vertical_center', 'min_width', 'min_height', 'image_protect', 'keyboard_nav', 'new_window', 'pause_hover', 'random', 'start_slide', 'stop_loop', 'performance', 'transition', 'transition_speed', 'slide_interval', 'css_class'); foreach ($key as $index) { $option[$index] = $attribute[$index]; } global $post; $bPost = $post; $i = 0; while ($file->have_posts()) { global $post; $file->the_post(); $meta = PBMeta::get($post); PBHelper::removeUIndex($meta, 'media_library_url'); $full = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $option['slides'][$i]['url'] = $meta['media_library_url']; $option['slides'][$i]['image'] = $full[0]; $option['slides'][$i]['title'] = get_the_title(); $i++; } wp_reset_query(); $post = $bPost; $html = ' <div class="pb-script-tag"> <script type="text/javascript"> jQuery(document).ready(function($) { $().PBSupersized(' . json_encode($option) . '); }); </script> </div> '; return PBHelper::formatHTML($html); }