PageRenderTime 53ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/components/com_weblinks/views/category/view.feed.php

https://github.com/joebushi/joomla
PHP | 68 lines | 35 code | 11 blank | 22 comment | 0 complexity | 037caee63744a82ee8b9ddf0e30292f6 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. <?php
  2. /**
  3. * @version $Id$
  4. * @package Joomla.Site
  5. * @subpackage Weblinks
  6. * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE.txt
  8. */
  9. // no direct access
  10. defined('_JEXEC') or die;
  11. jimport('joomla.application.component.view');
  12. /**
  13. * HTML View class for the WebLinks component
  14. *
  15. * @static
  16. * @package Joomla.Site
  17. * @subpackage Weblinks
  18. * @since 1.0
  19. */
  20. class WeblinksViewCategory extends JView
  21. {
  22. function display($tpl = null)
  23. {
  24. $app = &JFactory::getApplication();
  25. $document = &JFactory::getDocument();
  26. $document->link = JRoute::_('index.php?option=com_weblinks&view=category&id='.JRequest::getVar('id',null, '', 'int'));
  27. JRequest::setVar('limit', $app->getCfg('feed_limit'));
  28. $siteEmail = $app->getCfg('mailfrom');
  29. $fromName = $app->getCfg('fromname');
  30. $document->editor = $fromName;
  31. $document->editorEmail = $siteEmail;
  32. // Get some data from the model
  33. $items = &$this->get('data');
  34. $category = &$this->get('category');
  35. foreach ($items as $item)
  36. {
  37. // strip html from feed item title
  38. $title = $this->escape($item->title);
  39. $title = html_entity_decode($title);
  40. // url link to article
  41. $link = JRoute::_('index.php?option=com_weblinks&view=weblink&id='. $item->id);
  42. // strip html from feed item description text
  43. $description = $item->description;
  44. $date = ($item->date ? date('r', strtotime($item->date)) : '');
  45. // load individual item creator class
  46. $feeditem = new JFeedItem();
  47. $feeditem->title = $title;
  48. $feeditem->link = $link;
  49. $feeditem->description = $description;
  50. $feeditem->date = $date;
  51. $feeditem->category = 'Weblinks';
  52. // loads item info into rss array
  53. $document->addItem($feeditem);
  54. }
  55. }
  56. }
  57. ?>