]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/upload.php
WordPress 3.4.2-scripts
[autoinstalls/wordpress.git] / wp-admin / upload.php
index e121207010ded397f733882b28b26f9b0a76fbf5..d1723274740b3c0a10181641cf6bc606279f2769 100644 (file)
@@ -90,6 +90,8 @@ if ( $doaction ) {
                        }
                        break;
                case 'trash':
+                       if ( !isset( $post_ids ) )
+                               break;
                        foreach ( (array) $post_ids as $post_id ) {
                                if ( !current_user_can( 'delete_post', $post_id ) )
                                        wp_die( __( 'You are not allowed to move this post to the trash.' ) );
@@ -100,6 +102,8 @@ if ( $doaction ) {
                        $location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location );
                        break;
                case 'untrash':
+                       if ( !isset( $post_ids ) )
+                               break;
                        foreach ( (array) $post_ids as $post_id ) {
                                if ( !current_user_can( 'delete_post', $post_id ) )
                                        wp_die( __( 'You are not allowed to move this post out of the trash.' ) );
@@ -110,6 +114,8 @@ if ( $doaction ) {
                        $location = add_query_arg( 'untrashed', count( $post_ids ), $location );
                        break;
                case 'delete':
+                       if ( !isset( $post_ids ) )
+                               break;
                        foreach ( (array) $post_ids as $post_id_del ) {
                                if ( !current_user_can( 'delete_post', $post_id_del ) )
                                        wp_die( __( 'You are not allowed to delete this post.' ) );
@@ -139,11 +145,27 @@ wp_enqueue_script( 'media' );
 
 add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) );
 
-add_contextual_help( $current_screen,
-       '<p>' . __( 'All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the <em>Screen Options</em> tab to customize the display of this screen.' ) . '</p>' .
-       '<p>' . __( 'You can narrow the list by file type/status using the text link filters at the top of the screen. You also can refine the list by date using the dropdown menu above the media table.' ) . '</p>' .
-       '<p>' . __( 'Hovering over a row reveals action links: <em>Edit</em>, <em>Delete Permanently</em>, and <em>View</em>. Clicking <em>Edit</em> or on the media file&#8217;s name displays a simple screen to edit that individual file&#8217;s metadata. Clicking <em>Delete Permanently</em> will delete the file from the media library (as well as from any posts to which it is currently attached). <em>View</em> will take you to the display page for that file.' ) . '</p>' .
-       '<p>' . __( 'If a media file has not been attached to any post, you will see that in the <em>Attached To</em> column, and can click on <em>Attach File</em> to launch a small popup that will allow you to search for a post and attach the file.' ) . '</p>' .
+get_current_screen()->add_help_tab( array(
+'id'           => 'overview',
+'title'                => __('Overview'),
+'content'      =>
+       '<p>' . __( 'All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.' ) . '</p>' .
+       '<p>' . __( 'You can narrow the list by file type/status using the text link filters at the top of the screen. You also can refine the list by date using the dropdown menu above the media table.' ) . '</p>'
+) );
+get_current_screen()->add_help_tab( array(
+'id'           => 'actions-links',
+'title'                => __('Available Actions'),
+'content'      =>
+       '<p>' . __( 'Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file&#8217;s name displays a simple screen to edit that individual file&#8217;s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file.' ) . '</p>'
+) );
+get_current_screen()->add_help_tab( array(
+'id'           => 'attaching-files',
+'title'                => __('Attaching Files'),
+'content'      =>
+       '<p>' . __( 'If a media file has not been attached to any post, you will see that in the Attached To column, and can click on Attach File to launch a small popup that will allow you to search for a post and attach the file.' ) . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
        '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
        '<p>' . __( '<a href="http://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' .
        '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
@@ -154,37 +176,41 @@ require_once('./admin-header.php');
 
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo esc_html( $title ); ?> <a href="media-new.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a> <?php
-if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
+<h2>
+<?php
+echo esc_html( $title );
+if ( current_user_can( 'upload_files' ) ) { ?>
+       <a href="media-new.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
+}
+if ( ! empty( $_REQUEST['s'] ) )
        printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?>
 </h2>
 
 <?php
 $message = '';
-if ( isset($_GET['posted']) && (int) $_GET['posted'] ) {
+if ( ! empty( $_GET['posted'] ) ) {
        $message = __('Media attachment updated.');
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
 }
 
-if ( isset($_GET['attached']) && (int) $_GET['attached'] ) {
-       $attached = (int) $_GET['attached'];
+if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
        $message = sprintf( _n('Reattached %d attachment.', 'Reattached %d attachments.', $attached), $attached );
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('attached'), $_SERVER['REQUEST_URI']);
 }
 
-if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
-       $message = sprintf( _n( 'Media attachment permanently deleted.', '%d media attachments permanently deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
+if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
+       $message = sprintf( _n( 'Media attachment permanently deleted.', '%d media attachments permanently deleted.', $deleted ), number_format_i18n( $_GET['deleted'] ) );
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
 }
 
-if ( isset($_GET['trashed']) && (int) $_GET['trashed'] ) {
-       $message = sprintf( _n( 'Media attachment moved to the trash.', '%d media attachments moved to the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) );
+if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
+       $message = sprintf( _n( 'Media attachment moved to the trash.', '%d media attachments moved to the trash.', $trashed ), number_format_i18n( $_GET['trashed'] ) );
        $message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']);
 }
 
-if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) {
-       $message = sprintf( _n( 'Media attachment restored from the trash.', '%d media attachments restored from the trash.', $_GET['untrashed'] ), number_format_i18n( $_GET['untrashed'] ) );
+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'] ) );
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']);
 }
 
@@ -194,8 +220,8 @@ $messages[3] = __('Error saving media attachment.');
 $messages[4] = __('Media moved to the trash.') . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
 $messages[5] = __('Media restored from the trash.');
 
-if ( isset($_GET['message']) && (int) $_GET['message'] ) {
-       $message = $messages[$_GET['message']];
+if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) {
+       $message = $messages[ $_GET['message'] ];
        $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
 }