Make WordPress Core


Ignore:
Timestamp:
08/20/2008 04:06:36 AM (16 years ago)
Author:
ryan
Message:

Merge crazyhorse management pages. see #7552

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-pages.php

    r8656 r8682  
    1111
    1212// Handle bulk deletes
    13 if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
     13if ( isset($_GET['action']) && isset($_GET['delete']) ) {
    1414    check_admin_referer('bulk-pages');
    15     foreach( (array) $_GET['delete'] as $post_id_del ) {
    16         $post_del = & get_post($post_id_del);
    17 
    18         if ( !current_user_can('delete_page', $post_id_del) )
    19             wp_die( __('You are not allowed to delete this page.') );
    20 
    21         if ( $post_del->post_type == 'attachment' ) {
    22             if ( ! wp_delete_attachment($post_id_del) )
    23                 wp_die( __('Error in deleting...') );
    24         } else {
    25             if ( !wp_delete_post($post_id_del) )
    26                 wp_die( __('Error in deleting...') );
     15    if ( $_GET['action'] == 'delete' ) {
     16        foreach( (array) $_GET['delete'] as $post_id_del ) {
     17            $post_del = & get_post($post_id_del);
     18
     19            if ( !current_user_can('delete_page', $post_id_del) )
     20                wp_die( __('You are not allowed to delete this page.') );
     21
     22            if ( $post_del->post_type == 'attachment' ) {
     23                if ( ! wp_delete_attachment($post_id_del) )
     24                    wp_die( __('Error in deleting...') );
     25            } else {
     26                if ( !wp_delete_post($post_id_del) )
     27                    wp_die( __('Error in deleting...') );
     28            }
    2729        }
     30
     31        $sendback = wp_get_referer();
     32        if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
     33        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
     34        $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
     35
     36        wp_redirect($sendback);
     37        exit();
    2838    }
    29 
    30     $sendback = wp_get_referer();
    31     if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
    32     elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
    33     $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
    34 
    35     wp_redirect($sendback);
    36     exit();
    3739} elseif ( !empty($_GET['_wp_http_referer']) ) {
    3840     wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
     
    5254    );
    5355
    54 $post_status_label = __('Manage Pages');
     56$post_status_label = __('Pages');
    5557$post_status_q = '';
    5658if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
     
    8082    $h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name ));
    8183}
    82 printf( _c( '%1$s%2$s%3$s|You can reorder these: 1: Pages, 2: by {s}, 3: matching {s}' ), $post_status_label, $h2_author, $h2_search );
     84printf( _c( '%1$s%2$s%3$s (<a href="%4$s">Add New</a>)|You can reorder these: 1: Pages, 2: by {s}, 3: matching {s}' ), $post_status_label, $h2_author, $h2_search, 'page-new.php' );
    8385?></h2>
    8486
     
    147149
    148150<div class="alignleft">
    149 <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
     151<select name="action">
     152<option value="" selected><?php _e('Actions'); ?></option>
     153<option value="delete"><?php _e('Delete'); ?></option>
     154</select>
     155<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" />
    150156<?php wp_nonce_field('bulk-pages'); ?>
    151157</div>
Note: See TracChangeset for help on using the changeset viewer.