PageRenderTime 44ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/components/com_content/views/frontpage/view.feed.php

https://github.com/joebushi/joomla
PHP | 69 lines | 41 code | 7 blank | 21 comment | 3 complexity | 0bccfbec40e6dc3d897bdd9ccb0bb411 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. <?php
  2. /**
  3. * @version $Id$
  4. * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
  5. * @license GNU General Public License version 2 or later; see LICENSE.txt
  6. */
  7. // No direct access
  8. defined('_JEXEC') or die;
  9. jimport('joomla.application.component.view');
  10. /**
  11. * Frontpage View class
  12. *
  13. * @package Joomla.Site
  14. * @subpackage com_content
  15. * @since 1.5
  16. */
  17. class ContentViewFrontpage extends JView
  18. {
  19. function display($tpl = null)
  20. {
  21. // parameters
  22. $app = &JFactory::getApplication();
  23. $db = &JFactory::getDbo();
  24. $document = &JFactory::getDocument();
  25. $params = &$app->getParams();
  26. $feedEmail = (@$app->getCfg('feed_email')) ? $app->getCfg('feed_email') : 'author';
  27. $siteEmail = $app->getCfg('mailfrom');
  28. $document->link = JRoute::_('index.php?option=com_content&view=frontpage');
  29. // Get some data from the model
  30. JRequest::setVar('limit', $app->getCfg('feed_limit'));
  31. $rows = & $this->get('Data');
  32. foreach ($rows as $row)
  33. {
  34. // strip html from feed item title
  35. $title = $this->escape($row->title);
  36. $title = html_entity_decode($title);
  37. // url link to article
  38. $link = JRoute::_(ContentRoute::article($row->slug, $row->catslug, $row->sectionid));
  39. // strip html from feed item description text
  40. // TODO: Only pull fulltext if necessary (actually, just get the necessary fields).
  41. $description = ($params->get('feed_summary', 0) ? $row->introtext/*.$row->fulltext*/ : $row->introtext);
  42. $author = $row->created_by_alias ? $row->created_by_alias : $row->author;
  43. // load individual item creator class
  44. $item = new JFeedItem();
  45. $item->title = $title;
  46. $item->link = $link;
  47. $item->description = $description;
  48. $item->date = $row->created;
  49. $item->category = 'frontpage';
  50. $item->author = $author;
  51. if ($feedEmail == 'site') {
  52. $item->authorEmail = $siteEmail;
  53. }
  54. else {
  55. $item->authorEmail = $row->author_email;
  56. }
  57. // loads item info into rss array
  58. $document->addItem($item);
  59. }
  60. }
  61. }
  62. ?>