<!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>[13535] trunk/wp-admin: Custom taxonomy support for inline edit.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13535">13535</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-03-01 15:48:01 +0000 (Mon, 01 Mar 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Custom taxonomy support for inline edit. Props  prettyboymp. see <a href="http://trac.wordpress.org/ticket/9674">#9674</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludespostphp">trunk/wp-admin/includes/post.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminjsinlineeditpostdevjs">trunk/wp-admin/js/inline-edit-post.dev.js</a></li>
<li><a href="#trunkwpadminjsinlineeditpostjs">trunk/wp-admin/js/inline-edit-post.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/post.php (13534 => 13535)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/post.php        2010-03-01 15:28:20 UTC (rev 13534)
+++ trunk/wp-admin/includes/post.php        2010-03-01 15:48:01 UTC (rev 13535)
</span><span class="lines">@@ -254,7 +254,7 @@
</span><span class="cx"> 
</span><span class="cx">         $post_IDs = array_map( 'intval', (array) $post_data['post'] );
</span><span class="cx"> 
</span><del>-        $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tags_input', 'post_category', 'sticky' );
</del><ins>+        $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tax_input', 'post_category', 'sticky' );
</ins><span class="cx">         foreach ( $reset as $field ) {
</span><span class="cx">                 if ( isset($post_data[$field]) &amp;&amp; ( '' == $post_data[$field] || -1 == $post_data[$field] ) )
</span><span class="cx">                         unset($post_data[$field]);
</span><span class="lines">@@ -266,10 +266,20 @@
</span><span class="cx">                 else
</span><span class="cx">                         unset($post_data['post_category']);
</span><span class="cx">         }
</span><del>-
-        if ( isset($post_data['tags_input']) ) {
-                $new_tags = preg_replace( '/\s*,\s*/', ',', rtrim( trim($post_data['tags_input']), ' ,' ) );
-                $new_tags = explode(',', $new_tags);
</del><ins>+        
+        $tax_input = array();
+        if ( isset($post_data['tax_input'])) {
+                foreach ( $post_data['tax_input'] as $tax_name =&gt; $terms ) {
+                        if ( empty($terms) )
+                                continue;
+                        $taxonomy = get_taxonomy( $tax_name );
+                        if ( $taxonomy-&gt;hierarchical )
+                                $tax_input[$tax_name] = array_map( 'absint', $terms );                        
+                        else {
+                                $tax_input[$tax_name] = preg_replace( '/\s*,\s*/', ',', rtrim( trim($terms), ' ,' ) );
+                                $tax_input[$tax_name] = explode(',', $tax_input[$tax_name]);
+                        }
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( isset($post_data['post_parent']) &amp;&amp; ($parent = (int) $post_data['post_parent']) ) {
</span><span class="lines">@@ -300,15 +310,23 @@
</span><span class="cx">                         $locked[] = $post_ID;
</span><span class="cx">                         continue;
</span><span class="cx">                 }
</span><del>-
-                if ( isset($new_cats) ) {
</del><ins>+                
+                $tax_names = get_object_taxonomies( get_post($post_ID) );
+                
+                if ( isset($new_cats) &amp;&amp; in_array( 'category', $tax_names ) ) {
</ins><span class="cx">                         $cats = (array) wp_get_post_categories($post_ID);
</span><span class="cx">                         $post_data['post_category'] = array_unique( array_merge($cats, $new_cats) );
</span><span class="cx">                 }
</span><del>-
-                if ( isset($new_tags) ) {
-                        $tags = wp_get_post_tags($post_ID, array('fields' =&gt; 'names'));
-                        $post_data['tags_input'] = array_unique( array_merge($tags, $new_tags) );
</del><ins>+                
+                foreach ( $tax_names as $tax_name ) {
+                        if( isset( $tax_input[$tax_name])  ) {
+                                $taxonomy = get_taxonomy( $tax_name );
+                                if( $taxonomy-&gt;hierarchical )
+                                        $terms = (array) wp_get_object_terms( $post_ID, $tax_name, array('fields' =&gt; 'ids') );
+                                else
+                                        $terms = (array) wp_get_object_terms( $post_ID, $tax_name, array('fields' =&gt; 'names') );
+                                $post_data['tax_input'][$tax_name] = array_merge( $terms, $tax_input[$tax_name] );
+                        }
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 $post_data['ID'] = $post_ID;
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (13534 => 13535)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-03-01 15:28:20 UTC (rev 13534)
+++ trunk/wp-admin/includes/template.php        2010-03-01 15:48:01 UTC (rev 13535)
</span><span class="lines">@@ -911,6 +911,20 @@
</span><span class="cx">         $post = get_default_post_to_edit( $screen-&gt;post_type );
</span><span class="cx">         $post_type_object = get_post_type_object( $screen-&gt;post_type );
</span><span class="cx"> 
</span><ins>+        $taxonomy_names = get_object_taxonomies( $screen-&gt;post_type );
+        $hierarchical_taxonomies = array();
+        $flat_taxonomies = array();
+        foreach ( $taxonomy_names as $taxonomy_name ) {
+                $taxonomy = get_taxonomy( $taxonomy_name);
+                
+                if( !$taxonomy-&gt;show_ui ) continue;
+                
+                if( $taxonomy-&gt;hierarchical )
+                        $hierarchical_taxonomies[] = $taxonomy;
+                else 
+                        $flat_taxonomies[] = $taxonomy;
+        }
+        
</ins><span class="cx">         $columns = wp_manage_posts_columns($screen);
</span><span class="cx">         $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) );
</span><span class="cx">         $col_count = count($columns) - count($hidden);
</span><span class="lines">@@ -1002,19 +1016,25 @@
</span><span class="cx"> 
</span><span class="cx">         &lt;/div&gt;&lt;/fieldset&gt;
</span><span class="cx"> 
</span><del>-&lt;?php if ( is_object_in_taxonomy($screen-&gt;post_type, 'category') &amp;&amp; !$bulk ) : ?&gt;
</del><ins>+&lt;?php if ( count($hierarchical_taxonomies) &amp;&amp; !$bulk ) : ?&gt;
</ins><span class="cx"> 
</span><span class="cx">         &lt;fieldset class=&quot;inline-edit-col-center inline-edit-categories&quot;&gt;&lt;div class=&quot;inline-edit-col&quot;&gt;
</span><del>-                &lt;span class=&quot;title inline-edit-categories-label&quot;&gt;&lt;?php _e( 'Categories' ); ?&gt;
</del><ins>+        
+&lt;?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?&gt;
+
+                &lt;span class=&quot;title inline-edit-categories-label&quot;&gt;&lt;?php echo esc_html($taxonomy-&gt;label) ?&gt;
</ins><span class="cx">                         &lt;span class=&quot;catshow&quot;&gt;&lt;?php _e('[more]'); ?&gt;&lt;/span&gt;
</span><span class="cx">                         &lt;span class=&quot;cathide&quot; style=&quot;display:none;&quot;&gt;&lt;?php _e('[less]'); ?&gt;&lt;/span&gt;
</span><span class="cx">                 &lt;/span&gt;
</span><del>-                &lt;ul class=&quot;cat-checklist&quot;&gt;
-                        &lt;?php wp_category_checklist(); ?&gt;
</del><ins>+                &lt;ul class=&quot;cat-checklist &lt;?php echo esc_attr($taxonomy-&gt;name)?&gt;-checklist&quot;&gt;
+                        &lt;?php wp_terms_checklist(null, array('taxonomy' =&gt; $taxonomy-&gt;name)) ?&gt;
</ins><span class="cx">                 &lt;/ul&gt;
</span><ins>+
+&lt;?php endforeach; //$hierarchical_taxonomies as $taxonomy ?&gt;
+
</ins><span class="cx">         &lt;/div&gt;&lt;/fieldset&gt;
</span><span class="cx"> 
</span><del>-&lt;?php endif; // is_object_in_taxonomy($screen-&gt;post_type, 'category') &amp;&amp; !$bulk ?&gt;
</del><ins>+&lt;?php endif; // count($hierarchical_taxonomies) &amp;&amp; !$bulk ?&gt;
</ins><span class="cx"> 
</span><span class="cx">         &lt;fieldset class=&quot;inline-edit-col-right&quot;&gt;&lt;div class=&quot;inline-edit-col&quot;&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -1058,15 +1078,19 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;?php endif; // $post_type_object-&gt;hierarchical ?&gt;
</span><span class="cx"> 
</span><del>-&lt;?php if ( is_object_in_taxonomy($screen-&gt;post_type, 'post_tag') &amp;&amp; !$bulk ) : ?&gt;
</del><ins>+&lt;?php if ( count($flat_taxonomies) &amp;&amp; !$bulk ) : ?&gt;
</ins><span class="cx"> 
</span><ins>+&lt;?php foreach ( $flat_taxonomies as $taxonomy ) : ?&gt;
+
</ins><span class="cx">                 &lt;label class=&quot;inline-edit-tags&quot;&gt;
</span><del>-                        &lt;span class=&quot;title&quot;&gt;&lt;?php _e( 'Tags' ); ?&gt;&lt;/span&gt;
-                        &lt;textarea cols=&quot;22&quot; rows=&quot;1&quot; name=&quot;tags_input&quot; class=&quot;tags_input&quot;&gt;&lt;/textarea&gt;
</del><ins>+                        &lt;span class=&quot;title&quot;&gt;&lt;?php echo esc_html($taxonomy-&gt;label) ?&gt;&lt;/span&gt;
+                        &lt;textarea cols=&quot;22&quot; rows=&quot;1&quot; name=&quot;tax_input[&lt;?php echo esc_attr($taxonomy-&gt;name)?&gt;]&quot; class=&quot;tax_input_&lt;?php echo esc_attr($taxonomy-&gt;name)?&gt;&quot;&gt;&lt;/textarea&gt;
</ins><span class="cx">                 &lt;/label&gt;
</span><span class="cx"> 
</span><del>-&lt;?php endif; // is_object_in_taxonomy($screen-&gt;post_type, 'post_tag') &amp;&amp; !$bulk  ?&gt;
</del><ins>+&lt;?php endforeach; //$flat_taxonomies as $taxonomy ?&gt;
</ins><span class="cx"> 
</span><ins>+&lt;?php endif; // count($flat_taxonomies) &amp;&amp; !$bulk  ?&gt;
+
</ins><span class="cx"> &lt;?php if ( $bulk ) : ?&gt;
</span><span class="cx"> 
</span><span class="cx">                 &lt;div class=&quot;inline-edit-group&quot;&gt;
</span><span class="lines">@@ -1225,13 +1249,17 @@
</span><span class="cx">         if ( $post_type_object-&gt;hierarchical )
</span><span class="cx">                 echo '&lt;div class=&quot;menu_order&quot;&gt;' . $post-&gt;menu_order . '&lt;/div&gt;';
</span><span class="cx"> 
</span><del>-        if ( is_object_in_taxonomy($post-&gt;post_type, 'post_tag') )
-                echo '&lt;div class=&quot;tags_input&quot;&gt;' . esc_html( str_replace( ',', ', ', get_tags_to_edit($post-&gt;ID) ) ) . '&lt;/div&gt;';
</del><ins>+        $taxonomy_names = get_object_taxonomies( $post-&gt;post_type );
+        foreach ( $taxonomy_names as $taxonomy_name) {
+                $taxonomy = get_taxonomy( $taxonomy_name );
</ins><span class="cx"> 
</span><del>-        if ( is_object_in_taxonomy($post-&gt;post_type, 'post_tag') )
-                echo '&lt;div class=&quot;post_category&quot;&gt;' . implode( ',', wp_get_post_categories( $post-&gt;ID ) ) . '&lt;/div&gt;';
</del><ins>+                if ( $taxonomy-&gt;hierarchical &amp;&amp; $taxonomy-&gt;show_ui )
+                                echo '&lt;div class=&quot;post_category&quot; id=&quot;'.$taxonomy_name.'_'.$post-&gt;ID.'&quot;&gt;' . implode( ',', wp_get_object_terms( $post-&gt;ID, $taxonomy_name, array('fields'=&gt;'ids')) ) . '&lt;/div&gt;';
+                elseif ( $taxonomy-&gt;show_ui )
+                        echo '&lt;div class=&quot;tags_input&quot; id=&quot;'.$taxonomy_name.'_'.$post-&gt;ID.'&quot;&gt;' . esc_html( str_replace( ',', ', ', get_terms_to_edit($post-&gt;ID, $taxonomy_name) ) ) . '&lt;/div&gt;';
+        }
</ins><span class="cx"> 
</span><del>-        if ( $post-&gt;post_type == 'post' )
</del><ins>+        if ( !$post_type_object-&gt;hierarchical )
</ins><span class="cx">                 echo '&lt;div class=&quot;sticky&quot;&gt;' . (is_sticky($post-&gt;ID) ? 'sticky' : '') . '&lt;/div&gt;';
</span><span class="cx"> 
</span><span class="cx">         echo '&lt;/div&gt;';
</span></span></pre></div>
<a id="trunkwpadminjsinlineeditpostdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/inline-edit-post.dev.js (13534 => 13535)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/inline-edit-post.dev.js        2010-03-01 15:28:20 UTC (rev 13534)
+++ trunk/wp-admin/js/inline-edit-post.dev.js        2010-03-01 15:48:01 UTC (rev 13535)
</span><span class="lines">@@ -36,17 +36,13 @@
</span><span class="cx">                         $('#inline-edit label.inline-edit-tags').clone()
</span><span class="cx">                 );
</span><span class="cx"> 
</span><del>-                // categories expandable?
</del><ins>+                // hiearchical taxonomies expandable?
</ins><span class="cx">                 $('span.catshow').click(function() {
</span><del>-                        $('.inline-editor ul.cat-checklist').addClass(&quot;cat-hover&quot;);
-                        $('.inline-editor span.cathide').show();
-                        $(this).hide();
</del><ins>+                        $(this).hide().next().show().parent().next().addClass(&quot;cat-hover&quot;);
</ins><span class="cx">                 });
</span><span class="cx"> 
</span><span class="cx">                 $('span.cathide').click(function() {
</span><del>-                        $('.inline-editor ul.cat-checklist').removeClass(&quot;cat-hover&quot;);
-                        $('.inline-editor span.catshow').show();
-                        $(this).hide();
</del><ins>+                        $(this).hide().prev().show().parent().next().removeClass(&quot;cat-hover&quot;);
</ins><span class="cx">                 });
</span><span class="cx"> 
</span><span class="cx">                 $('select[name=&quot;_status&quot;] option[value=&quot;future&quot;]', bulkRow).remove();
</span><span class="lines">@@ -118,7 +114,6 @@
</span><span class="cx"> 
</span><span class="cx">                 fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password'];
</span><span class="cx">                 if ( t.type == 'page' ) fields.push('post_parent', 'menu_order', 'page_template');
</span><del>-                if ( t.type == 'post' ) fields.push('tags_input');
</del><span class="cx"> 
</span><span class="cx">                 // add the new blank row
</span><span class="cx">                 editRow = $('#inline-edit').clone(true);
</span><span class="lines">@@ -146,9 +141,24 @@
</span><span class="cx">                 if ( $('.sticky', rowData).text() == 'sticky' )
</span><span class="cx">                         $('input[name=&quot;sticky&quot;]', editRow).attr(&quot;checked&quot;, &quot;checked&quot;);
</span><span class="cx"> 
</span><del>-                // categories
-                if ( cats = $('.post_category', rowData).text() )
-                        $('ul.cat-checklist :checkbox', editRow).val(cats.split(','));
</del><ins>+                // hierarchical taxonomies
+                $('.post_category', rowData).each(function(){
+                        if( term_ids = $(this).text() )
+                        {
+                                taxname = $(this).attr('id').replace('_'+id, '');
+                                $('ul.'+taxname+'-checklist :checkbox', editRow).val(term_ids.split(','));
+                        }
+                });
+                //flat taxonomies
+                $('.tags_input', rowData).each(function(){
+                        if( terms = $(this).text() )
+                        {
+                                taxname = $(this).attr('id').replace('_'+id, '');
+                                $('textarea.tax_input_'+taxname, editRow).val(terms);
+                                $('textarea.tax_input_'+taxname, editRow).suggest( 'admin-ajax.php?action=ajax-tag-search&amp;tax='+taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: &quot;, &quot; } );
+                        }
+                });
+                
</ins><span class="cx"> 
</span><span class="cx">                 // handle the post status
</span><span class="cx">                 status = $('._status', rowData).text();
</span><span class="lines">@@ -180,12 +190,6 @@
</span><span class="cx">                 $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
</span><span class="cx">                 $('.ptitle', editRow).focus();
</span><span class="cx"> 
</span><del>-                // enable autocomplete for tags
-                if ( t.type == 'post' ) {
-                        tax = 'post_tag';
-                        $('tr.inline-editor textarea[name=&quot;tags_input&quot;]').suggest( 'admin-ajax.php?action=ajax-tag-search&amp;tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: &quot;, &quot; } );
-                }
-
</del><span class="cx">                 return false;
</span><span class="cx">         },
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminjsinlineeditpostjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/inline-edit-post.js (13534 => 13535)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/inline-edit-post.js        2010-03-01 15:28:20 UTC (rev 13534)
+++ trunk/wp-admin/js/inline-edit-post.js        2010-03-01 15:48:01 UTC (rev 13535)
</span><span class="lines">@@ -1 +1 @@
</span><del>-(function(a){inlineEditPost={init:function(){var c=this,d=a(&quot;#inline-edit&quot;),b=a(&quot;#bulk-edit&quot;);c.type=a(&quot;table.widefat&quot;).hasClass(&quot;page&quot;)?&quot;page&quot;:&quot;post&quot;;c.what=&quot;#&quot;+c.type+&quot;-&quot;;d.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});b.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});a(&quot;a.cancel&quot;,d).click(function(){return inlineEditPost.revert()});a(&quot;a.save&quot;,d).click(function(){return inlineEditPost.save(this)});a(&quot;td&quot;,d).keydown(function(f){if(f.which==13){return inlineEditPost.save(this)}});a(&quot;a.cancel&quot;,b).click(function(){return inlineEditPost.revert()});a(&quot;#inline-edit .inline-edit-private input[value=private]&quot;).click(function(){var e=a(&quot;input.inline-edit-password-input&quot;);if(a(this).attr(&quot;checked&quot;)){e.val(&quot;&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;)}else{e.attr(&quot;disabled&quot;,&quot;&quot;)}});a(&quot;a.editinline&quot;).live(&quot;click&quot;,function(){inlineEditPost.edit(this);return false});a(&quot;#bulk-title-div&quot;).parents(&quot;fieldset&quot;).after(a(&quot;#inline-edit fieldset.inline-edit-categories&quot;).clone()).siblings(&quot;fieldset:last&quot;).prepend(a(&quot;#inline-edit label.inline-edit-tags&quot;).clone());a(&quot;span.catshow&quot;).click(function(){a(&quot;.inline-editor ul.cat-checklist&quot;).addClass(&quot;cat-hover&quot;);a(&quot;.inline-editor span.cathide&quot;).show();a(this).hide()});a(&quot;span.cathide&quot;).click(function(){a(&quot;.inline-editor ul.cat-checklist&quot;).removeClass(&quot;cat-hover&quot;);a(&quot;.inline-editor span.catshow&quot;).show();a(this).hide()});a('select[name=&quot;_status&quot;] option[value=&quot;future&quot;]',b).remove();a(&quot;#doaction, #doaction2&quot;).click(function(f){var g=a(this).attr(&quot;id&quot;).substr(2);if(a('select[name=&quot;'+g+'&quot;]').val()==&quot;edit&quot;){f.preventDefault();c.setBulk()}else{if(a(&quot;form#posts-filter tr.inline-editor&quot;).length&gt;0){c.revert()}}});a(&quot;#post-query-submit&quot;).click(function(f){if(a(&quot;form#posts-filter tr.inline-editor&quot;).length&gt;0){c.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css(&quot;display&quot;)==&quot;none&quot;?b.revert():b.edit(c)},setBulk:function(){var e=&quot;&quot;,d=this.type,b,f=true;this.revert();a(&quot;#bulk-edit td&quot;).attr(&quot;colspan&quot;,a(&quot;.widefat:first thead th:visible&quot;).length);a(&quot;table.widefat tbody&quot;).prepend(a(&quot;#bulk-edit&quot;));a(&quot;#bulk-edit&quot;).addClass(&quot;inline-editor&quot;).show();a('tbody th.check-column input[type=&quot;checkbox&quot;]').each(function(g){if(a(this).attr(&quot;checked&quot;)){f=false;var h=a(this).val(),c;c=a(&quot;#inline_&quot;+h+&quot; .post_title&quot;).text()||inlineEditL10n.notitle;e+='&lt;div id=&quot;ttle'+h+'&quot;&gt;&lt;a id=&quot;_'+h+'&quot; class=&quot;ntdelbutton&quot; title=&quot;'+inlineEditL10n.ntdeltitle+'&quot;&gt;X&lt;/a&gt;'+c+&quot;&lt;/div&gt;&quot;}});if(f){return this.revert()}a(&quot;#bulk-titles&quot;).html(e);a(&quot;#bulk-titles a&quot;).click(function(){var c=a(this).attr(&quot;id&quot;).substr(1);a('table.widefat input[value=&quot;'+c+'&quot;]').attr(&quot;checked&quot;,&quot;&quot;);a(&quot;#ttle&quot;+c).remove()});if(d==&quot;post&quot;){b=&quot;post_tag&quot;;a('tr.inline-editor textarea[name=&quot;tags_input&quot;]').suggest(&quot;admin-ajax.php?action=ajax-tag-search&amp;tax=&quot;+b,{delay:500,minchars:2,multiple:true,multipleSep:&quot;, &quot;})}},edit:function(b){var o=this,j,d,g,n,i,h,k,m,l,c=true,p,e;o.revert();if(typeof(b)==&quot;object&quot;){b=o.getId(b)}j=[&quot;post_title&quot;,&quot;post_name&quot;,&quot;post_author&quot;,&quot;_status&quot;,&quot;jj&quot;,&quot;mm&quot;,&quot;aa&quot;,&quot;hh&quot;,&quot;mn&quot;,&quot;ss&quot;,&quot;post_password&quot;];if(o.type==&quot;page&quot;){j.push(&quot;post_parent&quot;,&quot;menu_order&quot;,&quot;page_template&quot;)}if(o.type==&quot;post&quot;){j.push(&quot;tags_input&quot;)}d=a(&quot;#inline-edit&quot;).clone(true);a(&quot;td&quot;,d).attr(&quot;colspan&quot;,a(&quot;.widefat:first thead th:visible&quot;).length);if(a(o.what+b).hasClass(&quot;alternate&quot;)){a(d).addClass(&quot;alternate&quot;)}a(o.what+b).hide().after(d);g=a(&quot;#inline_&quot;+b);if(!a(':input[name=&quot;post_author&quot;] option[value='+a(&quot;.post_author&quot;,g).text()+&quot;]&quot;,d).val()){a(':input[name=&quot;post_author&quot;]',d).prepend('&lt;option value=&quot;'+a(&quot;.post_author&quot;,g).text()+'&quot;&gt;'+a(&quot;#&quot;+o.type+&quot;-&quot;+b+&quot; .author&quot;).text()+&quot;&lt;/option&gt;&quot;)}for(k=0;k&lt;j.length;k++){a(':input[name=&quot;'+j[k]+'&quot;]',d).val(a(&quot;.&quot;+j[k],g).text())}if(a(&quot;.comment_status&quot;,g).text()==&quot;open&quot;){a('input[name=&quot;comment_status&quot;]',d).attr(&quot;checked&quot;,&quot;checked&quot;)}if(a(&quot;.ping_status&quot;,g).text()==&quot;open&quot;){a('input[name=&quot;ping_status&quot;]',d).attr(&quot;checked&quot;,&quot;checked&quot;)}if(a(&quot;.sticky&quot;,g).text()==&quot;sticky&quot;){a('input[name=&quot;sticky&quot;]',d).attr(&quot;checked&quot;,&quot;checked&quot;)}if(n=a(&quot;.post_category&quot;,g).text()){a(&quot;ul.cat-checklist :checkbox&quot;,d).val(n.split(&quot;,&quot;))}i=a(&quot;._status&quot;,g).text();if(i!=&quot;future&quot;){a('select[name=&quot;_status&quot;] option[value=&quot;future&quot;]',d).remove()}if(i==&quot;private&quot;){a('input[name=&quot;keep_private&quot;]',d).attr(&quot;checked&quot;,&quot;checked&quot;);a(&quot;input.inline-edit-password-input&quot;).val(&quot;&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;)}h=a('select[name=&quot;post_parent&quot;] option[value=&quot;'+b+'&quot;]',d);if(h.length&gt;0){m=h[0].className.split(&quot;-&quot;)[1];l=h;while(c){l=l.next(&quot;option&quot;);if(l.length==0){break}p=l[0].className.split(&quot;-&quot;)[1];if(p&lt;=m){c=false}else{l.remove();l=h}}h.remove()}a(d).attr(&quot;id&quot;,&quot;edit-&quot;+b).addClass(&quot;inline-editor&quot;).show();a(&quot;.ptitle&quot;,d).focus();if(o.type==&quot;post&quot;){e=&quot;post_tag&quot;;a('tr.inline-editor textarea[name=&quot;tags_input&quot;]').suggest(&quot;admin-ajax.php?action=ajax-tag-search&amp;tax=&quot;+e,{delay:500,minchars:2,multiple:true,multipleSep:&quot;, &quot;})}return false},save:function(e){var d,b,c=a(&quot;.post_status_page&quot;).val()||&quot;&quot;;if(typeof(e)==&quot;object&quot;){e=this.getId(e)}a(&quot;table.widefat .inline-edit-save .waiting&quot;).show();d={action:&quot;inline-save&quot;,post_type:typenow,post_ID:e,edit_date:&quot;true&quot;,post_status:c};b=a(&quot;#edit-&quot;+e+&quot; :input&quot;).serialize();d=b+&quot;&amp;&quot;+a.param(d);a.post(&quot;admin-ajax.php&quot;,d,function(f){a(&quot;table.widefat .inline-edit-save .waiting&quot;).hide();if(f){if(-1!=f.indexOf(&quot;&lt;tr&quot;)){a(inlineEditPost.what+e).remove();a(&quot;#edit-&quot;+e).before(f).remove();a(inlineEditPost.what+e).hide().fadeIn()}else{f=f.replace(/&lt;.[^&lt;&gt;]*?&gt;/g,&quot;&quot;);a(&quot;#edit-&quot;+e+&quot; .inline-edit-save&quot;).append('&lt;span class=&quot;error&quot;&gt;'+f+&quot;&lt;/span&gt;&quot;)}}else{a(&quot;#edit-&quot;+e+&quot; .inline-edit-save&quot;).append('&lt;span class=&quot;error&quot;&gt;'+inlineEditL10n.error+&quot;&lt;/span&gt;&quot;)}},&quot;html&quot;);return false},revert:function(){var b;if(b=a(&quot;table.widefat tr.inline-editor&quot;).attr(&quot;id&quot;)){a(&quot;table.widefat .inline-edit-save .waiting&quot;).hide();if(&quot;bulk-edit&quot;==b){a(&quot;table.widefat #bulk-edit&quot;).removeClass(&quot;inline-editor&quot;).hide();a(&quot;#bulk-titles&quot;).html(&quot;&quot;);a(&quot;#inlineedit&quot;).append(a(&quot;#bulk-edit&quot;))}else{a(&quot;#&quot;+b).remove();b=b.substr(b.lastIndexOf(&quot;-&quot;)+1);a(this.what+b).show()}}return false},getId:function(c){var d=c.tagName==&quot;TR&quot;?c.id:a(c).parents(&quot;tr&quot;).attr(&quot;id&quot;),b=d.split(&quot;-&quot;);return b[b.length-1]}};a(document).ready(function(){inlineEditPost.init()})})(jQuery);
</del><span class="cx">\ No newline at end of file
</span><ins>+(function(a){inlineEditPost={init:function(){var c=this,d=a(&quot;#inline-edit&quot;),b=a(&quot;#bulk-edit&quot;);c.type=a(&quot;table.widefat&quot;).hasClass(&quot;page&quot;)?&quot;page&quot;:&quot;post&quot;;c.what=&quot;#&quot;+c.type+&quot;-&quot;;d.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});b.keyup(function(f){if(f.which==27){return inlineEditPost.revert()}});a(&quot;a.cancel&quot;,d).click(function(){return inlineEditPost.revert()});a(&quot;a.save&quot;,d).click(function(){return inlineEditPost.save(this)});a(&quot;td&quot;,d).keydown(function(f){if(f.which==13){return inlineEditPost.save(this)}});a(&quot;a.cancel&quot;,b).click(function(){return inlineEditPost.revert()});a(&quot;#inline-edit .inline-edit-private input[value=private]&quot;).click(function(){var e=a(&quot;input.inline-edit-password-input&quot;);if(a(this).attr(&quot;checked&quot;)){e.val(&quot;&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;)}else{e.attr(&quot;disabled&quot;,&quot;&quot;)}});a(&quot;a.editinline&quot;).live(&quot;click&quot;,function(){inlineEditPost.edit(this);return false});a(&quot;#bulk-title-div&quot;).parents(&quot;fieldset&quot;).after(a(&quot;#inline-edit fieldset.inline-edit-categories&quot;).clone()).siblings(&quot;fieldset:last&quot;).prepend(a(&quot;#inline-edit label.inline-edit-tags&quot;).clone());a(&quot;span.catshow&quot;).click(function(){a(this).hide().next().show().parent().next().addClass(&quot;cat-hover&quot;)});a(&quot;span.cathide&quot;).click(function(){a(this).hide().prev().show().parent().next().removeClass(&quot;cat-hover&quot;)});a('select[name=&quot;_status&quot;] option[value=&quot;future&quot;]',b).remove();a(&quot;#doaction, #doaction2&quot;).click(function(f){var g=a(this).attr(&quot;id&quot;).substr(2);if(a('select[name=&quot;'+g+'&quot;]').val()==&quot;edit&quot;){f.preventDefault();c.setBulk()}else{if(a(&quot;form#posts-filter tr.inline-editor&quot;).length&gt;0){c.revert()}}});a(&quot;#post-query-submit&quot;).click(function(f){if(a(&quot;form#posts-filter tr.inline-editor&quot;).length&gt;0){c.revert()}})},toggle:function(c){var b=this;a(b.what+b.getId(c)).css(&quot;display&quot;)==&quot;none&quot;?b.revert():b.edit(c)},setBulk:function(){var e=&quot;&quot;,d=this.type,b,f=true;this.revert();a(&quot;#bulk-edit td&quot;).attr(&quot;colspan&quot;,a(&quot;.widefat:first thead th:visible&quot;).length);a(&quot;table.widefat tbody&quot;).prepend(a(&quot;#bulk-edit&quot;));a(&quot;#bulk-edit&quot;).addClass(&quot;inline-editor&quot;).show();a('tbody th.check-column input[type=&quot;checkbox&quot;]').each(function(g){if(a(this).attr(&quot;checked&quot;)){f=false;var h=a(this).val(),c;c=a(&quot;#inline_&quot;+h+&quot; .post_title&quot;).text()||inlineEditL10n.notitle;e+='&lt;div id=&quot;ttle'+h+'&quot;&gt;&lt;a id=&quot;_'+h+'&quot; class=&quot;ntdelbutton&quot; title=&quot;'+inlineEditL10n.ntdeltitle+'&quot;&gt;X&lt;/a&gt;'+c+&quot;&lt;/div&gt;&quot;}});if(f){return this.revert()}a(&quot;#bulk-titles&quot;).html(e);a(&quot;#bulk-titles a&quot;).click(function(){var c=a(this).attr(&quot;id&quot;).substr(1);a('table.widefat input[value=&quot;'+c+'&quot;]').attr(&quot;checked&quot;,&quot;&quot;);a(&quot;#ttle&quot;+c).remove()});if(d==&quot;post&quot;){b=&quot;post_tag&quot;;a('tr.inline-editor textarea[name=&quot;tags_input&quot;]').suggest(&quot;admin-ajax.php?action=ajax-tag-search&amp;tax=&quot;+b,{delay:500,minchars:2,multiple:true,multipleSep:&quot;, &quot;})}},edit:function(b){var o=this,j,d,g,n,i,h,k,m,l,c=true,p,e;o.revert();if(typeof(b)==&quot;object&quot;){b=o.getId(b)}j=[&quot;post_title&quot;,&quot;post_name&quot;,&quot;post_author&quot;,&quot;_status&quot;,&quot;jj&quot;,&quot;mm&quot;,&quot;aa&quot;,&quot;hh&quot;,&quot;mn&quot;,&quot;ss&quot;,&quot;post_password&quot;];if(o.type==&quot;page&quot;){j.push(&quot;post_parent&quot;,&quot;menu_order&quot;,&quot;page_template&quot;)}d=a(&quot;#inline-edit&quot;).clone(true);a(&quot;td&quot;,d).attr(&quot;colspan&quot;,a(&quot;.widefat:first thead th:visible&quot;).length);if(a(o.what+b).hasClass(&quot;alternate&quot;)){a(d).addClass(&quot;alternate&quot;)}a(o.what+b).hide().after(d);g=a(&quot;#inline_&quot;+b);if(!a(':input[name=&quot;post_author&quot;] option[value='+a(&quot;.post_author&quot;,g).text()+&quot;]&quot;,d).val()){a(':input[name=&quot;post_author&quot;]',d).prepend('&lt;option value=&quot;'+a(&quot;.post_author&quot;,g).text()+'&quot;&gt;'+a(&quot;#&quot;+o.type+&quot;-&quot;+b+&quot; .author&quot;).text()+&quot;&lt;/option&gt;&quot;)}for(k=0;k&lt;j.length;k++){a(':input[name=&quot;'+j[k]+'&quot;]',d).val(a(&quot;.&quot;+j[k],g).text())}if(a(&quot;.comment_status&quot;,g).text()==&quot;open&quot;){a('input[name=&quot;comment_status&quot;]',d).attr(&quot;checked&quot;,&quot;checked&quot;)}if(a(&quot;.ping_status&quot;,g).text()==&quot;open&quot;){a('input[name=&quot;ping_status&quot;]',d).attr(&quot;checked&quot;,&quot;checked&quot;)}if(a(&quot;.sticky&quot;,g).text()==&quot;sticky&quot;){a('input[name=&quot;sticky&quot;]',d).attr(&quot;checked&quot;,&quot;checked&quot;)}a(&quot;.post_category&quot;,g).each(function(){if(term_ids=a(this).text()){taxname=a(this).attr(&quot;id&quot;).replace(&quot;_&quot;+b,&quot;&quot;);a(&quot;ul.&quot;+taxname+&quot;-checklist :checkbox&quot;,d).val(term_ids.split(&quot;,&quot;))}});a(&quot;.tags_input&quot;,g).each(function(){if(terms=a(this).text()){taxname=a(this).attr(&quot;id&quot;).replace(&quot;_&quot;+b,&quot;&quot;);a(&quot;textarea.tax_input_&quot;+taxname,d).val(terms);a(&quot;textarea.tax_input_&quot;+taxname,d).suggest(&quot;admin-ajax.php?action=ajax-tag-search&amp;tax=&quot;+taxname,{delay:500,minchars:2,multiple:true,multipleSep:&quot;, &quot;})}});i=a(&quot;._status&quot;,g).text();if(i!=&quot;future&quot;){a('select[name=&quot;_status&quot;] option[value=&quot;future&quot;]',d).remove()}if(i==&quot;private&quot;){a('input[name=&quot;keep_private&quot;]',d).attr(&quot;checked&quot;,&quot;checked&quot;);a(&quot;input.inline-edit-password-input&quot;).val(&quot;&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;)}h=a('select[name=&quot;post_parent&quot;] option[value=&quot;'+b+'&quot;]',d);if(h.length&gt;0){m=h[0].className.split(&quot;-&quot;)[1];l=h;while(c){l=l.next(&quot;option&quot;);if(l.length==0){break}p=l[0].className.split(&quot;-&quot;)[1];if(p&lt;=m){c=false}else{l.remove();l=h}}h.remove()}a(d).attr(&quot;id&quot;,&quot;edit-&quot;+b).addClass(&quot;inline-editor&quot;).show();a(&quot;.ptitle&quot;,d).focus();return false},save:function(e){var d,b,c=a(&quot;.post_status_page&quot;).val()||&quot;&quot;;if(typeof(e)==&quot;object&quot;){e=this.getId(e)}a(&quot;table.widefat .inline-edit-save .waiting&quot;).show();d={action:&quot;inline-save&quot;,post_type:typenow,post_ID:e,edit_date:&quot;true&quot;,post_status:c};b=a(&quot;#edit-&quot;+e+&quot; :input&quot;).serialize();d=b+&quot;&amp;&quot;+a.param(d);a.post(&quot;admin-ajax.php&quot;,d,function(f){a(&quot;table.widefat .inline-edit-save .waiting&quot;).hide();if(f){if(-1!=f.indexOf(&quot;&lt;tr&quot;)){a(inlineEditPost.what+e).remove();a(&quot;#edit-&quot;+e).before(f).remove();a(inlineEditPost.what+e).hide().fadeIn()}else{f=f.replace(/&lt;.[^&lt;&gt;]*?&gt;/g,&quot;&quot;);a(&quot;#edit-&quot;+e+&quot; .inline-edit-save&quot;).append('&lt;span class=&quot;error&quot;&gt;'+f+&quot;&lt;/span&gt;&quot;)}}else{a(&quot;#edit-&quot;+e+&quot; .inline-edit-save&quot;).append('&lt;span class=&quot;error&quot;&gt;'+inlineEditL10n.error+&quot;&lt;/span&gt;&quot;)}},&quot;html&quot;);return false},revert:function(){var b;if(b=a(&quot;table.widefat tr.inline-editor&quot;).attr(&quot;id&quot;)){a(&quot;table.widefat .inline-edit-save .waiting&quot;).hide();if(&quot;bulk-edit&quot;==b){a(&quot;table.widefat #bulk-edit&quot;).removeClass(&quot;inline-editor&quot;).hide();a(&quot;#bulk-titles&quot;).html(&quot;&quot;);a(&quot;#inlineedit&quot;).append(a(&quot;#bulk-edit&quot;))}else{a(&quot;#&quot;+b).remove();b=b.substr(b.lastIndexOf(&quot;-&quot;)+1);a(this.what+b).show()}}return false},getId:function(c){var d=c.tagName==&quot;TR&quot;?c.id:a(c).parents(&quot;tr&quot;).attr(&quot;id&quot;),b=d.split(&quot;-&quot;);return b[b.length-1]}};a(document).ready(function(){inlineEditPost.init()})})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>