Source for file suggestions.json.php

Documentation is available at suggestions.json.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  com_finder
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Suggestions JSON controller for Finder.
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_finder
  17.  * @since       2.5
  18.  */
  19. {
  20.     /**
  21.      * Method to find search query suggestions.
  22.      *
  23.      * @param   boolean  $cachable   If true, the view output will be cached
  24.      * @param   array    $urlparams  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  25.      *
  26.      * @return  void 
  27.      *
  28.      * @since   2.5
  29.      */
  30.     public function display($cachable false$urlparams false)
  31.     {
  32.         $return array();
  33.  
  34.         $params JComponentHelper::getParams('com_finder');
  35.         if ($params->get('show_autosuggest'1))
  36.         {
  37.             // Get the suggestions.
  38.             $model $this->getModel('Suggestions''FinderModel');
  39.             $return $model->getItems();
  40.         }
  41.  
  42.         // Check the data.
  43.         if (empty($return))
  44.         {
  45.             $return array();
  46.         }
  47.  
  48.         // Use the correct json mime-type
  49.         header('Content-Type: application/json');
  50.  
  51.         // Send the response.
  52.         echo json_encode($return);
  53.         JFactory::getApplication()->close();
  54.     }
  55. }

Documentation generated on Tue, 19 Nov 2013 15:14:43 +0100 by phpDocumentor 1.4.3