check_permissions(); $action = $wp_list_table->current_action(); $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : ''; $s = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; // Clean up request URI from temporary args for screen options/paging uri's to work as expected. $_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']); if ( $action ) { $allowed_themes = get_site_option( 'allowedthemes' ); switch ( $action ) { case 'network-enable': $allowed_themes[ $_GET['theme'] ] = 1; update_site_option( 'allowedthemes', $allowed_themes ); wp_redirect( wp_get_referer() ); // @todo add_query_arg for update message exit; break; case 'network-disable': unset( $allowed_themes[ $_GET['theme'] ] ); update_site_option( 'allowedthemes', $allowed_themes ); wp_redirect( wp_get_referer() ); // @todo add_query_arg for update message exit; break; case 'network-enable-selected': check_admin_referer('bulk-plugins'); $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); if ( empty($themes) ) { wp_redirect( wp_get_referer() ); exit; } foreach( (array) $themes as $theme ) $allowed_themes[ $theme ] = 1; update_site_option( 'allowedthemes', $allowed_themes ); break; case 'network-disable-selected': check_admin_referer('bulk-plugins'); $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); if ( empty($themes) ) { wp_redirect( wp_get_referer() ); exit; } foreach( (array) $themes as $theme ) unset( $allowed_themes[ $theme ] ); update_site_option( 'allowedthemes', $allowed_themes ); break; } } $wp_list_table->prepare_items(); add_screen_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' ), 'default' => 999) ); $title = __('Themes'); $parent_file = 'themes.php'; require_once(ABSPATH . 'wp-admin/admin-header.php'); ?>