Make WordPress Core

Changeset 10697


Ignore:
Timestamp:
03/04/2009 07:24:48 PM (18 years ago)
Author:
ryan
Message:

Add RSS Error handling functionality to RSS Widget displays. Props DD32. fixes #9273

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/dashboard.php

    r10688 r10697  
    699699        $rss = @fetch_feed( $url );
    700700
    701         if ( !$rss->get_item_quantity() )
     701        if ( is_wp_error($rss) ) {
     702                if ( is_admin() || current_user_can('manage_options') ) {
     703                        echo '<div class="rss-widget"><p>';
     704                        printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
     705                        echo '</p></div>';
     706                }
     707        } elseif ( !$rss->get_item_quantity() ) {
    702708                return false;
    703 
    704         echo "<div class='rss-widget'>";
    705         wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
    706         echo "</div>";
     709        } else {
     710                echo '<div class="rss-widget">';
     711                wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
     712                echo '</div>';
     713        }
    707714}
    708715
  • trunk/wp-includes/widgets.php

    r10688 r10697  
    15471547                        return;
    15481548        } elseif ( !is_object($rss) ) {
     1549                return;
     1550        }
     1551
     1552        if ( is_wp_error($rss) ) {
     1553                if ( is_admin() || current_user_can('manage_options') ) {
     1554                        echo '<p>';
     1555                        printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
     1556                        echo '</p>';
     1557                }
    15491558                return;
    15501559        }
Note: See TracChangeset for help on using the changeset viewer.