[ 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_tags 6 * 7 * @copyright (C) 2013 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\Tags\Site\View\Tag; 12 13 use Joomla\CMS\Document\Feed\FeedItem; 14 use Joomla\CMS\Factory; 15 use Joomla\CMS\Filter\InputFilter; 16 use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; 17 use Joomla\CMS\Router\Route; 18 19 // phpcs:disable PSR1.Files.SideEffects 20 \defined('_JEXEC') or die; 21 // phpcs:enable PSR1.Files.SideEffects 22 23 /** 24 * HTML View class for the Tags component 25 * 26 * @since 3.1 27 */ 28 class FeedView extends BaseHtmlView 29 { 30 /** 31 * Execute and display a template script. 32 * 33 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 34 * 35 * @return mixed A string if successful, otherwise an Error object. 36 */ 37 public function display($tpl = null) 38 { 39 $app = Factory::getApplication(); 40 $ids = (array) $app->input->get('id', array(), 'int'); 41 $i = 0; 42 $tagIds = ''; 43 44 // Remove zero values resulting from input filter 45 $ids = array_filter($ids); 46 47 foreach ($ids as $id) { 48 if ($i !== 0) { 49 $tagIds .= '&'; 50 } 51 52 $tagIds .= 'id[' . $i . ']=' . $id; 53 54 $i++; 55 } 56 57 $this->document->link = Route::_('index.php?option=com_tags&view=tag&' . $tagIds); 58 59 $app->input->set('limit', $app->get('feed_limit')); 60 $siteEmail = $app->get('mailfrom'); 61 $fromName = $app->get('fromname'); 62 $feedEmail = $app->get('feed_email', 'none'); 63 64 $this->document->editor = $fromName; 65 66 if ($feedEmail !== 'none') { 67 $this->document->editorEmail = $siteEmail; 68 } 69 70 // Get some data from the model 71 $items = $this->get('Items'); 72 73 if ($items !== false) { 74 foreach ($items as $item) { 75 // Strip HTML from feed item title 76 $title = $this->escape($item->core_title); 77 $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8'); 78 79 // Strip HTML from feed item description text 80 $description = $item->core_body; 81 $author = $item->core_created_by_alias ?: $item->author; 82 $date = ($item->displayDate ? date('r', strtotime($item->displayDate)) : ''); 83 84 // Load individual item creator class 85 $feeditem = new FeedItem(); 86 $feeditem->title = $title; 87 $feeditem->link = Route::_($item->link); 88 $feeditem->description = $description; 89 $feeditem->date = $date; 90 $feeditem->category = $title; 91 $feeditem->author = $author; 92 93 if ($feedEmail === 'site') { 94 $item->authorEmail = $siteEmail; 95 } elseif ($feedEmail === 'author') { 96 $item->authorEmail = $item->author_email; 97 } 98 99 // Loads item info into RSS array 100 $this->document->addItem($feeditem); 101 } 102 } 103 } 104 }
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 |