Make WordPress Core

Ticket #19239: 19239.3.2.diff

File 19239.3.2.diff, 12.2 KB (added by lessbloat, 11 years ago)
  • 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();
    214                         break;
    215                 case 'dashboard_secondary' :
    216                         wp_dashboard_secondary();
    217                         break;
    218                 case 'dashboard_plugins' :
    219                         wp_dashboard_plugins();
    220                         break;
    221212        }
    222213        wp_die();
    223214}
  • 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' );
     
    8278        if ( is_blog_admin() && current_user_can('edit_posts') )
    8379                wp_add_dashboard_widget( 'dashboard_recent_drafts', __('Recent Drafts'), 'wp_dashboard_recent_drafts' );
    8480
    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 
    11581        // Hook to register new widgets
    11682        // Filter widget order
    11783        if ( is_network_admin() ) {
     
    163129        }
    164130
    165131        if ( is_blog_admin () )
    166                 $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
     132                $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts'); /* Needs new RSS widget added */
    167133        else if (is_network_admin() )
    168                 $side_widgets = array('dashboard_primary', 'dashboard_secondary');
     134                $side_widgets = array(); /* Needs new RSS widget added */
    169135        else
    170136                $side_widgets = array();
    171137
     
    860826        wp_dashboard_rss_control( 'dashboard_incoming_links', array( 'title' => false, 'show_summary' => false, 'show_author' => false ) );
    861827}
    862828
    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 
    871829/**
    872  * Display primary dashboard RSS widget feed.
    873  *
    874  * @since 2.5.0
    875  *
    876  * @param string $widget_id
    877  */
    878 function wp_dashboard_rss_output( $widget_id ) {
    879         $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 {
    916                 echo '<div class="rss-widget">';
    917                 wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
    918                 echo '</div>';
    919                 $rss->__destruct();
    920                 unset($rss);
    921         }
    922 }
    923 
    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 );
    943         }
    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);
    1003         }
    1004 }
    1005 
    1006 /**
    1007830 * Checks to see if all of the feed url in $check_urls are cached.
    1008831 *
    1009832 * If $check_urls is empty, look for the rss feed url found in the dashboard
  • wp-admin/js/dashboard.js

     
    2929
    3030        // These widgets are sometimes populated via ajax
    3131        ajaxWidgets = [
    32                 'dashboard_incoming_links',
    33                 'dashboard_primary',
    34                 'dashboard_secondary',
    35                 'dashboard_plugins'
     32                'dashboard_incoming_links'
    3633        ];
    3734
    3835        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,
    767766a.rsswidget,
    768767#dashboard_right_now td.b,
    769768#dashboard-widgets h4,
     
    71047103        content: '\2014';
    71057104}
    71067105
    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 
    71347106.dashboard-comment-wrap {
    71357107        overflow: hidden;
    71367108        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}