Plugins page layout improvements from DD32. see #7091

git-svn-id: http://svn.automattic.com/wordpress/trunk@8218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-06-30 23:12:18 +00:00
parent 3c6e74c8c1
commit 2ea00f0380
1 changed files with 20 additions and 10 deletions

View File

@ -2,7 +2,7 @@
require_once('admin.php'); require_once('admin.php');
$action = ''; $action = '';
foreach( array('activate-selected', 'deactivate-selected', 'delete-selected') as $action_key ) { foreach( array('activate-selected', 'deactivate-selected', 'delete-selected', 'clear-recent-list') as $action_key ) {
if( isset($_POST[$action_key]) ) { if( isset($_POST[$action_key]) ) {
$action = $action_key; $action = $action_key;
break; break;
@ -149,11 +149,13 @@ if( !empty($action) ) {
<?php <?php
require_once('admin-footer.php'); require_once('admin-footer.php');
exit; exit;
} } //Endif verify-delete
$delete_result = delete_plugins($plugins); $delete_result = delete_plugins($plugins);
wp_cache_delete('plugins', 'plugins'); wp_cache_delete('plugins', 'plugins');
break;
case 'clear-recent-list':
update_option('recently_activated', array());
break; break;
} }
} }
@ -197,8 +199,9 @@ validate_active_plugins();
<p><?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p> <p><?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p>
<?php <?php
$all_plugins = get_plugins();
$active_plugins = array(); $active_plugins = array();
$available_plugins = array(); $inactive_plugins = array();
$recent_plugins = array(); $recent_plugins = array();
$recently_activated = (array)get_option('recently_activated'); $recently_activated = (array)get_option('recently_activated');
@ -209,8 +212,6 @@ foreach( $recently_activated as $key => $time )
if( $recently_activated != get_option('recently_activated') ) //If array changed, update it. if( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
update_option('recently_activated', $recently_activated); update_option('recently_activated', $recently_activated);
$all_plugins = get_plugins();
$plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()); $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
foreach( (array)$all_plugins as $plugin_file => $plugin_data) { foreach( (array)$all_plugins as $plugin_file => $plugin_data) {
@ -223,13 +224,14 @@ foreach( (array)$all_plugins as $plugin_file => $plugin_data) {
if( ! empty($plugin_data['Author']) ) if( ! empty($plugin_data['Author']) )
$plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>'; $plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
//Filter into individual sections
if ( is_plugin_active($plugin_file) ) { if ( is_plugin_active($plugin_file) ) {
$active_plugins[ $plugin_file ] = $plugin_data; $active_plugins[ $plugin_file ] = $plugin_data;
} else { } else {
if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated? if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated?
$recent_plugins[ $plugin_file ] = $plugin_data; $recent_plugins[ $plugin_file ] = $plugin_data;
else else
$available_plugins[ $plugin_file ] = $plugin_data; $inactive_plugins[ $plugin_file ] = $plugin_data;
} }
} }
@ -289,6 +291,7 @@ function print_plugins_table($plugins, $context = '') {
} //End print_plugins_table() } //End print_plugins_table()
?> ?>
<?php if ( ! empty($active_plugins) ) : ?>
<h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3> <h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3>
<form method="post" action="<?php echo admin_url('plugins.php') ?>"> <form method="post" action="<?php echo admin_url('plugins.php') ?>">
<?php wp_nonce_field('bulk-manage-plugins') ?> <?php wp_nonce_field('bulk-manage-plugins') ?>
@ -303,9 +306,11 @@ function print_plugins_table($plugins, $context = '') {
</form> </form>
<p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR); ?></p> <p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR); ?></p>
<?php endif; ?>
<?php if ( ! empty($recent_plugins) ) : ?> <?php if ( ! empty($recent_plugins) ) : ?>
<h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3> <h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3>
<p><?php _e('The following plugins were recently active. When a plugin has been inactive for more than 7 days it will be moved to the Inactive plugin list.') ?></p>
<form method="post" action="<?php echo admin_url('plugins.php') ?>"> <form method="post" action="<?php echo admin_url('plugins.php') ?>">
<?php wp_nonce_field('bulk-manage-plugins') ?> <?php wp_nonce_field('bulk-manage-plugins') ?>
@ -315,6 +320,7 @@ function print_plugins_table($plugins, $context = '') {
<?php if( current_user_can('delete_plugins') ) : ?> <?php if( current_user_can('delete_plugins') ) : ?>
<input type="submit" name="delete-selected" value="<?php _e('Delete') ?>" class="button-secondary" /> <input type="submit" name="delete-selected" value="<?php _e('Delete') ?>" class="button-secondary" />
<?php endif; ?> <?php endif; ?>
<input type="submit" name="clear-recent-list" value="<?php _e('Clear List') ?>" class="button-secondary" />
</div> </div>
</div> </div>
<br class="clear" /> <br class="clear" />
@ -322,11 +328,11 @@ function print_plugins_table($plugins, $context = '') {
</form> </form>
<?php endif; ?> <?php endif; ?>
<h3 id="available-plugins"><?php _e('Available Plugins') ?></h3> <?php if ( ! empty($inactive_plugins) ) : ?>
<h3 id="inactive-plugins"><?php _e('Inactive Plugins') ?></h3>
<form method="post" action="<?php echo admin_url('plugins.php') ?>"> <form method="post" action="<?php echo admin_url('plugins.php') ?>">
<?php wp_nonce_field('bulk-manage-plugins') ?> <?php wp_nonce_field('bulk-manage-plugins') ?>
<?php if ( ! empty($available_plugins) ) : ?>
<div class="tablenav"> <div class="tablenav">
<div class="alignleft"> <div class="alignleft">
<input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" /> <input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" />
@ -336,10 +342,14 @@ function print_plugins_table($plugins, $context = '') {
</div> </div>
</div> </div>
<br class="clear" /> <br class="clear" />
<?php print_plugins_table($available_plugins, 'available') ?> <?php print_plugins_table($inactive_plugins, 'inactive') ?>
</form> </form>
<?php endif; ?> <?php endif; ?>
<?php if ( empty($all_plugins) ) : ?>
<p><?php _e('You do not appear to have any plugins available at this time.') ?></p>
<?php endif; ?>
<h2><?php _e('Get More Plugins'); ?></h2> <h2><?php _e('Get More Plugins'); ?></h2>
<p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>.'); ?></p> <p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>.'); ?></p>
<p><?php printf(__('To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.'), WP_PLUGIN_DIR); ?></p> <p><?php printf(__('To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.'), WP_PLUGIN_DIR); ?></p>