Skip to content

Commit

Permalink
Tried to clean the code :) and
Browse files Browse the repository at this point in the history
fixed the same failure in mod_feed.
  • Loading branch information
dimnax committed Feb 4, 2016
1 parent 50634cc commit bfb2c2d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
30 changes: 19 additions & 11 deletions components/com_newsfeeds/views/newsfeed/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,28 @@
<!-- Show items -->
<?php if (!empty($this->rssDoc[0])) { ?>
<ol>
<?php for ($i = 0; $i < $this->item->numarticles; $i++) { ?>
<?php if (empty($this->rssDoc[$i])) { break; } ?>
<?php
$uri = !empty($this->rssDoc[$i]->guid) || !is_null($this->rssDoc[$i]->guid) ? $this->rssDoc[$i]->guid : $this->rssDoc[$i]->uri;
$uri = substr($uri, 0, 4) != 'http' ? $this->item->link : $uri;
$text = !empty($this->rssDoc[$i]->content) || !is_null($this->rssDoc[$i]->content) ? $this->rssDoc[$i]->content : $this->rssDoc[$i]->description;
?>
<?php for ($i = 0; $i < $this->item->numarticles; $i++)
{
if (empty($this->rssDoc[$i]))
{
break;
}
?>
<?php
$uri = !empty($this->rssDoc[$i]->guid) || !is_null($this->rssDoc[$i]->guid) ? trim($this->rssDoc[$i]->guid) : trim($this->rssDoc[$i]->uri);
$uri = substr($uri, 0, 4) != 'http' ? $this->item->link : $uri;
$text = !empty($this->rssDoc[$i]->content) || !is_null($this->rssDoc[$i]->content) ? trim($this->rssDoc[$i]->content) : trim($this->rssDoc[$i]->description);
$title = trim($this->rssDoc[$i]->title);
?>
<li>
<?php if (!empty($this->rssDoc[$i]->uri)) : ?>
<a href="<?php echo $this->rssDoc[$i]->uri; ?>" target="_blank">
<?php echo $this->rssDoc[$i]->title; ?></a>
<?php if (!empty($uri)) : ?>
<h3 class="feed-link">
<a href="<?php echo htmlspecialchars($uri); ?>" target="_blank">
<?php echo $title; ?></a></h3>
<?php else : ?>
<h3><?php echo '<a target="_blank" href="' . trim($this->rssDoc[$i]->uri) . '">' . $this->rssDoc[$i]->title . '</a>'; ?></h3>
<h3 class="feed-link"><?php echo $title; ?></h3>
<?php endif; ?>

<?php if ($this->params->get('show_item_description') && !empty($text)) : ?>
<div class="feed-item-description">
<?php if ($this->params->get('show_feed_image', 0) == 0)
Expand Down
11 changes: 6 additions & 5 deletions modules/mod_feed/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,18 @@
}
?>
<?php
$uri = (!empty($feed[$i]->uri) || !is_null($feed[$i]->uri)) ? $feed[$i]->uri : $feed[$i]->guid;
$uri = substr($uri, 0, 4) != 'http' ? $params->get('rsslink') : $uri;
$text = !empty($feed[$i]->content) || !is_null($feed[$i]->content) ? $feed[$i]->content : $feed[$i]->description;
$uri = (!empty($feed[$i]->uri) || !is_null($feed[$i]->uri)) ? trim($feed[$i]->uri) : trim($feed[$i]->guid);
$uri = substr($uri, 0, 4) != 'http' ? $params->get('rsslink') : $uri;
$text = !empty($feed[$i]->content) || !is_null($feed[$i]->content) ? trim($feed[$i]->content) : trim($feed[$i]->description);
$title = trim($feed[$i]->title);
?>
<li>
<?php if (!empty($uri)) : ?>
<span class="feed-link">
<a href="<?php echo htmlspecialchars($uri); ?>" target="_blank">
<?php echo $feed[$i]->title; ?></a></span>
<?php echo $title; ?></a></span>
<?php else : ?>
<span class="feed-link"><?php echo $feed[$i]->title; ?></span>
<span class="feed-link"><?php echo $title; ?></span>
<?php endif; ?>

<?php if ($params->get('rssitemdesc') && !empty($text)) : ?>
Expand Down

0 comments on commit bfb2c2d

Please sign in to comment.