function su_lory_carousel_shortcode($atts, $content = null) { $atts = shortcode_atts(array('source' => 'none', 'limit' => 20, 'autoplay' => 5000, 'speed' => 600, 'random' => true), $atts); $slides = (array) Su_Tools::get_slides($atts); if (!count($slides)) { return; } $id = uniqid('su_lory_carousel_'); $html = ""; if ($atts['random'] != 'no') { shuffle($slides); } foreach ($slides as $s) { $html .= '<li> <div style="background: url(\'' . $s['image'] . '\') center center no-repeat; background-size: cover; width: 100%; height: 15rem"></div> </li>'; } ob_start(); ?> <script src="http://meandmax.github.io/lory/dist/lory.min.js"></script> <div class="js_slider" id="<?php echo $id; ?> "> <div class="js_frame"> <ul class="js_slides"> <?php echo $html; ?> </ul> </div> </div> <style> .js_slider { } .js_slider .js_frame { position: relative; overflow: hidden; white-space: nowrap; font-size: 0; } .js_slider .js_slides li { position: relative; display: inline-block; width: 100%; } </style> <script> document.addEventListener('DOMContentLoaded', function () { var el = document.querySelector('#<?php echo $id; ?> '); var l = lory(el, { infinite: 1, slideSpeed: <?php echo $atts['speed']; ?> }); setInterval(function() { l.next() }, <?php echo $atts['autoplay']; ?> ); }); </script> <?php $return .= ob_get_clean(); return $return; }
public static function device_slider($atts = null, $content = null) { $atts = su_shortcode_atts(array('source' => '', 'limit' => 5, 'device' => 'imac', 'arrows' => 'no', 'pagination' => 'no', 'autoplay' => 'yes', 'autoheight' => 'no', 'delay' => 4, 'speed' => 0.6, 'hoverpause' => 'yes', 'lazyload' => 'no', 'loop' => 'yes', 'lightbox' => 'no', 'margin' => 0, 'scroll_reveal' => '', 'class' => ''), $atts, 'device_slider'); $id = uniqid('suds'); $return = array(); $classes = array('su-device-slider'); if ($atts['lightbox'] === 'yes') { $classes[] = 'has-lightbox'; } // if ($atts['transitionin'] === 'slide') // $atts['transitionin'] = 'false'; $slides = (array) Su_Tools::get_slides($atts); $device = file_exists(BDT_SU_ROOT . DIRECTORY_SEPARATOR . 'shortcodes' . DIRECTORY_SEPARATOR . 'device_slider' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . $atts['device'] . '.png'); if (count($slides)) { $return[] = '<div' . su_scroll_reveal($atts) . ' class="su-device-slider-wrapper su-device-' . $atts['device'] . '">'; $return[] = '<img class="su-device-slider-device" src="' . BDT_SU_URI . '/shortcodes/device_slider/images/' . $atts['device'] . '.png" alt="' . $atts['device'] . '">'; $return[] = '<div id="' . $id . '" class="' . su_acssc($classes) . '" data-autoplay="' . $atts['autoplay'] . '" data-delay="' . $atts['delay'] . '" data-speed="' . $atts['speed'] . '" data-arrows="' . $atts['arrows'] . '" data-pagination="' . $atts['pagination'] . '" data-lazyload="' . $atts['lazyload'] . '" data-loop="' . $atts['loop'] . '" data-hoverpause="' . $atts['hoverpause'] . '">'; $limit = 0; foreach ($slides as $slide) { if ($slide['image']) { if ($limit++ == $atts['limit']) { break; } if ($atts['device'] == 'imac' or $atts['device'] == 'macbook') { $image = su_image_resize($slide['image'], 944, 590); } elseif ($atts['device'] == 'ipad') { $image = su_image_resize($slide['image'], 596, 771); } elseif ($atts['device'] == 'iphone' or $atts['device'] == 'galaxys6') { $image = su_image_resize($slide['image'], 447, 762); } $return[] = '<div class="su-device-slide-item">'; if ($atts['lightbox'] === 'yes') { $return[] = ' <div class="su-device-links"> <a class="su-lightbox-item" href="' . image_media($slide['image']) . '" title="' . strip_tags($slide['title']) . '"><i class="fa fa-search"></i></a> </div>'; } $return[] = '<img src="' . image_media($image['url']) . '" alt="' . esc_attr($slide['title']) . '" />'; $return[] = '</div>'; } } $return[] = '</div>'; $return[] = '</div>'; suAsset::addFile('css', 'owl.carousel.css'); suAsset::addFile('css', 'device_slider.css', __FUNCTION__); suAsset::addFile('js', 'owl.carousel.min.js'); suAsset::addFile('js', 'device_slider.js', __FUNCTION__); if ($atts['lightbox'] === 'yes') { suAsset::addFile('css', 'magnific-popup.css'); suAsset::addFile('js', 'magnific-popup.js'); } return implode('', $return); } else { return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_DEVICE_SLIDER_ERROR'), 'warning'); } }
public static function photo_gallery($atts = null, $content = null) { $return = ''; $atts = su_shortcode_atts(array('style' => 1, 'source' => '', 'limit' => 20, 'width' => 250, 'height' => 160, 'thumb_resize' => 'yes', 'large' => 4, 'medium' => 3, 'small' => 1, 'horizontal_gap' => 10, 'vertical_gap' => 10, 'quality' => 95, 'effect' => '', 'order' => 'created', 'order_by' => 'desc', 'scroll_reveal' => '', 'class' => ''), $atts, 'photo_gallery'); $slides = (array) Su_Tools::get_slides($atts); $thumb_resize_check = $atts['thumb_resize'] === 'yes' ? true : false; if (count($slides)) { $lightbox_effect = $atts['effect'] ? 'data-mfp-effect="' . $atts['effect'] . '"' : ''; $id = uniqid('supg'); $return = '<div id="' . $id . '"' . su_scroll_reveal($atts) . ' class="su-photo-gallery su-photo-gallery-style-' . $atts['style'] . '' . su_ecssc($atts) . '" data-pgid="' . $id . '" data-large="' . $atts['large'] . '" data-medium="' . $atts['medium'] . '" data-small="' . $atts['small'] . '" data-horizontal_gap="' . intval($atts['horizontal_gap']) . '" data-vertical_gap="' . intval($atts['vertical_gap']) . '" >'; $return .= '<div id="' . $id . '_container" class="cbp-l-grid-gallery">'; $limit = 0; foreach ($slides as $slide) { if ($slide['image']) { if ($limit++ == $atts['limit']) { break; } $image = su_image_resize($slide['image'], $atts['width'], $atts['height'], $thumb_resize_check, $atts['quality']); $return .= '<div class="su-photo-gallery-slide cbp-item">'; $return .= '<div class="su-pg-item">'; if ($slide['link']) { $return .= '<div class="su-photo-gallery-links"> <a class="su-lightbox-item" ' . $lightbox_effect . ' href="' . image_media($slide['image']) . '" title="' . strip_tags($slide['title']) . '"><i class="fa fa-search"></i></a> </div>'; } $return .= '<img src="' . image_media($image['url']) . '" alt="' . esc_attr($slide['title']) . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" />'; $return .= '</div>'; $return .= '</div>'; } } $return .= '<div class="su-clear"></div>'; $return .= '</div>'; $return .= '</div>'; suAsset::addFile('css', 'magnific-popup.css'); suAsset::addFile('js', 'magnific-popup.js'); suAsset::addFile('css', 'cubeportfolio.min.css'); suAsset::addFile('js', 'cubeportfolio.min.js'); suAsset::addFile('css', 'photo_gallery.css', __FUNCTION__); suAsset::addFile('js', 'photo_gallery.js', __FUNCTION__); } else { $return = alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_IMAGE_GALLERY_NOT_WORK'), 'warning'); } return $return; }
public static function custom_gallery($atts = null, $content = null) { $return = ''; $atts = shortcode_atts(array('source' => 'none', 'limit' => 20, 'gallery' => null, 'link' => 'none', 'width' => 90, 'height' => 90, 'title' => 'hover', 'target' => 'self', 'class' => ''), $atts, 'custom_gallery'); $slides = (array) Su_Tools::get_slides($atts); // Loop slides if (count($slides)) { // Prepare links target $atts['target'] = $atts['target'] === 'yes' || $atts['target'] === 'blank' ? ' target="_blank"' : ''; // Add lightbox class if ($atts['link'] === 'lightbox') { $atts['class'] .= ' su-lightbox-gallery'; } // Open gallery $return = '<div class="su-custom-gallery su-custom-gallery-title-' . $atts['title'] . su_ecssc($atts) . '">'; // Create slides foreach ($slides as $slide) { // Crop image $image = su_image_resize($slide['image'], $atts['width'], $atts['height']); // Prepare slide title $title = $slide['title'] ? '<span class="su-custom-gallery-title">' . stripslashes($slide['title']) . '</span>' : ''; // Open slide $return .= '<div class="su-custom-gallery-slide">'; // Slide content with link if ($slide['link']) { $return .= '<a href="' . $slide['link'] . '"' . $atts['target'] . '><img src="' . $image['url'] . '" alt="' . esc_attr($slide['title']) . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" />' . $title . '</a>'; } else { $return .= '<a><img src="' . $image['url'] . '" alt="' . esc_attr($slide['title']) . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" />' . $title . '</a>'; } // Close slide $return .= '</div>'; } // Clear floats $return .= '<div class="su-clear"></div>'; // Close gallery $return .= '</div>'; // Add lightbox assets if ($atts['link'] === 'lightbox') { su_query_asset('css', 'magnific-popup'); su_query_asset('js', 'jquery'); su_query_asset('js', 'magnific-popup'); su_query_asset('js', 'su-galleries-shortcodes'); } su_query_asset('css', 'su-galleries-shortcodes'); } else { $return = Su_Tools::error(__FUNCTION__, __('images not found', 'su')); } return $return; }
function load_item($atts = null) { $atts = su_shortcode_atts(array('source' => isset($_REQUEST["source"]) ? $_REQUEST["source"] : null, 'layout' => isset($_REQUEST["layout"]) ? $_REQUEST["layout"] : null, 'item_link' => isset($_REQUEST["item_link"]) ? $_REQUEST["item_link"] : null, 'limit' => isset($_REQUEST["limit"]) ? $_REQUEST["limit"] : null, 'order' => isset($_REQUEST["order"]) ? $_REQUEST["order"] : null, 'order_by' => isset($_REQUEST["order_by"]) ? $_REQUEST["order_by"] : null, 'thumb_resize' => isset($_REQUEST["thumb_resize"]) ? $_REQUEST["thumb_resize"] : null, 'thumb_width' => isset($_REQUEST["thumb_width"]) ? $_REQUEST["thumb_width"] : null, 'thumb_height' => isset($_REQUEST["thumb_height"]) ? $_REQUEST["thumb_height"] : null, 'show_more_item' => isset($_REQUEST["show_more_item"]) ? $_REQUEST["show_more_item"] : null, 'include_article_image' => isset($_REQUEST["include_article_image"]) ? $_REQUEST["include_article_image"] : null, 'popup_image' => isset($_REQUEST["popup_image"]) ? $_REQUEST["popup_image"] : null, 'popup_category' => isset($_REQUEST["popup_category"]) ? $_REQUEST["popup_category"] : null, 'popup_date' => isset($_REQUEST["popup_date"]) ? $_REQUEST["popup_date"] : null, 'offset' => isset($_REQUEST["offset"]) ? $_REQUEST["offset"] : null), $atts); $slides = (array) Su_Tools::get_slides($atts); $return = array(); $item_block = 0; $block = 1; if (preg_match('/k2-category/', $atts['source'])) { $source = 'k2'; } else { $source = 'article'; } if ($atts['item_link'] === 'inline') { $item_link_class = 'cbp-singlePageInline'; $page = 'data-url="' . JRoute::_('index.php?option=com_bdthemes_shortcodes&view=item&layout=inline') . '"'; } elseif ($atts['item_link'] === 'single') { $item_link_class = 'cbp-singlePage'; $page = 'data-url="' . JRoute::_('index.php?option=com_bdthemes_shortcodes&view=item&layout=single') . '"'; } elseif ($atts['item_link'] === 'link') { $item_link_class = 'cbp-linkPage'; $page = ''; } else { $item_link_class = 'cbp-linkNoPage'; $page = ''; } $thumb_resize_check = ($atts['thumb_resize'] === 'yes' and ($atts['layout'] != 'mosaic' or $atts['layout'] != 'masonry')) ? true : false; foreach ((array) $slides as $slide) { $thumb_url = su_image_resize($slide['image'], $atts['thumb_width'], $atts['thumb_height'], $thumb_resize_check, 95); // Title condition if ($slide['title']) { $title = stripslashes($slide['title']); } $category = su_title_class($slide['category']); $item_link = $atts['item_link'] != 'no' ? JRoute::_($slide['link']) : 'javascript:void(0);'; if ($item_block % $atts['show_more_item'] == 0) { $return[] = $item_block > 0 ? "</div>" : ""; // close div if it's not the first $return[] = '<div class="cbp-loadMore-block' . $block . '">'; $block++; } $return[] = '<div class="cbp-item ' . $category . '"> <a data-id="' . $slide['id'] . '" data-source = "' . $source . '" data-include_article_image = "' . $atts['include_article_image'] . '" data-popup_image = "' . $atts['popup_image'] . '" data-popup_category = "' . $atts['popup_category'] . '" data-popup_date = "' . $atts['popup_date'] . '" href="' . $item_link . '" ' . $page . ' class="cbp-caption ' . $item_link_class . '" data-title="' . $title . ' // ' . $slide['category'] . '"> <div class="cbp-caption-defaultWrap">'; if (isset($thumb_url['url'])) { $return[] = '<img src="' . image_media($thumb_url['url']) . '" alt="' . $title . '">'; } else { $return[] = '<img src="' . image_media(BDT_SU_IMG . 'no-image.svg') . '" alt="' . $title . '">'; } $return[] = '</div> <div class="cbp-caption-activeWrap"> <div class="cbp-l-caption-alignLeft"> <div class="cbp-l-caption-body"> <div class="cbp-l-caption-title">' . $title . '</div> <div class="cbp-l-caption-desc">' . $slide['category'] . '</div> </div> </div> </div> </a> </div>'; $item_block++; } return implode('', $return); }
public static function faq($atts = null, $content = null) { $atts = su_shortcode_atts(array('id' => uniqid('suf'), 'source' => '', 'limit' => 20, 'order' => 'created', 'order_by' => 'desc', 'loading_animation' => 'default', 'filter_animation' => 'sequentially', 'display_speed' => 200, 'scroll_reveal' => '', 'class' => ''), $atts, 'faq'); $slides = (array) Su_Tools::get_slides($atts); $intro_text = ''; $title = ''; $return = ''; if (count($slides)) { $return[] = ' <div' . su_scroll_reveal($atts) . ' id="' . $atts['id'] . '" class="su-faq ' . su_ecssc($atts) . '" data-scid="' . $atts['id'] . '" data-loading_animation="' . $atts['loading_animation'] . '" data-filter_animation="' . $atts['filter_animation'] . '" data-display_speed="' . $atts['display_speed'] . '"> <div id="' . $atts['id'] . '_filter" class="cbp-l-filters-underline"> <div data-filter="*" class="cbp-filter-item-active cbp-filter-item"> ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_ALL') . ' </div>'; $category = array(); foreach ((array) $slides as $slide) { if (in_array($slide['category'], $category)) { continue; } $category[] = $slide['category']; $return[] = '<div class="cbp-filter-item" data-filter=".' . str_replace(' ', '-', strtolower($slide['category'])) . '">' . $slide['category'] . '</div>'; } // if ($atts['show_search'] === 'yes') { // $return[] ='<div class="cbp-search cbp-l-filters-right"> // <input id="'.$atts['id']. '_search" type="text" placeholder="'.JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_FAQ_SEARCH').'" data-search="" class="cbp-search-input"> // <div class="cbp-search-icon"></div> // </div>'; // } $return[] = '</div> <div id="' . $atts['id'] . '_container" class="cbp cbp-l-grid-faq">'; $limit = 1; foreach ((array) $slides as $slide) { // Title condition $title = $slide['title']; $icon = $title ? explode('|| fa-', $title) : array(); if (count($icon) == 2) { $title = trim($icon[0]); $icon = '<i class="fa fa-' . trim($icon[1]) . '"></i>'; } else { $title = $slide['title']; $icon = '<i class="fa fa-question-circle"></i>'; } $isReadmore = $slide['fulltext'] ? '<div class="su-readmore"><a href="' . $slide['link'] . '">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_READMORE') . '</a></div>' : ''; $category = str_replace(' ', '-', strtolower($slide['category'])); $return[] = ' <div class="cbp-item ' . $category . '"> <div class="cbp-caption"> <div class="cbp-caption-defaultWrap"> ' . $icon . $title . ' </div> <div class="cbp-caption-activeWrap"> <div class="cbp-l-caption-body"> ' . su_do_shortcode($slide['introtext']) . $isReadmore . ' </div> </div> </div> </div>'; if ($limit++ == $atts['limit']) { break; } } $return[] = '<div class="clearfix"></div></div></div>'; suAsset::addFile('css', 'cubeportfolio.min.css'); suAsset::addFile('js', 'cubeportfolio.min.js'); suAsset::addFile('css', 'faq.css', __FUNCTION__); suAsset::addFile('js', 'faq.js', __FUNCTION__); return implode('', $return); } else { return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_FAQ_ERROR'), 'warning'); } }
public static function carousel($atts = null, $content = null) { $return = ''; $atts = su_shortcode_atts(array('style' => '1', 'source' => '', 'limit' => 5, 'order' => 'created', 'order_by' => 'desc', 'items' => 4, 'large' => 4, 'medium' => 3, 'small' => 1, 'image' => 'yes', 'quality' => 95, 'title' => 'yes', 'title_link' => 'yes', 'title_limit' => '', 'intro_text' => 'yes', 'intro_text_limit' => '60', 'background' => '', 'color' => '', 'title_color' => '', 'date' => 'no', 'category' => 'no', 'image_width' => 360, 'image_height' => 320, 'thumb_resize' => 'yes', 'margin' => 10, 'scroll' => 1, 'arrows' => 'no', 'arrow_position' => 'default', 'pagination' => 'yes', 'autoplay' => 'yes', 'delay' => 4, 'speed' => 0.35, 'hoverpause' => 'no', 'lazyload' => 'no', 'loop' => 'yes', 'scroll_reveal' => '', 'class' => ''), $atts, 'carousel'); $id = uniqid('suc'); $title = ""; $image = ""; $intro_text = ''; $css[] = ''; $background = ''; $color = ''; $date = ''; $category = ''; $lang = JFactory::getLanguage(); $lang = $lang->isRTL() ? 'true' : 'false'; $slides = (array) Su_Tools::get_slides($atts); $atts['items'] = $atts['large'] != 4 ? $atts['large'] : $atts['items']; $css[] = '#' . $id . '.su-carousel-style-3 .su-carousel-caption:after {border-bottom-color: ' . $atts['background'] . ';}'; if ($atts['background'] or $atts['color']) { $background = $atts['background'] ? 'background-color:' . $atts['background'] . ';' : ''; $color = $atts['color'] ? 'color:' . $atts['color'] . ';' : ''; $css[] = '#' . $id . ' .su-carousel-slide {' . $background . $color . '}'; } $thumb_resize_check = $atts['thumb_resize'] === 'yes' ? true : false; if ($atts['title_color']) { $css[] = '#' . $id . ' .su-carousel-slide .su-carousel-slide-title a {color: ' . $atts['title_color'] . ';}'; $css[] = '#' . $id . ' .su-carousel-slide .su-carousel-slide-title a:hover {color: ' . su_color::lighten($atts['title_color'], '10%') . ';}'; } if (count($slides) and ($atts['title'] == 'yes' or $atts['image'] == 'yes' or $atts['intro_text'] === 'yes')) { $source = substr($atts['source'], 0, 5); if ($source == 'media') { $atts['class'] .= ' su-carousel-media'; } $return[] = '<div id="' . $id . '"' . su_scroll_reveal($atts) . ' class="su-carousel su-carousel-style-' . $atts['style'] . ' su-carousel-title-' . $atts['title'] . ' arrow-' . $atts['arrow_position'] . ' ' . su_ecssc($atts) . '" data-autoplay="' . $atts['autoplay'] . '" data-delay="' . $atts['delay'] . '" data-speed="' . $atts['speed'] . '" data-arrows="' . $atts['arrows'] . '" data-pagination="' . $atts['pagination'] . '" data-lazyload="' . $atts['lazyload'] . '" data-hoverpause="' . $atts['hoverpause'] . '" data-items="' . $atts['items'] . '" data-medium="' . $atts['medium'] . '" data-small="' . $atts['small'] . '" data-margin="' . $atts['margin'] . '" data-scroll="' . $atts['scroll'] . '" data-loop="' . $atts['loop'] . '" data-rtl="' . $lang . '" ><div class="su-carousel-slides">'; $limit = 1; foreach ((array) $slides as $slide) { $image_url = su_image_resize($slide['image'], $atts['image_width'], $atts['image_height'], $thumb_resize_check, $atts['quality']); if ($atts['title'] == 'yes' && $slide['title']) { $title = stripslashes($slide['title']); if ($atts['title_limit']) { $title = su_char_limit($title, $atts['title_limit']); } if ($atts['title_link'] == "yes") { $title = '<a href="' . $slide['link'] . '">' . $title . '</a>'; } $title = '<h3 class="su-carousel-slide-title">' . $title . '</h3>'; } if ($atts['date'] === 'yes') { $date = JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')); $date = '<div class="su-cdate">' . $date . '</div>'; } if ($atts['category'] === 'yes') { $category = '<div class="su-ccategory">' . $slide['category'] . '</div>'; } if ($atts['intro_text'] === 'yes' and isset($slide['introtext'])) { $intro_text = $slide['introtext']; if ($atts['intro_text_limit']) { $intro_text = su_char_limit($intro_text, $atts['intro_text_limit']); } $intro_text = '<div class="su-carousel-item-text">' . su_do_shortcode($intro_text) . '</div>'; } $return[] = '<div class="su-carousel-slide">'; if (isset($image_url) && $atts['image'] == 'yes') { $return[] = '<div class="su-carousel-image">'; if (isset($image_url)) { $return[] = '<div class="su-carousel-links"> <a class="su-lightbox-item" href="' . image_media($slide['image']) . '" title="' . strip_tags($title) . '"> <i class="fa fa-search"></i> </a>'; if ($source != 'media') { $return[] = '<a class="su-carousel-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '"> <i class="fa fa-link"></i> </a>'; } $return[] = '</div>'; } $return[] = '<img src="' . image_media($image_url['url']) . '" alt="' . strip_tags($title) . '" />'; $return[] = '</div>'; } if ($title or $intro_text) { $return[] = '<div class="su-carousel-caption">' . $title . '<div class="su-cmeta">' . $date . $category . '</div>' . $intro_text . '</div>'; } $return[] = '</div>'; if ($limit++ == $atts['limit']) { break; } } $return[] = '</div>'; $return[] = '</div>'; suAsset::addString('css', implode("\n", $css)); suAsset::addFile('css', 'magnific-popup.css'); suAsset::addFile('js', 'magnific-popup.js'); suAsset::addFile('css', 'owl.carousel.css'); suAsset::addFile('js', 'owl.carousel.min.js'); suAsset::addFile('css', 'carousel.css', __FUNCTION__); suAsset::addFile('js', 'carousel.js', __FUNCTION__); } else { return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_CAROUSEL_INF'), 'warning'); } return implode("", $return); }
public static function showcase($atts = null, $content = null) { $atts = su_shortcode_atts(array('source' => '', 'limit' => 12, 'show_more' => 'no', 'layout' => 'grid', 'show_more_item' => 4, 'show_more_action' => 'click', 'item_link' => 'inline', 'order' => 'created', 'order_by' => 'desc', 'loading_animation' => 'default', 'filter_animation' => 'rotateSides', 'caption_style' => 'overlayBottomPush', 'horizontal_gap' => 10, 'vertical_gap' => 10, 'filter' => 'yes', 'filter_style' => 1, 'filter_deeplink' => 'no', 'filter_align' => '', 'filter_counter' => 'yes', 'page_deeplink' => 'no', 'popup_position' => 'below', 'popup_category' => 'yes', 'popup_date' => 'yes', 'popup_image' => 'yes', 'include_article_image' => 'no', 'large' => 4, 'medium' => 3, 'small' => 1, 'thumb_resize' => 'yes', 'thumb_width' => 640, 'thumb_height' => 480, 'scroll_reveal' => '', 'class' => ''), $atts, 'showcase'); $slides = (array) Su_Tools::get_slides($atts); $id = uniqid('susc'); $intro_text = ''; $title = ''; $return = array(); $atts['filter_deeplink'] = $atts['filter_deeplink'] === 'yes' ? 'true' : 'false'; $atts['page_deeplink'] = $atts['page_deeplink'] === 'yes' ? 'true' : 'false'; $lang = JFactory::getLanguage(); $filter_align = $atts['filter_align'] ? 'su-showcase-filter-align-' . $atts['filter_align'] : ''; $filter_counter = ''; if ($atts['layout'] === 'mosaic') { $layout = ' data-layout="mosaic"'; } elseif ($atts['layout'] === 'slider') { $layout = ' data-layout="slider"'; } else { $layout = ' data-layout="grid"'; } if ($atts['item_link'] === 'inline') { $item_link_class = 'cbp-singlePageInline'; $page = 'data-url="' . JRoute::_('index.php?option=com_bdthemes_shortcodes&view=item&layout=inline') . '"'; } elseif ($atts['item_link'] === 'single') { $item_link_class = 'cbp-singlePage'; $page = 'data-url="' . JRoute::_('index.php?option=com_bdthemes_shortcodes&view=item&layout=single') . '"'; } elseif ($atts['item_link'] === 'link') { $item_link_class = 'cbp-linkPage'; $page = ''; } else { $item_link_class = 'cbp-linkNoPage'; $page = ''; } $thumb_resize_check = ($atts['thumb_resize'] === 'yes' and $atts['layout'] != 'mosaic') ? true : false; if ($atts['filter_counter'] == 'yes') { if ($atts['filter_style'] == 1) { $filter_counter = ' (<div class="cbp-filter-counter"></div> ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_ITEMS') . ')'; } elseif ($atts['filter_style'] == 3 or $atts['filter_style'] == 8) { $filter_counter = ' (<div class="cbp-filter-counter"></div>)'; } else { $filter_counter = '<div class="cbp-filter-counter"></div>'; } } if (preg_match('/k2-category/', $atts['source'])) { $source = 'k2'; } else { $source = 'article'; } if (count($slides)) { suAsset::addFile('css', 'cubeportfolio.min.css'); suAsset::addFile('js', 'cubeportfolio.min.js'); $return[] = '<div id="' . $id . '"' . su_scroll_reveal($atts) . ' class="su-showcase ' . su_ecssc($atts) . $filter_align . '" data-scid="' . $id . '"' . $layout . ' data-loading_animation="' . $atts['loading_animation'] . '" data-filter_animation="' . $atts['filter_animation'] . '" data-caption_style="' . $atts['caption_style'] . '" data-horizontal_gap="' . intval($atts['horizontal_gap']) . '" data-vertical_gap="' . intval($atts['vertical_gap']) . '" data-popup_position="' . $atts['popup_position'] . '" data-large="' . $atts['large'] . '" data-medium="' . $atts['medium'] . '" data-small="' . $atts['small'] . '" data-filter_deeplink="' . $atts['filter_deeplink'] . '" data-page_deeplink="' . $atts['page_deeplink'] . '" data-loadmoreaction="' . $atts['show_more_action'] . '" >'; if ($atts['filter'] !== 'no' and $atts['filter_style'] == 1 and $atts['layout'] != 'slider') { $return[] = '<div id="' . $id . '_filter" class="cbp-l-filters-dropdown"> <div class="cbp-l-filters-dropdownWrap"> <div class="cbp-l-filters-dropdownHeader">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_SORT') . '</div> <div class="cbp-l-filters-dropdownList"> <div data-filter="*" class="cbp-filter-item-active cbp-filter-item"> ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_ALL') . $filter_counter . ' </div>'; $category = array(); foreach ((array) $slides as $slide) { if (in_array($slide['category'], $category)) { continue; } $category[] = $slide['category']; $return[] = '<div class="cbp-filter-item" data-filter=".' . su_title_class($slide['category']) . '">' . $slide['category'] . ' (<div class="cbp-filter-counter"></div> ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_ITEMS') . ')</div>'; } $return[] = '</div> </div> </div>'; } if ($atts['filter'] !== 'no' and $atts['filter_style'] != 1 and $atts['layout'] != 'slider') { if ($atts['filter_style'] == 2) { $filter_style = 'cbp-l-filters-button'; } elseif ($atts['filter_style'] == 3) { $filter_style = 'cbp-l-filters-alignLeft'; } elseif ($atts['filter_style'] == 4) { $filter_style = 'cbp-l-filters-alignCenter'; } elseif ($atts['filter_style'] == 5) { $filter_style = 'cbp-l-filters-alignRight'; } elseif ($atts['filter_style'] == 6) { $filter_style = 'cbp-l-filters-buttonCenter'; } elseif ($atts['filter_style'] == 7) { $filter_style = 'cbp-l-filters-work'; } elseif ($atts['filter_style'] == 8) { $filter_style = 'cbp-l-filters-list'; } elseif ($atts['filter_style'] == 9) { $filter_style = 'cbp-l-filters-text new_filter'; } $return[] = '<div id="' . $id . '_filter" class="' . $filter_style . '"> <div data-filter="*" class="cbp-filter-item-active cbp-filter-item"> ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_ALL') . $filter_counter . ' </div>'; $category = array(); foreach ((array) $slides as $slide) { if (in_array($slide['category'], $category)) { continue; } $category[] = $slide['category']; $return[] = '<div class="cbp-filter-item" data-filter=".' . su_title_class($slide['category']) . '">' . $slide['category'] . $filter_counter . '</div>'; } $return[] = ' </div>'; } $return[] = '<div id="' . $id . '_container" class="cbp-l-grid-gallery">'; $limit = 1; foreach ((array) $slides as $slide) { $thumb_url = su_image_resize($slide['image'], $atts['thumb_width'], $atts['thumb_height'], $thumb_resize_check, 95); // Title condition if ($slide['title']) { $title = stripslashes($slide['title']); } $category = su_title_class($slide['category']); $item_link = $atts['item_link'] != 'no' ? JRoute::_($slide['link']) : 'javascript:void(0);'; $return[] = ' <div class="cbp-item ' . $category . '"> <a data-id="' . $slide['id'] . '" data-source = "' . $source . '" data-include_article_image = "' . $atts['include_article_image'] . '" data-popup_image = "' . $atts['popup_image'] . '" data-popup_category = "' . $atts['popup_category'] . '" data-popup_date = "' . $atts['popup_date'] . '" href="' . $item_link . '" ' . $page . ' class="cbp-caption ' . $item_link_class . '" data-title="' . $title . ' // ' . $slide['category'] . '"> <div class="cbp-caption-defaultWrap">'; if (isset($thumb_url['url'])) { $return[] = '<img src="' . image_media($thumb_url['url']) . '" alt="' . $title . '">'; } else { $return[] = '<img src="' . image_media(BDT_SU_IMG . 'no-image.svg') . '" alt="' . $title . '">'; } $return[] = '</div> <div class="cbp-caption-activeWrap"> <div class="cbp-l-caption-alignLeft"> <div class="cbp-l-caption-body"> <div class="cbp-l-caption-title">' . $title . '</div> <div class="cbp-l-caption-desc">' . $slide['category'] . '</div> </div> </div> </div> </a> </div>'; if ($limit++ == $atts['limit']) { break; } } $return[] = '</div><div class="clearfix"></div>'; if ($atts['show_more'] === 'yes' and $atts['layout'] != 'slider') { $return[] = '<div id="' . $id . '_btn" class="cbp-l-loadMore-button"> <a data-id="' . $id . '" href="' . JRoute::_('index.php?option=com_bdthemes_shortcodes&view=item&layout=default') . '" class="cbp-l-loadMore-link" rel="nofollow"> <span class="cbp-l-loadMore-defaultText">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_LOAD_MORE') . '</span> <span class="cbp-l-loadMore-loadingText">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_LOADING') . '</span> <span class="cbp-l-loadMore-noMoreLoading">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_NO_MORE') . '</span> </a> <script type="text/javascript"> var tdata = tdata || []; tdata["' . $id . '"] = ' . json_encode($atts) . '; tdata["' . $id . '"]["offset"] =' . $atts["limit"] . ' </script> </div>'; suAsset::addFile('js', 'cbploadmore.js'); } $return[] = '</div>'; suAsset::addFile('css', 'showcase.css', __FUNCTION__); suAsset::addFile('js', 'showcase.js', __FUNCTION__); return implode('', $return); } else { return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SHOWCASE_ERROR'), 'warning'); } }
public static function timeline($atts = null, $content = null) { $atts = su_shortcode_atts(array('source' => '', 'limit' => 20, 'image' => 'yes', 'title' => 'yes', 'link_title' => 'yes', 'intro_text' => 'yes', 'date' => 'yes', 'time' => 'yes', 'read_more' => 'no', 'order' => 'created', 'order_by' => 'desc', 'highlight_year' => 'yes', 'icon_bg' => '', 'before_text' => '', 'after_text' => '', 'scroll_reveal' => '', 'class' => ''), $atts, 'timeline'); $slides = (array) Su_Tools::get_slides($atts); $return = ''; if ($atts['before_text']) { $return .= '<div class="su-timeline-before-text"><span>' . $atts['before_text'] . '</span></div>'; } $date = date('Y'); $return .= '<div' . su_scroll_reveal($atts) . ' class="su-timeline animated ' . su_ecssc($atts) . '">'; if (count($slides)) { $limit = 1; foreach ($slides as $slide) { $title = $slide['title']; $icon = $title ? explode('|| fa-', $title) : array(); if (count($icon) == 2) { $title = trim($icon[0]); $icon = '<i class="fa fa-' . trim($icon[1]) . '"></i>'; } else { $title = $slide['title']; $icon = '<i class="fa fa-circle"></i>'; } $has_icon = ''; if (isset($icon[1])) { $has_icon = 'has-ta-icon'; } $icon_bg = $atts['icon_bg'] ? 'style="background-color:' . $atts['icon_bg'] . ';"' : ''; if ($date != JHTML::_('date', $slide['created'], "Y") && $atts['highlight_year'] == 'yes') { $return .= '<div class="su-timeline-row su-timeline-has-year">' . "\n"; $date = JHTML::_('date', $slide['created'], "Y"); $return .= '<div class="su-timeline-year"><span>' . "\n"; $return .= $date . "\n"; $return .= '</span></div>' . "\n"; } else { $return .= '<div class="su-timeline-row">' . "\n"; } $return .= '<div class="su-timeline-icon ' . $has_icon . '"><div class="bg-primary" ' . $icon_bg . '>' . $icon . '</div></div>'; $return .= '<div class="su-timeline-time">'; if ($atts['date'] == 'yes') { $return .= '<small>' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . '</small>'; } if ($atts['time'] == 'yes') { $return .= JHTML::_('date', $slide['created'], "g:i A"); } $return .= '</div>'; $return .= '<div class="su-timeline-content">' . "\n"; $return .= '<div class="su-timeline-content-body">' . "\n"; if ($atts['title'] === 'yes' and isset($slide['title'])) { $return .= '<h3 class="su-timeline-item-title">'; if ($atts['link_title'] === 'yes') { $return .= '<a href="' . image_media($slide['link']) . '">'; } $return .= $title; if ($atts['link_title'] === 'yes') { $return .= '</a>'; } $return .= '</h3>'; } if ($slide['image'] and $atts['image'] === 'yes') { $return .= '<div class="su-timeline-item-image"><img src="' . image_media($slide['image']) . '" alt="" /></div>'; } if ($atts['intro_text'] === 'yes' and isset($slide['introtext'])) { $return .= '<div class="su-timeline-item-text">' . su_do_shortcode($slide['introtext']) . '</div>'; } if ($atts['read_more'] === 'yes') { $return .= '<a class="su-timeline-readmore readon" href="' . image_media($slide['link']) . '">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_READMORE') . '</a>'; } $return .= '</div>' . "\n"; $return .= '</div>' . "\n"; $return .= '</div>' . "\n"; if ($limit++ == $atts['limit']) { break; } } $return .= '</div>'; if ($atts['after_text']) { $return .= '<div class="su-timeline-after-text"><span>' . $atts['after_text'] . '</span></div>'; } suAsset::addFile('css', 'timeline.css', __FUNCTION__); suAsset::addFile('js', 'timeline.js', __FUNCTION__); } else { $return .= alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_TIMELINE_NOT_WORK'), 'warning'); } return $return; }
public static function post_grid($atts = null, $content = null) { $atts = su_shortcode_atts(array('source' => '', 'limit' => 12, 'layout' => 'grid', 'show_more' => 'no', 'intro_text_limit' => 105, 'show_more_item' => 4, 'show_more_action' => 'click', 'order' => 'created', 'order_by' => 'desc', 'loading_animation' => 'sequentially', 'filter_animation' => 'rotateSides', 'caption_style' => 'overlayBottomPush', 'horizontal_gap' => 35, 'vertical_gap' => 15, 'filter' => 'yes', 'filter_style' => 2, 'filter_deeplink' => 'no', 'filter_align' => '', 'filter_counter' => 'yes', 'category' => 'yes', 'date' => 'yes', 'large' => 4, 'medium' => 3, 'small' => 1, 'thumb_resize' => 'yes', 'include_article_image' => 'yes', 'thumb_width' => 640, 'thumb_height' => 480, 'show_search' => 'no', 'scroll_reveal' => '', 'class' => ''), $atts, 'post_grid'); $slides = (array) Su_Tools::get_slides($atts); $id = uniqid('supg'); $intro_text = ''; $title = ''; $return = array(); $atts['filter_deeplink'] = $atts['filter_deeplink'] === 'yes' ? 'true' : 'false'; $lang = JFactory::getLanguage(); $filter_align = $atts['filter_align'] ? 'su-post-grid-filter-align-' . $atts['filter_align'] : ''; $filter_counter = ''; if ($atts['layout'] === 'mosaic') { $layout = ' data-layout="mosaic"'; } elseif ($atts['layout'] === 'masonry') { $layout = ' data-layout="grid"'; } elseif ($atts['layout'] === 'slider') { $layout = ' data-layout="slider"'; } else { $layout = ' data-layout="grid"'; } if ($atts['filter_counter'] == 'yes') { if ($atts['filter_style'] == 1) { $filter_counter = ' (<div class="cbp-filter-counter"></div> ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_POST_GRID_ITEMS') . ')'; } elseif ($atts['filter_style'] == 3) { $filter_counter = ' (<div class="cbp-filter-counter"></div>)'; } else { $filter_counter = '<div class="cbp-filter-counter"></div>'; } } $thumb_resize_check = ($atts['thumb_resize'] === 'yes' and ($atts['layout'] != 'mosaic' or $atts['layout'] != 'masonry')) ? true : false; if (count($slides)) { suAsset::addFile('css', 'cubeportfolio.min.css'); suAsset::addFile('js', 'cubeportfolio.min.js'); $return[] = '<div id="' . $id . '" class="su-post-grid ' . su_ecssc($atts) . $filter_align . '" data-pgid="' . $id . '"' . $layout . ' data-loading_animation="' . $atts['loading_animation'] . '" data-filter_animation="' . $atts['filter_animation'] . '" data-caption_style="' . $atts['caption_style'] . '" data-horizontal_gap="' . intval($atts['horizontal_gap']) . '" data-vertical_gap="' . intval($atts['vertical_gap']) . '" data-large="' . $atts['large'] . '" data-medium="' . $atts['medium'] . '" data-small="' . $atts['small'] . '" data-filter_deeplink="' . $atts['filter_deeplink'] . '" data-loadmoreaction="' . $atts['show_more_action'] . '"' . su_scroll_reveal($atts) . '>'; if ($atts['filter'] !== 'no' && $atts['filter_style'] == 1) { $return[] = '<div id="' . $id . '_filter" class="cbp-l-filters-dropdown"> <div class="cbp-l-filters-dropdownWrap"> <div class="cbp-l-filters-dropdownHeader">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_POST_GRID_SORT') . '</div> <div class="cbp-l-filters-dropdownList"> <div data-filter="*" class="cbp-filter-item-active cbp-filter-item"> ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_POST_GRID_ALL') . $filter_counter . ' </div>'; $category = array(); foreach ((array) $slides as $slide) { if (in_array($slide['category'], $category)) { continue; } $category[] = $slide['category']; $return[] = '<div class="cbp-filter-item" data-filter=".' . su_title_class($slide['category']) . '">' . $slide['category'] . ' (<div class="cbp-filter-counter"></div> ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_POST_GRID_ITEMS') . ')</div>'; } $return[] = '</div> </div> </div>'; } if ($atts['filter'] !== 'no' and $atts['filter_style'] != 1 and $atts['layout'] != 'slider') { if ($atts['filter_style'] == 2) { $filter_style = 'cbp-l-filters-button'; } elseif ($atts['filter_style'] == 3) { $filter_style = 'cbp-l-filters-alignLeft'; } elseif ($atts['filter_style'] == 4) { $filter_style = 'cbp-l-filters-alignCenter'; } elseif ($atts['filter_style'] == 5) { $filter_style = 'cbp-l-filters-alignRight'; } elseif ($atts['filter_style'] == 6) { $filter_style = 'cbp-l-filters-buttonCenter'; } elseif ($atts['filter_style'] == 7) { $filter_style = 'cbp-l-filters-work'; } elseif ($atts['filter_style'] == 8) { $filter_style = 'cbp-l-filters-list'; } elseif ($atts['filter_style'] == 9) { $filter_style = 'cbp-l-filters-text new_filter'; } $return[] = '<div id="' . $id . '_filter" class="' . $filter_style . '"> <div data-filter="*" class="cbp-filter-item-active cbp-filter-item"> ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_POST_GRID_ALL') . $filter_counter . ' </div>'; $category = array(); foreach ((array) $slides as $slide) { if (in_array($slide['category'], $category)) { continue; } $category[] = $slide['category']; $return[] = '<div class="cbp-filter-item" data-filter=".' . su_title_class($slide['category']) . '">' . $slide['category'] . $filter_counter . '</div>'; } if ($atts['show_search'] === 'yes') { $return[] = '<div class="cbp-search cbp-l-filters-right"> <input id="' . $id . '_search" type="text" placeholder="' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_POST_GRID_SEARCH') . '" data-search="" class="cbp-search-input"> <div class="cbp-search-icon"></div> <div class="cbp-search-nothing">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_NO_SEARCH_RESULT') . ' <i>{{query}}</i></div> </div>'; } $return[] = ' </div>'; } $return[] = '<div id="' . $id . '_container" class="cbp-l-grid-gallery">'; $limit = 1; foreach ((array) $slides as $slide) { $thumb_url = su_image_resize($slide['image'], $atts['thumb_width'], $atts['thumb_height'], $thumb_resize_check, 95); // Title condition if ($slide['title']) { $title = stripslashes($slide['title']); } $category = str_replace(' ', '-', strtolower($slide['category'])); $date = $atts['date'] ? '<span class="cbp-l-grid-blog-date">' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . '</span>' : ''; $show_category = $atts['category'] ? '<span class="cpb-category">' . $slide['category'] . '</span>' : ''; if (isset($slide['introtext'])) { if ($atts['intro_text_limit'] != 0) { $intro_text = '<div class="cbp-l-grid-blog-desc">' . su_char_limit($slide['introtext'], $atts['intro_text_limit']) . '</div>'; } } $return[] = ' <div class="cbp-item ' . $category . '">'; if (isset($thumb_url['url'])) { $return[] = '<a data-id="' . $slide['id'] . '" href="' . $slide['link'] . '" class="cbp-caption"> <div class="cbp-caption-defaultWrap">'; $return[] = '<img src="' . image_media($thumb_url['url']) . '" alt="' . $title . '">'; $return[] = '</div>'; $return[] = '<div class="cbp-caption-activeWrap"> <div class="cbp-l-caption-alignCenter"> <div class="cbp-l-caption-body"> <div class="cbp-l-caption-text">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_POST_GRID_VIEW_POST') . '</div> </div> </div> </div>'; $return[] = '</a>'; } $return[] = '<a href="' . $slide['link'] . '" class="cbp-l-grid-blog-title">' . $title . '</a> <div class="su-pgrid-meta"> ' . $date . ' ' . $show_category . ' </div> ' . $intro_text . ' </div>'; if ($limit++ == $atts['limit']) { break; } } $return[] = '</div><div class="clearfix"></div>'; if ($atts['show_more'] === 'yes' and $atts['layout'] != 'slider') { $return[] = '<div id="' . $id . '_btn" class="cbp-l-loadMore-button"> <a data-id="' . $id . '" href="' . JRoute::_('index.php?option=com_bdthemes_shortcodes&view=post&layout=default') . '" class="cbp-l-loadMore-link" rel="nofollow"> <span class="cbp-l-loadMore-defaultText">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_POST_GRID_LOAD_MORE') . '</span> <span class="cbp-l-loadMore-loadingText">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_POST_GRID_LOADING') . '</span> <span class="cbp-l-loadMore-noMoreLoading">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_POST_GRID_NO_MORE') . '</span> </a> <script type="text/javascript"> var tdata = tdata || []; tdata["' . $id . '"] = ' . json_encode($atts) . '; tdata["' . $id . '"]["offset"] =' . $atts["limit"] . ' </script> </div>'; suAsset::addFile('js', 'cbploadmore.js'); } $return[] = '</div>'; suAsset::addFile('css', 'post_grid.css', __FUNCTION__); suAsset::addFile('js', 'post_grid.js', __FUNCTION__); return implode('', $return); } else { return alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_POST_GRID_ERROR'), 'warning'); } }
function load_post($atts = null) { $atts = su_shortcode_atts(array('source' => isset($_REQUEST["source"]) ? $_REQUEST["source"] : null, 'limit' => isset($_REQUEST["limit"]) ? $_REQUEST["limit"] : null, 'layout' => isset($_REQUEST["layout"]) ? $_REQUEST["layout"] : null, 'order' => isset($_REQUEST["order"]) ? $_REQUEST["order"] : null, 'date' => isset($_REQUEST["date"]) ? $_REQUEST["date"] : null, 'category' => isset($_REQUEST["category"]) ? $_REQUEST["category"] : null, 'order_by' => isset($_REQUEST["order_by"]) ? $_REQUEST["order_by"] : null, 'thumb_resize' => isset($_REQUEST["thumb_resize"]) ? $_REQUEST["thumb_resize"] : null, 'thumb_width' => isset($_REQUEST["thumb_width"]) ? $_REQUEST["thumb_width"] : null, 'thumb_height' => isset($_REQUEST["thumb_height"]) ? $_REQUEST["thumb_height"] : null, 'show_more_item' => isset($_REQUEST["show_more_item"]) ? $_REQUEST["show_more_item"] : null, 'intro_text_limit' => isset($_REQUEST["intro_text_limit"]) ? $_REQUEST["intro_text_limit"] : null, 'offset' => isset($_REQUEST["offset"]) ? $_REQUEST["offset"] : null), $atts); $slides = (array) Su_Tools::get_slides($atts); $return = array(); $item_block = 0; $block = 1; if (preg_match('/k2-category/', $atts['source'])) { $source = 'k2'; } else { $source = 'article'; } $thumb_resize_check = ($atts['thumb_resize'] === 'yes' and $atts['layout'] != 'mosaic') ? true : false; foreach ((array) $slides as $slide) { $thumb_url = su_image_resize($slide['image'], $atts['thumb_width'], $atts['thumb_height'], $thumb_resize_check, 95); // Title condition if ($slide['title']) { $title = stripslashes($slide['title']); } $category = su_title_class($slide['category']); $date = $atts['date'] ? '<span class="cbp-l-grid-blog-date">' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . '</span>' : ''; $show_category = $atts['category'] ? '<span class="cpb-category">' . $slide['category'] . '</span>' : ''; if (isset($slide['introtext'])) { if ($atts['intro_text_limit'] != 0) { $intro_text = '<div class="cbp-l-grid-blog-desc">' . su_char_limit($slide['introtext'], $atts['intro_text_limit']) . '</div>'; } } if ($item_block % $atts['show_more_item'] == 0) { $return[] = $item_block > 0 ? "</div>" : ""; // close div if it's not the first $return[] = '<div class="cbp-loadMore-block' . $block . '">'; $block++; } $return[] = ' <div class="cbp-item ' . $category . '">'; if (isset($thumb_url['url'])) { $return[] = '<a data-id="' . $slide['id'] . '" href="' . $slide['link'] . '" class="cbp-caption"> <div class="cbp-caption-defaultWrap">'; $return[] = '<img src="' . image_media($thumb_url['url']) . '" alt="' . $title . '">'; $return[] = '</div>'; $return[] = '<div class="cbp-caption-activeWrap"> <div class="cbp-l-caption-alignCenter"> <div class="cbp-l-caption-body"> <div class="cbp-l-caption-text">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_POST_GRID_VIEW_POST') . '</div> </div> </div> </div>'; $return[] = '</a>'; } $return[] = '<a href="' . $slide['link'] . '" class="cbp-l-grid-blog-title">' . $title . '</a> <div class="su-pgrid-meta"> ' . $date . ' ' . $show_category . ' </div> ' . $intro_text . ' </div>'; $item_block++; } return implode('', $return); }
public static function portfolio($atts = null, $content = null) { $return = ''; $atts = su_shortcode_atts(array('style' => 1, 'source' => '', 'limit' => 15, 'order' => 'created', 'order_by' => 'desc', 'color' => '#cccccc', 'intro_text_limit' => 50, 'filter' => 'yes', 'filter_align' => '', 'grid_type' => 0, 'animation' => 'fade', 'speed' => 600, 'rotate' => 99, 'delay' => 20, 'border' => 0, 'padding' => 10, 'thumb_width' => 640, 'thumb_height' => 480, 'thumb_resize' => 'yes', 'scroll_reveal' => '', 'class' => ''), $atts, 'portfolio'); $slides = (array) Su_Tools::get_slides($atts); $thumb_resize_check = $atts['thumb_resize'] === 'yes' ? true : false; $filter_align = $atts['filter_align'] ? ' su-portfolio-filter-align-' . $atts['filter_align'] : ''; $intro_text = ''; $title = ''; if (count($slides)) { $id = uniqid('susc_'); $return .= '<div id="' . $id . '"' . su_scroll_reveal($atts) . ' class="su-portfolio sup-style' . $atts['style'] . $filter_align . ' ' . su_ecssc($atts) . '" >'; if ($atts['filter'] !== 'no') { $return .= ' <div class="filter_padder" > <div class="filter_wrapper"> <div class="filter selected" data-category="cat-all">' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_PORTFOLIO_ALL') . '</div>'; $category = array(); foreach ((array) $slides as $slide) { if (in_array($slide['category'], $category)) { continue; } $category[] = $slide['category']; $return .= '<div class="filter" data-category="' . strtolower(preg_replace("/[^a-zA-Z0-9]/", "", $slide['category'])) . '">' . $slide['category'] . '</div>'; } $return .= ' <div class="clear"></div> </div> </div> <div class="clear"></div>'; } $return .= ' <div class="megafolio-container" data-grid_types="' . $atts['grid_type'] . '" data-speed="' . $atts['speed'] . '" data-delay="' . $atts['delay'] . '" data-rotate="' . $atts['rotate'] . '" data-padding="' . intval($atts['padding']) . '" data-animation="' . $atts['animation'] . '" >'; $limit = 1; foreach ((array) $slides as $slide) { $thumb_url = su_image_resize($slide['image'], $atts['thumb_width'], $atts['thumb_height'], $thumb_resize_check, 95); // Title condition if ($slide['title']) { $title = stripslashes($slide['title']); } if (isset($slide['introtext'])) { if ($atts['intro_text_limit'] != 0) { $intro_text = su_char_limit($slide['introtext'], $atts['intro_text_limit']); } } $category = strtolower(preg_replace("/[^a-zA-Z0-9]/", "", $slide['category'])); if ($atts['style'] == 2) { $return .= ' <div class="mega-entry cat-all ' . $category . '" data-src="' . image_media($thumb_url['url']) . '" data-width="500" data-height="500"> <div class="links-container"> <a class="hoverlink project-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '"> <i class=" fa fa-link"></i> <span></span> </a> <a class="hoverlink su-lightbox-item" href="' . image_media($slide['image']) . '" title="' . strip_tags($title) . '"> <i class=" fa fa-search"></i> <span></span> </a> </div> <div class="rollover-content mega-covercaption mega-square-bottom mega-portrait-bottom"> <div class="rollover-content-container"> <h3 class="entry-title">' . $title . '</h3> <div class="entry-meta"> <div class="su-portfolio-date"> <span class="su-pdate">' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . '</span> </div> <div class="portfolio-categories"> <span class="category">' . $category . '</span> </div> </div> </div> </div> </div>'; } elseif ($atts['style'] == 3) { $return .= ' <div class="mega-entry cat-all ' . $category . '" data-src="' . image_media($thumb_url['url']) . '" data-width="500" data-height="500"> <div class="mega-hover notitle"> <a class="su-lightbox-item" href="' . image_media($slide['image']) . '" title="' . strip_tags($title) . '"> <div class="mega-hoverview fa fa-search"></div> </a> <a class="hoverlink project-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '"> <i class="mega-hoverlink fa fa-link"></i> </a> </div> <div class="gallerycaption-bottom"> ' . $title . ' <div class="gallerysubline">' . $category . '</div> </div> </div>'; } elseif ($atts['style'] == 4) { $return .= ' <div class="mega-entry portfolio-style4 cat-all ' . $category . '" data-src="' . image_media($thumb_url['url']) . '" data-width="500" data-height="500"> <div class="portfolio-links"> <a class="su-lightbox-item" href="' . image_media($slide['image']) . '" title="' . strip_tags($title) . '"> <i class="fa fa-search"></i> </a> <a class="portfolio-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '"> <i class="fa fa-link"></i> </a> </div> <div class="portfolio-content"> <div class="portfolio-title">' . $title . '</div> <div class="portfolio-desc">' . $intro_text . '</div> </div> </div>'; } else { $return .= ' <div class="mega-entry cat-all ' . $category . '" data-src="' . image_media($thumb_url['url']) . '" data-width="500" data-height="500"> <div class="mega-hover"> <div class="mega-hovertitle">' . $title . ' <div class="mega-hoversubtitle">' . $intro_text . '</div> </div> <a href="' . $slide['link'] . '" title="' . strip_tags($title) . '"> <i class="mega-hoverlink fa fa-link"></i> </a> <a class="su-lightbox-item" href="' . image_media($slide['image']) . '" title="' . strip_tags($title) . '"> <i class="mega-hoverview fa fa-search"></i> </a> </div> </div>'; } if ($limit++ == $atts['limit']) { break; } } $return .= '</div></div>'; $css = ' #' . $id . ' .mega-hoversubtitle { color: ' . $atts['color'] . ';} #' . $id . ' .mega-entry .mega-entry-innerwrap { border: ' . $atts['border'] . ';} '; suAsset::addString('css', $css); suAsset::addFile('css', 'portfolio.css', __FUNCTION__); suAsset::addFile('css', 'magnific-popup.css'); suAsset::addFile('js', 'magnific-popup.js'); suAsset::addFile('js', 'themepunch_tools.js', __FUNCTION__); suAsset::addFile('js', 'themepunch_megafoliopro.js', __FUNCTION__); suAsset::addFile('js', 'portfolio.js', __FUNCTION__); } else { $return = alert_box(JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_PORTFOLIO_INF'), 'warning'); } return $return; }