Source for file view.feed.php

Documentation is available at view.feed.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.  * Search feed view class for the Finder package.
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_finder
  17.  * @since       2.5
  18.  */
  19. class FinderViewSearch extends JViewLegacy
  20. {
  21.     /**
  22.      * Method to display the view.
  23.      *
  24.      * @param   string  $tpl  A template file to load. [optional]
  25.      *
  26.      * @return  mixed  JError object on failure, void on success.
  27.      *
  28.      * @since   2.5
  29.      */
  30.     public function display($tpl null)
  31.     {
  32.         // Get the application
  33.         $app JFactory::getApplication();
  34.  
  35.         // Adjust the list limit to the feed limit.
  36.         $app->input->set('limit'$app->getCfg('feed_limit'));
  37.  
  38.         // Get view data.
  39.         $state $this->get('State');
  40.         $params $state->get('params');
  41.         $query $this->get('Query');
  42.         $results $this->get('Results');
  43.  
  44.         // Push out the query data.
  45.         JHtml::addIncludePath(JPATH_COMPONENT '/helpers/html');
  46.         $explained JHtml::_('query.explained'$query);
  47.  
  48.         // Set the document title.
  49.         $title $params->get('page_title''');
  50.  
  51.         if (empty($title))
  52.         {
  53.             $title $app->getCfg('sitename');
  54.         }
  55.         elseif ($app->getCfg('sitename_pagetitles'0== 1)
  56.         {
  57.             $title JText::sprintf('JPAGETITLE'$app->getCfg('sitename')$title);
  58.         }
  59.         elseif ($app->getCfg('sitename_pagetitles'0== 2)
  60.         {
  61.             $title JText::sprintf('JPAGETITLE'$title$app->getCfg('sitename'));
  62.         }
  63.  
  64.         $this->document->setTitle($title);
  65.  
  66.         // Configure the document description.
  67.         if (!empty($explained))
  68.         {
  69.             $this->document->setDescription(html_entity_decode(strip_tags($explained)ENT_QUOTES'UTF-8'));
  70.         }
  71.  
  72.         // Set the document link.
  73.         $this->document->link JRoute::_($query->toURI());
  74.  
  75.         // If we don't have any results, we are done.
  76.         if (empty($results))
  77.         {
  78.             return;
  79.         }
  80.  
  81.         // Convert the results to feed entries.
  82.         foreach ($results as $result)
  83.         {
  84.             // Convert the result to a feed entry.
  85.             $item new JFeedItem;
  86.             $item->title $result->title;
  87.             $item->link JRoute::_($result->route);
  88.             $item->description $result->description;
  89.             $item->date = (int) $result->start_date JHtml::date($result->start_date'l d F Y'$result->indexdate;
  90.  
  91.             // Get the taxonomy data.
  92.             $taxonomy $result->getTaxonomy();
  93.  
  94.             // Add the category to the feed if available.
  95.             if (isset($taxonomy['Category']))
  96.             {
  97.                 $node array_pop($taxonomy['Category']);
  98.                 $item->category $node->title;
  99.             }
  100.  
  101.             // Loads item info into RSS array
  102.             $this->document->addItem($item);
  103.         }
  104.     }
  105. }

Documentation generated on Tue, 19 Nov 2013 15:16:47 +0100 by phpDocumentor 1.4.3