]*>([^<]+)<\/a>/is','\2', $text);
// replace line breaking tags with whitespace
$text = preg_replace("'<(br[^/>]*?/|hr[^/>]*?/|/(div|h[1-6]|li|p|td))>'si", ' ', $text);
return self::_smartSubstr(strip_tags($text), $searchword);
}
/**
* Checks an object for search terms (after stripping fields of HTML)
*
* @param object The object to check
* @param string Search words to check for
* @param array List of object variables to check against
* @returns boolean True if searchTerm is in object, false otherwise
*/
public static function checkNoHtml($object, $searchTerm, $fields)
{
$searchRegex = array(
'##si',
'##si',
'##si',
'#<[^>]*>#i'
);
$terms = explode(' ', $searchTerm);
if (empty($fields)) return false;
foreach($fields as $field) {
if (!isset($object->$field)) continue;
$text = $object->$field;
foreach($searchRegex as $regex) {
$text = preg_replace($regex, '', $text);
}
foreach($terms as $term) {
if (JString::stristr($text, $term) !== false) {
return true;
}
}
}
return false;
}
/**
* returns substring of characters around a searchword
*
* @param string The source string
* @param int Number of chars to return
* @param string The searchword to select around
* @return string
*/
static function _smartSubstr($text, $searchword)
{
$lang = JFactory::getLanguage();
$length = $lang->getSearchDisplayedCharactersNumber();
$textlen = JString::strlen($text);
$lsearchword = JString::strtolower($searchword);
$wordfound = false;
$pos = 0;
while ($wordfound === false && $pos < $textlen) {
if (($wordpos = @JString::strpos($text, ' ', $pos + $length)) !== false) {
$chunk_size = $wordpos - $pos;
} else {
$chunk_size = $length;
}
$chunk = JString::substr($text, $pos, $chunk_size);
$wordfound = JString::strpos(JString::strtolower($chunk), $lsearchword);
if ($wordfound === false) {
$pos += $chunk_size + 1;
}
}
if ($wordfound !== false) {
return (($pos > 0) ? '... ' : '') . $chunk . ' ...';
} else {
if (($wordpos = @JString::strpos($text, ' ', $length)) !== false) {
return JString::substr($text, 0, $wordpos) . ' ...';
} else {
return JString::substr($text, 0, $length);
}
}
}
}
PK >\V helpers/index.htmlnu W+A
PK /?\C[ [ models/search.phpnu W+A setState('limit', $app->getUserStateFromRequest('com_search.limit', 'limit', $config->get('list_limit'), 'uint'));
$this->setState('limitstart', JRequest::getUInt('limitstart', 0));
// Get parameters.
$params = $app->getParams();
if ($params->get('searchphrase') == 1)
{
$searchphrase = 'any';
}
elseif ($params->get('searchphrase') == 2)
{
$searchphrase = 'exact';
}
else
{
$searchphrase = 'all';
}
// Set the search parameters
$keyword = urldecode(JRequest::getString('searchword'));
$match = JRequest::getWord('searchphrase', $searchphrase);
$ordering = JRequest::getWord('ordering', $params->get('ordering', 'newest'));
$this->setSearch($keyword, $match, $ordering);
//Set the search areas
$areas = JRequest::getVar('areas');
$this->setAreas($areas);
}
/**
* Method to set the search parameters
*
* @access public
* @param string search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
*/
function setSearch($keyword, $match = 'all', $ordering = 'newest')
{
if (isset($keyword)) {
$this->setState('origkeyword', $keyword);
if($match !== 'exact') {
$keyword = preg_replace('#\xE3\x80\x80#s', ' ', $keyword);
}
$this->setState('keyword', $keyword);
}
if (isset($match)) {
$this->setState('match', $match);
}
if (isset($ordering)) {
$this->setState('ordering', $ordering);
}
}
/**
* Method to set the search areas
*
* @access public
* @param array Active areas
* @param array Search areas
*/
function setAreas($active = array(), $search = array())
{
$this->_areas['active'] = $active;
$this->_areas['search'] = $search;
}
/**
* Method to get weblink item data for the category
*
* @access public
* @return array
*/
function getData()
{
// Lets load the content if it doesn't already exist
if (empty($this->_data))
{
$areas = $this->getAreas();
JPluginHelper::importPlugin('search');
$dispatcher = JDispatcher::getInstance();
$results = $dispatcher->trigger('onContentSearch', array(
$this->getState('keyword'),
$this->getState('match'),
$this->getState('ordering'),
$areas['active'])
);
$rows = array();
foreach ($results as $result) {
$rows = array_merge((array) $rows, (array) $result);
}
$this->_total = count($rows);
if ($this->getState('limit') > 0) {
$this->_data = array_splice($rows, $this->getState('limitstart'), $this->getState('limit'));
} else {
$this->_data = $rows;
}
}
return $this->_data;
}
/**
* Method to get the total number of weblink items for the category
*
* @access public
* @return integer
*/
function getTotal()
{
return $this->_total;
}
/**
* Method to get a pagination object of the weblink items for the category
*
* @access public
* @return integer
*/
function getPagination()
{
// Lets load the content if it doesn't already exist
if (empty($this->_pagination))
{
jimport('joomla.html.pagination');
$this->_pagination = new JPagination($this->getTotal(), $this->getState('limitstart'), $this->getState('limit'));
}
return $this->_pagination;
}
/**
* Method to get the search areas
*
* @since 1.5
*/
function getAreas()
{
// Load the Category data
if (empty($this->_areas['search']))
{
$areas = array();
JPluginHelper::importPlugin('search');
$dispatcher = JDispatcher::getInstance();
$searchareas = $dispatcher->trigger('onContentSearchAreas');
foreach ($searchareas as $area) {
if (is_array($area)) {
$areas = array_merge($areas, $area);
}
}
$this->_areas['search'] = $areas;
}
return $this->_areas;
}
}
PK /?\] views/search/view.html.phpnu W+A 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];
}
$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, '\0', $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);
}
}
PK /?\n views/search/metadata.xmlnu W+A
PK /?\L # views/search/tmpl/default_error.phpnu W+A
error): ?>
escape($this->error); ?>
PK /?\) views/search/tmpl/.htaccessnu W+A
Order allow,deny
Deny from all
PK /?\V views/search/tmpl/index.htmlnu W+A
PK /?\$T " views/search/tmpl/default_form.phpnu W+A getUpperLimitSearchWord();
?>
PK /?\WU U views/search/tmpl/default.phpnu W+A
params->get('show_page_heading')) : ?>
escape($this->params->get('page_heading'))) :?>
escape($this->params->get('page_heading')); ?>
escape($this->params->get('page_title')); ?>
loadTemplate('form'); ?>
error==null && count($this->results) > 0) :
echo $this->loadTemplate('results');
else :
echo $this->loadTemplate('error');
endif; ?>
PK /?\ views/search/tmpl/default.xmlnu W+A
PK /?\5j j % views/search/tmpl/default_results.phpnu W+A
results as $result) : ?>
-
pagination->limitstart + $result->count.'. ';?>
href) :?>
browsernav == 1) :?> target="_blank">
escape($result->title);?>
escape($result->title);?>
section) : ?>
-
(escape($result->section); ?>)
-
text; ?>
params->get('show_date')) : ?>
-
created); ?>
PK /?\xTr views/search/view.opensearch.phpnu W+A setShortName($params->get('opensearch_name', $app->getCfg('sitename')));
$doc->setDescription($params->get('opensearch_description', $app->getCfg('MetaDesc')));
// Add the URL for the search
$searchUri = JURI::base().'index.php?option=com_search&searchword={searchTerms}';
// Find the menu item for the search
$menu = $app->getMenu();
$items = $menu->getItems('link', 'index.php?option=com_search&view=search');
if (isset($items[0])) {
$searchUri .= '&Itemid='.$items[0]->id;
}
$htmlSearch = new JOpenSearchUrl();
$htmlSearch->template = JRoute::_($searchUri);
$doc->addUrl($htmlSearch);
}
}
PK /?\) views/search/.htaccessnu W+A
Order allow,deny
Deny from all
PK /?\V views/search/index.htmlnu W+A
PK /?\pn5v v
router.phpnu W+A \) .htaccessnu W+A PK 8>\) searches/.htaccessnu W+A PK 8>\" y searches/default.phpnu W+A PK 8>\V searches/index.htmlnu W+A PK 8>\V
6 index.htmlnu W+A PK >\) views/.htaccessnu W+A PK >\V M views/index.htmlnu W+A PK >\) views/searches/.htaccessnu W+A PK >\V s views/searches/tmpl/index.htmlnu W+A PK >\̊4 views/searches/tmpl/default.phpnu W+A PK >\) "# views/searches/tmpl/.htaccessnu W+A PK >\V # views/searches/index.htmlnu W+A PK >\ o V$ views/searches/view.html.phpnu W+A PK >\L
n* search.xmlnu W+A PK >\
_0 search.phpnu W+A PK >\a5b, ,
v2 config.xmlnu W+A PK >\]
8 access.xmlnu W+A PK >\V : controllers/index.htmlnu W+A PK >\ISn n %; controllers/searches.phpnu W+A PK >\) > controllers/.htaccessnu W+A PK >\5
? controller.phpnu W+A PK >\
9l l I models/searches.phpnu W+A PK >\V [ models/index.htmlnu W+A PK >\) \ models/.htaccessnu W+A PK >\) \ helpers/.htaccessnu W+A PK >\؟; ] helpers/site.phpnu W+A PK >\'$ W` helpers/search.phpnu W+A PK >\V y helpers/index.htmlnu W+A PK /?\C[ [ y models/search.phpnu W+A PK /?\] views/search/view.html.phpnu W+A PK /?\n B views/search/metadata.xmlnu W+A PK /?\L # views/search/tmpl/default_error.phpnu W+A PK /?\) views/search/tmpl/.htaccessnu W+A PK /?\V views/search/tmpl/index.htmlnu W+A PK /?\$T " + views/search/tmpl/default_form.phpnu W+A PK /?\WU U ? views/search/tmpl/default.phpnu W+A PK /?\ views/search/tmpl/default.xmlnu W+A PK /?\5j j % 4 views/search/tmpl/default_results.phpnu W+A PK /?\xTr views/search/view.opensearch.phpnu W+A PK /?\) - views/search/.htaccessnu W+A PK /?\V views/search/index.htmlnu W+A PK /?\pn5v v
X router.phpnu W+A PK * *