<!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>[13739] trunk/wp-admin: Nav Menus: blur/
 Focus behavior for Create Menu and Add Custom Links.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13739">13739</a></dd>
<dt>Author</dt> <dd>markjaquith</dd>
<dt>Date</dt> <dd>2010-03-17 19:57:08 +0000 (Wed, 17 Mar 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Nav Menus: blur/Focus behavior for Create Menu and Add Custom Links. Route &quot;return&quot; presses in each of those areas to proper button press. Better create/save logic on the PHP side.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesnavmenuphp">trunk/wp-admin/includes/nav-menu.php</a></li>
<li><a href="#trunkwpadminjsnavmenudevjs">trunk/wp-admin/js/nav-menu.dev.js</a></li>
<li><a href="#trunkwpadminjsnavmenujs">trunk/wp-admin/js/nav-menu.js</a></li>
<li><a href="#trunkwpadminnavmenusphp">trunk/wp-admin/nav-menus.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/nav-menu.php (13738 => 13739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/nav-menu.php        2010-03-17 19:33:20 UTC (rev 13738)
+++ trunk/wp-admin/includes/nav-menu.php        2010-03-17 19:57:08 UTC (rev 13739)
</span><span class="lines">@@ -86,8 +86,8 @@
</span><span class="cx">  */
</span><span class="cx"> function wp_nav_menu_create_metabox() { ?&gt;
</span><span class="cx">         &lt;p&gt;
</span><del>-                &lt;input type=&quot;text&quot; name=&quot;create-menu-name&quot; id=&quot;create-menu-name&quot; class=&quot;regular-text&quot; value=&quot;&quot;  /&gt;
-                &lt;input type=&quot;submit&quot; name=&quot;create-menu&quot; id=&quot;create-menu&quot; class=&quot;button&quot; value=&quot;&lt;?php esc_attr_e('Create Menu'); ?&gt;&quot; /&gt;
</del><ins>+                &lt;input type=&quot;text&quot; name=&quot;create-menu-name&quot; id=&quot;create-menu-name&quot; class=&quot;regular-text&quot; value=&quot;&lt;?php esc_attr_e( 'Menu name' ); ?&gt;&quot;  /&gt;
+                &lt;input type=&quot;submit&quot; name=&quot;create-menu-button&quot; id=&quot;create-menu-button&quot; class=&quot;button&quot; value=&quot;&lt;?php esc_attr_e('Create Menu'); ?&gt;&quot; /&gt;
</ins><span class="cx">         &lt;/p&gt;
</span><span class="cx">         &lt;?php
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.dev.js (13738 => 13739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.dev.js        2010-03-17 19:33:20 UTC (rev 13738)
+++ trunk/wp-admin/js/nav-menu.dev.js        2010-03-17 19:57:08 UTC (rev 13739)
</span><span class="lines">@@ -386,6 +386,39 @@
</span><span class="cx">                 return wp_update_post_data();
</span><span class="cx">         });
</span><span class="cx"> 
</span><ins>+        // Handle some return keypresses
+        $('#create-menu-name').keypress(function(e){
+                if ( 13 == e.keyCode ) {
+                        $('#create-menu-button').click();
+                        return false;
+                }
+        });
+
+        $('#custom-menu-item-url, #custom-menu-item-name').keypress(function(e){
+                if ( 13 == e.keyCode ) {
+                        $('#add-custom-links a.button').click();
+                        return false;
+                }
+        }).focus(function(){
+                if ( $(this).val() == $(this).attr('defaultValue') &amp;&amp; $(this).attr('id') != 'custom-menu-item-url' ) {
+                        $(this).val('');
+                }
+        }).blur(function(){
+                if ( $(this).val() == '' ) {
+                        $(this).val($(this).attr('defaultValue'));
+                }
+        });
+
+        $('#create-menu-name').focus(function(){
+                if ( $(this).val() == $(this).attr('defaultValue') ) {
+                        $(this).val('');
+                }
+        }).blur(function(){
+                if ( $(this).val() == '' ) {
+                        $(this).val($(this).attr('defaultValue'));
+                }
+        });
+
</ins><span class="cx">         // close postboxes that should be closed
</span><span class="cx">         $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
</span><span class="cx"> 
</span><span class="lines">@@ -446,11 +479,12 @@
</span><span class="cx"> 
</span><span class="cx">         // Create a new link then add it to the menu
</span><span class="cx">         $('#add-custom-links .add-to-menu a').click(function(e){
</span><del>-                var link_url = jQuery(e.currentTarget).parent().parent().find('#custom-menu-item-url').val();
-                var link_name = jQuery(e.currentTarget).parent().parent().find('#custom-menu-item-name').val();
-
</del><span class="cx">                 // Add link to menu
</span><del>-                wp_add_item_to_menu( 0, '', 'custom', navMenuL10n.custom, 0, link_name, link_url, '', '', '_self', '', '' );
</del><ins>+                if ( $('#custom-menu-item-url').val() == $('#custom-menu-item-url').attr('defaultValue') )
+                        return; // Do not allow &quot;http://&quot; submissions to go through
+                wp_add_item_to_menu( 0, '', 'custom', navMenuL10n.custom, 0, $('#custom-menu-item-name').val(), $('#custom-menu-item-url').val(), '', '', '_self', '', '' );
+                $('#custom-menu-item-name').val($('#custom-menu-item-name').attr('defaultValue'));
+                $('#custom-menu-item-url' ).val($('#custom-menu-item-url' ).attr('defaultValue')).focus();
</ins><span class="cx">         });
</span><span class="cx"> });
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminjsnavmenujs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.js (13738 => 13739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.js        2010-03-17 19:33:20 UTC (rev 13738)
+++ trunk/wp-admin/js/nav-menu.js        2010-03-17 19:57:08 UTC (rev 13739)
</span><span class="lines">@@ -1 +1 @@
</span><del>-function wp_nav_menu_autocomplete(a){jQuery(&quot;#add-&quot;+a+&quot; .quick-search&quot;).autocomplete(jQuery(&quot;#add-&quot;+a+&quot; .autocomplete&quot;).val().split(&quot;|&quot;));jQuery(&quot;#add-&quot;+a+&quot; .quick-search&quot;).result(function(b,d,c){jQuery(&quot;#add-&quot;+a+&quot; .list-wrap&quot;).css(&quot;display&quot;,&quot;block&quot;);jQuery(&quot;#add-&quot;+a+&quot; .list-wrap li:contains('&quot;+d+&quot;')&quot;).css(&quot;display&quot;,&quot;block&quot;);jQuery(&quot;#add-&quot;+a+&quot; .show-all&quot;).hide();jQuery(&quot;#add-&quot;+a+&quot; .hide-all&quot;).show()})}function wp_edit_menu_item(a){var f=jQuery(&quot;#menu-item-type&quot;+a).val();var b=jQuery(&quot;#menu-item-title&quot;+a).val();var g=jQuery(&quot;#menu-item-url&quot;+a).val();var c=jQuery(&quot;#menu-item-attr-title&quot;+a).val();var d=jQuery(&quot;#menu-item-target&quot;+a).val();var h=jQuery(&quot;#menu-item-description&quot;+a).val();var e=jQuery(&quot;#menu-item-classes&quot;+a).val();var i=jQuery(&quot;#menu-item-xfn&quot;+a).val();if(&quot;custom&quot;!=f){jQuery(&quot;#edit-menu-item-url&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;)}jQuery(&quot;#edit-menu-item-id&quot;).val(a);jQuery(&quot;#edit-menu-item-title&quot;).val(b);jQuery(&quot;#edit-menu-item-url&quot;).val(g);jQuery(&quot;#edit-menu-item-attr-title&quot;).val(c);jQuery(&quot;#edit-menu-item-target&quot;).val(d);jQuery(&quot;#edit-menu-item-target option[value='&quot;+d+&quot;']&quot;).attr(&quot;selected&quot;,&quot;selected&quot;);jQuery(&quot;#edit-menu-item-description&quot;).val(h);jQuery(&quot;#edit-menu-item-classes&quot;).val(e);jQuery(&quot;#edit-menu-item-xfn&quot;).val(i);jQuery(&quot;#edit-menu-item-title&quot;).focus()}function wp_update_menu_item(){var h=jQuery(&quot;#edit-menu-item-id&quot;).val();var f=jQuery(&quot;#edit-menu-item-title&quot;).val();var b=jQuery(&quot;#edit-menu-item-url&quot;).val();var g=jQuery(&quot;#edit-menu-item-attr-title&quot;).val();var d=jQuery(&quot;#edit-menu-item-target&quot;).val();var c=jQuery(&quot;#edit-menu-item-description&quot;).val();var a=jQuery(&quot;#edit-menu-item-classes&quot;).val();var e=jQuery(&quot;#edit-menu-item-xfn&quot;).val();jQuery(&quot;.menu #menu-item&quot;+h).find(&quot;span.item-title&quot;).html(f);jQuery(&quot;.menu #menu-item-title&quot;+h).val(f);jQuery(&quot;.menu #menu-item-url&quot;+h).val(b);jQuery(&quot;.menu #menu-item-attr-title&quot;+h).val(g);jQuery(&quot;.menu #menu-item-target&quot;+h).val(d);jQuery(&quot;.menu #menu-item-description&quot;+h).val(c);jQuery(&quot;.menu #menu-item-classes&quot;+h).val(a);jQuery(&quot;.menu #menu-item-xfn&quot;+h).val(e);jQuery(&quot;.menu #menu-item&quot;+h+&quot; dt:first&quot;).animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}})}function wp_remove_menu_item(b){var a=document.getElementById(&quot;menu-item&quot;+b);if(a){jQuery(a).find(&quot;dt&quot;).each(function(){jQuery(this).animate({backgroundColor:&quot;#FF3333&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).parent().parent().remove()}})})}}function wp_add_item_to_menu(a,k,f,n,l,b,m,h,e,d,c,i){var j=wp_get_unique_menu_id();var g=wp_get_hidden_inputs(j,a,k,f,n,l,b,m,h,e,d,c,i);jQuery(&quot;.menu&quot;).append('&lt;li id=&quot;menu-item'+j+'&quot; value=&quot;'+j+'&quot;&gt;&lt;div class=&quot;dropzone ui-droppable&quot;&gt;&lt;/div&gt;&lt;dl class=&quot;ui-droppable&quot;&gt;&lt;dt&gt;&lt;span class=&quot;item-title&quot;&gt;'+b+'&lt;/span&gt;&lt;span class=&quot;item-controls&quot;&gt;&lt;span class=&quot;item-type&quot;&gt;'+n+'&lt;/span&gt;&lt;a class=&quot;item-edit thickbox&quot; id=&quot;edit'+j+'&quot; value=&quot;'+j+'&quot; onClick=&quot;wp_edit_menu_item('+j+')&quot; title=&quot;'+navMenuL10n.thickbox+'&quot; href=&quot;#TB_inline?height=540&amp;width=300&amp;inlineId=menu-item-settings&quot;&gt;'+navMenuL10n.edit+'&lt;/a&gt; | &lt;a class=&quot;item-delete&quot; id=&quot;delete'+j+'&quot; value=&quot;'+j+'&quot;&gt;Delete&lt;/a&gt;&lt;/span&gt;&lt;/dt&gt;&lt;/dl&gt;'+g+&quot;&lt;/li&gt;&quot;);jQuery(&quot;.menu #menu-item&quot;+j+&quot; dt:first&quot;).animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}});wp_drag_and_drop();tb_init(&quot;a.thickbox, area.thickbox, input.thickbox&quot;)}function wp_add_checked_items_to_menu(b){var a=jQuery(b).siblings(&quot;.list-wrap&quot;).find(&quot;:checked&quot;);if(0==a.length){return false}jQuery(a).each(function(){var h=jQuery(this).parent().siblings(&quot;.menu-item-type&quot;).val();if(&quot;custom&quot;==h){var e=jQuery(this).parent().siblings(&quot;.menu-item-attr-title&quot;).val();var f=jQuery(this).parent().siblings(&quot;.menu-item-target&quot;).val();var g=jQuery(this).parent().siblings(&quot;.menu-item-classes&quot;).val();var j=jQuery(this).parent().siblings(&quot;.menu-item-xfn&quot;).val()}else{var e=&quot;&quot;;var f=&quot;_self&quot;;var g=&quot;&quot;;var j=&quot;&quot;}var c=jQuery(this).parent().siblings(&quot;.menu-item-db-id&quot;).val();var k=jQuery(this).parent().siblings(&quot;.menu-item-object-id&quot;).val();var n=jQuery(this).parent().siblings(&quot;.menu-item-append&quot;).val();var l=jQuery(this).parent().siblings(&quot;.menu-item-parent-id&quot;).val();var d=jQuery(this).parent().siblings(&quot;.menu-item-title&quot;).val();var m=jQuery(this).parent().siblings(&quot;.menu-item-url&quot;).val();var i=jQuery(this).parent().siblings(&quot;.menu-item-description&quot;).val();if(undefined==i){i=&quot;&quot;}wp_add_item_to_menu(c,k,h,n,l,d,m,i,e,f,g,j);jQuery(this).attr(&quot;checked&quot;,false)})}function wp_drag_and_drop(){jQuery(&quot;.menu li&quot;).each(function(){if(!jQuery(this).children(&quot;.dropzone&quot;).attr(&quot;class&quot;)){jQuery(this).prepend('&lt;div class=&quot;dropzone&quot;&gt;&lt;/div&gt;')}});jQuery(&quot;.menu li&quot;).draggable({handle:&quot; &gt; dl&quot;,opacity:0.8,addClasses:false,helper:&quot;clone&quot;,zIndex:100});jQuery(&quot;.menu li dl, .menu li .dropzone&quot;).droppable({accept:&quot;.menu li&quot;,tolerance:&quot;pointer&quot;,drop:function(f,d){var a=jQuery(this).parent();var g=!jQuery(this).hasClass(&quot;dropzone&quot;);if(g&amp;&amp;a.children(&quot;ul&quot;).length==0){a.append('&lt;ul class=&quot;sub-menu&quot; /&gt;')}if(g){a.children(&quot;ul&quot;).append(d.draggable)}else{a.before(d.draggable)}a.find(&quot;dl,.dropzone&quot;).css({backgroundColor:&quot;&quot;,borderColor:&quot;&quot;});var c=d.draggable.attr(&quot;value&quot;);var b=a.attr(&quot;value&quot;);a.find(&quot;#menu-&quot;+c).find(&quot;#parent&quot;+c).val(b);jQuery(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);jQuery(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;)},over:function(){if(jQuery(this).attr(&quot;class&quot;)==&quot;dropzone ui-droppable&quot;){jQuery(this).parent().find(&quot;div:first&quot;).css(&quot;background&quot;,&quot;none&quot;).css(&quot;height&quot;,&quot;50px&quot;)}else{if(jQuery(this).attr(&quot;class&quot;)==&quot;ui-droppable&quot;){jQuery(this).parent().find(&quot;dt:first&quot;).css(&quot;background&quot;,&quot;#d8d8d8&quot;)}else{}}var a=jQuery(this).parent().attr(&quot;id&quot;)},out:function(){jQuery(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);jQuery(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;);jQuery(this).filter(&quot;.dropzone&quot;).css({borderColor:&quot;&quot;})}})}function wp_update_post_data(){var a=0;jQuery(&quot;.menu li&quot;).each(function(c){c=c+1;var b=jQuery(this).attr(&quot;value&quot;);jQuery(this).find(&quot;#menu-item-position&quot;+b).attr(&quot;value&quot;,c);jQuery(this).attr(&quot;id&quot;,&quot;menu-item&quot;+c);jQuery(this).attr(&quot;value&quot;,c);jQuery(this).find(&quot;#menu-item-db-id&quot;+b).attr(&quot;id&quot;,&quot;menu-item-db-id&quot;+c);jQuery(this).find(&quot;#menu-item-object-id&quot;+b).attr(&quot;id&quot;,&quot;menu-item-object-id&quot;+c);jQuery(this).find(&quot;#menu-item-append&quot;+b).attr(&quot;id&quot;,&quot;menu-item-append&quot;+c);jQuery(this).find(&quot;#menu-item-type&quot;+b).attr(&quot;id&quot;,&quot;menu-item-type&quot;+c);jQuery(this).find(&quot;#menu-item-position&quot;+b).attr(&quot;id&quot;,&quot;menu-item-position&quot;+c);var d=jQuery(this).find(&quot;#menu-item-parent-id&quot;+b).parent().parent().parent().attr(&quot;value&quot;);jQuery(this).find(&quot;#menu-item-parent-id&quot;+b).attr(&quot;id&quot;,&quot;menu-item-parent-id&quot;+c);if(d){}else{d=0}jQuery(this).find(&quot;#menu-item-parent-id&quot;+b).attr(&quot;value&quot;,d);jQuery(this).find(&quot;#menu-item-title&quot;+b).attr(&quot;id&quot;,&quot;menu-item-title&quot;+c);jQuery(this).find(&quot;#menu-item-url&quot;+b).attr(&quot;id&quot;,&quot;menu-item-url&quot;+c);jQuery(this).find(&quot;#menu-item-description&quot;+b).attr(&quot;id&quot;,&quot;menu-item-description&quot;+c);jQuery(this).find(&quot;#menu-item-classes&quot;+b).attr(&quot;id&quot;,&quot;menu-item-classes&quot;+c);jQuery(this).find(&quot;#menu-item-xfn&quot;+b).attr(&quot;id&quot;,&quot;menu-item-xfn&quot;+c);jQuery(this).find(&quot;#menu-item-description&quot;+b).attr(&quot;id&quot;,&quot;menu-item-description&quot;+c);jQuery(this).find(&quot;#menu-item-attr-title&quot;+b).attr(&quot;id&quot;,&quot;menu-item-attr-title&quot;+c);jQuery(this).find(&quot;#menu-item-target&quot;+b).attr(&quot;id&quot;,&quot;menu-item-target&quot;+c);jQuery(&quot;#li-count&quot;).attr(&quot;value&quot;,c)})}function wp_get_unique_menu_id(){var d=jQuery(&quot;.menu li&quot;).length+1;var e=d;var a=0;try{var f=document.getElementById(&quot;menu-&quot;+e.toString()).value}catch(c){a=1}while(a==0){e=e+1;try{var b=document.getElementById(&quot;menu-&quot;+e.toString()).value}catch(c){a=1}}return e}function wp_get_hidden_inputs(j,a,k,f,n,l,b,m,h,e,d,c,i){var g=&quot;&quot;;g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-db-id[]&quot; id=&quot;menu-item-db-id'+j+'&quot; value=&quot;'+a+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-object-id[]&quot; id=&quot;menu-item-object-id'+j+'&quot; value=&quot;'+k+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-type[]&quot; id=&quot;menu-item-type'+j+'&quot; value=&quot;'+f+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-append[]&quot; id=&quot;menu-item-append'+j+'&quot; value=&quot;'+n+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-parent-id[]&quot; id=&quot;menu-item-parent-id'+j+'&quot; value=&quot;'+l+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-position[]&quot; id=&quot;menu-item-position'+j+'&quot; value=&quot;'+j+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-title[]&quot; id=&quot;menu-item-title'+j+'&quot; value=&quot;'+b+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-attr-title[]&quot; id=&quot;menu-item-attr-title'+j+'&quot; value=&quot;'+e+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-url[]&quot; id=&quot;menu-item-url'+j+'&quot; value=&quot;'+m+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-target[]&quot; id=&quot;menu-item-target'+j+'&quot; value=&quot;'+d+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-description[]&quot; id=&quot;menu-item-description'+j+'&quot; value=&quot;'+h+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-classes[]&quot; id=&quot;menu-item-classes'+j+'&quot; value=&quot;'+c+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-xfn[]&quot; id=&quot;menu-item-xfn'+j+'&quot; value=&quot;'+i+'&quot; /&gt;';return g}jQuery(document).ready(function(a){wp_drag_and_drop();a(&quot;#update-nav-menu .deletion&quot;).click(function(){if(confirm(navMenuL10n.warnDelete)){return true}else{return false}});a(&quot;#save_menu&quot;).click(function(){return wp_update_post_data()});a(&quot;.if-js-closed&quot;).removeClass(&quot;if-js-closed&quot;).addClass(&quot;closed&quot;);postboxes.add_postbox_toggles(&quot;menus&quot;);a(&quot;.quick-search&quot;).click(function(){a(this).attr(&quot;value&quot;,&quot;&quot;)});a(&quot;.quick-search-submit&quot;).click(function(){a(this).siblings(&quot;.quick-search&quot;).search()});a(&quot;#menu-container .item-edit&quot;).click(function(){return wp_edit_menu_item(a(this).attr(&quot;value&quot;))});a(&quot;#menu-container .item-delete&quot;).live(&quot;click&quot;,function(b){return wp_remove_menu_item(a(this).attr(&quot;value&quot;))});a(&quot;#update-menu-item&quot;).click(function(){wp_update_menu_item();return tb_remove()});a(&quot;#cancel-save&quot;).click(function(){return tb_remove()});a(&quot;.show-all&quot;).click(function(b){jQuery(b.currentTarget).parent().siblings(&quot;.list-wrap&quot;).css(&quot;display&quot;,&quot;block&quot;);jQuery(b.currentTarget).parent().siblings(&quot;.list-wrap&quot;).find(&quot;li&quot;).css(&quot;display&quot;,&quot;block&quot;);jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(&quot;.hide-all&quot;).show()});a(&quot;.hide-all&quot;).click(function(b){jQuery(b.currentTarget).parent().siblings(&quot;.list-wrap&quot;).css(&quot;display&quot;,&quot;none&quot;);jQuery(b.currentTarget).parent().siblings(&quot;.list-wrap&quot;).find(&quot;li&quot;).css(&quot;display&quot;,&quot;none&quot;);jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(&quot;.show-all&quot;).show()});a(&quot;.add-to-menu&quot;).click(function(b){return wp_add_checked_items_to_menu(b.currentTarget)});a(&quot;#add-custom-links .add-to-menu a&quot;).click(function(d){var b=jQuery(d.currentTarget).parent().parent().find(&quot;#custom-menu-item-url&quot;).val();var c=jQuery(d.currentTarget).parent().parent().find(&quot;#custom-menu-item-name&quot;).val();wp_add_item_to_menu(0,&quot;&quot;,&quot;custom&quot;,navMenuL10n.custom,0,c,b,&quot;&quot;,&quot;&quot;,&quot;_self&quot;,&quot;&quot;,&quot;&quot;)})});function get_html_translation_table(i,g){var d={},f={},c=0,a=&quot;&quot;;var e={},b={};var j={},h={};e[0]=&quot;HTML_SPECIALCHARS&quot;;e[1]=&quot;HTML_ENTITIES&quot;;b[0]=&quot;ENT_NOQUOTES&quot;;b[2]=&quot;ENT_COMPAT&quot;;b[3]=&quot;ENT_QUOTES&quot;;j=!isNaN(i)?e[i]:i?i.toUpperCase():&quot;HTML_SPECIALCHARS&quot;;h=!isNaN(g)?b[g]:g?g.toUpperCase():&quot;ENT_COMPAT&quot;;if(j!==&quot;HTML_SPECIALCHARS&quot;&amp;&amp;j!==&quot;HTML_ENTITIES&quot;){throw new Error(&quot;Table: &quot;+j+&quot; not supported&quot;)}d[&quot;38&quot;]=&quot;&amp;amp;&quot;;if(j===&quot;HTML_ENTITIES&quot;){d[&quot;160&quot;]=&quot;&amp;nbsp;&quot;;d[&quot;161&quot;]=&quot;&amp;iexcl;&quot;;d[&quot;162&quot;]=&quot;&amp;cent;&quot;;d[&quot;163&quot;]=&quot;&amp;pound;&quot;;d[&quot;164&quot;]=&quot;&amp;curren;&quot;;d[&quot;165&quot;]=&quot;&amp;yen;&quot;;d[&quot;166&quot;]=&quot;&amp;brvbar;&quot;;d[&quot;167&quot;]=&quot;&amp;sect;&quot;;d[&quot;168&quot;]=&quot;&amp;uml;&quot;;d[&quot;169&quot;]=&quot;&amp;copy;&quot;;d[&quot;170&quot;]=&quot;&amp;ordf;&quot;;d[&quot;171&quot;]=&quot;&amp;laquo;&quot;;d[&quot;172&quot;]=&quot;&amp;not;&quot;;d[&quot;173&quot;]=&quot;&amp;shy;&quot;;d[&quot;174&quot;]=&quot;&amp;reg;&quot;;d[&quot;175&quot;]=&quot;&amp;macr;&quot;;d[&quot;176&quot;]=&quot;&amp;deg;&quot;;d[&quot;177&quot;]=&quot;&amp;plusmn;&quot;;d[&quot;178&quot;]=&quot;&amp;sup2;&quot;;d[&quot;179&quot;]=&quot;&amp;sup3;&quot;;d[&quot;180&quot;]=&quot;&amp;acute;&quot;;d[&quot;181&quot;]=&quot;&amp;micro;&quot;;d[&quot;182&quot;]=&quot;&amp;para;&quot;;d[&quot;183&quot;]=&quot;&amp;middot;&quot;;d[&quot;184&quot;]=&quot;&amp;cedil;&quot;;d[&quot;185&quot;]=&quot;&amp;sup1;&quot;;d[&quot;186&quot;]=&quot;&amp;ordm;&quot;;d[&quot;187&quot;]=&quot;&amp;raquo;&quot;;d[&quot;188&quot;]=&quot;&amp;frac14;&quot;;d[&quot;189&quot;]=&quot;&amp;frac12;&quot;;d[&quot;190&quot;]=&quot;&amp;frac34;&quot;;d[&quot;191&quot;]=&quot;&amp;iquest;&quot;;d[&quot;192&quot;]=&quot;&amp;Agrave;&quot;;d[&quot;193&quot;]=&quot;&amp;Aacute;&quot;;d[&quot;194&quot;]=&quot;&amp;Acirc;&quot;;d[&quot;195&quot;]=&quot;&amp;Atilde;&quot;;d[&quot;196&quot;]=&quot;&amp;Auml;&quot;;d[&quot;197&quot;]=&quot;&amp;Aring;&quot;;d[&quot;198&quot;]=&quot;&amp;AElig;&quot;;d[&quot;199&quot;]=&quot;&amp;Ccedil;&quot;;d[&quot;200&quot;]=&quot;&amp;Egrave;&quot;;d[&quot;201&quot;]=&quot;&amp;Eacute;&quot;;d[&quot;202&quot;]=&quot;&amp;Ecirc;&quot;;d[&quot;203&quot;]=&quot;&amp;Euml;&quot;;d[&quot;204&quot;]=&quot;&amp;Igrave;&quot;;d[&quot;205&quot;]=&quot;&amp;Iacute;&quot;;d[&quot;206&quot;]=&quot;&amp;Icirc;&quot;;d[&quot;207&quot;]=&quot;&amp;Iuml;&quot;;d[&quot;208&quot;]=&quot;&amp;ETH;&quot;;d[&quot;209&quot;]=&quot;&amp;Ntilde;&quot;;d[&quot;210&quot;]=&quot;&amp;Ograve;&quot;;d[&quot;211&quot;]=&quot;&amp;Oacute;&quot;;d[&quot;212&quot;]=&quot;&amp;Ocirc;&quot;;d[&quot;213&quot;]=&quot;&amp;Otilde;&quot;;d[&quot;214&quot;]=&quot;&amp;Ouml;&quot;;d[&quot;215&quot;]=&quot;&amp;times;&quot;;d[&quot;216&quot;]=&quot;&amp;Oslash;&quot;;d[&quot;217&quot;]=&quot;&amp;Ugrave;&quot;;d[&quot;218&quot;]=&quot;&amp;Uacute;&quot;;d[&quot;219&quot;]=&quot;&amp;Ucirc;&quot;;d[&quot;220&quot;]=&quot;&amp;Uuml;&quot;;d[&quot;221&quot;]=&quot;&amp;Yacute;&quot;;d[&quot;222&quot;]=&quot;&amp;THORN;&quot;;d[&quot;223&quot;]=&quot;&amp;szlig;&quot;;d[&quot;224&quot;]=&quot;&amp;agrave;&quot;;d[&quot;225&quot;]=&quot;&amp;aacute;&quot;;d[&quot;226&quot;]=&quot;&amp;acirc;&quot;;d[&quot;227&quot;]=&quot;&amp;atilde;&quot;;d[&quot;228&quot;]=&quot;&amp;auml;&quot;;d[&quot;229&quot;]=&quot;&amp;aring;&quot;;d[&quot;230&quot;]=&quot;&amp;aelig;&quot;;d[&quot;231&quot;]=&quot;&amp;ccedil;&quot;;d[&quot;232&quot;]=&quot;&amp;egrave;&quot;;d[&quot;233&quot;]=&quot;&amp;eacute;&quot;;d[&quot;234&quot;]=&quot;&amp;ecirc;&quot;;d[&quot;235&quot;]=&quot;&amp;euml;&quot;;d[&quot;236&quot;]=&quot;&amp;igrave;&quot;;d[&quot;237&quot;]=&quot;&amp;iacute;&quot;;d[&quot;238&quot;]=&quot;&amp;icirc;&quot;;d[&quot;239&quot;]=&quot;&amp;iuml;&quot;;d[&quot;240&quot;]=&quot;&amp;eth;&quot;;d[&quot;241&quot;]=&quot;&amp;ntilde;&quot;;d[&quot;242&quot;]=&quot;&amp;ograve;&quot;;d[&quot;243&quot;]=&quot;&amp;oacute;&quot;;d[&quot;244&quot;]=&quot;&amp;ocirc;&quot;;d[&quot;245&quot;]=&quot;&amp;otilde;&quot;;d[&quot;246&quot;]=&quot;&amp;ouml;&quot;;d[&quot;247&quot;]=&quot;&amp;divide;&quot;;d[&quot;248&quot;]=&quot;&amp;oslash;&quot;;d[&quot;249&quot;]=&quot;&amp;ugrave;&quot;;d[&quot;250&quot;]=&quot;&amp;uacute;&quot;;d[&quot;251&quot;]=&quot;&amp;ucirc;&quot;;d[&quot;252&quot;]=&quot;&amp;uuml;&quot;;d[&quot;253&quot;]=&quot;&amp;yacute;&quot;;d[&quot;254&quot;]=&quot;&amp;thorn;&quot;;d[&quot;255&quot;]=&quot;&amp;yuml;&quot;}if(h!==&quot;ENT_NOQUOTES&quot;){d[&quot;34&quot;]=&quot;&amp;quot;&quot;}if(h===&quot;ENT_QUOTES&quot;){d[&quot;39&quot;]=&quot;&amp;#39;&quot;}d[&quot;60&quot;]=&quot;&amp;lt;&quot;;d[&quot;62&quot;]=&quot;&amp;gt;&quot;;for(c in d){a=String.fromCharCode(c);f[a]=d[c]}return f}function htmlentities(c,f){var e={},d=&quot;&quot;,a=&quot;&quot;,b=&quot;&quot;;a=c.toString();if(false===(e=this.get_html_translation_table(&quot;HTML_ENTITIES&quot;,f))){return false}e[&quot;'&quot;]=&quot;&amp;#039;&quot;;for(d in e){b=e[d];a=a.split(d).join(b)}return a};
</del><span class="cx">\ No newline at end of file
</span><ins>+function wp_nav_menu_autocomplete(a){jQuery(&quot;#add-&quot;+a+&quot; .quick-search&quot;).autocomplete(jQuery(&quot;#add-&quot;+a+&quot; .autocomplete&quot;).val().split(&quot;|&quot;));jQuery(&quot;#add-&quot;+a+&quot; .quick-search&quot;).result(function(b,d,c){jQuery(&quot;#add-&quot;+a+&quot; .list-wrap&quot;).css(&quot;display&quot;,&quot;block&quot;);jQuery(&quot;#add-&quot;+a+&quot; .list-wrap li:contains('&quot;+d+&quot;')&quot;).css(&quot;display&quot;,&quot;block&quot;);jQuery(&quot;#add-&quot;+a+&quot; .show-all&quot;).hide();jQuery(&quot;#add-&quot;+a+&quot; .hide-all&quot;).show()})}function wp_edit_menu_item(a){var f=jQuery(&quot;#menu-item-type&quot;+a).val();var b=jQuery(&quot;#menu-item-title&quot;+a).val();var g=jQuery(&quot;#menu-item-url&quot;+a).val();var c=jQuery(&quot;#menu-item-attr-title&quot;+a).val();var d=jQuery(&quot;#menu-item-target&quot;+a).val();var h=jQuery(&quot;#menu-item-description&quot;+a).val();var e=jQuery(&quot;#menu-item-classes&quot;+a).val();var i=jQuery(&quot;#menu-item-xfn&quot;+a).val();if(&quot;custom&quot;!=f){jQuery(&quot;#edit-menu-item-url&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;)}jQuery(&quot;#edit-menu-item-id&quot;).val(a);jQuery(&quot;#edit-menu-item-title&quot;).val(b);jQuery(&quot;#edit-menu-item-url&quot;).val(g);jQuery(&quot;#edit-menu-item-attr-title&quot;).val(c);jQuery(&quot;#edit-menu-item-target&quot;).val(d);jQuery(&quot;#edit-menu-item-target option[value='&quot;+d+&quot;']&quot;).attr(&quot;selected&quot;,&quot;selected&quot;);jQuery(&quot;#edit-menu-item-description&quot;).val(h);jQuery(&quot;#edit-menu-item-classes&quot;).val(e);jQuery(&quot;#edit-menu-item-xfn&quot;).val(i);jQuery(&quot;#edit-menu-item-title&quot;).focus()}function wp_update_menu_item(){var h=jQuery(&quot;#edit-menu-item-id&quot;).val();var f=jQuery(&quot;#edit-menu-item-title&quot;).val();var b=jQuery(&quot;#edit-menu-item-url&quot;).val();var g=jQuery(&quot;#edit-menu-item-attr-title&quot;).val();var d=jQuery(&quot;#edit-menu-item-target&quot;).val();var c=jQuery(&quot;#edit-menu-item-description&quot;).val();var a=jQuery(&quot;#edit-menu-item-classes&quot;).val();var e=jQuery(&quot;#edit-menu-item-xfn&quot;).val();jQuery(&quot;.menu #menu-item&quot;+h).find(&quot;span.item-title&quot;).html(f);jQuery(&quot;.menu #menu-item-title&quot;+h).val(f);jQuery(&quot;.menu #menu-item-url&quot;+h).val(b);jQuery(&quot;.menu #menu-item-attr-title&quot;+h).val(g);jQuery(&quot;.menu #menu-item-target&quot;+h).val(d);jQuery(&quot;.menu #menu-item-description&quot;+h).val(c);jQuery(&quot;.menu #menu-item-classes&quot;+h).val(a);jQuery(&quot;.menu #menu-item-xfn&quot;+h).val(e);jQuery(&quot;.menu #menu-item&quot;+h+&quot; dt:first&quot;).animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}})}function wp_remove_menu_item(b){var a=document.getElementById(&quot;menu-item&quot;+b);if(a){jQuery(a).find(&quot;dt&quot;).each(function(){jQuery(this).animate({backgroundColor:&quot;#FF3333&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).parent().parent().remove()}})})}}function wp_add_item_to_menu(a,k,f,n,l,b,m,h,e,d,c,i){var j=wp_get_unique_menu_id();var g=wp_get_hidden_inputs(j,a,k,f,n,l,b,m,h,e,d,c,i);jQuery(&quot;.menu&quot;).append('&lt;li id=&quot;menu-item'+j+'&quot; value=&quot;'+j+'&quot;&gt;&lt;div class=&quot;dropzone ui-droppable&quot;&gt;&lt;/div&gt;&lt;dl class=&quot;ui-droppable&quot;&gt;&lt;dt&gt;&lt;span class=&quot;item-title&quot;&gt;'+b+'&lt;/span&gt;&lt;span class=&quot;item-controls&quot;&gt;&lt;span class=&quot;item-type&quot;&gt;'+n+'&lt;/span&gt;&lt;a class=&quot;item-edit thickbox&quot; id=&quot;edit'+j+'&quot; value=&quot;'+j+'&quot; onClick=&quot;wp_edit_menu_item('+j+')&quot; title=&quot;'+navMenuL10n.thickbox+'&quot; href=&quot;#TB_inline?height=540&amp;width=300&amp;inlineId=menu-item-settings&quot;&gt;'+navMenuL10n.edit+'&lt;/a&gt; | &lt;a class=&quot;item-delete&quot; id=&quot;delete'+j+'&quot; value=&quot;'+j+'&quot;&gt;Delete&lt;/a&gt;&lt;/span&gt;&lt;/dt&gt;&lt;/dl&gt;'+g+&quot;&lt;/li&gt;&quot;);jQuery(&quot;.menu #menu-item&quot;+j+&quot; dt:first&quot;).animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}});wp_drag_and_drop();tb_init(&quot;a.thickbox, area.thickbox, input.thickbox&quot;)}function wp_add_checked_items_to_menu(b){var a=jQuery(b).siblings(&quot;.list-wrap&quot;).find(&quot;:checked&quot;);if(0==a.length){return false}jQuery(a).each(function(){var h=jQuery(this).parent().siblings(&quot;.menu-item-type&quot;).val();if(&quot;custom&quot;==h){var e=jQuery(this).parent().siblings(&quot;.menu-item-attr-title&quot;).val();var f=jQuery(this).parent().siblings(&quot;.menu-item-target&quot;).val();var g=jQuery(this).parent().siblings(&quot;.menu-item-classes&quot;).val();var j=jQuery(this).parent().siblings(&quot;.menu-item-xfn&quot;).val()}else{var e=&quot;&quot;;var f=&quot;_self&quot;;var g=&quot;&quot;;var j=&quot;&quot;}var c=jQuery(this).parent().siblings(&quot;.menu-item-db-id&quot;).val();var k=jQuery(this).parent().siblings(&quot;.menu-item-object-id&quot;).val();var n=jQuery(this).parent().siblings(&quot;.menu-item-append&quot;).val();var l=jQuery(this).parent().siblings(&quot;.menu-item-parent-id&quot;).val();var d=jQuery(this).parent().siblings(&quot;.menu-item-title&quot;).val();var m=jQuery(this).parent().siblings(&quot;.menu-item-url&quot;).val();var i=jQuery(this).parent().siblings(&quot;.menu-item-description&quot;).val();if(undefined==i){i=&quot;&quot;}wp_add_item_to_menu(c,k,h,n,l,d,m,i,e,f,g,j);jQuery(this).attr(&quot;checked&quot;,false)})}function wp_drag_and_drop(){jQuery(&quot;.menu li&quot;).each(function(){if(!jQuery(this).children(&quot;.dropzone&quot;).attr(&quot;class&quot;)){jQuery(this).prepend('&lt;div class=&quot;dropzone&quot;&gt;&lt;/div&gt;')}});jQuery(&quot;.menu li&quot;).draggable({handle:&quot; &gt; dl&quot;,opacity:0.8,addClasses:false,helper:&quot;clone&quot;,zIndex:100});jQuery(&quot;.menu li dl, .menu li .dropzone&quot;).droppable({accept:&quot;.menu li&quot;,tolerance:&quot;pointer&quot;,drop:function(f,d){var a=jQuery(this).parent();var g=!jQuery(this).hasClass(&quot;dropzone&quot;);if(g&amp;&amp;a.children(&quot;ul&quot;).length==0){a.append('&lt;ul class=&quot;sub-menu&quot; /&gt;')}if(g){a.children(&quot;ul&quot;).append(d.draggable)}else{a.before(d.draggable)}a.find(&quot;dl,.dropzone&quot;).css({backgroundColor:&quot;&quot;,borderColor:&quot;&quot;});var c=d.draggable.attr(&quot;value&quot;);var b=a.attr(&quot;value&quot;);a.find(&quot;#menu-&quot;+c).find(&quot;#parent&quot;+c).val(b);jQuery(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);jQuery(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;)},over:function(){if(jQuery(this).attr(&quot;class&quot;)==&quot;dropzone ui-droppable&quot;){jQuery(this).parent().find(&quot;div:first&quot;).css(&quot;background&quot;,&quot;none&quot;).css(&quot;height&quot;,&quot;50px&quot;)}else{if(jQuery(this).attr(&quot;class&quot;)==&quot;ui-droppable&quot;){jQuery(this).parent().find(&quot;dt:first&quot;).css(&quot;background&quot;,&quot;#d8d8d8&quot;)}else{}}var a=jQuery(this).parent().attr(&quot;id&quot;)},out:function(){jQuery(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);jQuery(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;);jQuery(this).filter(&quot;.dropzone&quot;).css({borderColor:&quot;&quot;})}})}function wp_update_post_data(){var a=0;jQuery(&quot;.menu li&quot;).each(function(c){c=c+1;var b=jQuery(this).attr(&quot;value&quot;);jQuery(this).find(&quot;#menu-item-position&quot;+b).attr(&quot;value&quot;,c);jQuery(this).attr(&quot;id&quot;,&quot;menu-item&quot;+c);jQuery(this).attr(&quot;value&quot;,c);jQuery(this).find(&quot;#menu-item-db-id&quot;+b).attr(&quot;id&quot;,&quot;menu-item-db-id&quot;+c);jQuery(this).find(&quot;#menu-item-object-id&quot;+b).attr(&quot;id&quot;,&quot;menu-item-object-id&quot;+c);jQuery(this).find(&quot;#menu-item-append&quot;+b).attr(&quot;id&quot;,&quot;menu-item-append&quot;+c);jQuery(this).find(&quot;#menu-item-type&quot;+b).attr(&quot;id&quot;,&quot;menu-item-type&quot;+c);jQuery(this).find(&quot;#menu-item-position&quot;+b).attr(&quot;id&quot;,&quot;menu-item-position&quot;+c);var d=jQuery(this).find(&quot;#menu-item-parent-id&quot;+b).parent().parent().parent().attr(&quot;value&quot;);jQuery(this).find(&quot;#menu-item-parent-id&quot;+b).attr(&quot;id&quot;,&quot;menu-item-parent-id&quot;+c);if(d){}else{d=0}jQuery(this).find(&quot;#menu-item-parent-id&quot;+b).attr(&quot;value&quot;,d);jQuery(this).find(&quot;#menu-item-title&quot;+b).attr(&quot;id&quot;,&quot;menu-item-title&quot;+c);jQuery(this).find(&quot;#menu-item-url&quot;+b).attr(&quot;id&quot;,&quot;menu-item-url&quot;+c);jQuery(this).find(&quot;#menu-item-description&quot;+b).attr(&quot;id&quot;,&quot;menu-item-description&quot;+c);jQuery(this).find(&quot;#menu-item-classes&quot;+b).attr(&quot;id&quot;,&quot;menu-item-classes&quot;+c);jQuery(this).find(&quot;#menu-item-xfn&quot;+b).attr(&quot;id&quot;,&quot;menu-item-xfn&quot;+c);jQuery(this).find(&quot;#menu-item-description&quot;+b).attr(&quot;id&quot;,&quot;menu-item-description&quot;+c);jQuery(this).find(&quot;#menu-item-attr-title&quot;+b).attr(&quot;id&quot;,&quot;menu-item-attr-title&quot;+c);jQuery(this).find(&quot;#menu-item-target&quot;+b).attr(&quot;id&quot;,&quot;menu-item-target&quot;+c);jQuery(&quot;#li-count&quot;).attr(&quot;value&quot;,c)})}function wp_get_unique_menu_id(){var d=jQuery(&quot;.menu li&quot;).length+1;var e=d;var a=0;try{var f=document.getElementById(&quot;menu-&quot;+e.toString()).value}catch(c){a=1}while(a==0){e=e+1;try{var b=document.getElementById(&quot;menu-&quot;+e.toString()).value}catch(c){a=1}}return e}function wp_get_hidden_inputs(j,a,k,f,n,l,b,m,h,e,d,c,i){var g=&quot;&quot;;g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-db-id[]&quot; id=&quot;menu-item-db-id'+j+'&quot; value=&quot;'+a+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-object-id[]&quot; id=&quot;menu-item-object-id'+j+'&quot; value=&quot;'+k+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-type[]&quot; id=&quot;menu-item-type'+j+'&quot; value=&quot;'+f+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-append[]&quot; id=&quot;menu-item-append'+j+'&quot; value=&quot;'+n+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-parent-id[]&quot; id=&quot;menu-item-parent-id'+j+'&quot; value=&quot;'+l+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-position[]&quot; id=&quot;menu-item-position'+j+'&quot; value=&quot;'+j+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-title[]&quot; id=&quot;menu-item-title'+j+'&quot; value=&quot;'+b+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-attr-title[]&quot; id=&quot;menu-item-attr-title'+j+'&quot; value=&quot;'+e+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-url[]&quot; id=&quot;menu-item-url'+j+'&quot; value=&quot;'+m+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-target[]&quot; id=&quot;menu-item-target'+j+'&quot; value=&quot;'+d+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-description[]&quot; id=&quot;menu-item-description'+j+'&quot; value=&quot;'+h+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-classes[]&quot; id=&quot;menu-item-classes'+j+'&quot; value=&quot;'+c+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-xfn[]&quot; id=&quot;menu-item-xfn'+j+'&quot; value=&quot;'+i+'&quot; /&gt;';return g}jQuery(document).ready(function(a){wp_drag_and_drop();a(&quot;#update-nav-menu .deletion&quot;).click(function(){if(confirm(navMenuL10n.warnDelete)){return true}else{return false}});a(&quot;#save_menu&quot;).click(function(){return wp_update_post_data()});a(&quot;#create-menu-name&quot;).keypress(function(b){if(13==b.keyCode){a(&quot;#create-menu-button&quot;).click();return false}});a(&quot;#custom-menu-item-url, #custom-menu-item-name&quot;).keypress(function(b){if(13==b.keyCode){a(&quot;#add-custom-links a.button&quot;).click();return false}}).focus(function(){if(a(this).val()==a(this).attr(&quot;defaultValue&quot;)&amp;&amp;a(this).attr(&quot;id&quot;)!=&quot;custom-menu-item-url&quot;){a(this).val(&quot;&quot;)}}).blur(function(){if(a(this).val()==&quot;&quot;){a(this).val(a(this).attr(&quot;defaultValue&quot;))}});a(&quot;#create-menu-name&quot;).focus(function(){if(a(this).val()==a(this).attr(&quot;defaultValue&quot;)){a(this).val(&quot;&quot;)}}).blur(function(){if(a(this).val()==&quot;&quot;){a(this).val(a(this).attr(&quot;defaultValue&quot;))}});a(&quot;.if-js-closed&quot;).removeClass(&quot;if-js-closed&quot;).addClass(&quot;closed&quot;);postboxes.add_postbox_toggles(&quot;menus&quot;);a(&quot;.quick-search&quot;).click(function(){a(this).attr(&quot;value&quot;,&quot;&quot;)});a(&quot;.quick-search-submit&quot;).click(function(){a(this).siblings(&quot;.quick-search&quot;).search()});a(&quot;#menu-container .item-edit&quot;).click(function(){return wp_edit_menu_item(a(this).attr(&quot;value&quot;))});a(&quot;#menu-container .item-delete&quot;).live(&quot;click&quot;,function(b){return wp_remove_menu_item(a(this).attr(&quot;value&quot;))});a(&quot;#update-menu-item&quot;).click(function(){wp_update_menu_item();return tb_remove()});a(&quot;#cancel-save&quot;).click(function(){return tb_remove()});a(&quot;.show-all&quot;).click(function(b){jQuery(b.currentTarget).parent().siblings(&quot;.list-wrap&quot;).css(&quot;display&quot;,&quot;block&quot;);jQuery(b.currentTarget).parent().siblings(&quot;.list-wrap&quot;).find(&quot;li&quot;).css(&quot;display&quot;,&quot;block&quot;);jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(&quot;.hide-all&quot;).show()});a(&quot;.hide-all&quot;).click(function(b){jQuery(b.currentTarget).parent().siblings(&quot;.list-wrap&quot;).css(&quot;display&quot;,&quot;none&quot;);jQuery(b.currentTarget).parent().siblings(&quot;.list-wrap&quot;).find(&quot;li&quot;).css(&quot;display&quot;,&quot;none&quot;);jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(&quot;.show-all&quot;).show()});a(&quot;.add-to-menu&quot;).click(function(b){return wp_add_checked_items_to_menu(b.currentTarget)});a(&quot;#add-custom-links .add-to-menu a&quot;).click(function(b){if(a(&quot;#custom-menu-item-url&quot;).val()==a(&quot;#custom-menu-item-url&quot;).attr(&quot;defaultValue&quot;)){return}wp_add_item_to_menu(0,&quot;&quot;,&quot;custom&quot;,navMenuL10n.custom,0,a(&quot;#custom-menu-item-name&quot;).val(),a(&quot;#custom-menu-item-url&quot;).val(),&quot;&quot;,&quot;&quot;,&quot;_self&quot;,&quot;&quot;,&quot;&quot;);a(&quot;#custom-menu-item-name&quot;).val(a(&quot;#custom-menu-item-name&quot;).attr(&quot;defaultValue&quot;));a(&quot;#custom-menu-item-url&quot;).val(a(&quot;#custom-menu-item-url&quot;).attr(&quot;defaultValue&quot;)).focus()})});function get_html_translation_table(i,g){var d={},f={},c=0,a=&quot;&quot;;var e={},b={};var j={},h={};e[0]=&quot;HTML_SPECIALCHARS&quot;;e[1]=&quot;HTML_ENTITIES&quot;;b[0]=&quot;ENT_NOQUOTES&quot;;b[2]=&quot;ENT_COMPAT&quot;;b[3]=&quot;ENT_QUOTES&quot;;j=!isNaN(i)?e[i]:i?i.toUpperCase():&quot;HTML_SPECIALCHARS&quot;;h=!isNaN(g)?b[g]:g?g.toUpperCase():&quot;ENT_COMPAT&quot;;if(j!==&quot;HTML_SPECIALCHARS&quot;&amp;&amp;j!==&quot;HTML_ENTITIES&quot;){throw new Error(&quot;Table: &quot;+j+&quot; not supported&quot;)}d[&quot;38&quot;]=&quot;&amp;amp;&quot;;if(j===&quot;HTML_ENTITIES&quot;){d[&quot;160&quot;]=&quot;&amp;nbsp;&quot;;d[&quot;161&quot;]=&quot;&amp;iexcl;&quot;;d[&quot;162&quot;]=&quot;&amp;cent;&quot;;d[&quot;163&quot;]=&quot;&amp;pound;&quot;;d[&quot;164&quot;]=&quot;&amp;curren;&quot;;d[&quot;165&quot;]=&quot;&amp;yen;&quot;;d[&quot;166&quot;]=&quot;&amp;brvbar;&quot;;d[&quot;167&quot;]=&quot;&amp;sect;&quot;;d[&quot;168&quot;]=&quot;&amp;uml;&quot;;d[&quot;169&quot;]=&quot;&amp;copy;&quot;;d[&quot;170&quot;]=&quot;&amp;ordf;&quot;;d[&quot;171&quot;]=&quot;&amp;laquo;&quot;;d[&quot;172&quot;]=&quot;&amp;not;&quot;;d[&quot;173&quot;]=&quot;&amp;shy;&quot;;d[&quot;174&quot;]=&quot;&amp;reg;&quot;;d[&quot;175&quot;]=&quot;&amp;macr;&quot;;d[&quot;176&quot;]=&quot;&amp;deg;&quot;;d[&quot;177&quot;]=&quot;&amp;plusmn;&quot;;d[&quot;178&quot;]=&quot;&amp;sup2;&quot;;d[&quot;179&quot;]=&quot;&amp;sup3;&quot;;d[&quot;180&quot;]=&quot;&amp;acute;&quot;;d[&quot;181&quot;]=&quot;&amp;micro;&quot;;d[&quot;182&quot;]=&quot;&amp;para;&quot;;d[&quot;183&quot;]=&quot;&amp;middot;&quot;;d[&quot;184&quot;]=&quot;&amp;cedil;&quot;;d[&quot;185&quot;]=&quot;&amp;sup1;&quot;;d[&quot;186&quot;]=&quot;&amp;ordm;&quot;;d[&quot;187&quot;]=&quot;&amp;raquo;&quot;;d[&quot;188&quot;]=&quot;&amp;frac14;&quot;;d[&quot;189&quot;]=&quot;&amp;frac12;&quot;;d[&quot;190&quot;]=&quot;&amp;frac34;&quot;;d[&quot;191&quot;]=&quot;&amp;iquest;&quot;;d[&quot;192&quot;]=&quot;&amp;Agrave;&quot;;d[&quot;193&quot;]=&quot;&amp;Aacute;&quot;;d[&quot;194&quot;]=&quot;&amp;Acirc;&quot;;d[&quot;195&quot;]=&quot;&amp;Atilde;&quot;;d[&quot;196&quot;]=&quot;&amp;Auml;&quot;;d[&quot;197&quot;]=&quot;&amp;Aring;&quot;;d[&quot;198&quot;]=&quot;&amp;AElig;&quot;;d[&quot;199&quot;]=&quot;&amp;Ccedil;&quot;;d[&quot;200&quot;]=&quot;&amp;Egrave;&quot;;d[&quot;201&quot;]=&quot;&amp;Eacute;&quot;;d[&quot;202&quot;]=&quot;&amp;Ecirc;&quot;;d[&quot;203&quot;]=&quot;&amp;Euml;&quot;;d[&quot;204&quot;]=&quot;&amp;Igrave;&quot;;d[&quot;205&quot;]=&quot;&amp;Iacute;&quot;;d[&quot;206&quot;]=&quot;&amp;Icirc;&quot;;d[&quot;207&quot;]=&quot;&amp;Iuml;&quot;;d[&quot;208&quot;]=&quot;&amp;ETH;&quot;;d[&quot;209&quot;]=&quot;&amp;Ntilde;&quot;;d[&quot;210&quot;]=&quot;&amp;Ograve;&quot;;d[&quot;211&quot;]=&quot;&amp;Oacute;&quot;;d[&quot;212&quot;]=&quot;&amp;Ocirc;&quot;;d[&quot;213&quot;]=&quot;&amp;Otilde;&quot;;d[&quot;214&quot;]=&quot;&amp;Ouml;&quot;;d[&quot;215&quot;]=&quot;&amp;times;&quot;;d[&quot;216&quot;]=&quot;&amp;Oslash;&quot;;d[&quot;217&quot;]=&quot;&amp;Ugrave;&quot;;d[&quot;218&quot;]=&quot;&amp;Uacute;&quot;;d[&quot;219&quot;]=&quot;&amp;Ucirc;&quot;;d[&quot;220&quot;]=&quot;&amp;Uuml;&quot;;d[&quot;221&quot;]=&quot;&amp;Yacute;&quot;;d[&quot;222&quot;]=&quot;&amp;THORN;&quot;;d[&quot;223&quot;]=&quot;&amp;szlig;&quot;;d[&quot;224&quot;]=&quot;&amp;agrave;&quot;;d[&quot;225&quot;]=&quot;&amp;aacute;&quot;;d[&quot;226&quot;]=&quot;&amp;acirc;&quot;;d[&quot;227&quot;]=&quot;&amp;atilde;&quot;;d[&quot;228&quot;]=&quot;&amp;auml;&quot;;d[&quot;229&quot;]=&quot;&amp;aring;&quot;;d[&quot;230&quot;]=&quot;&amp;aelig;&quot;;d[&quot;231&quot;]=&quot;&amp;ccedil;&quot;;d[&quot;232&quot;]=&quot;&amp;egrave;&quot;;d[&quot;233&quot;]=&quot;&amp;eacute;&quot;;d[&quot;234&quot;]=&quot;&amp;ecirc;&quot;;d[&quot;235&quot;]=&quot;&amp;euml;&quot;;d[&quot;236&quot;]=&quot;&amp;igrave;&quot;;d[&quot;237&quot;]=&quot;&amp;iacute;&quot;;d[&quot;238&quot;]=&quot;&amp;icirc;&quot;;d[&quot;239&quot;]=&quot;&amp;iuml;&quot;;d[&quot;240&quot;]=&quot;&amp;eth;&quot;;d[&quot;241&quot;]=&quot;&amp;ntilde;&quot;;d[&quot;242&quot;]=&quot;&amp;ograve;&quot;;d[&quot;243&quot;]=&quot;&amp;oacute;&quot;;d[&quot;244&quot;]=&quot;&amp;ocirc;&quot;;d[&quot;245&quot;]=&quot;&amp;otilde;&quot;;d[&quot;246&quot;]=&quot;&amp;ouml;&quot;;d[&quot;247&quot;]=&quot;&amp;divide;&quot;;d[&quot;248&quot;]=&quot;&amp;oslash;&quot;;d[&quot;249&quot;]=&quot;&amp;ugrave;&quot;;d[&quot;250&quot;]=&quot;&amp;uacute;&quot;;d[&quot;251&quot;]=&quot;&amp;ucirc;&quot;;d[&quot;252&quot;]=&quot;&amp;uuml;&quot;;d[&quot;253&quot;]=&quot;&amp;yacute;&quot;;d[&quot;254&quot;]=&quot;&amp;thorn;&quot;;d[&quot;255&quot;]=&quot;&amp;yuml;&quot;}if(h!==&quot;ENT_NOQUOTES&quot;){d[&quot;34&quot;]=&quot;&amp;quot;&quot;}if(h===&quot;ENT_QUOTES&quot;){d[&quot;39&quot;]=&quot;&amp;#39;&quot;}d[&quot;60&quot;]=&quot;&amp;lt;&quot;;d[&quot;62&quot;]=&quot;&amp;gt;&quot;;for(c in d){a=String.fromCharCode(c);f[a]=d[c]}return f}function htmlentities(c,f){var e={},d=&quot;&quot;,a=&quot;&quot;,b=&quot;&quot;;a=c.toString();if(false===(e=this.get_html_translation_table(&quot;HTML_ENTITIES&quot;,f))){return false}e[&quot;'&quot;]=&quot;&amp;#039;&quot;;for(d in e){b=e[d];a=a.split(d).join(b)}return a};
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminnavmenusphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/nav-menus.php (13738 => 13739)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/nav-menus.php        2010-03-17 19:33:20 UTC (rev 13738)
+++ trunk/wp-admin/nav-menus.php        2010-03-17 19:57:08 UTC (rev 13739)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx">                 check_admin_referer( 'update-nav_menu' );
</span><span class="cx"> 
</span><span class="cx">                 // Add Menu
</span><del>-                if ( isset($_POST['create-menu']) ) {
</del><ins>+                if ( isset($_POST['create-menu-button']) ) {
</ins><span class="cx">                         if ( current_theme_supports('nav-menus') ) {
</span><span class="cx">                                 $add_nav_menu = esc_html( $_POST['create-menu-name'] );
</span><span class="cx"> 
</span><span class="lines">@@ -86,77 +86,79 @@
</span><span class="cx">                                 }
</span><span class="cx">                                 unset($add_nav_menu);
</span><span class="cx">                         }
</span><del>-                } elseif ( isset($_POST['menu-name']) ) {
-                        $old_nav_menu = get_term( $nav_menu_selected_id, 'nav_menu', ARRAY_A );
-                        $args = array( 'name' =&gt; $_POST['menu-name'], 'slug' =&gt; null, 'description' =&gt; $old_nav_menu['description'], 'parent' =&gt; $old_nav_menu['parent'], );
-                        $new_nav_menu = wp_update_term( $nav_menu_selected_id, 'nav_menu', $args );
-                }
</del><ins>+                } else {
+                        if ( isset($_POST['menu-name']) ) {
+                                $old_nav_menu = get_term( $nav_menu_selected_id, 'nav_menu', ARRAY_A );
+                                $args = array( 'name' =&gt; $_POST['menu-name'], 'slug' =&gt; null, 'description' =&gt; $old_nav_menu['description'], 'parent' =&gt; $old_nav_menu['parent'], );
+                                $new_nav_menu = wp_update_term( $nav_menu_selected_id, 'nav_menu', $args );
+                        }
</ins><span class="cx"> 
</span><del>-                // Update menu items
-                $update_nav_items = isset( $_POST['li-count'] ) ? (int) $_POST['li-count'] : 0;
-                $update_nav_menu = is_nav_menu( $nav_menu_selected_id );
</del><ins>+                        // Update menu items
+                        $update_nav_items = isset( $_POST['li-count'] ) ? (int) $_POST['li-count'] : 0;
+                        $update_nav_menu = is_nav_menu( $nav_menu_selected_id );
</ins><span class="cx"> 
</span><del>-                if ( !is_wp_error($update_nav_menu) ) {
-                        $menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array('orderby' =&gt; 'ID', 'output' =&gt; ARRAY_A, 'output_key' =&gt; 'ID') );
-                        $parent_menu_ids = array();
</del><ins>+                        if ( !is_wp_error($update_nav_menu) ) {
+                                $menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array('orderby' =&gt; 'ID', 'output' =&gt; ARRAY_A, 'output_key' =&gt; 'ID') );
+                                $parent_menu_ids = array();
</ins><span class="cx"> 
</span><del>-                        // Loop through all POST variables
-                        for ( $k = 0; $k &lt; $update_nav_items; $k++ ) {
-                                $menu_item_db_id                 = isset( $_POST['menu-item-db-id'][$k] )                ? $_POST['menu-item-db-id'][$k]         : 0;
-                                $menu_item_object_id         = isset( $_POST['menu-item-object-id'][$k] )         ? $_POST['menu-item-object-id'][$k] : 0;
-                                $menu_item_parent_id         = isset( $_POST['menu-item-parent-id'][$k] )         ? $_POST['menu-item-parent-id'][$k] : 0;
-                                $menu_item_position         = isset( $_POST['menu-item-position'][$k] )         ? $_POST['menu-item-position'][$k]         : 0;
-                                $menu_item_type                 = isset( $_POST['menu-item-type'][$k] )                         ? $_POST['menu-item-type'][$k]                 : 'custom';
-                                $menu_item_append                 = isset( $_POST['menu-item-append'][$k] )                 ? $_POST['menu-item-append'][$k]        : 'custom';
</del><ins>+                                // Loop through all POST variables
+                                for ( $k = 0; $k &lt; $update_nav_items; $k++ ) {
+                                        $menu_item_db_id                 = isset( $_POST['menu-item-db-id'][$k] )                ? $_POST['menu-item-db-id'][$k]         : 0;
+                                        $menu_item_object_id         = isset( $_POST['menu-item-object-id'][$k] )         ? $_POST['menu-item-object-id'][$k] : 0;
+                                        $menu_item_parent_id         = isset( $_POST['menu-item-parent-id'][$k] )         ? $_POST['menu-item-parent-id'][$k] : 0;
+                                        $menu_item_position         = isset( $_POST['menu-item-position'][$k] )         ? $_POST['menu-item-position'][$k]         : 0;
+                                        $menu_item_type                 = isset( $_POST['menu-item-type'][$k] )                         ? $_POST['menu-item-type'][$k]                 : 'custom';
+                                        $menu_item_append                 = isset( $_POST['menu-item-append'][$k] )                 ? $_POST['menu-item-append'][$k]        : 'custom';
</ins><span class="cx"> 
</span><del>-                                $menu_item_title                 = isset( $_POST['menu-item-title'][$k] )                 ? $_POST['menu-item-title'][$k]         : '';
-                                $menu_item_url                         = isset( $_POST['menu-item-url'][$k] )                         ? $_POST['menu-item-url'][$k]                 : '';
-                                $menu_item_description         = isset( $_POST['menu-item-description'][$k] )         ? $_POST['menu-item-description'][$k]: '';
-                                $menu_item_attr_title          = isset( $_POST['menu-item-attr-title'][$k] )         ? $_POST['menu-item-attr-title'][$k] : '';
-                                $menu_item_target                 = isset( $_POST['menu-item-target'][$k] )                 ? $_POST['menu-item-target'][$k]         : 0;
-                                $menu_item_classes                 = isset( $_POST['menu-item-classes'][$k] )                 ? $_POST['menu-item-classes'][$k]         : '';
-                                $menu_item_xfn                         = isset( $_POST['menu-item-xfn'][$k] )                         ? $_POST['menu-item-xfn'][$k]                 : '';
</del><ins>+                                        $menu_item_title                 = isset( $_POST['menu-item-title'][$k] )                 ? $_POST['menu-item-title'][$k]         : '';
+                                        $menu_item_url                         = isset( $_POST['menu-item-url'][$k] )                         ? $_POST['menu-item-url'][$k]                 : '';
+                                        $menu_item_description         = isset( $_POST['menu-item-description'][$k] )         ? $_POST['menu-item-description'][$k]: '';
+                                        $menu_item_attr_title          = isset( $_POST['menu-item-attr-title'][$k] )         ? $_POST['menu-item-attr-title'][$k] : '';
+                                        $menu_item_target                 = isset( $_POST['menu-item-target'][$k] )                 ? $_POST['menu-item-target'][$k]         : 0;
+                                        $menu_item_classes                 = isset( $_POST['menu-item-classes'][$k] )                 ? $_POST['menu-item-classes'][$k]         : '';
+                                        $menu_item_xfn                         = isset( $_POST['menu-item-xfn'][$k] )                         ? $_POST['menu-item-xfn'][$k]                 : '';
</ins><span class="cx"> 
</span><del>-                                // Menu item title can't be blank
-                                if ( '' == $menu_item_title )
-                                        continue;
</del><ins>+                                        // Menu item title can't be blank
+                                        if ( '' == $menu_item_title )
+                                                continue;
</ins><span class="cx"> 
</span><del>-                                // Populate the menu item
-                                $post = array( 'post_status' =&gt; 'publish', 'post_type' =&gt; 'nav_menu_item', 'post_author' =&gt; $user_ID,
-                                        'ping_status' =&gt; 0, 'post_parent' =&gt; $menu_item_parent_id, 'menu_order' =&gt; $menu_item_position,
-                                        'post_excerpt' =&gt; $menu_item_attr_title, 'tax_input' =&gt; array( 'nav_menu' =&gt; $update_nav_menu-&gt;name ),
-                                        'post_content' =&gt; $menu_item_description, 'post_title' =&gt; $menu_item_title );
</del><ins>+                                        // Populate the menu item
+                                        $post = array( 'post_status' =&gt; 'publish', 'post_type' =&gt; 'nav_menu_item', 'post_author' =&gt; $user_ID,
+                                                'ping_status' =&gt; 0, 'post_parent' =&gt; $menu_item_parent_id, 'menu_order' =&gt; $menu_item_position,
+                                                'post_excerpt' =&gt; $menu_item_attr_title, 'tax_input' =&gt; array( 'nav_menu' =&gt; $update_nav_menu-&gt;name ),
+                                                'post_content' =&gt; $menu_item_description, 'post_title' =&gt; $menu_item_title );
</ins><span class="cx"> 
</span><del>-                                // New menu item
-                                if ( $menu_item_db_id == 0 ) {
-                                        $menu_item_db_id = wp_insert_post( $post );
-                                } elseif ( isset( $menu_items[$menu_item_db_id] ) ) {
-                                        $post['ID'] = $menu_item_db_id;
-                                        wp_update_post( $post );
-                                        unset( $menu_items[$menu_item_db_id] );
-                                }
-                                $parent_menu_ids[$k] = $menu_item_db_id;
</del><ins>+                                        // New menu item
+                                        if ( $menu_item_db_id == 0 ) {
+                                                $menu_item_db_id = wp_insert_post( $post );
+                                        } elseif ( isset( $menu_items[$menu_item_db_id] ) ) {
+                                                $post['ID'] = $menu_item_db_id;
+                                                wp_update_post( $post );
+                                                unset( $menu_items[$menu_item_db_id] );
+                                        }
+                                        $parent_menu_ids[$k] = $menu_item_db_id;
</ins><span class="cx"> 
</span><del>-                                // @todo sanitize type append and ID.
-                                update_post_meta( $menu_item_db_id, 'menu_item_type', $menu_item_type );
-                                update_post_meta( $menu_item_db_id, 'menu_item_append', $menu_item_append );
-                                update_post_meta( $menu_item_db_id, 'menu_item_object_id', $menu_item_object_id );
-                                update_post_meta( $menu_item_db_id, 'menu_item_target', sanitize_key($menu_item_target) );
-                                // @todo handle sanitizing multiple classes separated by whitespace.
-                                update_post_meta( $menu_item_db_id, 'menu_item_classes', sanitize_html_class($menu_item_classes) );
-                                update_post_meta( $menu_item_db_id, 'menu_item_xfn', sanitize_html_class($menu_item_xfn) );
</del><ins>+                                        // @todo sanitize type append and ID.
+                                        update_post_meta( $menu_item_db_id, 'menu_item_type', $menu_item_type );
+                                        update_post_meta( $menu_item_db_id, 'menu_item_append', $menu_item_append );
+                                        update_post_meta( $menu_item_db_id, 'menu_item_object_id', $menu_item_object_id );
+                                        update_post_meta( $menu_item_db_id, 'menu_item_target', sanitize_key($menu_item_target) );
+                                        // @todo handle sanitizing multiple classes separated by whitespace.
+                                        update_post_meta( $menu_item_db_id, 'menu_item_classes', sanitize_html_class($menu_item_classes) );
+                                        update_post_meta( $menu_item_db_id, 'menu_item_xfn', sanitize_html_class($menu_item_xfn) );
</ins><span class="cx"> 
</span><del>-                                // @todo: only save custom link urls.
-                                update_post_meta( $menu_item_db_id, 'menu_item_url', esc_url_raw( $menu_item_url ) );
-                        }
</del><ins>+                                        // @todo: only save custom link urls.
+                                        update_post_meta( $menu_item_db_id, 'menu_item_url', esc_url_raw( $menu_item_url ) );
+                                }
</ins><span class="cx"> 
</span><del>-                        // Remove menu items from the menu that weren't in $_POST
-                        if ( !empty( $menu_items ) ) {
-                                foreach ( array_keys( $menu_items ) as $menu_item_id ) {
-                                        wp_delete_post( $menu_item_id );
</del><ins>+                                // Remove menu items from the menu that weren't in $_POST
+                                if ( !empty( $menu_items ) ) {
+                                        foreach ( array_keys( $menu_items ) as $menu_item_id ) {
+                                                wp_delete_post( $menu_item_id );
+                                        }
</ins><span class="cx">                                 }
</span><ins>+                                $messages_div = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . __('The menu has been updated.') . '&lt;/p&gt;&lt;/div&gt;';
</ins><span class="cx">                         }
</span><del>-                        $messages_div = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . __('The menu has been updated.') . '&lt;/p&gt;&lt;/div&gt;';
</del><span class="cx">                 }
</span><span class="cx">                 break;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>