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 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 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 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 tabs_itemYTShortcode($atts, $content = null) { extract(ytshortcode_atts(array("title" => '', "icon" => ''), $atts)); global $tab_array; if ($icon != '') { if (strpos($icon, 'icon:') !== false) { $icon = "<i class='fa fa-" . trim(str_replace('icon:', '', $icon)) . "'></i> "; } else { $icon = '<img src="' . yt_image_media($icon) . '" style="width:16px" alt="" /> '; } } $tab_array[] = array("title" => $title, "icon" => $icon, "content" => parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content))); }
function memberYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('style' => '1', 'background' => '#ffffff', 'color' => '#333333', 'shadow' => '', 'border' => '1px solid #cccccc', 'radius' => '0', 'text_align' => 'left', 'photo' => '', 'name' => 'John Doe', 'role' => 'Designer', 'icon_1' => '', 'icon_1_url' => '', 'icon_1_color' => '#444444', 'icon_1_title' => '', 'icon_2' => '', 'icon_2_url' => '', 'icon_2_color' => '#444444', 'icon_2_title' => '', 'icon_3' => '', 'icon_3_url' => '', 'icon_3_color' => '#444444', 'icon_3_title' => '', 'icon_4' => '', 'icon_4_url' => '', 'icon_4_color' => '#444444', 'icon_4_title' => '', 'icon_5' => '', 'icon_5_url' => '', 'icon_5_color' => '#444444', 'icon_5_title' => '', 'icon_6' => '', 'icon_6_url' => '', 'icon_6_color' => '#444444', 'icon_6_title' => '', 'url' => '', 'class' => ''), $atts, 'yt_member'); $icons = array(); $id = uniqid('ytm') . rand() . time(); $css = ''; $box_shadow = $atts['shadow'] ? 'box-shadow:' . $atts['shadow'] . '; -webkit-box-shadow:' . $atts['shadow'] . ';' : ''; $radius = $atts['radius'] ? 'border-radius:' . $atts['radius'] . ';' : ''; $css .= '#' . $id . '.yt-member {background-color:' . $atts['background'] . '; color:' . $atts['color'] . '; border:' . $atts['border'] . ';' . $radius . $box_shadow . '}'; for ($i = 1; $i <= 6; $i++) { if (!$atts['icon_' . $i] || !$atts['icon_' . $i . '_url']) { continue; } if (strpos($atts['icon_' . $i], 'icon:') !== false) { $icon = '<i class="fa fa-' . trim(str_replace('icon:', '', $atts['icon_' . $i])) . '" style="color:' . $atts['icon_' . $i . '_color'] . '"></i>'; } else { $icon = '<img src="' . yt_image_media($atts['icon_' . $i]) . '" width="16" height="16" alt="" />'; } $icons[] = '<a href="' . $atts['icon_' . $i . '_url'] . '" title="' . $atts['icon_' . $i . '_title'] . '" class="yt-memeber-icon yt-m-' . trim(str_replace('icon:', '', $atts['icon_' . $i])) . '" target="_blank" style="text-align:center"> ' . $icon . ' </a>'; } $icons = count($icons) ? '<div class="yt-member-icons" style="text-align:' . $atts['text_align'] . ';"><div class="yt-member-ic">' . implode('', $icons) . '</div></div>' : ''; $multi_photo = array(); $multi_photo = explode(',', $atts['photo'], 2); $member_photo = ''; $member_photo = '<a href="' . $atts['url'] . '" title="' . $atts['name'] . '"><img src="' . yt_image_media($multi_photo[0]) . '" alt="" /></a>'; if (isset($multi_photo[1])) { $member_photo .= '<a href="' . $atts['url'] . '" title="' . $atts['name'] . '"><img src="' . yt_image_media($multi_photo[1]) . '" alt="" /></a>'; } $title = '<span class="yt-member-name">' . $atts['name'] . '</span><span class="yt-member-role">' . $atts['role'] . '</span>'; // Adding asse $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/member/css/membar.css", 'text/css'); // HTML Layout $return = '<div id="' . $id . '" class="yt-member yt-member-style-' . $atts['style'] . '" data-url="' . $atts['url'] . '">'; $return .= '<div class="yt-member-photo">' . $member_photo; if ($atts['style'] == '2' or $atts['style'] == '4') { $return .= $icons; } $return .= '</div>'; $return .= '<div class="yt-member-info" style="text-align:' . $atts['text_align'] . '">'; $return .= $title; $return .= '<div class="yt-member-desc yt-content-wrap">' . parse_shortcode(str_replace(array("<br/>", "<br />", "<p></p>"), " ", $content)) . '</div>'; $return .= '</div>'; if ($atts['style'] != '2' and $atts['style'] != '4') { $return .= $icons; } $return .= '</div>'; return $return; }
function audioYTShortcode($atts, $content = null) { $atts = ytshortcode_atts(array('style' => 'dark', 'url' => false, 'width' => '100%', 'title' => '', 'autoplay' => 'no', 'volume' => 50, 'loop' => 'no', 'class' => ''), $atts, 'audio'); $id = uniqid('ytap') . rand() . time(); // Audio URL check if (!$atts['url']) { return yt_alert_box(JText::_('PLG_SYSTEM_YOUTECH_SHORTCODES_AUDIO_CU'), 'warning'); } $width = $atts['width'] !== 'auto' ? 'max-width:' . $atts['width'] : ''; // Add CSS JS file in head $cssFile = JUri::base() . "plugins/system/ytshortcodes/shortcodes/audio/css/jplayer.skin.css"; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/audio/css/jplayer.skin.css"); JHtml::_('jquery.framework'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/audio/js/jplayer.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/audio/js/audio.js"); // Output HTML $output = '<div id="' . $id . '_container" class="yt-clearfix yt-audio jPlayer audioPlayer jPlayer-' . $atts['style'] . '" data-id="' . $id . '" data-audio="' . yt_image_media($atts['url']) . '" data-swf="' . (JUri::root() . 'plugins/system/ytshortcodes/other/jplayer.swf') . '" data-autoplay="' . $atts['autoplay'] . '" data-volume="' . $atts['volume'] . '" data-loop="' . $atts['loop'] . '"> <div class="playerScreen"> <div id="' . $id . '" class="jPlayer-container"></div> </div> <div class="controls"> <div class="controlset left"> <a tabindex="1" href="#" class="play smooth"><i class="fa fa-play"></i></a> <a tabindex="1" href="#" class="pause smooth"><i class="fa fa-pause"></i></a> </div> <div class="controlset right-volume"> <a tabindex="1" href="#" class="mute smooth"><i class="fa fa-volume-up"></i></a> <a tabindex="1" href="#" class="unmute smooth"><i class="fa fa-volume-off"></i></a> </div> <div class="volumeblock"> <div class="volume-control"><div class="volume-value"></div></div> </div> <div class="jpprogress-block"> <div class="timer current"></div> <div class="timer duration"></div> <div class="jpprogress"> <div class="seekBar"> <div class="playBar"></div> </div> </div> </div> </div> </div>'; return $output; }
function pricing_tables_itemYTShortcode($atts, $content = null) { global $pcolumns, $per, $type; extract(ytshortcode_atts(array("title" => '', "button_link" => '', "button_label" => '', "price" => '', "featured" => '', "text" => 'Popular', "background" => '#4e9e41', "color" => '#fff', "icon_name" => ''), $atts)); $return = ''; if ($icon_name != '') { if (strpos($icon_name, 'icon:') !== false) { $icon_name = '<i class="fa fa-' . trim(str_replace('icon:', '', $icon_name)) . '"></i>'; } else { $icon_name = '<img src="' . yt_image_media($icon_name) . '" width="16" height="16" alt="" />'; } } switch ($type) { case 'style1': $text = strtolower($featured) == "yes" ? $text : ''; $return = '<div class="col-xs-12 col-sm-6 col-md-' . round(12 / $pcolumns) . ' col-lg-' . round(12 / $pcolumns) . '"> <div class="' . $type . ' column ' . ('yes' == strtolower($featured) ? ' featured' : '') . '"> <span class="pricing-featured">' . $text . '</span> <div class="pricing-basic " style=""><h2>' . $title . '</h2></div>' . '<div class="pricing-money block " style="" ><h5>' . $price . '</h5></div>' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . '<div class="pricing-bottom"> <div class="signup"><a href="' . $button_link . '">' . $button_label . '<div class="iconsignup">' . $icon_name . '</div></a></div> </div> ' . '</div></div>'; break; default: case 'style2': //$text= (strtolower($featured)=="true" ? $text : ''); $return = '<div class="col-xs-12 col-sm-6 col-md-' . round(12 / $pcolumns) . ' col-lg-' . round(12 / $pcolumns) . '"> <div class="' . $type . ' column ' . ('true' == strtolower($featured) ? ' featured' : '') . '"> <div class="pricing-basic " style="background:' . $background . '; color:' . $color . '"><h2>' . $title . '</h2><span class="pricing-featured">' . $text . '</span></div>' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . '<div class="pricing-money block ">' . $price . '</div>' . '<div class="pricing-bottom" > <a class="signup" style="background:' . $background . ';color:' . $color . '" href="' . $button_link . '">' . $button_label . '</a> </div> ' . '</div></div>'; break; case 'style3': $text = strtolower($featured) == "true" ? $text : ''; $return = '<div class="col-xs-12 col-sm-6 col-md-' . round(12 / $pcolumns) . ' col-lg-' . round(12 / $pcolumns) . '"> <div class="' . $type . ' column ' . ('true' == strtolower($featured) ? ' featured' : '') . '"> <div class="pricing-basic " style="background:#e74847; color:' . $color . '"><h2>' . $title . '</h2><span class="pricing-featured">' . $text . '</span></div>' . '<div class="pricing-money block "><h1>' . $price . '</h1></div>' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . '<div class="pricing-bottom" > <a class="signup" style="background:#e74847;color:' . $color . '" href="' . $button_link . '">' . $button_label . '</a> </div> ' . '</div></div>'; } return $return; }
function counterYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('align' => 'none', 'text_align' => 'top', 'width' => '', 'count_start' => 1, 'count_end' => 5000, 'counter_speed' => 5, 'separator' => 'no', 'prefix' => '', 'suffix' => '', 'count_color' => '', 'count_size' => '32px', 'text_color' => '', 'text_size' => '14px', 'icon' => '', 'icon_color' => '', 'icon_size' => '24px', 'border' => '', 'background' => '', 'border_radius' => '', 'class' => ''), $atts); $id = uniqid('ytc') . rand() . time(); $css = ''; if (strpos($atts['icon'], '/') !== false) { $atts['icon'] = '<img src="' . yt_image_media($atts['icon']) . '" style="width:' . $atts['icon_size'] . ';" alt="" />'; } else { if (strpos($atts['icon'], 'icon:') !== false) { $atts['icon'] = '<i class="fa fa-' . trim(str_replace('icon:', '', $atts['icon'])) . '"></i>'; } } $icon = $atts['icon'] ? '<div class="yt-counter-icon" style="float:left; margin-right:10px">' . $atts['icon'] . '</div>' : ''; $border = $atts['border'] ? 'border:' . $atts['border'] . ';' : ''; $background = $atts['background'] ? 'background-color:' . $atts['background'] . ';' : ''; if ($border or $background) { $css .= '#' . $id . ' {' . $background . $border . '}'; } $count_color = $atts['count_color'] ? 'color:' . $atts['count_color'] . ';' : ''; $text_color = $atts['text_color'] ? 'color:' . $atts['text_color'] . ';' : ''; $icon_color = $atts['icon_color'] ? 'color:' . $atts['icon_color'] . ';' : ''; $css .= '#' . $id . ' .yt-counter-number {font-size: ' . $atts['count_size'] . '; ' . $count_color . ' }'; $css .= '#' . $id . ' .yt-counter-text {' . $text_color . ' font-size: ' . $atts['text_size'] . ';}'; $css .= '#' . $id . ' i {' . $icon_color . '' . 'font-size:' . $atts['count_size'] . '; line-height: 1.42857;}'; // Add css file in head $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/counter/css/counter.css", 'text/css', "screen"); // Add javascript file in head JHtml::_('jquery.framework'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/jquery.appear.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/counter/js/countUp.js"); $return = '<div id="' . $id . '" class="yt-counter-wrapper clearfix yt-counter-' . $atts['align'] . ' ' . trim($atts['class']) . ' pull-' . $atts['text_align'] . '" style="width:' . $atts['width'] . '; overflow:auto; border-radius:' . $atts['border_radius'] . '" data-id="' . $id . '" data-from="' . $atts['count_start'] . '" data-to="' . $atts['count_end'] . '" data-speed="' . $atts['counter_speed'] . '" data-separator="' . $atts['separator'] . '" data-prefix="' . $atts['prefix'] . '" data-suffix="' . $atts['suffix'] . '">'; $return .= $icon; $return .= '<div class="yt-counter-desc" > <div id="' . $id . '_count" class="yt-counter-number"> </div> <div class="yt-counter-text">' . parse_shortcode(str_replace(array("<br/>", "<br />", "<p></p>"), " ", $content)) . '</div> </div>'; $return .= '</div>'; return $return; }
function iconYTShortcode($atts, $content = null) { $atts = ytshortcode_atts(array('icon' => 'icon: heart', 'background' => '#eeeeee', 'color' => '#333333', 'size' => '20', 'shape_size' => '', 'padding' => '15px', 'radius' => '3px', 'border' => 'none', 'margin' => '', 'url' => '', 'target' => 'blank', 'class' => ''), $atts, 'icon'); $id = uniqid('ytico_') . rand() . time(); $css = ''; // dep 1.6.7 if ($atts['shape_size']) { $atts['padding'] = $atts['shape_size']; } if ($atts['margin']) { $css .= '#' . $id . '.yt-icon{margin:' . $atts['margin'] . '}'; } if (strpos($atts['icon'], '/') !== false) { $css .= '#' . $id . '.yt-icon img{ width:' . $atts['size'] . 'px;height:' . $atts['size'] . 'px;background:' . $atts['background'] . ';-webkit-border-radius:' . $atts['radius'] . ';border-radius:' . $atts['radius'] . ';border: ' . $atts['border'] . ';padding:' . $atts['padding'] . '; }'; } else { if (strpos($atts['icon'], 'icon:') !== false) { $css .= '#' . $id . '.yt-icon i{ font-size:' . $atts['size'] . 'px;line-height:' . $atts['size'] . 'px;background:' . $atts['background'] . ';color:' . $atts['color'] . ';-webkit-border-radius:' . $atts['radius'] . ';border-radius:' . $atts['radius'] . ';border: ' . $atts['border'] . '; padding:' . $atts['padding'] . '; }'; } } if (strpos($atts['icon'], '/') !== false) { $atts['icon'] = '<img src="' . yt_image_media($atts['icon']) . '" alt="" width="' . intval($atts['size']) . 'px;" height="' . intval($atts['size']) . 'px" />'; } else { if (strpos($atts['icon'], 'icon:') !== false) { $atts['icon'] = '<i class="fa fa-' . trim(str_replace('icon:', '', $atts['icon'])) . '"></i>'; } } // Prepare text if ($content) { $content = '<span class="yt-icon-text">' . $content . '</span>'; } if (!$atts['url']) { $icon = '<span id="' . $id . '" class="yt-icon">' . $atts['icon'] . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />", "<p>", "</p>"), " ", $content)) . '</span>'; } else { $icon = '<a id="' . $id . '" href="' . $atts['url'] . '" class="yt-icon" target="_' . $atts['target'] . '">' . $atts['icon'] . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />", "<p>", "</p>"), " ", $content)) . '</a>'; } // Asset added JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/icon/css/icon.css", 'text/css'); $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); return $icon; }
function toggle_box_itemYTShortcode($atts, $content = null) { extract(ytshortcode_atts(array("title" => '', "icon" => '', "active" => '', "background" => '#f1f1f1', "color" => '#000'), $atts)); $toggle_active = strtoupper($active) == 'YES' ? 'active' : ''; $icon_active = ''; if ($icon != '') { if (strpos($icon, 'icon:') !== false) { $icon_active .= "<i class='fa fa-" . trim(str_replace('icon:', '', $icon)) . "'></i> "; } else { $icon_active .= '<img src="' . yt_image_media($icon) . '" style="width:16px" alt="" /> '; } } $toggle_item = "<li class='yt-divider'>"; $toggle_item = $toggle_item . "<h3 class='toggle-box-head " . $toggle_active . "' style=' " . ($background != '' ? 'background:' . $background . '' : '') . ";" . ($color != '' ? 'color:' . $color . '' : '') . "'>"; $toggle_item = $toggle_item . $icon_active; $toggle_item = $toggle_item . "<span style='color:" . $color . "; " . ($background == '' ? 'background:rgba(255,255,255,0.5)' : 'background:none') . "'></span>"; $toggle_item = $toggle_item . $title . "</h3>"; $toggle_item = $toggle_item . "<div class='toggle-box-content " . $toggle_active . "' style='border-color:" . $background . "'>" . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)) . "</div>"; $toggle_item = $toggle_item . "</li>"; return $toggle_item; }
function portfolioYTShortcode($atts, $content = null) { $atts = ytshortcode_atts(array('style' => 1, 'source' => '', 'limit' => 15, 'color' => '#cccccc', 'intro_text_limit' => 50, 'grid_type' => 0, 'animation' => 'fade', 'speed' => 600, 'rotate' => 99, 'delay' => 20, 'border' => 0, 'padding' => 10, 'thumb_width' => 640, 'thumb_height' => 480, 'class' => ''), $atts, 'portfolio'); $return = ''; $slides = (array) get_slides($atts); $intro_text = ''; $title = ''; if (count($slides)) { $id = uniqid('ytpor_') . rand() . time(); $return .= '<script>jQuery(document).ready(function($) { $(\'#' . $id . ' .megafolio-container\').each(function () { data = $(this).data(); var api=$(this).megafoliopro({ filterChangeAnimation: data.animation, // fade, rotate, scale, rotatescale, pagetop, pagebottom,pagemiddle filterChangeSpeed: data.speed, // Speed of Transition filterChangeRotate:data.rotate, // If you ue scalerotate or rotate you can set the rotation (99 = random !!) filterChangeScale:0.6, // Scale Animation Endparameter delay: data.delay, defaultWidth:980, paddingHorizontal:data.padding, paddingVertical:data.padding, layoutarray:[data.grid_types] // Defines the Layout Types which can be used in the Gallery. 2-9 or "random". You can define more than one, like {5,2,6,4} where the first items will be orderd in layout 5, the next comming items in layout 2, the next comming items in layout 6 etc... You can use also simple {9} then all item ordered in Layout 9 type. }); // CALL FILTER FUNCTION IF ANY FILTER HAS BEEN CLICKED $(\'#' . $id . ' .filter\').click(function() { $(\'#' . $id . ' .filter\').each(function() { $(this).removeClass("selected")}); api.megafilter($(this).data(\'category\')); $(this).addClass("selected"); }); // Lightbox for galleries (slider, carousel, custom_gallery) $(this).find(\'.yt-lightbox-item\').magnificPopup({ type: \'image\', mainClass: \'mfp-zoom-in mfp-img-mobile\', closeBtnInside: false, tLoading: \'\', // remove text from preloader removalDelay: 400, //delay removal by X to allow out-animation gallery: { enabled: true, navigateByImgClick: true, preload: [0, 1] // Will preload 0 - before current, and 1 after the current image }, callbacks: { open: function() { //overwrite default prev + next function. Add timeout for css3 crossfade animation $.magnificPopup.instance.next = function() { var self = this; self.wrap.removeClass(\'mfp-image-loaded\'); setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120); } $.magnificPopup.instance.prev = function() { var self = this; self.wrap.removeClass(\'mfp-image-loaded\'); setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120); } }, imageLoadComplete: function() { var self = this; setTimeout(function() { self.wrap.addClass(\'mfp-image-loaded\'); }, 16); } } }); }); }); </script>'; $return .= '<div id="' . $id . '" class="yt-portfolio sup-style' . $atts['style'] . ' ' . $atts['class'] . '" > <div class="filter_padder" > <div class="filter_wrapper"> <div class="filter selected" data-category="cat-all">All</div>'; $category = array(); foreach ((array) $slides as $slide) { if (in_array($slide['category'], $category)) { continue; } $category[] = $slide['category']; $return .= '<div class="filter" data-category="' . str_replace(' ', '-', strtolower($slide['category'])) . '">' . $slide['category'] . '</div>'; } $return .= ' <div class="clear"></div> </div> </div> <div class="clear"></div> <div class="megafolio-container" data-grid_types="' . $atts['grid_type'] . '" data-speed="' . $atts['speed'] . '" data-delay="' . $atts['delay'] . '" data-rotate="' . $atts['rotate'] . '" data-padding="' . intval($atts['padding']) . '" data-animation="' . $atts['animation'] . '" >'; $limit = 1; foreach ((array) $slides as $slide) { $thumb_url = yt_image_resize($slide['image'], $atts['thumb_width'], $atts['thumb_height'], 95); // Title condition if ($slide['title']) { $title = stripslashes($slide['title']); } if (isset($slide['introtext'])) { $intro_text = $slide['introtext']; if ($atts['intro_text_limit']) { $atts['intro_text'] = yt_char_limit($intro_text, $atts['intro_text_limit']); } } $category = str_replace(' ', '-', strtolower($slide['category'])); if ($atts['style'] == 2) { $return .= ' <div class="mega-entry cat-all ' . $category . '" data-src="' . yt_image_media($thumb_url['url']) . '" data-width="500" data-height="500"> <div class="links-container"> <a class="hoverlink project-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '"> <i class=" fa fa-link"></i> <span></span> </a> <a class="hoverlink yt-lightbox-item" href="' . yt_image_media($slide['image']) . '" title="' . strip_tags($title) . '"> <i class=" fa fa-search"></i> <span></span> </a> </div> <div class="rollover-content mega-covercaption mega-square-bottom mega-portrait-bottom"> <div class="rollover-content-container"> <h3 class="entry-title">' . $title . '</h3> <div class="entry-meta"> <div class="yt-portfolio-date"> <span class="yt-pdate">' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . '</span> </div> <div class="portfolio-categories"> <span class="category">' . $category . '</span> </div> </div> </div> </div> </div>'; } elseif ($atts['style'] == 3) { $return .= ' <div class="mega-entry cat-all ' . $category . '" data-src="' . yt_image_media($thumb_url['url']) . '" data-width="500" data-height="500"> <div class="mega-hover notitle"> <a class="yt-lightbox-item" href="' . yt_image_media($slide['image']) . '" title="' . strip_tags($title) . '"> <div class="mega-hoverview fa fa-search"></div> </a> <a class="hoverlink project-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '"> <i class="mega-hoverlink fa fa-link"></i> </a> </div> <div class="gallerycaption-bottom"> ' . $title . ' <div class="gallerysubline">' . $category . '</div> </div> </div>'; } elseif ($atts['style'] == 4) { $return .= ' <div class="mega-entry portfolio-style4 cat-all ' . $category . '" data-src="' . yt_image_media($thumb_url['url']) . '" data-width="500" data-height="500"> <div class="portfolio-links"> <a class="yt-lightbox-item" href="' . yt_image_media($slide['image']) . '" title="' . strip_tags($title) . '"> <i class="fa fa-search"></i> </a> <a class="portfolio-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '"> <i class="fa fa-link"></i> </a> </div> <div class="portfolio-content"> <div class="portfolio-title">' . $title . '</div> <div class="portfolio-desc">' . $atts['intro_text'] . '</div> </div> </div>'; } else { $return .= ' <div class="mega-entry cat-all ' . $category . '" data-src="' . yt_image_media($thumb_url['url']) . '" data-width="500" data-height="500"> <div class="mega-hover"> <div class="mega-hovertitle">' . $title . ' <div class="mega-hoversubtitle">' . $atts['intro_text'] . '</div> </div> <a href="' . $slide['link'] . '" title="' . strip_tags($title) . '"> <i class="mega-hoverlink fa fa-link"></i> </a> <a class="yt-lightbox-item" href="' . yt_image_media($slide['image']) . '" title="' . strip_tags($title) . '"> <i class="mega-hoverview fa fa-search"></i> </a> </div> </div>'; } if ($limit++ == $atts['limit']) { break; } } $return .= '</div></div>'; $css = ' #' . $id . ' .mega-hoversubtitle { color: ' . $atts['color'] . ';} #' . $id . ' .mega-entry .mega-entry-innerwrap { border: ' . $atts['border'] . ';} '; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/portfolio/css/portfolio.css", 'text/css', "screen"); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/assets/css/magnific-popup.css", 'text/css', "screen"); JHtml::_('jquery.framework'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/magnific-popup.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/portfolio/js/themepunch_tools.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/portfolio/js/themepunch_megafoliopro.js"); $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); } else { $return = yt_alert_box('Please select your correct article source.', 'warning'); } 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>'; }
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 contact_formYTShortcode($atts, $content = null) { extract(ytshortcode_atts(array('type' => 'border', 'style' => 'default', 'email' => '', 'name' => 'yes', 'subject' => 'yes', 'submit_button_text' => '', 'label_show' => 'yes', 'textarea_height' => '120', 'reset' => 'yes', 'margin' => '', 'class' => '', 'color_name' => '#000', 'background_name' => '#fff', 'icon_name' => '', 'color_email' => '#000', 'background_email' => '#fff', 'icon_email' => '', 'color_subject' => '#000', 'background_subject' => '#fff', 'icon_subject' => '', 'color_message' => '#000', 'background_message' => '#fff', 'add_field' => '', 'btn_submit' => 'info', 'btn_reset' => 'warning'), $atts)); $config = JFactory::getConfig(); parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $content)); // add filed $addstr = ''; $idman = ''; $iduniq = uniqid('ytcf_') . rand() . time(); $validation_mandatory = ''; if ($icon_name != '') { if (strpos($icon_name, 'icon:') !== false) { $icon_name = "<span class='add-on' style='background:" . $background_name . "; color:" . $color_name . "'><i class='fa fa-" . trim(str_replace('icon:', '', $icon_name)) . "'></i></span> "; } else { $icon_name = '<span class="add-on" style="background:' . $background_name . '; color:' . $color_name . '"><img src="' . yt_image_media($icon_name) . '" style="width:18px" alt="" /></span> '; } } if ($icon_email != '') { if (strpos($icon_email, 'icon:') !== false) { $icon_email = "<span class='add-on' style='background:" . $background_name . "; color:" . $color_name . "'><i class='fa fa-" . trim(str_replace('icon:', '', $icon_email)) . "'></i></span> "; } else { $icon_email = '<span class="add-on" style="background:' . $background_name . '; color:' . $color_name . '"><img src="' . yt_image_media($icon_email) . '" style="width:18px" alt="" /></span> '; } } if ($icon_subject != '') { if (strpos($icon_subject, 'icon:') !== false) { $icon_subject = "<span class='add-on' style='background:" . $background_name . "; color:" . $color_name . "'><i class='fa fa-" . trim(str_replace('icon:', '', $icon_subject)) . "'></i></span> "; } else { $icon_subject = '<span class="add-on" style="background:' . $background_name . '; color:' . $color_name . '"><img src="' . yt_image_media($icon_subject) . '" style="width:18px" alt="" /></span> '; } } if ($add_field != '') { $field_array = explode(',', $add_field); if (count($field_array) > 0) { $addstr .= '<div class="yt-form-common-field">'; for ($i = 0; $i < count($field_array); $i++) { $str1 = $field_array[$i]; $str1_array = explode('|', $str1); if (count($str1_array) > 4) { if (count($str1_array) > 5) { if ($str1_array[5] == 'yes') { $idman = 'mandatory' . $iduniq; } $validation_mandatory = $str1_array[0]; } $icon_add = ''; if (count($str1_array) > 6) { $icon_add = '<span class="add-on" style="background:' . $str1_array[4] . ';color:' . $str1_array[3] . '"><i class="fa fa-' . $str1_array[6] . '"></i></span>'; } $addstr .= ' <div class="form-group"> '; if (strtolower($label_show) == 'yes' || strtolower($label_show) == 'no|yes') { $addstr .= '<label for="' . $str1_array[0] . '" class="yt-form-label" style="color:' . $str1_array[3] . '">' . $str1_array[0] . ':</label>'; } $addstr .= ' <div class="yt-input-box ' . ($icon_add != "" ? "yt-input-prepend" : "") . '">'; if ($str1_array[1] == 'textarea') { $addstr .= '<textarea id="' . $str1_array[0] . ' " placeholder="' . $str1_array[2] . '" class="form-control-1 ' . $idman . '" name="' . $str1_array[0] . '" style="height: ' . $textarea_height . 'px; margin-bottom:10px; background:' . $str1_array[4] . ';color:' . $str1_array[3] . ' !important" ></textarea>'; } else { $addstr .= $icon_add; $addstr .= '<input type="' . $str1_array[1] . '" placeholder="' . $str1_array[2] . '" id="' . $str1_array[0] . '" class="form-control-1 ' . $idman . '" name="' . $str1_array[0] . '" style="background:' . $str1_array[4] . ';margin-bottom:10px;color:' . $str1_array[3] . '" />'; } $addstr .= '</div> </div>'; } } $addstr .= '</div>'; } } $margin = $margin != '' ? 'margin: ' . $margin : ' margin: 0 0 25px 0'; JHtml::_('jquery.framework'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/contact_form/js/contact_form.js"); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/contact_form/css/contact_form.css"); $fields = ""; if ($name == 'yes' && $subject == 'yes') { $fields .= 'name-email-subject'; } elseif ($name == 'yes') { $fields .= 'name-email'; } elseif ($subject == 'yes') { $fields .= 'email-subject'; } else { $fields .= 'email'; } if (isset($_POST['email'])) { $name = ''; $email1 = ''; $message = ''; $subject = ''; if (isset($_POST['name'])) { $name = $_POST['name']; } if (isset($_POST['email'])) { $email1 = $_POST['email']; } if (isset($_POST['subject'])) { $subject = $_POST['subject']; } if (isset($_POST['message'])) { $message = $_POST['message']; } $to = $email ? $email : $config->get('mailfrom'); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; if (!empty($subject)) { $subject = $subject; } else { $subject = $config->get('fromname'); } if (!empty($name)) { $name = $name; } else { $name = $config->get('fromname'); } $addmess = ''; if ($add_field != '') { $field_a = explode(',', $add_field); for ($i = 0; $i < count($field_a); $i++) { $str2 = $field_a[$i]; $str2_array = explode('|', $str2); $addmess .= '<tr> <td>' . $str2_array[0] . '</td> <td>' . $_POST["" . $str2_array[0] . ""] . '</td> </tr>'; } } $message = '<table> <tr> <td>Name</td> <td>' . $name . '</td> </tr> <tr> <td>Email</td> <td>' . $email1 . '</td> </tr> ' . $addmess . ' <tr> <td>Message</td> <td>' . $message . '</td> </tr> </table>'; if (!$email1) { $erre = "Email"; } elseif (!$message) { $errm = "Message"; } else { $email1 = trim($email1); $_ename = "/^[-!#\$%&\\'*+\\.\\/0-9=?A-Z^_'{|}~]+"; $_host = "([0-9A-Z]+\\.)+"; $_tlds = "([0-9A-Z]){2,4}\$/i"; $mail_validate = FALSE; if (!preg_match($_ename . "@" . $_host . $_tlds, $email1)) { $mail_validate = TRUE; $errev = "Please enter a valid e-mail address"; } else { $mail1 = JFactory::getMailer(); $mail1->IsHTML(true); $mail1->addRecipient($to); $mail1->setSender(array($config->get('mailfrom'), $name)); $mail1->setSubject($subject); $mail1->setBody($message); $result = new stdClass(); if ($mail1->Send()) { echo '1'; } else { echo '0'; } exit(0); } } } $str = ' <div class="yt-clearfix yt-contact_form ' . $type . ' ' . $fields . '" style="' . $margin . '"> <script type="text/javascript"> jQuery(document).ready(function() { jQuery(document).off(\'click\', \'input[name="contact_us_submit' . $iduniq . '"]\'); jQuery(document).on(\'click\', \'input[name="contact_us_reset' . $iduniq . '"]\', function(e) { resetForm("contact_us_form' . $iduniq . '"); }); jQuery(document).on(\'click\', \'input[name="contact_us_submit' . $iduniq . '"]\', function(e) { //e.preventDefault; $ = jQuery; var form = jQuery(\'form[name="contact_us_form' . $iduniq . '"]\'); var formData = form.serialize(); var formAction = form.attr(\'action\'); var name = escape(jQuery(\'#name' . $iduniq . '\').val()); var email = escape(jQuery(\'#email' . $iduniq . '\').val()); var message = escape(jQuery(\'#message' . $iduniq . '\').val()); var subject = escape(jQuery(\'#subject' . $iduniq . '\').val()); var mandatory = escape(jQuery(\'.mandatory' . $iduniq . '\').val()); var validation_mandatory = escape(jQuery(\'.mandatory' . $iduniq . '\').attr(\'name\')); isVal = false; vEmail = isValidEmail(email); if (name == "") { onErrorMessage(\'danger\', validation_name); } else if (email == "") { onErrorMessage(\'danger\', validation_email); } else if (!isNaN(email) || vEmail == false) { onErrorMessage(\'danger\', validation_vemail); } else if (subject == "") { onErrorMessage(\'danger\', validation_subject); } else if (mandatory == "") { onErrorMessage(\'danger\', validation_mandatory); }else if (message == "") { onErrorMessage(\'danger\', validation_message); }else { isVal = true; } if (isVal != false) { onContactSubmit(formAction, formData); } }); function onErrorMessage(msgType, msgText) { jQuery(\'.error-message.' . $iduniq . '\').removeClass(\'message-info\'); jQuery(\'.error-message.' . $iduniq . '\').removeClass(\'message-warning\'); jQuery(\'.error-message.' . $iduniq . '\').removeClass(\'message-success\'); jQuery(\'.error-message.' . $iduniq . '\').removeClass(\'message-danger\'); if (msgType == \'info\') { jQuery(\'.error-message.' . $iduniq . '\').addClass(\'message-info\'); } else if (msgType == \'warning\') { jQuery(\'.error-message.' . $iduniq . '\').addClass(\'message-warning\'); } else if (msgType == \'success\') { jQuery(\'.error-message.' . $iduniq . '\').addClass(\'message-success\'); } else if (msgType == \'danger\') { jQuery(\'.error-message.' . $iduniq . '\').addClass(\'message-danger\'); } if (jQuery(\'.error-message.' . $iduniq . '\').is(\':visible\')) { jQuery(\'.error-message.' . $iduniq . ' .text\').html(msgText); } else { jQuery(\'.error-message.' . $iduniq . ' .text\').html(msgText); jQuery(\'.error-message.' . $iduniq . '\').slideDown(800); } } function onContactSubmit(formAction, formData) { jQuery.ajax({ \'type\' : \'POST\', \'url\' : formAction, \'data\' : formData, \'dataType\': \'json\', \'success\' : function(response) { if (response == 1) { jQuery(\'#contact_us_form' . $iduniq . '\').each(function() { this.reset(); }); onErrorMessage(\'success\', \'Your Message Has been Sent Successfully\'); jQuery(\'body\').animate ({ opacity : 1 }, 1600, function() { if (jQuery(\'.error-message.' . $iduniq . '\').is(\':visible\')) { jQuery(\'.error-message.' . $iduniq . '\').slideUp(800); } }); } else { onErrorMessage(\'warning\', \'Server Processing Error\'); } } }); }; }); validation_name="Name"; validation_email="Email"; validation_vemail="Please enter a valid e-mail address"; validation_subject="Subject"; validation_message="Message"; </script> <div class="yt-form-wrapper"> <div class="yt-form"> <div class="error-message ' . $iduniq . '"> <span class="text"></span> </div> <form name="contact_us_form' . $iduniq . '" id="contact_us_form' . $iduniq . '" class="yt-clearfix contact_us_form " action="' . JURI::current() . '" method="POST"> <div class="yt-form-fields"> '; if (strtolower($name) == 'yes') { $str .= ' <div class="form-group"> '; if (strtolower($label_show) == 'yes' || strtolower($label_show) == 'no|yes') { $str .= '<label for="name' . $iduniq . '" class="yt-form-label" style="color:' . $color_name . '">Your Name:</label>'; } $str .= ' <div class="yt-input-box ' . ($icon_name != "" ? "yt-input-prepend" : "") . '"> ' . $icon_name . ' <input type="text" placeholder="Name" id="name' . $iduniq . '" class="form-control-1" name="name" style="background:' . $background_name . ';color:' . $color_name . ' !important ; " /> </div> </div>'; } $str .= ' <div class="form-group"> '; if (strtolower($label_show) == 'yes') { $str .= '<label for="email' . $iduniq . '" class="yt-form-label" style="color:' . $color_email . '">Your E-Mail:</label>'; } $str .= ' <div class="yt-input-box ' . ($icon_email != "" ? "yt-input-prepend" : "") . '"> ' . $icon_email . ' <input type="text" placeholder="Email" id="email' . $iduniq . '" class="form-control-1" name="email" style="background:' . $background_email . ';color:' . $color_email . '" /> </div> </div>'; if (strtolower($subject) == 'yes' || strtolower($subject) == 'no|yes') { $str .= ' <div class="form-group"> '; if (strtolower($label_show) == 'yes') { $str .= '<label for="subject' . $iduniq . '" class="yt-form-label" style="color:' . $color_subject . '">Your Subject:</label>'; } $str .= ' <div class="yt-input-box ' . ($icon_subject != "" ? "yt-input-prepend" : "") . '"> ' . $icon_subject . ' <input type="text" placeholder="Subject" id="subject' . $iduniq . '" class="form-control-1" name="subject" style="background:' . $background_subject . ';color:' . $color_subject . '" > </div> </div> '; } $str .= ' </div>'; $str .= $addstr; $str .= ' <div class="yt-form-common-field"> <div class="form-group "> '; if (strtolower($label_show) == 'yes' || strtolower($label_show) == 'no|yes') { $str .= '<label for="message' . $iduniq . '" class="yt-form-label" style="color:' . $color_message . '">Your Message:</label>'; } $str .= ' <div class="yt-input-box"> <textarea id="message' . $iduniq . '" placeholder="Message" class="form-control-1 message" name="message" style="height: ' . $textarea_height . 'px; background:' . $background_message . ';color:' . $color_message . '" ></textarea> </div> </div> <div style="display: none;"></div> <div class="form-group"> <div class=" submit-button"> '; if ($submit_button_text) { $str .= '<input name="contact_us_submit' . $iduniq . '" class="btn btn-' . $btn_submit . '" type="button" value="' . $submit_button_text . '" />'; } else { $str .= '<input name="contact_us_submit' . $iduniq . '" class="btn btn-' . $btn_submit . '" type="button" value="Submit" />'; } if (strtolower($reset) == 'yes' || strtolower($reset) == 'no|yes') { $str .= '<input name="contact_us_reset' . $iduniq . '" class="btn btn-' . $btn_reset . '" type="reset" value="Reset" />'; } $str .= ' </div> </div> </div> </form> </div> </div> </div>'; return $str; }
function buttonsYTShortcode($atts, $content = null) { extract(ytshortcode_atts(array("type" => '', "size" => 'sm', "full" => 'no', "icon" => 'home', "link" => '#', "radius" => '3px', "target" => '', "title" => '', "position" => '', "subtitle" => '', "style" => '', "iconposition" => '', "background" => '#4e9e41', "color" => '#fff', "icon_right" => '', "center" => 'no', "animated_icon" => 'no', "box_shadow_color" => '#337e27', "linear_color" => '#4e9e41', "gradient_color" => '#93c38c'), $atts)); $yt_btn_icon = ''; $icon_right = ''; $dropshadow = ''; $stylecss = ''; if ($type == "line") { $dropshadow = 'box-shadow:0px 6px 0px ' . $background . ';'; } if ($style == "bottom_line") { $stylecss .= "box-shadow:0px 6px 0px " . $box_shadow_color; } else { if ($style == "3d") { $stylecss .= "background:linear-gradient(19deg," . $background . " 50%," . $linear_color . " 50%)"; } } $animated_icon = $animated_icon == 'yes' ? 'fa-spin' : ''; if ($icon != '') { if (strpos($icon, 'icon:') !== false) { $yt_btn_icon = "<i class='fa " . $animated_icon . " fa-" . trim(str_replace('icon:', '', $icon)) . "'></i> "; } else { $yt_btn_icon = '<img src="' . yt_image_media($icon) . '" style="width:18px" alt="" /> '; } } if ($icon_right != '') { if (strpos($icon_right, 'icon:') !== false) { $icon_right = "<i class='fa fa-" . trim(str_replace('icon:', '', $icon_right)) . "'></i> "; } else { $icon_right = '<img src="' . yt_image_media($icon_right) . '" style="width:18px" alt="" /> '; } } $center = $center == "yes" ? 'text-align:center' : ''; switch ($style) { case 'border': $color = $color == '#fff' ? 'color:' . $background : 'color:' . $color; $background = 'border-color:' . $background; break; case 'dot': $color = $color == '#fff' ? 'color:' . $background : 'color:' . $color; $background = 'border-color:' . $background; break; case 'transparent': $background = "background:transparent;border-style:solid; border-color:" . $background . "; border-width:1px"; $color = 'color:' . $color; break; case 'gradient': $background = "background: -webkit-linear-gradient(" . $gradient_color . ", " . $background . "); /* For Safari 5.1 to 6.0 */\n background: -o-linear-gradient(" . $gradient_color . ", " . $background . "); /* For Opera 11.1 to 12.0 */\n background: -moz-linear-gradient(" . $gradient_color . ", " . $background . "); /* For Firefox 3.6 to 15 */\n background: linear-gradient(" . $gradient_color . ", " . $background . "); /* Standard syntax (must be last) */"; $color = 'color:' . $color; break; default: $background = 'background:' . $background; $color = $color != '' ? 'color:' . $color : ''; break; } if ($subtitle != "") { $subtitle = '<small style="display: block;margin: 5px 0px 0px;color: inherit;text-align: center;font-style: normal;font-size: 0.8em;line-height: 1;opacity: 0.7;">' . $subtitle . '</small>'; } else { $subtitle = ''; } return '<a class="yt-clearfix buttons-style-' . $style . ' ytyt_btn' . ($type != '' ? ' yt_btn-' . $type : '') . ($size != '' ? ' yt_btn-' . $size : '') . ($full == 'yes' ? ' yt_btn-block' : '') . ' " style="border-radius:' . $radius . '; ' . $background . ';' . $dropshadow . '; ' . $color . '; ' . $center . ' ; ' . $stylecss . '" href="' . $link . '" target="' . $target . '" data-placement="' . $position . '" title="' . $title . '">' . '<span class="span-buttons"><span>' . $yt_btn_icon . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />", "<p>", "</p>"), " ", $content)) . $icon_right . '</span> ' . $subtitle . '</span></a>'; }
function carouselYTShortcode($atts, $content = null) { $return = ''; $atts = ytshortcode_atts(array('style' => '1', 'source' => '', 'limit' => 5, 'items' => 4, '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, 'margin' => 10, 'scroll' => 1, 'arrows' => 'no', 'arrow_position' => 'default', 'pagination' => 'yes', 'autoplay' => 'no', 'delay' => 4, 'speed' => 0.35, 'hoverpause' => 'no', 'lazyload' => 'no', 'loop' => 'yes', 'class' => ''), $atts, 'yt_carousel'); $id = uniqid('ytc') . rand() . time(); $title = ""; $image = ""; $intro_text = ''; $css = ''; $background = ''; $color = ''; $lang = JFactory::getLanguage(); $lang = $lang->isRTL() ? 'true' : 'false'; $slides = (array) get_slides($atts); if ($atts['background'] or $atts['color']) { $background = $atts['background'] ? 'background-color:' . $atts['background'] . ';' : ''; $color = $atts['color'] ? 'color:' . $atts['color'] . ';' : ''; $css .= '.' . $id . ' .yt-carousel-slide {' . $background . $color . '}'; if ($atts['style'] == 3) { $css .= '.' . $id . '.yt-carousel-style-3 .yt-carousel-caption:after {border-bottom-color: ' . $atts['background'] . ';}'; } } if ($atts['title_color']) { $css .= '.' . $id . '.yt-carousel-slide .yt-carousel-slide-title a {color: ' . $atts['title_color'] . ';}'; $css .= '.' . $id . '.yt-carousel-slide .yt-carousel-slide-title a:hover {color: ' . yt_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'] .= ' yt-carousel-media'; } $return .= '<div id="' . $id . '" class="yt-clearfix ' . $id . ' ' . $atts['class'] . ' yt-carousel yt-carousel-style-' . $atts['style'] . ' yt-carousel-title-' . $atts['title'] . ' arrow-' . $atts['arrow_position'] . '" 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-margin="' . $atts['margin'] . '" data-scroll="' . $atts['scroll'] . '" data-loop="' . $atts['loop'] . '" data-rtl="' . $lang . '" ><div class="' . $id . ' yt-carousel-slides">'; $limit = 1; foreach ((array) $slides as $slide) { $image_url = ''; if ($slide['image']) { $image_url = yt_image_resize($slide['image'], $atts['image_width'], $atts['image_height'], $atts['quality']); } else { $image_url = yt_image_resize('plugins/system/ytshortcodes/assets/images/URL_IMAGES.png', $atts['image_width'], $atts['image_height'], $atts['quality']); } if ($atts['title'] == 'yes' && $slide['title']) { $title = stripslashes($slide['title']); if ($atts['title_limit']) { $title = yt_char_limit($title, $atts['title_limit']); } if ($atts['title_link'] == "yes") { $title = '<a href="' . $slide['link'] . '">' . $title . '</a>'; } $title = '<h3 class="yt-carousel-slide-title">' . $title . '</h3>'; } if ($atts['intro_text'] === 'yes' and isset($slide['introtext'])) { $intro_text = $slide['introtext']; if ($atts['intro_text_limit']) { $intro_text = yt_char_limit($intro_text, $atts['intro_text_limit']); } $intro_text = '<div class="yt-carousel-item-text">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $intro_text)) . '</div>'; } $return .= '<div class="' . $id . ' yt-carousel-slide">'; if (isset($image_url) && $atts['image'] == 'yes') { $return .= '<div class="yt-carousel-image">'; if (isset($image_url)) { $return .= '<div class="yt-carousel-links"> <a class="yt-lightbox-item" href="' . yt_image_media($slide['image']) . '" title="' . strip_tags($title) . '"> <i class="fa fa-search"></i> </a>'; if ($source != 'media') { $return .= '<a class="yt-carousel-link" href="' . $slide['link'] . '" title="' . strip_tags($title) . '"> <i class="fa fa-link"></i> </a>'; } $return .= '</div>'; } $return .= '<img src="' . yt_image_media($image_url['url']) . '" alt="' . strip_tags($title) . '" />'; $return .= '</div>'; } if ($title or $intro_text) { $return .= '<div class="yt-carousel-caption">' . $title . $intro_text . '</div>'; } $return .= '</div>'; if ($limit++ == $atts['limit']) { break; } } $return .= '</div>'; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/assets/css/magnific-popup.css", 'text/css', "screen"); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/assets/css/owl.carousel.css", 'text/css', "screen"); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/carousel/css/carousel.css"); JHtml::_('jquery.framework'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/magnific-popup.js"); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/assets/js/owl.carousel.min.js"); $return .= '</div>'; $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css); $doc->addScriptDeclaration(' jQuery(document).ready(function ($) { // Enable carousels jQuery(\'.' . $id . '.yt-carousel\').each(function () { // Prepare data var $carousel = $(this), $slides = $(\'.' . $id . '.yt-carousel-slides\'), $slide = $(\'.' . $id . '.yt-carousel-slide\'), data = $carousel.data(); // Apply Swiper var $owlCarousel = $slides.owlCarousel({ responsiveClass: true, mouseDrag: true, autoplayTimeout: data.delay * 1000, smartSpeed: data.speed * 1000, lazyLoad: (data.lazyload == \'yes\') ? true : false, autoplay: (data.autoplay == \'yes\') ? true : false, autoplayHoverPause: (data.hoverpause == \'yes\') ? true : false, center: (data.center == \'yes\') ? true : false, loop: (data.loop == \'yes\') ? true : false, margin: data.margin, navText: [\'\',\'\'], rtl: data.rtl, responsive:{ 0:{ items:1, margin: 0, dots: (data.pagination == \'yes\') ? true : false, nav: (data.arrows == \'yes\') ? true : false }, 768:{ items:$carousel.data(\'items\'), dots: (data.pagination == \'yes\') ? true : false, nav: (data.arrows == \'yes\') ? true : false }, 1000:{ items: $carousel.data(\'items\'), dots: (data.pagination == \'yes\') ? true : false, nav: (data.arrows == \'yes\') ? true : false } } }); // Lightbox for galleries (slider, carousel, custom_gallery) $(this).find(\'.yt-lightbox-item\').magnificPopup({ type: \'image\', mainClass: \'mfp-zoom-in mfp-img-mobile\', tLoading: \'\', // remove text from preloader removalDelay: 400, //delay removal by X to allow out-animation gallery: { enabled: true, navigateByImgClick: true, preload: [0, 1] // Will preload 0 - before current, and 1 after the current image }, callbacks: { open: function() { //overwrite default prev + next function. Add timeout for css3 crossfade animation $.magnificPopup.instance.next = function() { var self = this; self.wrap.removeClass(\'mfp-image-loaded\'); setTimeout(function() { $.magnificPopup.proto.next.call(self); }, 120); } $.magnificPopup.instance.prev = function() { var self = this; self.wrap.removeClass(\'mfp-image-loaded\'); setTimeout(function() { $.magnificPopup.proto.prev.call(self); }, 120); } }, imageLoadComplete: function() { var self = this; setTimeout(function() { self.wrap.addClass(\'mfp-image-loaded\'); }, 16); } } }); }); }); '); } else { $return = yt_alert_box('Carousel content not found, please check carousel source settings.', 'warning'); } return $return; }
function Content_styleYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('type_change' => 'single_column', 'source' => '', 'limit' => 20, 'image' => 'yes', 'title' => 'yes', 'link_title' => 'yes', 'intro_text' => 'yes', 'intro_text_limit' => '', 'date' => 'yes', 'time' => 'yes', 'read_more' => 'no', 'order' => 'created', 'order_by' => 'desc', 'highlight_year' => 'yes', 'icon_bg' => '', 'before_text' => '', 'after_text' => '', 'class' => '', 'gutter' => '', 'sticky_mode' => '', 'masonry_sticky_size' => '', 'masonry_size' => '', 'masonry_sticky_medium_size' => '', 'masonry_medium_size' => '', 'masonry_sticky_small_size' => '', 'masonry_small_size' => '', 'masonry_sticky_extra_small_size' => '', 'masonry_extra_small_size' => '', 'masonry_sticky_width' => '', 'masonry_width' => '', 'grid' => 'no', 'offset' => '', 'column' => '', 'style_slider' => '', 'transitionin' => 'bounceIn', 'transitionout' => 'bounceOut', 'arrows' => 'yes', 'arrow_position' => 'arrow-default', 'pagination' => 'no', 'autoplay' => 'yes', 'autoheight' => 'yes', 'hoverpause' => 'yes'), $atts, 'yt_content_style'); $blogid = 'cpt_list_' . rand(); $slides = (array) get_slides($atts); $return = ''; switch ($atts['type_change']) { case 'masonry': $masonry = ''; $masonry .= ' [yt_masonry id="' . $blogid . '" gutter="' . $atts['gutter'] . '"] '; $limit = 1; foreach ($slides as $slide) { if ($atts['intro_text_limit']) { $slide['introtext'] = yt_char_limit($slide['introtext'], $atts['intro_text_limit']); } $title = $slide['title']; $masonry .= ' [yt_masonry_item ' . 'size="' . $atts['masonry_sticky_size'] . '" ' . 'medium_size="' . $atts['masonry_sticky_medium_size'] . '" ' . 'small_size="' . $atts['masonry_sticky_small_size'] . '" ' . 'extra_small_size="' . $atts['masonry_sticky_extra_small_size'] . '" ' . 'width="' . $atts['masonry_sticky_width'] . '"]'; $masonry .= '<div class="yt_content_style_masonry">'; if ($slide['image'] and $atts['image'] === 'yes') { $masonry .= '<div class=""><img src="' . yt_image_media($slide['image']) . '" alt="" /></div>'; } if ($atts['title'] === 'yes' and isset($slide['title'])) { $masonry .= '<h1>'; if ($atts['link_title'] === 'yes') { $masonry .= '<a href="' . $slide['link'] . '">'; } $masonry .= $title; if ($atts['link_title'] === 'yes') { $masonry .= '</a>'; } $masonry .= '</h1>'; } if ($atts['intro_text'] === 'yes' and isset($slide['introtext'])) { $masonry .= '<div class="yt-masonry-item-text">' . $slide['introtext'] . '</div>'; } $masonry .= '<div style="margin:15px;"> <i class="fa fa-calendar"></i> ' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . ' // <i class="fa fa-book"></i> ' . $slide['category'] . ',' . $slide['category_alias'] . ' // <i class="fa fa-user"></i> by ' . $slide['author_name'] . '. </div>'; $masonry .= '</div>'; $masonry .= ' [/yt_masonry_item] '; if ($limit++ == $atts['limit']) { break; } } $masonry .= ' [/yt_masonry] '; $return .= parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $masonry)); break; case 'timeline': if ($atts['before_text']) { $return .= '<div class="yt-timeline-before-text"><span>' . $atts['before_text'] . '</span></div>'; } $date = date('Y'); $return .= '<div class="yt-timeline animated">'; if (count($slides)) { $limit = 1; foreach ($slides as $slide) { if ($atts['intro_text_limit']) { $slide['introtext'] = yt_char_limit($slide['introtext'], $atts['intro_text_limit']); } $title = $slide['title']; $icon = $title ? explode('|| fa-', $title) : array(); if (count($icon) == 2) { $title = trim($icon[0]); $icon = '<i class="fa fa-' . trim($icon[1]) . '"></i>'; } else { $title = $slide['title']; $icon = '<i class="fa fa-circle"></i>'; } $has_icon = ''; if (isset($icon[1])) { $has_icon = 'has-ta-icon'; } $icon_bg = $atts['icon_bg'] ? 'style="background-color:' . $atts['icon_bg'] . ';"' : ''; if ($date != JHTML::_('date', $slide['created'], "Y") && $atts['highlight_year'] == 'yes') { $return .= '<div class="yt-timeline-row yt-timeline-has-year">' . "\n"; $date = JHTML::_('date', $slide['created'], "Y"); $return .= '<div class="yt-timeline-year"><span>' . "\n"; $return .= $date . "\n"; $return .= '</span></div>' . "\n"; } else { $return .= '<div class="yt-timeline-row">' . "\n"; } $return .= '<div class="yt-timeline-icon ' . $has_icon . '"><div class="bg-primary" ' . $icon_bg . '>' . $icon . '</div></div>'; $return .= '<div class="yt-timeline-time">'; if ($atts['date'] == 'yes') { $return .= '<small>' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . '</small>'; } if ($atts['time'] == 'yes') { $return .= JHTML::_('date', $slide['created'], "g:i A"); } $return .= '</div>'; $return .= '<div class="yt-timeline-content">' . "\n"; $return .= '<div class="yt-timeline-content-body">' . "\n"; if ($atts['title'] === 'yes' and isset($slide['title'])) { $return .= '<h3 class="yt-timeline-item-title">'; if ($atts['link_title'] === 'yes') { $return .= '<a href="' . yt_image_media($slide['link']) . '">'; } $return .= $title; if ($atts['link_title'] === 'yes') { $return .= '</a>'; } $return .= '</h3>'; } if ($slide['image'] and $atts['image'] === 'yes') { $return .= '<div class="yt-timeline-item-image"><img src="' . yt_image_media($slide['image']) . '" alt="" /></div>'; } if ($atts['intro_text'] === 'yes' and isset($slide['introtext'])) { $return .= '<div class="yt-timeline-item-text">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $slide['introtext'])) . '</div>'; } if ($atts['read_more'] === 'yes') { $return .= '<a class="yt-timeline-readmore readon" href="' . yt_image_media($slide['link']) . '">Read More...</a>'; } $return .= '</div>' . "\n"; $return .= '</div>' . "\n"; $return .= '</div>' . "\n"; if ($limit++ == $atts['limit']) { break; } } $return .= '</div>'; if ($atts['after_text']) { $return .= '<div class="yt-timeline-after-text"><span>' . $atts['after_text'] . '</span></div><br/>'; } JHtml::_('jquery.framework'); JHtml::script(JUri::base() . "plugins/system/ytshortcodes/shortcodes/content_style/js/content_style.js"); } else { $return .= yt_alert_box('Timeline not work, Please select the correct source and settings.', 'warning'); } break; case 'multiple_column': $multiple_column = ''; $limit = 1; $i = 1; $multiple_column .= ' [yt_columns grid="' . $atts['grid'] . '"] '; foreach ($slides as $slide) { if ($atts['intro_text_limit']) { $slide['introtext'] = yt_char_limit($slide['introtext'], $atts['intro_text_limit']); } $title = $slide['title']; $multiple_column .= ' [yt_columns_item offset="' . $atts['offset'] . '" col="' . floor(12 / $atts['column']) . '"] '; if ($slide['image']) { $multiple_column .= '<img src="' . yt_image_media($slide['image']) . '" alt="" style="margin-bottom:15px;"/>'; } else { $multiple_column .= '<img src="' . yt_image_media(JURI::base() . 'plugins/system/ytshortcodes/assets/images/URL_IMAGES.png') . '" alt="" />'; } if ($atts['title'] === 'yes' and isset($slide['title'])) { $multiple_column .= '<h1>'; if ($atts['link_title'] === 'yes') { $multiple_column .= '<a href="' . yt_image_media($slide['link']) . '">'; } $multiple_column .= $title; if ($atts['link_title'] === 'yes') { $multiple_column .= '</a>'; } $multiple_column .= '</h1>'; } if ($atts['date'] == 'yes') { $multiple_column .= '<i class="fa fa-calendar"></i> ' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . ' // <i class="fa fa-book"></i> ' . $slide['category'] . ',' . $slide['category_alias'] . ' // <i class="fa fa-user"></i> by ' . $slide['author_name'] . '.'; } $multiple_column .= '<div class="yt_contentstyle_content">' . $slide['introtext'] . '</div>'; $multiple_column .= ' [/yt_columns_item] '; if ($i++ == $atts['column']) { break; } if ($limit++ == $atts['limit']) { break; } } $multiple_column .= ' [/yt_columns] '; $return = parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $multiple_column)); break; case 'slider': $slider = ''; $limit = 1; $slider .= ' [yt_content_slider style="' . $atts['style_slider'] . '" transitionin="' . $atts['transitionin'] . '" transitionout="' . $atts['transitionout'] . '" arrows="' . $atts['arrows'] . '" arrow_position="' . $atts['arrow_position'] . '" pagination="' . $atts['pagination'] . '" autoplay="' . $atts['autoplay'] . '" autoheight="' . $atts['autoheight'] . '" hoverpause="' . $atts['hoverpause'] . '"] '; foreach ($slides as $slide) { $title = $slide['title']; $slider .= ' [yt_content_slider_item] '; if ($slide['image']) { $slider .= '<img src="' . yt_image_media($slide['image']) . '" alt="" />'; } else { $slider .= '<img src="' . yt_image_media(JURI::base() . 'plugins/system/ytshortcodes/assets/images/URL_IMAGES.png') . '" alt="" />'; } $slider .= ' [/yt_content_slider_item] '; if ($limit++ == $atts['limit']) { break; } } $slider .= ' [/yt_content_slider] '; $return = parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $slider)); break; default: $single_column = ''; $limit = 1; foreach ($slides as $slide) { if ($atts['intro_text_limit']) { $slide['introtext'] = yt_char_limit($slide['introtext'], $atts['intro_text_limit']); } $title = $slide['title']; $single_column .= ' [yt_columns grid="' . $atts['grid'] . '"] '; $single_column .= ' [yt_columns_item offset="' . $atts['offset'] . '" col="12"] '; if ($slide['image']) { $single_column .= '<div class="col-sm-6" style="width:50%; margin:0;"><img src="' . yt_image_media($slide['image']) . '" alt="" /></div><div class="col-sm-6" style="width:50%; margin:0;">'; } else { $single_column .= '<div class="col-sm-12">'; } if ($atts['title'] === 'yes' and isset($slide['title'])) { $single_column .= '<h1 class="yt-timeline-item-title">'; if ($atts['link_title'] === 'yes') { $single_column .= '<a href="' . yt_image_media($slide['link']) . '">'; } $single_column .= $title; if ($atts['link_title'] === 'yes') { $single_column .= '</a>'; } $single_column .= '</h1>'; } if ($atts['date'] == 'yes') { $single_column .= '<i class="fa fa-calendar"></i> ' . JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')) . ' // <i class="fa fa-book"></i> ' . $slide['category'] . ',' . $slide['category_alias'] . ' // <i class="fa fa-user"></i> by ' . $slide['author_name'] . '.'; } $single_column .= '<div class="yt_contentstyle_content">' . $slide['introtext'] . '</div>'; $single_column .= '</div> [/yt_columns_item] '; $single_column .= ' [/yt_columns] '; if ($limit++ == $atts['limit']) { break; } } $return = parse_shortcode(str_replace(array("<br/>", "<br>", "<br />"), " ", $single_column)); break; } JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/content_style/css/content_style.css"); return $return; }
function ShowcaseYTShortcode($atts = null, $content = null) { $atts = ytshortcode_atts(array('source' => '', 'limit' => 12, 'loading_animation' => 'default', 'filter_animation' => 'rotateSides', 'caption_style' => 'overlayBottomPush', 'horizontal_gap' => 10, 'vertical_gap' => 10, 'filter' => 'yes', 'filter_deeplink' => 'no', 'page_deeplink' => 'no', 'popup_position' => 'below', 'popup_category' => 'yes', 'popup_date' => 'yes', 'popup_image' => 'yes', 'large' => 4, 'medium' => 3, 'small' => 1, 'thumb_width' => 640, 'thumb_height' => 480, 'class' => ''), $atts, 'showcase'); $slides = (array) get_slides($atts); $id = uniqid('ytsc') . rand() . time(); $intro_text = ''; $title = ''; $return = ''; $atts['filter_deeplink'] = $atts['filter_deeplink'] === 'yes' ? 'true' : 'false'; $atts['page_deeplink'] = $atts['page_deeplink'] === 'yes' ? 'true' : 'false'; if (count($slides)) { $return .= '<div id="' . $id . '" class="yt-showcase" data-scid="' . $id . '" 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'] . '" >'; if ($atts['filter'] !== 'no') { $return .= '<div id="' . $id . '_filter" class="cbp-l-filters-dropdown"> <div class="cbp-l-filters-dropdownWrap"> <div class="cbp-l-filters-dropdownHeader">Sort Showcase</div> <div class="cbp-l-filters-dropdownList"> <div data-filter="*" class="cbp-filter-item-active cbp-filter-item"> All Items (<div class="cbp-filter-counter"></div> items) </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=".' . str_replace(' ', '-', strtolower($slide['category'])) . '">' . $slide['category'] . ' (<div class="cbp-filter-counter"></div> items)</div>'; } $return .= '</div> </div> </div>'; } $return .= '<div id="' . $id . '_container" class="cbp-l-grid-gallery">'; $limit = 1; foreach ((array) $slides as $slide) { $thumb_url = yt_image_resize($slide['image'], $atts['thumb_width'], $atts['thumb_height'], 95); // Title condition if ($slide['title']) { $title = stripslashes($slide['title']); } $category = str_replace(' ', '-', strtolower($slide['category'])); $itemid = uniqid() . rand() . time(); $return .= ' <div class="cbp-item ' . $category . ' motion"> <a href="' . $slide['link'] . '" class="cbp-caption cbp-singlePageInline" data-title="' . $title . ' // ' . $slide['category'] . '"> <div class="cbp-caption-defaultWrap">'; if ($slide['image']) { $return .= '<img src="' . yt_image_media($thumb_url['url']) . '" alt="' . $title . '">'; } else { $return .= '<img src="' . yt_image_media(JURI::base() . 'plugins/system/ytshortcodes/assets/images/URL_IMAGES.png') . '" alt="' . $title . '" width="640" height="480" />'; } $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>'; $return .= '<div id="' . $id . '_inlinecontents" style="display: none;">'; foreach ((array) $slides as $slide) { $date = JHTML::_('date', $slide['created'], JText::_('DATE_FORMAT_LC3')); $textImg = yt_all_images($slide['fulltext']); $return .= ' <div> <div class="cbp-l-inline"> <div class="cbp-l-inline-left">'; if ($atts['popup_image'] === 'yes' and $textImg != null) { $return .= ' <div class="cbp-slider"> <ul class="cbp-slider-wrap"> <li class="cbp-slider-item"><img src="' . yt_image_media($slide['image']) . '" alt="' . $slide['title'] . '"></li>'; foreach ($textImg as $img) { $return .= '<li class="cbp-slider-item"><img src="' . yt_image_media($img) . '" alt="' . $slide['title'] . '"></li>'; } $return .= '</ul> </div>'; } elseif ($atts['popup_image'] === 'yes') { $return .= '<img src="' . yt_image_media($slide['image']) . '" alt="' . $slide['title'] . '">'; } $return .= '</div> <div class="cbp-l-inline-right"> <div class="cbp-l-inline-title">' . $slide['title'] . '</div> <div class="cbp-l-inline-subtitle">' . $slide['category'] . ' // ' . $date . '</div> <div class="cbp-l-inline-desc">' . parse_shortcode(str_replace(array("<br/>", "<br>", "<br />", "<p>", "</p>"), " ", $slide['introtext'])) . '</div> <a href="' . $slide['link'] . '" class="cbp-l-inline-view">View Details</a> </div> </div> </div>'; } $return .= '</div></div>'; JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/showcase/css/cubeportfolio.min.css", 'text/css'); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/shortcodes/showcase/css/showcase.css", 'text/css'); JHtml::stylesheet(JUri::base() . "plugins/system/ytshortcodes/assets/css/magnific-popup.css", 'text/css'); JHtml::script("plugins/system/ytshortcodes/assets/js/magnific-popup.js"); JHtml::script("plugins/system/ytshortcodes/shortcodes/showcase/js/cubeportfolio.min.js"); JHtml::script("plugins/system/ytshortcodes/shortcodes/showcase/js/showcase.js"); } else { $return = yt_alert_box('Error: Something wrong there, please check your showcase source.', 'warning'); } return $return; }