Ticket #17607: 17607.2.diff

File 17607.2.diff, 7.3 KB (added by aaroncampbell, 15 months ago)
  • wp-admin/includes/dashboard.php

     
    5454                wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments', 'wp_dashboard_recent_comments_control' ); 
    5555        } 
    5656 
    57         // Incoming Links Widget 
    58         if ( is_blog_admin() && current_user_can('publish_posts') ) { 
    59                 if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) { 
    60                         $update = true; 
    61                         $num_items = isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10; 
    62                         $widget_options['dashboard_incoming_links'] = array( 
    63                                 'home' => get_option('home'), 
    64                                 'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ), 
    65                                 'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters( 'dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url'] ) : apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?scoring=d&ie=utf-8&num=' . $num_items . '&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ), 
    66                                 'items' => $num_items, 
    67                                 'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false 
    68                         ); 
    69                 } 
    70                 wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' ); 
    71         } 
    72  
    7357        // WP Plugins Widget 
    7458        if ( ( ! is_multisite() && is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) && current_user_can( 'install_plugins' ) ) ) 
    7559                wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' ); 
     
    784768        echo '<input id="comments-number" name="widget-recent-comments[items]" type="text" value="' . $number . '" size="3" /></p>'; 
    785769} 
    786770 
    787 function wp_dashboard_incoming_links() { 
    788         wp_dashboard_cached_rss_widget( 'dashboard_incoming_links', 'wp_dashboard_incoming_links_output' ); 
    789 } 
    790  
    791 /** 
    792  * Display incoming links dashboard widget content. 
    793  * 
    794  * @since 2.5.0 
    795  */ 
    796 function wp_dashboard_incoming_links_output() { 
    797         $widgets = get_option( 'dashboard_widget_options' ); 
    798         @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP ); 
    799         $rss = fetch_feed( $url ); 
    800  
    801         if ( is_wp_error($rss) ) { 
    802                 if ( is_admin() || current_user_can('manage_options') ) { 
    803                         echo '<p>'; 
    804                         printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()); 
    805                         echo '</p>'; 
    806                 } 
    807                 return; 
    808         } 
    809  
    810         if ( !$rss->get_item_quantity() ) { 
    811                 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"; 
    812                 $rss->__destruct(); 
    813                 unset($rss); 
    814                 return; 
    815         } 
    816  
    817         echo "<ul>\n"; 
    818  
    819         if ( !isset($items) ) 
    820                 $items = 10; 
    821  
    822         foreach ( $rss->get_items(0, $items) as $item ) { 
    823                 $publisher = ''; 
    824                 $site_link = ''; 
    825                 $link = ''; 
    826                 $content = ''; 
    827                 $date = ''; 
    828                 $link = esc_url( strip_tags( $item->get_link() ) ); 
    829  
    830                 $author = $item->get_author(); 
    831                 if ( $author ) { 
    832                         $site_link = esc_url( strip_tags( $author->get_link() ) ); 
    833  
    834                         if ( !$publisher = esc_html( strip_tags( $author->get_name() ) ) ) 
    835                                 $publisher = __( 'Somebody' ); 
    836                 } else { 
    837                   $publisher = __( 'Somebody' ); 
    838                 } 
    839                 if ( $site_link ) 
    840                         $publisher = "<a href='$site_link'>$publisher</a>"; 
    841                 else 
    842                         $publisher = "<strong>$publisher</strong>"; 
    843  
    844                 $content = $item->get_content(); 
    845                 $content = wp_html_excerpt($content, 50) . ' ...'; 
    846  
    847                 if ( $link ) 
    848                         /* translators: incoming links feed, %1$s is other person, %3$s is content */ 
    849                         $text = __( '%1$s linked here <a href="%2$s">saying</a>, "%3$s"' ); 
    850                 else 
    851                         /* translators: incoming links feed, %1$s is other person, %3$s is content */ 
    852                         $text = __( '%1$s linked here saying, "%3$s"' ); 
    853  
    854                 if ( !empty($show_date) ) { 
    855                         if ( !empty($show_author) || !empty($show_summary) ) 
    856                                 /* translators: incoming links feed, %4$s is the date */ 
    857                                 $text .= ' ' . __( 'on %4$s' ); 
    858                         $date = esc_html( strip_tags( $item->get_date() ) ); 
    859                         $date = strtotime( $date ); 
    860                         $date = gmdate( get_option( 'date_format' ), $date ); 
    861                 } 
    862  
    863                 echo "\t<li>" . sprintf( $text, $publisher, $link, $content, $date ) . "</li>\n"; 
    864         } 
    865  
    866         echo "</ul>\n"; 
    867         $rss->__destruct(); 
    868         unset($rss); 
    869 } 
    870  
    871 function wp_dashboard_incoming_links_control() { 
    872         wp_dashboard_rss_control( 'dashboard_incoming_links', array( 'title' => false, 'show_summary' => false, 'show_author' => false ) ); 
    873 } 
    874  
    875771function wp_dashboard_primary() { 
    876772        wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_rss_output' ); 
    877773} 
  • wp-admin/js/dashboard.dev.js

     
    2929 
    3030        // These widgets are sometimes populated via ajax 
    3131        ajaxWidgets = [ 
    32                 'dashboard_incoming_links', 
    3332                'dashboard_primary', 
    3433                'dashboard_secondary', 
    3534                'dashboard_plugins' 
  • wp-admin/index.php

     
    6262        $help .= '<p>' . __('<strong>Right Now</strong> - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.') . '</p>'; 
    6363if ( current_user_can( 'moderate_comments' ) ) 
    6464        $help .= '<p>' . __('<strong>Recent Comments</strong> - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them.') . '</p>'; 
    65 if ( current_user_can( 'publish_posts' ) ) 
    66         $help .= '<p>' . __('<strong>Incoming Links</strong> - Shows links to your site found by Google Blog Search.') . '</p>'; 
    6765if ( current_user_can( 'edit_posts' ) ) { 
    6866        $help .= '<p>' . __('<strong>QuickPress</strong> - Allows you to create a new post and either publish it or save it as a draft.') . '</p>'; 
    6967        $help .= '<p>' . __('<strong>Recent Drafts</strong> - Displays links to the 5 most recent draft posts you&#8217;ve started.') . '</p>'; 
  • wp-admin/css/ie-rtl.dev.css

     
    111111        direction: rtl; 
    112112} 
    113113 
    114 #dashboard_incoming_links ul li, 
    115114#dashboard_secondary ul li, 
    116115#dashboard_primary ul li, 
    117116p.row-actions { 
  • wp-admin/index-extra.php

     
    1919 
    2020switch ( $_GET['jax'] ) { 
    2121 
    22 case 'dashboard_incoming_links' : 
    23         wp_dashboard_incoming_links(); 
    24         break; 
    25  
    2622case 'dashboard_primary' : 
    2723        wp_dashboard_primary(); 
    2824        break;