first commit

This commit is contained in:
alazhar
2020-01-02 22:20:31 +07:00
commit 10eb3340ad
5753 changed files with 631345 additions and 0 deletions

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="COM_FINDER_MENU_SEARCH_VIEW_TITLE">
<message><![CDATA[COM_FINDER_MENU_SEARCH_VIEW_TEXT]]></message>
</view>
</metadata>

View File

@ -0,0 +1,41 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
JHtml::_('behavior.framework');
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::stylesheet('com_finder/finder.css', false, true, false);
?>
<div class="finder<?php echo $this->pageclass_sfx; ?>">
<?php if ($this->params->get('show_page_heading')) : ?>
<h1>
<?php if ($this->escape($this->params->get('page_heading'))) : ?>
<?php echo $this->escape($this->params->get('page_heading')); ?>
<?php else : ?>
<?php echo $this->escape($this->params->get('page_title')); ?>
<?php endif; ?>
</h1>
<?php endif; ?>
<?php if ($this->params->get('show_search_form', 1)) : ?>
<div id="search-form">
<?php echo $this->loadTemplate('form'); ?>
</div>
<?php endif;
// Load the search results layout if we are performing a search.
if ($this->query->search === true):
?>
<div id="search-results">
<?php echo $this->loadTemplate('results'); ?>
</div>
<?php endif; ?>
</div>

View File

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_FINDER_MENU_SEARCH_VIEW_DEFAULT_TITLE">
<help
key = "JHELP_MENUS_MENU_ITEM_FINDER_SEARCH"
/>
<message>
<![CDATA[COM_FINDER_MENU_SEARCH_VIEW_DEFAULT_TEXT]]>
</message>
</layout>
<fields name="request" addfieldpath="/administrator/components/com_finder/models/fields">
<fieldset name="request">
<field name="q"
type="text"
label="COM_FINDER_SEARCH_SEARCH_QUERY_LABEL"
description="COM_FINDER_SEARCH_SEARCH_QUERY_DESC"
size="30"
/>
<field name="f"
type="searchfilter"
default=""
label="COM_FINDER_SEARCH_FILTER_SEARCH_LABEL"
description="COM_FINDER_SEARCH_FILTER_SEARCH_DESC"
/>
</fieldset>
</fields>
<fields name="params" addfieldpath="/administrator/components/com_finder/models/fields">
<fieldset name="basic">
<field name="show_date_filters"
type="list"
default=""
validate="options"
label="COM_FINDER_CONFIG_SHOW_DATE_FILTERS_LABEL"
description="COM_FINDER_CONFIG_SHOW_DATE_FILTERS_DESC">
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
<option value="">JGLOBAL_USE_GLOBAL</option>
</field>
<field name="show_advanced"
type="list"
default=""
validate="options"
label="COM_FINDER_CONFIG_SHOW_ADVANCED_LABEL"
description="COM_FINDER_CONFIG_SHOW_ADVANCED_DESC">
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
<option value="">JGLOBAL_USE_GLOBAL</option>
</field>
<field name="expand_advanced"
type="list"
default=""
validate="options"
label="COM_FINDER_CONFIG_EXPAND_ADVANCED_LABEL"
description="COM_FINDER_CONFIG_EXPAND_ADVANCED_DESC">
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
<option value="">JGLOBAL_USE_GLOBAL</option>
</field>
<field type="spacer" />
<field name="show_description"
type="list"
default=""
validate="options"
label="COM_FINDER_CONFIG_SHOW_DESCRIPTION_LABEL"
description="COM_FINDER_CONFIG_SHOW_DESCRIPTION_DESC">
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
<option value="">JGLOBAL_USE_GLOBAL</option>
</field>
<field name="description_length"
type="text"
default="255"
filter="integer"
label="COM_FINDER_CONFIG_DESCRIPTION_LENGTH_LABEL"
description="COM_FINDER_CONFIG_DESCRIPTION_LENGTH_DESC"
size="5"
/>
<field name="show_url"
type="list"
default=""
validate="options"
label="COM_FINDER_CONFIG_SHOW_URL_LABEL"
description="COM_FINDER_CONFIG_SHOW_URL_DESC">
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
<option value="">JGLOBAL_USE_GLOBAL</option>
</field>
<field type="spacer" />
</fieldset>
<fieldset name="advanced">
<field name="show_pagination_limit" type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
validate="options"
description="JGLOBAL_DISPLAY_SELECT_DESC">
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_pagination" type="list"
description="JGLOBAL_PAGINATION_DESC"
validate="options"
label="JGLOBAL_PAGINATION_LABEL" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field name="show_pagination_results" type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
validate="options"
description="JGLOBAL_PAGINATION_RESULTS_DESC" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="allow_empty_query"
type="radio"
class="btn-group"
default="0"
validate="options"
label="COM_FINDER_ALLOW_EMPTY_QUERY_LABEL"
description="COM_FINDER_ALLOW_EMPTY_QUERY_DESC">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="sort_order"
type="list"
default=""
validate="options"
label="COM_FINDER_CONFIG_SORT_ORDER_LABEL"
description="COM_FINDER_CONFIG_SORT_ORDER_DESC">
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="relevance">COM_FINDER_CONFIG_SORT_OPTION_RELEVANCE</option>
<option value="date">COM_FINDER_CONFIG_SORT_OPTION_START_DATE</option>
<option value="price">COM_FINDER_CONFIG_SORT_OPTION_LIST_PRICE</option>
</field>
<field name="sort_direction"
type="list"
default=""
validate="options"
label="COM_FINDER_CONFIG_SORT_DIRECTION_LABEL"
description="COM_FINDER_CONFIG_SORT_DIRECTION_DESC">
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="desc">COM_FINDER_CONFIG_SORT_OPTION_DESCENDING</option>
<option value="asc">COM_FINDER_CONFIG_SORT_OPTION_ASCENDING</option>
</field>
<field type="spacer" />
<field name="show_feed"
type="radio"
class="btn-group"
default="0"
validate="options"
label="COM_FINDER_CONFIG_SHOW_FEED_LABEL"
description="COM_FINDER_CONFIG_SHOW_FEED_DESC">
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field name="show_feed_text"
type="radio"
class="btn-group"
default="0"
validate="options"
label="COM_FINDER_CONFIG_SHOW_FEED_TEXT_LABEL"
description="COM_FINDER_CONFIG_SHOW_FEED_TEXT_DESC">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
<fieldset name="integration">
<field name="show_feed_link" type="list"
description="JGLOBAL_SHOW_FEED_LINK_DESC"
validate="options"
label="JGLOBAL_SHOW_FEED_LINK_LABEL" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
</metadata>

