Ticket #22400: 22400.dashboard.php.diff
File 22400.dashboard.php.diff, 3.7 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/dashboard.php
760 760 */ 761 761 function wp_dashboard_incoming_links_output() { 762 762 $widgets = get_option( 'dashboard_widget_options' ); 763 @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP ); 764 $rss = fetch_feed( $url ); 763 $rss = fetch_feed( $widgets['dashboard_incoming_links']['url'] ); 765 764 766 if ( is_wp_error( $rss) ) {767 if ( is_admin() || current_user_can( 'manage_options') ) {765 if ( is_wp_error( $rss ) ) { 766 if ( is_admin() || current_user_can( 'manage_options' ) ) { 768 767 echo '<p>'; 769 printf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message());768 printf( __( '<strong>RSS Error</strong>: %s' ), $rss->get_error_message() ); 770 769 echo '</p>'; 771 770 } 772 771 return; … … 775 774 if ( !$rss->get_item_quantity() ) { 776 775 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"; 777 776 $rss->__destruct(); 778 unset( $rss);777 unset( $rss ); 779 778 return; 780 779 } 781 780 782 781 echo "<ul>\n"; 783 782 784 if ( !isset( $items) )785 $ items= 10;783 if ( !isset( $widgets['dashboard_incoming_links']['items'] ) ) 784 $widgets['dashboard_incoming_links']['items'] = 10; 786 785 787 foreach ( $rss->get_items( 0, $items) as $item ) {786 foreach ( $rss->get_items( 0, $widgets['dashboard_incoming_links']['items'] ) as $item ) { 788 787 $publisher = ''; 789 788 $site_link = ''; 790 789 $link = ''; … … 816 815 /* translators: incoming links feed, %1$s is other person, %3$s is content */ 817 816 $text = __( '%1$s linked here saying, "%3$s"' ); 818 817 819 if ( !empty( $ show_date) ) {818 if ( !empty( $widgets['dashboard_incoming_links']['show_date'] ) ) { 820 819 if ( $link ) 821 820 /* translators: incoming links feed, %1$s is other person, %3$s is content, %4$s is the date */ 822 821 $text = __( '%1$s linked here <a href="%2$s">saying</a>, "%3$s" on %4$s' ); … … 833 832 834 833 echo "</ul>\n"; 835 834 $rss->__destruct(); 836 unset( $rss);835 unset( $rss ); 837 836 } 838 837 839 838 function wp_dashboard_incoming_links_control() { … … 879 878 */ 880 879 function wp_dashboard_secondary_output() { 881 880 $widgets = get_option( 'dashboard_widget_options' ); 882 @extract( @$widgets['dashboard_secondary'], EXTR_SKIP ); 883 $rss = @fetch_feed( $url ); 884 885 if ( is_wp_error($rss) ) { 886 if ( is_admin() || current_user_can('manage_options') ) { 881 $rss = @fetch_feed( $widgets['dashboard_secondary']['url'] ); 882 if ( is_wp_error( $rss ) ) { 883 if ( is_admin() || current_user_can( 'manage_options' ) ) { 887 884 echo '<div class="rss-widget"><p>'; 888 printf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message());885 printf( __( '<strong>RSS Error</strong>: %s' ), $rss->get_error_message() ); 889 886 echo '</p></div>'; 890 887 } 891 888 } elseif ( !$rss->get_item_quantity() ) { 892 889 $rss->__destruct(); 893 unset( $rss);890 unset( $rss ); 894 891 return false; 895 892 } else { 896 893 echo '<div class="rss-widget">'; 897 894 wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] ); 898 895 echo '</div>'; 899 896 $rss->__destruct(); 900 unset( $rss);897 unset( $rss ); 901 898 } 902 899 } 903 900 … … 1193 1190 global $wp_version; 1194 1191 1195 1192 $options = array( 1196 'body' 1197 'user-agent' 1193 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), 1194 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url() 1198 1195 ); 1199 1196 1200 1197 $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options );