function tabsYTShortcode($atts, $content = null) { global $tab_array; global $index_tab; extract(ytshortcode_atts(array("style" => '', "type" => 'basic', "width" => '', "align" => '', "height" => ''), $atts)); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/tabs/css/tabs.css"); parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)); $tabs_style = $style != '' ? "style-" . $style : ""; $num = count($tab_array); $tab = "<p><div class='yt-tabs " . $type . " " . $tabs_style . " pull-" . $align . "' style='width:" . $width . "; height:" . $height . "'><ul class='nav-tabs clearfix'>"; for ($i = 0; $i < $num; $i++) { $active = $i == 0 ? 'active' : ''; $tab_id = str_replace(' ', '-', $tab_array[$i]["title"]); $tab .= '<li class="' . $active . '"><a href="#' . $tab_id . $index_tab . '" class="'; //$icon = ($tab_array[$i]["icon"] !='fa fa-' ? '<i class="'.$tab_array[$i]["icon"].'"></i><br/>' : ''); $tab .= $active . '" >' . $tab_array[$i]["icon"] . '' . $tab_array[$i]["title"] . '</a></li>'; } $tab .= "</ul>"; $tab .= "<div class='tab-content'>"; for ($i = 0; $i < $num; $i++) { $active = $i == 0 ? 'active' : ''; $tab_id = str_replace(' ', '-', $tab_array[$i]["title"]); $tab = $tab . '<div id="' . $tab_id . $index_tab . '" class="clearfix '; $tab = $tab . $active . '" >' . $tab_array[$i]["content"] . '</div>'; } $index_tab++; $tab .= "</div></div></p>"; $tab_array = array(); return $tab; }
function galleryYTShortcode($atts, $content = null) { global $gwidth, $gheight, $gcolumns, $galleryArray, $cation_gallery, $border_gallery, $padding_item, $id_uniq, $hover_gallery; $gwidth = 100; $gheight = 100; JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/jquery.prettyPhoto.js"); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/gallery/css/gallery.css"); extract(ytshortcode_atts(array("title" => '', "width" => 100, "height" => 100, "columns" => 3, "align" => 'center', "caption" => '0', "border" => '0px solid #4e9e41', "border_size" => '0px', "border_color" => '#4e9e41', "border_style" => 'solid', "padding" => '0px', "hover" => '1'), $atts)); //$border_gallery = ($border_size =='0px') ? '' : "border:".$border_size." ".$border_style." #4e9e41;"; $border_gallery = "border: " . $border . ""; switch ($caption) { case '1': $cation_gallery = 'caption_gallery_1'; break; case '2': $cation_gallery = 'caption_gallery_2'; break; default: $cation_gallery = ''; break; } $hover_gallery = $hover; $padding_item = $padding == '0px' ? '' : "padding:" . $padding . ""; $id_uniq = uniqid("yt") . rand() . time(); $gwidth = $width; $gheight = $height; $gcolumns = $columns; $gallery = ''; $galleryArray = array(); parse_shortcode($content); $tags = array(); $tags = ''; foreach ($galleryArray as $key => $item) { $tags .= ',' . strtolower($item['tag']); } $tags = ltrim($tags, ','); $tags = explode(',', $tags); $newtags = array(); foreach ($tags as $tag) { $newtags[] = trim($tag); } $tags = array_values(array_unique($newtags)); if ($align != '') { $align = 'pull-' . $align; } else { $align = ''; } $gallery .= '<div class="yt-gallery clearfix ' . $align . '" style="margin:0 auto">'; $gallery .= '<div class = "yt-gallery-tabbed" style="display:table; margin-bottom:10px;">'; $gallery .= '<ul class="tabnav">'; $gallery .= '<li class="showall active ' . $id_uniq . '"><span >Show all</span></li>'; foreach ($tags as $tag) { $gallery .= '<li id=' . trim($tag) . $id_uniq . ' class="' . $id_uniq . '"><span>' . ucfirst(trim($tag)) . '</span></li>'; } $gallery .= '</ul>'; $gallery .= '</div>'; $gallery .= '<ul class="gallery-list clearfix">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />", "<p>", "</p>"), " ", $content)) . '</ul>'; $gallery .= '</div>'; return $gallery; }
function notificationYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('effect' => 1, 'button_text' => 'Open notification', 'button_class' => '', 'close_button' => '', 'title' => 'notification Title', 'title_background' => 'rgba(0,0,0,0.1)', 'title_color' => '#222222', 'background' => '#ffffff', 'color' => '#666666', 'border' => 'none', 'shadow' => '0 solid #000000', 'width' => '640px', 'height' => 'auto', 'overlay_background' => '#000', 'class' => ''), $atts, 'notification'); $id = uniqid('ytmodal_') . rand() . time(); $id_over = uniqid() . rand() . time(); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/notification/css/notification.css", 'text/css'); JHtml::_('jquery.framework'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/notification/js/notification.js"); $css = ' #' . $id . ' .yt-modal-content-wrapper { height: ' . $atts['height'] . '; width: ' . $atts['width'] . '; background: ' . $atts['background'] . '; color: ' . $atts['color'] . '; border: ' . $atts['border'] . '; box-shadow: ' . $atts['shadow'] . '; } #' . $id . ' .yt-modal-title-wrapper { background: ' . $atts['title_background'] . '; } #' . $id . ' .yt-modal-title-wrapper h3 { color: ' . $atts['title_color'] . '; } '; $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); $overlay_style = 'style=" background-color: ' . $atts['overlay_background'] . ';"'; $close_button = $atts['close_button'] === 'yes' ? '<a href="javascript:void(0);" class="yt-modal-close"><i class="fa fa-remove"></i></a>' : ''; $return = '<div class="yt-modal-wrapper">'; $return .= '<a href="javascript:void(0);" class="yt-modal-trigger ' . $atts['button_class'] . '" data-modal="' . $id . '">' . $atts['button_text'] . '</a>'; $return .= '<div class="yt-modal yt-modal-effect-' . $atts['effect'] . '" id="' . $id . '"> <div class="yt-modal-content-wrapper">'; $return .= '<div class="yt-modal-title-wrapper">'; $return .= '<h3>' . $atts['title'] . '</h3>'; $return .= $close_button; $return .= '</div>'; $return .= '<div class="yt-content">'; $return .= parse_shortcode(str_replace(array("<br/>", "<br />", "<p></p>"), " ", $content)); $return .= '</div> </div> </div> <div class="yt-modal-overlay ' . $id . '" ' . $overlay_style . '></div>'; $return .= '</div>'; return $return; }
function sectionYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('background' => '#ffffff', 'image' => '', 'repeat' => 'repeat', 'parallax' => 'yes', 'speed' => '10', 'max_width' => '960', 'margin' => '0px 0px 0px 0px', 'padding' => '30px 0px 30px 0px', 'border' => 'none', 'color' => '#333333', 'text_align' => 'inharit', 'text_shadow' => 'none', 'url_youtube' => '', 'url_webm' => '', 'url_vimeo' => '', 'font_size' => '12px', 'class' => ''), $atts, 'section'); $id_section = uniqid('sec_') . rand() . time(); $id_video = uniqid('svb_sec_') . rand() . time(); $background = $atts['image'] ? sprintf('%s %s url(\'%s\') repeat %s', $atts['background'], '50% 0', yt_image_media($atts['image']), $atts['parallax'] === 'yes' ? 'fixed' : 'scroll') : $atts['background']; if ($atts['image'] && $atts['parallax'] === 'yes') { $atts['class'] .= ' yt-section-parallax'; } if ($atts['url_youtube']) { $atts['class'] .= ' yt-panel-clickable'; } JHtml::_('jquery.framework'); if ($atts['image'] && $atts['parallax'] === 'yes' or $atts['url_youtube']) { JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/section/js/section.js"); } JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/section/js/modernizr.video.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/section/js/swfobject.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/section/js/video_background.js"); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/section/css/section.css", 'text/css'); $atts['text_align'] = $atts['text_align'] != 'inherit' ? 'text-align:' . $atts['text_align'] . ';' : ''; $atts['text_shadow'] = $atts['text_shadow'] ? ' -webkit-text-shadow:' . $atts['text_shadow'] . ';-moz-text-shadow:' . $atts['text_shadow'] . ';text-shadow:' . $atts['text_shadow'] . ';' : ''; if ($atts['url_youtube'] != '') { return '<div class="yt-section-forcefullwidth"><div id="' . $id_section . '" class="yt-section-wrapper" data-id="' . $id_section . '"><div class="yt-section ' . trim($atts['class']) . ' " data-speed="' . $atts['speed'] . '" style="background:' . $background . ';margin:' . $atts['margin'] . ';padding:' . $atts['padding'] . ';border-top:' . $atts['border'] . ';border-bottom:' . $atts['border'] . '"><div class="yt-section-content yt-content-wrap" style="max-width:' . $atts['max_width'] . 'px; ' . $atts['text_align'] . ' color:' . $atts['color'] . ';' . $atts['text_shadow'] . ' font-size:' . $atts['font_size'] . '">' . parse_shortcode(str_replace(array("<br/>", "<br />", "<p></p>"), " ", $content)) . '</div><div class="yt-section-overlay"></div><div class="yt-section-video" id="' . $id_video . '" data-id="' . $id_video . '" data-loop="true" data-muted="true" data-autoplay="true" data-ratio="1.77" data-overlay="" data-swfpath="" data-youtube="' . $atts['url_youtube'] . '"><div id="video_background_video_1" style="z-index: 0; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; overflow: hidden;"></div></div></div></div></div>'; } else { if ($atts['url_webm'] != '') { return '<div class="yt-section-forcefullwidth"><div id="' . $id_section . '" class="yt-section-wrapper" data-id="' . $id_section . '"><div class="yt-section ' . trim($atts['class']) . ' " data-speed="' . $atts['speed'] . '" style="background:' . $background . ';margin:' . $atts['margin'] . ';padding:' . $atts['padding'] . ';border-top:' . $atts['border'] . ';border-bottom:' . $atts['border'] . '"><div class="yt-section-content yt-content-wrap" style="max-width:' . $atts['max_width'] . 'px; ' . $atts['text_align'] . ' color:' . $atts['color'] . ';' . $atts['text_shadow'] . ' font-size:' . $atts['font_size'] . '">' . parse_shortcode(str_replace(array("<br/>", "<br />"), " ", $content)) . '</div><div class="yt-section-overlay"></div><div class="yt-section-video" id="' . $id_video . '" data-id="' . $id_video . '" data-loop="true" data-muted="true" data-autoplay="true" data-ratio="1.77" data-overlay="" data-swfpath="" data-webm="' . $atts['url_webm'] . '"><div id="video_background_video_1" style="z-index: 0; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; overflow: hidden;"><video autoplay="" loop="" onended="this.play()"><source src="' . $atts['url_webm'] . '" type="video/webm"></video></div></div></div></div></div>'; } else { return '<div class="yt-section ' . trim($atts['class']) . ' " data-speed="' . $atts['speed'] . '" style="background:' . $background . ';margin:' . $atts['margin'] . ';padding:' . $atts['padding'] . ';border-top:' . $atts['border'] . ';border-bottom:' . $atts['border'] . '"><div class="yt-section-content yt-content-wrap" style="max-width:' . $atts['max_width'] . 'px; ' . $atts['text_align'] . ' color:' . $atts['color'] . ';' . $atts['text_shadow'] . ' font-size:' . $atts['font_size'] . '">' . parse_shortcode(str_replace(array("<br/>", "<br />", "<p></p>"), " ", $content)) . '</div></div>'; } } }
function dummy_textYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('amount' => 1, 'what' => 'paras', 'cache' => 'yes', 'class' => ''), $atts, 'dummy_text'); $xml = simplexml_load_file('http://www.lipsum.com/feed/xml?amount=' . $atts['amount'] . '&what=' . $atts['what'] . '&start=0'); $return = '<div class="yt-dummy-text"><p>' . str_replace("\n", "</p><p>", $xml->lipsum) . '</p></div>'; return $return; }
function accordion_itemYTShortcode($atts, $content = null) { global $style_acc; extract(ytshortcode_atts(array("title" => '', "icon" => 'plus', 'background' => '#fff', "color_title" => '#333', "color_desc" => '#333', "width" => '100', "height" => '100%', "active" => '', "border_color" => '', "icon_color" => '#ccc', "icon_size" => '16', "background_active" => '#fff', "color_active" => '#4e9e31'), $atts)); $id = uniqid('yt_acc_item_') . rand() . time(); $css = ''; $icon_color = $icon_color ? 'color:' . $icon_color . ';' : ''; $icon_size_ = $icon_size ? 'font-size: ' . intval($icon_size) . 'px;' : ''; $style = $style_acc == 'border' ? 'border:1px solid ' . $border_color : ''; $acc_item = "<li class='yt-accordion-group' id='" . $id . "' style='" . $style . "'>"; $active = $active == "yes" ? 'enable' : 'disable'; $acc_item .= "<h3 class='accordion-heading " . $active . "'"; $acc_item .= " style='background:" . $background . "; box-shadow: 0px 1px 0px " . $background . " inset ; color:" . $color_title . ";font-size:" . $icon_size . "px'>"; if ($icon != '') { if (strpos($icon, 'icon:') !== false) { $acc_item .= "<i class='icon_accordion fa fa-" . trim(str_replace('icon:', '', $icon)) . "'></i> "; if ($icon_color or $icon_size) { $css .= '#' . $id . ' .icon_accordion {' . $icon_color . $icon_size_ . '}'; } } else { $acc_item .= '<img src="' . yt_image_media($icon) . '" style="width:' . $icon_size . 'px" alt="" /> '; } } $acc_item .= ' ' . $title . "</h3>"; $acc_item .= "<div class='yt-accordion-inner' style='background:" . $background . ";color:" . $color_desc . ";border-color:" . $color_title . "'>" . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . "</div>"; $acc_item .= "</li>"; $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); return $acc_item; }
function masonryYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('id_masonry' => '', 'gutter' => null, 'rtl' => 'no'), $atts, 'yt_masonry'); global $intense_masonry_gutter; $intense_masonry_gutter = $atts['gutter']; if (empty($intense_masonry_gutter)) { $intense_masonry_gutter = '0'; } if (empty($id_masonry)) { $id_masonry = rand(); } // intense_add_script( 'packery' ); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/masonry/js/masonry.js"); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/masonry/css/masonry.css", 'text/css'); $init_script = '<script> function intenseInitMasonry() { var $ = jQuery; var $container = $(".intense.masonry"); $container.packery({ itemSelector: ".item", gutter: 0, isOriginLeft: ' . ($atts['rtl'] == "no" ? 'false' : 'true') . ' }); return $container; } jQuery(function($){ $(window).load(function() { setTimeout(intenseInitMasonry, 250); intenseInitMasonry(); }); });</script>'; return $init_script . '<div id="' . $id_masonry . '" class="intense masonry' . (!empty($class) ? ' ' . $class : '') . '" style="position: relative;">' . parse_shortcode(str_replace(array("<br/>", "<br />"), " ", $content)) . '</div><div class="clearfix"></div>'; }
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 BoxYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('style' => 'default', 'title' => 'Box Title', 'title_color' => '#FFFFFF', 'box_color' => '#333333', 'color' => null, 'radius' => '', 'class' => ''), $atts, 'box'); // Initioal Variables $id = uniqid('yt_box_') . rand() . time(); $radius = ''; $css = ''; // Color Manage if ($atts['color'] !== null) { $atts['box_color'] = $atts['color']; } // Radius Manage if ($atts['radius']) { $radius = $atts['radius'] != '0' ? 'border-radius:' . $atts['radius'] . 'px;' : ''; } // Get Css in $css variable $css .= '#' . $id . '{' . $radius . 'border-color:' . $atts['box_color'] . ';} #' . $id . ' .yt-box-title { background-color:' . $atts['box_color'] . ';color:' . $atts['title_color'] . ';}'; // Add CSS in head $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/box/css/box.css"); // Output HTML $return = '<div id="' . $id . '" class="yt-clearfix yt-box yt-box-style-' . $atts['style'] . '"> <div class="yt-box-title">' . $atts['title'] . ' </div> <div class="yt-box-content yt-clearfix">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />", "<p>", "</p>"), " ", $content)) . '</div> </div>'; return $return; }
function columnsYTShortcode($atts, $content = null) { extract(ytshortcode_atts(array("grid" => 'no'), $atts)); $show_grid = $grid == 'yes' ? 'show-grid' : ''; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/columns/css/columns.css"); return '<div class="yt-clearfix yt-show-grid ' . $show_grid . ' ">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . '</div>'; }
function blockquoteYTShortcode($atts, $content = null) { extract(ytshortcode_atts(array("title" => '', "align" => 'none', 'border' => '#666', 'color' => '#fff', 'width' => 'auto'), $atts)); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/blockquote/css/blockquote.css"); $source_title = $title != '' ? "<small>" . $title . "</small>" : ''; return '<blockquote class="yt-clearfix yt-boxquote pull-' . $align . '" style="width:' . $width . '%;border-color:' . $border . ';color:' . $color . '">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . $source_title . '</blockquote>'; }
function frameYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('style' => 'default', 'align' => 'left', 'class' => ''), $atts, 'yt_frame'); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/frame/css/frame.css", 'text/css'); JHtml::script("plugins/system/ytshortcodes/shortcodes/frame/js/frame.js"); return '<span class="yt-frame yt-frame-align-' . $atts['align'] . ' yt-frame-style-' . $atts['style'] . '"><span class="yt-frame-inner">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . '</span></span><div class="clear clearfix"></div>'; }
function image_compareYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('before_image' => '', 'after_image' => '', 'orientation' => '', 'before_text' => 'Original', 'after_text' => 'Modified', 'class' => ''), $atts, 'image_compare'); // Unique Id $id = uniqid("ytic") . rand() . time(); if (yt_image_media($atts['before_image']) && yt_image_media($atts['after_image'])) { $orientation = $atts['orientation'] == 'horizontal' ? 'data-orientation="horizontal"' : ''; $css = '#' . $id . ' .twentytwenty-before-label:before {content: "' . $atts['before_text'] . '"}'; $css .= '#' . $id . ' .twentytwenty-after-label:before {content: "' . $atts['after_text'] . '"}'; // Css Adding in Head JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/image_compare/css/image_compare.css", 'text/css'); // JavaScipt additon in Head JHtml::_('jquery.framework'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/jquery.twentytwenty.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/jquery.event.move.js"); // OUtput Structure in here $return = ' <div id="' . $id . '" class="twentytwenty-container' . trim($atts['class']) . '" data-orientation="horizontal"> <img src="' . yt_image_media($atts['before_image']) . '" alt="' . $atts['before_text'] . '"> <img src="' . yt_image_media($atts['after_image']) . '" alt="' . $atts['before_text'] . '"> </div>'; $js = 'jQuery(window).load(function(){ jQuery("#' . $id . '").twentytwenty({orientation: \'' . $atts['orientation'] . '\'}); });'; $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); $doc->addScriptDeclaration($js); } else { $return = yt_alert_box('You can compare two images by using this shortcode', 'warning'); } return $return; }
function countdownYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('count_date' => '2020/12/25', 'count_time' => '', 'count_size' => '32', 'count_color' => '', 'background' => '#FFFFFF', 'text_align' => 'default', 'text_size' => '14', 'text_color' => '#666666', 'align' => 'left', 'padding' => '', 'margin' => '', 'border' => '0px solid #DDD', 'radius' => '', 'divider' => 'none', 'divider_color' => 'rgba(100,100,100,.1)', 'class' => ''), $atts, 'countdown'); $id = uniqid('yt_countdown_') . rand() . time(); $css = ''; $js = ''; $divider_style = ''; if ($atts['divider'] == 'colon') { $divider_style = '#' . $id . ' .yt-countdown-content .yt-cd-timer > span:after { font-size: ' . round($atts['count_size'] / 2) . 'px;line-height: ' . round($atts['count_size'] / 2) . 'px; color: ' . $atts['divider_color'] . ';}'; } if ($atts['divider'] == 'vertical_line' || $atts['divider'] == 'horizontal_line') { $divider_style = '#' . $id . ' .yt-countdown-content .yt-cd-timer > span:after {background-color: ' . $atts['divider_color'] . ';}'; } else { $divider_style = '#' . $id . ' .yt-countdown-content .yt-cd-timer > span:after { font-size: ' . $atts['count_size'] . 'px;line-height: ' . $atts['count_size'] . 'px; color: ' . $atts['divider_color'] . ';}'; } if ($atts['margin'] or $atts['padding'] or $atts['radius'] or $atts['border'] or $atts['background']) { $margin = $atts['margin'] ? 'margin: ' . $atts['margin'] . ';' : ''; $padding = $atts['padding'] ? 'padding: ' . $atts['padding'] . ';' : ''; $radius = $atts['radius'] ? 'border-radius: ' . $atts['radius'] . ';' : ''; $border = $atts['border'] ? 'border: ' . $atts['border'] . ';' : ''; $background = $atts['background'] ? 'background-color: ' . $atts['background'] . ';' : ''; $css .= '#' . $id . ' {' . $margin . $padding . $radius . $border . $background . '}'; } $count_color = $atts['count_color'] ? 'color: ' . $atts['count_color'] . ';' : ''; $css .= '#' . $id . ' .yt-cd-timer > span span[class*="text"] { color: ' . $atts['text_color'] . '; font-size: ' . $atts['text_size'] . 'px; } #' . $id . ' .yt-cd-timer span > span { font-size: ' . $atts['count_size'] . 'px; line-height: ' . $atts['count_size'] . 'px; ' . $count_color . '} ' . $divider_style . ' '; $message = ''; $countdown = $atts['count_date']; $countdown .= $atts['count_time'] ? ' ' . $atts['count_time'] : ''; if (isset($content)) { $message = '.on("finish.countdown", function(event) { $(this).parent() .addClass("disabled") .html("' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />", "<p>", "</p>"), " ", $content)) . '"); })'; } $js .= ' jQuery(document).ready(function ($) { $("#' . $id . ' .yt-cd-timer").countdown("' . $countdown . '").on("update.countdown", function(event) { var $this = $(this).html(event.strftime( "<span class=\'yt-cd-day\'><span class=\'yt-cd-day-data\'>%-D</span> <span class=\'yt-cd-day-text\'>DAY</span></span> " + "<span class=\'yt-cd-hour\'><span class=\'yt-cd-hour-data\'>%H</span> <span class=\'yt-cd-hour-text\'>HOUR</span></span> " + "<span class=\'yt-cd-minute\'><span class=\'yt-cd-minute-data\'>%M</span> <span class=\'yt-cd-minute-text\'>MIN</span></span> " + "<span class=\'yt-cd-second\'><span class=\'yt-cd-second-data\'>%S</span> <span class=\'yt-cd-second-text\'>SEC</span></span>")); })' . $message . '; }); '; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/countdown/css/countdown.css", 'text/css'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/countdown/js/jquery.countdown.js"); $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); $doc->addScriptDeclaration($js); return '<div id="' . $id . '" class="yt-countdown-wrapper clearfix yt-countdown-' . $atts['align'] . ' yt-cd-divider-' . $atts['divider'] . ' yt-countdown-text-' . $atts['text_align'] . '"> <div class="yt-countdown-content"> <div class="yt-cd-timer"></div> </div> </div>'; }
function google_fontYTShortcode($atts, $content = null) { extract(ytshortcode_atts(array("font" => '', "size" => '', "color" => '', "align" => '', "font_weight" => '', "margin" => ''), $atts)); $style = ' style="'; if ($font != "") { $style .= "font-family:{$font};"; } if ($size != "") { $style .= "font-size:{$size}px;"; } if ($color != "") { $style .= "color:{$color};"; } if ($font_weight != "") { $style .= "font-weight:{$font_weight};"; } if ($align != "") { $style .= "text-align:{$align};"; } if ($margin != "") { $style .= "margin:{$margin};"; } $style .= '"'; $doc = JFactory::getDocument(); $href = "http://fonts.googleapis.com/css?family={$font}"; $attribs = array('type' => 'text/css', 'title' => 'CSS'); $doc->addHeadLink($href, 'stylesheet', 'rel', $attribs); $googlefont = "<h3 class='googlefont'" . $style . ">" . $content . "</h3>"; return $googlefont; }
function animationYTShortcode($atts, $content = null) { $atts = ytshortcode_atts(array('type' => 'bounceIn', 'duration' => 1, 'delay' => 0, 'inline_block' => 'no', 'class' => ''), $atts, 'animation'); $id = uniqid('yta') . rand() . time(); $inline = $atts['inline_block'] === 'yes' ? ' display: inline-block;' : ''; $style = array('duration' => array(), 'delay' => array()); // CSS Prefix manage foreach (array('-webkit-', '-moz-', '-ms-', '-o-', '') as $vendor) { $style['duration'][] = $vendor . 'animation-duration:' . $atts['duration'] . 's'; $style['delay'][] = $vendor . 'animation-delay:' . $atts['delay'] . 's'; } // Get Css in $css variable $css = '#' . $id . ' {visibility:hidden;' . $inline . implode(';', $style['duration']) . ';' . implode(';', $style['delay']) . '}'; // Add CSS in head $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); // Add CSS file in head JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/assets/css/animate.css"); JHtml::_('jquery.framework'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/jquery.appear.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/animation/js/animate.js"); // Output HTML $output = '<div id="' . $id . '" class="yt-clearfix yt-animate " data-animation="' . $atts['type'] . '">' . parse_shortcode(str_replace(array("<br/>", "<br />", "<p></p>"), " ", $content)) . '</div>'; return $output; }
function player_list_itemYTShortcode($atts, $content = null) { global $playeritem_count; extract(ytshortcode_atts(array("src" => '', "song" => '', "artist" => ''), $atts)); $playeritem_count++; $player_item = '<li class=""><span>' . $playeritem_count . '</span> <a href="#" data-src="' . $src . '" >' . $song . '</a> - ' . $artist . '</li>'; return $player_item; }
function documentYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('url' => '', 'file' => null, 'width' => 600, 'height' => 600, 'responsive' => 'yes', 'class' => ''), $atts, 'yt_document'); if ($atts['file'] !== null) { $atts['url'] = $atts['file']; } JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/document/css/document.css", 'text/css'); return '<div class="yt-document yt-responsive-media-' . $atts['responsive'] . '"><iframe src="http://docs.google.com/viewer?embedded=true&url=' . yt_image_media($atts['url']) . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" class="yt-document"></iframe></div>'; }
function highlightYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('background' => '#ddff99', 'bg' => null, 'color' => '#000000', 'size' => '14', 'class' => ''), $atts, 'highlight'); if ($atts['bg'] !== null) { $atts['background'] = $atts['bg']; } JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/highlight/css/highlight.css", 'text/css'); return '<span class="yt-highlight' . trim($atts['class']) . '" style="background:' . $atts['background'] . ';color:' . $atts['color'] . '; font-size:' . $atts['size'] . 'px; line-height:' . $atts['size'] . 'px"> ' . parse_shortcode(str_replace(array("<br/>", "<br />", "<p></p>"), " ", $content)) . ' </span>'; }
function dummy_imageYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('width' => 500, 'height' => 300, 'theme' => 'any', 'class' => ''), $atts, 'yt_dummy_image'); $url = 'http://lorempixel.com/' . $atts['width'] . '/' . $atts['height'] . '/'; if ($atts['theme'] !== 'any') { $url .= $atts['theme'] . '/' . rand(0, 10) . '/'; } return '<img src="' . $url . '" alt="Dummy Image" width="' . $atts['width'] . '" height="' . $atts['height'] . '" class="yt-dummy-image" />'; }
function pricing_tablesYTShortcode($atts, $content = null) { global $pcolumns, $type; extract(ytshortcode_atts(array("columns" => '3', "width" => '100%', "style" => '', "type" => ''), $atts)); $pcolumns = $columns; $class = 'yt-pricing block col-' . $columns . ' pricing-' . $style; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/pricing_tables/css/pricingtable.css", 'text/css', "screen"); return '<div class="' . $class . '" style="width:' . $width . ';" >' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . '</div>'; }
function toggle_boxYTShortcode($atts, $content = null) { extract(ytshortcode_atts(array("width" => '', "align" => '', "height" => ''), $atts)); $toggle_box = "<ul class='yt-toggle-box pull-" . $align . "' style='width:" . $width . "' >"; $toggle_box = $toggle_box . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)); $toggle_box = $toggle_box . "</ul>"; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/toggle_box/css/toggle_box.css"); return $toggle_box; }
function list_style_itemYTShortcode($atts, $content = null) { global $list_color; extract(ytshortcode_atts(array("offset" => ''), $atts)); if ($list_color != '') { return '<li ><span>' . $content . '</span></li>'; } else { return '<li >' . $content . '</li>'; } }
function skillsYTShortcode($atts, $content = null) { global $no_number; extract(ytshortcode_atts(array("width" => '', 'no_number' => ''), $atts)); $skills = '<div class="yt-skills" style="width:' . $width . '">'; $skills .= parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)); $skills .= '</div>'; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/skills/css/skills.css"); return $skills; }
function blurYTShortcode($atts, $content = null) { extract(ytshortcode_atts(array("blur" => '1', "hover_blur" => '0.1'), $atts)); $class = uniqid('yt_blur_') . rand() . time(); $css = '.' . $class . ' {-webkit-filter: blur(' . $blur . 'px); -moz-filter: blur(' . $blur . 'px); -o-filter: blur(' . $blur . 'px); -ms-filter: blur(' . $blur . 'px); filter: blur(' . $blur . 'px);} .' . $class . ':hover{-webkit-filter: blur(' . $hover_blur . 'px); -moz-filter: blur(' . $hover_blur . 'px); -o-filter: blur(' . $hover_blur . 'px); -ms-filter: blur(' . $hover_blur . 'px); filter: blur(' . $hover_blur . 'px);}'; $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); return '<div class="yt-clearfix ' . $class . '" > ' . parse_shortcode(str_replace(array("<br/>", "<br />", "<p></p>"), " ", $content)) . '</div> '; }
function content_slider_itemYTShortcode($atts, $content = null) { extract(ytshortcode_atts(array('class' => '', 'src' => '', 'caption' => 'no'), $atts)); $image = $src != '' ? '<img src=' . JURI::base() . $src . ' alt=' . uniqid("title_") . rand() . time() . '>' : ''; if ($caption == "yes") { return '<div class="yt-content-slide yt-clearfix yt-content-wrap' . $class . '"> ' . $image . ' <p class="caption">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . '</p></div>'; } else { return '<div class="yt-content-slide yt-clearfix yt-content-wrap' . $class . '"> ' . $image . ' ' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . '</div>'; } }
function highlighterYTShortcode($atts, $content = null) { extract(ytshortcode_atts(array("label" => '', "linenums" => 'no'), $atts)); $highli_lang = $label != '' ? '' . $label : ''; if (preg_match("/yt_google_map/i", $content)) { $content = '[' . trim($content) . ']'; } $highlighter = '<pre title="' . $highli_lang . '"class="highlighter prettyprint' . ($linenums == 'Yes' || $linenums == 'yes' ? ' linenums' : '') . '"> ' . trim($content) . ' </pre>'; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/highlighter/css/highlighter.css"); return $highlighter; }
function social_iconYTShortcode($atts, $content = null) { extract(ytshortcode_atts(array("type" => 'facebook', "title" => '', "size" => 'default', "style" => '', "color" => ''), $atts)); //var_dump($content);die(); $social_color = $color == "Yes" || $color == "yes" ? 'color' : ""; $social = '<div class="yt-socialbt"><a data-placement="top" target="_blank" class="sb ' . $type . " " . $size . " " . $style . " " . $social_color . '" title="' . $title . '" href="' . trim($content) . '">'; $social .= '<i class="fa fa-' . $type . '"></i></a></div>'; //echo $social ;die(); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/social_icon/css/social_icon.css"); return $social; }
function skills_itemYTShortcode($atts, $content = null) { global $no_number; extract(ytshortcode_atts(array("title" => '', "number" => ''), $atts)); $skill_item = "<div class='form-group'>"; $skill_item .= "<strong>" . $title . "</strong>"; $skill_item .= $no_number != 'no' || $no_number != 'No' ? "<span class='pull-right'>" . $number . "%</span>" : ''; $skill_item .= "<div class='progress progress-danger active'> <div style='width:" . $number . "%' class='bar'></div> </div>"; $skill_item .= "</div>"; return $skill_item; }
function list_styleYTShortcode($atts, $content = null) { extract(ytshortcode_atts(array("type" => 'check', "color" => ''), $atts)); if ($color != '') { global $list_color; $list_color = $color; } $color = $color != '' ? 'color:' . $color : ""; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/list_style/css/list_style.css"); return '<ul class="yt-list type-' . $type . '" style="' . $color . '">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . '</ul>'; }