CoreFiles by mySites.guru
view.opensearch.php49 lines, 1,345 bytes, from Joomla_2.5.1-Stable-Full_Package.zip
Raw History Compare with 2.5.0
md5
ac028f081582b1517b07badf902129a9
sha1
5a31cdfe4425e7e7a47d3b8d7196da3ac70d5cd6
sha256
f4eed99ab6f2d88e8b4f2fe376477946c5b32394419cd8cb8797c54276551d18
<?php
/**
 * @package		Joomla.Site
 * @subpackage	Weblinks
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// No direct access
defined('_JEXEC') or die;

jimport('joomla.application.component.view');
jimport('joomla.methods');
jimport('joomla.environment.uri');

/**
 * OpenSearch View class for the Search component
 *
 * @static
 * @package		Joomla.Site
 * @subpackage	Search
 * @since 1.7
 */
class SearchViewSearch extends JView
{
	function display($tpl = null)
	{
		$doc = JFactory::getDocument();
		$app = JFactory::getApplication();

		$params = JComponentHelper::getParams('com_search');
		$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_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);
	}
}

The same content is in 5 releases, Joomla 2.5.0 to 2.5.4. See them all, or every version of this file.