Changeset 8600 for trunk/wp-admin/includes/template.php
- Timestamp:
- 08/09/2008 05:36:14 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r8589 r8600 58 58 echo "\t" . _cat_row( $category, $level ); 59 59 60 unset($categories[$i]); // Prune the working set 60 unset($categories[$i]); // Prune the working set 61 61 $count++; 62 62 … … 192 192 193 193 $args = array(); 194 194 195 195 if ( is_array( $selected_cats ) ) 196 196 $args['selected_cats'] = $selected_cats; … … 548 548 } 549 549 550 /* 550 /* 551 551 * arrange pages into two parts: top level pages and children_pages 552 * children_pages is two dimensional array, eg. 553 * children_pages[10][] contains all sub-pages whose parent is 10. 552 * children_pages is two dimensional array, eg. 553 * children_pages[10][] contains all sub-pages whose parent is 10. 554 554 * It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations 555 555 * If searching, ignore hierarchy and treat everything as top level 556 556 */ 557 557 if ( empty($_GET['s']) ) { 558 558 559 559 $top_level_pages = array(); 560 560 $children_pages = array(); 561 561 562 562 foreach ( $pages as $page ) { 563 563 564 564 // catch and repair bad pages 565 565 if ( $page->post_parent == $page->ID ) { … … 568 568 clean_page_cache( $page->ID ); 569 569 } 570 570 571 571 if ( 0 == $page->post_parent ) 572 572 $top_level_pages[] = $page; … … 581 581 $start = ($pagenum - 1) * $per_page; 582 582 $end = $start + $per_page; 583 583 584 584 foreach ( $pages as $page ) { 585 585 if ( $count >= $end ) … … 594 594 _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page ); 595 595 } 596 596 597 597 // if it is the last pagenum and there are orphaned pages, display them with paging as well 598 598 if ( isset($children_pages) && $count < $end ){ … … 614 614 */ 615 615 function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) { 616 616 617 617 if ( ! isset( $children_pages[$parent] ) ) 618 return; 619 618 return; 619 620 620 $start = ($pagenum - 1) * $per_page; 621 621 $end = $start + $per_page; 622 622 623 623 foreach ( $children_pages[$parent] as $page ) { 624 624 625 625 if ( $count >= $end ) 626 626 break; 627 627 628 628 // If the page starts in a subtree, print the parents. 629 629 if ( $count == $start && $page->post_parent > 0 ) { … … 646 646 if ( $count >= $start ) 647 647 echo "\t" . display_page_row( $page, $level ); 648 648 649 649 $count++; 650 650 651 651 _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page ); 652 652 } 653 653 654 654 unset( $children_pages[$parent] ); //required in order to keep track of orphans 655 655 } … … 659 659 660 660 $current_user = wp_get_current_user(); 661 661 662 662 if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) ) 663 663 $user_object = new WP_User( (int) $user_object ); … … 748 748 749 749 $post_link .= get_the_title($comment->comment_post_ID) . '</a>'; 750 750 751 751 $edit_link_start = "<a class='row-title' href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>"; 752 752 $edit_link_end = '</a>'; … … 755 755 $edit_link_start = $edit_link_end =''; 756 756 } 757 757 758 758 $author_url = get_comment_author_url(); 759 759 if ( 'http://' == $author_url ) … … 789 789 <?php endif; ?> 790 790 <a href="edit-comments.php?s=<?php comment_author_IP() ?>&mode=detail"><?php comment_author_IP() ?></a> 791 <?php endif; //current_user_can?> 791 <?php endif; //current_user_can?> 792 792 </p> 793 793 <?php if ( 'detail' == $mode ) comment_text(); ?> … … 1172 1172 global $wp_meta_boxes; 1173 1173 1174 1174 1175 1175 if ( !isset($wp_meta_boxes) ) 1176 1176 $wp_meta_boxes = array();
Note: See TracChangeset
for help on using the changeset viewer.