Plugins dashboard widget from mdawaffe. fixes #5931

git-svn-id: http://svn.automattic.com/wordpress/trunk@6928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-02-20 03:23:34 +00:00
parent 4da577f121
commit be8d41230a
3 changed files with 73 additions and 2 deletions

View File

@ -231,3 +231,26 @@ div.dashboard-widget-content .comment-meta {
#dashboard-widgets .widget_rss ul li div {
clear: both;
}
#dashboard_primary a.rsswidget, #dashboard_plugins h5 {
font-size: 1.2em;
}
#dashboard_primary span.rss-date {
font-size: 1.2em;
color: #999;
}
#dashboard_plugins h4 {
font-size: 1em;
margin: 0 0 .7em;
}
#dashboard_plugins h5 {
margin: 0;
display: inline;
}
#dashboard_plugins p {
margin: 0 0 1em;
}

View File

@ -99,6 +99,54 @@ $post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] );
<?php
}
break;
case 'plugins' :
$popular = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/popular/' );
$new = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/new/' );
$updated = @fetch_rss( 'http://wordpress.org/extend/plugins/rss/browse/updated/' );
foreach ( array( 'popular' => __('Most Popular'), 'new' => __('Newest Plugins'), 'updated' => __('Recently Updated') ) as $feed => $label ) :
if ( !isset($$feed->items) || 0 == count($$feed->items) )
continue;
$$feed->items = array_slice($$feed->items, 0, 5);
$item_key = array_rand($$feed->items);
// Eliminate some common badly formed plugin descriptions
while ( ( null !== $item_key = array_rand($$feed->items) ) && false !== strpos( $$feed->items[$item_key]['description'], 'Plugin Name:' ) )
unset($$feed->items[$item_key]);
if ( !isset($$feed->items[$item_key]) )
continue;
$item = $$feed->items[$item_key];
// current bbPress feed item titles are: user on "topic title"
if ( preg_match( '/"(.*)"/s', $item['title'], $matches ) )
$title = $matches[1];
else // but let's make it forward compatible if things change
$title = $item['title'];
$title = wp_specialchars( $title );
$description = wp_specialchars( strip_tags(html_entity_decode($item['description'], ENT_QUOTES)) );
list($link, $frag) = explode( '#', $item['link'] );
$link = clean_url($link);
$dlink = rtrim($link, '/') . '/download/';
?>
<h4><?php echo $label; ?></h4>
<h5><a href="<?php echo $link; ?>"><?php echo $title; ?></a></h5> <span>(<a href="<?php echo $dlink; ?>"><?php _e( 'Download' ); ?></a>)</span>
<p><?php echo $description; ?></p>
<?php
endforeach;
break;
}
?>
?>

View File

@ -13,7 +13,7 @@ function index_js() {
jQuery('#dashboard_incoming_links div.dashboard-widget-content').not( '.dashboard-widget-control' ).load('index-extra.php?jax=incominglinks');
jQuery('#dashboard_primary div.dashboard-widget-content').not( '.dashboard-widget-control' ).load('index-extra.php?jax=devnews');
jQuery('#dashboard_secondary div.dashboard-widget-content').not( '.dashboard-widget-control' ).load('index-extra.php?jax=planetnews');
jQuery('#dashboard_plugins div.dashboard-widget-content').not( '.dashboard-widget-control' ).html( 'TODO' );
jQuery('#dashboard_plugins div.dashboard-widget-content').not( '.dashboard-widget-control' ).load('index-extra.php?jax=plugins');
});
</script>
<?php