Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
<?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;
Ejemplo n.º 3
0
<?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 
Ejemplo n.º 4
0
 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);
 }