public static function switcher($atts = null, $content = null) { $atts = su_shortcode_atts(array('id' => uniqid('swt'), 'style' => 1, 'active' => 1, 'position' => 'top', 'align' => 'center', 'animation' => 'bounceLeft', 'scroll_reveal' => '', 'class' => ''), $atts, 'switcher'); su_do_shortcode($content); $return = $panes = $css = $filter_item = array(); if (is_array(self::$switcher)) { foreach (self::$switcher as $switcher_item) { $filter_data = su_title_class($switcher_item['title']); $filter_item[] = '<div data-filter=".' . $filter_data . '" class="cbp-filter-item ' . su_ecssc($switcher_item) . '"><div class="cbp-filter-item-inner">' . su_scattr($switcher_item['icon']) . '<span class="su-swt-title">' . su_scattr($switcher_item['title']) . '</span></div></div>'; $panes[] = '<div class="' . $filter_data . ' cbp-item' . su_ecssc($switcher_item) . '">' . $switcher_item['content'] . '</div>'; } $filters = '<div id="' . $atts['id'] . '_filter" class="su-swt-filter">' . implode('', $filter_item) . '</div>'; if (is_int($atts['active']) && $atts['active'] > 0) { $active_tab = su_title_class(self::$switcher[$atts['active'] - 1]['title']); } else { $active_tab = su_title_class(self::$switcher[0]['title']); } $return[] = '<div id="' . $atts['id'] . '"' . su_scroll_reveal($atts) . ' data-animation="' . $atts['animation'] . '" class="su-switcher su-switch-position-' . $atts['position'] . ' su-switch-align-' . $atts['align'] . ' su-switcher-style-' . $atts['style'] . su_ecssc($atts) . '" data-active_tab=".' . $active_tab . '" data-swtid="' . $atts['id'] . '">'; $return[] = ($atts['position'] == 'top' or $atts['position'] == 'left') ? $filters : ''; $return[] = '<div id="' . $atts['id'] . '_container" class="cbp cbp-l-grid-tabs">' . implode("\n", $panes) . '</div>'; $return[] = ($atts['position'] == 'bottom' or $atts['position'] == 'right') ? $filters : ''; $return[] = '<div class="su-clearfix"></div>'; $return[] = '</div>'; } self::$switcher = array(); self::$switcher_item_count = 0; suAsset::addFile('css', 'cubeportfolio.min.css'); suAsset::addFile('js', 'cubeportfolio.min.js'); suAsset::addFile('css', 'switcher.css', __FUNCTION__); suAsset::addFile('js', 'switcher.js', __FUNCTION__); return implode("\n", $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 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'); } }
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'); } }
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); }