public static function calltoaction($atts = null, $content = null) { $atts = su_shortcode_atts(array('title' => 'This is Call To Action Title', 'title_color' => '#ffffff', 'button_text' => 'Click Here', 'align' => 'default', 'button_link' => '#', 'target' => 'self', 'color' => '#ddd', 'background' => '#2D89EF', 'button_color' => '#fff', 'button_background' => '#165194', 'button_background_hover' => '', 'radius' => '3px', 'button_radius' => '3px', 'desc' => '', 'scroll_reveal' => '', 'class' => ''), $atts, 'calltoaction'); $id = uniqid('suca_'); $css = array(); $padding = ''; $title = $atts['title'] ? "<h3>" . $atts['title'] . "</h3>" : ''; $target = $atts['target'] === 'yes' || $atts['target'] === 'blank' ? ' target="_blank"' : 'target="_self"'; $bdt_hbg = $atts['button_background_hover'] ? $atts['button_background_hover'] : su_color::lighten($atts['button_background'], '5%'); if (intval($atts['radius']) > 40 && intval($atts['button_radius']) > 40) { $padding = "padding: 20px 20px 20px 40px;"; } $css[] = '#' . $id . ' {' . $padding . ' background-color:' . $atts['background'] . '; border-radius:' . $atts['radius'] . '; }'; $css[] = '#' . $id . ' a.cta-dbtn { border-radius:' . $atts['button_radius'] . '; color:' . $atts['button_color'] . '; background:' . $atts['button_background'] . ';}'; $css[] = '#' . $id . ' a.cta-dbtn:hover { background:' . $bdt_hbg . ';}'; $css[] = '#' . $id . ' .cta-content > h3 { color: ' . $atts['title_color'] . ';}'; $css[] = '#' . $id . ' .cta-content div { color:' . $atts['color'] . ';}'; suAsset::addFile('css', 'call-to-action.css', 'calltoaction'); suAsset::addString('css', implode("\n", $css)); $return = '<section id="' . $id . '"' . su_scroll_reveal($atts) . ' class="call-to-action' . su_ecssc($atts) . ' cta-align-' . $atts['align'] . '">'; $return .= "<a class='cta-dbtn hidden-phone' " . $target . " href='" . $atts['button_link'] . "'>" . $atts['button_text'] . "</a>"; $return .= "<div class='cta-content'>" . $title . "<div>" . su_do_shortcode($content) . '</div></div>'; $return .= "<a class='cta-dbtn visible-phone' " . $target . " href='" . $atts['button_link'] . "'>" . $atts['button_text'] . "</a>"; $return .= '<div class="clear"></div></section>'; return $return; }
public static function user_content($atts = null, $content = null) { $atts = su_shortcode_atts(array('message' => JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_USER_CONTENT_DEFAULT_MESSAGE'), 'color' => '#ffcc00', 'login_text' => JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_LOGIN'), 'login_url' => JRoute::_('index.php?option=com_users&view=login'), 'scroll_reveal' => '', 'class' => ''), $atts, 'user_content'); $user = JFactory::getUser(); if ($user->guest) { suAsset::addFile('css', 'user_content.css', __FUNCTION__); $login = '******' . esc_attr($atts['login_url']) . '">' . $atts['login_text'] . '</a>'; return '<div' . su_scroll_reveal($atts) . ' class="su-user_content' . su_ecssc($atts) . '" style="background-color:' . su_color::lighten($atts['color']) . ';border-color:' . su_color::darken($atts['color'], '10%') . ';color:' . su_color::darken($atts['color'], '40%') . '">' . str_replace('%login%', $login, su_scattr($atts['message'])) . '</div>'; } else { return su_do_shortcode($content); } }
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 button($atts = null, $content = null) { $atts = su_shortcode_atts(array('style' => 'default', 'url' => '#', 'target' => 'self', 'color' => '#FFFFFF', 'background' => '#2D89EF', 'background_hover' => '', 'size' => 3, 'wide' => 'no', 'center' => 'no', 'radius' => '3px', 'icon' => false, 'icon_color' => '#FFFFFF', 'desc' => '', 'onclick' => '', 'rel' => '', 'title' => '', 'padding' => '', 'margin' => '', 'scroll_reveal' => '', 'class' => ''), $atts, 'button'); // Initioal Variables $id = uniqid('subtn_'); $css = array(); $js = array(); $borderBtn = ''; $borderBtnHover = ''; // Prepare vars $before = $after = ''; // Common styles for button $btn_size = round(($atts['size'] + 7) * 1.25); // Background hover check if ($atts['background_hover']) { $bg_hover = $atts['background_hover']; } elseif ($atts['background'] != 'transparent') { $bg_hover = su_color::lighten($atts['background']); } else { $bg_hover = ''; } $lineheight = $atts['icon'] ? 'line-height:' . round($btn_size * 1.5) . 'px;' : 'line-height:' . round($btn_size * 2) . 'px;'; if ($atts['padding']) { $padding = 'padding: ' . $atts['padding'] . ';'; } else { $padding = $atts['icon'] ? 'padding: ' . round($atts['size'] / 2 + 4) . 'px ' . round($atts['size'] * 2 + 10) . 'px;' : 'padding: ' . '4px ' . round($atts['size'] * 2 + 10) . 'px;'; } $radius = $atts['radius'] ? '-webkit-border-radius: ' . $atts['radius'] . '; border-radius: ' . $atts['radius'] . ';' : ''; $margin = $atts['margin'] ? 'margin: ' . $atts['margin'] . ';' : ''; if ($atts['style'] === 'border') { $borderBtn = 'border-color: ' . $atts['color'] . ';'; $borderBtnHover = 'border-color: ' . su_color::lighten($atts['color']) . ';'; } // CSS rules for <a> tag $css[] = 'a#' . $id . ' { color: ' . $atts['color'] . '; background-color: ' . $atts['background'] . ';' . $radius . $borderBtn . $margin . '}'; $css[] = 'a#' . $id . ' span { font-size: ' . $btn_size . 'px;' . $radius . $lineheight . $padding . '}'; if ($bg_hover) { $css[] = 'a#' . $id . ':hover { background-color: ' . $bg_hover . ';}'; } elseif ($atts['style'] === 'border') { $css[] = 'a#' . $id . ':hover {' . $borderBtnHover . '}'; } if ($atts['desc']) { $css[] = 'a#' . $id . ' small {padding-bottom:' . round($atts['size'] / 2 + 4) . 'px;color: ' . $atts['color'] . ';}'; } if ($atts['style'] === '3d') { $css[] = 'a#' . $id . '.su-button-style-3d { box-shadow: 0 ' . round($atts['size']) . 'px 0 ' . su_color::darken($atts['background'], '6%') . '; }'; $css[] = 'a#' . $id . '.su-button-style-3d:active { box-shadow: 0 1px 0 ' . su_color::darken($atts['background'], '8%') . '; top: ' . round($atts['size'] - 1) . 'px }'; } // Prepare button classes $classes = array('su-button', 'su-button-style-' . $atts['style']); // Additional classes if ($atts['class']) { $classes[] = $atts['class']; } // Wide class if ($atts['wide'] === 'yes') { $classes[] = 'su-button-wide'; } // Prepare icon if ($atts['icon']) { if (strpos($atts['icon'], 'licon:') !== false) { suAsset::addFile('css', 'linea.css'); $icon = '<i class="li li-' . trim(str_replace('licon:', '', $atts['icon'])) . '"></i>'; $css[] = 'a#' . $id . ' i {font-size:' . $btn_size . 'px; color:' . $atts['icon_color'] . '}'; } elseif (strpos($atts['icon'], 'icon:') !== false) { $icon = '<i class="fa fa-' . trim(str_replace('icon:', '', $atts['icon'])) . '"></i>'; $css[] = 'a#' . $id . ' i {font-size:' . $btn_size . 'px; color:' . $atts['icon_color'] . '}'; } else { $icon = '<img src="' . image_media($atts['icon']) . '" alt="' . esc_attr($content) . '"/>'; $css[] = 'a#' . $id . ' img {width:' . round($btn_size * 1.5) . 'px; height:' . round($btn_size * 1.5) . 'px;}'; } } else { $icon = ''; } // Prepare <small> with description $desc = $atts['desc'] ? '<small>' . su_scattr($atts['desc']) . '</small>' : ''; // Wrap with div if button centered if ($atts['center'] === 'yes') { $before .= '<div class="su-button-center">'; $after .= '</div>'; } // Replace icon marker in content, // add float-icon class to rearrange margins if (strpos($content, '%icon%') !== false) { $content = str_replace('%icon%', $icon, $content); $classes[] = 'su-button-float-icon'; } else { $content = $icon . ' ' . $content; } // Prepare onclick action $atts['onclick'] = $atts['onclick'] ? ' onClick="' . $atts['onclick'] . '"' : ''; // Prepare rel attribute $atts['rel'] = $atts['rel'] ? ' rel="' . $atts['rel'] . '"' : ''; // Prepare title attribute $atts['title'] = $atts['title'] ? ' title="' . $atts['title'] . '"' : ''; // put css in head suAsset::addFile('css', 'button.css', __FUNCTION__); suAsset::addString('css', implode("\n", $css)); return $before . '<a id="' . $id . '" href="' . su_scattr($atts['url']) . '"' . su_scroll_reveal($atts) . ' class="' . su_acssc($classes) . '" target="_' . $atts['target'] . '"' . $atts['onclick'] . $atts['rel'] . $atts['title'] . '><span>' . su_do_shortcode(stripcslashes($content)) . $desc . '</span></a>' . $after; }
public static function _plan($atts = null, $content = null) { $atts = su_shortcode_atts(array('name' => 'Standard', 'price' => '19.99', 'before' => '$', 'after' => '', 'period' => 'per month', 'featured' => 'no', 'icon' => '', 'icon_color' => '#666666', 'btn_url' => '#', 'btn_target' => 'self', 'btn_text' => 'Sign up Now', 'btn_color' => '#ffffff', 'btn_background' => '#4FC1E9', 'btn_background_hover' => '#1AA0D1', 'badge' => '', 'badge_background' => '#999999', 'background' => '#FFFFFF', 'color' => '#444444', 'class' => ''), $atts, 'plan'); $id = uniqid('plan_'); $css = array(); $icon = ''; $badge = ''; if ($atts['icon']) { $icon .= '<div class="su-plan-icon">'; if (strpos($atts['icon'], '/') !== false) { $icon .= '<img src="' . image_media($atts['icon']) . '" alt="" width="' . $atts['size'] . '" height="' . $atts['size'] . '" />'; } elseif (strpos($atts['icon'], 'licon:') !== false) { suAsset::addFile('css', 'linea.css'); $icon .= '<i class="li li-' . trim(str_replace('licon:', '', $atts['icon'])) . '"></i>'; $css[] = '#' . $id . ' .su-plan-icon i { color:' . $atts['icon_color'] . '}'; } elseif (strpos($atts['icon'], 'icon:') !== false) { $icon .= '<i class="fa fa-' . trim(str_replace('icon:', '', $atts['icon'])) . '"></i>'; $css[] = '#' . $id . ' .su-plan-icon i { color:' . $atts['icon_color'] . '}'; } $icon .= '</div>'; } if ($atts['before']) { $atts['before'] = '<span class="su-plan-price-before">' . $atts['before'] . '</span>'; } if ($atts['after']) { $atts['after'] = '<span class="su-plan-price-after">' . $atts['after'] . '</span>'; } if ($atts['period']) { $atts['period'] = '<div class="su-plan-period">' . $atts['period'] . '</div>'; } if ($atts['featured'] === 'yes') { $atts['class'] .= ' su-plan-featured'; } if ($atts['badge']) { $badge = '<div class="su-plan-badge">' . $atts['badge'] . '</div>'; } $content = trim(strip_tags(su_do_shortcode($content), '<br><ul><li><a><b><strong><i><em><span>')); $button = $atts['btn_text'] && $atts['btn_url'] ? '<a href="' . $atts['btn_url'] . '" class="su-plan-button" target="_' . $atts['btn_target'] . '">' . $atts['btn_text'] . '</a>' : ''; $footer = $button ? '<div class="su-plan-footer">' . $button . '</div>' : ''; $head_style = $atts['background'] ? 'background-color:' . su_color::darken($atts['background'], '10%') : ''; $css[] = '#' . $id . ' { background-color:' . $atts['background'] . ';}'; $css[] = '#' . $id . ' .su-plan-head { border-bottom-color: ' . su_color::lighten($atts['color'], '10%') . ';color:' . $atts['color'] . ';}'; $css[] = '#' . $id . ' .su-plan-badge { border-color: ' . su_color::darken($atts['badge_background'], '10%') . ';background-color: ' . $atts['badge_background'] . ' }'; $css[] = '#' . $id . ' .su-plan-name { color: ' . $atts['color'] . ';}'; $css[] = '#' . $id . ' .su-plan-button { background-color: ' . $atts['btn_background'] . '; color:' . $atts['btn_color'] . ';}'; $css[] = '#' . $id . ' .su-plan-button:hover { background-color: ' . $atts['btn_background_hover'] . ';}'; $css[] = '#' . $id . ' .su-plan-footer { border-top-color: ' . su_color::lighten($atts['background'], '10%') . ';background-color:' . $atts['background'] . '; color:' . $atts['btn_background'] . ';}'; $css[] = '.su-pricing-table.su-pricing-style-4 #' . $id . ' { box-shadow: 0px -5px 0px ' . $atts['btn_background'] . ';}'; suAsset::addString('css', implode("\n", $css)); suAsset::addFile('css', 'pricing-table.css', 'plan'); $return = '<div id="' . $id . '" class="su-plan' . su_ecssc($atts) . '">'; $return .= '<div class="su-plan-head">'; $return .= $badge; $return .= '<div class="su-plan-name">' . $atts['name'] . '</div>'; $return .= '<div class="su-plan-price">' . $atts['before']; $return .= '<span class="su-plan-price-value">' . $atts['price'] . '</span>' . $atts['after']; $return .= '</div>'; $return .= $atts['period'] . $icon; $return .= '</div>'; $return .= '<div class="su-plan-options">' . $content . '</div>'; $return .= $footer; $return .= '</div>'; return $return; }