Better error handling and display in the RSS widget, props DD32, fixes #8495

git-svn-id: https://develop.svn.wordpress.org/trunk@10742 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2009-03-08 05:01:26 +00:00
parent 88cae82656
commit 82cf6e6383
1 changed files with 7 additions and 2 deletions

View File

@ -1765,6 +1765,12 @@ function wp_widget_rss_form( $args, $inputs = null ) {
$show_author = (int) $show_author;
$show_date = (int) $show_date;
if ( !empty($error) ) {
$message = sprintf( __('Error in RSS Widget: %s'), $error);
echo "<div class='error'><p>$message</p></div>";
echo "<p class='hide-if-no-js'><strong>$message</strong></p>";
}
if ( $inputs['url'] ) :
?>
<p>
@ -1854,8 +1860,7 @@ function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
$error = false;
$link = '';
if ( is_wp_error($rss) ) {
$url = wp_specialchars(__('Error: could not find an RSS or ATOM feed at that URL.'), 1);
$error = sprintf(__('Error in RSS %1$d'), $widget_number );
$error = $rss->get_error_message();
} else {
$link = clean_url(strip_tags($rss->get_permalink()));
while ( stristr($link, 'http') != $link )