/** WordPress Administration Bootstrap */
require_once('admin.php');
+if ( ! current_user_can('activate_plugins') )
+ wp_die(__('You do not have sufficient permissions to manage plugins for this blog.'));
+
if ( isset($_POST['clear-recent-list']) )
$action = 'clear-recent-list';
elseif ( !empty($_REQUEST['action']) )
if ( !empty($action) ) {
switch ( $action ) {
case 'activate':
+ if ( ! current_user_can('activate_plugins') )
+ wp_die(__('You do not have sufficient permissions to activate plugins for this blog.'));
+
check_admin_referer('activate-plugin_' . $plugin);
$result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin);
exit;
break;
case 'activate-selected':
+ if ( ! current_user_can('activate_plugins') )
+ wp_die(__('You do not have sufficient permissions to activate plugins for this blog.'));
+
check_admin_referer('bulk-manage-plugins');
- $plugins = (array) $_POST['checked'];
+ $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
$plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); //Only activate plugins which are not already active.
if ( empty($plugins) ) {
wp_redirect("plugins.php?plugin_status=$status&paged=$page");
exit;
break;
case 'error_scrape':
+ if ( ! current_user_can('activate_plugins') )
+ wp_die(__('You do not have sufficient permissions to activate plugins for this blog.'));
+
check_admin_referer('plugin-activation-error_' . $plugin);
$valid = validate_plugin($plugin);
if ( is_wp_error($valid) )
wp_die($valid);
- error_reporting( E_ALL ^ E_NOTICE );
+ if ( defined('E_RECOVERABLE_ERROR') )
+ error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
+ else
+ error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);
+
@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
include(WP_PLUGIN_DIR . '/' . $plugin);
do_action('activate_' . $plugin);
exit;
break;
case 'deactivate':
+ if ( ! current_user_can('activate_plugins') )
+ wp_die(__('You do not have sufficient permissions to deactivate plugins for this blog.'));
+
check_admin_referer('deactivate-plugin_' . $plugin);
deactivate_plugins($plugin);
update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
exit;
break;
case 'deactivate-selected':
+ if ( ! current_user_can('activate_plugins') )
+ wp_die(__('You do not have sufficient permissions to deactivate plugins for this blog.'));
+
check_admin_referer('bulk-manage-plugins');
- $plugins = (array) $_POST['checked'];
+ $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
$plugins = array_filter($plugins, 'is_plugin_active'); //Do not deactivate plugins which are already deactivated.
if ( empty($plugins) ) {
wp_redirect("plugins.php?plugin_status=$status&paged=$page");
check_admin_referer('bulk-manage-plugins');
- $plugins = (array) $_REQUEST['checked']; //$_POST = from the plugin form; $_GET = from the FTP details screen.
+ //$_POST = from the plugin form; $_GET = from the FTP details screen.
+ $plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
$plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); //Do not allow to delete Activated plugins.
if ( empty($plugins) ) {
wp_redirect("plugins.php?plugin_status=$status&paged=$page");
<div class="wrap">
<?php screen_icon(); ?>
-<h2><?php echo esc_html( $title ); ?></h2>
+<h2><?php echo esc_html( $title ); ?> <a href="plugin-install.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'plugin'); ?></a></h2>
<?php
//Paging.
$total_this_page = "total_{$status}_plugins";
$total_this_page = $$total_this_page;
-$plugins_per_page = get_user_option('plugins_per_page');
-if ( empty($plugins_per_page) )
+$plugins_per_page = (int) get_user_option( 'plugins_per_page', 0, false );
+if ( empty( $plugins_per_page ) || $plugins_per_page < 1 )
$plugins_per_page = 999;
-$plugins_per_page = apply_filters('plugins_per_page', $plugins_per_page);
+$plugins_per_page = apply_filters( 'plugins_per_page', $plugins_per_page );
$start = ($page - 1) * $plugins_per_page;