View File

@ -0,0 +1,111 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
?>
<script type="text/javascript">
window.addEvent('domready', function() {
<?php if ($this->params->get('show_advanced', 1)) : ?>
/*
* This segment of code adds the slide effect to the advanced search box.
*/
if (document.id('advanced-search') != null)
{
var searchSlider = new Fx.Slide('advanced-search');
<?php if (!$this->params->get('expand_advanced', 0)) : ?>
searchSlider.hide();
<?php endif; ?>
document.id('advanced-search-toggle').addEvent('click', function(e)
{
e = new Event(e);
e.stop();
searchSlider.toggle();
});
}
/*
* This segment of code disables select boxes that have no value when the
* form is submitted so that the URL doesn't get blown up with null values.
*/
if (document.id('finder-search') != null)
{
document.id('finder-search').addEvent('submit', function(e){
e = new Event(e);
e.stop();
if (document.id('advanced-search') != null)
{
// Disable select boxes with no value selected.
document.id('advanced-search').getElements('select').each(function(s){
if (!s.getProperty('value'))
{
s.setProperty('disabled', 'disabled');
}
});
}
document.id('finder-search').submit();
});
}
<?php endif; ?>
/*
* This segment of code sets up the autocompleter.
*/
<?php if ($this->params->get('show_autosuggest', 1)) : ?>
<?php JHtml::_('script', 'com_finder/autocompleter.js', false, true); ?>
var url = '<?php echo JRoute::_('index.php?option=com_finder&task=suggestions.display&format=json&tmpl=component', false); ?>';
var completer = new Autocompleter.Request.JSON(document.id('q'), url, {'postVar': 'q'});
<?php endif; ?>
});
</script>
<form id="finder-search" action="<?php echo JRoute::_($this->query->toURI()); ?>" method="get" class="form-inline">
<?php echo $this->getFields(); ?>
<?php
/*
* DISABLED UNTIL WEIRD VALUES CAN BE TRACKED DOWN.
*/
if (false && $this->state->get('list.ordering') !== 'relevance_dsc') : ?>
<input type="hidden" name="o" value="<?php echo $this->escape($this->state->get('list.ordering')); ?>" />
<?php endif; ?>
<fieldset class="word">
<label for="q">
<?php echo JText::_('COM_FINDER_SEARCH_TERMS'); ?>
</label>
<input type="text" name="q" id="q" size="30" value="<?php echo $this->escape($this->query->input); ?>" class="inputbox" />
<?php if ($this->escape($this->query->input) != '' || $this->params->get('allow_empty_search')):?>
<button name="Search" type="submit" class="btn btn-primary"><span class="icon-search icon-white"></span> <?php echo JText::_('JSEARCH_FILTER_SUBMIT');?></button>
<?php else: ?>
<button name="Search" type="submit" class="btn btn-primary disabled"><span class="icon-search icon-white"></span> <?php echo JText::_('JSEARCH_FILTER_SUBMIT');?></button>
<?php endif; ?>
<?php if ($this->params->get('show_advanced', 1)) : ?>
<a href="#advancedSearch" data-toggle="collapse" class="btn"><span class="icon-list"></span> <?php echo JText::_('COM_FINDER_ADVANCED_SEARCH_TOGGLE'); ?></a>
<?php endif; ?>
</fieldset>
<?php if ($this->params->get('show_advanced', 1)) : ?>
<div id="advancedSearch" class="collapse">
<hr />
<?php if ($this->params->get('show_advanced_tips', 1)) : ?>
<div class="advanced-search-tip">
<?php echo JText::_('COM_FINDER_ADVANCED_TIPS'); ?>
</div>
<hr />
<?php endif; ?>
<div id="finder-filter-window">
<?php echo JHtml::_('filter.select', $this->query, $this->params); ?>
</div>
</div>
<?php endif; ?>
</form>

