Ticket #11575: 11575.diff
| File 11575.diff, 5.8 KB (added by , 16 years ago) |
|---|
-
wp-admin/includes/template.php
671 671 * @param unknown_type $class 672 672 * @return unknown 673 673 */ 674 function _tag_row( $tag, $level, $class = '', $taxonomy = 'post_tag' ) { 674 function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) { 675 static $row_class = ''; 676 $row_class = ($row_class == '' ? ' class="alternate"' : ''); 677 675 678 $count = number_format_i18n( $tag->count ); 676 679 if ( 'post_tag' == $taxonomy ) 677 680 $tagsel = 'tag'; … … 685 688 $count = ( $count > 0 ) ? "<a href='edit.php?$tagsel=$tag->slug'>$count</a>" : $count; 686 689 687 690 $pad = str_repeat( '— ', max(0, $level) ); 688 $name = apply_filters( 'term_name', $pad . ' ' . $tag->name );691 $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag ); 689 692 $qe_data = get_term($tag->term_id, $taxonomy, object, 'edit'); 690 693 $edit_link = "edit-tags.php?action=edit&taxonomy=$taxonomy&tag_ID=$tag->term_id"; 691 694 692 695 $out = ''; 693 $out .= '<tr id="tag-' . $tag->term_id . '"' . $ class . '>';696 $out .= '<tr id="tag-' . $tag->term_id . '"' . $row_class . '>'; 694 697 698 695 699 $columns = get_column_headers('edit-tags'); 696 700 $hidden = get_hidden_columns('edit-tags'); 697 701 $default_term = get_option('default_' . $taxonomy); … … 780 784 781 785 $args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0); 782 786 783 if ( !empty( $searchterms ) ) 787 if ( !empty( $searchterms ) ) { 784 788 $args['search'] = $searchterms; 789 add_filter('term_name', '_tag_rows_prepend_parents', 20, 2); 790 } 785 791 786 792 // convert it to table rows 787 793 $out = ''; … … 791 797 $args['number'] = $args['offset'] = 0; 792 798 793 799 $terms = get_terms( $taxonomy, $args ); 794 if ( !empty( $searchterms ) ) // Ignore children on searches. 795 $children = array(); 796 else 797 $children = _get_term_hierarchy($taxonomy); 800 $children = _get_term_hierarchy($taxonomy); 798 801 799 // Some funky recursion to get the job done is contained within, Skip it for non-hierarchical taxonomies for performance sake802 // Some funky recursion to get the job done(Paging & parents mainly) is contained within, Skip it for non-hierarchical taxonomies for performance sake 800 803 $out .= _term_rows($taxonomy, $terms, $children, $page, $pagesize, $count); 801 804 } else { 802 805 $terms = get_terms( $taxonomy, $args ); 803 806 foreach( $terms as $term ) 804 $out .= _tag_row( $term, 0, ++$count % 2 ? ' class="alternate"' : '',$taxonomy );807 $out .= _tag_row( $term, 0, $taxonomy ); 805 808 } 809 remove_filter('term_name', '_tag_rows_prepend_parents', 20, 2); 806 810 807 811 echo $out; 808 812 return $count; 809 813 } 810 814 815 function _tag_rows_prepend_parents($name, $term) { 816 $parent_ids = array(); 817 $p = $term->parent; 818 while ( $p ) { 819 $my_parent = get_term( $p, $term->taxonomy ); 820 $p = $my_parent->parent; 821 if ( in_array($p, $parent_ids) ) // Prevent parent loops. 822 break; 823 $parent_ids[] = $p; 824 $name = $my_parent->name . ' — ' . $name; 825 } 826 827 return $name; 828 } 829 811 830 function _term_rows( $taxonomy, $terms, &$children, $page = 1, $per_page = 20, &$count, $parent = 0, $level = 0 ) { 812 831 813 832 $start = ($page - 1) * $per_page; … … 837 856 unset($parent_ids); 838 857 839 858 $num_parents = count($my_parents); 840 $count -= $num_parents; // Do not include parents in the per-page count, This is due to paging issues with unknown numbers of rows.841 859 while ( $my_parent = array_pop($my_parents) ) { 842 $output .= "\t" . _tag_row( $my_parent, $level - $num_parents, ++$count % 2 ? ' class="alternate"' : '',$taxonomy );860 $output .= "\t" . _tag_row( $my_parent, $level - $num_parents, $taxonomy ); 843 861 $num_parents--; 844 862 } 845 863 } 846 864 847 865 if ( $count >= $start ) 848 $output .= "\t" . _tag_row( $term, $level, ++$count % 2 ? ' class="alternate"' : '', $taxonomy ); 849 else 850 ++$count; 866 $output .= "\t" . _tag_row( $term, $level, $taxonomy ); 851 867 868 ++$count; 869 852 870 unset($terms[$key]); 853 871 854 if ( isset($children[$term->term_id]) )872 if ( isset($children[$term->term_id]) && empty($_GET['s']) ) 855 873 $output .= _term_rows( $taxonomy, $terms, $children, $page, $per_page, $count, $term->term_id, $level + 1 ); 856 874 } 857 875 … … 2690 2708 ?> 2691 2709 </select> 2692 2710 <input class="hide-if-js" type="text" id="metakeyinput" name="metakeyinput" tabindex="7" value="" /> 2693 <a href="#postcustomstuff" class="hide-if-no-js" on click="jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;">2711 <a href="#postcustomstuff" class="hide-if-no-js" onClick="jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;"> 2694 2712 <span id="enternew"><?php _e('Enter new'); ?></span> 2695 2713 <span id="cancelnew" class="hidden"><?php _e('Cancel'); ?></span></a> 2696 2714 <?php } else { ?> … … 3367 3385 <?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?> 3368 3386 <label class="screen-reader-text" for="find-posts-input"><?php _e( 'Search' ); ?></label> 3369 3387 <input type="text" id="find-posts-input" name="ps" value="" /> 3370 <input type="button" on click="findPosts.send();" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /><br />3388 <input type="button" onClick="findPosts.send();" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /><br /> 3371 3389 3372 3390 <input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="posts" /> 3373 3391 <label for="find-posts-posts"><?php _e( 'Posts' ); ?></label> … … 3377 3395 <div id="find-posts-response"></div> 3378 3396 </div> 3379 3397 <div class="find-box-buttons"> 3380 <input type="button" class="button alignleft" on click="findPosts.close();" value="<?php esc_attr_e('Close'); ?>" />3398 <input type="button" class="button alignleft" onClick="findPosts.close();" value="<?php esc_attr_e('Close'); ?>" /> 3381 3399 <input id="find-posts-submit" type="submit" class="button-primary alignright" value="<?php esc_attr_e('Select'); ?>" /> 3382 3400 </div> 3383 3401 </div>