function carouselYTShortcode($atts, $content = null) { $return = ''; $atts = ytshortcode_atts(array('style' => '1', 'source' => '', 'limit' => 5, 'items' => 4, '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, 'margin' => 10, 'scroll' => 1, 'arrows' => 'no', 'arrow_position' => 'default', 'pagination' => 'yes', 'autoplay' => 'no', 'delay' => 4, 'speed' => 0.35, 'hoverpause' => 'no', 'lazyload' => 'no', 'loop' => 'yes', 'class' => ''), $atts, 'yt_carousel'); $id = uniqid('ytc') . rand() . time(); $title = ""; $image = ""; $intro_text = ''; $css = ''; $background = ''; $color = ''; $lang = JFactory::getLanguage(); $lang = $lang->isRTL() ? 'true' : 'false'; $slides = (array) get_slides($atts); if ($atts['background'] or $atts['color']) { $background = $atts['background'] ? 'background-color:' . $atts['background'] . ';' : ''; $color = $atts['color'] ? 'color:' . $atts['color'] . ';' : ''; $css .= '.' . $id . ' .yt-carousel-slide {' . $background . $color . '}'; if ($atts['style'] == 3) { $css .= '.' . $id . '.yt-carousel-style-3 .yt-carousel-caption:after {border-bottom-color: ' . $atts['background'] . ';}'; } } if ($atts['title_color']) { $css .= '.' . $id . '.yt-carousel-slide .yt-carousel-slide-title a {color: ' . $atts['title_color'] . ';}'; $css .= '.' . $id . '.yt-carousel-slide .yt-carousel-slide-title a:hover {color: ' . yt_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'] .= ' yt-carousel-media'; } $return .= '<div id="' . $id . '" class="yt-clearfix ' . $id . ' ' . $atts['class'] . ' yt-carousel yt-carousel-style-' . $atts['style'] . ' yt-carousel-title-' . $atts['title'] . ' arrow-' . $atts['arrow_position'] . '" 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-margin="' . $atts['margin'] . '" data-scroll="' . $atts['scroll'] . '" data-loop="' . $atts['loop'] . '" data-rtl="' . $lang . '" ><div class="' . $id . ' yt-carousel-slides">'; $limit = 1; foreach ((array) $slides as $slide) { $image_url = ''; if ($slide['image']) { $image_url = yt_image_resize($slide['image'], $atts['image_width'], $atts['image_height'], $atts['quality']); } else { $image_url = yt_image_resize('plugins/system/ytshortcodes/assets/images/URL_IMAGES.png', $atts['image_width'], $atts['image_height'], $atts['quality']); } if ($atts['title'] == 'yes' && $slide['title']) { $title = stripslashes($slide['title']); if ($atts['title_limit']) { $title = yt_char_limit($title, $atts['title_limit']); } if ($atts['title_link'] == "yes") { $title = '<a href="' . $slide['link'] . '">' . $title . '</a>'; } $title = '<h3 class="yt-carousel-slide-title">' . $title . '</h3>'; } if ($atts['intro_text'] === 'yes' and isset($slide['introtext'])) { $intro_text = $slide['introtext']; if ($atts['intro_text_limit']) { $intro_text = yt_char_limit($intro_text, $atts['intro_text_limit']); } $intro_text = '<div class="yt-carousel-item-text">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $intro_text)) . '</div>'; } $return .= '<div class="' . $id . ' yt-carousel-slide">'; if (isset($image_url) && $atts['image'] == 'yes') { $return .= '<div class="yt-carousel-image">'; if (isset($image_url)) { $return .= '<div class="yt-carousel-links"> <a class="yt-lightbox-item" href="' . yt_image_media($slide['image']) . '" title="' . strip_tags($title) . '"> <i class="fa fa-search"></i> </a>'; if ($source != 'media') { $return .= '<a class="yt-carousel-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '"> <i class="fa fa-link"></i> </a>'; } $return .= '</div>'; } $return .= '<img src="' . yt_image_media($image_url['url']) . '" alt="' . strip_tags($title) . '" />'; $return .= '</div>'; } if ($title or $intro_text) { $return .= '<div class="yt-carousel-caption">' . $title . $intro_text . '</div>'; } $return .= '</div>'; if ($limit++ == $atts['limit']) { break; } } $return .= '</div>'; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/assets/css/magnific-popup.css", 'text/css', "screen"); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/assets/css/owl.carousel.css", 'text/css', "screen"); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/carousel/css/carousel.css"); JHtml::_('jquery.framework'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/magnific-popup.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/owl.carousel.min.js"); $return .= '</div>'; $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); $doc->addScriptDeclaration(' jQuery(document).ready(function ($) { // Enable carousels jQuery(\'.' . $id . '.yt-carousel\').each(function () { // Prepare data var $carousel = $(this), $slides = $(\'.' . $id . '.yt-carousel-slides\'), $slide = $(\'.' . $id . '.yt-carousel-slide\'), data = $carousel.data(); // Apply Swiper var $owlCarousel = $slides.owlCarousel({ responsiveClass: true, mouseDrag: true, autoplayTimeout: data.delay * 1000, smartSpeed: data.speed * 1000, lazyLoad: (data.lazyload == \'yes\') ? true : false, autoplay: (data.autoplay == \'yes\') ? true : false, autoplayHoverPause: (data.hoverpause == \'yes\') ? true : false, center: (data.center == \'yes\') ? true : false, loop: (data.loop == \'yes\') ? true : false, margin: data.margin, navText: [\'\',\'\'], rtl: data.rtl, responsive:{ 0:{ items:1, margin: 0, dots: (data.pagination == \'yes\') ? true : false, nav: (data.arrows == \'yes\') ? true : false }, 768:{ items:$carousel.data(\'items\'), dots: (data.pagination == \'yes\') ? true : false, nav: (data.arrows == \'yes\') ? true : false }, 1000:{ items: $carousel.data(\'items\'), dots: (data.pagination == \'yes\') ? true : false, nav: (data.arrows == \'yes\') ? true : false } } }); // Lightbox for galleries (slider, carousel, custom_gallery) $(this).find(\'.yt-lightbox-item\').magnificPopup({ type: \'image\', mainClass: \'mfp-zoom-in mfp-img-mobile\', tLoading: \'\', // remove text from preloader removalDelay: 400, //delay removal by X to allow out-animation gallery: { enabled: true, navigateByImgClick: true, preload: [0, 1] // Will preload 0 - before current, and 1 after the current image }, callbacks: { open: function() { //overwrite default prev + next function. Add timeout for css3 crossfade animation $.magnificPopup.instance.next = function() { var self = this; self.wrap.removeClass(\'mfp-image-loaded\'); setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120); } $.magnificPopup.instance.prev = function() { var self = this; self.wrap.removeClass(\'mfp-image-loaded\'); setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120); } }, imageLoadComplete: function() { var self = this; setTimeout(function() { self.wrap.addClass(\'mfp-image-loaded\'); }, 16); } } }); }); }); '); } else { $return = yt_alert_box('Carousel content not found, please check carousel source settings.', 'warning'); } return $return; }
function portfolioYTShortcode($atts, $content = null) { $atts = ytshortcode_atts(array('style' => 1, 'source' => '', 'limit' => 15, 'color' => '#cccccc', 'intro_text_limit' => 50, 'grid_type' => 0, 'animation' => 'fade', 'speed' => 600, 'rotate' => 99, 'delay' => 20, 'border' => 0, 'padding' => 10, 'thumb_width' => 640, 'thumb_height' => 480, 'class' => ''), $atts, 'portfolio'); $return = ''; $slides = (array) get_slides($atts); $intro_text = ''; $title = ''; if (count($slides)) { $id = uniqid('ytpor_') . rand() . time(); $return .= '<script>jQuery(document).ready(function($) { $(\'#' . $id . ' .megafolio-container\').each(function () { data = $(this).data(); var api=$(this).megafoliopro({ filterChangeAnimation: data.animation, // fade, rotate, scale, rotatescale, pagetop, pagebottom,pagemiddle filterChangeSpeed: data.speed, // Speed of Transition filterChangeRotate:data.rotate, // If you ue scalerotate or rotate you can set the rotation (99 = random !!) filterChangeScale:0.6, // Scale Animation Endparameter delay: data.delay, defaultWidth:980, paddingHorizontal:data.padding, paddingVertical:data.padding, layoutarray:[data.grid_types] // Defines the Layout Types which can be used in the Gallery. 2-9 or "random". You can define more than one, like {5,2,6,4} where the first items will be orderd in layout 5, the next comming items in layout 2, the next comming items in layout 6 etc... You can use also simple {9} then all item ordered in Layout 9 type. }); // CALL FILTER FUNCTION IF ANY FILTER HAS BEEN CLICKED $(\'#' . $id . ' .filter\').click(function() { $(\'#' . $id . ' .filter\').each(function() { $(this).removeClass("selected")}); api.megafilter($(this).data(\'category\')); $(this).addClass("selected"); }); // Lightbox for galleries (slider, carousel, custom_gallery) $(this).find(\'.yt-lightbox-item\').magnificPopup({ type: \'image\', mainClass: \'mfp-zoom-in mfp-img-mobile\', closeBtnInside: false, tLoading: \'\', // remove text from preloader removalDelay: 400, //delay removal by X to allow out-animation gallery: { enabled: true, navigateByImgClick: true, preload: [0, 1] // Will preload 0 - before current, and 1 after the current image }, callbacks: { open: function() { //overwrite default prev + next function. Add timeout for css3 crossfade animation $.magnificPopup.instance.next = function() { var self = this; self.wrap.removeClass(\'mfp-image-loaded\'); setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120); } $.magnificPopup.instance.prev = function() { var self = this; self.wrap.removeClass(\'mfp-image-loaded\'); setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120); } }, imageLoadComplete: function() { var self = this; setTimeout(function() { self.wrap.addClass(\'mfp-image-loaded\'); }, 16); } } }); }); }); </script>'; $return .= '<div id="' . $id . '" class="yt-portfolio sup-style' . $atts['style'] . ' ' . $atts['class'] . '" > <div class="filter_padder" > <div class="filter_wrapper"> <div class="filter selected" data-category="cat-all">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="' . str_replace(' ', '-', strtolower($slide['category'])) . '">' . $slide['category'] . '</div>'; } $return .= ' <div class="clear"></div> </div> </div> <div class="clear"></div> <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 = yt_image_resize($slide['image'], $atts['thumb_width'], $atts['thumb_height'], 95); // Title condition if ($slide['title']) { $title = stripslashes($slide['title']); } if (isset($slide['introtext'])) { $intro_text = $slide['introtext']; if ($atts['intro_text_limit']) { $atts['intro_text'] = yt_char_limit($intro_text, $atts['intro_text_limit']); } } $category = str_replace(' ', '-', strtolower($slide['category'])); if ($atts['style'] == 2) { $return .= ' <div class="mega-entry cat-all ' . $category . '" data-src="' . yt_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 yt-lightbox-item" href="' . yt_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="yt-portfolio-date"> <span class="yt-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="' . yt_image_media($thumb_url['url']) . '" data-width="500" data-height="500"> <div class="mega-hover notitle"> <a class="yt-lightbox-item" href="' . yt_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="' . yt_image_media($thumb_url['url']) . '" data-width="500" data-height="500"> <div class="portfolio-links"> <a class="yt-lightbox-item" href="' . yt_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">' . $atts['intro_text'] . '</div> </div> </div>'; } else { $return .= ' <div class="mega-entry cat-all ' . $category . '" data-src="' . yt_image_media($thumb_url['url']) . '" data-width="500" data-height="500"> <div class="mega-hover"> <div class="mega-hovertitle">' . $title . ' <div class="mega-hoversubtitle">' . $atts['intro_text'] . '</div> </div> <a href="' . $slide['link'] . '" title="' . strip_tags($title) . '"> <i class="mega-hoverlink fa fa-link"></i> </a> <a class="yt-lightbox-item" href="' . yt_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'] . ';} '; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/portfolio/css/portfolio.css", 'text/css', "screen"); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/assets/css/magnific-popup.css", 'text/css', "screen"); JHtml::_('jquery.framework'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/magnific-popup.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/portfolio/js/themepunch_tools.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/portfolio/js/themepunch_megafoliopro.js"); $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); } else { $return = yt_alert_box('Please select your correct article source.', 'warning'); } return $return; }
function ShowcaseYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('source' => '', 'limit' => 12, 'loading_animation' => 'default', 'filter_animation' => 'rotateSides', 'caption_style' => 'overlayBottomPush', 'horizontal_gap' => 10, 'vertical_gap' => 10, 'filter' => 'yes', 'filter_deeplink' => 'no', 'page_deeplink' => 'no', 'popup_position' => 'below', 'popup_category' => 'yes', 'popup_date' => 'yes', 'popup_image' => 'yes', 'large' => 4, 'medium' => 3, 'small' => 1, 'thumb_width' => 640, 'thumb_height' => 480, 'class' => ''), $atts, 'showcase'); $slides = (array) get_slides($atts); $id = uniqid('ytsc') . rand() . time(); $intro_text = ''; $title = ''; $return = ''; $atts['filter_deeplink'] = $atts['filter_deeplink'] === 'yes' ? 'true' : 'false'; $atts['page_deeplink'] = $atts['page_deeplink'] === 'yes' ? 'true' : 'false'; if (count($slides)) { $return .= '<div id="' . $id . '" class="yt-showcase" data-scid="' . $id . '" 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'] . '" >'; if ($atts['filter'] !== 'no') { $return .= '<div id="' . $id . '_filter" class="cbp-l-filters-dropdown"> <div class="cbp-l-filters-dropdownWrap"> <div class="cbp-l-filters-dropdownHeader">Sort Showcase</div> <div class="cbp-l-filters-dropdownList"> <div data-filter="*" class="cbp-filter-item-active cbp-filter-item"> All Items (<div class="cbp-filter-counter"></div> items) </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 class="cbp-filter-counter"></div> items)</div>'; } $return .= '</div> </div> </div>'; } $return .= '<div id="' . $id . '_container" class="cbp-l-grid-gallery">'; $limit = 1; foreach ((array) $slides as $slide) { $thumb_url = yt_image_resize($slide['image'], $atts['thumb_width'], $atts['thumb_height'], 95); // Title condition if ($slide['title']) { $title = stripslashes($slide['title']); } $category = str_replace(' ', '-', strtolower($slide['category'])); $itemid = uniqid() . rand() . time(); $return .= ' <div class="cbp-item ' . $category . ' motion"> <a href="' . $slide['link'] . '" class="cbp-caption cbp-singlePageInline" data-title="' . $title . ' // ' . $slide['category'] . '"> <div class="cbp-caption-defaultWrap">'; if ($slide['image']) { $return .= '<img src="' . yt_image_media($thumb_url['url']) . '" alt="' . $title . '">'; } else { $return .= '<img src="' . yt_image_media(JURI::base() . 'plugins/system/ytshortcodes/assets/images/URL_IMAGES.png') . '" alt="' . $title . '" width="640" height="480" />'; } $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>'; $return .= '<div id="' . $id . '_inlinecontents" style="display: none;">'; foreach ((array) $slides as $slide) { $date = JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')); $textImg = yt_all_images($slide['fulltext']); $return .= ' <div> <div class="cbp-l-inline"> <div class="cbp-l-inline-left">'; if ($atts['popup_image'] === 'yes' and $textImg != null) { $return .= ' <div class="cbp-slider"> <ul class="cbp-slider-wrap"> <li class="cbp-slider-item"><img src="' . yt_image_media($slide['image']) . '" alt="' . $slide['title'] . '"></li>'; foreach ($textImg as $img) { $return .= '<li class="cbp-slider-item"><img src="' . yt_image_media($img) . '" alt="' . $slide['title'] . '"></li>'; } $return .= '</ul> </div>'; } elseif ($atts['popup_image'] === 'yes') { $return .= '<img src="' . yt_image_media($slide['image']) . '" alt="' . $slide['title'] . '">'; } $return .= '</div> <div class="cbp-l-inline-right"> <div class="cbp-l-inline-title">' . $slide['title'] . '</div> <div class="cbp-l-inline-subtitle">' . $slide['category'] . ' // ' . $date . '</div> <div class="cbp-l-inline-desc">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />", "<p>", "</p>"), " ", $slide['introtext'])) . '</div> <a href="' . $slide['link'] . '" class="cbp-l-inline-view">View Details</a> </div> </div> </div>'; } $return .= '</div></div>'; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/showcase/css/cubeportfolio.min.css", 'text/css'); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/showcase/css/showcase.css", 'text/css'); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/assets/css/magnific-popup.css", 'text/css'); JHtml::script("plugins/system/ytshortcodes/assets/js/magnific-popup.js"); JHtml::script("plugins/system/ytshortcodes/shortcodes/showcase/js/cubeportfolio.min.js"); JHtml::script("plugins/system/ytshortcodes/shortcodes/showcase/js/showcase.js"); } else { $return = yt_alert_box('Error: Something wrong there, please check your showcase source.', 'warning'); } return $return; }