2 require_once('admin.php');
5 if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
6 check_admin_referer('bulk-pages');
7 foreach( (array) $_GET['delete'] as $post_id_del ) {
8 $post_del = & get_post($post_id_del);
10 if ( !current_user_can('delete_page', $post_id_del) )
11 wp_die( __('You are not allowed to delete this page.') );
13 if ( $post_del->post_type == 'attachment' ) {
14 if ( ! wp_delete_attachment($post_id_del) )
15 wp_die( __('Error in deleting...') );
17 if ( !wp_delete_post($post_id_del) )
18 wp_die( __('Error in deleting...') );
22 $sendback = wp_get_referer();
23 if (strpos($sendback, 'page.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/page-new.php';
24 elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
25 $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
27 wp_redirect($sendback);
29 } elseif ( !empty($_GET['_wp_http_referer']) ) {
30 wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
35 $parent_file = 'edit.php';
36 wp_enqueue_script('admin-forms');
38 $post_stati = array( // array( adj, noun )
39 'publish' => array(__('Published'), __('Published pages'), __ngettext_noop('Published (%s)', 'Published (%s)')),
40 'future' => array(__('Scheduled'), __('Scheduled pages'), __ngettext_noop('Scheduled (%s)', 'Scheduled (%s)')),
41 'pending' => array(__('Pending Review'), __('Pending pages'), __ngettext_noop('Pending Review (%s)', 'Pending Review (%s)')),
42 'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft (%s)', 'Drafts (%s)')),
43 'private' => array(__('Private'), __('Private pages'), __ngettext_noop('Private (%s)', 'Private (%s)'))
46 $post_status_label = __('Manage Pages');
48 if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
49 $post_status_label = $post_stati[$_GET['post_status']][1];
50 $post_status_q = '&post_status=' . $_GET['post_status'];
51 $post_status_q .= '&perm=readable';
54 $query_str = "post_type=page&orderby=menu_order title&what_to_show=posts$post_status_q&posts_per_page=-1&posts_per_archive_page=-1&order=asc";
56 $query_str = apply_filters('manage_pages_query', $query_str);
60 wp_enqueue_script( 'admin-comments' );
61 require_once('admin-header.php');
65 <form id="posts-filter" action="" method="get">
67 // Use $_GET instead of is_ since they can override each other
68 $h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching “%s”'), wp_specialchars( stripslashes( $_GET['s'] ) ) ) : '';
70 if ( isset($_GET['author']) && $_GET['author'] ) {
71 $author_user = get_userdata( (int) $_GET['author'] );
72 $h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name ));
74 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 );
77 <ul class="subsubsub">
80 $avail_post_stati = get_available_post_statuses('page');
82 $status_links = array();
83 $num_posts = wp_count_posts('page', 'readable');
84 $class = empty($_GET['post_status']) ? ' class="current"' : '';
85 $status_links[] = "<li><a href=\"edit-pages.php\"$class>".__('All Pages')."</a>";
86 foreach ( $post_stati as $status => $label ) {
89 if ( !in_array($status, $avail_post_stati) )
92 if ( $status == $_GET['post_status'] )
93 $class = ' class="current"';
95 $status_links[] = "<li><a href=\"edit-pages.php?post_status=$status\"$class>" .
96 sprintf(__ngettext($label[2][0], $label[2][1], $num_posts->$status), number_format_i18n( $num_posts->$status ) ) . '</a>';
98 echo implode(' |</li>', $status_links) . '</li>';
103 <?php if ( isset($_GET['post_status'] ) ) : ?>
104 <input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
107 if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
108 <div id="message" class="updated fade"><p><strong><?php _e('Your page has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View page'); ?></a> | <a href="page.php?action=edit&post=<?php echo $_GET['posted']; ?>"><?php _e('Edit page'); ?></a></p></div>
109 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
114 <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
115 <input type="submit" value="<?php _e( 'Search Pages' ); ?>" class="button" />
118 <div class="tablenav">
120 <div class="alignleft">
121 <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
122 <?php wp_nonce_field('bulk-pages'); ?>
132 $all = !( $h2_search || $post_status_q );
136 <table class="widefat">
139 <?php $posts_columns = wp_manage_pages_columns(); ?>
140 <?php foreach($posts_columns as $post_column_key => $column_display_name) {
141 if ( 'cb' === $post_column_key )
142 $class = ' class="check-column"';
143 elseif ( 'comments' === $post_column_key )
144 $class = ' class="num"';
148 <th scope="col"<?php echo $class; ?>><?php echo $column_display_name; ?></th>
153 <?php page_rows($posts); ?>
159 <div id="ajax-response"></div>
165 <p><?php _e('No pages found.') ?></p>
170 <div class="tablenav">
176 if ( 1 == count($posts) && is_singular() ) :
178 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
180 // Make sure comments, post, and post_author are cached
181 update_comment_cache($comments);
182 $post = get_post($id);
183 $authordata = get_userdata($post->post_author);
188 <table class="widefat" style="margin-top: .5em">
191 <th scope="col"><?php _e('Comment') ?></th>
192 <th scope="col"><?php _e('Date') ?></th>
193 <th scope="col"><?php _e('Actions') ?></th>
196 <tbody id="the-comment-list" class="list:comment">
198 foreach ($comments as $comment)
199 _wp_comment_row( $comment->comment_ID, 'detail', false, false );
213 <?php include('admin-footer.php'); ?>