Changeset 11450 for trunk/wp-admin/includes/template.php
- Timestamp:
- 05/24/2009 11:47:49 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/template.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r11445 r11450 22 22 */ 23 23 function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) { 24 24 25 25 $count = 0; 26 26 27 27 if ( empty($categories) ) { 28 28 29 29 $args = array('hide_empty' => 0); 30 30 if ( !empty($_GET['s']) ) 31 31 $args['search'] = $_GET['s']; 32 33 $categories = get_categories( $args ); 34 32 33 $categories = get_categories( $args ); 34 35 35 if ( empty($categories) ) 36 36 return false; 37 37 } 38 38 39 $children = _get_term_hierarchy('category'); 40 41 _cat_rows( $parent, $level, $categories, $children, $page, $per_page, $count ); 42 39 $children = _get_term_hierarchy('category'); 40 41 _cat_rows( $parent, $level, $categories, $children, $page, $per_page, $count ); 42 43 43 } 44 44 … … 56 56 * @return unknown 57 57 */ 58 function _cat_rows( $parent = 0, $level = 0, $categories, &$children, $page = 1, $per_page = 20, &$count ) { 59 58 function _cat_rows( $parent = 0, $level = 0, $categories, &$children, $page = 1, $per_page = 20, &$count ) { 59 60 60 $start = ($page - 1) * $per_page; 61 61 $end = $start + $per_page; 62 62 ob_start(); 63 63 64 64 foreach ( $categories as $key => $category ) { 65 65 if ( $count >= $end ) 66 66 break; 67 67 68 68 if ( $category->parent != $parent && empty($_GET['s']) ) 69 69 continue; … … 71 71 // If the page starts in a subtree, print the parents. 72 72 if ( $count == $start && $category->parent > 0 ) { 73 73 74 74 $my_parents = array(); 75 75 $p = $category->parent; … … 81 81 $p = $my_parent->parent; 82 82 } 83 83 84 84 $num_parents = count($my_parents); 85 85 while( $my_parent = array_pop($my_parents) ) { … … 92 92 echo "\t" . _cat_row( $category, $level ); 93 93 94 unset( $categories[ $key ] ); 95 94 unset( $categories[ $key ] ); 95 96 96 $count++; 97 97 98 98 if ( isset($children[$category->term_id]) ) 99 _cat_rows( $category->term_id, $level + 1, $categories, $children, $page, $per_page, $count ); 99 _cat_rows( $category->term_id, $level + 1, $categories, $children, $page, $per_page, $count ); 100 100 } 101 101 … … 518 518 // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) 519 519 $checked_categories = array(); 520 $keys = array_keys( $categories ); 521 520 $keys = array_keys( $categories ); 521 522 522 foreach( $keys as $k ) { 523 523 if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) { 524 524 $checked_categories[] = $categories[$k]; 525 525 unset( $categories[$k] ); 526 } 526 } 527 527 } 528 528 … … 3599 3599 return ''; 3600 3600 } 3601 3601 3602 3602 $screen_layout_columns = get_user_option("screen_layout_$screen"); 3603 3603 $num = $columns[$screen];
Note: See TracChangeset
for help on using the changeset viewer.