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