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 = admin_url('page-new.php');
24 elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('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 <label class="hidden" for="post-search-input"><?php _e( 'Search Pages' ); ?>:</label>
115 <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
116 <input type="submit" value="<?php _e( 'Search Pages' ); ?>" class="button" />
119 <div class="tablenav">
122 $pagenum = absint( $_GET['pagenum'] );
123 if ( empty($pagenum) )
125 if( !$per_page || $per_page < 0 )
128 $num_pages = ceil(count($posts) / $per_page);
129 $page_links = paginate_links( array(
130 'base' => add_query_arg( 'pagenum', '%#%' ),
132 'total' => $num_pages,
133 'current' => $pagenum
137 echo "<div class='tablenav-pages'>$page_links</div>";
140 <div class="alignleft">
141 <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
142 <?php wp_nonce_field('bulk-pages'); ?>
152 $all = !( $h2_search || $post_status_q );
156 <table class="widefat">
159 <?php $posts_columns = wp_manage_pages_columns(); ?>
160 <?php foreach($posts_columns as $post_column_key => $column_display_name) {
161 if ( 'cb' === $post_column_key )
162 $class = ' class="check-column"';
163 elseif ( 'comments' === $post_column_key )
164 $class = ' class="num"';
168 <th scope="col"<?php echo $class; ?>><?php echo $column_display_name; ?></th>
173 <?php page_rows($posts, $pagenum, $per_page); ?>
179 <div id="ajax-response"></div>
185 <p><?php _e('No pages found.') ?></p>
190 <div class="tablenav">
193 echo "<div class='tablenav-pages'>$page_links</div>";
200 if ( 1 == count($posts) && is_singular() ) :
202 $comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $id) );
204 // Make sure comments, post, and post_author are cached
205 update_comment_cache($comments);
206 $post = get_post($id);
207 $authordata = get_userdata($post->post_author);
212 <table class="widefat" style="margin-top: .5em">
215 <th scope="col"><?php _e('Comment') ?></th>
216 <th scope="col"><?php _e('Date') ?></th>
217 <th scope="col"><?php _e('Actions') ?></th>
220 <tbody id="the-comment-list" class="list:comment">
222 foreach ($comments as $comment)
223 _wp_comment_row( $comment->comment_ID, 'detail', false, false );
237 <?php include('admin-footer.php'); ?>