From be8d41230a7685a13703be8d45d31c62cf05c4ce Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 20 Feb 2008 03:23:34 +0000 Subject: [PATCH] Plugins dashboard widget from mdawaffe. fixes #5931 git-svn-id: http://svn.automattic.com/wordpress/trunk@6928 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/css/dashboard.css | 23 ++++++++++++++++++ wp-admin/index-extra.php | 50 +++++++++++++++++++++++++++++++++++++- wp-admin/index.php | 2 +- 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/wp-admin/css/dashboard.css b/wp-admin/css/dashboard.css index 6e08f192f..ba7895b9c 100644 --- a/wp-admin/css/dashboard.css +++ b/wp-admin/css/dashboard.css @@ -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; +} diff --git a/wp-admin/index-extra.php b/wp-admin/index-extra.php index 0842dd5fe..f032ccfde 100644 --- a/wp-admin/index-extra.php +++ b/wp-admin/index-extra.php @@ -99,6 +99,54 @@ $post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] ); __('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/'; + +?> + +

+
() + +

+ + \ No newline at end of file +?> diff --git a/wp-admin/index.php b/wp-admin/index.php index 1e382f010..445b4e089 100644 --- a/wp-admin/index.php +++ b/wp-admin/index.php @@ -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'); });