summaryrefslogtreecommitdiffstats
path: root/wp-admin/plugins.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-23 18:28:40 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-23 18:28:40 +0000
commit87bb8cd69cc593fe6bed330fb1791eac9df87167 (patch)
tree6b2ad252df89d2a1863198fd44b321b59e42ef54 /wp-admin/plugins.php
parent0cbda3349a2571904ea063fdd73e018299919589 (diff)
downloadwordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.tar.gz
wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.tar.xz
wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.zip
Merge with WordPress, rev 6285 and untested
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1125 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/plugins.php')
-rw-r--r--wp-admin/plugins.php35
1 files changed, 7 insertions, 28 deletions
diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php
index d2c7d48..5e7bcf2 100644
--- a/wp-admin/plugins.php
+++ b/wp-admin/plugins.php
@@ -11,22 +11,9 @@ if( $menu_perms[ 'plugins' ] != 1 )
if ( isset($_GET['action']) ) {
if ('activate' == $_GET['action']) {
check_admin_referer('activate-plugin_' . $_GET['plugin']);
- $current = get_option('active_plugins');
- $plugin = trim($_GET['plugin']);
- if ( validate_file($plugin) )
- wp_die(__('Invalid plugin.'));
- if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
- wp_die(__('Plugin file does not exist.'));
- if (!in_array($plugin, $current)) {
- wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), 'plugins.php?error=true&plugin=' . $plugin)); // we'll override this later if the plugin can be included without fatal error
- ob_start();
- @include(ABSPATH . PLUGINDIR . '/' . $plugin);
- $current[] = $plugin;
- sort($current);
- update_option('active_plugins', $current);
- do_action('activate_' . $plugin);
- ob_end_clean();
- }
+ $result = activate_plugin($_GET['plugin']);
+ if( is_wp_error( $result ) )
+ wp_die( $result->get_error_message() );
wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
} elseif ('error_scrape' == $_GET['action']) {
$plugin = trim($_GET['plugin']);
@@ -38,21 +25,11 @@ if ( isset($_GET['action']) ) {
include(ABSPATH . PLUGINDIR . '/' . $plugin);
} elseif ('deactivate' == $_GET['action']) {
check_admin_referer('deactivate-plugin_' . $_GET['plugin']);
- $current = get_option('active_plugins');
- array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu!
- update_option('active_plugins', $current);
- do_action('deactivate_' . trim( $_GET['plugin'] ));
+ deactivate_plugins($_GET['plugin']);
wp_redirect('plugins.php?deactivate=true');
} elseif ($_GET['action'] == 'deactivate-all') {
check_admin_referer('deactivate-all');
- $current = get_option('active_plugins');
-
- foreach ($current as $plugin) {
- array_splice($current, array_search($plugin, $current), 1);
- do_action('deactivate_' . $plugin);
- }
-
- update_option('active_plugins', array());
+ deactivate_all_plugins();
wp_redirect('plugins.php?deactivate-all=true');
}
exit;
@@ -153,6 +130,7 @@ if (empty($plugins)) {
if ( $style != '' )
$style = 'class="' . $style . '"';
+ $author = ( empty($plugin_data['Author']) ) ? '' : ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
echo "
<tr $style>
@@ -162,6 +140,7 @@ if (empty($plugins)) {
<td class='togl'>$toggle</td>";
echo"
</tr>";
+ do_action( 'after_plugin_row', $plugin_file );
}
?>