CoreFiles by mySites.guru
view.opensearch.php50 lines, 1,422 bytes, from Joomla_1.7.2-Stable-Full_Package.zip
Raw History Compare with 1.7.1
md5
52164a92c664f59de161e8bc8bc7f42b
sha1
851e314abbc9f7dec84f367b7f9d861fe68549c7
sha256
c4517647a1108b67ef0354d8760df804fbb6fba9166afa230b4eb6a4da073420
<?php
/**
 * @version		$Id: view.opensearch.php 21766 2011-07-08 12:20:23Z eddieajau $
 * @package		Joomla.Site
 * @subpackage	Weblinks
 * @copyright	Copyright (C) 2005 - 2011 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 6 releases, Joomla 1.7.0 to 1.7.5. See them all, or every version of this file.