<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12818] trunk: Merge Categories/Hierarchical taxonomies into edit-tags.php.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12818">12818</a></dd>
<dt>Author</dt> <dd>dd32</dd>
<dt>Date</dt> <dd>2010-01-24 11:00:27 +0000 (Sun, 24 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge Categories/Hierarchical taxonomies into edit-tags.php. See <a href="http://trac.wordpress.org/ticket/11838">#11838</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadmineditlinkcategoriesphp">trunk/wp-admin/edit-link-categories.php</a></li>
<li><a href="#trunkwpadminedittagformphp">trunk/wp-admin/edit-tag-form.php</a></li>
<li><a href="#trunkwpadminedittagsphp">trunk/wp-admin/edit-tags.php</a></li>
<li><a href="#trunkwpadminincludestaxonomyphp">trunk/wp-admin/includes/taxonomy.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminjstagsdevjs">trunk/wp-admin/js/tags.dev.js</a></li>
<li><a href="#trunkwpadminjstagsjs">trunk/wp-admin/js/tags.js</a></li>
<li><a href="#trunkwpadminmenuphp">trunk/wp-admin/menu.php</a></li>
<li><a href="#trunkwpincludestaxonomyphp">trunk/wp-includes/taxonomy.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-ajax.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/admin-ajax.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -610,7 +610,19 @@
</span><span class="cx">                 exit;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        echo _tag_row( $tag, '', $taxonomy );
</del><ins>+        $level = 0;
+        $tag_full_name = false;
+        if ( is_taxonomy_hierarchical($taxonomy) ) {
+                $tag_full_name = $tag-&gt;name;
+                $_tag = $tag;
+                while ( $_tag-&gt;parent ) {
+                        $_tag = get_term( $_tag-&gt;parent, $taxonomy );
+                        $tag_full_name = $_tag-&gt;name . ' &amp;#8212; ' . $tag_full_name;
+                        $level++;
+                }
+                $tag_full_name = esc_attr($tag_full_name);        
+        }
+        echo _tag_row( $tag, $level, $tag_full_name, $taxonomy );
</ins><span class="cx">         exit;
</span><span class="cx">         break;
</span><span class="cx"> case 'get-tagcloud' :
</span><span class="lines">@@ -1210,7 +1222,7 @@
</span><span class="cx">                                 if ( !$tag || is_wp_error( $tag ) )
</span><span class="cx">                                         die( __('Tag not updated.') );
</span><span class="cx"> 
</span><del>-                                echo _tag_row($tag, '', $taxonomy);
</del><ins>+                                echo _tag_row($tag, 0, '', $taxonomy);
</ins><span class="cx">                         } else {
</span><span class="cx">                                 die( __('Tag not updated.') );
</span><span class="cx">                         }
</span></span></pre></div>
<a id="trunkwpadmineditlinkcategoriesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-link-categories.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-link-categories.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/edit-link-categories.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -226,5 +226,5 @@
</span><span class="cx"> &lt;/div&gt;&lt;!-- /col-container --&gt;
</span><span class="cx"> &lt;/div&gt;&lt;!-- /wrap --&gt;
</span><span class="cx"> 
</span><del>-&lt;?php inline_edit_term_row('edit-link-categories'); ?&gt;
</del><ins>+&lt;?php inline_edit_term_row('edit-link-categories', 'link_category'); ?&gt;
</ins><span class="cx"> &lt;?php include('admin-footer.php'); ?&gt;
</span></span></pre></div>
<a id="trunkwpadminedittagformphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-tag-form.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-tag-form.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/edit-tag-form.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -39,13 +39,22 @@
</span><span class="cx">                 &lt;tr class=&quot;form-field&quot;&gt;
</span><span class="cx">                         &lt;th scope=&quot;row&quot; valign=&quot;top&quot;&gt;&lt;label for=&quot;slug&quot;&gt;&lt;?php _e('Tag slug') ?&gt;&lt;/label&gt;&lt;/th&gt;
</span><span class="cx">                         &lt;td&gt;&lt;input name=&quot;slug&quot; id=&quot;slug&quot; type=&quot;text&quot; value=&quot;&lt;?php if ( isset( $tag-&gt;slug ) ) echo esc_attr(apply_filters('editable_slug', $tag-&gt;slug)); ?&gt;&quot; size=&quot;40&quot; /&gt;
</span><del>-            &lt;p class=&quot;description&quot;&gt;&lt;?php _e('The &amp;#8220;slug&amp;#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?&gt;&lt;/p&gt;&lt;/td&gt;
</del><ins>+                        &lt;p class=&quot;description&quot;&gt;&lt;?php _e('The &amp;#8220;slug&amp;#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?&gt;&lt;/p&gt;&lt;/td&gt;
</ins><span class="cx">                 &lt;/tr&gt;
</span><span class="cx"> &lt;?php } ?&gt;
</span><ins>+&lt;?php if ( is_taxonomy_hierarchical($taxonomy) ) { ?&gt;
</ins><span class="cx">                 &lt;tr class=&quot;form-field&quot;&gt;
</span><ins>+                        &lt;th scope=&quot;row&quot; valign=&quot;top&quot;&gt;&lt;label for=&quot;parent&quot;&gt;&lt;?php _e('Category Parent') ?&gt;&lt;/label&gt;&lt;/th&gt;
+                        &lt;td&gt;
+                                &lt;?php wp_dropdown_categories(array('hide_empty' =&gt; 0, 'hide_if_empty' =&gt; false, 'name' =&gt; 'parent', 'orderby' =&gt; 'name', 'taxonomy' =&gt; $taxonomy, 'selected' =&gt; $tag-&gt;parent, 'exclude' =&gt; $tag-&gt;term_id, 'hierarchical' =&gt; true, 'show_option_none' =&gt; __('None'))); ?&gt;&lt;br /&gt;
+                                &lt;span class=&quot;description&quot;&gt;&lt;?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?&gt;&lt;/span&gt;
+                        &lt;/td&gt;
+                &lt;/tr&gt;
+&lt;?php } ?&gt;
+                &lt;tr class=&quot;form-field&quot;&gt;
</ins><span class="cx">                         &lt;th scope=&quot;row&quot; valign=&quot;top&quot;&gt;&lt;label for=&quot;description&quot;&gt;&lt;?php _e('Description') ?&gt;&lt;/label&gt;&lt;/th&gt;
</span><span class="cx">                         &lt;td&gt;&lt;textarea name=&quot;description&quot; id=&quot;description&quot; rows=&quot;5&quot; cols=&quot;50&quot; style=&quot;width: 97%;&quot;&gt;&lt;?php echo esc_html($tag-&gt;description); ?&gt;&lt;/textarea&gt;&lt;br /&gt;
</span><del>-            &lt;span class=&quot;description&quot;&gt;&lt;?php _e('The description is not prominent by default, however some themes may show it.'); ?&gt;&lt;/span&gt;&lt;/td&gt;
</del><ins>+                        &lt;span class=&quot;description&quot;&gt;&lt;?php _e('The description is not prominent by default, however some themes may show it.'); ?&gt;&lt;/span&gt;&lt;/td&gt;
</ins><span class="cx">                 &lt;/tr&gt;
</span><span class="cx">                 &lt;?php do_action('edit_tag_form_fields', $tag); ?&gt;
</span><span class="cx">         &lt;/table&gt;
</span></span></pre></div>
<a id="trunkwpadminedittagsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-tags.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-tags.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/edit-tags.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -44,9 +44,9 @@
</span><span class="cx"> 
</span><span class="cx">         $ret = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST);
</span><span class="cx">         if ( $ret &amp;&amp; !is_wp_error( $ret ) ) {
</span><del>-                wp_redirect('edit-tags.php?message=1#addtag');
</del><ins>+                wp_redirect(&quot;edit-tags.php?taxonomy=$taxonomy&amp;amp;message=1#addtag&quot;);
</ins><span class="cx">         } else {
</span><del>-                wp_redirect('edit-tags.php?message=4#addtag');
</del><ins>+                wp_redirect(&quot;edit-tags.php?taxonomy=$taxonomy&amp;amp;message=4#addtag&quot;);
</ins><span class="cx">         }
</span><span class="cx">         exit;
</span><span class="cx"> break;
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx"> 
</span><span class="cx">         wp_delete_term( $tag_ID, $taxonomy);
</span><span class="cx"> 
</span><del>-        $location = 'edit-tags.php';
</del><ins>+        $location = 'edit-tags.php?taxonomy=' . $taxonomy;
</ins><span class="cx">         if ( $referer = wp_get_referer() ) {
</span><span class="cx">                 if ( false !== strpos($referer, 'edit-tags.php') )
</span><span class="cx">                         $location = $referer;
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">                 wp_delete_term( $tag_ID, $taxonomy);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        $location = 'edit-tags.php';
</del><ins>+        $location = 'edit-tags.php?taxonomy=' . $taxonomy;
</ins><span class="cx">         if ( $referer = wp_get_referer() ) {
</span><span class="cx">                 if ( false !== strpos($referer, 'edit-tags.php') )
</span><span class="cx">                         $location = $referer;
</span><span class="lines">@@ -120,7 +120,7 @@
</span><span class="cx"> 
</span><span class="cx">         $ret = wp_update_term($tag_ID, $taxonomy, $_POST);
</span><span class="cx"> 
</span><del>-        $location = 'edit-tags.php';
</del><ins>+        $location = 'edit-tags.php?taxonomy=' . $taxonomy;
</ins><span class="cx">         if ( $referer = wp_get_original_referer() ) {
</span><span class="cx">                 if ( false !== strpos($referer, 'edit-tags.php') )
</span><span class="cx">                         $location = $referer;
</span><span class="lines">@@ -200,10 +200,13 @@
</span><span class="cx"> $tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
</span><span class="cx"> $tags_per_page = apply_filters( 'tagsperpage', $tags_per_page ); // Old filter
</span><span class="cx"> 
</span><del>-if ( !empty($_GET['s']) )
-        $total_terms = count( get_terms( $taxonomy, array( 'search' =&gt; trim(stripslashes($_GET['s'])), 'number' =&gt; 0, 'hide_empty' =&gt; 0 ) ) );
-else
</del><ins>+if ( !empty($_GET['s']) ) {
+        $searchterms = trim(stripslashes($_GET['s']));
+        $total_terms = count( get_terms( $taxonomy, array( 'search' =&gt; $searchterms, 'number' =&gt; 0, 'hide_empty' =&gt; 0 ) ) );
+} else {
+        $searchterms = '';
</ins><span class="cx">         $total_terms = wp_count_terms($taxonomy);
</span><ins>+}
</ins><span class="cx"> 
</span><span class="cx"> $page_links = paginate_links( array(
</span><span class="cx">         'base' =&gt; add_query_arg( 'pagenum', '%#%' ),
</span><span class="lines">@@ -248,8 +251,6 @@
</span><span class="cx">         &lt;tbody id=&quot;the-list&quot; class=&quot;list:tag&quot;&gt;
</span><span class="cx"> &lt;?php
</span><span class="cx"> 
</span><del>-$searchterms = isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '';
-
</del><span class="cx"> $count = tag_rows( $pagenum, $tags_per_page, $searchterms, $taxonomy );
</span><span class="cx"> ?&gt;
</span><span class="cx">         &lt;/tbody&gt;
</span><span class="lines">@@ -312,7 +313,14 @@
</span><span class="cx">         &lt;p&gt;&lt;?php _e('The &amp;#8220;slug&amp;#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?&gt;&lt;/p&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> &lt;?php } ?&gt;
</span><ins>+&lt;?php if ( is_taxonomy_hierarchical($taxonomy) ) { ?&gt;
</ins><span class="cx"> &lt;div class=&quot;form-field&quot;&gt;
</span><ins>+        &lt;label for=&quot;category_parent&quot;&gt;&lt;?php _e('Category Parent') ?&gt;&lt;/label&gt;
+        &lt;?php wp_dropdown_categories(array('hide_empty' =&gt; 0, 'hide_if_empty' =&gt; false, 'taxonomy' =&gt; $taxonomy, 'name' =&gt; 'parent', 'orderby' =&gt; 'name', 'hierarchical' =&gt; true, 'show_option_none' =&gt; __('None'))); ?&gt;
+        &lt;p&gt;&lt;?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?&gt;&lt;/p&gt;
+&lt;/div&gt;
+&lt;?php } ?&gt;
+&lt;div class=&quot;form-field&quot;&gt;
</ins><span class="cx">         &lt;label for=&quot;description&quot;&gt;&lt;?php _e('Description') ?&gt;&lt;/label&gt;
</span><span class="cx">         &lt;textarea name=&quot;description&quot; id=&quot;description&quot; rows=&quot;5&quot; cols=&quot;40&quot;&gt;&lt;/textarea&gt;
</span><span class="cx">         &lt;p&gt;&lt;?php _e('The description is not prominent by default; however, some themes may show it.'); ?&gt;&lt;/p&gt;
</span><span class="lines">@@ -329,7 +337,7 @@
</span><span class="cx"> &lt;/div&gt;&lt;!-- /col-container --&gt;
</span><span class="cx"> &lt;/div&gt;&lt;!-- /wrap --&gt;
</span><span class="cx"> 
</span><del>-&lt;?php inline_edit_term_row('edit-tags'); ?&gt;
</del><ins>+&lt;?php inline_edit_term_row('edit-tags', $taxonomy); ?&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;?php
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkwpadminincludestaxonomyphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/taxonomy.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/taxonomy.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/includes/taxonomy.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">                                 $cat_ids[] = $id;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ($post_id)
</del><ins>+        if ( $post_id )
</ins><span class="cx">                 wp_set_post_categories($post_id, $cat_ids);
</span><span class="cx"> 
</span><span class="cx">         return $cat_ids;
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/includes/template.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -205,15 +205,15 @@
</span><span class="cx">  *
</span><span class="cx">  * Outputs the HTML for the hidden table rows used in Categories, Link Caregories and Tags quick edit.
</span><span class="cx">  *
</span><del>- * @param string $type &quot;tag&quot;, &quot;category&quot; or &quot;link-category&quot;
</del><ins>+ * @param string $type &quot;edit-tags&quot;, &quot;categoried&quot; or &quot;edit-link-categories&quot;
+ * @param string $taxonomy The taxonomy of the row.
</ins><span class="cx">  * @return
</span><span class="cx">  */
</span><del>-function inline_edit_term_row($type) {
</del><ins>+function inline_edit_term_row($type, $taxonomy) {
</ins><span class="cx"> 
</span><span class="cx">         if ( ! current_user_can( 'manage_categories' ) )
</span><span class="cx">                 return;
</span><span class="cx"> 
</span><del>-        $is_tag = $type == 'edit-tags';
</del><span class="cx">         $columns = get_column_headers($type);
</span><span class="cx">         $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($type) ) );
</span><span class="cx">         $col_count = count($columns) - count($hidden);
</span><span class="lines">@@ -236,14 +236,13 @@
</span><span class="cx">                         &lt;/label&gt;
</span><span class="cx"> &lt;?php } ?&gt;
</span><span class="cx"> 
</span><del>-&lt;?php if ( 'category' == $type ) : ?&gt;
-
</del><ins>+&lt;?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?&gt;
</ins><span class="cx">                         &lt;label&gt;
</span><span class="cx">                                 &lt;span class=&quot;title&quot;&gt;&lt;?php _e( 'Parent' ); ?&gt;&lt;/span&gt;
</span><del>-                                &lt;?php wp_dropdown_categories(array('hide_empty' =&gt; 0, 'name' =&gt; 'parent', 'orderby' =&gt; 'name', 'hierarchical' =&gt; 1, 'show_option_none' =&gt; __('None'))); ?&gt;
</del><ins>+                                &lt;?php wp_dropdown_categories(array('hide_empty' =&gt; 0, 'name' =&gt; 'parent', 'orderby' =&gt; 'name', 'hierarchical' =&gt; 1, 'taxonomy' =&gt; $taxonomy, 'show_option_none' =&gt; __('None'))); ?&gt;
</ins><span class="cx">                         &lt;/label&gt;
</span><span class="cx"> 
</span><del>-&lt;?php endif; // $type ?&gt;
</del><ins>+&lt;?php endif; // $hierarchical ?&gt;
</ins><span class="cx"> 
</span><span class="cx">                 &lt;/div&gt;&lt;/fieldset&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -254,14 +253,14 @@
</span><span class="cx">         foreach ( $columns as $column_name =&gt; $column_display_name ) {
</span><span class="cx">                 if ( isset( $core_columns[$column_name] ) )
</span><span class="cx">                         continue;
</span><del>-                do_action( 'quick_edit_custom_box', $column_name, $type );
</del><ins>+                do_action( 'quick_edit_custom_box', $column_name, $type, $taxonomy );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx"> ?&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;p class=&quot;inline-edit-save submit&quot;&gt;
</span><span class="cx">                 &lt;a accesskey=&quot;c&quot; href=&quot;#inline-edit&quot; title=&quot;&lt;?php _e('Cancel'); ?&gt;&quot; class=&quot;cancel button-secondary alignleft&quot;&gt;&lt;?php _e('Cancel'); ?&gt;&lt;/a&gt;
</span><del>-                &lt;?php $update_text = ( $is_tag ) ? __( 'Update Tag' ) : __( 'Update Category' ); ?&gt;
</del><ins>+                &lt;?php $update_text = ( 'post_tag' == $taxonomy ) ? __( 'Update Tag' ) : __( 'Update Category' ); ?&gt;
</ins><span class="cx">                 &lt;a accesskey=&quot;s&quot; href=&quot;#inline-edit&quot; title=&quot;&lt;?php echo esc_attr( $update_text ); ?&gt;&quot; class=&quot;save button-primary alignright&quot;&gt;&lt;?php echo $update_text; ?&gt;&lt;/a&gt;
</span><span class="cx">                 &lt;img class=&quot;waiting&quot; style=&quot;display:none;&quot; src=&quot;images/wpspin_light.gif&quot; alt=&quot;&quot; /&gt;
</span><span class="cx">                 &lt;span class=&quot;error&quot; style=&quot;display:none;&quot;&gt;&lt;/span&gt;
</span><span class="lines">@@ -671,12 +670,18 @@
</span><span class="cx">  * @param unknown_type $class
</span><span class="cx">  * @return unknown
</span><span class="cx">  */
</span><del>-function _tag_row( $tag, $class = '', $taxonomy = 'post_tag' ) {
</del><ins>+function _tag_row( $tag, $level, $class = '', $taxonomy = 'post_tag' ) {
</ins><span class="cx">                 $count = number_format_i18n( $tag-&gt;count );
</span><del>-                $tagsel = ($taxonomy == 'post_tag' ? 'tag' : $taxonomy);
</del><ins>+                if ( 'post_tag' == $taxonomy ) 
+                        $tagsel = 'tag';
+                elseif ( 'category' == $taxonomy )
+                        $tagsel = 'category_name';
+                else
+                        $tagsel = $taxonomy;
</ins><span class="cx">                 $count = ( $count &gt; 0 ) ? &quot;&lt;a href='edit.php?$tagsel=$tag-&gt;slug'&gt;$count&lt;/a&gt;&quot; : $count;
</span><span class="cx"> 
</span><del>-                $name = apply_filters( 'term_name', $tag-&gt;name );
</del><ins>+                $pad = str_repeat( '&amp;#8212; ', max(0, $level) );
+                $name = apply_filters( 'term_name', $pad . ' ' . $tag-&gt;name );
</ins><span class="cx">                 $qe_data = get_term($tag-&gt;term_id, $taxonomy, object, 'edit');
</span><span class="cx">                 $edit_link = &quot;edit-tags.php?action=edit&amp;amp;taxonomy=$taxonomy&amp;amp;tag_ID=$tag-&gt;term_id&quot;;
</span><span class="cx">                 $out = '';
</span><span class="lines">@@ -694,15 +699,22 @@
</span><span class="cx"> 
</span><span class="cx">                         switch ($column_name) {
</span><span class="cx">                                 case 'cb':
</span><del>-                                        $out .= '&lt;th scope=&quot;row&quot; class=&quot;check-column&quot;&gt; &lt;input type=&quot;checkbox&quot; name=&quot;delete_tags[]&quot; value=&quot;' . $tag-&gt;term_id . '&quot; /&gt;&lt;/th&gt;';
</del><ins>+                                        if ( $tag-&gt;term_id != get_option('default_' . $taxonomy) )
+                                                $out .= '&lt;th scope=&quot;row&quot; class=&quot;check-column&quot;&gt; &lt;input type=&quot;checkbox&quot; name=&quot;delete_tags[]&quot; value=&quot;' . $tag-&gt;term_id . '&quot; /&gt;&lt;/th&gt;';
+                                        else
+                                                $out .= '&lt;th scope=&quot;row&quot; class=&quot;check-column&quot;&gt;&amp;nbsp;&lt;/th&gt;';
</ins><span class="cx">                                         break;
</span><span class="cx">                                 case 'name':
</span><span class="cx">                                         $out .= '&lt;td ' . $attributes . '&gt;&lt;strong&gt;&lt;a class=&quot;row-title&quot; href=&quot;' . $edit_link . '&quot; title=&quot;' . esc_attr(sprintf(__('Edit &amp;#8220;%s&amp;#8221;'), $name)) . '&quot;&gt;' . $name . '&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;';
</span><span class="cx">                                         $actions = array();
</span><span class="cx">                                         $actions['edit'] = '&lt;a href=&quot;' . $edit_link . '&quot;&gt;' . __('Edit') . '&lt;/a&gt;';
</span><span class="cx">                                         $actions['inline hide-if-no-js'] = '&lt;a href=&quot;#&quot; class=&quot;editinline&quot;&gt;' . __('Quick&amp;nbsp;Edit') . '&lt;/a&gt;';
</span><del>-                                        $actions['delete'] = &quot;&lt;a class='delete-tag' href='&quot; . wp_nonce_url(&quot;edit-tags.php?action=delete&amp;amp;taxonomy=$taxonomy&amp;amp;tag_ID=$tag-&gt;term_id&quot;, 'delete-tag_' . $tag-&gt;term_id) . &quot;'&gt;&quot; . __('Delete') . &quot;&lt;/a&gt;&quot;;
</del><ins>+                                        if ( $tag-&gt;term_id != get_option('default_' . $taxonomy) )
+                                                $actions['delete'] = &quot;&lt;a class='delete-tag' href='&quot; . wp_nonce_url(&quot;edit-tags.php?action=delete&amp;amp;taxonomy=$taxonomy&amp;amp;tag_ID=$tag-&gt;term_id&quot;, 'delete-tag_' . $tag-&gt;term_id) . &quot;'&gt;&quot; . __('Delete') . &quot;&lt;/a&gt;&quot;;
+
</ins><span class="cx">                                         $actions = apply_filters('tag_row_actions', $actions, $tag);
</span><ins>+                                        $actions = apply_filters(&quot;${taxonomy}_row_actions&quot;, $actions, $tag);
+
</ins><span class="cx">                                         $action_count = count($actions);
</span><span class="cx">                                         $i = 0;
</span><span class="cx">                                         $out .= '&lt;div class=&quot;row-actions&quot;&gt;';
</span><span class="lines">@@ -714,7 +726,8 @@
</span><span class="cx">                                         $out .= '&lt;/div&gt;';
</span><span class="cx">                                         $out .= '&lt;div class=&quot;hidden&quot; id=&quot;inline_' . $qe_data-&gt;term_id . '&quot;&gt;';
</span><span class="cx">                                         $out .= '&lt;div class=&quot;name&quot;&gt;' . $qe_data-&gt;name . '&lt;/div&gt;';
</span><del>-                                        $out .= '&lt;div class=&quot;slug&quot;&gt;' . apply_filters('editable_slug', $qe_data-&gt;slug) . '&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;';
</del><ins>+                                        $out .= '&lt;div class=&quot;slug&quot;&gt;' . apply_filters('editable_slug', $qe_data-&gt;slug) . '&lt;/div&gt;';
+                                        $out .= '&lt;div class=&quot;parent&quot;&gt;' . $qe_data-&gt;parent . '&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;';
</ins><span class="cx">                                         break;
</span><span class="cx">                                 case 'description':
</span><span class="cx">                                         $out .= &quot;&lt;td $attributes&gt;$tag-&gt;description&lt;/td&gt;&quot;;
</span><span class="lines">@@ -758,23 +771,85 @@
</span><span class="cx"> 
</span><span class="cx">         $args = array('offset' =&gt; $start, 'number' =&gt; $pagesize, 'hide_empty' =&gt; 0);
</span><span class="cx"> 
</span><del>-        if ( !empty( $searchterms ) ) {
</del><ins>+        if ( !empty( $searchterms ) )
</ins><span class="cx">                 $args['search'] = $searchterms;
</span><del>-        }
</del><span class="cx"> 
</span><del>-        $tags = get_terms( $taxonomy, $args );
-
</del><span class="cx">         // convert it to table rows
</span><span class="cx">         $out = '';
</span><span class="cx">         $count = 0;
</span><del>-        foreach( $tags as $tag )
-                $out .= _tag_row( $tag, ++$count % 2 ? ' class=&quot;alternate&quot;' : '', $taxonomy );
</del><ins>+        if ( is_taxonomy_hierarchical($taxonomy) ) {
+                // We'll need the full set of terms then.
+                $args['number'] = $args['offset'] = 0;
</ins><span class="cx"> 
</span><ins>+                $terms = get_terms( $taxonomy, $args );
+                if ( !empty( $searchterms ) ) // Ignore children on searches.
+                        $children = array();
+                else
+                        $children = _get_term_hierarchy($taxonomy);
+
+                // Some funky recursion to get the job done is contained within, Skip it for non-hierarchical taxonomies for performance sake
+                $out .= _term_rows($taxonomy, $terms, $children, $page, $pagesize, $count);
+        } else {
+                $terms = get_terms( $taxonomy, $args );
+                foreach( $terms as $term )
+                        $out .= _tag_row( $term, 0, ++$count % 2 ? ' class=&quot;alternate&quot;' : '', $taxonomy );
+        }
+
</ins><span class="cx">         // filter and send to screen
</span><span class="cx">         echo $out;
</span><span class="cx">         return $count;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function _term_rows( $taxonomy, $terms, &amp;$children, $page = 1, $per_page = 20, &amp;$count, $parent = 0, $level = 0 ) {
+
+        $start = ($page - 1) * $per_page;
+        $end = $start + $per_page;
+
+        $output = '';
+        foreach ( $terms as $key =&gt; $term ) {
+
+                if ( $count &gt;= $end )
+                        break;
+
+                if ( $term-&gt;parent != $parent &amp;&amp; empty($_GET['s']) )
+                        continue;
+
+                // If the page starts in a subtree, print the parents.
+                if ( $count == $start &amp;&amp; $term-&gt;parent &gt; 0 &amp;&amp; empty($_GET['s']) ) {
+                        $my_parents = $parent_ids = array();
+                        $p = $term-&gt;parent;
+                        while ( $p ) {
+                                $my_parent = get_term( $p, $taxonomy );
+                                $my_parents[] = $my_parent;
+                                $p = $my_parent-&gt;parent;
+                                if ( in_array($p, $parent_ids) ) // Prevent parent loops.
+                                        break;
+                                $parent_ids[] = $p;
+                        }
+                        unset($parent_ids);
+
+                        $num_parents = count($my_parents);
+                        $count -= $num_parents; // Do not include parents in the per-page count, This is due to paging issues with unknown numbers of rows.
+                        while ( $my_parent = array_pop($my_parents) ) {
+                                $output .=  &quot;\t&quot; . _tag_row( $my_parent, $level - $num_parents, ++$count % 2 ? ' class=&quot;alternate&quot;' : '', $taxonomy );
+                                $num_parents--;
+                        }
+                }
+
+                if ( $count &gt;= $start )
+                        $output .= &quot;\t&quot; . _tag_row( $term, $level, ++$count % 2 ? ' class=&quot;alternate&quot;' : '', $taxonomy );
+                else
+                        ++$count;
+
+                unset($terms[$key]);
+
+                if ( isset($children[$term-&gt;term_id]) )
+                        $output .= _term_rows( $taxonomy, $terms, $children, $page, $per_page, $count, $term-&gt;term_id, $level + 1 );
+        }
+
+        return $output;
+}
+
</ins><span class="cx"> // define the columns to display, the syntax is 'internal name' =&gt; 'display name'
</span><span class="cx"> /**
</span><span class="cx">  * {@internal Missing Short Description}}
</span></span></pre></div>
<a id="trunkwpadminjstagsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/tags.dev.js (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/tags.dev.js        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/js/tags.dev.js        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -34,7 +34,11 @@
</span><span class="cx">                                 $('#ajax-response').append(r);
</span><span class="cx">                         } else {
</span><span class="cx">                                 $('#ajax-response').empty();
</span><del>-                                $('#the-list').prepend(r);
</del><ins>+                                var parent = form.find('select#parent').val();
+                                if ( parent &gt; 0 &amp;&amp; $('#tag-' + parent ).length &gt; 0 ) // If the parent exists on this page, insert it below. Else insert it at the top of the list.
+                                        $('#the-list #tag-' + parent).after(r);
+                                else
+                                        $('#the-list').prepend(r);
</ins><span class="cx">                                 $('input[type=&quot;text&quot;]:visible, textarea:visible', form).val('');
</span><span class="cx">                         }
</span><span class="cx">                 });
</span><span class="lines">@@ -42,4 +46,4 @@
</span><span class="cx">                 return false;
</span><span class="cx">         });
</span><span class="cx"> 
</span><del>-});
</del><ins>+});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjstagsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/tags.js (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/tags.js        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/js/tags.js        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -1 +1 @@
</span><del>-jQuery(document).ready(function(a){a(&quot;.delete-tag&quot;).live(&quot;click&quot;,function(g){var b=a(this),f=b.parents(&quot;tr&quot;),c=true,d;if(&quot;undefined&quot;!=showNotice){c=showNotice.warn()}if(c){d=b.attr(&quot;href&quot;).replace(/[^?]*\?/,&quot;&quot;).replace(/action=delete/,&quot;action=delete-tag&quot;);a.post(ajaxurl,d,function(e){if(&quot;1&quot;==e){a(&quot;#ajax-response&quot;).empty();f.fadeOut(&quot;normal&quot;,function(){f.remove()})}else{if(&quot;-1&quot;==e){a(&quot;#ajax-response&quot;).empty().append('&lt;div class=&quot;error&quot;&gt;&lt;p&gt;'+tagsl10n.noPerm+&quot;&lt;/p&gt;&lt;/div&gt;&quot;);f.children().css(&quot;backgroundColor&quot;,&quot;&quot;)}else{a(&quot;#ajax-response&quot;).empty().append('&lt;div class=&quot;error&quot;&gt;&lt;p&gt;'+tagsl10n.broken+&quot;&lt;/p&gt;&lt;/div&gt;&quot;);f.children().css(&quot;backgroundColor&quot;,&quot;&quot;)}}});f.children().css(&quot;backgroundColor&quot;,&quot;#f33&quot;)}return false});a(&quot;#submit&quot;).click(function(){var b=a(this).parents(&quot;form&quot;);if(!validateForm(b)){return false}a.post(ajaxurl,a(&quot;#addtag&quot;).serialize(),function(c){if(c.indexOf('&lt;div class=&quot;error&quot;')===0){a(&quot;#ajax-response&quot;).append(c)}else{a(&quot;#ajax-response&quot;).empty();a(&quot;#the-list&quot;).prepend(c);a('input[type=&quot;text&quot;]:visible, textarea:visible',b).val(&quot;&quot;)}});return false})});
</del><span class="cx">\ No newline at end of file
</span><ins>+jQuery(document).ready(function($){$(&quot;.delete-tag&quot;).live(&quot;click&quot;,function(e){var t=$(this),tr=t.parents(&quot;tr&quot;),r=true,data;if(&quot;undefined&quot;!=showNotice){r=showNotice.warn()}if(r){data=t.attr(&quot;href&quot;).replace(/[^?]*\?/,&quot;&quot;).replace(/action=delete/,&quot;action=delete-tag&quot;);$.post(ajaxurl,data,function(r){if(&quot;1&quot;==r){$(&quot;#ajax-response&quot;).empty();tr.fadeOut(&quot;normal&quot;,function(){tr.remove()})}else{if(&quot;-1&quot;==r){$(&quot;#ajax-response&quot;).empty().append('&lt;div class=&quot;error&quot;&gt;&lt;p&gt;'+tagsl10n.noPerm+&quot;&lt;/p&gt;&lt;/div&gt;&quot;);tr.children().css(&quot;backgroundColor&quot;,&quot;&quot;)}else{$(&quot;#ajax-response&quot;).empty().append('&lt;div class=&quot;error&quot;&gt;&lt;p&gt;'+tagsl10n.broken+&quot;&lt;/p&gt;&lt;/div&gt;&quot;);tr.children().css(&quot;backgroundColor&quot;,&quot;&quot;)}}});tr.children().css(&quot;backgroundColor&quot;,&quot;#f33&quot;)}return false});$(&quot;#submit&quot;).click(function(){var form=$(this).parents(&quot;form&quot;);if(!validateForm(form)){return false}$.post(ajaxurl,$(&quot;#addtag&quot;).serialize(),function(r){if(r.indexOf('&lt;div class=&quot;error&quot;')===0){$(&quot;#ajax-response&quot;).append(r)}else{$(&quot;#ajax-response&quot;).empty();var parent=form.find(&quot;select#parent&quot;).val();if(parent&gt;0&amp;&amp;$(&quot;#tag-&quot;+parent).length&gt;0){$(&quot;#the-list #tag-&quot;+parent).after(r)}else{$(&quot;#the-list&quot;).prepend(r)}$('input[type=&quot;text&quot;]:visible, textarea:visible',form).val(&quot;&quot;)}});return false})});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-admin/menu.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -50,11 +50,7 @@
</span><span class="cx">                 if ( ! in_array('post', (array) $tax-&gt;object_type, true) )
</span><span class="cx">                         continue;
</span><span class="cx"> 
</span><del>-                if ( $tax-&gt;hierarchical )
-                        $submenu['edit.php'][$i] = array( esc_attr($tax-&gt;label), 'manage_categories', 'categories.php?taxonomy=' . $tax-&gt;name );
-                else
-                        $submenu['edit.php'][$i] = array( esc_attr($tax-&gt;label), 'manage_categories', 'edit-tags.php?taxonomy=' . $tax-&gt;name );
-                ++$i;
</del><ins>+                $submenu['edit.php'][$i++] = array( esc_attr($tax-&gt;label), 'manage_categories', 'edit-tags.php?taxonomy=' . $tax-&gt;name );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx"> $menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top', 'menu-media', 'div' );
</span><span class="lines">@@ -90,11 +86,7 @@
</span><span class="cx">                 if ( ! in_array($ptype, (array) $tax-&gt;object_type, true) )
</span><span class="cx">                         continue;
</span><span class="cx"> 
</span><del>-                if ( $tax-&gt;hierarchical )
-                        $submenu[&quot;edit.php?post_type=$ptype&quot;][$i] = array( esc_attr($tax-&gt;label), 'manage_categories', &quot;categories.php?taxonomy=$tax-&gt;name&amp;amp;post_type=$ptype&quot; );
-                else
-                        $submenu[&quot;edit.php?post_type=$ptype&quot;][$i] = array( esc_attr($tax-&gt;label), 'manage_categories', &quot;edit-tags.php?taxonomy=$tax-&gt;name&amp;amp;post_type=$ptype&quot; );
-                ++$i;
</del><ins>+                $submenu[&quot;edit.php?post_type=$ptype&quot;][$i++] = array( esc_attr($tax-&gt;label), 'manage_categories', &quot;edit-tags.php?taxonomy=$tax-&gt;name&amp;amp;post_type=$ptype&quot; );
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> unset($ptype, $ptype_obj);
</span></span></pre></div>
<a id="trunkwpincludestaxonomyphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/taxonomy.php (12817 => 12818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/taxonomy.php        2010-01-24 06:16:17 UTC (rev 12817)
+++ trunk/wp-includes/taxonomy.php        2010-01-24 11:00:27 UTC (rev 12818)
</span><span class="lines">@@ -786,13 +786,13 @@
</span><span class="cx"> 
</span><span class="cx">         // don't limit the query results when we have to descend the family tree
</span><span class="cx">         if ( ! empty($number) &amp;&amp; ! $hierarchical &amp;&amp; empty( $child_of ) &amp;&amp; '' === $parent ) {
</span><del>-                if( $offset )
</del><ins>+                if ( $offset )
</ins><span class="cx">                         $limit = 'LIMIT ' . $offset . ',' . $number;
</span><span class="cx">                 else
</span><span class="cx">                         $limit = 'LIMIT ' . $number;
</span><del>-
-        } else
</del><ins>+        } else {
</ins><span class="cx">                 $limit = '';
</span><ins>+        }
</ins><span class="cx"> 
</span><span class="cx">         if ( !empty($search) ) {
</span><span class="cx">                 $search = like_escape($search);
</span><span class="lines">@@ -2446,4 +2446,5 @@
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> ?&gt;
</span></span></pre>
</div>
</div>

</body>
</html>