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 progress_bar($atts = null, $content = null) { $atts = su_shortcode_atts(array('style' => '1', 'percent' => 75, 'show_percent' => 'yes', 'text' => '', 'bar_color' => '', 'fill_color' => '', 'text_color' => '', 'animation' => 'easeInOutExpo', 'duration' => 1.5, 'delay' => 0.3, 'scroll_reveal' => '', 'class' => ''), $atts, 'progress_bar'); $id = uniqid('suc'); $css = array(); $classes = array('su-progress-bar', 'su-progress-bar-style-' . $atts['style'], su_ecssc($atts)); if ($atts['bar_color']) { $css[] = '#' . $id . '.su-progress-bar { background-color:' . $atts['bar_color'] . '; border-color:' . su_color::darken($atts['bar_color'], '10%') . ';' . '}'; } if ($atts['fill_color'] or $atts['text_color']) { $fill_color = $atts['fill_color'] ? 'background-color:' . $atts['fill_color'] . ';' : ''; $text_color = $atts['text_color'] ? 'color:' . $atts['text_color'] . ';' : ''; $css[] = '#' . $id . '.su-progress-bar > span {' . $fill_color . $text_color . '}'; } $text = $atts['text'] ? '<span class="su-pb-text">' . $atts['text'] . '</span>' : ''; $show_percent = $atts['show_percent'] !== 'no' ? '<span class="su-pb-percent">' . $atts['percent'] . '%</span>' : ''; // Add CSS and JS in head suAsset::addFile('css', 'progress-bar.css', __FUNCTION__); suAsset::addFile('js', 'jquery.easing.js'); suAsset::addFile('js', 'jquery.appear.js'); suAsset::addFile('js', 'progress-bar.js', __FUNCTION__); suAsset::addString('css', implode("\n", $css)); $return = '<div id="' . $id . '"' . su_scroll_reveal($atts) . ' class="' . su_acssc($classes) . '"><span class="su-pb-fill" data-percent="' . $atts['percent'] . '" data-animation="' . $atts['animation'] . '" data-duration="' . $atts['duration'] . '" data-delay="' . $atts['delay'] . '">' . $text . $show_percent . '</span></div>'; 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 heading($atts = null, $content = null) { $atts = su_shortcode_atts(array('style' => 'default', 'size' => '', 'align' => 'center', 'style_color' => '', 'margin' => '', 'width' => '', 'heading' => 'h3', 'color' => '', 'scroll_reveal' => '', 'class' => ''), $atts, 'heading'); $id = uniqid('suhead'); $css = array(); $width = $atts['width'] ? 'width: ' . intVal($atts['width']) . '%;' : ''; $margin = $atts['margin'] ? 'margin-bottom: ' . intVal($atts['margin']) . 'px;' : ''; $size = $atts['size'] ? 'font-size: ' . intVal($atts['size']) . 'px;line-height: ' . $atts['size'] . 'px;' : ''; $color = $atts['color'] ? ' color: ' . $atts['color'] . ';' : ''; if ($atts['width'] or $atts['margin']) { $css[] = '#' . $id . '.su-heading {' . $width . $margin . '}'; } if ($atts['size'] or $atts['color']) { $css[] = '#' . $id . '.su-heading .su-heading-inner {' . $size . $color . '}'; } if ($atts['style_color']) { if ($atts['style'] == 1 or $atts['style'] == 2 or $atts['style'] == 3) { $css[] = '#' . $id . ' .su-heading-inner:before {background: ' . $atts['style_color'] . '}'; } if ($atts['style'] == 4) { $css[] = '#' . $id . ' .su-heading-inner {border-bottom-color: ' . $atts['style_color'] . '}'; } if ($atts['style'] == 5) { $css[] = '#' . $id . ' .su-heading-inner:before, #' . $id . ' .su-heading-inner:after { background-image: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' width=\'5\' height=\'10\' viewBox=\'0 0 5 10\'><line x1=\'-2\' y1=\'1\' x2=\'7\' y2=\'10\' stroke=\'' . $atts['style_color'] . '\' stroke-width=\'1\'/><line x1=\'-2\' y1=\'6\' x2=\'7\' y2=\'15\' stroke=\'' . $atts['style_color'] . '\' stroke-width=\'1\'/><line x1=\'-2\' y1=\'-4\' x2=\'7\' y2=\'5\' stroke=\'' . $atts['style_color'] . '\' stroke-width=\'1\'/></svg>");}'; } if ($atts['style'] == 6) { $css[] = '#' . $id . ' .su-heading-inner:before { background-image: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' width=\'11\' height=\'8\' viewBox=\'0 0 100 100\' xml:space=\'preserve\'><rect x=\'14.614\' y=\'14.824\' transform=\'matrix(0.7071 -0.7071 0.7071 0.7071 -20.8159 49.9564)\' fill=\'' . $atts['style_color'] . '\' width=\'70\' height=\'70\'/></svg>");}'; } if ($atts['style'] == 7) { $css[] = '#' . $id . ' .su-heading-inner:before { background-image: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' width=\'9\' height=\'6\' viewBox=\'0 0 100 100\' xml:space=\'preserve\'><circle fill=\'' . $atts['style_color'] . '\' cx=\'50\' cy=\'50\' r=\'50\'/></svg>");}'; } if ($atts['style'] == 8) { $css[] = '#' . $id . ' .su-heading-inner:before { background-image: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' width=\'122px\' height=\'12px\' viewBox=\'0 0 122 12\' enable-background=\'new 0 0 122 12\' xml:space=\'preserve\'><circle fill=\'transparent\' stroke=\'' . su_color::darken($atts['style_color'], '10%') . '\' stroke-width=\'2\' cx=\'61\' cy=\'6\' r=\'5\'/><rect y=\'5\' width=\'50\' height=\'1\' fill=\'' . $atts['style_color'] . '\' /><rect x=\'72\' y=\'5\' width=\'50\' height=\'1\' fill=\'' . $atts['style_color'] . '\'/></svg>");}'; } if ($atts['style'] == 9) { $css[] = '#' . $id . ' .su-heading-inner:before { background-image: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' x=\'0px\' y=\'0px\' viewBox=\'-244 391 122 12\' style=\'enable-background:new -244 391 122 12;\' xml:space=\'preserve\'><polygon points=\'-172.6,391 -173.8,391 -175.6,392.8 -183,400.2 -190.4,392.8 -192.2,391 -193.4,391 -244,391 -244,392.8 -192.9,392.8 -183,402.7 -173.1,392.8 -122,392.8 -122,391 \' fill=\'' . $atts['style_color'] . '\'/></svg>");}'; } } // Add CSS in head suAsset::addFile('css', 'heading.css', __FUNCTION__); suAsset::addString('css', implode("\n", $css)); return '<div id="' . $id . '"' . su_scroll_reveal($atts) . ' class="su-heading su-heading-style-' . $atts['style'] . ' su-heading-align-' . $atts['align'] . su_ecssc($atts) . '"><' . $atts['heading'] . ' class="su-heading-inner">' . su_do_shortcode($content) . '</' . $atts['heading'] . '></div>'; }
public static function qrcode($atts = null, $content = null) { $atts = su_shortcode_atts(array('data' => '', 'title' => '', 'size' => 200, 'margin' => 0, 'align' => 'none', 'link' => '', 'target' => 'blank', 'color' => '#000000', 'background' => '#ffffff', 'scroll_reveal' => '', 'class' => ''), $atts, 'qrcode'); if (!$atts['data']) { return 'QR code: ' . JText::_('PLG_SYSTEM_BDTHEMES_SHORTCODES_SPECIFY_DATA'); } $atts['title'] = esc_attr($atts['title']); $qrImg = '<img src="https://api.qrserver.com/v1/create-qr-code/?data=' . urlencode($atts['data']) . '&size=' . $atts['size'] . 'x' . $atts['size'] . '&format=png&margin=' . $atts['margin'] . '&color=' . su_color::hexToRgb($atts['color'], true, '-') . '&bgcolor=' . su_color::hexToRgb($atts['background'], true, '-') . '" alt="' . $atts['title'] . '" />'; if ($atts['link']) { if ($atts['link']) { $atts['class'] .= ' su-qrcode-clickable'; } $return = '<a href="' . $atts['link'] . '" target="_' . $atts['target'] . '" title="' . $atts['title'] . '">' . $qrImg . '</a>'; } else { $return = $qrImg; } suAsset::addFile('css', 'qr-code.css', __FUNCTION__); return '<span' . su_scroll_reveal($atts) . ' class="su-qrcode su-qrcode-align-' . $atts['align'] . su_ecssc($atts) . '">' . $return . '</span>'; }
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; }