function accordion_sc($atts, $content = "") { global $accordionArray; $params = shortcode_atts(array('id' => 'accordion1'), $atts); do_shortcode($content); $html = '<div class="accordion" id="' . $params['id'] . '">'; //Accordions foreach ($accordionArray as $key => $accordion) { $html .= '<div class="accordion-group">'; $html .= '<div class="accordion-heading">'; $html .= '<a class="accordion-toggle" data-toggle="collapse" data-parent="#' . $params['id'] . '" href="#' . Helix::slug($accordion['title']) . '">'; $html .= $accordion['title']; $html .= '</a>'; $html .= '</div>'; //end Accordion Heading $html .= '<div id="' . Helix::slug($accordion['title']) . '" class="accordion-body collapse' . ($key == 0 ? " in" : "") . '">'; $html .= '<div class="accordion-inner">'; $html .= do_shortcode($accordion['content']); $html .= '</div>'; $html .= '</div>'; //end Accordion Content $html .= '</div>'; //end accordion group } $html .= '</div>'; $accordionArray = array(); return $html; }
function testimonial_sc($atts, $content = "") { extract(shortcode_atts(array('name' => 'John Doe', 'designation' => '', 'email' => '*****@*****.**', 'url' => '', 'img' => ''), $atts)); ob_start(); ?> <div class="media testimonial"> <div class="pull-left"> <i style="font-size:48px" class="icon-quote-<?php echo Helix::direction() == 'rtl' ? 'right' : 'left'; ?> "></i> </div> <div class="media-body"> <div class="testimonial-content"> <?php echo do_shortcode($content); ?> </div> <div style="margin-top:5px" class="media testimonial-author"> <div class="pull-left"> <img class="img-circle" alt="<?php echo $name; ?> " src="//1.gravatar.com/avatar/<?php echo md5($email); ?> ?s=68&r=pg&d=mm" width="68"> </div> <div class="media-body"> <strong><?php echo $name; ?> </strong> <br /> <?php echo $designation; ?> <br/> <a href="<?php echo $url; ?> "><?php echo $url; ?> </a> </div> </div> </div> </div> <?php return ob_get_clean(); }
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 onAfterRender() { $shortcodes_scripts = Helix::getInstance()->_shortcodes_scripts; $shortcodes_styles = Helix::getInstance()->_shortcodes_styles; $shortcodes_scripts = array_unique($shortcodes_scripts); $shortcodes_styles = array_unique($shortcodes_styles); $data = JResponse::getBody(); $new_head_data = ''; foreach ($shortcodes_styles as $style) { $new_head_data .= '<link rel="stylesheet" href="' . $style . '" />' . "\n"; } foreach ($shortcodes_scripts as $script) { $new_head_data .= '<script type="text/javascript" src="' . $script . '"></script>' . "\n"; } $data = str_replace('</head>', $new_head_data . "\n</head>", $data); JResponse::setBody($data); }
function map_sc($atts, $content = "") { extract(shortcode_atts(array('lat' => '-34.397', 'lng' => '150.644', 'maptype' => 'ROADMAP', 'height' => '200', 'zoom' => 8), $atts)); Helix::addShortcodeScript('https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true', ',', false); ob_start(); ?> <script type="text/javascript"> var myLatlng = new google.maps.LatLng(<?php echo $lat; ?> ,<?php echo $lng; ?> ); function initialize() { var mapOptions = { zoom: <?php echo $zoom; ?> , center: myLatlng, mapTypeId: google.maps.MapTypeId.<?php echo $maptype; ?> }; var map = new google.maps.Map(document.getElementById('sp_simple_map_canvas'), mapOptions); var marker = new google.maps.Marker({position:myLatlng, map:map}); } google.maps.event.addDomListener(window, 'load', initialize); </script> <div style="height:<?php echo $height; ?> px" id="sp_simple_map_canvas"></div> <?php $data = ob_get_clean(); return $data; }
function tab_sc($atts, $content = "") { global $tabArray; $params = shortcode_atts(array('button' => 'nav-tabs', 'id' => 'tab', 'class' => ''), $atts); do_shortcode($content); $html = '<div class="tab">'; $html .= '<div class="' . $params['class'] . '">'; //Tab Title $html .= '<ul class="nav ' . $params['button'] . '" id="' . $params['id'] . '">'; foreach ($tabArray as $key => $tab) { $html .= '<li class="' . ($key == 0 ? "active" : "") . '"><a href="#' . Helix::slug($params['id']) . '-' . Helix::slug($tab['title']) . '" data-toggle="tab">' . $tab['title'] . '</a></li>'; } $html .= '</ul>'; //Tab Content $html .= '<div class="tab-content">'; foreach ($tabArray as $key => $tab) { $html .= '<div class="tab-pane fade' . ($key == 0 ? " active in" : "") . '" id="' . Helix::slug($params['id']) . '-' . Helix::slug($tab['title']) . '">' . do_shortcode($tab['content']) . '</div>'; } $html .= '</div>'; $html .= '</div>'; $html .= '</div>'; $tabArray = array(); return $html; }
<?php /** * PRI Simple - Free Responsive Joomla! Template * @author Devpri - http://www.devpri.com * @copyright Copyright (c) 2013 Devpri * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later * Helix Framework Credit * @author JoomShaper http://www.joomshaper.com * @copyright Copyright (c) 2001 - 2013 JoomShaper * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later */ defined('_JEXEC') or die; $this->helix = Helix::getInstance(); if (!isset($this->error)) { $this->error = JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); $this->debug = false; } //get language and direction $doc = JFactory::getDocument(); $this->language = $doc->language; $this->direction = $doc->direction; $this->helix->getDocument()->setTitle($this->error->getCode() . ' - ' . $this->title); $this->helix->header()->addLess('error', 'error'); require_once JPATH_LIBRARIES . '/joomla/document/html/renderer/head.php'; $header_renderer = new JDocumentRendererHead($doc); $header_contents = $header_renderer->render(null); ?> <!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="<?php echo $this->language;
/** * Get the path to a layout for a module * * @param string $module The name of the module * @param string $layout The name of the module layout. If alternative layout, in the form template:filename. * * @return string The path to the module layout * * @since 1.5 */ public static function getLayoutPath($module, $layout = 'default') { $template = JFactory::getApplication()->getTemplate(); $defaultLayout = $layout; if (strpos($layout, ':') !== false) { // Get the template and file name from the string $temp = explode(':', $layout); $template = $temp[0] == '_' ? $template : $temp[0]; $layout = $temp[1]; $defaultLayout = $temp[1] ? $temp[1] : 'default'; } // Build the template and base path for the layout $hPath = Helix::pluginPath() . '/html/' . $module . '/' . $layout . '.php'; // from helix $tPath = JPATH_THEMES . '/' . $template . '/html/' . $module . '/' . $layout . '.php'; $bPath = JPATH_BASE . '/modules/' . $module . '/tmpl/' . $defaultLayout . '.php'; $dPath = JPATH_BASE . '/modules/' . $module . '/tmpl/default.php'; // If the template has a layout override use it if (file_exists($tPath)) { return $tPath; } elseif (file_exists($hPath)) { return $hPath; } elseif (file_exists($bPath)) { return $bPath; } else { return $dPath; } }
public static function loadHelixOverwrite() { if (!JFactory::getApplication()->isAdmin()) { if (JVERSION >= 3) { // override core joomla 3 class if (!class_exists('JViewLegacy', false)) { self::getInstance()->Import('core/classes/joomla30/viewlegacy.php'); } if (!class_exists('JModuleHelper', false)) { self::getInstance()->Import('core/classes/joomla30/helper.php'); } } else { // override core joomla 2.5 class if (!class_exists('JHtmlBehavior', false)) { self::getInstance()->Import('core/classes/joomla25/behavior.php'); } if (!class_exists('JViewLegacy', false)) { self::getInstance()->Import('core/classes/joomla25/view.php'); } if (!class_exists('JDocumentRendererMessage', false)) { self::getInstance()->Import('core/classes/joomla25/message.php'); } if (!class_exists('JModuleHelper', false)) { self::getInstance()->Import('core/classes/joomla25/helper.php'); } if (!class_exists('JHtmlBootstrap', false)) { Helix::Import('core/classes/joomla30/bootstrap.php'); } } } return self::getInstance(); }
/** * Sets an entire array of search paths for templates or resources. * * @param string $type The type of path to set, typically 'template'. * @param mixed $path The new search path, or an array of search paths. If null or false, resets to the current directory only. * * @return void * * @since 11.1 */ protected function _setPath($type, $path) { $component = JApplicationHelper::getComponentName(); $app = JFactory::getApplication(); // Clear out the prior search dirs $this->_path[$type] = array(); // Actually add the user-specified directories $this->_addPath($type, $path); // Always add the fallback directories as last resort switch (strtolower($type)) { case 'template': // Set the alternative template search dir if (isset($app)) { $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $component); $fallback = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . $this->getName(); $this->_addPath('template', Helix::frameworkPath() . '/html/' . $component . '/' . $this->getName()); $this->_addPath('template', $fallback); } break; } }
<?php /** * @package Joomla.Site * @subpackage com_search * * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; Helix::getInstance()->importShortCodeFiles(); ?> <dl class="search-results<?php echo $this->pageclass_sfx; ?> "> <?php foreach ($this->results as $result) { ?> <dt class="result-title"> <?php echo $this->pagination->limitstart + $result->count . '. '; ?> <?php if ($result->href) { ?> <a href="<?php echo JRoute::_($result->href); ?> "<?php
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::addShortcodeStyle('gallery.css'); //isotope if ($filter == 'yes') { Helix::addShortcodeScript('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 btn-group"> <a class="btn active" 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="icon-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"> spnoConflict(function($){ $(window).load(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'); $(this).addClass('active'); $gallery.isotope({ filter: selector }); return false; }); }); }); </script> <?php } ?> <?php $galleryArray = array(); //return $html; return ob_get_clean(); }
function display($tpl = null) { require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/search.php'; Helix::getInstance()->importShortCodeFiles(); // Initialise some variables $app = JFactory::getApplication(); $pathway = $app->getPathway(); $uri = JFactory::getURI(); $error = null; $rows = null; $results = null; $total = 0; // Get some data from the model $areas = $this->get('areas'); $state = $this->get('state'); $searchword = $state->get('keyword'); $params = $app->getParams(); $menus = $app->getMenu(); $menu = $menus->getActive(); // because the application sets a default page title, we need to get it // right from the menu item itself if (is_object($menu)) { $menu_params = new JRegistry(); $menu_params->loadString($menu->params); if (!$menu_params->get('page_title')) { $params->set('page_title', JText::_('COM_SEARCH_SEARCH')); } } else { $params->set('page_title', JText::_('COM_SEARCH_SEARCH')); } $title = $params->get('page_title'); if ($app->getCfg('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename')); } $this->document->setTitle($title); if ($params->get('menu-meta_description')) { $this->document->setDescription($params->get('menu-meta_description')); } if ($params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $params->get('menu-meta_keywords')); } if ($params->get('robots')) { $this->document->setMetadata('robots', $params->get('robots')); } // built select lists $orders = array(); $orders[] = JHtml::_('select.option', 'newest', JText::_('COM_SEARCH_NEWEST_FIRST')); $orders[] = JHtml::_('select.option', 'oldest', JText::_('COM_SEARCH_OLDEST_FIRST')); $orders[] = JHtml::_('select.option', 'popular', JText::_('COM_SEARCH_MOST_POPULAR')); $orders[] = JHtml::_('select.option', 'alpha', JText::_('COM_SEARCH_ALPHABETICAL')); $orders[] = JHtml::_('select.option', 'category', JText::_('JCATEGORY')); $lists = array(); $lists['ordering'] = JHtml::_('select.genericlist', $orders, 'ordering', 'class="inputbox"', 'value', 'text', $state->get('ordering')); $searchphrases = array(); $searchphrases[] = JHtml::_('select.option', 'all', JText::_('COM_SEARCH_ALL_WORDS')); $searchphrases[] = JHtml::_('select.option', 'any', JText::_('COM_SEARCH_ANY_WORDS')); $searchphrases[] = JHtml::_('select.option', 'exact', JText::_('COM_SEARCH_EXACT_PHRASE')); $lists['searchphrase'] = JHtml::_('select.radiolist', $searchphrases, 'searchphrase', '', 'value', 'text', $state->get('match')); // log the search SearchHelper::logSearch($searchword); //limit searchword $lang = JFactory::getLanguage(); $upper_limit = $lang->getUpperLimitSearchWord(); $lower_limit = $lang->getLowerLimitSearchWord(); if (SearchHelper::limitSearchWord($searchword)) { $error = JText::sprintf('COM_SEARCH_ERROR_SEARCH_MESSAGE', $lower_limit, $upper_limit); } //sanatise searchword if (SearchHelper::santiseSearchWord($searchword, $state->get('match'))) { $error = JText::_('COM_SEARCH_ERROR_IGNOREKEYWORD'); } if (!$searchword && count(JRequest::get('post'))) { //$error = JText::_('COM_SEARCH_ERROR_ENTERKEYWORD'); } // put the filtered results back into the model // for next release, the checks should be done in the model perhaps... $state->set('keyword', $searchword); if ($error == null) { $results = $this->get('data'); $total = $this->get('total'); $pagination = $this->get('pagination'); require_once JPATH_SITE . '/components/com_content/helpers/route.php'; for ($i = 0, $count = count($results); $i < $count; $i++) { $row =& $results[$i]->text; if ($state->get('match') == 'exact') { $searchwords = array($searchword); $needle = $searchword; } else { $searchworda = preg_replace('#\\xE3\\x80\\x80#s', ' ', $searchword); $searchwords = preg_split("/\\s+/u", $searchworda); $needle = $searchwords[0]; } // strip shortcodes on search result $row = strip_shortcodes(strip_shortcodes(strip_shortcodes($row))); $row = SearchHelper::prepareSearchContent($row, $needle); $searchwords = array_unique($searchwords); $searchRegex = '#('; $x = 0; foreach ($searchwords as $k => $hlword) { $searchRegex .= $x == 0 ? '' : '|'; $searchRegex .= preg_quote($hlword, '#'); $x++; } $searchRegex .= ')#iu'; $row = preg_replace($searchRegex, '<span class="highlight">\\0</span>', $row); $result =& $results[$i]; if ($result->created) { $created = JHtml::_('date', $result->created, JText::_('DATE_FORMAT_LC3')); } else { $created = ''; } $result->text = JHtml::_('content.prepare', $result->text, '', 'com_search.search'); $result->created = $created; $result->count = $i + 1; } } // Check for layout override $active = JFactory::getApplication()->getMenu()->getActive(); if (isset($active->query['layout'])) { $this->setLayout($active->query['layout']); } //Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $this->assignRef('pagination', $pagination); $this->assignRef('results', $results); $this->assignRef('lists', $lists); $this->assignRef('params', $params); $this->ordering = $state->get('ordering'); $this->searchword = $searchword; $this->origkeyword = $state->get('origkeyword'); $this->searchphrase = $state->get('match'); $this->searchareas = $areas; $this->total = $total; $this->error = $error; $this->action = $uri; parent::display($tpl); }