View File

@ -0,0 +1,37 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
// Get the mime type class.
$mime = !empty($this->result->mime) ? 'mime-' . $this->result->mime : null;
// Get the base url.
$base = JUri::getInstance()->toString(array('scheme', 'host', 'port'));
// Get the route with highlighting information.
if (!empty($this->query->highlight) && empty($this->result->mime) && $this->params->get('highlight_terms', 1) && JPluginHelper::isEnabled('system', 'highlight'))
{
$route = $this->result->route . '&highlight=' . base64_encode(json_encode($this->query->highlight));
} else {
$route = $this->result->route;
}
?>
<li>
<h4 class="result-title <?php echo $mime; ?>"><a href="<?php echo JRoute::_($route); ?>"><?php echo $this->result->title; ?></a></h4>
<?php if ($this->params->get('show_description', 1)) : ?>
<p class="result-text<?php echo $this->pageclass_sfx; ?>">
<?php echo JHtml::_('string.truncate', $this->result->description, $this->params->get('description_length', 255)); ?>
</p>
<?php endif; ?>
<?php if ($this->params->get('show_url', 1)) : ?>
<div class="small result-url<?php echo $this->pageclass_sfx; ?>"><?php echo $base . JRoute::_($this->result->route); ?></div>
<?php endif; ?>
</li>

View File

