'', 'active' => '', 'inactive' => '', 'autoload' => '' ); $plugin_nav_class[$plugin_request] = ' class="current"'; // Get plugin counts extract( bb_get_plugin_counts() ); // Get requested plugins $requested_plugins = bb_get_plugins( 'all', $_plugin_type, $_plugin_status ); // Get currently active $active_plugins = (array) bb_get_option( 'active_plugins' ); // Check for missing plugin files and remove them from the active plugins array $update = false; foreach ( $active_plugins as $index => $plugin ) { if ( !file_exists( bb_get_plugin_path( $plugin ) ) ) { $update = true; unset( $active_plugins[$index] ); } } if ( $update ) { bb_update_option( 'active_plugins', $active_plugins ); } unset( $update, $index, $plugin ); // Set the action $action = ''; if( isset( $_GET['action'] ) && !empty( $_GET['action'] ) ) { $action = trim( $_GET['action'] ); } // Set the plugin $plugin = isset( $_GET['plugin'] ) ? trim( stripslashes( $_GET['plugin'] ) ) : ''; // Deal with user actions if ( !empty( $action ) ) { switch ( $action ) { case 'activate': // Activation bb_check_admin_referer( 'activate-plugin_' . $plugin ); $result = bb_activate_plugin( $plugin, 'plugins.php?message=error&plugin=' . urlencode( $plugin ) ); if ( is_wp_error( $result ) ) bb_die( $result ); // Overrides the ?message=error one above wp_redirect( 'plugins.php?plugin_request=' . $plugin_request . '&message=activate&plugin=' . urlencode( $plugin ) ); break; case 'deactivate': // Deactivation bb_check_admin_referer( 'deactivate-plugin_' . $plugin ); // Remove the deactivated plugin bb_deactivate_plugins( $plugin ); // Redirect wp_redirect( 'plugins.php?plugin_request=' . $plugin_request . '&message=deactivate&plugin=' . urlencode( $plugin ) ); break; case 'scrape': // Scrape php errors from the plugin bb_check_admin_referer('scrape-plugin_' . $plugin); $valid_path = bb_validate_plugin( $plugin ); if ( is_wp_error( $valid_path ) ) bb_die( $valid_path ); // Pump up the errors and output them to screen error_reporting( E_ALL ^ E_NOTICE ); @ini_set( 'display_errors', true ); include( $valid_path ); break; } // Stop processing exit; } // Display notices if ( isset($_GET['message']) ) { switch ( $_GET['message'] ) { case 'error' : bb_admin_notice( __( 'Plugin could not be activated, it produced a Fatal Error. The error is shown below.' ), 'error' ); break; case 'activate' : $plugin_data = bb_get_plugin_data( $plugin ); bb_admin_notice( sprintf( __( '"%s" plugin activated' ), esc_attr( $plugin_data['name'] ) ) ); break; case 'deactivate' : $plugin_data = bb_get_plugin_data( $plugin ); bb_admin_notice( sprintf( __( '"%s" plugin deactivated' ), esc_attr( $plugin_data['name'] ) ) ); break; } } if ( isset( $bb->safemode ) && $bb->safemode === true ) { bb_admin_notice( __( '"Safe mode" is on, all plugins are disabled even if they are listed as active.' ), 'error' ); } $bb_admin_body_class = ' bb-admin-plugins'; bb_get_admin_header(); ?>