Make WordPress Core

Ticket #19239: 19239.5.diff

File 19239.5.diff, 25.6 KB (added by lessbloat, 12 years ago)
  • wp-includes/default-widgets.php

     
    823823 * @param array $args Widget arguments.
    824824 */
    825825function wp_widget_rss_output( $rss, $args = array() ) {
    826         if ( is_string( $rss ) ) {
    827                 $rss = fetch_feed($rss);
    828         } elseif ( is_array($rss) && isset($rss['url']) ) {
    829                 $args = $rss;
    830                 $rss = fetch_feed($rss['url']);
    831         } elseif ( !is_object($rss) ) {
    832                 return;
    833         }
     826       
     827        // Shows plugins plus link to install them
     828        if ( isset( $args['type'] ) && 'plugins' == $args['type'] ) {
    834829
    835         if ( is_wp_error($rss) ) {
    836                 if ( is_admin() || current_user_can('manage_options') )
    837                         echo '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';
    838                 return;
    839         }
    840 
    841         $default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0 );
    842         $args = wp_parse_args( $args, $default_args );
    843         extract( $args, EXTR_SKIP );
    844 
    845         $items = (int) $items;
    846         if ( $items < 1 || 20 < $items )
    847                 $items = 10;
    848         $show_summary  = (int) $show_summary;
    849         $show_author   = (int) $show_author;
    850         $show_date     = (int) $show_date;
    851 
    852         if ( !$rss->get_item_quantity() ) {
    853                 echo '<ul><li>' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</li></ul>';
    854                 $rss->__destruct();
    855                 unset($rss);
    856                 return;
    857         }
    858 
    859         echo '<ul>';
    860         foreach ( $rss->get_items(0, $items) as $item ) {
    861                 $link = $item->get_link();
    862                 while ( stristr($link, 'http') != $link )
    863                         $link = substr($link, 1);
    864                 $link = esc_url(strip_tags($link));
    865                 $title = esc_attr(strip_tags($item->get_title()));
    866                 if ( empty($title) )
    867                         $title = __('Untitled');
    868 
    869                 $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) );
    870                 $excerpt = wp_html_excerpt( $desc, 360 );
    871 
    872                 // Append ellipsis. Change existing [...] to [&hellip;].
    873                 if ( '[...]' == substr( $excerpt, -5 ) )
    874                         $excerpt = substr( $excerpt, 0, -5 ) . '[&hellip;]';
    875                 elseif ( '[&hellip;]' != substr( $excerpt, -10 ) && $desc != $excerpt )
    876                         $excerpt .= ' [&hellip;]';
    877 
    878                 $excerpt = esc_html( $excerpt );
    879 
    880                 if ( $show_summary ) {
    881                         $summary = "<div class='rssSummary'>$excerpt</div>";
    882                 } else {
    883                         $summary = '';
     830                $popular = fetch_feed( $args['url']['popular'] );
     831                $new     = fetch_feed( $args['url']['new'] );
     832       
     833                if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
     834                        $plugin_slugs = array_keys( get_plugins() );
     835                        set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS );
    884836                }
    885 
    886                 $date = '';
    887                 if ( $show_date ) {
    888                         $date = $item->get_date( 'U' );
    889 
    890                         if ( $date ) {
    891                                 $date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date ) . '</span>';
     837               
     838                echo '<ul>';
     839               
     840                foreach ( array( 'popular' => __('Popular Plugin'), 'new' => __('Newest Plugin') ) as $feed => $label ) {
     841                        if ( is_wp_error($$feed) || !$$feed->get_item_quantity() )
     842                                continue;
     843       
     844                        $items = $$feed->get_items(0, 5);
     845       
     846                        // Pick a random, non-installed plugin
     847                        while ( true ) {
     848                                // Abort this foreach loop iteration if there's no plugins left of this type
     849                                if ( 0 == count($items) )
     850                                        continue 2;
     851       
     852                                $item_key = array_rand($items);
     853                                $item = $items[$item_key];
     854       
     855                                list($link, $frag) = explode( '#', $item->get_link() );
     856       
     857                                $link = esc_url($link);
     858                                if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
     859                                        $slug = $matches[1];
     860                                else {
     861                                        unset( $items[$item_key] );
     862                                        continue;
     863                                }
     864       
     865                                // Is this random plugin's slug already installed? If so, try again.
     866                                reset( $plugin_slugs );
     867                                foreach ( $plugin_slugs as $plugin_slug ) {
     868                                        if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) {
     869                                                unset( $items[$item_key] );
     870                                                continue 2;
     871                                        }
     872                                }
     873       
     874                                // If we get to this point, then the random plugin isn't installed and we can stop the while().
     875                                break;
    892876                        }
     877       
     878                        // Eliminate some common badly formed plugin descriptions
     879                        while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) )
     880                                unset($items[$item_key]);
     881       
     882                        if ( !isset($items[$item_key]) )
     883                                continue;
     884       
     885                        $title = esc_html( $item->get_title() );
     886       
     887                        $description = esc_html( strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'))) );
     888       
     889                        $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
     890       
     891                        echo "<li><span>$label:</span> <a href='$link'>$title</a></h5>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span></li>";
     892       
     893                        $$feed->__destruct();
     894                        unset($$feed);
    893895                }
     896               
     897                echo '</ul>';
     898       
     899        } else { // Shows all other RSS feeds   
    894900
    895                 $author = '';
    896                 if ( $show_author ) {
    897                         $author = $item->get_author();
    898                         if ( is_object($author) ) {
    899                                 $author = $author->get_name();
    900                                 $author = ' <cite>' . esc_html( strip_tags( $author ) ) . '</cite>';
     901                if ( is_string( $rss ) ) {
     902                        $rss = fetch_feed($rss);
     903                } elseif ( is_array($rss) && isset($rss['url']) ) {
     904                        $args = $rss;
     905                        $rss = fetch_feed($rss['url']);
     906                } elseif ( !is_object($rss) ) {
     907                        return;
     908                }
     909       
     910                if ( is_wp_error($rss) ) {
     911                        if ( is_admin() || current_user_can('manage_options') )
     912                                echo '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';
     913                        return;
     914                }
     915       
     916                $default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0 );
     917                $args = wp_parse_args( $args, $default_args );
     918                extract( $args, EXTR_SKIP );
     919       
     920                $items = (int) $items;
     921                if ( $items < 1 || 20 < $items )
     922                        $items = 10;
     923                $show_summary  = (int) $show_summary;
     924                $show_author   = (int) $show_author;
     925                $show_date     = (int) $show_date;
     926       
     927                if ( !$rss->get_item_quantity() ) {
     928                        echo '<ul><li>' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</li></ul>';
     929                        $rss->__destruct();
     930                        unset($rss);
     931                        return;
     932                }
     933       
     934                echo '<ul>';
     935       
     936                foreach ( $rss->get_items(0, $items) as $item ) {
     937                        $link = $item->get_link();
     938                        while ( stristr($link, 'http') != $link )
     939                                $link = substr($link, 1);
     940                        $link = esc_url(strip_tags($link));
     941                        $title = esc_attr(strip_tags($item->get_title()));
     942                        if ( empty($title) )
     943                                $title = __('Untitled');
     944       
     945                        $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) );
     946                        $excerpt = wp_html_excerpt( $desc, 160 );
     947       
     948                        // Append ellipsis. Change existing [...] to [&hellip;].
     949                        if ( '[...]' == substr( $excerpt, -5 ) )
     950                                $excerpt = substr( $excerpt, 0, -5 ) . '[&hellip;]';
     951                        elseif ( '[&hellip;]' != substr( $excerpt, -10 ) && $desc != $excerpt )
     952                                $excerpt .= ' [&hellip;]';
     953       
     954                        $excerpt = esc_html( $excerpt );
     955       
     956                        if ( $show_summary ) {
     957                                $summary = "<div class='rssSummary'>$excerpt</div>";
     958                        } else {
     959                                $summary = '';
    901960                        }
     961       
     962                        $date = '';
     963                        if ( $show_date ) {
     964                                $date = $item->get_date( 'U' );
     965       
     966                                if ( $date ) {
     967                                        $date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date ) . '</span>';
     968                                }
     969                        }
     970       
     971                        $author = '';
     972                        if ( $show_author ) {
     973                                $author = $item->get_author();
     974                                if ( is_object($author) ) {
     975                                        $author = $author->get_name();
     976                                        $author = ' <cite>' . esc_html( strip_tags( $author ) ) . '</cite>';
     977                                }
     978                        }
     979       
     980                        if ( $link == '' ) {
     981                                echo "<li>$title{$date}{$summary}{$author}</li>";
     982                        } else {
     983                                echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";
     984                        }
    902985                }
    903 
    904                 if ( $link == '' ) {
    905                         echo "<li>$title{$date}{$summary}{$author}</li>";
    906                 } else {
    907                         echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";
    908                 }
     986                $rss->__destruct();
     987                unset($rss);
     988       
     989                echo '</ul>';
    909990        }
    910         echo '</ul>';
    911         $rss->__destruct();
    912         unset($rss);
    913991}
    914992
    915993/**
     
    9441022        if ( !empty($error) )
    9451023                echo '<p class="widget-error"><strong>' . sprintf( __('RSS Error: %s'), $error) . '</strong></p>';
    9461024
    947         if ( $inputs['url'] ) :
     1025        if ( $inputs['url'] && is_string( $args['url'] ) ) :
    9481026?>
    9491027        <p><label for="rss-url-<?php echo $number; ?>"><?php _e('Enter the RSS feed URL here:'); ?></label>
    9501028        <input class="widefat" id="rss-url-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][url]" type="text" value="<?php echo $url; ?>" /></p>
  • wp-admin/includes/ajax-actions.php

     
    209209                case 'dashboard_incoming_links' :
    210210                        wp_dashboard_incoming_links();
    211211                        break;
    212                 case 'dashboard_primary' :
    213                         wp_dashboard_primary();
     212                case 'dashboard_rss' :
     213                        wp_dashboard_rss();
    214214                        break;
    215                 case 'dashboard_secondary' :
    216                         wp_dashboard_secondary();
    217                         break;
    218                 case 'dashboard_plugins' :
    219                         wp_dashboard_plugins();
    220                         break;
    221215        }
    222216        wp_die();
    223217}
  • wp-admin/includes/dashboard.php

     
    7070                wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );
    7171        }
    7272
    73         // WP Plugins Widget
    74         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' ) ) )
    75                 wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' );
    76 
    7773        // QuickPress Widget
    7874        if ( is_blog_admin() && current_user_can('edit_posts') )
    7975                wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' );
     
    8177        // Recent Drafts
    8278        if ( is_blog_admin() && current_user_can('edit_posts') )
    8379                wp_add_dashboard_widget( 'dashboard_recent_drafts', __('Recent Drafts'), 'wp_dashboard_recent_drafts' );
     80               
     81        // RSS Widget
     82        wp_add_dashboard_widget( 'dashboard_rss', __( 'WordPress News' ), 'wp_dashboard_rss', 'wp_dashboard_rss_feed_control' );
    8483
    85         // Primary feed (Dev Blog) Widget
    86         if ( !isset( $widget_options['dashboard_primary'] ) ) {
    87                 $update = true;
    88                 $widget_options['dashboard_primary'] = array(
    89                         'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ),
    90                         'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ),
    91                         'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ),
    92                         'items' => 2,
    93                         'show_summary' => 1,
    94                         'show_author' => 0,
    95                         'show_date' => 1,
    96                 );
    97         }
    98         wp_add_dashboard_widget( 'dashboard_primary', $widget_options['dashboard_primary']['title'], 'wp_dashboard_primary', 'wp_dashboard_primary_control' );
    99 
    100         // Secondary Feed (Planet) Widget
    101         if ( !isset( $widget_options['dashboard_secondary'] ) ) {
    102                 $update = true;
    103                 $widget_options['dashboard_secondary'] = array(
    104                         'link' => apply_filters( 'dashboard_secondary_link', __( 'http://planet.wordpress.org/' ) ),
    105                         'url' => apply_filters( 'dashboard_secondary_feed', __( 'http://planet.wordpress.org/feed/' ) ),
    106                         'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
    107                         'items' => 5,
    108                         'show_summary' => 0,
    109                         'show_author' => 0,
    110                         'show_date' => 0,
    111                 );
    112         }
    113         wp_add_dashboard_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_secondary', 'wp_dashboard_secondary_control' );
    114 
    11584        // Hook to register new widgets
    11685        // Filter widget order
    11786        if ( is_network_admin() ) {
     
    163132        }
    164133
    165134        if ( is_blog_admin () )
    166                 $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
     135                $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts','dashboard_rss');
    167136        else if (is_network_admin() )
    168                 $side_widgets = array('dashboard_primary', 'dashboard_secondary');
     137                $side_widgets = array('dashboard_rss');
    169138        else
    170139                $side_widgets = array();
    171140
     
    856825        unset($rss);
    857826}
    858827
     828function wp_dashboard_rss_feed_control() {
     829        wp_dashboard_rss_control( 'dashboard_rss' );
     830}
     831
    859832function wp_dashboard_incoming_links_control() {
    860833        wp_dashboard_rss_control( 'dashboard_incoming_links', array( 'title' => false, 'show_summary' => false, 'show_author' => false ) );
    861834}
    862835
    863 function wp_dashboard_primary() {
    864         wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_rss_output' );
    865 }
    866 
    867 function wp_dashboard_primary_control() {
    868         wp_dashboard_rss_control( 'dashboard_primary' );
    869 }
    870 
    871836/**
    872837 * Display primary dashboard RSS widget feed.
    873838 *
     
    875840 *
    876841 * @param string $widget_id
    877842 */
    878 function wp_dashboard_rss_output( $widget_id ) {
     843function wp_dashboard_rss_output() {
    879844        $widgets = get_option( 'dashboard_widget_options' );
    880         echo '<div class="rss-widget">';
    881         wp_widget_rss_output( $widgets[$widget_id] );
    882         echo "</div>";
    883 }
    884 
    885 function wp_dashboard_secondary() {
    886         wp_dashboard_cached_rss_widget( 'dashboard_secondary', 'wp_dashboard_secondary_output' );
    887 }
    888 
    889 function wp_dashboard_secondary_control() {
    890         wp_dashboard_rss_control( 'dashboard_secondary' );
    891 }
    892 
    893 /**
    894  * Display secondary dashboard RSS widget feed.
    895  *
    896  * @since 2.5.0
    897  *
    898  * @return unknown
    899  */
    900 function wp_dashboard_secondary_output() {
    901         $widgets = get_option( 'dashboard_widget_options' );
    902         @extract( @$widgets['dashboard_secondary'], EXTR_SKIP );
    903         $rss = @fetch_feed( $url );
    904 
    905         if ( is_wp_error($rss) ) {
    906                 if ( is_admin() || current_user_can('manage_options') ) {
    907                         echo '<div class="rss-widget"><p>';
    908                         printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
    909                         echo '</p></div>';
    910                 }
    911         } elseif ( !$rss->get_item_quantity() ) {
    912                 $rss->__destruct();
    913                 unset($rss);
    914                 return false;
    915         } else {
     845       
     846        foreach( $widgets['dashboard_rss'] as $type => $args ) {
     847                $args['type'] = $type;
    916848                echo '<div class="rss-widget">';
    917                 wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
    918                 echo '</div>';
    919                 $rss->__destruct();
    920                 unset($rss);
     849                wp_widget_rss_output( $args['url'], $args );
     850                echo "</div>";
    921851        }
    922852}
    923853
    924 function wp_dashboard_plugins() {
    925         wp_dashboard_cached_rss_widget( 'dashboard_plugins', 'wp_dashboard_plugins_output', array(
    926                 'http://wordpress.org/plugins/rss/browse/popular/',
    927                 'http://wordpress.org/plugins/rss/browse/new/'
    928         ) );
    929 }
    930 
    931 /**
    932  * Display plugins most popular, newest plugins, and recently updated widget text.
    933  *
    934  * @since 2.5.0
    935  */
    936 function wp_dashboard_plugins_output() {
    937         $popular = fetch_feed( 'http://wordpress.org/plugins/rss/browse/popular/' );
    938         $new     = fetch_feed( 'http://wordpress.org/plugins/rss/browse/new/' );
    939 
    940         if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
    941                 $plugin_slugs = array_keys( get_plugins() );
    942                 set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS );
     854/**
     855 * Display (cached) dashboard RSS widget
     856 *
     857 * @since 3.7.0
     858 */
     859function wp_dashboard_rss() {
     860        $default_feeds = array(
     861                'news'   => array(
     862                        'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ),
     863                        'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ),
     864                        'title' => '',
     865                        'items' => 1,
     866                        'show_summary' => 1,
     867                        'show_author' => 0,
     868                        'show_date' => 1,
     869                ),
     870                'planet' => array(
     871                        'link' => apply_filters( 'dashboard_secondary_link', __( 'http://planet.wordpress.org/' ) ),
     872                        'url' => apply_filters( 'dashboard_secondary_feed', __( 'http://planet.wordpress.org/feed/' ) ),
     873                        'title' => '',
     874                        'items' => 3,
     875                        'show_summary' => 0,
     876                        'show_author' => 0,
     877                        'show_date' => 0,
     878                ),
     879                'plugins' => array(
     880                        'link' => '',
     881                        'url' => array(
     882                                'popular' => 'http://wordpress.org/plugins/rss/browse/popular/',
     883                                'new' => 'http://wordpress.org/plugins/rss/browse/new/'
     884                        ),
     885                        'title' => '',
     886                        'items' => 1,
     887                        'show_summary' => 0,
     888                        'show_author' => 0,
     889                        'show_date' => 0,
     890                )
     891        );
     892       
     893        $widget_options = get_option( 'dashboard_widget_options' );
     894       
     895        if ( !$widget_options || !is_array($widget_options) )
     896                $widget_options = array();
     897       
     898        if ( ! isset( $widget_options['dashboard_rss'] ) ) {
     899                $widget_options['dashboard_rss'] = $default_feeds;
     900                update_option( 'dashboard_widget_options', $widget_options );
    943901        }
    944 
    945         foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins') ) as $feed => $label ) {
    946                 if ( is_wp_error($$feed) || !$$feed->get_item_quantity() )
    947                         continue;
    948 
    949                 $items = $$feed->get_items(0, 5);
    950 
    951                 // Pick a random, non-installed plugin
    952                 while ( true ) {
    953                         // Abort this foreach loop iteration if there's no plugins left of this type
    954                         if ( 0 == count($items) )
    955                                 continue 2;
    956 
    957                         $item_key = array_rand($items);
    958                         $item = $items[$item_key];
    959 
    960                         list($link, $frag) = explode( '#', $item->get_link() );
    961 
    962                         $link = esc_url($link);
    963                         if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
    964                                 $slug = $matches[1];
    965                         else {
    966                                 unset( $items[$item_key] );
    967                                 continue;
    968                         }
    969 
    970                         // Is this random plugin's slug already installed? If so, try again.
    971                         reset( $plugin_slugs );
    972                         foreach ( $plugin_slugs as $plugin_slug ) {
    973                                 if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) {
    974                                         unset( $items[$item_key] );
    975                                         continue 2;
    976                                 }
    977                         }
    978 
    979                         // If we get to this point, then the random plugin isn't installed and we can stop the while().
    980                         break;
    981                 }
    982 
    983                 // Eliminate some common badly formed plugin descriptions
    984                 while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) )
    985                         unset($items[$item_key]);
    986 
    987                 if ( !isset($items[$item_key]) )
    988                         continue;
    989 
    990                 $title = esc_html( $item->get_title() );
    991 
    992                 $description = esc_html( strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'))) );
    993 
    994                 $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) .
    995                                                         '&amp;TB_iframe=true&amp;width=600&amp;height=800';
    996 
    997                 echo "<h4>$label</h4>\n";
    998                 echo "<h5><a href='$link'>$title</a></h5>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span>\n";
    999                 echo "<p>$description</p>\n";
    1000 
    1001                 $$feed->__destruct();
    1002                 unset($$feed);
     902               
     903        foreach( $default_feeds as $key => $value ) {
     904                $default_urls[] = $value['url'];
    1003905        }
     906       
     907        wp_dashboard_cached_rss_widget( 'dashboard_rss', 'wp_dashboard_rss_output', $default_urls );
    1004908}
    1005909
    1006910/**
     
    1089993        if ( !isset($widget_options[$widget_id]) )
    1090994                $widget_options[$widget_id] = array();
    1091995
    1092         $number = 1; // Hack to use wp_widget_rss_form()
    1093         $widget_options[$widget_id]['number'] = $number;
     996        if ( isset( $widget_options[$widget_id]['url'] ) ) {
     997                // Single feed
     998                $widget_options[$widget_id]['number'] = 1;
     999                wp_dashboard_rss_form_control( $widget_options[$widget_id], $form_inputs );
     1000        } else {
     1001                // Multiple feeds
     1002                foreach ( $widget_options[$widget_id] as $name => $options ) {
     1003                        $options['number'] = $name;
     1004                       
     1005                        if ( 'dashboard_rss' == $widget_id )
     1006                                $form_inputs = array( 'title' => false, 'show_summary' => false, 'show_author' => false, 'show_date' => false, 'items' => false );
     1007                       
     1008                        wp_dashboard_rss_form_control( $options, $form_inputs );
     1009                }
     1010        }
    10941011
    1095         if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) {
    1096                 $_POST['widget-rss'][$number] = wp_unslash( $_POST['widget-rss'][$number] );
    1097                 $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
    1098                 $widget_options[$widget_id]['number'] = $number;
    1099                 // title is optional. If black, fill it if possible
    1100                 if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
    1101                         $rss = fetch_feed($widget_options[$widget_id]['url']);
    1102                         if ( is_wp_error($rss) ) {
    1103                                 $widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed'));
    1104                         } else {
    1105                                 $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title()));
    1106                                 $rss->__destruct();
    1107                                 unset($rss);
     1012        if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss']) ) {
     1013
     1014                if ( isset( $widget_options[$widget_id]['url'] ) ) {
     1015                        // Single feed
     1016                        $_POST['widget-rss'][1] = wp_unslash( $_POST['widget-rss'][1] );
     1017                        $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][1] );
     1018                } else {
     1019                        // Multiple feeds
     1020                        $_POST['widget-rss'] = wp_unslash( $_POST['widget-rss'] );
     1021                        foreach ( $widget_options[$widget_id] as $name => $options ) {
     1022                                $widget_options[$widget_id][$name] = wp_widget_rss_process( $_POST['widget-rss'][$name] );
    11081023                        }
    11091024                }
    11101025                update_option( 'dashboard_widget_options', $widget_options );
    11111026                $cache_key = 'dash_' . md5( $widget_id );
    11121027                delete_transient( $cache_key );
    11131028        }
     1029}
    11141030
    1115         wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );
     1031function wp_dashboard_rss_form_control( $options, $form_inputs ) {
     1032        wp_widget_rss_form( $options, $form_inputs );
    11161033}
    11171034
    11181035/**
  • wp-admin/js/dashboard.js

     
    3030        // These widgets are sometimes populated via ajax
    3131        ajaxWidgets = [
    3232                'dashboard_incoming_links',
    33                 'dashboard_primary',
    34                 'dashboard_secondary',
    35                 'dashboard_plugins'
     33                'dashboard_rss',
    3634        ];
    3735
    3836        ajaxPopulateWidgets = function(el) {
  • wp-admin/js/plugin-install.js

     
    2727
    2828        $(window).resize(function(){ tb_position(); });
    2929
    30         $('#dashboard_plugins, .plugins').on( 'click', 'a.thickbox', function() {
     30        $('.plugins').on( 'click', 'a.thickbox', function() {
    3131                tb_click.call(this);
    3232
    3333                $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
  • wp-admin/css/ie-rtl.css

     
    8686        margin-right: 335px !important;
    8787}
    8888
    89 #dashboard_plugins {
    90         direction: ltr;
    91 }
    92 
    93 #dashboard_plugins h3.hndle {
    94         direction: rtl;
    95 }
    96 
    9789#dashboard_incoming_links ul li,
    98 #dashboard_secondary ul li,
    99 #dashboard_primary ul li,
    10090p.row-actions {
    10191        width: 100%;
    10292}
  • wp-admin/css/colors-fresh.css

     
    552552        border-color: #666;
    553553}
    554554
    555 #dashboard_secondary div.dashboard-widget-content ul li a {
    556         background-color: #f9f9f9;
    557 }
    558 
    559555input.readonly, textarea.readonly {
    560556        background-color: #ddd;
    561557}
  • wp-admin/css/wp-admin-rtl.css

     
    21302130#dashboard_right_now p.sub,
    21312131#dashboard-widgets h4,
    21322132a.rsswidget,
    2133 #dashboard_plugins h4,
    2134 #dashboard_plugins h5,
    21352133#dashboard_recent_comments .comment-meta .approve,
    21362134#dashboard_right_now td.b,
    21372135#dashboard_right_now .versions a {
     
    21672165        clear: left;
    21682166}
    21692167
    2170 #dashboard_plugins .inside span {
    2171          padding-left: 0;
    2172          padding-right: 5px;
    2173 }
    2174 
    21752168#dashboard-widgets h3 .postbox-title-action {
    21762169        right: auto;
    21772170        left: 10px;
     
    29032896.locale-he-il #dashboard_right_now p.sub,
    29042897.locale-he-il #dashboard-widgets h4,
    29052898.locale-he-il a.rsswidget,
    2906 .locale-he-il #dashboard_plugins h4,
    2907 .locale-he-il #dashboard_plugins h5,
    29082899.locale-he-il #dashboard_recent_comments .comment-meta .approve,
    29092900.locale-he-il #dashboard_right_now td.b,
    29102901.locale-he-il #dashboard_right_now .versions a,
  • wp-admin/css/wp-admin.css

     
    763763
    764764div.sidebar-name h3,
    765765#menu-management .nav-tab,
    766 #dashboard_plugins h5,
    767 a.rsswidget,
    768766#dashboard_right_now td.b,
    769767#dashboard-widgets h4,
    770768.tool-box .title,
     
    67866784        padding: 0;
    67876785}
    67886786
     6787.rss-widget {
     6788        border-bottom: 1px solid #eee;
     6789        margin-bottom: 13px;
     6790}
     6791
     6792.rss-widget:last-child {
     6793        border-bottom: none;
     6794        margin-bottom: 0;
     6795}
     6796
    67896797/* Right Now */
    67906798#dashboard_right_now p.sub,
    67916799#dashboard_right_now .table, #dashboard_right_now .versions {
     
    70877095        margin-bottom: 12px;
    70887096}
    70897097
    7090 .rss-widget span.rss-date {
     7098.rss-widget span {
    70917099        color: #999;
    70927100        font-size: 12px;
     7101}
     7102
     7103.rss-widget span.rss-date {
    70937104        margin-left: 3px;
    70947105}
    70957106
     
    71047115        content: '\2014';
    71057116}
    71067117
    7107 /* Plugins */
    7108 #dashboard_plugins h4 {
    7109         line-height: 1.7em;
    7110 }
    7111 
    7112 #dashboard_plugins h5 {
    7113         font-weight: normal;
    7114         font-size: 13px;
    7115         margin: 0;
    7116         display: inline;
    7117         line-height: 1.4em;
    7118 }
    7119 
    7120 #dashboard_plugins h5 a {
    7121         line-height: 1.4em;
    7122 }
    7123 
    7124 #dashboard_plugins .inside span {
    7125         font-size: 12px;
    7126         padding-left: 5px;
    7127 }
    7128 
    7129 #dashboard_plugins p {
    7130         margin: 0.3em 0 1.4em;
    7131         line-height: 1.4em;
    7132 }
    7133 
    71347118.dashboard-comment-wrap {
    71357119        overflow: hidden;
    71367120        word-wrap: break-word;
  • wp-admin/css/colors-classic.css

     
    550550        border-color: #666;
    551551}
    552552
    553 #dashboard_secondary div.dashboard-widget-content ul li a {
    554         background-color: #f9f9f9;
    555 }
    556 
    557553input.readonly, textarea.readonly {
    558554        background-color: #ddd;
    559555}