@ -0,0 +1,92 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
// Activate the highlighter if enabled.
if (!empty($this->query->highlight) && $this->params->get('highlight_terms', 1))
{
JHtml::_('behavior.highlighter', $this->query->highlight);
}
// Get the application object.
$app = JFactory::getApplication();
// Display the suggested search if it is different from the current search.
if (($this->suggested && $this->params->get('show_suggested_query', 1)) || ($this->explained && $this->params->get('show_explained_query', 1))):
?>
<div id="search-query-explained">
<?php
// Display the suggested search query.
if ($this->suggested && $this->params->get('show_suggested_query', 1))
{
// Replace the base query string with the suggested query string.
$uri = JUri::getInstance($this->query->toURI());
$uri->setVar('q', $this->suggested);
// Compile the suggested query link.
$link = '<a href="' . JRoute::_($uri->toString(array('path', 'query'))) . '">'
. $this->escape($this->suggested)
. '</a>';
echo JText::sprintf('COM_FINDER_SEARCH_SIMILAR', $link);
}
// Display the explained search query.
elseif ($this->explained && $this->params->get('show_explained_query', 1))
{
echo $this->explained;
}
?>
</div>
<?php
endif;
if ($this->total == 0):
?>
<div id="search-result-empty">
<h2><?php echo JText::_('COM_FINDER_SEARCH_NO_RESULTS_HEADING'); ?></h2>
<?php if ($app->getLanguageFilter()) : ?>
<p><?php echo JText::sprintf('COM_FINDER_SEARCH_NO_RESULTS_BODY_MULTILANG', $this->escape($this->query->input)); ?></p>
<?php else : ?>
<p><?php echo JText::sprintf('COM_FINDER_SEARCH_NO_RESULTS_BODY', $this->escape($this->query->input)); ?></p>
<?php endif; ?>
</div>
<?php
else:
// Prepare the pagination string. Results X - Y of Z
$start = (int) $this->pagination->get('limitstart') + 1;
$total = (int) $this->pagination->get('total');
$limit = (int) $this->pagination->get('limit') * $this->pagination->pagesTotal;
$limit = (int) ($limit > $total ? $total : $limit);
$pages = JText::sprintf('COM_FINDER_SEARCH_RESULTS_OF', $start, $limit, $total);
?>
<br id="highlighter-start" />
<ul class="search-results<?php echo $this->pageclass_sfx; ?> list-striped">
<?php
for ($i = 0, $n = count($this->results); $i < $n; $i++):
$this->result = &$this->results[$i];
$layout = $this->getLayoutFile($this->result->layout);
?>
<?php echo $this->loadTemplate($layout); ?>
<?php
endfor;
?>
</ul>
<br id="highlighter-end" />
<div class="search-pagination">
<div class="pagination">
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<div class="search-pages-counter">
<?php echo $pages; ?>
</div>
</div>
<?php
endif;

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,105 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
/**
* Search feed view class for the Finder package.
*
* @package Joomla.Site
* @subpackage com_finder
* @since 2.5
*/
class FinderViewSearch extends JViewLegacy
{
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed JError object on failure, void on success.
*
* @since 2.5
*/
public function display($tpl = null)
{
// Get the application
$app = JFactory::getApplication();
// Adjust the list limit to the feed limit.
$app->input->set('limit', $app->getCfg('feed_limit'));
// Get view data.
$state = $this->get('State');
$params = $state->get('params');
$query = $this->get('Query');
$results = $this->get('Results');
// Push out the query data.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$explained = JHtml::_('query.explained', $query);
// Set the document title.
$title = $params->get('page_title', '');
if (empty($title))
{
$title = $app->getCfg('sitename');
}
elseif ($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);
// Configure the document description.
if (!empty($explained))
{
$this->document->setDescription(html_entity_decode(strip_tags($explained), ENT_QUOTES, 'UTF-8'));
}
// Set the document link.
$this->document->link = JRoute::_($query->toURI());
// If we don't have any results, we are done.
if (empty($results))
{
return;
}
// Convert the results to feed entries.
foreach ($results as $result)
{
// Convert the result to a feed entry.
$item = new JFeedItem;
$item->title = $result->title;
$item->link = JRoute::_($result->route);
$item->description = $result->description;
$item->date = (int) $result->start_date ? JHtml::date($result->start_date, 'l d F Y') : $result->indexdate;
// Get the taxonomy data.
$taxonomy = $result->getTaxonomy();
// Add the category to the feed if available.
if (isset($taxonomy['Category']))
{
$node = array_pop($taxonomy['Category']);
$item->category = $node->title;
}
// Loads item info into RSS array
$this->document->addItem($item);
}
}
}

View File

