[ 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_finder 6 * 7 * @copyright (C) 2011 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\Finder\Site\View\Search; 12 13 use Joomla\CMS\Document\Feed\FeedItem; 14 use Joomla\CMS\Factory; 15 use Joomla\CMS\HTML\HTMLHelper; 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 * Search feed view class for the Finder package. 25 * 26 * @since 2.5 27 */ 28 class FeedView extends BaseHtmlView 29 { 30 /** 31 * Method to display the view. 32 * 33 * @param string $tpl A template file to load. [optional] 34 * 35 * @return void 36 * 37 * @since 2.5 38 */ 39 public function display($tpl = null) 40 { 41 // Get the application 42 $app = Factory::getApplication(); 43 44 // Adjust the list limit to the feed limit. 45 $app->input->set('limit', $app->get('feed_limit')); 46 47 // Get view data. 48 $state = $this->get('State'); 49 $params = $state->get('params'); 50 $query = $this->get('Query'); 51 $results = $this->get('Items'); 52 $total = $this->get('Total'); 53 54 // Push out the query data. 55 $explained = HTMLHelper::_('query.explained', $query); 56 57 // Set the document title. 58 $this->setDocumentTitle($params->get('page_title', '')); 59 60 // Configure the document description. 61 if (!empty($explained)) { 62 $this->document->setDescription(html_entity_decode(strip_tags($explained), ENT_QUOTES, 'UTF-8')); 63 } 64 65 // Set the document link. 66 $this->document->link = Route::_($query->toUri()); 67 68 // If we don't have any results, we are done. 69 if (empty($results)) { 70 return; 71 } 72 73 // Convert the results to feed entries. 74 foreach ($results as $result) { 75 // Convert the result to a feed entry. 76 $item = new FeedItem(); 77 $item->title = $result->title; 78 $item->link = Route::_($result->route); 79 $item->description = $result->description; 80 81 // Use Unix date to cope for non-english languages 82 $item->date = (int) $result->start_date ? HTMLHelper::_('date', $result->start_date, 'U') : $result->indexdate; 83 84 // Loads item info into RSS array 85 $this->document->addItem($item); 86 } 87 } 88 }
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 |