-
+ 3043631715D6345B415AA169554043AEEFF92A92B95D9445AAA69C6AF0636C1FF00CD3535B1BB04086F9D92D682B3FCA847E89B466B5FB9F24CD2E6DBE606E5Fmp-wp/wp-admin/edit-pages.php(0 . 0)(1 . 331)
12308 <?php
12309 /**
12310 * Edit Pages Administration Panel.
12311 *
12312 * @package WordPress
12313 * @subpackage Administration
12314 */
12315
12316 /** WordPress Administration Bootstrap */
12317 require_once('admin.php');
12318
12319 // Handle bulk actions
12320 if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) {
12321 $doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2'];
12322
12323 switch ( $doaction ) {
12324 case 'delete':
12325 if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
12326 check_admin_referer('bulk-pages');
12327 $deleted = 0;
12328 foreach( (array) $_GET['post'] as $post_id_del ) {
12329 $post_del = & get_post($post_id_del);
12330
12331 if ( !current_user_can('delete_page', $post_id_del) )
12332 wp_die( __('You are not allowed to delete this page.') );
12333
12334 if ( $post_del->post_type == 'attachment' ) {
12335 if ( ! wp_delete_attachment($post_id_del) )
12336 wp_die( __('Error in deleting...') );
12337 } else {
12338 if ( !wp_delete_post($post_id_del) )
12339 wp_die( __('Error in deleting...') );
12340 }
12341 $deleted++;
12342 }
12343 }
12344 break;
12345 case 'edit':
12346 if ( isset($_GET['post']) && isset($_GET['bulk_edit']) ) {
12347 check_admin_referer('bulk-pages');
12348
12349 if ( -1 == $_GET['_status'] ) {
12350 $_GET['post_status'] = null;
12351 unset($_GET['_status'], $_GET['post_status']);
12352 } else {
12353 $_GET['post_status'] = $_GET['_status'];
12354 }
12355
12356 $done = bulk_edit_posts($_GET);
12357 }
12358 break;
12359 }
12360
12361 $sendback = wp_get_referer();
12362 if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
12363 elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
12364 if ( isset($done) ) {
12365 $done['updated'] = count( $done['updated'] );
12366 $done['skipped'] = count( $done['skipped'] );
12367 $done['locked'] = count( $done['locked'] );
12368 $sendback = add_query_arg( $done, $sendback );
12369 }
12370 if ( isset($deleted) )
12371 $sendback = add_query_arg('deleted', $deleted, $sendback);
12372 wp_redirect($sendback);
12373 exit();
12374 } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
12375 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
12376 exit;
12377 }
12378
12379 if ( empty($title) )
12380 $title = __('Edit Pages');
12381 $parent_file = 'edit-pages.php';
12382 wp_enqueue_script('inline-edit-post');
12383
12384 $post_stati = array( // array( adj, noun )
12385 'publish' => array(__('Published|page'), __('Published pages'), _n_noop('Published <span class="count">(%s)</span>|page', 'Published <span class="count">(%s)</span>')),
12386 'future' => array(__('Scheduled|page'), __('Scheduled pages'), _n_noop('Scheduled <span class="count">(%s)</span>|page', 'Scheduled <span class="count">(%s)</span>')),
12387 'pending' => array(__('Pending Review|page'), __('Pending pages'), _n_noop('Pending Review <span class="count">(%s)</span>|page', 'Pending Review <span class="count">(%s)</span>')),
12388 'draft' => array(__('Draft|page'), _c('Drafts|manage posts header'), _n_noop('Draft <span class="count">(%s)</span>|page', 'Drafts <span class="count">(%s)</span>')),
12389 'private' => array(__('Private|page'), __('Private pages'), _n_noop('Private <span class="count">(%s)</span>|page', 'Private <span class="count">(%s)</span>'))
12390 );
12391
12392 $query = array('post_type' => 'page', 'orderby' => 'menu_order title', 'what_to_show' => 'posts',
12393 'posts_per_page' => -1, 'posts_per_archive_page' => -1, 'order' => 'asc');
12394
12395 $post_status_label = __('Pages');
12396 if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
12397 $post_status_label = $post_stati[$_GET['post_status']][1];
12398 $query['post_status'] = $_GET['post_status'];
12399 $query['perm'] = 'readable';
12400 }
12401
12402 $query = apply_filters('manage_pages_query', $query);
12403 wp($query);
12404
12405 if ( is_singular() ) {
12406 wp_enqueue_script( 'admin-comments' );
12407 enqueue_comment_hotkeys_js();
12408 }
12409
12410 require_once('admin-header.php'); ?>
12411
12412 <div class="wrap">
12413 <?php screen_icon(); ?>
12414 <h2><?php echo wp_specialchars( $title );
12415 if ( isset($_GET['s']) && $_GET['s'] )
12416 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', wp_specialchars( get_search_query() ) ); ?>
12417 </h2>
12418
12419 <?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) ) { ?>
12420 <div id="message" class="updated fade"><p>
12421 <?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
12422 printf( __ngettext( '%s page updated.', '%s pages updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
12423 unset($_GET['updated']);
12424 }
12425
12426 if ( isset($_GET['skipped']) && (int) $_GET['skipped'] ) {
12427 printf( __ngettext( '%s page not updated, invalid parent page specified.', '%s pages not updated, invalid parent page specified.', $_GET['skipped'] ), number_format_i18n( $_GET['skipped'] ) );
12428 unset($_GET['skipped']);
12429 }
12430
12431 if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
12432 printf( __ngettext( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['skipped'] ) );
12433 unset($_GET['locked']);
12434 }
12435
12436 if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
12437 printf( __ngettext( 'Page deleted.', '%s pages deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
12438 unset($_GET['deleted']);
12439 }
12440 $_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] );
12441 ?>
12442 </p></div>
12443 <?php } ?>
12444
12445 <?php if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
12446 <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="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit page'); ?></a></p></div>
12447 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
12448 endif; ?>
12449
12450 <form id="posts-filter" action="" method="get">
12451 <ul class="subsubsub">
12452 <?php
12453
12454 $avail_post_stati = get_available_post_statuses('page');
12455 if ( empty($locked_post_status) ) :
12456 $status_links = array();
12457 $num_posts = wp_count_posts('page', 'readable');
12458 $total_posts = array_sum( (array) $num_posts );
12459 $class = empty($_GET['post_status']) ? ' class="current"' : '';
12460 $status_links[] = "<li><a href='edit-pages.php'$class>" . sprintf( __ngettext( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts ), number_format_i18n( $total_posts ) ) . '</a>';
12461 foreach ( $post_stati as $status => $label ) {
12462 $class = '';
12463
12464 if ( !in_array($status, $avail_post_stati) )
12465 continue;
12466
12467 if ( isset( $_GET['post_status'] ) && $status == $_GET['post_status'] )
12468 $class = ' class="current"';
12469
12470 $status_links[] = "<li><a href='edit-pages.php?post_status=$status'$class>" . sprintf( _nc( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';
12471 }
12472 echo implode( " |</li>\n", $status_links ) . '</li>';
12473 unset($status_links);
12474 endif;
12475 ?>
12476 </ul>
12477
12478 <p class="search-box">
12479 <label class="hidden" for="page-search-input"><?php _e( 'Search Pages' ); ?>:</label>
12480 <input type="text" class="search-input" id="page-search-input" name="s" value="<?php _admin_search_query(); ?>" />
12481 <input type="submit" value="<?php _e( 'Search Pages' ); ?>" class="button" />
12482 </p>
12483
12484 <?php if ( isset($_GET['post_status'] ) ) : ?>
12485 <input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
12486 <?php endif; ?>
12487
12488 <?php if ($posts) { ?>
12489
12490 <div class="tablenav">
12491
12492 <?php
12493 $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
12494 if ( empty($pagenum) )
12495 $pagenum = 1;
12496 if( ! isset( $per_page ) || $per_page < 0 )
12497 $per_page = 20;
12498
12499 $num_pages = ceil($wp_query->post_count / $per_page);
12500 $page_links = paginate_links( array(
12501 'base' => add_query_arg( 'pagenum', '%#%' ),
12502 'format' => '',
12503 'prev_text' => __('«'),
12504 'next_text' => __('»'),
12505 'total' => $num_pages,
12506 'current' => $pagenum
12507 ));
12508
12509 if ( $page_links ) : ?>
12510 <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s',
12511 number_format_i18n( ( $pagenum - 1 ) * $per_page + 1 ),
12512 number_format_i18n( min( $pagenum * $per_page, $wp_query->post_count ) ),
12513 number_format_i18n( $wp_query->post_count ),
12514 $page_links
12515 ); echo $page_links_text; ?></div>
12516 <?php endif; ?>
12517
12518 <div class="alignleft actions">
12519 <select name="action">
12520 <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
12521 <option value="edit"><?php _e('Edit'); ?></option>
12522 <option value="delete"><?php _e('Delete'); ?></option>
12523 </select>
12524 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
12525 <?php wp_nonce_field('bulk-pages'); ?>
12526 </div>
12527
12528 <br class="clear" />
12529 </div>
12530
12531 <div class="clear"></div>
12532
12533 <table class="widefat page fixed" cellspacing="0">
12534 <thead>
12535 <tr>
12536 <?php print_column_headers('edit-pages'); ?>
12537 </tr>
12538 </thead>
12539
12540 <tfoot>
12541 <tr>
12542 <?php print_column_headers('edit-pages', false); ?>
12543 </tr>
12544 </tfoot>
12545
12546 <tbody>
12547 <?php page_rows($posts, $pagenum, $per_page); ?>
12548 </tbody>
12549 </table>
12550
12551 <div class="tablenav">
12552 <?php
12553 if ( $page_links )
12554 echo "<div class='tablenav-pages'>$page_links_text</div>";
12555 ?>
12556
12557 <div class="alignleft actions">
12558 <select name="action2">
12559 <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
12560 <option value="edit"><?php _e('Edit'); ?></option>
12561 <option value="delete"><?php _e('Delete'); ?></option>
12562 </select>
12563 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
12564 </div>
12565
12566 <br class="clear" />
12567 </div>
12568
12569 <?php } else { ?>
12570 <div class="clear"></div>
12571 <p><?php _e('No pages found.') ?></p>
12572 <?php
12573 } // end if ($posts)
12574 ?>
12575
12576 </form>
12577
12578 <?php inline_edit_row( 'page' ) ?>
12579
12580 <div id="ajax-response"></div>
12581
12582
12583 <?php
12584
12585 if ( 1 == count($posts) && is_singular() ) :
12586
12587 $comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $id) );
12588 if ( $comments ) :
12589 // Make sure comments, post, and post_author are cached
12590 update_comment_cache($comments);
12591 $post = get_post($id);
12592 $authordata = get_userdata($post->post_author);
12593 ?>
12594
12595 <br class="clear" />
12596
12597 <table class="widefat" cellspacing="0">
12598 <thead>
12599 <tr>
12600 <th scope="col" class="column-comment"><?php echo _c('Comment|noun') ?></th>
12601 <th scope="col" class="column-author"><?php _e('Author') ?></th>
12602 <th scope="col" class="column-date"><?php _e('Submitted') ?></th>
12603 </tr>
12604 </thead>
12605 <tbody id="the-comment-list" class="list:comment">
12606 <?php
12607 foreach ($comments as $comment)
12608 _wp_comment_row( $comment->comment_ID, 'single', false, false );
12609 ?>
12610 </tbody>
12611 </table>
12612
12613 <?php
12614 wp_comment_reply();
12615 endif; // comments
12616 endif; // posts;
12617
12618 ?>
12619
12620 </div>
12621
12622 <script type="text/javascript">
12623 /* <![CDATA[ */
12624 (function($){
12625 $(document).ready(function(){
12626 $('#doaction, #doaction2').click(function(){
12627 if ( $('select[name^="action"]').val() == 'delete' ) {
12628 var m = '<?php echo js_escape(__("You are about to delete the selected pages.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
12629 return showNotice.warn(m);
12630 }
12631 });
12632 });
12633 })(jQuery);
12634 columns.init('edit-pages');
12635 /* ]]> */
12636 </script>
12637
12638 <?php include('admin-footer.php'); ?>