<!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>[14285] trunk: Fix handling of nav menu search, also menu naming conflicts.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/14285">14285</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-04-28 20:44:08 +0000 (Wed, 28 Apr 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix handling of nav menu search, also menu naming conflicts. props filosofo, fixes <a href="http://trac.wordpress.org/ticket/13138">#13138</a></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>
<li><a href="#trunkwpincludesnavmenuphp">trunk/wp-includes/nav-menu.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.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 (14284 => 14285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/nav-menu.php        2010-04-28 20:21:06 UTC (rev 14284)
+++ trunk/wp-admin/includes/nav-menu.php        2010-04-28 20:44:08 UTC (rev 14285)
</span><span class="lines">@@ -216,6 +216,8 @@
</span><span class="cx">                                 'post_type' =&gt; $matches[2],
</span><span class="cx">                                 's' =&gt; $query,
</span><span class="cx">                         ));
</span><ins>+                        if ( ! have_posts() )
+                                        echo '-1';
</ins><span class="cx">                         while ( have_posts() ) {
</span><span class="cx">                                 the_post();
</span><span class="cx">                                 if ( 'markup' == $response_format ) {
</span><span class="lines">@@ -236,6 +238,8 @@
</span><span class="cx">                                 'name__like' =&gt; $query,
</span><span class="cx">                                 'number' =&gt; 10,
</span><span class="cx">                         ));
</span><ins>+                        if ( empty( $terms ) || is_wp_error( $terms ) )
+                                echo '-1';
</ins><span class="cx">                         foreach( (array) $terms as $term ) {
</span><span class="cx">                                 if ( 'markup' == $response_format ) {
</span><span class="cx">                                         echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args );
</span><span class="lines">@@ -531,6 +535,10 @@
</span><span class="cx">                                 $args['walker'] = new Walker_Nav_Menu_Checklist;
</span><span class="cx">                                 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
</span><span class="cx">                                 ?&gt;
</span><ins>+                        &lt;?php elseif ( is_wp_error( $search_results ) ) : ?&gt;
+                                &lt;li&gt;&lt;?php echo $search_results-&gt;get_error_message(); ?&gt;&lt;/li&gt;
+                        &lt;?php elseif ( ! empty( $searched ) ) : ?&gt;
+                                &lt;li&gt;&lt;?php _e('No results found.'); ?&gt;&lt;/li&gt;
</ins><span class="cx">                         &lt;?php endif; ?&gt;
</span><span class="cx">                         &lt;/ul&gt;
</span><span class="cx">                 &lt;/div&gt;&lt;!-- /.tabs-panel --&gt;
</span><span class="lines">@@ -698,6 +706,10 @@
</span><span class="cx">                                 $args['walker'] = $walker;
</span><span class="cx">                                 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
</span><span class="cx">                                 ?&gt;
</span><ins>+                        &lt;?php elseif ( is_wp_error( $search_results ) ) : ?&gt;
+                                &lt;li&gt;&lt;?php echo $search_results-&gt;get_error_message(); ?&gt;&lt;/li&gt;
+                        &lt;?php elseif ( ! empty( $searched ) ) : ?&gt;
+                                &lt;li&gt;&lt;?php _e('No results found.'); ?&gt;&lt;/li&gt;
</ins><span class="cx">                         &lt;?php endif; ?&gt;
</span><span class="cx">                         &lt;/ul&gt;
</span><span class="cx">                 &lt;/div&gt;&lt;!-- /.tabs-panel --&gt;
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.dev.js (14284 => 14285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.dev.js        2010-04-28 20:21:06 UTC (rev 14284)
+++ trunk/wp-admin/js/nav-menu.dev.js        2010-04-28 20:44:08 UTC (rev 14285)
</span><span class="lines">@@ -614,6 +614,7 @@
</span><span class="cx">                         i,
</span><span class="cx">                         items,
</span><span class="cx">                         matched,
</span><ins>+                        message,
</ins><span class="cx">                         newID,
</span><span class="cx">                         pattern = new RegExp('menu-item\\[(\[^\\]\]*)'),
</span><span class="cx">                         resultList;
</span><span class="lines">@@ -642,12 +643,17 @@
</span><span class="cx">                                         resultList.appendChild(items[0]);
</span><span class="cx">                                 }
</span><span class="cx">                         } else if ( req.type ) {
</span><del>-                                matched = /quick-search-posttype-([a-zA-Z_-]*)/.exec(req.type);
-                                if ( matched &amp;&amp; matched[1] ) {
-                                        resultList = document.getElementById(matched[1] + '-search-checklist');
</del><ins>+                                matched = /quick-search-(posttype|taxonomy)-([a-zA-Z_-]*)/.exec(req.type);
+                                if ( matched &amp;&amp; matched[2] ) {
+                                        resultList = document.getElementById(matched[2] + '-search-checklist');
</ins><span class="cx">                                         if ( resultList ) {
</span><span class="cx">                                                 resultList.innerHTML = '';
</span><span class="cx">                                                 i = items.length;
</span><ins>+                                                if ( ! i ) {
+                                                        message = document.createElement('li');
+                                                        message.appendChild(document.createTextNode(navMenuL10n.noResultsFound));
+                                                        resultList.appendChild(message);
+                                                }
</ins><span class="cx">                                                 while( i-- ) {
</span><span class="cx">                                                         resultList.appendChild(items[i]);
</span><span class="cx">                                                 }
</span></span></pre></div>
<a id="trunkwpadminjsnavmenujs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.js (14284 => 14285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.js        2010-04-28 20:21:06 UTC (rev 14284)
+++ trunk/wp-admin/js/nav-menu.js        2010-04-28 20:44:08 UTC (rev 14285)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var WPNavMenuHandler=function(){var i=jQuery,a=false,k=null,h,d,n,j,m={},o=function(q,u,r,t){if(q&amp;&amp;q[0]){var s=i.parseJSON(q[0]);if(s.post_title){if(s.ID&amp;&amp;s.post_type){m[s.post_title]={ID:s.ID,object_type:s.post_type}}return s.post_title}}},p=function(q,u,r,t){if(q&amp;&amp;q[0]){var s=i.parseJSON(q[0]);if(s.post_title){return s.post_title}}},b=function(w,v){if(!w){return false}v=v||document;var r=[&quot;menu-item-db-id&quot;,&quot;menu-item-object-id&quot;,&quot;menu-item-object&quot;,&quot;menu-item-parent-id&quot;,&quot;menu-item-position&quot;,&quot;menu-item-type&quot;,&quot;menu-item-append&quot;,&quot;menu-item-title&quot;,&quot;menu-item-url&quot;,&quot;menu-item-description&quot;,&quot;menu-item-attr-title&quot;,&quot;menu-item-target&quot;,&quot;menu-item-classes&quot;,&quot;menu-item-xfn&quot;],q={},s=v.getElementsByTagName(&quot;input&quot;),u=s.length,t,x=document.getElementById(&quot;nav-menu-meta-object-id&quot;).value;while(u--){t=r.length;while(t--){if(s[u]&amp;&amp;s[u].name&amp;&amp;&quot;menu-item[&quot;+w+&quot;][&quot;+r[t]+&quot;]&quot;==s[u].name){q[r[t]]=s[u].value}}}return q},c=function(){var u=this.getElementsByTagName(&quot;input&quot;),r=u.length,q,t,s;while(r--){if(-1!=u[r].name.indexOf(&quot;menu-item-parent-id[&quot;+parseInt(this.id.replace(&quot;menu-item-&quot;,&quot;&quot;),10)+&quot;]&quot;)){if(!this.parentNode.className||-1==this.parentNode.className.indexOf(&quot;sub-menu&quot;)){u[r].value=0}else{if(&quot;LI&quot;==this.parentNode.parentNode.nodeName&amp;&amp;-1!=this.parentNode.parentNode.id.indexOf(&quot;menu-item-&quot;)){t=this.parentNode.parentNode;s=t.getElementsByTagName(&quot;input&quot;);q=s.length;while(q--){if(s[q].name&amp;&amp;-1!=s[q].name.indexOf(&quot;menu-item-object-id[&quot;+parseInt(t.id.replace(&quot;menu-item-&quot;,&quot;&quot;),10)+&quot;]&quot;)){u[r].value=parseInt(s[q].value,10);break}}}}break}}},e=function(r,t){var s=document.getElementById(&quot;nav-menu-meta&quot;),q;while(r.parentNode&amp;&amp;(!r.className||-1==r.className.indexOf(t))&amp;&amp;r.parentNode!=s){r=r.parentNode}return r},f=function(q){var r=this;i(q).droppable({accept:&quot;.menu li&quot;,tolerance:&quot;pointer&quot;,drop:function(t,s){r.eventOnDrop(s.draggable[0],this,s,t)},over:function(t,s){r.eventOnDragOver(s.draggable[0],this,s,t)},out:function(t,s){r.eventOnDragOut(s.draggable[0],this,s,t)}})},l,g=function(t){if(!t){return}var r=document.getElementById(t.id+&quot;-dummy-list-item&quot;),q=t.getElementsByTagName(&quot;li&quot;),s=q.length;if(!r){r=document.createElement(&quot;li&quot;);r.id=t.id+&quot;-dummy-list-item&quot;;t.appendChild(r);this.setupListItemDragAndDrop(r)}while(s--){this.setupListItemDragAndDrop(q[s])}};return{init:function(){l=document.getElementById(&quot;menu-to-edit&quot;);this.attachMenuEditListeners();this.attachMenuMetaListeners(document.getElementById(&quot;nav-menu-meta&quot;));this.attachTabsPanelListeners();g.call(this,l);postboxes.add_postbox_toggles(&quot;nav-menus&quot;)},attachMenuEditListeners:function(){var q=this;i(&quot;#update-nav-menu&quot;).bind(&quot;click&quot;,function(r){if(r.target&amp;&amp;r.target.className){if(-1!=r.target.className.indexOf(&quot;item-edit&quot;)){return q.eventOnClickEditLink(r.target)}else{if(-1!=r.target.className.indexOf(&quot;menu-delete&quot;)){return q.eventOnClickMenuDelete(r.target)}else{if(-1!=r.target.className.indexOf(&quot;item-delete&quot;)){return q.eventOnClickMenuItemDelete(r.target)}}}}})},attachMenuMetaListeners:function(q){if(!q){return}var r=this;h=document.getElementById(&quot;custom-menu-item-name&quot;);d=document.getElementById(&quot;custom-menu-item-url&quot;);if(h){n=&quot;undefined&quot;!=typeof h.defaultValue?h.defaultValue:h.getAttribute(&quot;value&quot;);j=&quot;undefined&quot;!=typeof d.defaultValue?d.defaultValue:d.getAttribute(&quot;value&quot;);i(h).bind(&quot;focus&quot;,function(s){this.value=n==this.value?&quot;&quot;:this.value});i(h).bind(&quot;blur&quot;,function(s){this.value=&quot;&quot;==this.value?n:this.value})}i(&quot;input.quick-search&quot;).each(function(s,t){r.setupQuickSearchEventListeners(t)});i(q).bind(&quot;submit&quot;,function(s){return r.eventSubmitMetaForm.call(r,this,s)})},attachTabsPanelListeners:function(){i(&quot;#menu-settings-column&quot;).bind(&quot;click&quot;,function(v){if(v.target&amp;&amp;v.target.className&amp;&amp;-1!=v.target.className.indexOf(&quot;menu-tab-link&quot;)){var w,r=/#(.*)$/.exec(v.target.href),u,x=e(v.target,&quot;inside&quot;),q=x?x.getElementsByTagName(&quot;input&quot;):[],s=q.length;while(s--){q[s].checked=false}i(&quot;.tabs-panel&quot;,x).each(function(){if(this.className){this.className=this.className.replace(&quot;tabs-panel-active&quot;,&quot;tabs-panel-inactive&quot;)}});i(&quot;.tabs&quot;,x).each(function(){this.className=this.className.replace(&quot;tabs&quot;,&quot;&quot;)});v.target.parentNode.className+=&quot; tabs&quot;;if(r&amp;&amp;r[1]){w=document.getElementById(r[1]);if(w){w.className=w.className.replace(&quot;tabs-panel-inactive&quot;,&quot;tabs-panel-active&quot;)}}return false}else{if(v.target&amp;&amp;v.target.className&amp;&amp;-1!=v.target.className.indexOf(&quot;select-all&quot;)){var t=/#(.*)$/.exec(v.target.href);if(t&amp;&amp;t[1]){i(&quot;#&quot;+t[1]+&quot; .tabs-panel-active input[type=checkbox]&quot;).attr(&quot;checked&quot;,&quot;checked&quot;);return false}}}})},setupListItemDragAndDrop:function(s){var q=s.getElementsByTagName(&quot;dl&quot;),t=this.makeListItemDropzone(s),r=q.length;f.call(this,t);this.makeListItemDraggable(s);while(r--){f.call(this,q[r])}},setupQuickSearchEventListeners:function(q){var r=this;i(q).autocomplete(ajaxurl+&quot;?action=menu-quick-search&amp;type=&quot;+q.name,{delay:500,formatItem:o,formatResult:p,minchars:2,multiple:false}).bind(&quot;blur&quot;,function(u){var s=m[this.value],t=this;if(s){i.post(ajaxurl+&quot;?action=menu-quick-search&amp;type=get-post-item&amp;response-format=markup&quot;,s,function(v){r.processQuickSearchQueryResponse.call(r,v,s);m[t.value]=false})}})},eventOnClickEditLink:function(q){var s,r=/#(.*)$/.exec(q.href);if(r&amp;&amp;r[1]){s=document.getElementById(r[1]);if(s){if(-1!=s.className.indexOf(&quot;menu-item-edit-inactive&quot;)){s.className=s.className.replace(&quot;menu-item-edit-inactive&quot;,&quot;menu-item-edit-active&quot;)}else{s.className=s.className.replace(&quot;menu-item-edit-active&quot;,&quot;menu-item-edit-inactive&quot;)}return false}}},eventOnClickMenuDelete:function(q){if(confirm(navMenuL10n.warnDeleteMenu)){return true}else{return false}},eventOnClickMenuItemDelete:function(q){var t,s,r=this;if(confirm(navMenuL10n.warnDeleteMenuItem)){s=/_wpnonce=([a-zA-Z0-9]*)$/.exec(q.href);if(s&amp;&amp;s[1]){t=parseInt(q.id.replace(&quot;delete-&quot;,&quot;&quot;),10);i.post(ajaxurl,{action:&quot;delete-menu-item&quot;,&quot;menu-item&quot;:t,_wpnonce:s[1]},function(u){if(&quot;1&quot;==u){r.removeMenuItem(document.getElementById(&quot;menu-item-&quot;+t))}});return false}return true}else{return false}},eventOnDragOver:function(q,r){a=true;k=r;r.className+=&quot; sortable-placeholder&quot;},eventOnDragOut:function(q,r){a=false;(function(s){setTimeout(function(){if(s!=k||(!a&amp;&amp;s.className&amp;&amp;-1!=s.className.indexOf(&quot;sortable-placeholder&quot;))){s.className=s.className.replace(/sortable-placeholder/g,&quot;&quot;)}},800)})(r)},eventOnDrop:function(t,w){var u=!!(-1==w.className.indexOf(&quot;dropzone&quot;)),r=w.parentNode.getElementsByTagName(&quot;ul&quot;),v=false,s=r.length,q;a=false;w.className=w.className.replace(/sortable-placeholder/g,&quot;&quot;);if(u){while(s--){if(r[s]&amp;&amp;1!=r[s].className.indexOf(&quot;sub-menu&quot;)){v=true;q=r[s]}}if(!v){q=document.createElement(&quot;ul&quot;);q.className=&quot;sub-menu&quot;;w.parentNode.appendChild(q)}q.appendChild(t)}else{w.parentNode.parentNode.insertBefore(t,w.parentNode)}this.recalculateSortOrder(l);c.call(t)},eventSubmitMetaForm:function(r,y){var v,w=r.getElementsByTagName(&quot;input&quot;),u=w.length,t,A,q,x,s={},z=function(){},B=new RegExp(&quot;menu-item\\[([^\\]]*)&quot;);that=this;s.action=&quot;&quot;;while(u--){if(w[u].name&amp;&amp;-1!=w[u].name.indexOf(&quot;menu-item-object-id&quot;)&amp;&amp;w[u].checked||(&quot;undefined&quot;!=typeof w[u].id&amp;&amp;&quot;custom-menu-item-url&quot;==w[u].id&amp;&amp;&quot;&quot;!=w[u].value&amp;&amp;&quot;http://&quot;!=w[u].value)){s.action=&quot;add-menu-item&quot;;z=that.processAddMenuItemResponse;x=B.exec(w[u].name);q=&quot;undefined&quot;==typeof x[1]?0:parseInt(x[1],10);A=b(q);for(t in A){s[&quot;menu-item[&quot;+q+&quot;][&quot;+t+&quot;]&quot;]=A[t]}v=e(w[u],&quot;inside&quot;);w[u].checked=false}else{if(&quot;&quot;==s.action&amp;&amp;&quot;&quot;!=w[u].value&amp;&amp;w[u].className&amp;&amp;-1!=w[u].className.search(/quick-search\b[^-]/)){v=e(w[u],&quot;inside&quot;);s.action=&quot;menu-quick-search&quot;;s.q=w[u].value;s[&quot;response-format&quot;]=&quot;markup&quot;;s.type=w[u].name;z=that.processQuickSearchQueryResponse}}}if(v){v.className=v.className+&quot; processing&quot;,s.menu=r.elements.menu.value}s[&quot;menu-settings-column-nonce&quot;]=r.elements[&quot;menu-settings-column-nonce&quot;].value;i.post(ajaxurl,s,function(C){z.call(that,C,s);v.className=v.className.replace(/processing/g,&quot;&quot;)});return false},makeListItemDraggable:function(q){i(q).draggable({handle:&quot; &gt; dl&quot;,opacity:0.8,addClasses:false,helper:&quot;clone&quot;,zIndex:100})},makeListItemDropzone:function(s){if(!s){return false}var r=s.getElementsByTagName(&quot;div&quot;),q=r.length,t=document.createElement(&quot;div&quot;);while(q--){if(r[q].className&amp;&amp;-1!=r[q].className.indexOf(&quot;dropzone&quot;)&amp;&amp;(s==r[q].parentNode)){return r[q]}}t.className=&quot;dropzone&quot;;s.insertBefore(t,s.firstChild);return t},processAddMenuItemResponse:function(q,v){if(!v){v={}}var w,r=document.getElementById(l.id+&quot;-dummy-list-item&quot;),t,s,u=document.createElement(&quot;ul&quot;);u.innerHTML=q;s=u.getElementsByTagName(&quot;li&quot;);t=s.length;while(t--){this.setupListItemDragAndDrop(s[t]);if(r){l.insertBefore(s[t],r)}else{l.appendChild(s[t])}}this.recalculateSortOrder(l);if(h&amp;&amp;d){h.value=n;d.value=j}},processQuickSearchQueryResponse:function(u,z){if(!z){z={}}var r=document.createElement(&quot;ul&quot;),q=document.getElementById(&quot;nav-menu-meta&quot;),v,y,s,w,x=new RegExp(&quot;menu-item\\[([^\\]]*)&quot;),t;s=x.exec(u);if(s&amp;&amp;s[1]){w=s[1];while(q.elements[&quot;menu-item[&quot;+w+&quot;][menu-item-type]&quot;]){w--}if(w!=s[1]){u=u.replace(new RegExp(&quot;menu-item\\[&quot;+s[1]+&quot;\\]&quot;,&quot;g&quot;),&quot;menu-item[&quot;+w+&quot;]&quot;)}}r.innerHTML=u;y=r.getElementsByTagName(&quot;li&quot;);if(y[0]&amp;&amp;z.object_type){t=document.getElementById(z.object_type+&quot;-search-checklist&quot;);if(t){t.innerHTML=&quot;&quot;;t.appendChild(y[0])}}else{if(z.type){s=/quick-search-posttype-([a-zA-Z_-]*)/.exec(z.type);if(s&amp;&amp;s[1]){t=document.getElementById(s[1]+&quot;-search-checklist&quot;);if(t){t.innerHTML=&quot;&quot;;v=y.length;while(v--){t.appendChild(y[v])}}}}}},recalculateSortOrder:function(s){var t=s.getElementsByTagName(&quot;input&quot;),r,q=0;for(r=0;r&lt;t.length;r++){if(t[r].name&amp;&amp;-1!=t[r].name.indexOf(&quot;menu-item-position&quot;)){t[r].value=++q}}},removeMenuItem:function(s){if(!s){return false}var t=s.getElementsByTagName(&quot;ul&quot;),r,q;if(t[0]){r=t[0].getElementsByTagName(&quot;li&quot;);for(q=0;q&lt;r.length;q++){if(r[q].id&amp;&amp;-1!=r[q].id.indexOf(&quot;menu-item-&quot;)&amp;&amp;r[q].parentNode==t[0]){s.parentNode.insertBefore(r[q],s)}}}s.className+=&quot; deleting&quot;;i(s).fadeOut(350,function(){this.parentNode.removeChild(this)});this.recalculateSortOrder(l)}}};var wpNavMenu=new WPNavMenuHandler();jQuery(function(){wpNavMenu.init()});
</del><span class="cx">\ No newline at end of file
</span><ins>+var WPNavMenuHandler=function(){var i=jQuery,a=false,k=null,h,d,n,j,m={},o=function(q,u,r,t){if(q&amp;&amp;q[0]){var s=i.parseJSON(q[0]);if(s.post_title){if(s.ID&amp;&amp;s.post_type){m[s.post_title]={ID:s.ID,object_type:s.post_type}}return s.post_title}}},p=function(q,u,r,t){if(q&amp;&amp;q[0]){var s=i.parseJSON(q[0]);if(s.post_title){return s.post_title}}},b=function(w,v){if(!w){return false}v=v||document;var r=[&quot;menu-item-db-id&quot;,&quot;menu-item-object-id&quot;,&quot;menu-item-object&quot;,&quot;menu-item-parent-id&quot;,&quot;menu-item-position&quot;,&quot;menu-item-type&quot;,&quot;menu-item-append&quot;,&quot;menu-item-title&quot;,&quot;menu-item-url&quot;,&quot;menu-item-description&quot;,&quot;menu-item-attr-title&quot;,&quot;menu-item-target&quot;,&quot;menu-item-classes&quot;,&quot;menu-item-xfn&quot;],q={},s=v.getElementsByTagName(&quot;input&quot;),u=s.length,t,x=document.getElementById(&quot;nav-menu-meta-object-id&quot;).value;while(u--){t=r.length;while(t--){if(s[u]&amp;&amp;s[u].name&amp;&amp;&quot;menu-item[&quot;+w+&quot;][&quot;+r[t]+&quot;]&quot;==s[u].name){q[r[t]]=s[u].value}}}return q},c=function(){var u=this.getElementsByTagName(&quot;input&quot;),r=u.length,q,t,s;while(r--){if(-1!=u[r].name.indexOf(&quot;menu-item-parent-id[&quot;+parseInt(this.id.replace(&quot;menu-item-&quot;,&quot;&quot;),10)+&quot;]&quot;)){if(!this.parentNode.className||-1==this.parentNode.className.indexOf(&quot;sub-menu&quot;)){u[r].value=0}else{if(&quot;LI&quot;==this.parentNode.parentNode.nodeName&amp;&amp;-1!=this.parentNode.parentNode.id.indexOf(&quot;menu-item-&quot;)){t=this.parentNode.parentNode;s=t.getElementsByTagName(&quot;input&quot;);q=s.length;while(q--){if(s[q].name&amp;&amp;-1!=s[q].name.indexOf(&quot;menu-item-object-id[&quot;+parseInt(t.id.replace(&quot;menu-item-&quot;,&quot;&quot;),10)+&quot;]&quot;)){u[r].value=parseInt(s[q].value,10);break}}}}break}}},e=function(r,t){var s=document.getElementById(&quot;nav-menu-meta&quot;),q;while(r.parentNode&amp;&amp;(!r.className||-1==r.className.indexOf(t))&amp;&amp;r.parentNode!=s){r=r.parentNode}return r},f=function(q){var r=this;i(q).droppable({accept:&quot;.menu li&quot;,tolerance:&quot;pointer&quot;,drop:function(t,s){r.eventOnDrop(s.draggable[0],this,s,t)},over:function(t,s){r.eventOnDragOver(s.draggable[0],this,s,t)},out:function(t,s){r.eventOnDragOut(s.draggable[0],this,s,t)}})},l,g=function(t){if(!t){return}var r=document.getElementById(t.id+&quot;-dummy-list-item&quot;),q=t.getElementsByTagName(&quot;li&quot;),s=q.length;if(!r){r=document.createElement(&quot;li&quot;);r.id=t.id+&quot;-dummy-list-item&quot;;t.appendChild(r);this.setupListItemDragAndDrop(r)}while(s--){this.setupListItemDragAndDrop(q[s])}};return{init:function(){l=document.getElementById(&quot;menu-to-edit&quot;);this.attachMenuEditListeners();this.attachMenuMetaListeners(document.getElementById(&quot;nav-menu-meta&quot;));this.attachTabsPanelListeners();g.call(this,l);postboxes.add_postbox_toggles(&quot;nav-menus&quot;)},attachMenuEditListeners:function(){var q=this;i(&quot;#update-nav-menu&quot;).bind(&quot;click&quot;,function(r){if(r.target&amp;&amp;r.target.className){if(-1!=r.target.className.indexOf(&quot;item-edit&quot;)){return q.eventOnClickEditLink(r.target)}else{if(-1!=r.target.className.indexOf(&quot;menu-delete&quot;)){return q.eventOnClickMenuDelete(r.target)}else{if(-1!=r.target.className.indexOf(&quot;item-delete&quot;)){return q.eventOnClickMenuItemDelete(r.target)}}}}})},attachMenuMetaListeners:function(q){if(!q){return}var r=this;h=document.getElementById(&quot;custom-menu-item-name&quot;);d=document.getElementById(&quot;custom-menu-item-url&quot;);if(h){n=&quot;undefined&quot;!=typeof h.defaultValue?h.defaultValue:h.getAttribute(&quot;value&quot;);j=&quot;undefined&quot;!=typeof d.defaultValue?d.defaultValue:d.getAttribute(&quot;value&quot;);i(h).bind(&quot;focus&quot;,function(s){this.value=n==this.value?&quot;&quot;:this.value});i(h).bind(&quot;blur&quot;,function(s){this.value=&quot;&quot;==this.value?n:this.value})}i(&quot;input.quick-search&quot;).each(function(s,t){r.setupQuickSearchEventListeners(t)});i(q).bind(&quot;submit&quot;,function(s){return r.eventSubmitMetaForm.call(r,this,s)})},attachTabsPanelListeners:function(){i(&quot;#menu-settings-column&quot;).bind(&quot;click&quot;,function(v){if(v.target&amp;&amp;v.target.className&amp;&amp;-1!=v.target.className.indexOf(&quot;menu-tab-link&quot;)){var w,r=/#(.*)$/.exec(v.target.href),u,x=e(v.target,&quot;inside&quot;),q=x?x.getElementsByTagName(&quot;input&quot;):[],s=q.length;while(s--){q[s].checked=false}i(&quot;.tabs-panel&quot;,x).each(function(){if(this.className){this.className=this.className.replace(&quot;tabs-panel-active&quot;,&quot;tabs-panel-inactive&quot;)}});i(&quot;.tabs&quot;,x).each(function(){this.className=this.className.replace(&quot;tabs&quot;,&quot;&quot;)});v.target.parentNode.className+=&quot; tabs&quot;;if(r&amp;&amp;r[1]){w=document.getElementById(r[1]);if(w){w.className=w.className.replace(&quot;tabs-panel-inactive&quot;,&quot;tabs-panel-active&quot;)}}return false}else{if(v.target&amp;&amp;v.target.className&amp;&amp;-1!=v.target.className.indexOf(&quot;select-all&quot;)){var t=/#(.*)$/.exec(v.target.href);if(t&amp;&amp;t[1]){i(&quot;#&quot;+t[1]+&quot; .tabs-panel-active input[type=checkbox]&quot;).attr(&quot;checked&quot;,&quot;checked&quot;);return false}}}})},setupListItemDragAndDrop:function(s){var q=s.getElementsByTagName(&quot;dl&quot;),t=this.makeListItemDropzone(s),r=q.length;f.call(this,t);this.makeListItemDraggable(s);while(r--){f.call(this,q[r])}},setupQuickSearchEventListeners:function(q){var r=this;i(q).autocomplete(ajaxurl+&quot;?action=menu-quick-search&amp;type=&quot;+q.name,{delay:500,formatItem:o,formatResult:p,minchars:2,multiple:false}).bind(&quot;blur&quot;,function(u){var s=m[this.value],t=this;if(s){i.post(ajaxurl+&quot;?action=menu-quick-search&amp;type=get-post-item&amp;response-format=markup&quot;,s,function(v){r.processQuickSearchQueryResponse.call(r,v,s);m[t.value]=false})}})},eventOnClickEditLink:function(q){var s,r=/#(.*)$/.exec(q.href);if(r&amp;&amp;r[1]){s=document.getElementById(r[1]);if(s){if(-1!=s.className.indexOf(&quot;menu-item-edit-inactive&quot;)){s.className=s.className.replace(&quot;menu-item-edit-inactive&quot;,&quot;menu-item-edit-active&quot;)}else{s.className=s.className.replace(&quot;menu-item-edit-active&quot;,&quot;menu-item-edit-inactive&quot;)}return false}}},eventOnClickMenuDelete:function(q){if(confirm(navMenuL10n.warnDeleteMenu)){return true}else{return false}},eventOnClickMenuItemDelete:function(q){var t,s,r=this;if(confirm(navMenuL10n.warnDeleteMenuItem)){s=/_wpnonce=([a-zA-Z0-9]*)$/.exec(q.href);if(s&amp;&amp;s[1]){t=parseInt(q.id.replace(&quot;delete-&quot;,&quot;&quot;),10);i.post(ajaxurl,{action:&quot;delete-menu-item&quot;,&quot;menu-item&quot;:t,_wpnonce:s[1]},function(u){if(&quot;1&quot;==u){r.removeMenuItem(document.getElementById(&quot;menu-item-&quot;+t))}});return false}return true}else{return false}},eventOnDragOver:function(q,r){a=true;k=r;r.className+=&quot; sortable-placeholder&quot;},eventOnDragOut:function(q,r){a=false;(function(s){setTimeout(function(){if(s!=k||(!a&amp;&amp;s.className&amp;&amp;-1!=s.className.indexOf(&quot;sortable-placeholder&quot;))){s.className=s.className.replace(/sortable-placeholder/g,&quot;&quot;)}},800)})(r)},eventOnDrop:function(t,w){var u=!!(-1==w.className.indexOf(&quot;dropzone&quot;)),r=w.parentNode.getElementsByTagName(&quot;ul&quot;),v=false,s=r.length,q;a=false;w.className=w.className.replace(/sortable-placeholder/g,&quot;&quot;);if(u){while(s--){if(r[s]&amp;&amp;1!=r[s].className.indexOf(&quot;sub-menu&quot;)){v=true;q=r[s]}}if(!v){q=document.createElement(&quot;ul&quot;);q.className=&quot;sub-menu&quot;;w.parentNode.appendChild(q)}q.appendChild(t)}else{w.parentNode.parentNode.insertBefore(t,w.parentNode)}this.recalculateSortOrder(l);c.call(t)},eventSubmitMetaForm:function(r,y){var v,w=r.getElementsByTagName(&quot;input&quot;),u=w.length,t,A,q,x,s={},z=function(){},B=new RegExp(&quot;menu-item\\[([^\\]]*)&quot;);that=this;s.action=&quot;&quot;;while(u--){if(w[u].name&amp;&amp;-1!=w[u].name.indexOf(&quot;menu-item-object-id&quot;)&amp;&amp;w[u].checked||(&quot;undefined&quot;!=typeof w[u].id&amp;&amp;&quot;custom-menu-item-url&quot;==w[u].id&amp;&amp;&quot;&quot;!=w[u].value&amp;&amp;&quot;http://&quot;!=w[u].value)){s.action=&quot;add-menu-item&quot;;z=that.processAddMenuItemResponse;x=B.exec(w[u].name);q=&quot;undefined&quot;==typeof x[1]?0:parseInt(x[1],10);A=b(q);for(t in A){s[&quot;menu-item[&quot;+q+&quot;][&quot;+t+&quot;]&quot;]=A[t]}v=e(w[u],&quot;inside&quot;);w[u].checked=false}else{if(&quot;&quot;==s.action&amp;&amp;&quot;&quot;!=w[u].value&amp;&amp;w[u].className&amp;&amp;-1!=w[u].className.search(/quick-search\b[^-]/)){v=e(w[u],&quot;inside&quot;);s.action=&quot;menu-quick-search&quot;;s.q=w[u].value;s[&quot;response-format&quot;]=&quot;markup&quot;;s.type=w[u].name;z=that.processQuickSearchQueryResponse}}}if(v){v.className=v.className+&quot; processing&quot;,s.menu=r.elements.menu.value}s[&quot;menu-settings-column-nonce&quot;]=r.elements[&quot;menu-settings-column-nonce&quot;].value;i.post(ajaxurl,s,function(C){z.call(that,C,s);v.className=v.className.replace(/processing/g,&quot;&quot;)});return false},makeListItemDraggable:function(q){i(q).draggable({handle:&quot; &gt; dl&quot;,opacity:0.8,addClasses:false,helper:&quot;clone&quot;,zIndex:100})},makeListItemDropzone:function(s){if(!s){return false}var r=s.getElementsByTagName(&quot;div&quot;),q=r.length,t=document.createElement(&quot;div&quot;);while(q--){if(r[q].className&amp;&amp;-1!=r[q].className.indexOf(&quot;dropzone&quot;)&amp;&amp;(s==r[q].parentNode)){return r[q]}}t.className=&quot;dropzone&quot;;s.insertBefore(t,s.firstChild);return t},processAddMenuItemResponse:function(q,v){if(!v){v={}}var w,r=document.getElementById(l.id+&quot;-dummy-list-item&quot;),t,s,u=document.createElement(&quot;ul&quot;);u.innerHTML=q;s=u.getElementsByTagName(&quot;li&quot;);t=s.length;while(t--){this.setupListItemDragAndDrop(s[t]);if(r){l.insertBefore(s[t],r)}else{l.appendChild(s[t])}}this.recalculateSortOrder(l);if(h&amp;&amp;d){h.value=n;d.value=j}},processQuickSearchQueryResponse:function(u,z){if(!z){z={}}var r=document.createElement(&quot;ul&quot;),q=document.getElementById(&quot;nav-menu-meta&quot;),v,y,s,A,w,x=new RegExp(&quot;menu-item\\[([^\\]]*)&quot;),t;s=x.exec(u);if(s&amp;&amp;s[1]){w=s[1];while(q.elements[&quot;menu-item[&quot;+w+&quot;][menu-item-type]&quot;]){w--}if(w!=s[1]){u=u.replace(new RegExp(&quot;menu-item\\[&quot;+s[1]+&quot;\\]&quot;,&quot;g&quot;),&quot;menu-item[&quot;+w+&quot;]&quot;)}}r.innerHTML=u;y=r.getElementsByTagName(&quot;li&quot;);if(y[0]&amp;&amp;z.object_type){t=document.getElementById(z.object_type+&quot;-search-checklist&quot;);if(t){t.innerHTML=&quot;&quot;;t.appendChild(y[0])}}else{if(z.type){s=/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*)/.exec(z.type);if(s&amp;&amp;s[2]){t=document.getElementById(s[2]+&quot;-search-checklist&quot;);if(t){t.innerHTML=&quot;&quot;;v=y.length;if(!v){A=document.createElement(&quot;li&quot;);A.appendChild(document.createTextNode(navMenuL10n.noResultsFound));t.appendChild(A)}while(v--){t.appendChild(y[v])}}}}}},recalculateSortOrder:function(s){var t=s.getElementsByTagName(&quot;input&quot;),r,q=0;for(r=0;r&lt;t.length;r++){if(t[r].name&amp;&amp;-1!=t[r].name.indexOf(&quot;menu-item-position&quot;)){t[r].value=++q}}},removeMenuItem:function(s){if(!s){return false}var t=s.getElementsByTagName(&quot;ul&quot;),r,q;if(t[0]){r=t[0].getElementsByTagName(&quot;li&quot;);for(q=0;q&lt;r.length;q++){if(r[q].id&amp;&amp;-1!=r[q].id.indexOf(&quot;menu-item-&quot;)&amp;&amp;r[q].parentNode==t[0]){s.parentNode.insertBefore(r[q],s)}}}s.className+=&quot; deleting&quot;;i(s).fadeOut(350,function(){this.parentNode.removeChild(this)});this.recalculateSortOrder(l)}}};var wpNavMenu=new WPNavMenuHandler();jQuery(function(){wpNavMenu.init()});
</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 (14284 => 14285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/nav-menus.php        2010-04-28 20:21:06 UTC (rev 14284)
+++ trunk/wp-admin/nav-menus.php        2010-04-28 20:44:08 UTC (rev 14285)
</span><span class="lines">@@ -219,8 +219,14 @@
</span><span class="cx">                         $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id );
</span><span class="cx"> 
</span><span class="cx">                         if ( ! is_wp_error( $_menu_object ) ) {
</span><del>-                                $_menu_object = wp_get_nav_menu_object( wp_update_nav_menu_object( $nav_menu_selected_id, array( 'menu-name' =&gt; $_POST['menu-name'] ) ) );
-                                $nav_menu_selected_title = $_menu_object-&gt;name;
</del><ins>+                                $_nav_menu_selected_id = wp_update_nav_menu_object( $nav_menu_selected_id, array( 'menu-name' =&gt; $_POST['menu-name'] ) );
+                                if ( is_wp_error( $_nav_menu_selected_id ) ) {
+                                        $_menu_object = $_nav_menu_selected_id;
+                                        $messages_div = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . $_nav_menu_selected_id-&gt;get_error_message() . '&lt;/p&gt;&lt;/div&gt;';
+                                } else {
+                                        $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
+                                        $nav_menu_selected_title = $_menu_object-&gt;name;
+                                }
</ins><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         // Update menu items
</span><span class="lines">@@ -229,33 +235,35 @@
</span><span class="cx">                                 $menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array('orderby' =&gt; 'ID', 'output' =&gt; ARRAY_A, 'output_key' =&gt; 'ID') );
</span><span class="cx"> 
</span><span class="cx">                                 // Loop through all the menu items' POST variables
</span><del>-                                foreach( (array) $_POST['menu-item-db-id'] as $_key =&gt; $k ) {
</del><ins>+                                if ( ! empty( $_POST['menu-item-db-id'] ) ) {
+                                        foreach( (array) $_POST['menu-item-db-id'] as $_key =&gt; $k ) {
</ins><span class="cx"> 
</span><del>-                                        // Menu item title can't be blank
-                                        if ( '' == $_POST['menu-item-title'][$_key] )
-                                                continue;
-        
-                                        $args = array(
-                                                'menu-item-db-id' =&gt; $_POST['menu-item-db-id'][$_key],
-                                                'menu-item-object-id' =&gt; $_POST['menu-item-object-id'][$_key],
-                                                'menu-item-object' =&gt; $_POST['menu-item-object'][$_key],
-                                                'menu-item-parent-id' =&gt; $_POST['menu-item-parent-id'][$_key],
-                                                'menu-item-position' =&gt; $_POST['menu-item-position'][$_key],
-                                                'menu-item-type' =&gt; $_POST['menu-item-type'][$_key],
-                                                'menu-item-append' =&gt; $_POST['menu-item-append'][$_key],
-                                                'menu-item-title' =&gt; $_POST['menu-item-title'][$_key],
-                                                'menu-item-url' =&gt; $_POST['menu-item-url'][$_key],
-                                                'menu-item-description' =&gt; $_POST['menu-item-description'][$_key],
-                                                'menu-item-attr-title' =&gt; $_POST['menu-item-attr-title'][$_key],
-                                                'menu-item-target' =&gt; $_POST['menu-item-target'][$_key],
-                                                'menu-item-classes' =&gt; $_POST['menu-item-classes'][$_key],
-                                                'menu-item-xfn' =&gt; $_POST['menu-item-xfn'][$_key],
-                                        );
</del><ins>+                                                // Menu item title can't be blank
+                                                if ( '' == $_POST['menu-item-title'][$_key] )
+                                                        continue;
+                
+                                                $args = array(
+                                                        'menu-item-db-id' =&gt; $_POST['menu-item-db-id'][$_key],
+                                                        'menu-item-object-id' =&gt; $_POST['menu-item-object-id'][$_key],
+                                                        'menu-item-object' =&gt; $_POST['menu-item-object'][$_key],
+                                                        'menu-item-parent-id' =&gt; $_POST['menu-item-parent-id'][$_key],
+                                                        'menu-item-position' =&gt; $_POST['menu-item-position'][$_key],
+                                                        'menu-item-type' =&gt; $_POST['menu-item-type'][$_key],
+                                                        'menu-item-append' =&gt; $_POST['menu-item-append'][$_key],
+                                                        'menu-item-title' =&gt; $_POST['menu-item-title'][$_key],
+                                                        'menu-item-url' =&gt; $_POST['menu-item-url'][$_key],
+                                                        'menu-item-description' =&gt; $_POST['menu-item-description'][$_key],
+                                                        'menu-item-attr-title' =&gt; $_POST['menu-item-attr-title'][$_key],
+                                                        'menu-item-target' =&gt; $_POST['menu-item-target'][$_key],
+                                                        'menu-item-classes' =&gt; $_POST['menu-item-classes'][$_key],
+                                                        'menu-item-xfn' =&gt; $_POST['menu-item-xfn'][$_key],
+                                                );
</ins><span class="cx"> 
</span><del>-                                        $menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args );
</del><ins>+                                                $menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args );
</ins><span class="cx"> 
</span><del>-                                        if ( ! is_wp_error( $menu_item_db_id ) &amp;&amp; isset( $menu_items[$menu_item_db_id] ) ) {
-                                                unset( $menu_items[$menu_item_db_id] );
</del><ins>+                                                if ( ! is_wp_error( $menu_item_db_id ) &amp;&amp; isset( $menu_items[$menu_item_db_id] ) ) {
+                                                        unset( $menu_items[$menu_item_db_id] );
+                                                }
</ins><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/nav-menu.php (14284 => 14285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/nav-menu.php        2010-04-28 20:21:06 UTC (rev 14284)
+++ trunk/wp-includes/nav-menu.php        2010-04-28 20:44:08 UTC (rev 14285)
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx">         $menu_exists = get_term_by( 'name', $menu_name, 'nav_menu' );
</span><span class="cx"> 
</span><span class="cx">         if ( $menu_exists )
</span><del>-                return new WP_Error( 'menu_exists', sprintf( __('A menu named &lt;strong&gt;%s&lt;/strong&gt; already exists; please try another name.'), esc_html( $menu_exists-&gt;name ) ) );
</del><ins>+                return new WP_Error( 'menu_exists', sprintf( __('The menu name &lt;strong&gt;%s&lt;/strong&gt; conflicts with another menu name. Please try another.'), esc_html( $menu_name ) ) );
</ins><span class="cx"> 
</span><span class="cx">         if ( isset($args['slug']) )
</span><span class="cx">                 $slug = $args['slug'];
</span><span class="lines">@@ -172,6 +172,17 @@
</span><span class="cx">         
</span><span class="cx">                 $menu_id = (int) $_menu-&gt;term_id;
</span><span class="cx"> 
</span><ins>+                // double-check that we're not changing a menu to the name of another
+                $_possible_existing = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' ); 
+                if ( 
+                        $_possible_existing &amp;&amp; 
+                        ! is_wp_error( $_possible_existing ) &amp;&amp; 
+                        isset( $_possible_existing-&gt;term_id ) &amp;&amp;
+                        $_possible_existing-&gt;term_id != $menu_id 
+                ) {
+                        return new WP_Error( 'menu_exists', sprintf( __('The menu name &lt;strong&gt;%s&lt;/strong&gt; conflicts with another menu name. Please try another.'), esc_html( $menu_data['menu-name'] ) ) );
+                }
+
</ins><span class="cx">                 $update_response = wp_update_term( $menu_id, 'nav_menu', $args );
</span><span class="cx"> 
</span><span class="cx">                 if ( ! is_wp_error( $update_response ) )
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (14284 => 14285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-04-28 20:21:06 UTC (rev 14284)
+++ trunk/wp-includes/script-loader.php        2010-04-28 20:44:08 UTC (rev 14285)
</span><span class="lines">@@ -393,11 +393,12 @@
</span><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 // Custom Navigation
</span><del>-                $scripts-&gt;add( 'nav-menu', &quot;/wp-admin/js/nav-menu$suffix.js&quot;, false, '20100428' );
</del><ins>+                $scripts-&gt;add( 'nav-menu', &quot;/wp-admin/js/nav-menu$suffix.js&quot;, false, '20100428b' );
</ins><span class="cx">                 $scripts-&gt;localize( 'nav-menu', 'navMenuL10n', array(
</span><span class="cx">                         'custom' =&gt; _x('Custom', 'menu nav item type'),
</span><span class="cx">                         'thickbox' =&gt; _x('Edit Menu Item', 'Thickbox Title'),
</span><span class="cx">                         'edit' =&gt; _x('Edit', 'menu item edit text'),
</span><ins>+                        'noResultsFound' =&gt; _x('No results found.', 'search results'),
</ins><span class="cx">                         'warnDeleteMenu' =&gt; __( &quot;You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete.&quot; ),
</span><span class="cx">                         'warnDeleteMenuItem' =&gt; __( &quot;You are about to permanently delete this menu item. \n 'Cancel' to stop, 'OK' to delete.&quot; ),
</span><span class="cx">                 ) );
</span></span></pre>
</div>
</div>

</body>
</html>