[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage mod_feed 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 defined('_JEXEC') or die; 12 13 use Joomla\CMS\Filter\OutputFilter; 14 use Joomla\CMS\HTML\HTMLHelper; 15 use Joomla\CMS\Language\Text; 16 17 // Check if feed URL has been set 18 if (empty($rssurl)) { 19 echo '<div>' . Text::_('MOD_FEED_ERR_NO_URL') . '</div>'; 20 21 return; 22 } 23 24 if (!empty($feed) && is_string($feed)) { 25 echo $feed; 26 } else { 27 $lang = $app->getLanguage(); 28 $myrtl = $params->get('rssrtl', 0); 29 $direction = ' '; 30 31 if ($lang->isRtl() && $myrtl == 0) { 32 $direction = ' redirect-rtl'; 33 } elseif ($lang->isRtl() && $myrtl == 1) { 34 // Feed description 35 $direction = ' redirect-ltr'; 36 } elseif ($lang->isRtl() && $myrtl == 2) { 37 $direction = ' redirect-rtl'; 38 } elseif ($myrtl == 0) { 39 $direction = ' redirect-ltr'; 40 } elseif ($myrtl == 1) { 41 $direction = ' redirect-ltr'; 42 } elseif ($myrtl == 2) { 43 $direction = ' redirect-rtl'; 44 } 45 46 if ($feed != false) : 47 ?> 48 <div style="direction: <?php echo $rssrtl ? 'rtl' : 'ltr'; ?>; text-align: <?php echo $rssrtl ? 'right' : 'left'; ?> !important" class="feed"> 49 <?php 50 51 // Feed title 52 if (!is_null($feed->title) && $params->get('rsstitle', 1)) : ?> 53 <h2 class="<?php echo $direction; ?>"> 54 <a href="<?php echo str_replace('&', '&', $rssurl); ?>" target="_blank"> 55 <?php echo $feed->title; ?></a> 56 </h2> 57 <?php endif; 58 // Feed date 59 if ($params->get('rssdate', 1)) : ?> 60 <h3> 61 <?php echo HTMLHelper::_('date', $feed->publishedDate, Text::_('DATE_FORMAT_LC3')); ?> 62 </h3> 63 <?php endif; ?> 64 65 <?php // Feed description ?> 66 <?php if ($params->get('rssdesc', 1)) : ?> 67 <?php echo $feed->description; ?> 68 <?php endif; ?> 69 70 <?php // Feed image ?> 71 <?php if ($params->get('rssimage', 1) && $feed->image) : ?> 72 <img class="w-100" src="<?php echo $feed->image->uri; ?>" alt="<?php echo $feed->image->title; ?>"/> 73 <?php endif; ?> 74 75 76 <?php // Show items ?> 77 <?php if (!empty($feed)) : ?> 78 <ul class="newsfeed list-group"> 79 <?php for ($i = 0; $i < $params->get('rssitems', 3); $i++) : 80 if (!$feed->offsetExists($i)) : 81 break; 82 endif; 83 $uri = $feed[$i]->uri || !$feed[$i]->isPermaLink ? trim($feed[$i]->uri) : trim($feed[$i]->guid); 84 $uri = !$uri || stripos($uri, 'http') !== 0 ? $rssurl : $uri; 85 $text = $feed[$i]->content !== '' ? trim($feed[$i]->content) : ''; 86 ?> 87 <li class="list-group-item mb-2"> 88 <?php if (!empty($uri)) : ?> 89 <h5 class="feed-link"> 90 <a href="<?php echo $uri; ?>" target="_blank"> 91 <?php echo trim($feed[$i]->title); ?></a></h5> 92 <?php else : ?> 93 <h5 class="feed-link"><?php echo trim($feed[$i]->title); ?></h5> 94 <?php endif; ?> 95 96 <?php if ($params->get('rssitemdate', 0)) : ?> 97 <div class="feed-item-date"> 98 <?php echo HTMLHelper::_('date', $feed[$i]->publishedDate, Text::_('DATE_FORMAT_LC3')); ?> 99 </div> 100 <?php endif; ?> 101 102 <?php if ($params->get('rssitemdesc', 1) && $text !== '') : ?> 103 <div class="feed-item-description"> 104 <?php 105 // Strip the images. 106 $text = OutputFilter::stripImages($text); 107 $text = HTMLHelper::_('string.truncate', $text, $params->get('word_count', 0), true, false); 108 echo str_replace(''', "'", $text); 109 ?> 110 </div> 111 <?php endif; ?> 112 </li> 113 <?php endfor; ?> 114 </ul> 115 <?php endif; ?> 116 </div> 117 <?php endif; 118 }
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 |