Ticket #11575: 11575.patch
File 11575.patch, 5.7 KB (added by , 13 years ago) |
---|
-
wp-admin/categories.php
238 238 </tr> 239 239 </tfoot> 240 240 241 <tbody id="the-list" class="list:cat ">241 <tbody id="the-list" class="list:cat categories"> 242 242 <?php 243 cat_rows( 0, 0, 0, $pagenum, $cats_per_page, $taxonomy);243 cat_rows($pagenum, $cats_per_page); 244 244 ?> 245 245 </tbody> 246 246 </table> -
wp-admin/css/colors-classic.dev.css
600 600 background-color: #fff; 601 601 } 602 602 603 .categories .notfound, 604 .categories .notfound th, 605 .categories .notfound td, 603 606 .plugins .inactive, 604 607 .plugins .inactive th, 605 608 .plugins .inactive td, -
wp-admin/css/colors-fresh.dev.css
595 595 background-color: #fff; 596 596 } 597 597 598 .categories .notfound, 599 .categories .notfound th, 600 .categories .notfound td, 598 601 .plugins .inactive, 599 602 .plugins .inactive th, 600 603 .plugins .inactive td, -
wp-admin/includes/template.php
8 8 * @subpackage Administration 9 9 */ 10 10 11 // Uglyrecursive category stuff.11 // Nice recursive category stuff. 12 12 /** 13 13 * {@internal Missing Short Description}} 14 14 * 15 15 * @since unknown 16 16 * 17 * @param unknown_type $parent 18 * @param unknown_type $level 19 * @param unknown_type $categories 20 * @param unknown_type $page 21 * @param unknown_type $per_page 17 * @param numeric $page 18 * @param numeric $per_page 19 * @return string 22 20 */ 23 function cat_rows( $pa rent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20, $taxonomy = 'category' ) {21 function cat_rows( $page = 1, $per_page = 20, $taxonomy = 'category' ) { 24 22 25 $count = 0; 23 $_cats = $cats = $categories = array(); 24 $args = (!empty($_GET['s'])) ? array('search' => $_GET['s'], 'hide_empty' => 0) : array('hide_empty' => 0); 26 25 27 if ( empty($categories) ) { 26 $_cats = get_categories( $args ); 27 foreach ($_cats as $_cat) { $_cat->_found = true; $cats[$_cat->term_id] = $_cat;} 28 unset($_cats, $_cat); 28 29 29 $args = array('hide_empty' => 0, 'taxonomy' => $taxonomy); 30 if ( !empty($_GET['s']) ) 31 $args['search'] = $_GET['s']; 30 $categories = array_slice($cats, ($page - 1) * $per_page, $per_page, true); 32 31 33 $categories = get_categories( $args ); 32 foreach ($categories as $term_id => $category) 33 { 34 $my_parent = $category->parent; 34 35 35 if ( empty($categories) ) 36 return false; 36 if (!$my_parent) continue; 37 38 do { 39 $my_parent = (isset($cats[$my_parent])) ? $cats[$my_parent] : get_category( $my_parent ); 40 if (!isset($categories[$my_parent->term_id])) $categories[$my_parent->term_id] = $my_parent; 41 $my_parent = $my_parent->parent; 42 } while ( $my_parent ); 37 43 } 38 44 39 45 $children = _get_term_hierarchy($taxonomy); 40 46 41 echo _cat_rows( $ parent, $level, $categories, $children, $page, $per_page, $count);47 echo _cat_rows( $categories, $children ); 42 48 43 49 } 44 50 … … 47 53 * 48 54 * @since unknown 49 55 * 50 * @param unknown_type $categories 51 * @param unknown_type $count 52 * @param unknown_type $parent 53 * @param unknown_type $level 54 * @param unknown_type $page 55 * @param unknown_type $per_page 56 * @return string the output of the table. 56 * @param array $categories 57 * @param array $children 58 * @param numeric $level 59 * @param numeric $parent 60 * @return string 57 61 */ 58 function _cat_rows( $parent = 0, $level = 0, $categories, &$children, $page = 1, $per_page = 20, &$count) {62 function _cat_rows( &$categories, &$children, $level = 0, $parent = 0 ) { 59 63 60 $start = ($page - 1) * $per_page;61 $end = $start + $per_page;62 63 64 $output = ''; 64 foreach ( $categories as $key => $category ) { 65 if ( $count >= $end ) 66 break; 67 68 if ( $category->parent != $parent && empty($_GET['s']) ) 69 continue; 70 71 // If the page starts in a subtree, print the parents. 72 if ( $count == $start && $category->parent > 0 ) { 73 74 $my_parents = array(); 75 $p = $category->parent; 76 while ( $p ) { 77 $my_parent = get_category( $p ); 78 $my_parents[] = $my_parent; 79 if ( $my_parent->parent == 0 ) 80 break; 81 $p = $my_parent->parent; 82 } 83 84 $num_parents = count($my_parents); 85 while( $my_parent = array_pop($my_parents) ) { 86 $output = "\t" . _cat_row( $my_parent, $level - $num_parents ); 87 $num_parents--; 88 } 89 } 90 91 if ( $count >= $start ) 92 $output .= "\t" . _cat_row( $category, $level ); 93 94 unset( $categories[ $key ] ); 95 96 $count++; 97 98 if ( isset($children[$category->term_id]) ) 99 $output .= _cat_rows( $category->term_id, $level + 1, $categories, $children, $page, $per_page, $count ); 65 foreach ( $categories as $key => $category ) 66 { 67 if ( $parent == $category->parent ) 68 { 69 $output .= _cat_row( $category, $level ); 70 unset( $categories[ $key ] ); 71 if ( isset($children[$category->term_id]) ) 72 $output .= _cat_rows( $categories, $children, $level + 1, $category->term_id ); 73 } 100 74 } 101 75 102 76 return $output; … … 142 116 $edit = $name; 143 117 } 144 118 145 $row_class = 'alternate' == $row_class ? '' : 'alternate';119 $row_class = (isset($category->_found)) ? 'found' : 'notfound'; 146 120 $qe_data = get_category_to_edit($category->term_id); 147 121 148 122 $category->count = number_format_i18n( $category->count ); … … 193 167 $output .= "</td>"; 194 168 } 195 169 } 196 $output .= '</tr>';170 $output .= "</tr>\n"; 197 171 198 172 return $output; 199 173 }