X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f..38ac4bc40322ecdc4052db4263466573e01fa51f:/wp-admin/upload.php?ds=sidebyside diff --git a/wp-admin/upload.php b/wp-admin/upload.php index 646381e9..39fa165f 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -24,8 +24,21 @@ if ( 'grid' === $mode ) { wp_enqueue_media(); wp_enqueue_script( 'media-grid' ); wp_enqueue_script( 'media' ); + + $q = $_GET; + // let JS handle this + unset( $q['s'] ); + $vars = wp_edit_attachments_query_vars( $q ); + $ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' ); + foreach ( $vars as $key => $value ) { + if ( ! $value || in_array( $key, $ignore ) ) { + unset( $vars[ $key ] ); + } + } + wp_localize_script( 'media-grid', '_wpMediaGridSettings', array( 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ), + 'queryVars' => (object) $vars ) ); get_current_screen()->add_help_tab( array( @@ -48,7 +61,7 @@ if ( 'grid' === $mode ) { get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . - '

' . __( 'Documentation on Media Library' ) . '

' . + '

' . __( 'Documentation on Media Library' ) . '

' . '

' . __( 'Support Forums' ) . '

' ); @@ -57,7 +70,7 @@ if ( 'grid' === $mode ) { require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?> -
+

query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $attach_string )", $parent_id ) ); - foreach ( $attach as $att_id ) { - clean_attachment_cache( $att_id ); - } - } - - if ( isset( $attached ) ) { - $location = 'upload.php'; - if ( $referer = wp_get_referer() ) { - if ( false !== strpos( $referer, 'upload.php' ) ) - $location = $referer; - } + case 'detach': + wp_media_attach_action( $_REQUEST['parent_post_id'], 'detach' ); + break; - $location = add_query_arg( array( 'attached' => $attached ) , $location ); - wp_redirect( $location ); - exit; - } + case 'attach': + wp_media_attach_action( $_REQUEST['found_post_id'] ); break; + case 'trash': if ( !isset( $post_ids ) ) break; @@ -191,7 +173,7 @@ $parent_file = 'upload.php'; wp_enqueue_script( 'media' ); -add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) ); +add_screen_option( 'per_page' ); get_current_screen()->add_help_tab( array( 'id' => 'overview', @@ -216,7 +198,7 @@ get_current_screen()->add_help_tab( array( get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . - '

' . __( 'Documentation on Media Library' ) . '

' . + '

' . __( 'Documentation on Media Library' ) . '

' . '

' . __( 'Support Forums' ) . '

' ); @@ -237,28 +219,48 @@ if ( ! empty( $_REQUEST['s'] ) ) ' . __('Undo') . ''; $_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']); } if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) { - $message = sprintf( _n( 'Media attachment restored from the trash.', '%d media attachments restored from the trash.', $untrashed ), number_format_i18n( $_GET['untrashed'] ) ); + if ( 1 == $untrashed ) { + $message = __( 'Media attachment restored from the trash.' ); + } else { + $message = _n( '%d media attachment restored from the trash.', '%d media attachments restored from the trash.', $untrashed ); + } + $message = sprintf( $message, number_format_i18n( $untrashed ) ); $_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']); } @@ -274,10 +276,10 @@ if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) { } if ( !empty($message) ) { ?> -

+

-
+ views(); ?>