@ -0,0 +1,256 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
/**
* Search HTML view class for the Finder package.
*
* @package Joomla.Site
* @subpackage com_finder
* @since 2.5
*/
class FinderViewSearch extends JViewLegacy
{
protected $query;
protected $params;
protected $state;
protected $user;
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed JError object on failure, void on success.
*
* @since 2.5
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$params = $app->getParams();
// Get view data.
$state = $this->get('State');
$query = $this->get('Query');
JDEBUG ? $GLOBALS['_PROFILER']->mark('afterFinderQuery') : null;
$results = $this->get('Results');
JDEBUG ? $GLOBALS['_PROFILER']->mark('afterFinderResults') : null;
$total = $this->get('Total');
JDEBUG ? $GLOBALS['_PROFILER']->mark('afterFinderTotal') : null;
$pagination = $this->get('Pagination');
JDEBUG ? $GLOBALS['_PROFILER']->mark('afterFinderPagination') : null;
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Configure the pathway.
if (!empty($query->input))
{
$app->getPathWay()->addItem($this->escape($query->input));
}
// Push out the view data.
$this->state = &$state;
$this->params = &$params;
$this->query = &$query;
$this->results = &$results;
$this->total = &$total;
$this->pagination = &$pagination;
// Check for a double quote in the query string.
if (strpos($this->query->input, '"'))
{
// Get the application router.
$router =& $app->getRouter();
// Fix the q variable in the URL.
if ($router->getVar('q') !== $this->query->input)
{
$router->setVar('q', $this->query->input);
}
}
// Log the search
JSearchHelper::logSearch($this->query->input, 'com_finder');
// Push out the query data.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$this->suggested = JHtml::_('query.suggested', $query);
$this->explained = JHtml::_('query.explained', $query);
// Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
// Check for layout override only if this is not the active menu item
// If it is the active menu item, then the view and category id will match
$active = $app->getMenu()->getActive();
if (isset($active->query['layout']))
{
// We need to set the layout in case this is an alternative menu item (with an alternative layout)
$this->setLayout($active->query['layout']);
}
$this->prepareDocument($query);
JDEBUG ? $GLOBALS['_PROFILER']->mark('beforeFinderLayout') : null;
parent::display($tpl);
JDEBUG ? $GLOBALS['_PROFILER']->mark('afterFinderLayout') : null;
}
/**
* Method to get hidden input fields for a get form so that control variables
* are not lost upon form submission
*
* @return string A string of hidden input form fields
*
* @since 2.5
*/
protected function getFields()
{
$fields = null;
// Get the URI.
$uri = JUri::getInstance(JRoute::_($this->query->toURI()));
$uri->delVar('q');
$uri->delVar('o');
$uri->delVar('t');
$uri->delVar('d1');
$uri->delVar('d2');
$uri->delVar('w1');
$uri->delVar('w2');
$elements = $uri->getQuery(true);
// Create hidden input elements for each part of the URI.
foreach ($elements as $n => $v)
{
if (is_scalar($v))
{
$fields .= '<input type="hidden" name="' . $n . '" value="' . $v . '" />';
}
}
return $fields;
}
/**
* Method to get the layout file for a search result object.
*
* @param string $layout The layout file to check. [optional]
*
* @return string The layout file to use.
*
* @since 2.5
*/
protected function getLayoutFile($layout = null)
{
// Create and sanitize the file name.
$file = $this->_layout . '_' . preg_replace('/[^A-Z0-9_\.-]/i', '', $layout);
// Check if the file exists.
jimport('joomla.filesystem.path');
$filetofind = $this->_createFileName('template', array('name' => $file));
$exists = JPath::find($this->_path['template'], $filetofind);
return ($exists ? $layout : 'result');
}
/**
* Prepares the document
*
* @param FinderIndexerQuery $query The search query
*
* @return void
*
* @since 2.5
*/
protected function prepareDocument($query)
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading', JText::_('COM_FINDER_DEFAULT_PAGE_TITLE'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->getCfg('sitename');
}
elseif ($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 ($layout = $this->params->get('article_layout'))
{
$this->setLayout($layout);
}
// Configure the document meta-description.
if (!empty($this->explained))
{
$explained = $this->escape(html_entity_decode(strip_tags($this->explained), ENT_QUOTES, 'UTF-8'));
$this->document->setDescription($explained);
}
// Configure the document meta-keywords.
if (!empty($query->highlight))
{
$this->document->setMetadata('keywords', implode(', ', $query->highlight));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots', $this->params->get('robots'));
}
// Add feed link to the document head.
if ($this->params->get('show_feed_link', 1) == 1)
{
// Add the RSS link.
$props = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$route = JRoute::_($this->query->toURI() . '&format=feed&type=rss');
$this->document->addHeadLink($route, 'alternate', 'rel', $props);
// Add the ATOM link.
$props = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$route = JRoute::_($this->query->toURI() . '&format=feed&type=atom');
$this->document->addHeadLink($route, 'alternate', 'rel', $props);
}
}
}

View File

@ -0,0 +1,54 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_finder
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
/**
* OpenSearch View class for Finder
*
* @package Joomla.Site
* @subpackage com_finder
* @since 2.5
*/
class FinderViewSearch extends JViewLegacy
{
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed JError object on failure, void on success.
*
* @since 2.5
*/
public function display($tpl = null)
{
$doc = JFactory::getDocument();
$app = JFactory::getApplication();
$params = JComponentHelper::getParams('com_finder');
$doc->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_finder&q={searchTerms}';
// Find the menu item for the search
$menu = $app->getMenu();
$items = $menu->getItems('link', 'index.php?option=com_finder&view=search');
if (isset($items[0]))
{
$searchUri .= '&Itemid=' . $items[0]->id;
}
$htmlSearch = new JOpenSearchUrl;
$htmlSearch->template = JRoute::_($searchUri);
$doc->addUrl($htmlSearch);
}
}