Make WordPress Core

Ticket #22400: 22400.dashboard.php.diff

File 22400.dashboard.php.diff, 3.7 KB (added by MikeHansenMe, 11 years ago)

Dashboard.php with some minor code clean up as well

  • wp-admin/includes/dashboard.php

     
    760760 */
    761761function wp_dashboard_incoming_links_output() {
    762762        $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'] );
    765764
    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' ) ) {
    768767                        echo '<p>';
    769                         printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
     768                        printf( __( '<strong>RSS Error</strong>: %s' ), $rss->get_error_message() );
    770769                        echo '</p>';
    771770                }
    772771                return;
     
    775774        if ( !$rss->get_item_quantity() ) {
    776775                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&hellip; yet. It&#8217;s okay &#8212; there is no rush.') . "</p>\n";
    777776                $rss->__destruct();
    778                 unset($rss);
     777                unset( $rss );
    779778                return;
    780779        }
    781780
    782781        echo "<ul>\n";
    783782
    784         if ( !isset($items) )
    785                 $items = 10;
     783        if ( !isset( $widgets['dashboard_incoming_links']['items'] ) )
     784                $widgets['dashboard_incoming_links']['items'] = 10;
    786785
    787         foreach ( $rss->get_items(0, $items) as $item ) {
     786        foreach ( $rss->get_items( 0, $widgets['dashboard_incoming_links']['items'] ) as $item ) {
    788787                $publisher = '';
    789788                $site_link = '';
    790789                $link = '';
     
    816815                        /* translators: incoming links feed, %1$s is other person, %3$s is content */
    817816                        $text = __( '%1$s linked here saying, "%3$s"' );
    818817
    819                 if ( !empty( $show_date ) ) {
     818                if ( !empty( $widgets['dashboard_incoming_links']['show_date'] ) ) {
    820819                        if ( $link )
    821820                                /* translators: incoming links feed, %1$s is other person, %3$s is content, %4$s is the date */
    822821                                $text = __( '%1$s linked here <a href="%2$s">saying</a>, "%3$s" on %4$s' );
     
    833832
    834833        echo "</ul>\n";
    835834        $rss->__destruct();
    836         unset($rss);
     835        unset( $rss );
    837836}
    838837
    839838function wp_dashboard_incoming_links_control() {
     
    879878 */
    880879function wp_dashboard_secondary_output() {
    881880        $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' ) ) {
    887884                        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() );
    889886                        echo '</p></div>';
    890887                }
    891888        } elseif ( !$rss->get_item_quantity() ) {
    892889                $rss->__destruct();
    893                 unset($rss);
     890                unset( $rss );
    894891                return false;
    895892        } else {
    896893                echo '<div class="rss-widget">';
    897894                wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
    898895                echo '</div>';
    899896                $rss->__destruct();
    900                 unset($rss);
     897                unset( $rss );
    901898        }
    902899}
    903900
     
    11931190                global $wp_version;
    11941191
    11951192                $options = array(
    1196                         'body'                  => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
    1197                         'user-agent'    => 'WordPress/' . $wp_version . '; ' . home_url()
     1193                        'body'          => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
     1194                        'user-agent'    => 'WordPress/' . $wp_version . '; ' . home_url()
    11981195                );
    11991196
    12001197                $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options );