Plugins dashboard widget from mdawaffe. fixes #5931
git-svn-id: https://develop.svn.wordpress.org/trunk@6928 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
24a91f74e9
commit
c797fb35ff
|
@ -231,3 +231,26 @@ div.dashboard-widget-content .comment-meta {
|
||||||
#dashboard-widgets .widget_rss ul li div {
|
#dashboard-widgets .widget_rss ul li div {
|
||||||
clear: both;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -99,6 +99,54 @@ $post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] );
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
break;
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -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_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_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_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>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in New Issue