1<?php 2/** 3 * @package Joomla.Site 4 * @subpackage mod_feed 5 * 6 * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10defined('_JEXEC') or die; 11?> 12 13<?php 14if (!empty($feed) && is_string($feed)) 15{ 16 echo $feed; 17} 18else 19{ 20 $lang = JFactory::getLanguage(); 21 $myrtl = $params->get('rssrtl', 0); 22 $direction = ' '; 23 24 $isRtl = $lang->isRtl(); 25 26 if ($isRtl && $myrtl == 0) 27 { 28 $direction = ' redirect-rtl'; 29 } 30 31 // Feed description 32 elseif ($isRtl && $myrtl == 1) 33 { 34 $direction = ' redirect-ltr'; 35 } 36 37 elseif ($isRtl && $myrtl == 2) 38 { 39 $direction = ' redirect-rtl'; 40 } 41 42 elseif ($myrtl == 0) 43 { 44 $direction = ' redirect-ltr'; 45 } 46 elseif ($myrtl == 1) 47 { 48 $direction = ' redirect-ltr'; 49 } 50 elseif ($myrtl == 2) 51 { 52 $direction = ' redirect-rtl'; 53 } 54 55 if ($feed !== false) 56 { 57 ?> 58 <div style="direction: <?php echo $rssrtl ? 'rtl' :'ltr'; ?>; text-align: <?php echo $rssrtl ? 'right' :'left'; ?> !important" class="feed<?php echo $moduleclass_sfx; ?>"> 59 <?php 60 // Feed description 61 if ($feed->title !== null && $params->get('rsstitle', 1)) 62 { 63 ?> 64 <h2 class="<?php echo $direction; ?>"> 65 <a href="<?php echo htmlspecialchars($rssurl, ENT_COMPAT, 'UTF-8'); ?>" target="_blank"> 66 <?php echo $feed->title; ?></a> 67 </h2> 68 <?php 69 } 70 // Feed date 71 if ($params->get('rssdate', 1)) : ?> 72 <h3> 73 <?php echo JHtml::_('date', $feed->publishedDate, JText::_('DATE_FORMAT_LC3')); ?> 74 </h3> 75 <?php endif; 76 // Feed description 77 if ($params->get('rssdesc', 1)) 78 { 79 ?> 80 <?php echo $feed->description; ?> 81 <?php 82 } 83 // Feed image 84 if ($feed->image && $params->get('rssimage', 1)) : 85 ?> 86 <img src="<?php echo $feed->image->uri; ?>" alt="<?php echo $feed->image->title; ?>"/> 87 <?php endif; ?> 88 89 90 <!-- Show items --> 91 <?php if (!empty($feed)) 92 { ?> 93 <ul class="newsfeed<?php echo $params->get('moduleclass_sfx'); ?>"> 94 <?php for ($i = 0, $max = min(count($feed), $params->get('rssitems', 3)); $i < $max; $i++) { ?> 95 <?php 96 $uri = $feed[$i]->uri || !$feed[$i]->isPermaLink ? trim($feed[$i]->uri) : trim($feed[$i]->guid); 97 $uri = !$uri || stripos($uri, 'http') !== 0 ? $rssurl : $uri; 98 $text = $feed[$i]->content !== '' ? trim($feed[$i]->content) : ''; 99 ?> 100 <li> 101 <?php if (!empty($uri)) : ?> 102 <span class="feed-link"> 103 <a href="<?php echo htmlspecialchars($uri, ENT_COMPAT, 'UTF-8'); ?>" target="_blank"> 104 <?php echo trim($feed[$i]->title); ?></a></span> 105 <?php else : ?> 106 <span class="feed-link"><?php echo trim($feed[$i]->title); ?></span> 107 <?php endif; ?> 108 <?php if ($params->get('rssitemdate', 0)) : ?> 109 <div class="feed-item-date"> 110 <?php echo JHtml::_('date', $feed[$i]->publishedDate, JText::_('DATE_FORMAT_LC3')); ?> 111 </div> 112 <?php endif; ?> 113 <?php if ($params->get('rssitemdesc', 1) && $text !== '') : ?> 114 <div class="feed-item-description"> 115 <?php 116 // Strip the images. 117 $text = JFilterOutput::stripImages($text); 118 $text = JHtml::_('string.truncate', $text, $params->get('word_count', 0)); 119 echo str_replace(''', "'", $text); 120 ?> 121 </div> 122 <?php endif; ?> 123 </li> 124 <?php } ?> 125 </ul> 126 <?php } ?> 127 </div> 128 <?php } 129} 130