Make WordPress Core

Changeset 8049


Ignore:
Timestamp:
06/04/2008 06:09:31 PM (17 years ago)
Author:
ryan
Message:

Bulk delete/activate/deactivate for plugins. Split plugins into active and available lists. Props DD32. see #7091

Location:
trunk/wp-admin
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/colors-classic.css

    r8013 r8049  
    416416}
    417417
    418 #plugins .active {
     418.plugins .active {
    419419    background-color: #BBEEBB;
    420420}
    421421
    422 #plugins .togl {
     422.plugins .togl {
    423423    border-right-color: #ccc;
    424424}
     
    428428}
    429429
    430 #plugins tr {
     430.plugins tr {
    431431    background-color: #fff;
    432432}
  • trunk/wp-admin/css/colors-fresh.css

    r8013 r8049  
    385385}
    386386
    387 #plugins .active {
     387.plugins .active {
    388388    background-color: #e7f7d3;
    389389}
    390390
    391 #plugins .togl {
     391.plugins .togl {
    392392    border-right-color: #ccc;
    393393}
     
    397397}
    398398
    399 #plugins tr {
     399.plugins tr {
    400400    background-color: #fff;
    401401}
  • trunk/wp-admin/includes/plugin.php

    r7999 r8049  
    133133}
    134134
    135 function deactivate_all_plugins() {
    136     $current = get_option('active_plugins');
    137     if ( empty($current) )
    138         return;
    139 
    140     deactivate_plugins($current);
    141 
    142     update_option('deactivated_plugins', $current);
    143 }
    144 
    145 function reactivate_all_plugins($redirect = '') {
    146     $plugins = get_option('deactivated_plugins');
    147 
    148     if ( empty($plugins) )
    149         return;
    150 
    151     if ( !empty($redirect) )
    152         wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
     135//Replaces reactivate_all_plugins() / deactivate_all_plugins()  = 'deactivated_plugins' is now useless
     136function activate_plugins($plugins, $redirect = '') {
     137    if ( !is_array($plugins) )
     138        $plugins = array($plugins);
    153139
    154140    $errors = array();
    155141    foreach ( (array) $plugins as $plugin ) {
    156         $result = activate_plugin($plugin);
     142        if ( !empty($redirect) )
     143            $redirect = add_query_arg('plugin', $plugin, $redirect);
     144        $result = activate_plugin($plugin, $redirect);
    157145        if ( is_wp_error($result) )
    158146            $errors[$plugin] = $result;
    159147    }
    160148
    161     delete_option('deactivated_plugins');
    162 
    163149    if ( !empty($errors) )
    164150        return new WP_Error('plugins_invalid', __('One of the plugins is invalid.'), $errors);
    165151
     152    return true;
     153}
     154
     155function delete_plugins($plugins, $redirect = '' ) {
     156    global $wp_filesystem;
     157
     158    if( empty($plugins) )
     159        return false;
     160
     161    $checked = array();
     162    foreach( $plugins as $plugin )
     163        $checked[] = 'checked[]=' . $plugin;
     164
     165    ob_start();
     166    $url = wp_nonce_url('plugins.php?action=delete-selected&' . implode('&', $checked), 'mass-manage-plugins');
     167    if ( false === ($credentials = request_filesystem_credentials($url)) ) {
     168        $data = ob_get_contents();
     169        ob_end_clean();
     170        if( ! empty($data) ){
     171            include_once( ABSPATH . 'wp-admin/admin-header.php');
     172            echo $data;
     173            include( ABSPATH . 'wp-admin/admin-footer.php');
     174            exit;
     175        }
     176        return;
     177    }
     178
     179    if ( ! WP_Filesystem($credentials) ) {
     180        request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
     181        $data = ob_get_contents();
     182        ob_end_clean();
     183        if( ! empty($data) ){
     184            include_once( ABSPATH . 'wp-admin/admin-header.php');
     185            echo $data;
     186            include( ABSPATH . 'wp-admin/admin-footer.php');
     187            exit;
     188        }
     189        return;
     190    }
     191
     192    if ( $wp_filesystem->errors->get_error_code() ) {
     193        return $wp_filesystem->errors;
     194    }
     195
     196    if ( ! is_object($wp_filesystem) )
     197        return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
     198
     199    if ( $wp_filesystem->errors->get_error_code() )
     200        return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
     201
     202    //Get the base plugin folder
     203    $plugins_dir = $wp_filesystem->wp_plugins_dir();
     204    if ( empty($plugins_dir) )
     205        return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));
     206   
     207    $plugins_dir = trailingslashit( $plugins_dir );
     208
     209    $errors = array();
     210
     211    foreach( $plugins as $plugin_file ) {
     212        $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin_file) );
     213        // If plugin is in its own directory, recursively delete the directory.
     214        if ( strpos($plugin_file, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
     215            $deleted = $wp_filesystem->delete($this_plugin_dir, true);
     216        else
     217            $deleted = $wp_filesystem->delete($plugins_dir . $plugin_file);
     218   
     219        if ( ! $deleted )
     220            $errors[] = $plugin_file;
     221    }
     222   
     223    if( ! empty($errors) )
     224        return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s'), implode(', ', $errors)) );
     225   
    166226    return true;
    167227}
  • trunk/wp-admin/includes/update.php

    r8010 r8049  
    119119add_action( 'load-plugins.php', 'wp_update_plugins' );
    120120
    121 function wp_plugin_update_row( $file ) {
    122     global $plugin_data;
     121function wp_plugin_update_row( $file, $plugin_data ) {
    123122    $current = get_option( 'update_plugins' );
    124123    if ( !isset( $current->response[ $file ] ) )
     
    127126    $r = $current->response[ $file ];
    128127
    129     echo "<tr><td colspan='5' class='plugin-update'>";
     128    echo '<tr><td colspan="5" class="plugin-update">';
    130129    if ( !current_user_can('edit_plugins') )
    131130        printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a>.'), $plugin_data['Name'], $r->url, $r->new_version);
     
    133132        printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> <em>automatic upgrade unavailable for this plugin</em>.'), $plugin_data['Name'], $r->url, $r->new_version);
    134133    else
    135         printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url("update.php?action=upgrade-plugin&amp;plugin=$file", 'upgrade-plugin_' . $file) );
    136    
    137     echo "</td></tr>";
    138 }
    139 add_action( 'after_plugin_row', 'wp_plugin_update_row' );
     134        printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url('update.php?action=upgrade-plugin&amp;plugin=' . $file, 'upgrade-plugin_' . $file) );
     135   
     136    echo '</td></tr>';
     137}
     138add_action( 'after_plugin_row', 'wp_plugin_update_row', 10, 2 );
    140139
    141140function wp_update_plugin($plugin, $feedback = '') {
  • trunk/wp-admin/menu-header.php

    r7999 r8049  
    22$self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
    33$self = preg_replace('|^.*/plugins/|i', '', $self);
     4
     5global $menu, $submenu, $parent_file; //For when admin-header is included from within a function.
    46
    57get_admin_page_parent();
  • trunk/wp-admin/plugins.php

    r7999 r8049  
    22require_once('admin.php');
    33
    4 if ( isset($_GET['action']) ) {
    5     if ( isset($_GET['plugin']) )
    6         $plugin = trim($_GET['plugin']);
    7 
    8     if ( 'activate' == $_GET['action'] ) {
    9         check_admin_referer('activate-plugin_' . $_GET['plugin']);
    10         $result = activate_plugin($_GET['plugin'], 'plugins.php?error=true&plugin=' . $plugin);
    11         if ( is_wp_error( $result ) )
    12             wp_die( $result->get_error_message() );
    13         wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
    14     } elseif ( 'error_scrape' == $_GET['action'] ) {
    15         check_admin_referer('plugin-activation-error_' . $plugin);
    16         $valid = validate_plugin($plugin);
    17         if ( is_wp_error($valid) )
    18             wp_die($valid);
    19         error_reporting( E_ALL ^ E_NOTICE );
    20         @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
    21         include(WP_PLUGIN_DIR . '/' . $plugin);
    22     } elseif ( 'deactivate' == $_GET['action'] ) {
    23         check_admin_referer('deactivate-plugin_' . $_GET['plugin']);
    24         deactivate_plugins($_GET['plugin']);
    25         wp_redirect('plugins.php?deactivate=true');
    26     } elseif ( 'deactivate-all' == $_GET['action'] ) {
    27         check_admin_referer('deactivate-all');
    28         deactivate_all_plugins();
    29         wp_redirect('plugins.php?deactivate-all=true');
    30     } elseif ('reactivate-all' == $_GET['action']) {
    31         check_admin_referer('reactivate-all');
    32         reactivate_all_plugins('plugins.php?errors=true');
    33         wp_redirect('plugins.php?reactivate-all=true'); // overrides the ?error=true one above
    34     }
    35 
    36     exit;
     4$action = '';
     5foreach( array('activate-selected', 'deactivate-selected', 'delete-selected') as $action_key ) {
     6    if( isset($_POST[$action_key]) ) {
     7        $action = $action_key;
     8        break;
     9    }
    3710}
     11
     12if( isset($_GET['action']) )
     13    $action = $_GET['action'];
     14
     15$plugin = $_REQUEST['plugin'];
     16
     17if( !empty($action) ) {
     18    switch( $action ) {
     19        case 'activate':
     20            check_admin_referer('activate-plugin_' . $plugin);
     21            $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin);
     22            if ( is_wp_error( $result ) )
     23                wp_die( $result->get_error_message() );
     24            $recent = (array)get_option('recently_activated');
     25            if( isset($recent[ $plugin ]) ){
     26                unset($recent[ $plugin ]);
     27                update_option('recently_activated', $recent);
     28            }
     29            wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
     30            exit;
     31            break;
     32        case 'activate-selected':
     33            check_admin_referer('mass-manage-plugins');
     34            activate_plugins($_POST['checked'], 'plugins.php?error=true');
     35
     36            $recent = (array)get_option('recently_activated');
     37            foreach( (array)$_POST['checked'] as $plugin => $time) {
     38                if( isset($recent[ $plugin ]) )
     39                    unset($recent[ $plugin ]);
     40            }
     41            if( $recent != get_option('recently_activated') ) //If array changed, update it.
     42                update_option('recently_activated', $recent);
     43
     44            wp_redirect('plugins.php?activate-multi=true');
     45            exit;
     46            break;
     47        case 'error_scrape':
     48            check_admin_referer('plugin-activation-error_' . $plugin);
     49            $valid = validate_plugin($plugin);
     50            if ( is_wp_error($valid) )
     51                wp_die($valid);
     52            error_reporting( E_ALL ^ E_NOTICE );
     53            @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
     54            include(WP_PLUGIN_DIR . '/' . $plugin);
     55            exit;
     56            break;
     57        case 'deactivate':
     58            check_admin_referer('deactivate-plugin_' . $plugin);
     59            deactivate_plugins($plugin);
     60            update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
     61            wp_redirect('plugins.php?deactivate=true');
     62            exit;
     63            break;
     64        case 'deactivate-selected':
     65            check_admin_referer('mass-manage-plugins');
     66            deactivate_plugins($_POST['checked']);
     67            $deactivated = array();
     68            foreach( (array)$_POST['checked'] as $plugin )
     69                $deactivated[ $plugin ] = time();
     70            update_option('recently_activated', $deactivated + (array)get_option('recently_activated'));
     71            wp_redirect('plugins.php?deactivate-multi=true');
     72            exit;
     73            break;
     74        case 'delete-selected':
     75            check_admin_referer('mass-manage-plugins');
     76            $plugins = $_REQUEST['checked'];
     77            include(ABSPATH . 'wp-admin/update.php');
     78
     79            $title = __('Delete Plugin');
     80            $parent_file = 'plugins.php';
     81
     82            $delete_result = delete_plugins($plugins);
     83           
     84            //HACK TIME!
     85            // Proper way needed, perhaps get_plugins() to convert to wp_cache_get() any reason why it hasnt allready?
     86            // This clears the cached plugin list
     87            global $wp_plugins;
     88            $wp_plugins = null;
     89           
     90           
     91               
     92            //TODO: Implement!.. STAT!
     93            break;
     94        default:
     95            var_dump("Unknown Action $action");
     96    }
     97}
     98
     99wp_enqueue_script('admin-forms');
    38100
    39101$title = __('Manage Plugins');
     
    47109    <div id="message" class="updated fade"><p><?php _e('Plugin could not be activated because it triggered a <strong>fatal error</strong>.') ?></p>
    48110    <?php
    49         $plugin = trim($_GET['plugin']);
    50111        if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
    51     <iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&amp;plugin=<?php echo attribute_escape($plugin); ?>&amp;_wpnonce=<?php echo attribute_escape($_GET['_error_nonce']); ?>"></iframe>
     112    <iframe style="border:0" width="100%" height="70px" src="<?php echo admin_url('plugins.php?action=error_scrape&amp;plugin=' . attribute_escape($plugin) . '&amp;_wpnonce=' . attribute_escape($_GET['_error_nonce'])); ?>"></iframe>
    52113    <?php
    53114        }
    54115    ?>
    55116    </div>
    56 <?php elseif ( isset($_GET['errors']) ) : ?>
    57     <div id="message" class="updated fade"><p><?php _e('Some plugins could not be reactivated because they triggered a <strong>fatal error</strong>.') ?></p></div>
     117<?php elseif ( 'delete-selected' == $action ) :
     118        if ( is_wp_error($delete_result) ) : ?>
     119        <div id="message" class="updated fade"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
     120        <?php else : ?>
     121        <div id="message" class="updated fade"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div>
     122        <?php endif; ?>
    58123<?php elseif ( isset($_GET['activate']) ) : ?>
    59124    <div id="message" class="updated fade"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
     125<?php elseif (isset($_GET['activate-multi'])) : ?>
     126    <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div>
    60127<?php elseif ( isset($_GET['deactivate']) ) : ?>
    61128    <div id="message" class="updated fade"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
    62 <?php elseif (isset($_GET['deactivate-all'])) : ?>
    63     <div id="message" class="updated fade"><p><?php _e('All plugins <strong>deactivated</strong>.'); ?></p></div>
    64 <?php elseif (isset($_GET['reactivate-all'])) : ?>
    65     <div id="message" class="updated fade"><p><?php _e('Plugins <strong>reactivated</strong>.'); ?></p></div>
     129<?php elseif (isset($_GET['deactivate-multi'])) : ?>
     130    <div id="message" class="updated fade"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div>
    66131<?php endif; ?>
    67132
     
    71136<?php
    72137
    73 $plugins = get_plugins();
    74 
    75 if (empty($plugins)) {
    76     echo '<p>';
    77     _e("Couldn&#8217;t open plugins directory or there are no plugins available."); // TODO: make more helpful
    78     echo '</p>';
    79 } else {
    80 ?>
     138$active_plugins = array();
     139$available_plugins = array();
     140$recent_plugins = array();
     141$recently_activated = (array)get_option('recently_activated');
     142
     143//Clean out any plugins which were deactivated over a week ago.
     144foreach( $recently_activated as $key => $time )
     145    if( $time + (7*24*60*60) < time() ) //1 week
     146        unset($recently_activated[ $key ]);
     147if( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
     148    update_option('recently_activated', $recently_activated);
     149
     150$all_plugins = get_plugins();
     151
     152$plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
     153
     154foreach( (array)$all_plugins as $plugin_file => $plugin_data) {
     155
     156    // Sanitize all displayed data
     157    $plugin_data['Title']       = wp_kses($plugin_data['Title'], $plugins_allowedtags);
     158    $plugin_data['Version']     = wp_kses($plugin_data['Version'], $plugins_allowedtags);
     159    $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags);
     160    $plugin_data['Author']      = wp_kses($plugin_data['Author'], $plugins_allowedtags);
     161    if( ! empty($plugin_data['Author']) )
     162        $plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
     163
     164    if ( is_plugin_active($plugin_file) ) {
     165        $active_plugins[ $plugin_file ] = $plugin_data;
     166    } else {
     167        if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated?
     168            $recent_plugins[ $plugin_file ] = $plugin_data;
     169        else
     170            $available_plugins[ $plugin_file ] = $plugin_data;
     171    }
     172}
     173
     174?>
     175
     176<?php
     177function print_plugins_table($plugins, $context = '') {
     178?>
     179<table class="widefat" id="<?php echo $context ?>-plugins-table">
     180    <thead>
     181    <tr>
     182        <th scope="col" class="check-column"><input type="checkbox" /></th>
     183        <th scope="col"><?php _e('Plugin'); ?></th>
     184        <th scope="col" class="num"><?php _e('Version'); ?></th>
     185        <th scope="col"><?php _e('Description'); ?></th>
     186        <th scope="col" class="action-links"><?php _e('Action'); ?></th>
     187    </tr>
     188    </thead>
     189    <tbody class="plugins">
     190<?php
     191
     192    if( empty($plugins) ) {
     193        echo '<tr>
     194            <td colspan="6">' . __('No plugins to show') . '</td>
     195        </tr>';
     196    }
     197    foreach( (array)$plugins as $plugin_file => $plugin_data) {
     198        $action_links = array();
     199
     200        if( 'active' == $context )
     201            $action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '" class="delete">' . __('Deactivate') . '</a>';
     202        else //Available or Recently deactivated
     203            $action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
     204
     205        if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
     206            $action_links[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
     207
     208        $action_links = apply_filters('plugin_action_links', $action_links, $plugin_file, $plugin_data, $context);
     209
     210        echo "
     211    <tr class='$context'>
     212        <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . attribute_escape($plugin_file) . "' /></th>
     213        <td class='name'>{$plugin_data['Title']}</td>
     214        <td class='vers'>{$plugin_data['Version']}</td>
     215        <td class='desc'><p>{$plugin_data['Description']}</p></td>
     216        <td class='togl action-links'>"; 
     217        if ( !empty($action_links) )
     218            echo implode(' | ', $action_links);
     219        echo '</td>
     220    </tr>';
     221        do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
     222    }
     223?>
     224    </tbody>
     225</table>
     226<?php
     227} //End print_plugins_table()
     228?>
     229
     230<h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3>
     231<form method="post" action="<?php echo admin_url('plugins.php') ?>">
     232<?php wp_nonce_field('mass-manage-plugins') ?>
    81233
    82234<div class="tablenav">
    83235    <div class="alignleft">
    84     <?php
    85     $active = get_option('active_plugins');
    86     $inactive = get_option('deactivated_plugins');
    87     if ( !empty($active) ) {
    88     ?>
    89     <a class="button-secondary delete" href="<?php echo wp_nonce_url('plugins.php?action=deactivate-all', 'deactivate-all'); ?>"><?php _e('Deactivate All Plugins'); ?></a>
    90     <?php
    91     } elseif ( empty($active) && !empty($inactive) ) {
    92     ?>
    93     <a class="button-secondary delete" href="<?php echo wp_nonce_url('plugins.php?action=reactivate-all', 'reactivate-all'); ?>"><?php _e('Reactivate Plugins'); ?></a>
    94     <?php
    95     } // endif active/inactive plugin check
    96     ?>
    97     </div>
    98     <br class="clear" />
    99 </div>
    100 
     236        <input type="submit" name="deactivate-selected" value="<?php _e('Deactivate') ?>" class="button-secondary" />
     237    </div>
     238</div>
    101239<br class="clear" />
    102 
    103 <table class="widefat">
    104     <thead>
    105     <tr>
    106         <th><?php _e('Plugin'); ?></th>
    107         <th class="num"><?php _e('Version'); ?></th>
    108         <th><?php _e('Description'); ?></th>
    109         <th class="status"><?php _e('Status') ?></th>
    110         <th class="action-links"><?php _e('Action'); ?></th>
    111     </tr>
    112     </thead>
    113     <tbody id="plugins">
    114 <?php
    115     foreach($plugins as $plugin_file => $plugin_data) {
    116         $action_links = array();
    117        
    118         $style = '';
    119 
    120         if ( is_plugin_active($plugin_file) ) {
    121             $action_links[] = "<a href='" . wp_nonce_url("plugins.php?action=deactivate&amp;plugin=$plugin_file", 'deactivate-plugin_' . $plugin_file) . "' title='".__('Deactivate this plugin')."' class='delete'>".__('Deactivate')."</a>";
    122             $style = 'active';
    123         } else {
    124             $action_links[] = "<a href='" . wp_nonce_url("plugins.php?action=activate&amp;plugin=$plugin_file", 'activate-plugin_' . $plugin_file) . "' title='".__('Activate this plugin')."' class='edit'>".__('Activate')."</a>";
    125         }
    126         if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
    127             $action_links[] = "<a href='plugin-editor.php?file=$plugin_file' title='".__('Open this file in the Plugin Editor')."' class='edit'>".__('Edit')."</a>";
    128 
    129         $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
    130 
    131         // Sanitize all displayed data
    132         $plugin_data['Title']       = wp_kses($plugin_data['Title'], $plugins_allowedtags);
    133         $plugin_data['Version']     = wp_kses($plugin_data['Version'], $plugins_allowedtags);
    134         $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags);
    135         $plugin_data['Author']      = wp_kses($plugin_data['Author'], $plugins_allowedtags);
    136         $author = ( empty($plugin_data['Author']) ) ? '' :  ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
    137 
    138         if ( $style != '' )
    139             $style = ' class="' . $style . '"';
    140 
    141         $action_links = apply_filters('plugin_action_links', $action_links, $plugin_file, $plugin_info);
    142 
    143         echo "
    144     <tr$style>
    145         <td class='name'>{$plugin_data['Title']}</td>
    146         <td class='vers'>{$plugin_data['Version']}</td>
    147         <td class='desc'><p>{$plugin_data['Description']}$author</p></td>
    148         <td class='status'>";
    149         if ( is_plugin_active($plugin_file) )
    150             echo  __('<span class="active">Active</span>');
    151         else
    152             _e('<span class="inactive">Inactive</span>');
    153         echo "</td>
    154         <td class='togl action-links'>$toggle"; 
    155         if ( !empty($action_links) )
    156             echo implode(' | ', $action_links);
    157         echo "</td>
    158     </tr>";
    159     do_action( 'after_plugin_row', $plugin_file );
    160     }
    161 ?>
    162     </tbody>
    163 </table>
    164 
    165 <?php
    166 }
    167 ?>
     240<?php print_plugins_table($active_plugins, 'active') ?>
     241</form>
    168242
    169243<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>
     244
     245<?php if ( ! empty($recent_plugins) ) : ?>
     246<h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3>
     247<form method="post" action="<?php echo admin_url('plugins.php') ?>">
     248<?php wp_nonce_field('mass-manage-plugins') ?>
     249
     250<div class="tablenav">
     251    <div class="alignleft">
     252        <input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" />
     253<?php if( current_user_can('edit_plugins') ) : ?>
     254        <input type="submit" name="delete-selected" value="<?php _e('Delete') ?>" class="button-secondary" />
     255<?php endif; ?>
     256    </div>
     257</div>
     258<br class="clear" />
     259<?php print_plugins_table($recent_plugins, 'recent') ?>
     260</form>
     261<?php endif; ?>
     262
     263<h3 id="available-plugins"><?php _e('Available Plugins') ?></h3>
     264<form method="post" action="<?php echo admin_url('plugins.php') ?>">
     265<?php wp_nonce_field('mass-manage-plugins') ?>
     266
     267<div class="tablenav">
     268    <div class="alignleft">
     269        <input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" />
     270<?php if( current_user_can('edit_plugins') ) : ?>
     271        <input type="submit" name="delete-selected" value="<?php _e('Delete') ?>" class="button-secondary" />
     272<?php endif; ?>
     273    </div>
     274</div>
     275<br class="clear" />
     276<?php print_plugins_table($available_plugins, 'available') ?>
     277</form>
    170278
    171279<h2><?php _e('Get More Plugins'); ?></h2>
  • trunk/wp-admin/wp-admin.css

    r8015 r8049  
    1 #plugins .name {
     1.plugins .name {
    22    font-weight: bold;
    33}
    44
    5 #plugins p {
     5.plugins p {
    66    margin: 0 4px;
    77    padding: 0;
    88}
    99
    10 #plugins .togl {
     10.plugins .togl {
    1111    width: 150px;
    1212    border-right-width: 1px;
Note: See TracChangeset for help on using the changeset viewer.