[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Site 5 * @subpackage com_content 6 * 7 * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Content\Site\View\Category; 12 13 use Joomla\CMS\Factory; 14 use Joomla\CMS\HTML\HTMLHelper; 15 use Joomla\CMS\Language\Text; 16 use Joomla\CMS\MVC\View\CategoryFeedView; 17 use Joomla\CMS\Router\Route; 18 use Joomla\Component\Content\Site\Helper\RouteHelper; 19 20 // phpcs:disable PSR1.Files.SideEffects 21 \defined('_JEXEC') or die; 22 // phpcs:enable PSR1.Files.SideEffects 23 24 /** 25 * HTML View class for the Content component 26 * 27 * @since 1.5 28 */ 29 class FeedView extends CategoryFeedView 30 { 31 /** 32 * @var string The name of the view to link individual items to 33 * 34 * @since 3.2 35 */ 36 protected $viewName = 'article'; 37 38 /** 39 * Method to reconcile non-standard names from components to usage in this class. 40 * Typically overridden in the component feed view class. 41 * 42 * @param object $item The item for a feed, an element of the $items array. 43 * 44 * @return void 45 * 46 * @since 3.2 47 */ 48 protected function reconcileNames($item) 49 { 50 // Get description, intro_image, author and date 51 $app = Factory::getApplication(); 52 $params = $app->getParams(); 53 $item->description = ''; 54 $obj = json_decode($item->images); 55 56 if (!empty($obj->image_intro)) { 57 $item->description = '<p>' . HTMLHelper::_('image', $obj->image_intro, $obj->image_intro_alt) . '</p>'; 58 } 59 60 $item->description .= ($params->get('feed_summary', 0) ? $item->introtext . $item->fulltext : $item->introtext); 61 62 // Add readmore link to description if introtext is shown, show_readmore is true and fulltext exists 63 if (!$item->params->get('feed_summary', 0) && $item->params->get('feed_show_readmore', 0) && $item->fulltext) { 64 // Compute the article slug 65 $item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id; 66 67 // URL link to article 68 $link = Route::_( 69 RouteHelper::getArticleRoute($item->slug, $item->catid, $item->language), 70 true, 71 $app->get('force_ssl') == 2 ? Route::TLS_FORCE : Route::TLS_IGNORE, 72 true 73 ); 74 75 $item->description .= '<p class="feed-readmore"><a target="_blank" href="' . $link . '" rel="noopener">' 76 . Text::_('COM_CONTENT_FEED_READMORE') . '</a></p>'; 77 } 78 79 $item->author = $item->created_by_alias ?: $item->author; 80 } 81 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |