Introduce WP_List_Table::check_permissions() and WP_List_Table::prepare_items(). Fixes #14596; See #14579

git-svn-id: https://develop.svn.wordpress.org/trunk@15496 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
scribu
2010-08-12 23:21:05 +00:00
parent d570886128
commit 37401689c5
16 changed files with 271 additions and 170 deletions
+23 -6
View File
@@ -9,11 +9,30 @@
/** WordPress Administration Bootstrap */
require_once( './admin.php' );
if ( !current_user_can('upload_files') )
wp_die(__('You do not have permission to upload files.'));
require_once( './includes/default-list-tables.php' );
$table = new WP_Media_Table;
$table->check_permissions();
// Handle bulk actions
if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) {
if ( isset($_REQUEST['find_detached']) ) {
check_admin_referer('bulk-media');
if ( !current_user_can('edit_posts') )
wp_die( __('You are not allowed to scan for lost attachments.') );
$lost = $wpdb->get_col( "
SELECT ID FROM $wpdb->posts
WHERE post_type = 'attachment' AND post_parent > '0'
AND post_parent NOT IN (
SELECT ID FROM $wpdb->posts
WHERE post_type NOT IN ( 'attachment', '" . join( "', '", get_post_types( array( 'public' => false ) ) ) . "' )
)
" );
$_REQUEST['detached'] = 1;
} elseif ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) {
check_admin_referer( 'bulk-media' );
$parent_id = (int) $_REQUEST['found_post_id'];
@@ -111,9 +130,7 @@ if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) {
exit;
}
require_once( './includes/default-list-tables.php' );
$table = new WP_Media_Table;
$table->prepare_items();
$title = __('Media Library');
$parent_file = 'upload.php';