Changeset 10739
- Timestamp:
- 03/07/2009 07:44:28 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/dashboard.php
r10738 r10739 604 604 $rss = fetch_feed( $url ); 605 605 606 if ( is_wp_error($rss) ) { 607 if ( is_admin() || current_user_can('manage_options') ) { 608 echo '<p>'; 609 printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()); 610 echo '</p>'; 611 } 612 return; 613 } 614 606 615 if ( !$rss->get_item_quantity() ) { 607 616 echo '<p>' . __('This dashboard widget queries <a href="http://blogsearch.google.com/">Google Blog Search</a> so that when another blog links to your site it will show up here. It has found no incoming links… yet. It’s okay — there is no rush.') . "</p>\n"; … … 741 750 742 751 foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) { 743 if ( !$$feed->get_item_quantity() )752 if ( is_wp_error($$feed) || !$$feed->get_item_quantity() ) 744 753 continue; 745 754 … … 899 908 if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) { 900 909 $rss = fetch_feed($widget_options[$widget_id]['url']); 901 $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title())); 910 if ( ! is_wp_error($rss) ) 911 $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title())); 912 else 913 $widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed')); 902 914 } 903 915 update_option( 'dashboard_widget_options', $widget_options ); -
trunk/wp-includes/widgets.php
r10712 r10739 1542 1542 1543 1543 $url = $options[$number]['url']; 1544 while ( str str($url, 'http') != $url )1544 while ( stristr($url, 'http') != $url ) 1545 1545 $url = substr($url, 1); 1546 1546 if ( empty($url) ) … … 1548 1548 1549 1549 $rss = fetch_feed($url); 1550 $link = clean_url(strip_tags($rss->get_permalink()));1551 while ( strstr($link, 'http') != $link )1552 $link = substr($link, 1);1553 $desc = attribute_escape(strip_tags(html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset'))));1554 1550 $title = $options[$number]['title']; 1555 if ( empty($title) ) 1556 $title = htmlentities(strip_tags($rss->get_title())); 1551 $desc = ''; 1552 $link = ''; 1553 if ( ! is_wp_error($rss) ) { 1554 $desc = attribute_escape(strip_tags(html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset')))); 1555 if ( empty($title) ) 1556 $title = htmlentities(strip_tags($rss->get_title())); 1557 $link = clean_url(strip_tags($rss->get_permalink())); 1558 while ( stristr($link, 'http') != $link ) 1559 $link = substr($link, 1); 1560 } 1557 1561 if ( empty($title) ) 1558 1562 $title = $desc; … … 1561 1565 $title = apply_filters('widget_title', $title ); 1562 1566 $url = clean_url(strip_tags($url)); 1563 if ( file_exists(dirname(__FILE__) . '/rss.png') ) 1564 $icon = str_replace(ABSPATH, site_url() . '/', dirname(__FILE__)) . '/rss.png'; 1565 else 1566 $icon = includes_url('images/rss.png'); 1567 $icon = includes_url('images/rss.png'); 1567 1568 $title = "<a class='rsswidget' href='$url' title='" . attribute_escape(__('Syndicate this content')) ."'><img style='background:orange;color:white;border:none;' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' title='$desc'>$title</a>"; 1568 1569 … … 1585 1586 function wp_widget_rss_output( $rss, $args = array() ) { 1586 1587 if ( is_string( $rss ) ) { 1587 if ( !$rss = fetch_feed($rss) ) 1588 return; 1588 $rss = fetch_feed($rss); 1589 1589 } elseif ( is_array($rss) && isset($rss['url']) ) { 1590 1590 $args = $rss; 1591 if ( !$rss = fetch_feed($rss['url']) ) 1592 return; 1591 $rss = fetch_feed($rss['url']); 1593 1592 } elseif ( !is_object($rss) ) { 1594 1593 return; … … 1623 1622 foreach ( $rss->get_items(0, $items) as $item ) { 1624 1623 $link = $item->get_link(); 1625 while ( str str($link, 'http') != $link )1624 while ( stristr($link, 'http') != $link ) 1626 1625 $link = substr($link, 1); 1627 1626 $link = clean_url(strip_tags($link)); … … 1855 1854 $error = false; 1856 1855 $link = ''; 1857 if ( !is_object($rss) ) {1856 if ( is_wp_error($rss) ) { 1858 1857 $url = wp_specialchars(__('Error: could not find an RSS or ATOM feed at that URL.'), 1); 1859 1858 $error = sprintf(__('Error in RSS %1$d'), $widget_number ); 1860 1859 } else { 1861 1860 $link = clean_url(strip_tags($rss->get_permalink())); 1862 while ( str str($link, 'http') != $link )1861 while ( stristr($link, 'http') != $link ) 1863 1862 $link = substr($link, 1); 1864 1863 }
Note: See TracChangeset
for help on using the changeset viewer.