function fancy_textYTShortcode($atts, $content = null) { $atts = ytshortcode_atts(array('type' => '1', 'tags' => 'Hello, Text', 'class' => '', 'color' => '', 'size' => ''), $atts, 'fancy_text'); // Inistial Variables $id = uniqid("ytft_") . rand() . time(); $tags = array(); $tag = ''; // class manage $classes = array('yt-fancy-text', 'yt-fteffect' . $atts['type'], trim($atts['class'])); // Fancy Text interchangeable tag spliting if ($atts['tags']) { $tags = explode(',', $atts['tags']); foreach ($tags as $word) { $tag .= '<b>' . $word . '</b>'; } $tag = str_replace('<b>' . $tags['0'] . '</b>', '<b class="is-visible">' . $tags['0'] . '</b>', $tag); } // Manage class for different type of Fancy Text if ($atts['type'] == 1 or $atts['type'] == 2 or $atts['type'] == 4 or $atts['type'] == 5) { $classes[] = 'yt-ft-letters'; } // Add css file in head JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/fancy_text/css/fancy_text.css", 'text/css', "screen"); // Add javascript file in head JHtml::_('jquery.framework'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/fancy_text/js/fancy_text.js"); // HTML Ourput $return = "\r\n <span id='" . $id . "' class='" . yt_acssc($classes) . "' style='color:" . $atts['color'] . "; font-size:" . $atts['size'] . "px;'>\r\n <span class='yt-ft-wrap'>\r\n " . $tag . "\r\n </span>\r\n </span>"; return $return; }
function progress_barYTShortcode($atts, $content = null) { $atts = ytshortcode_atts(array('type_change' => '', 'style_linear' => 'default', 'percent' => 75, 'show_percent' => 'yes', 'text' => '', 'bar_color' => '', 'fill_color' => '', 'text_color' => '', 'animation' => 'easeInOutExpo', 'duration' => 1.5, 'delay' => 0.3, 'class' => '', 'data_type' => '', 'style_circle' => 'circle1', 'icon_circle' => ''), $atts, 'progress_bar'); $id = uniqid('ytp') . rand() . time(); $css = ''; $return = ''; $classes = array('yt-progress-bar', 'yt-progress-bar-style-' . $atts['style_linear']); if ($atts['bar_color']) { $css .= '#' . $id . '.yt-progress-bar { background-color:' . $atts['bar_color'] . '; border-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 . '.yt-progress-bar > span {' . $fill_color . $text_color . '}'; } $text = $atts['text'] ? '<span class="yt-pb-text">' . $atts['text'] . '</span>' : ''; $show_percent = $atts['show_percent'] !== 'no' ? '<span class="yt-pb-percent">' . $atts['percent'] . '%</span>' : ''; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/progress_bar/css/progress-bar.css", 'text/css', "screen"); if ($atts['type_change'] == "circle") { if ($atts['style_circle'] == "circle4") { $return .= '<div class="circle4"><div class="' . $atts['style_circle'] . ' progress-radial progress-' . $atts['percent'] . '"></div> <div class="overlay"> <ul> <li><i class="fa fa-' . $atts['icon_circle'] . '"></i><b>' . $atts['percent'] . '</b>%</li> <li>' . $atts['text'] . '</li> </ul> </div></div>'; } else { $return .= '<div class="' . $atts['style_circle'] . ' progress-radial progress-' . $atts['percent'] . '"> <div class="overlay"> <ul> <li><i class="fa fa-' . $atts['icon_circle'] . '"></i><b>' . $atts['percent'] . '</b>%</li> <li>' . $atts['text'] . '</li> </ul> </div> </div>'; } } else { // Add CSS and JS in head JHtml::_('jquery.framework'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/jquery.easing.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/jquery.appear.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/progress_bar/js/progress-bar.js"); $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); $return = '<div id="' . $id . '" class="' . yt_acssc($classes) . '"><span class="yt-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; }
function icon_listYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('title' => 'Icon List Heading', 'title_color' => '', 'title_size' => '', 'color' => '', 'icon_background' => 'transparent', 'icon' => 'icon: heart', 'icon_color' => '', 'icon_size' => 32, 'icon_animation' => '', 'icon_border' => '', 'icon_shadow' => '', 'icon_radius' => '', 'icon_align' => 'left', 'icon_padding' => '', 'connector' => 'no', 'class' => ''), $atts, 'icon_list_item'); $id = uniqid('ytil') . rand() . time(); $css = ''; $has_connector = ''; $icon_animation = ''; $shadow = ''; $icon = ''; $lang = JFactory::getLanguage(); if ($lang->isRTL()) { if ($atts['icon_align'] === 'left') { $atts['icon_align'] = 'right'; } elseif ($atts['icon_align'] === 'right') { $atts['icon_align'] = 'left'; } } $has_connector = $atts['connector'] == 'yes' ? ' has-connector ' : ''; $icon_animation = $atts['icon_animation'] ? 'yt-il-animation-' . $atts['icon_animation'] . '' : ''; $title_color = $atts['title_color'] ? 'color:' . $atts['title_color'] . ';' : ''; $title_size = $atts['title_size'] ? 'font-size: ' . $atts['title_size'] . ';' : ''; $radius = $atts['icon_radius'] ? '-webkit-border-radius:' . $atts['icon_radius'] . '; border-radius:' . $atts['icon_radius'] . ';' : ''; $shadow = $atts['icon_shadow'] ? '-webkit-box-shadow:' . $atts['icon_shadow'] . '; box-shadow:' . $atts['icon_shadow'] . ';' : ''; $padding = $atts['icon_padding'] ? 'padding:' . $atts['icon_padding'] . ';' : ''; $border = $atts['icon_border'] ? 'border:' . $atts['icon_border'] . ';' : ''; $icon_color = $atts['icon_color'] ? 'color:' . $atts['icon_color'] . ';' : ''; $icon_size = $atts['icon_size'] ? 'font-size: ' . intval($atts['icon_size']) . 'px;' : ''; $classes = array('yt-icon-list', 'yt-icon-align-' . $atts['icon_align'], $has_connector, $icon_animation); if (strpos($atts['icon'], 'icon:') !== false) { $icon = '<i class="list-img-icon fa fa-' . trim(str_replace('icon:', '', $atts['icon'])) . '"></i>'; if ($icon_color or $icon_size) { $css .= '#' . $id . ' .icon_list_icon .list-img-icon {' . $icon_color . $icon_size . '}'; } } else { $icon = '<img class="list-img-icon"src="' . yt_image_media($atts['icon']) . '" style="width:' . $atts['icon_size'] . 'px" alt="" />'; } if ($atts['icon_align'] == 'right') { if ($atts['icon_background'] == 'transparent' || $atts['icon_background'] == '' and $atts['icon_border'] == '' || substr($atts['icon_border'], 0, 1) == '0') { $description_margin = 'margin-right: ' . ($atts['icon_size'] + 30) . 'px;'; } else { $description_margin = 'margin-right: ' . ($atts['icon_size'] * 2 + 35 + $atts['icon_border'] * 2) . 'px;'; } } elseif ($atts['icon_align'] == 'top') { $description_margin = ""; } elseif ($atts['icon_align'] == 'title') { $description_margin = ""; $padding = 'padding: 0;'; } elseif ($atts['icon_align'] == 'top_left') { $description_margin = ""; if ($atts['icon_background'] == 'transparent' || $atts['icon_background'] == '' and $atts['icon_border'] == '' || substr($atts['icon_border'], 0, 1) == '0') { $padding = 'padding: 0;'; } } elseif ($atts['icon_align'] == 'top_right') { $description_margin = ""; if ($atts['icon_background'] == 'transparent' || $atts['icon_background'] == '' and $atts['icon_border'] == '' || substr($atts['icon_border'], 0, 1) == '0') { $padding = 'padding: 0;'; } } else { if ($atts['icon_background'] == 'transparent' || $atts['icon_background'] == '' and $atts['icon_border'] == '' || substr($atts['icon_border'], 0, 1) == '0') { $description_margin = 'margin-left: ' . ($atts['icon_size'] + 20) . 'px;'; $padding = 'padding: 0;'; } else { $description_margin = 'margin-left: ' . ($atts['icon_size'] * 2 + 30 + $atts['icon_border'] * 2) . 'px;'; } } if ($atts['icon_animation'] == 6) { $css .= '#' . $id . '.su-il-animation-6 .icon_list_icon i:before { margin-right: -' . round($atts['icon_size'] / 2) . 'px}'; } $icon_list_connector = ($atts['connector'] == "yes" and ($atts['icon_align'] == 'right' or $atts['icon_align'] == 'left')) ? 'icon_list_connector' : ''; $css .= '#' . $id . ' .icon_list_icon { background:' . $atts['icon_background'] . '; font-size:' . $atts['icon_size'] . 'px; max-width:' . $atts['icon_size'] . 'px; height:' . $atts['icon_size'] . 'px;' . $border . $padding . $radius . $shadow . '}'; $css .= '#' . $id . ' .icon_description { ' . $description_margin . '}'; if ($title_color or $title_size) { $css .= '#' . $id . ' .icon_description h3 {' . $title_color . $title_size . '}'; } if ($atts['color']) { $css .= '#' . $id . ' .icon_description_text { color:' . $atts['color'] . ';}'; } // Add CSS in head $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/icon_list/css/icon-list.css", 'text/css'); $return = ' <div id="' . $id . '" class="' . yt_acssc($classes) . ' "> <div class="icon_list_item"> <div class="icon_list_wrapper ' . $icon_list_connector . '"> <div class="icon_list_icon">' . $icon . ' </div> </div> <div class="icon_description"> <h3>' . $atts['title'] . '</h3> <div class="icon_description_text">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . '</div> </div> <div class="clearfix"></div> </div> </div>'; return $return; }
function dividerYTShortcode($atts = null, $content = null) { extract(ytshortcode_atts(array('style' => 1, 'align' => 'center', 'icon_divider' => '', 'icon_style' => '1', 'icon_color' => '#E5E5E5', 'icon_size' => '16px', 'icon_align' => 'center', 'bottom_top' => '0', 'color' => '#999', 'width' => 100, 'margin_top' => 10, 'margin_bottom' => 10, 'margin_left' => '', 'margin_right' => '', 'text' => '', 'border_width' => '1'), $atts)); $id = uniqid('ytd') . rand() . time(); $classes = array('yt-divider', 'yt-divider-style-' . $style, 'yt-icon-style-' . $icon_style, 'yt-divider-align-' . $align); $margin = ''; $icon = ''; $css = ''; if ($text != '') { $icon = '<span style="margin: 0 20px;">' . $text . '</span>'; } else { if ($icon_divider !== '') { if (strpos($icon_divider, '/') !== false) { $icon = '<img src="' . yt_image_media($icon_divider) . '" style="width:' . $icon_size . ';" alt="" />'; } else { if (strpos($icon_divider, 'icon:') !== false) { $icon = '<i class="fa fa-' . trim(str_replace('icon:', '', $icon_divider)) . '"></i>'; } } $css .= '#' . $id . '.yt-divider > span {font-size:' . $icon_size . 'px;border-color:' . $color . ';}'; $css .= '#' . $id . '.yt-divider i {color:' . $icon_color . ';height:' . $icon_size . ';width:' . $icon_size . ';padding:' . round($icon_size / 2) . 'px;}'; } if ($bottom_top == '2') { $icon = '<span id="' . $id . '_top">' . $icon . ' </span>'; $icon .= "<script>\n jQuery(document).ready(function() {\n var offset = 250;\n var duration = 300;\n jQuery('#" . $id . "_top').click(function(event) {\n event.preventDefault();\n jQuery('html, body').animate({scrollTop: 0}, duration);\n return false;\n });\n });\n </script>"; } else { if ($bottom_top == '1') { $icon = '<span id="' . $id . '_bottom">' . $icon . '</span>'; $icon .= "<script>\n jQuery(document).ready(function() {\n var offset = 250;\n var duration = 300;\n jQuery('#" . $id . "_bottom').click(function(event) {\n event.preventDefault();\n jQuery('html, body').animate({scrollTop: jQuery(document).height()}, duration);\n return false;\n });\n });\n </script>"; } } } if ($style == 7) { $css .= '#' . $id . '.yt-divider-style-7 span.divider-left { background-image: -webkit-linear-gradient(45deg, ' . $color . ' 25%, transparent 25%, transparent 50%, ' . $color . ' 50%, ' . $color . ' 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, ' . $color . ' 25%, transparent 25%, transparent 50%, ' . $color . ' 50%, ' . $color . ' 75%, transparent 75%, transparent);}'; $css .= '#' . $id . '.yt-divider-style-7 span.divider-right {background-image: -webkit-linear-gradient(45deg, ' . $color . ' 25%, transparent 25%, transparent 50%, ' . $color . ' 50%, ' . $color . ' 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, ' . $color . ' 25%, transparent 25%, transparent 50%, ' . $color . ' 50%, ' . $color . ' 75%, transparent 75%, transparent);}'; } if ($margin_top or $margin_right or $margin_bottom or $margin_left) { $margin = 'margin: '; $margin .= $margin_top ? intval($margin_top) . 'px ' : '0 '; $margin .= $margin_right ? intval($margin_right) . 'px ' : 'auto '; $margin .= $margin_bottom ? intval($margin_bottom) . 'px ' : '0 '; $margin .= $margin_left ? intval($margin_left) . 'px;' : 'auto;'; } // Get Css in $css variable $css .= '#' . $id . '.yt-divider { width:' . intval($width) . '%;' . $margin . ';text-align: ' . $icon_align . ';}'; $css .= '#' . $id . '.yt-divider span:before, #' . $id . ' span:after { border-color: ' . $color . '; border-width:' . $border_width . 'px;}'; $css .= '#' . $id . '.yt-icon-style-2 > span { background: ' . $color . ';border-radius: 50%;}'; // Add CSS in head $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/divider/css/divider.css", 'text/css'); // Output HTML return '<div id="' . $id . '" class="' . yt_acssc($classes) . '"> <span> <span class="divider-left"></span> ' . $icon . ' <span class="divider-right"></span> </span> </div>'; }