Make WordPress Core

Changeset 6928


Ignore:
Timestamp:
02/20/2008 03:23:34 AM (18 years ago)
Author:
ryan
Message:

Plugins dashboard widget from mdawaffe. fixes #5931

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/dashboard.css

    r6917 r6928  
    232232    clear: both;
    233233}
     234
     235#dashboard_primary a.rsswidget, #dashboard_plugins h5 {
     236    font-size: 1.2em;
     237}
     238
     239#dashboard_primary span.rss-date {
     240    font-size: 1.2em;
     241    color: #999;
     242}
     243
     244#dashboard_plugins h4 {
     245    font-size: 1em;
     246    margin: 0 0 .7em;
     247}
     248
     249#dashboard_plugins h5 {
     250    margin: 0;
     251    display: inline;
     252}
     253
     254#dashboard_plugins p {
     255    margin: 0 0 1em;
     256}
  • trunk/wp-admin/index-extra.php

    r6810 r6928  
    100100}
    101101break;
     102
     103case 'plugins' :
     104$popular = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/popular/' );
     105$new     = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/new/' );
     106$updated = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/updated/' );
     107
     108foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) :
     109    if ( !isset($$feed->items) || 0 == count($$feed->items) )
     110        continue;
     111
     112    $$feed->items = array_slice($$feed->items, 0, 5);
     113    $item_key = array_rand($$feed->items);
     114
     115    // Eliminate some common badly formed plugin descriptions
     116    while ( ( null !== $item_key = array_rand($$feed->items) ) && false !== strpos( $$feed->items[$item_key]['description'], 'Plugin Name:' ) )
     117        unset($$feed->items[$item_key]);
     118
     119    if ( !isset($$feed->items[$item_key]) )
     120        continue;
     121
     122    $item = $$feed->items[$item_key];
     123
     124    // current bbPress feed item titles are: user on "topic title"
     125    if ( preg_match( '/"(.*)"/s', $item['title'], $matches ) )
     126        $title = $matches[1];
     127    else // but let's make it forward compatible if things change
     128        $title = $item['title'];
     129    $title = wp_specialchars( $title );
     130
     131    $description = wp_specialchars( strip_tags(html_entity_decode($item['description'], ENT_QUOTES)) );
     132
     133    list($link, $frag) = explode( '#', $item['link'] );
     134
     135    $link = clean_url($link);
     136    $dlink = rtrim($link, '/') . '/download/';
     137
     138?>
     139
     140<h4><?php echo $label; ?></h4>
     141<h5><a href="<?php echo $link; ?>"><?php echo $title; ?></a></h5> <span>(<a href="<?php echo $dlink; ?>"><?php _e( 'Download' ); ?></a>)</span>
     142
     143<p><?php echo $description; ?></p>
     144
     145<?php
     146
     147endforeach;
     148break;
     149
    102150}
    103151
  • trunk/wp-admin/index.php

    r6913 r6928  
    1414        jQuery('#dashboard_primary div.dashboard-widget-content').not( '.dashboard-widget-control' ).load('index-extra.php?jax=devnews');
    1515        jQuery('#dashboard_secondary div.dashboard-widget-content').not( '.dashboard-widget-control' ).load('index-extra.php?jax=planetnews');
    16         jQuery('#dashboard_plugins div.dashboard-widget-content').not( '.dashboard-widget-control' ).html( 'TODO' );
     16        jQuery('#dashboard_plugins div.dashboard-widget-content').not( '.dashboard-widget-control' ).load('index-extra.php?jax=plugins');
    1717    });
    1818</script>
Note: See TracChangeset for help on using the changeset viewer.