]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/edit.php
Wordpress 3.6
[autoinstalls/wordpress.git] / wp-admin / edit.php
index ab16be088faaba1330c4ca0a2bdd855559b4dcf3..65fd03426aa4b5fbbf8c23c5a393008df7701fdf 100644 (file)
@@ -48,7 +48,7 @@ $doaction = $wp_list_table->current_action();
 if ( $doaction ) {
        check_admin_referer('bulk-posts');
 
 if ( $doaction ) {
        check_admin_referer('bulk-posts');
 
-       $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
+       $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'locked', 'ids'), wp_get_referer() );
        if ( ! $sendback )
                $sendback = admin_url( $parent_file );
        $sendback = add_query_arg( 'paged', $pagenum, $sendback );
        if ( ! $sendback )
                $sendback = admin_url( $parent_file );
        $sendback = add_query_arg( 'paged', $pagenum, $sendback );
@@ -75,22 +75,29 @@ if ( $doaction ) {
 
        switch ( $doaction ) {
                case 'trash':
 
        switch ( $doaction ) {
                case 'trash':
-                       $trashed = 0;
+                       $trashed = $locked = 0;
+
                        foreach( (array) $post_ids as $post_id ) {
                        foreach( (array) $post_ids as $post_id ) {
-                               if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
+                               if ( !current_user_can( 'delete_post', $post_id) )
                                        wp_die( __('You are not allowed to move this item to the Trash.') );
 
                                        wp_die( __('You are not allowed to move this item to the Trash.') );
 
+                               if ( wp_check_post_lock( $post_id ) ) {
+                                       $locked++;
+                                       continue;
+                               }
+
                                if ( !wp_trash_post($post_id) )
                                        wp_die( __('Error in moving to Trash.') );
 
                                $trashed++;
                        }
                                if ( !wp_trash_post($post_id) )
                                        wp_die( __('Error in moving to Trash.') );
 
                                $trashed++;
                        }
-                       $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids) ), $sendback );
+
+                       $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids), 'locked' => $locked ), $sendback );
                        break;
                case 'untrash':
                        $untrashed = 0;
                        foreach( (array) $post_ids as $post_id ) {
                        break;
                case 'untrash':
                        $untrashed = 0;
                        foreach( (array) $post_ids as $post_id ) {
-                               if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
+                               if ( !current_user_can( 'delete_post', $post_id) )
                                        wp_die( __('You are not allowed to restore this item from the Trash.') );
 
                                if ( !wp_untrash_post($post_id) )
                                        wp_die( __('You are not allowed to restore this item from the Trash.') );
 
                                if ( !wp_untrash_post($post_id) )
@@ -103,17 +110,17 @@ if ( $doaction ) {
                case 'delete':
                        $deleted = 0;
                        foreach( (array) $post_ids as $post_id ) {
                case 'delete':
                        $deleted = 0;
                        foreach( (array) $post_ids as $post_id ) {
-                               $post_del = get_post($post_id);
+                               $post_del = get_post($post_id);
 
 
-                               if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
+                               if ( !current_user_can( 'delete_post', $post_id ) )
                                        wp_die( __('You are not allowed to delete this item.') );
 
                                if ( $post_del->post_type == 'attachment' ) {
                                        if ( ! wp_delete_attachment($post_id) )
                                        wp_die( __('You are not allowed to delete this item.') );
 
                                if ( $post_del->post_type == 'attachment' ) {
                                        if ( ! wp_delete_attachment($post_id) )
-                                               wp_die( __('Error in deleting...') );
+                                               wp_die( __('Error in deleting.') );
                                } else {
                                        if ( !wp_delete_post($post_id) )
                                } else {
                                        if ( !wp_delete_post($post_id) )
-                                               wp_die( __('Error in deleting...') );
+                                               wp_die( __('Error in deleting.') );
                                }
                                $deleted++;
                        }
                                }
                                $deleted++;
                        }
@@ -138,7 +145,7 @@ if ( $doaction ) {
        wp_redirect($sendback);
        exit();
 } elseif ( ! empty($_REQUEST['_wp_http_referer']) ) {
        wp_redirect($sendback);
        exit();
 } elseif ( ! empty($_REQUEST['_wp_http_referer']) ) {
-        wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
+        wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) ) );
         exit;
 }
 
         exit;
 }
 
@@ -215,16 +222,19 @@ if ( 'post' == $post_type ) {
        );
 }
 
        );
 }
 
-add_screen_option( 'per_page', array('label' => $title, 'default' => 20) );
+add_screen_option( 'per_page', array( 'label' => $title, 'default' => 20, 'option' => 'edit_' . $post_type . '_per_page' ) );
 
 require_once('./admin-header.php');
 ?>
 <div class="wrap">
 <?php screen_icon(); ?>
 
 require_once('./admin-header.php');
 ?>
 <div class="wrap">
 <?php screen_icon(); ?>
-<h2><?php echo esc_html( $post_type_object->labels->name ); ?> <a href="<?php echo $post_new_file ?>" class="add-new-h2"><?php echo esc_html($post_type_object->labels->add_new); ?></a> <?php
+<h2><?php
+echo esc_html( $post_type_object->labels->name );
+if ( current_user_can( $post_type_object->cap->create_posts ) )
+       echo ' <a href="' . esc_url( $post_new_file ) . '" class="add-new-h2">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
 if ( ! empty( $_REQUEST['s'] ) )
 if ( ! empty( $_REQUEST['s'] ) )
-       printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?>
-</h2>
+       printf( ' <span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() );
+?></h2>
 
 <?php if ( isset( $_REQUEST['locked'] ) || isset( $_REQUEST['updated'] ) || isset( $_REQUEST['deleted'] ) || isset( $_REQUEST['trashed'] ) || isset( $_REQUEST['untrashed'] ) ) {
        $messages = array();
 
 <?php if ( isset( $_REQUEST['locked'] ) || isset( $_REQUEST['updated'] ) || isset( $_REQUEST['deleted'] ) || isset( $_REQUEST['trashed'] ) || isset( $_REQUEST['untrashed'] ) ) {
        $messages = array();