- md5
- 7fc7157656ab447df5ea9bdb6e1ccc46
- sha1
- 8566c5040e3aa039d9cbcd72f887bde5d335ca6d
- sha256
- 5ee38153fbc790387d99751773e452002db54b47ba336b753a11940506a481d5
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Frontpage View class
*
* @since 1.5
*/
class ContentViewFeatured extends JViewLegacy
{
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a Error object.
*/
public function display($tpl = null)
{
// Parameters
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$params = $app->getParams();
$feedEmail = $app->get('feed_email', 'author');
$siteEmail = $app->get('mailfrom');
$doc->link = JRoute::_('index.php?option=com_content&view=featured');
// Get some data from the model
$app->input->set('limit', $app->get('feed_limit'));
$categories = JCategories::getInstance('Content');
$rows = $this->get('Items');
foreach ($rows as $row)
{
// Strip html from feed item title
$title = $this->escape($row->title);
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
// Compute the article slug
$row->slug = $row->alias ? ($row->id . ':' . $row->alias) : $row->id;
// Url link to article
$link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language));
// Get row fulltext
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('fulltext'))
->from($db->quoteName('#__content'))
->where($db->quoteName('id') . ' = ' . $row->id);
$db->setQuery($query);
$row->fulltext = $db->loadResult();
$description = ($params->get('feed_summary', 0) ? $row->introtext . $row->fulltext : $row->introtext);
$author = $row->created_by_alias ? $row->created_by_alias : $row->author;
// Load individual item creator class
$item = new JFeedItem;
$item->title = $title;
$item->link = $link;
$item->date = $row->publish_up;
$item->category = array();
// All featured articles are categorized as "Featured"
$item->category[] = JText::_('JFEATURED');
for ($item_category = $categories->get($row->catid); $item_category !== null; $item_category = $item_category->getParent())
{
// Only add non-root categories
if ($item_category->id > 1)
{
$item->category[] = $item_category->title;
}
}
$item->author = $author;
if ($feedEmail == 'site')
{
$item->authorEmail = $siteEmail;
}
elseif ($feedEmail === 'author')
{
$item->authorEmail = $row->author_email;
}
// Add readmore link to description if introtext is shown, show_readmore is true and fulltext exists
if (!$params->get('feed_summary', 0) && $params->get('feed_show_readmore', 0) && $row->fulltext)
{
$description .= '<p class="feed-readmore"><a target="_blank" href ="' . $item->link . '">' . JText::_('COM_CONTENT_FEED_READMORE') . '</a></p>';
}
// Load item description and add div
$item->description = '<div class="feed-description">' . $description . '</div>';
// Loads item info into rss array
$doc->addItem($item);
}
}
}
The same content is in 11 releases, Joomla 3.4.0-beta1 to 3.4.3. See them all, or every version of this file.