Fix xhtml output for RSS widget when feed contains no items. Fixed #4671 props brettz95 and Nazgul

git-svn-id: http://svn.automattic.com/wordpress/trunk@5968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2007-08-29 17:28:07 +00:00
parent f78592cf01
commit 36ec45d7ff

View File

@ -966,10 +966,10 @@ function wp_widget_rss($args, $number = 1) {
?>
<?php echo $before_widget; ?>
<?php $title ? print($before_title . $title . $after_title) : null; ?>
<ul>
<?php
if ( is_array( $rss->items ) ) {
if ( is_array( $rss->items ) && !empty( $rss->items ) ) {
$rss->items = array_slice($rss->items, 0, $num_items);
echo '<ul>';
foreach ($rss->items as $item ) {
while ( strstr($item['link'], 'http') != $item['link'] )
$item['link'] = substr($item['link'], 1);
@ -987,13 +987,12 @@ function wp_widget_rss($args, $number = 1) {
}
echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>$summary</li>";
}
echo '</ul>';
} else {
echo '<li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li>';
echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>';
}
?>
</ul>
<?php echo $after_widget; ?>
<?php
echo $after_widget;
}
function wp_widget_rss_control($number) {