function video_sc($atts, $content = "") { extract(shortcode_atts(array('height' => 281, 'width' => 500), $atts)); Helix::addJS('fitvids.js'); ob_start(); $video = parse_url($content); switch ($video['host']) { case 'youtu.be': $id = trim($video['path'], '/'); $src = 'https://www.youtube.com/embed/' . $id; break; case 'www.youtube.com': case 'youtube.com': parse_str($video['query'], $query); $id = $query['v']; $src = 'https://www.youtube.com/embed/' . $id; break; case 'vimeo.com': case 'www.vimeo.com': $id = trim($video['path'], '/'); $src = "http://player.vimeo.com/video/{$id}"; } ?> <div id="video-<?php echo $id; ?> " class="shortcode-video"> <iframe src="<?php echo $src; ?> " width="<?php echo $width; ?> " height="<?php echo $height; ?> " frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> </div> <script> spnoConflict(function($){ $("#video-<?php echo $id; ?> ").fitVids(); }); </script> <?php $data = ob_get_clean(); return $data; }
function gallery_sc($atts, $content = "") { global $galleryArray; $tags = array(); extract(shortcode_atts(array('columns' => 3, 'modal' => 'yes', 'filter' => 'no'), $atts)); do_shortcode($content); //Add gallery.css file Helix::addCSS('gallery.css'); //isotope if ($filter == 'yes') { Helix::addJS('jquery.isotope.min.js'); } $tags = ''; foreach ($galleryArray as $key => $item) { $tags .= ',' . $item['tag']; } $tags = ltrim($tags, ','); $tags = explode(',', $tags); $newtags = array(); foreach ($tags as $tag) { $newtags[] = trim($tag); } $tags = array_unique($newtags); ob_start(); if ($filter == 'yes') { ?> <div class="gallery-filters"> <a class="btn active btn-primary" href="#" data-filter="*"><?php echo JText::_('Show All'); ?> </a> <?php foreach ($tags as $tag) { ?> <a class="btn" href="#" data-filter=".<?php echo trim($tag); ?> "><?php echo ucfirst(trim($tag)); ?> </a> <?php } ?> </div> <?php } ?> <ul class="gallery"> <?php foreach ($galleryArray as $key => $item) { ?> <li style="width:<?php echo round(100 / $columns); ?> %" class="<?php echo str_replace(',', ' ', $item['tag']); ?> "> <a class="img-polaroid" data-toggle="modal" href="<?php echo $modal == 'yes' ? '#modal-' . $key . '' : '#'; ?> "> <?php echo '<img alt=" " src="' . $item['src'] . '" />'; ?> <?php if ($item['content'] != '') { ?> <div> <div> <?php echo do_shortcode($item['content']); ?> </div> </div> <?php } ?> </a> </li> <?php if ($modal == 'yes') { ?> <div id="modal-<?php echo $key; ?> " class="modal hide fade" tabindex="-1"> <a class="close-modal" href="javascript:;" data-dismiss="modal" aria-hidden="true"><i class="fa fa-remove"></i></a> <div class="modal-body"> <?php echo '<img src="' . $item['src'] . '" alt=" " width="100%" style="max-height:400px" />'; ?> </div> </div> <?php } ?> <?php } ?> </ul> <?php if ($filter == 'yes') { ?> <script type="text/javascript"> window.addEvent('load', function(){ spnoConflict(function($){ $gallery = $('.gallery'); $gallery.isotope({ // options itemSelector : 'li', layoutMode : 'fitRows' }); $filter = $('.gallery-filters'); $selectors = $filter.find('>a'); $filter.find('>a').click(function(){ var selector = $(this).attr('data-filter'); $selectors.removeClass('active btn-primary'); $(this).addClass('active btn-primary'); $gallery.isotope({ filter: selector }); return false; }); }); }); </script> <?php } ?> <?php $galleryArray = array(); //return $html; return ob_get_clean(); }