<!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 "return" 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() { ?>
</span><span class="cx">         <p>
</span><del>-                <input type="text" name="create-menu-name" id="create-menu-name" class="regular-text" value="" />
-                <input type="submit" name="create-menu" id="create-menu" class="button" value="<?php esc_attr_e('Create Menu'); ?>" />
</del><ins>+                <input type="text" name="create-menu-name" id="create-menu-name" class="regular-text" value="<?php esc_attr_e( 'Menu name' ); ?>" />
+                <input type="submit" name="create-menu-button" id="create-menu-button" class="button" value="<?php esc_attr_e('Create Menu'); ?>" />
</ins><span class="cx">         </p>
</span><span class="cx">         <?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') && $(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 "http://" 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("#add-"+a+" .quick-search").autocomplete(jQuery("#add-"+a+" .autocomplete").val().split("|"));jQuery("#add-"+a+" .quick-search").result(function(b,d,c){jQuery("#add-"+a+" .list-wrap").css("display","block");jQuery("#add-"+a+" .list-wrap li:contains('"+d+"')").css("display","block");jQuery("#add-"+a+" .show-all").hide();jQuery("#add-"+a+" .hide-all").show()})}function wp_edit_menu_item(a){var f=jQuery("#menu-item-type"+a).val();var b=jQuery("#menu-item-title"+a).val();var g=jQuery("#menu-item-url"+a).val();var c=jQuery("#menu-item-attr-title"+a).val();var d=jQuery("#menu-item-target"+a).val();var h=jQuery("#menu-item-description"+a).val();var e=jQuery("#menu-item-classes"+a).val();var i=jQuery("#menu-item-xfn"+a).val();if("custom"!=f){jQuery("#edit-menu-item-url").attr("disabled","disabled")}jQuery("#edit-menu-item-id").val(a);jQuery("#edit-menu-item-title").val(b);jQuery("#edit-menu-item-url").val(g);jQuery("#edit-menu-item-attr-title").val(c);jQuery("#edit-menu-item-target").val(d);jQuery("#edit-menu-item-target option[value='"+d+"']").attr("selected","selected");jQuery("#edit-menu-item-description").val(h);jQuery("#edit-menu-item-classes").val(e);jQuery("#edit-menu-item-xfn").val(i);jQuery("#edit-menu-item-title").focus()}function wp_update_menu_item(){var h=jQuery("#edit-menu-item-id").val();var f=jQuery("#edit-menu-item-title").val();var b=jQuery("#edit-menu-item-url").val();var g=jQuery("#edit-menu-item-attr-title").val();var d=jQuery("#edit-menu-item-target").val();var c=jQuery("#edit-menu-item-description").val();var a=jQuery("#edit-menu-item-classes").val();var e=jQuery("#edit-menu-item-xfn").val();jQuery(".menu #menu-item"+h).find("span.item-title").html(f);jQuery(".menu #menu-item-title"+h).val(f);jQuery(".menu #menu-item-url"+h).val(b);jQuery(".menu #menu-item-attr-title"+h).val(g);jQuery(".menu #menu-item-target"+h).val(d);jQuery(".menu #menu-item-description"+h).val(c);jQuery(".menu #menu-item-classes"+h).val(a);jQuery(".menu #menu-item-xfn"+h).val(e);jQuery(".menu #menu-item"+h+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}})}function wp_remove_menu_item(b){var a=document.getElementById("menu-item"+b);if(a){jQuery(a).find("dt").each(function(){jQuery(this).animate({backgroundColor:"#FF3333"},{duration:"normal",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(".menu").append('<li id="menu-item'+j+'" value="'+j+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">'+b+'</span><span class="item-controls"><span class="item-type">'+n+'</span><a class="item-edit thickbox" id="edit'+j+'" value="'+j+'" onClick="wp_edit_menu_item('+j+')" title="'+navMenuL10n.thickbox+'" href="#TB_inline?height=540&width=300&inlineId=menu-item-settings">'+navMenuL10n.edit+'</a> | <a class="item-delete" id="delete'+j+'" value="'+j+'">Delete</a></span></dt></dl>'+g+"</li>");jQuery(".menu #menu-item"+j+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}});wp_drag_and_drop();tb_init("a.thickbox, area.thickbox, input.thickbox")}function wp_add_checked_items_to_menu(b){var a=jQuery(b).siblings(".list-wrap").find(":checked");if(0==a.length){return false}jQuery(a).each(function(){var h=jQuery(this).parent().siblings(".menu-item-type").val();if("custom"==h){var e=jQuery(this).parent().siblings(".menu-item-attr-title").val();var f=jQuery(this).parent().siblings(".menu-item-target").val();var g=jQuery(this).parent().siblings(".menu-item-classes").val();var j=jQuery(this).parent().siblings(".menu-item-xfn").val()}else{var e="";var f="_self";var g="";var j=""}var c=jQuery(this).parent().siblings(".menu-item-db-id").val();var k=jQuery(this).parent().siblings(".menu-item-object-id").val();var n=jQuery(this).parent().siblings(".menu-item-append").val();var l=jQuery(this).parent().siblings(".menu-item-parent-id").val();var d=jQuery(this).parent().siblings(".menu-item-title").val();var m=jQuery(this).parent().siblings(".menu-item-url").val();var i=jQuery(this).parent().siblings(".menu-item-description").val();if(undefined==i){i=""}wp_add_item_to_menu(c,k,h,n,l,d,m,i,e,f,g,j);jQuery(this).attr("checked",false)})}function wp_drag_and_drop(){jQuery(".menu li").each(function(){if(!jQuery(this).children(".dropzone").attr("class")){jQuery(this).prepend('<div class="dropzone"></div>')}});jQuery(".menu li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});jQuery(".menu li dl, .menu li .dropzone").droppable({accept:".menu li",tolerance:"pointer",drop:function(f,d){var a=jQuery(this).parent();var g=!jQuery(this).hasClass("dropzone");if(g&&a.children("ul").length==0){a.append('<ul class="sub-menu" />')}if(g){a.children("ul").append(d.draggable)}else{a.before(d.draggable)}a.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var c=d.draggable.attr("value");var b=a.attr("value");a.find("#menu-"+c).find("#parent"+c).val(b);jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style")},over:function(){if(jQuery(this).attr("class")=="dropzone ui-droppable"){jQuery(this).parent().find("div:first").css("background","none").css("height","50px")}else{if(jQuery(this).attr("class")=="ui-droppable"){jQuery(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var a=jQuery(this).parent().attr("id")},out:function(){jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style");jQuery(this).filter(".dropzone").css({borderColor:""})}})}function wp_update_post_data(){var a=0;jQuery(".menu li").each(function(c){c=c+1;var b=jQuery(this).attr("value");jQuery(this).find("#menu-item-position"+b).attr("value",c);jQuery(this).attr("id","menu-item"+c);jQuery(this).attr("value",c);jQuery(this).find("#menu-item-db-id"+b).attr("id","menu-item-db-id"+c);jQuery(this).find("#menu-item-object-id"+b).attr("id","menu-item-object-id"+c);jQuery(this).find("#menu-item-append"+b).attr("id","menu-item-append"+c);jQuery(this).find("#menu-item-type"+b).attr("id","menu-item-type"+c);jQuery(this).find("#menu-item-position"+b).attr("id","menu-item-position"+c);var d=jQuery(this).find("#menu-item-parent-id"+b).parent().parent().parent().attr("value");jQuery(this).find("#menu-item-parent-id"+b).attr("id","menu-item-parent-id"+c);if(d){}else{d=0}jQuery(this).find("#menu-item-parent-id"+b).attr("value",d);jQuery(this).find("#menu-item-title"+b).attr("id","menu-item-title"+c);jQuery(this).find("#menu-item-url"+b).attr("id","menu-item-url"+c);jQuery(this).find("#menu-item-description"+b).attr("id","menu-item-description"+c);jQuery(this).find("#menu-item-classes"+b).attr("id","menu-item-classes"+c);jQuery(this).find("#menu-item-xfn"+b).attr("id","menu-item-xfn"+c);jQuery(this).find("#menu-item-description"+b).attr("id","menu-item-description"+c);jQuery(this).find("#menu-item-attr-title"+b).attr("id","menu-item-attr-title"+c);jQuery(this).find("#menu-item-target"+b).attr("id","menu-item-target"+c);jQuery("#li-count").attr("value",c)})}function wp_get_unique_menu_id(){var d=jQuery(".menu li").length+1;var e=d;var a=0;try{var f=document.getElementById("menu-"+e.toString()).value}catch(c){a=1}while(a==0){e=e+1;try{var b=document.getElementById("menu-"+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="";g+='<input type="hidden" name="menu-item-db-id[]" id="menu-item-db-id'+j+'" value="'+a+'" />';g+='<input type="hidden" name="menu-item-object-id[]" id="menu-item-object-id'+j+'" value="'+k+'" />';g+='<input type="hidden" name="menu-item-type[]" id="menu-item-type'+j+'" value="'+f+'" />';g+='<input type="hidden" name="menu-item-append[]" id="menu-item-append'+j+'" value="'+n+'" />';g+='<input type="hidden" name="menu-item-parent-id[]" id="menu-item-parent-id'+j+'" value="'+l+'" />';g+='<input type="hidden" name="menu-item-position[]" id="menu-item-position'+j+'" value="'+j+'" />';g+='<input type="hidden" name="menu-item-title[]" id="menu-item-title'+j+'" value="'+b+'" />';g+='<input type="hidden" name="menu-item-attr-title[]" id="menu-item-attr-title'+j+'" value="'+e+'" />';g+='<input type="hidden" name="menu-item-url[]" id="menu-item-url'+j+'" value="'+m+'" />';g+='<input type="hidden" name="menu-item-target[]" id="menu-item-target'+j+'" value="'+d+'" />';g+='<input type="hidden" name="menu-item-description[]" id="menu-item-description'+j+'" value="'+h+'" />';g+='<input type="hidden" name="menu-item-classes[]" id="menu-item-classes'+j+'" value="'+c+'" />';g+='<input type="hidden" name="menu-item-xfn[]" id="menu-item-xfn'+j+'" value="'+i+'" />';return g}jQuery(document).ready(function(a){wp_drag_and_drop();a("#update-nav-menu .deletion").click(function(){if(confirm(navMenuL10n.warnDelete)){return true}else{return false}});a("#save_menu").click(function(){return wp_update_post_data()});a(".if-js-closed").removeClass("if-js-closed").addClass("closed");postboxes.add_postbox_toggles("menus");a(".quick-search").click(function(){a(this).attr("value","")});a(".quick-search-submit").click(function(){a(this).siblings(".quick-search").search()});a("#menu-container .item-edit").click(function(){return wp_edit_menu_item(a(this).attr("value"))});a("#menu-container .item-delete").live("click",function(b){return wp_remove_menu_item(a(this).attr("value"))});a("#update-menu-item").click(function(){wp_update_menu_item();return tb_remove()});a("#cancel-save").click(function(){return tb_remove()});a(".show-all").click(function(b){jQuery(b.currentTarget).parent().siblings(".list-wrap").css("display","block");jQuery(b.currentTarget).parent().siblings(".list-wrap").find("li").css("display","block");jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(".hide-all").show()});a(".hide-all").click(function(b){jQuery(b.currentTarget).parent().siblings(".list-wrap").css("display","none");jQuery(b.currentTarget).parent().siblings(".list-wrap").find("li").css("display","none");jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(".show-all").show()});a(".add-to-menu").click(function(b){return wp_add_checked_items_to_menu(b.currentTarget)});a("#add-custom-links .add-to-menu a").click(function(d){var b=jQuery(d.currentTarget).parent().parent().find("#custom-menu-item-url").val();var c=jQuery(d.currentTarget).parent().parent().find("#custom-menu-item-name").val();wp_add_item_to_menu(0,"","custom",navMenuL10n.custom,0,c,b,"","","_self","","")})});function get_html_translation_table(i,g){var d={},f={},c=0,a="";var e={},b={};var j={},h={};e[0]="HTML_SPECIALCHARS";e[1]="HTML_ENTITIES";b[0]="ENT_NOQUOTES";b[2]="ENT_COMPAT";b[3]="ENT_QUOTES";j=!isNaN(i)?e[i]:i?i.toUpperCase():"HTML_SPECIALCHARS";h=!isNaN(g)?b[g]:g?g.toUpperCase():"ENT_COMPAT";if(j!=="HTML_SPECIALCHARS"&&j!=="HTML_ENTITIES"){throw new Error("Table: "+j+" not supported")}d["38"]="&amp;";if(j==="HTML_ENTITIES"){d["160"]="&nbsp;";d["161"]="&iexcl;";d["162"]="&cent;";d["163"]="&pound;";d["164"]="&curren;";d["165"]="&yen;";d["166"]="&brvbar;";d["167"]="&sect;";d["168"]="&uml;";d["169"]="&copy;";d["170"]="&ordf;";d["171"]="&laquo;";d["172"]="&not;";d["173"]="&shy;";d["174"]="&reg;";d["175"]="&macr;";d["176"]="&deg;";d["177"]="&plusmn;";d["178"]="&sup2;";d["179"]="&sup3;";d["180"]="&acute;";d["181"]="&micro;";d["182"]="&para;";d["183"]="&middot;";d["184"]="&cedil;";d["185"]="&sup1;";d["186"]="&ordm;";d["187"]="&raquo;";d["188"]="&frac14;";d["189"]="&frac12;";d["190"]="&frac34;";d["191"]="&iquest;";d["192"]="&Agrave;";d["193"]="&Aacute;";d["194"]="&Acirc;";d["195"]="&Atilde;";d["196"]="&Auml;";d["197"]="&Aring;";d["198"]="&AElig;";d["199"]="&Ccedil;";d["200"]="&Egrave;";d["201"]="&Eacute;";d["202"]="&Ecirc;";d["203"]="&Euml;";d["204"]="&Igrave;";d["205"]="&Iacute;";d["206"]="&Icirc;";d["207"]="&Iuml;";d["208"]="&ETH;";d["209"]="&Ntilde;";d["210"]="&Ograve;";d["211"]="&Oacute;";d["212"]="&Ocirc;";d["213"]="&Otilde;";d["214"]="&Ouml;";d["215"]="&times;";d["216"]="&Oslash;";d["217"]="&Ugrave;";d["218"]="&Uacute;";d["219"]="&Ucirc;";d["220"]="&Uuml;";d["221"]="&Yacute;";d["222"]="&THORN;";d["223"]="&szlig;";d["224"]="&agrave;";d["225"]="&aacute;";d["226"]="&acirc;";d["227"]="&atilde;";d["228"]="&auml;";d["229"]="&aring;";d["230"]="&aelig;";d["231"]="&ccedil;";d["232"]="&egrave;";d["233"]="&eacute;";d["234"]="&ecirc;";d["235"]="&euml;";d["236"]="&igrave;";d["237"]="&iacute;";d["238"]="&icirc;";d["239"]="&iuml;";d["240"]="&eth;";d["241"]="&ntilde;";d["242"]="&ograve;";d["243"]="&oacute;";d["244"]="&ocirc;";d["245"]="&otilde;";d["246"]="&ouml;";d["247"]="&divide;";d["248"]="&oslash;";d["249"]="&ugrave;";d["250"]="&uacute;";d["251"]="&ucirc;";d["252"]="&uuml;";d["253"]="&yacute;";d["254"]="&thorn;";d["255"]="&yuml;"}if(h!=="ENT_NOQUOTES"){d["34"]="&quot;"}if(h==="ENT_QUOTES"){d["39"]="&#39;"}d["60"]="&lt;";d["62"]="&gt;";for(c in d){a=String.fromCharCode(c);f[a]=d[c]}return f}function htmlentities(c,f){var e={},d="",a="",b="";a=c.toString();if(false===(e=this.get_html_translation_table("HTML_ENTITIES",f))){return false}e["'"]="&#039;";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("#add-"+a+" .quick-search").autocomplete(jQuery("#add-"+a+" .autocomplete").val().split("|"));jQuery("#add-"+a+" .quick-search").result(function(b,d,c){jQuery("#add-"+a+" .list-wrap").css("display","block");jQuery("#add-"+a+" .list-wrap li:contains('"+d+"')").css("display","block");jQuery("#add-"+a+" .show-all").hide();jQuery("#add-"+a+" .hide-all").show()})}function wp_edit_menu_item(a){var f=jQuery("#menu-item-type"+a).val();var b=jQuery("#menu-item-title"+a).val();var g=jQuery("#menu-item-url"+a).val();var c=jQuery("#menu-item-attr-title"+a).val();var d=jQuery("#menu-item-target"+a).val();var h=jQuery("#menu-item-description"+a).val();var e=jQuery("#menu-item-classes"+a).val();var i=jQuery("#menu-item-xfn"+a).val();if("custom"!=f){jQuery("#edit-menu-item-url").attr("disabled","disabled")}jQuery("#edit-menu-item-id").val(a);jQuery("#edit-menu-item-title").val(b);jQuery("#edit-menu-item-url").val(g);jQuery("#edit-menu-item-attr-title").val(c);jQuery("#edit-menu-item-target").val(d);jQuery("#edit-menu-item-target option[value='"+d+"']").attr("selected","selected");jQuery("#edit-menu-item-description").val(h);jQuery("#edit-menu-item-classes").val(e);jQuery("#edit-menu-item-xfn").val(i);jQuery("#edit-menu-item-title").focus()}function wp_update_menu_item(){var h=jQuery("#edit-menu-item-id").val();var f=jQuery("#edit-menu-item-title").val();var b=jQuery("#edit-menu-item-url").val();var g=jQuery("#edit-menu-item-attr-title").val();var d=jQuery("#edit-menu-item-target").val();var c=jQuery("#edit-menu-item-description").val();var a=jQuery("#edit-menu-item-classes").val();var e=jQuery("#edit-menu-item-xfn").val();jQuery(".menu #menu-item"+h).find("span.item-title").html(f);jQuery(".menu #menu-item-title"+h).val(f);jQuery(".menu #menu-item-url"+h).val(b);jQuery(".menu #menu-item-attr-title"+h).val(g);jQuery(".menu #menu-item-target"+h).val(d);jQuery(".menu #menu-item-description"+h).val(c);jQuery(".menu #menu-item-classes"+h).val(a);jQuery(".menu #menu-item-xfn"+h).val(e);jQuery(".menu #menu-item"+h+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}})}function wp_remove_menu_item(b){var a=document.getElementById("menu-item"+b);if(a){jQuery(a).find("dt").each(function(){jQuery(this).animate({backgroundColor:"#FF3333"},{duration:"normal",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(".menu").append('<li id="menu-item'+j+'" value="'+j+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">'+b+'</span><span class="item-controls"><span class="item-type">'+n+'</span><a class="item-edit thickbox" id="edit'+j+'" value="'+j+'" onClick="wp_edit_menu_item('+j+')" title="'+navMenuL10n.thickbox+'" href="#TB_inline?height=540&width=300&inlineId=menu-item-settings">'+navMenuL10n.edit+'</a> | <a class="item-delete" id="delete'+j+'" value="'+j+'">Delete</a></span></dt></dl>'+g+"</li>");jQuery(".menu #menu-item"+j+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}});wp_drag_and_drop();tb_init("a.thickbox, area.thickbox, input.thickbox")}function wp_add_checked_items_to_menu(b){var a=jQuery(b).siblings(".list-wrap").find(":checked");if(0==a.length){return false}jQuery(a).each(function(){var h=jQuery(this).parent().siblings(".menu-item-type").val();if("custom"==h){var e=jQuery(this).parent().siblings(".menu-item-attr-title").val();var f=jQuery(this).parent().siblings(".menu-item-target").val();var g=jQuery(this).parent().siblings(".menu-item-classes").val();var j=jQuery(this).parent().siblings(".menu-item-xfn").val()}else{var e="";var f="_self";var g="";var j=""}var c=jQuery(this).parent().siblings(".menu-item-db-id").val();var k=jQuery(this).parent().siblings(".menu-item-object-id").val();var n=jQuery(this).parent().siblings(".menu-item-append").val();var l=jQuery(this).parent().siblings(".menu-item-parent-id").val();var d=jQuery(this).parent().siblings(".menu-item-title").val();var m=jQuery(this).parent().siblings(".menu-item-url").val();var i=jQuery(this).parent().siblings(".menu-item-description").val();if(undefined==i){i=""}wp_add_item_to_menu(c,k,h,n,l,d,m,i,e,f,g,j);jQuery(this).attr("checked",false)})}function wp_drag_and_drop(){jQuery(".menu li").each(function(){if(!jQuery(this).children(".dropzone").attr("class")){jQuery(this).prepend('<div class="dropzone"></div>')}});jQuery(".menu li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});jQuery(".menu li dl, .menu li .dropzone").droppable({accept:".menu li",tolerance:"pointer",drop:function(f,d){var a=jQuery(this).parent();var g=!jQuery(this).hasClass("dropzone");if(g&&a.children("ul").length==0){a.append('<ul class="sub-menu" />')}if(g){a.children("ul").append(d.draggable)}else{a.before(d.draggable)}a.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var c=d.draggable.attr("value");var b=a.attr("value");a.find("#menu-"+c).find("#parent"+c).val(b);jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style")},over:function(){if(jQuery(this).attr("class")=="dropzone ui-droppable"){jQuery(this).parent().find("div:first").css("background","none").css("height","50px")}else{if(jQuery(this).attr("class")=="ui-droppable"){jQuery(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var a=jQuery(this).parent().attr("id")},out:function(){jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style");jQuery(this).filter(".dropzone").css({borderColor:""})}})}function wp_update_post_data(){var a=0;jQuery(".menu li").each(function(c){c=c+1;var b=jQuery(this).attr("value");jQuery(this).find("#menu-item-position"+b).attr("value",c);jQuery(this).attr("id","menu-item"+c);jQuery(this).attr("value",c);jQuery(this).find("#menu-item-db-id"+b).attr("id","menu-item-db-id"+c);jQuery(this).find("#menu-item-object-id"+b).attr("id","menu-item-object-id"+c);jQuery(this).find("#menu-item-append"+b).attr("id","menu-item-append"+c);jQuery(this).find("#menu-item-type"+b).attr("id","menu-item-type"+c);jQuery(this).find("#menu-item-position"+b).attr("id","menu-item-position"+c);var d=jQuery(this).find("#menu-item-parent-id"+b).parent().parent().parent().attr("value");jQuery(this).find("#menu-item-parent-id"+b).attr("id","menu-item-parent-id"+c);if(d){}else{d=0}jQuery(this).find("#menu-item-parent-id"+b).attr("value",d);jQuery(this).find("#menu-item-title"+b).attr("id","menu-item-title"+c);jQuery(this).find("#menu-item-url"+b).attr("id","menu-item-url"+c);jQuery(this).find("#menu-item-description"+b).attr("id","menu-item-description"+c);jQuery(this).find("#menu-item-classes"+b).attr("id","menu-item-classes"+c);jQuery(this).find("#menu-item-xfn"+b).attr("id","menu-item-xfn"+c);jQuery(this).find("#menu-item-description"+b).attr("id","menu-item-description"+c);jQuery(this).find("#menu-item-attr-title"+b).attr("id","menu-item-attr-title"+c);jQuery(this).find("#menu-item-target"+b).attr("id","menu-item-target"+c);jQuery("#li-count").attr("value",c)})}function wp_get_unique_menu_id(){var d=jQuery(".menu li").length+1;var e=d;var a=0;try{var f=document.getElementById("menu-"+e.toString()).value}catch(c){a=1}while(a==0){e=e+1;try{var b=document.getElementById("menu-"+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="";g+='<input type="hidden" name="menu-item-db-id[]" id="menu-item-db-id'+j+'" value="'+a+'" />';g+='<input type="hidden" name="menu-item-object-id[]" id="menu-item-object-id'+j+'" value="'+k+'" />';g+='<input type="hidden" name="menu-item-type[]" id="menu-item-type'+j+'" value="'+f+'" />';g+='<input type="hidden" name="menu-item-append[]" id="menu-item-append'+j+'" value="'+n+'" />';g+='<input type="hidden" name="menu-item-parent-id[]" id="menu-item-parent-id'+j+'" value="'+l+'" />';g+='<input type="hidden" name="menu-item-position[]" id="menu-item-position'+j+'" value="'+j+'" />';g+='<input type="hidden" name="menu-item-title[]" id="menu-item-title'+j+'" value="'+b+'" />';g+='<input type="hidden" name="menu-item-attr-title[]" id="menu-item-attr-title'+j+'" value="'+e+'" />';g+='<input type="hidden" name="menu-item-url[]" id="menu-item-url'+j+'" value="'+m+'" />';g+='<input type="hidden" name="menu-item-target[]" id="menu-item-target'+j+'" value="'+d+'" />';g+='<input type="hidden" name="menu-item-description[]" id="menu-item-description'+j+'" value="'+h+'" />';g+='<input type="hidden" name="menu-item-classes[]" id="menu-item-classes'+j+'" value="'+c+'" />';g+='<input type="hidden" name="menu-item-xfn[]" id="menu-item-xfn'+j+'" value="'+i+'" />';return g}jQuery(document).ready(function(a){wp_drag_and_drop();a("#update-nav-menu .deletion").click(function(){if(confirm(navMenuL10n.warnDelete)){return true}else{return false}});a("#save_menu").click(function(){return wp_update_post_data()});a("#create-menu-name").keypress(function(b){if(13==b.keyCode){a("#create-menu-button").click();return false}});a("#custom-menu-item-url, #custom-menu-item-name").keypress(function(b){if(13==b.keyCode){a("#add-custom-links a.button").click();return false}}).focus(function(){if(a(this).val()==a(this).attr("defaultValue")&&a(this).attr("id")!="custom-menu-item-url"){a(this).val("")}}).blur(function(){if(a(this).val()==""){a(this).val(a(this).attr("defaultValue"))}});a("#create-menu-name").focus(function(){if(a(this).val()==a(this).attr("defaultValue")){a(this).val("")}}).blur(function(){if(a(this).val()==""){a(this).val(a(this).attr("defaultValue"))}});a(".if-js-closed").removeClass("if-js-closed").addClass("closed");postboxes.add_postbox_toggles("menus");a(".quick-search").click(function(){a(this).attr("value","")});a(".quick-search-submit").click(function(){a(this).siblings(".quick-search").search()});a("#menu-container .item-edit").click(function(){return wp_edit_menu_item(a(this).attr("value"))});a("#menu-container .item-delete").live("click",function(b){return wp_remove_menu_item(a(this).attr("value"))});a("#update-menu-item").click(function(){wp_update_menu_item();return tb_remove()});a("#cancel-save").click(function(){return tb_remove()});a(".show-all").click(function(b){jQuery(b.currentTarget).parent().siblings(".list-wrap").css("display","block");jQuery(b.currentTarget).parent().siblings(".list-wrap").find("li").css("display","block");jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(".hide-all").show()});a(".hide-all").click(function(b){jQuery(b.currentTarget).parent().siblings(".list-wrap").css("display","none");jQuery(b.currentTarget).parent().siblings(".list-wrap").find("li").css("display","none");jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(".show-all").show()});a(".add-to-menu").click(function(b){return wp_add_checked_items_to_menu(b.currentTarget)});a("#add-custom-links .add-to-menu a").click(function(b){if(a("#custom-menu-item-url").val()==a("#custom-menu-item-url").attr("defaultValue")){return}wp_add_item_to_menu(0,"","custom",navMenuL10n.custom,0,a("#custom-menu-item-name").val(),a("#custom-menu-item-url").val(),"","","_self","","");a("#custom-menu-item-name").val(a("#custom-menu-item-name").attr("defaultValue"));a("#custom-menu-item-url").val(a("#custom-menu-item-url").attr("defaultValue")).focus()})});function get_html_translation_table(i,g){var d={},f={},c=0,a="";var e={},b={};var j={},h={};e[0]="HTML_SPECIALCHARS";e[1]="HTML_ENTITIES";b[0]="ENT_NOQUOTES";b[2]="ENT_COMPAT";b[3]="ENT_QUOTES";j=!isNaN(i)?e[i]:i?i.toUpperCase():"HTML_SPECIALCHARS";h=!isNaN(g)?b[g]:g?g.toUpperCase():"ENT_COMPAT";if(j!=="HTML_SPECIALCHARS"&&j!=="HTML_ENTITIES"){throw new Error("Table: "+j+" not supported")}d["38"]="&amp;";if(j==="HTML_ENTITIES"){d["160"]="&nbsp;";d["161"]="&iexcl;";d["162"]="&cent;";d["163"]="&pound;";d["164"]="&curren;";d["165"]="&yen;";d["166"]="&brvbar;";d["167"]="&sect;";d["168"]="&uml;";d["169"]="&copy;";d["170"]="&ordf;";d["171"]="&laquo;";d["172"]="&not;";d["173"]="&shy;";d["174"]="&reg;";d["175"]="&macr;";d["176"]="&deg;";d["177"]="&plusmn;";d["178"]="&sup2;";d["179"]="&sup3;";d["180"]="&acute;";d["181"]="&micro;";d["182"]="&para;";d["183"]="&middot;";d["184"]="&cedil;";d["185"]="&sup1;";d["186"]="&ordm;";d["187"]="&raquo;";d["188"]="&frac14;";d["189"]="&frac12;";d["190"]="&frac34;";d["191"]="&iquest;";d["192"]="&Agrave;";d["193"]="&Aacute;";d["194"]="&Acirc;";d["195"]="&Atilde;";d["196"]="&Auml;";d["197"]="&Aring;";d["198"]="&AElig;";d["199"]="&Ccedil;";d["200"]="&Egrave;";d["201"]="&Eacute;";d["202"]="&Ecirc;";d["203"]="&Euml;";d["204"]="&Igrave;";d["205"]="&Iacute;";d["206"]="&Icirc;";d["207"]="&Iuml;";d["208"]="&ETH;";d["209"]="&Ntilde;";d["210"]="&Ograve;";d["211"]="&Oacute;";d["212"]="&Ocirc;";d["213"]="&Otilde;";d["214"]="&Ouml;";d["215"]="&times;";d["216"]="&Oslash;";d["217"]="&Ugrave;";d["218"]="&Uacute;";d["219"]="&Ucirc;";d["220"]="&Uuml;";d["221"]="&Yacute;";d["222"]="&THORN;";d["223"]="&szlig;";d["224"]="&agrave;";d["225"]="&aacute;";d["226"]="&acirc;";d["227"]="&atilde;";d["228"]="&auml;";d["229"]="&aring;";d["230"]="&aelig;";d["231"]="&ccedil;";d["232"]="&egrave;";d["233"]="&eacute;";d["234"]="&ecirc;";d["235"]="&euml;";d["236"]="&igrave;";d["237"]="&iacute;";d["238"]="&icirc;";d["239"]="&iuml;";d["240"]="&eth;";d["241"]="&ntilde;";d["242"]="&ograve;";d["243"]="&oacute;";d["244"]="&ocirc;";d["245"]="&otilde;";d["246"]="&ouml;";d["247"]="&divide;";d["248"]="&oslash;";d["249"]="&ugrave;";d["250"]="&uacute;";d["251"]="&ucirc;";d["252"]="&uuml;";d["253"]="&yacute;";d["254"]="&thorn;";d["255"]="&yuml;"}if(h!=="ENT_NOQUOTES"){d["34"]="&quot;"}if(h==="ENT_QUOTES"){d["39"]="&#39;"}d["60"]="&lt;";d["62"]="&gt;";for(c in d){a=String.fromCharCode(c);f[a]=d[c]}return f}function htmlentities(c,f){var e={},d="",a="",b="";a=c.toString();if(false===(e=this.get_html_translation_table("HTML_ENTITIES",f))){return false}e["'"]="&#039;";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' => $_POST['menu-name'], 'slug' => null, 'description' => $old_nav_menu['description'], 'parent' => $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' => $_POST['menu-name'], 'slug' => null, 'description' => $old_nav_menu['description'], 'parent' => $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' => 'ID', 'output' => ARRAY_A, 'output_key' => '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' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID') );
+                                $parent_menu_ids = array();
</ins><span class="cx">
</span><del>-                        // Loop through all POST variables
-                        for ( $k = 0; $k < $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 < $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' => 'publish', 'post_type' => 'nav_menu_item', 'post_author' => $user_ID,
-                                        'ping_status' => 0, 'post_parent' => $menu_item_parent_id, 'menu_order' => $menu_item_position,
-                                        'post_excerpt' => $menu_item_attr_title, 'tax_input' => array( 'nav_menu' => $update_nav_menu->name ),
-                                        'post_content' => $menu_item_description, 'post_title' => $menu_item_title );
</del><ins>+                                        // Populate the menu item
+                                        $post = array( 'post_status' => 'publish', 'post_type' => 'nav_menu_item', 'post_author' => $user_ID,
+                                                'ping_status' => 0, 'post_parent' => $menu_item_parent_id, 'menu_order' => $menu_item_position,
+                                                'post_excerpt' => $menu_item_attr_title, 'tax_input' => array( 'nav_menu' => $update_nav_menu->name ),
+                                                'post_content' => $menu_item_description, 'post_title' => $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 = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been updated.') . '</p></div>';
</ins><span class="cx">                         }
</span><del>-                        $messages_div = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been updated.') . '</p></div>';
</del><span class="cx">                 }
</span><span class="cx">                 break;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>