Source for file categoryfeed.php

Documentation is available at categoryfeed.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Legacy
  4.  * @subpackage  View
  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.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Base feed View class for a category
  14.  *
  15.  * @package     Joomla.Legacy
  16.  * @subpackage  View
  17.  * @since       3.2
  18.  */
  19. {
  20.     /**
  21.      * Execute and display a template script.
  22.      *
  23.      * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  24.      *
  25.      * @return  mixed  A string if successful, otherwise a Error object.
  26.      *
  27.      * @since   3.2
  28.      */
  29.     public function display($tpl null)
  30.     {
  31.         $app      JFactory::getApplication();
  32.         $document JFactory::getDocument();
  33.  
  34.         $extension      $app->input->getString('option');
  35.         $document->link JRoute::_(JHelperRoute::getCategoryRoute($app->input->getInt('id')$language 0$extension));
  36.  
  37.         $app->input->set('limit'$app->get('feed_limit'));
  38.         $siteEmail        $app->get('mailfrom');
  39.         $fromName         $app->get('fromname');
  40.         $feedEmail        $app->get('feed_email''author');
  41.         $document->editor $fromName;
  42.  
  43.         if ($feedEmail != 'none')
  44.         {
  45.             $document->editorEmail $siteEmail;
  46.         }
  47.  
  48.         // Get some data from the model
  49.         $items    $this->get('Items');
  50.         $category $this->get('Category');
  51.  
  52.         foreach ($items as $item)
  53.         {
  54.             $this->reconcileNames($item);
  55.  
  56.             // Strip html from feed item title
  57.             $title $this->escape($item->title);
  58.             $title html_entity_decode($titleENT_COMPAT'UTF-8');
  59.  
  60.             // URL link to article
  61.             $router new JHelperRoute;
  62.             $link   JRoute::_($router->getRoute($item->id$item->catid));
  63.  
  64.             // Strip HTML from feed item description text.
  65.             $description $item->description;
  66.             $author      $item->created_by_alias $item->created_by_alias $item->author;
  67.             $date        = isset($item->datedate('r'strtotime($item->date)) '';
  68.  
  69.             // Load individual item creator class.
  70.             $feeditem              new JFeedItem;
  71.             $feeditem->title       $title;
  72.             $feeditem->link        $link;
  73.             $feeditem->description $description;
  74.             $feeditem->date        $date;
  75.             $feeditem->category    $category->title;
  76.             $feeditem->author      $author;
  77.  
  78.             // We don't have the author email so we have to use site in both cases.
  79.             if ($feedEmail == 'site')
  80.             {
  81.                 $feeditem->authorEmail $siteEmail;
  82.             }
  83.             elseif ($feedEmail === 'author')
  84.             {
  85.                 $feeditem->authorEmail $item->author_email;
  86.             }
  87.  
  88.             // Loads item information into RSS array
  89.             $document->addItem($feeditem);
  90.         }
  91.     }
  92.  
  93.     /**
  94.      * Method to reconcile non standard names from components to usage in this class.
  95.      * Typically overriden in the component feed view class.
  96.      *
  97.      * @param   object  $item  The item for a feed, an element of the $items array.
  98.      *
  99.      * @return  void 
  100.      *
  101.      * @since   3.2
  102.      */
  103.     protected function reconcileNames($item)
  104.     {
  105.         if (!property_exists($item'title'&& property_exists($item'name'))
  106.         {
  107.             $item->title $item->name;
  108.         }
  109.     }
  110. }

Documentation generated on Tue, 19 Nov 2013 14:55:37 +0100 by phpDocumentor 1.4.3