Make WordPress Core

Ticket #14134: wordpress-menuitem.patch

File wordpress-menuitem.patch, 41.0 KB (added by okax, 12 years ago)

With this patch only changed menuitems will be transmitted

  • wp-admin/includes/nav-menu.php

     
    7777                        $classes[] = 'pending';
    7878                        /* translators: %s: title of menu item in draft status */
    7979                        $title = sprintf( __('%s (Pending)'), $item->title );
     80                } else {
     81                        $classes[] = 'menu-item-unchanged';
    8082                }
    8183
    8284                $title = empty( $item->label ) ? $title : $item->label;
     
    11591161                wp_delete_post( $menu_item_id, true );
    11601162}
    11611163
     1164/**
     1165 * Update the position of all menu items if necessary
     1166 * As only changed menu items will be posted from the browser a position change of one item can lead to a reordering
     1167 * of all other items
     1168 *
     1169 * @param array $menu_items_sorted_by_position The array of all menu items of a menu prior to the change sorted by position
     1170 * @param array $unchanged_menu_items The map of all unchanged menu items with db_id as key
     1171 * @param array $changed_menu_items The map of all changed or new menu items with the position as key
     1172 */
     1173function wp_update_menu_item_positions( $menu_items_sorted_by_position, $unchanged_menu_items, $changed_menu_items)
     1174{
     1175    $total_menu_item_count = count( $unchanged_menu_items ) + count( $changed_menu_items );
     1176
     1177    // Create an array that associate a parent id to an array of all direct child items to this parent
     1178    $menu_items_grouped_by_parent_id = array();
     1179    foreach ( $menu_items_sorted_by_position as $menu_item ) {
     1180        // Only unchanged menu items should be in the array
     1181        if ( isset( $unchanged_menu_items[ $menu_item->db_id ] ) ) {
     1182            $menu_items_grouped_by_parent_id[ $menu_item->menu_item_parent ][ ] = $menu_item;
     1183        }
     1184    }
     1185
     1186    $menu_items_for_current_parent_id = &$menu_items_grouped_by_parent_id[ 0 ];
     1187    $parent_id_stack = array( 0 );
     1188
     1189    // Loop over all indices, calculate the menu item for each index and assign the index as menu_order value.
     1190    // Every time a menu item has child items, the item id is put on top of the $parent_id_stack and the array with
     1191    // all child items is assigned to $menu_items_for_current_parent_id.
     1192    for ( $index = 1; $index <= $total_menu_item_count; $index ++ ) {
     1193        if ( isset( $changed_menu_items[ $index ] ) ) {
     1194            // at this position is a new or changed item and the position was already saved
     1195            $id = $changed_menu_items[ $index ]->db_id;
     1196        } else {
     1197            $menu_item = current( $menu_items_for_current_parent_id );
     1198            // update the position if needed
     1199            if ( $menu_item->menu_order != $index ) {
     1200                $menu_item->menu_order = $index;
     1201                wp_update_post( $menu_item );
     1202            }
     1203            $id = $menu_item->db_id;
     1204            next( $menu_items_for_current_parent_id );
     1205        }
     1206
     1207        if ( isset( $menu_items_grouped_by_parent_id[ $id ] ) or
     1208            (
     1209                isset( $changed_menu_items[ $index + 1 ] ) and
     1210                    $changed_menu_items[ $index + 1 ]->menu_item_parent == $id
     1211            )
     1212        ) {
     1213            // there exist a child for the item at the current index
     1214            array_push( $parent_id_stack, $id );
     1215            // get the children for this parent to iterate over
     1216            $menu_items_for_current_parent_id = &$menu_items_grouped_by_parent_id[ $id ];
     1217        } else {
     1218            if ( isset( $changed_menu_items[ $index + 1 ] ) ) {
     1219                // next menu item is a changed one and not a child of the current menu item
     1220                // pop from the stack until the correct parent for the next item is found
     1221                $parentId = $changed_menu_items[ $index + 1 ]->menu_item_parent;
     1222                while ( ! empty( $parent_id_stack ) and end( $parent_id_stack ) != $parentId ) {
     1223                    array_pop( $parent_id_stack );
     1224                }
     1225            } else {
     1226                if ( isset( $menu_items_for_current_parent_id ) ) {
     1227                    $menu_item = current( $menu_items_for_current_parent_id );
     1228                } else {
     1229                    $menu_item = false;
     1230                }
     1231                while ( false == $menu_item ) {
     1232                    if ( empty( $parent_id_stack ) ) break;
     1233                    array_pop( $parent_id_stack );
     1234                    $menu_items_for_current_parent_id = &$menu_items_grouped_by_parent_id[ end( $parent_id_stack ) ];
     1235                    if ( isset( $menu_items_for_current_parent_id ) ) {
     1236                        $menu_item = current( $menu_items_for_current_parent_id );
     1237                    }
     1238                }
     1239            }
     1240        }
     1241    }
     1242}
     1243
    11621244add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
  • wp-admin/js/nav-menu.js

     
    315315                                                updateMenuMaxDepth( depthChange );
    316316                                        }
    317317                                        // Register a change
    318                                         api.registerChange();
     318                                        api.registerChange( ui.item );
    319319                                        // Update the item data.
    320320                                        ui.item.updateParentMenuItemDBId();
    321321
     
    593593                },
    594594
    595595                attachUnsavedChangesListener : function() {
    596                         $('#menu-management input, #menu-management select, #menu-management, #menu-management textarea').change(function(){
    597                                 api.registerChange();
     596                        $('#menu-management input, #menu-management select, #menu-management, #menu-management textarea').change(function( changeEvent ){
     597                                var menuItem = $(changeEvent.target).parents('.menu-item');
     598                                api.registerChange( menuItem );
    598599                        });
    599600
    600601                        if ( 0 != $('#menu-to-edit').length ) {
     
    608609                        }
    609610                },
    610611
    611                 registerChange : function() {
     612                registerChange:function( menuItem ) {
     613                        if ( menuItem !== undefined ) {
     614                                menuItem.removeClass( "menu-item-unchanged" );
     615                        }
    612616                        api.menusChanged = true;
    613617                },
    614618
     
    867871                        $('#update-nav-menu').append( locs );
    868872                        // Update menu item position data
    869873                        api.menuList.find('.menu-item-data-position').val( function(index) { return index + 1; } );
     874                        //disable unchanged items before submit
     875                        api.menuList.find('.menu-item-unchanged :input').each(function() { $(this).attr("disabled", "disabled"); } );
    870876                        window.onbeforeunload = null;
    871877
    872878                        return true;
     
    883889
    884890                eventOnClickMenuItemDelete : function(clickedEl) {
    885891                        var itemID = parseInt(clickedEl.id.replace('delete-', ''), 10);
    886                         api.removeMenuItem( $('#menu-item-' + itemID) );
     892                        api.removeMenuItem( $('#menu-item-' + itemID), itemID );
    887893                        api.registerChange();
    888894                        return false;
    889895                },
     
    935941                        $('.spinner', panel).hide();
    936942                },
    937943
    938                 removeMenuItem : function(el) {
     944                removeMenuItem : function(el, itemId) {
    939945                        var children = el.childMenuItems();
    940946
     947                        //add deleted entry to the form
     948                        var deleted = '<input type="hidden" name="menu-item-delete[' + itemId + ']" value="' + itemId + '" />';
     949                        $('#update-nav-menu').append( deleted );
     950
    941951                        el.addClass('deleting').animate({
    942952                                        opacity : 0,
    943953                                        height: 0
  • wp-admin/js/nav-menu.min.js

     
    1 var wpNavMenu;(function(b){var a=wpNavMenu={options:{menuItemDepthPerLevel:30,globalMaxDepth:11},menuList:undefined,targetList:undefined,menusChanged:false,isRTL:!!("undefined"!=typeof isRtl&&isRtl),negateIfRTL:("undefined"!=typeof isRtl&&isRtl)?-1:1,init:function(){a.menuList=b("#menu-to-edit");a.targetList=a.menuList;this.jQueryExtensions();this.attachMenuEditListeners();this.setupInputWithDefaultTitle();this.attachQuickSearchListeners();this.attachThemeLocationsListeners();this.attachTabsPanelListeners();this.attachUnsavedChangesListener();if(a.menuList.length){this.initSortables()}this.initToggles();this.initTabManager()},jQueryExtensions:function(){b.fn.extend({menuItemDepth:function(){var c=a.isRTL?this.eq(0).css("margin-right"):this.eq(0).css("margin-left");return a.pxToDepth(c&&-1!=c.indexOf("px")?c.slice(0,-2):0)},updateDepthClass:function(d,c){return this.each(function(){var e=b(this);c=c||e.menuItemDepth();b(this).removeClass("menu-item-depth-"+c).addClass("menu-item-depth-"+d)})},shiftDepthClass:function(c){return this.each(function(){var d=b(this),e=d.menuItemDepth();b(this).removeClass("menu-item-depth-"+e).addClass("menu-item-depth-"+(e+c))})},childMenuItems:function(){var c=b();this.each(function(){var d=b(this),f=d.menuItemDepth(),e=d.next();while(e.length&&e.menuItemDepth()>f){c=c.add(e);e=e.next()}});return c},updateParentMenuItemDBId:function(){return this.each(function(){var e=b(this),c=e.find(".menu-item-data-parent-id"),f=e.menuItemDepth(),d=e.prev();if(f==0){c.val(0)}else{while(!d[0]||!d[0].className||-1==d[0].className.indexOf("menu-item")||(d.menuItemDepth()!=f-1)){d=d.prev()}c.val(d.find(".menu-item-data-db-id").val())}})},hideAdvancedMenuItemFields:function(){return this.each(function(){var c=b(this);b(".hide-column-tog").not(":checked").each(function(){c.find(".field-"+b(this).val()).addClass("hidden-field")})})},addSelectedToMenu:function(c){if(0==b("#menu-to-edit").length){return false}return this.each(function(){var e=b(this),d={},g=e.find(".tabs-panel-active .categorychecklist li input:checked"),f=new RegExp("menu-item\\[([^\\]]*)");c=c||a.addMenuItemToBottom;if(!g.length){return false}e.find(".spinner").show();b(g).each(function(){var i=b(this),h=f.exec(i.attr("name")),j="undefined"==typeof h[1]?0:parseInt(h[1],10);if(this.className&&-1!=this.className.indexOf("add-to-top")){c=a.addMenuItemToTop}d[j]=i.closest("li").getItemData("add-menu-item",j)});a.addItemToMenu(d,c,function(){g.removeAttr("checked");e.find(".spinner").hide()})})},getItemData:function(f,g){f=f||"menu-item";var d={},e,c=["menu-item-db-id","menu-item-object-id","menu-item-object","menu-item-parent-id","menu-item-position","menu-item-type","menu-item-title","menu-item-url","menu-item-description","menu-item-attr-title","menu-item-target","menu-item-classes","menu-item-xfn"];if(!g&&f=="menu-item"){g=this.find(".menu-item-data-db-id").val()}if(!g){return d}this.find("input").each(function(){var h;e=c.length;while(e--){if(f=="menu-item"){h=c[e]+"["+g+"]"}else{if(f=="add-menu-item"){h="menu-item["+g+"]["+c[e]+"]"}}if(this.name&&h==this.name){d[c[e]]=this.value}}});return d},setItemData:function(c,d,e){d=d||"menu-item";if(!e&&d=="menu-item"){e=b(".menu-item-data-db-id",this).val()}if(!e){return this}this.find("input").each(function(){var f=b(this),g;b.each(c,function(h,i){if(d=="menu-item"){g=h+"["+e+"]"}else{if(d=="add-menu-item"){g="menu-item["+e+"]["+h+"]"}}if(g==f.attr("name")){f.val(i)}})});return this}})},initToggles:function(){postboxes.add_postbox_toggles("nav-menus");columns.useCheckboxesForHidden();columns.checked=function(c){b(".field-"+c).removeClass("hidden-field")};columns.unchecked=function(c){b(".field-"+c).addClass("hidden-field")};a.menuList.hideAdvancedMenuItemFields()},initSortables:function(){var p=0,e,t,d,l,o,f,c,i,s,m=a.menuList.offset().left,h=b("body"),q,n=r();m+=a.isRTL?a.menuList.width():0;a.menuList.sortable({handle:".menu-item-handle",placeholder:"sortable-placeholder",start:function(A,z){var u,x,w,v,y;if(a.isRTL){z.item[0].style.right="auto"}s=z.item.children(".menu-item-transport");e=z.item.menuItemDepth();j(z,e);w=(z.item.next()[0]==z.placeholder[0])?z.item.next():z.item;v=w.childMenuItems();s.append(v);u=s.outerHeight();u+=(u>0)?(z.placeholder.css("margin-top").slice(0,-2)*1):0;u+=z.helper.outerHeight();i=u;u-=2;z.placeholder.height(u);q=e;v.each(function(){var B=b(this).menuItemDepth();q=(B>q)?B:q});x=z.helper.find(".menu-item-handle").outerWidth();x+=a.depthToPx(q-e);x-=2;z.placeholder.width(x);y=z.placeholder.next();y.css("margin-top",i+"px");z.placeholder.detach();b(this).sortable("refresh");z.item.after(z.placeholder);y.css("margin-top",0);k(z)},stop:function(x,w){var v,u=p-e;v=s.children().insertAfter(w.item);if(u!=0){w.item.updateDepthClass(p);v.shiftDepthClass(u);g(u)}a.registerChange();w.item.updateParentMenuItemDBId();w.item[0].style.top=0;if(a.isRTL){w.item[0].style.left="auto";w.item[0].style.right=0}a.refreshMenuTabs(true)},change:function(v,u){if(!u.placeholder.parent().hasClass("menu")){(l.length)?l.after(u.placeholder):a.menuList.prepend(u.placeholder)}k(u)},sort:function(w,v){var y=v.helper.offset(),u=a.isRTL?y.left+v.helper.width():y.left,x=a.negateIfRTL*a.pxToDepth(u-m);if(x>d||y.top<f){x=d}else{if(x<t){x=t}}if(x!=p){j(v,x)}if(c&&y.top+i>c){o.after(v.placeholder);k(v);b(this).sortable("refreshPositions")}}});function k(u){var v;l=u.placeholder.prev();o=u.placeholder.next();if(l[0]==u.item[0]){l=l.prev()}if(o[0]==u.item[0]){o=o.next()}f=(l.length)?l.offset().top+l.height():0;c=(o.length)?o.offset().top+o.height()/3:0;t=(o.length)?o.menuItemDepth():0;if(l.length){d=((v=l.menuItemDepth()+1)>a.options.globalMaxDepth)?a.options.globalMaxDepth:v}else{d=0}}function j(u,v){u.placeholder.updateDepthClass(v,p);p=v}function r(){if(!h[0].className){return 0}var u=h[0].className.match(/menu-max-depth-(\d+)/);return u&&u[1]?parseInt(u[1]):0}function g(u){var v,w=n;if(u===0){return}else{if(u>0){v=q+u;if(v>n){w=v}}else{if(u<0&&q==n){while(!b(".menu-item-depth-"+w,a.menuList).length&&w>0){w--}}}}h.removeClass("menu-max-depth-"+n).addClass("menu-max-depth-"+w);n=w}},attachMenuEditListeners:function(){var c=this;b("#update-nav-menu").bind("click",function(d){if(d.target&&d.target.className){if(-1!=d.target.className.indexOf("item-edit")){return c.eventOnClickEditLink(d.target)}else{if(-1!=d.target.className.indexOf("menu-save")){return c.eventOnClickMenuSave(d.target)}else{if(-1!=d.target.className.indexOf("menu-delete")){return c.eventOnClickMenuDelete(d.target)}else{if(-1!=d.target.className.indexOf("item-delete")){return c.eventOnClickMenuItemDelete(d.target)}else{if(-1!=d.target.className.indexOf("item-cancel")){return c.eventOnClickCancelLink(d.target)}}}}}}});b('#add-custom-links input[type="text"]').keypress(function(d){if(d.keyCode===13){d.preventDefault();b("#submit-customlinkdiv").click()}})},setupInputWithDefaultTitle:function(){var c="input-with-default-title";b("."+c).each(function(){var f=b(this),e=f.attr("title"),d=f.val();f.data(c,e);if(""==d){f.val(e)}else{if(e==d){return}else{f.removeClass(c)}}}).focus(function(){var d=b(this);if(d.val()==d.data(c)){d.val("").removeClass(c)}}).blur(function(){var d=b(this);if(""==d.val()){d.addClass(c).val(d.data(c))}})},attachThemeLocationsListeners:function(){var d=b("#nav-menu-theme-locations"),c={};c.action="menu-locations-save";c["menu-settings-column-nonce"]=b("#menu-settings-column-nonce").val();d.find('input[type="submit"]').click(function(){d.find("select").each(function(){c[this.name]=b(this).val()});d.find(".spinner").show();b.post(ajaxurl,c,function(e){d.find(".spinner").hide()});return false})},attachQuickSearchListeners:function(){var c;b(".quick-search").keypress(function(f){var d=b(this);if(13==f.which){a.updateQuickSearchResults(d);return false}if(c){clearTimeout(c)}c=setTimeout(function(){a.updateQuickSearchResults(d)},400)}).attr("autocomplete","off")},updateQuickSearchResults:function(d){var c,g,e=2,f=d.val();if(f.length<e){return}c=d.parents(".tabs-panel");g={action:"menu-quick-search","response-format":"markup",menu:b("#menu").val(),"menu-settings-column-nonce":b("#menu-settings-column-nonce").val(),q:f,type:d.attr("name")};b(".spinner",c).show();b.post(ajaxurl,g,function(h){a.processQuickSearchQueryResponse(h,g,c)})},addCustomLink:function(c){var e=b("#custom-menu-item-url").val(),d=b("#custom-menu-item-name").val();c=c||a.addMenuItemToBottom;if(""==e||"http://"==e){return false}b(".customlinkdiv .spinner").show();this.addLinkToMenu(e,d,c,function(){b(".customlinkdiv .spinner").hide();b("#custom-menu-item-name").val("").blur();b("#custom-menu-item-url").val("http://")})},addLinkToMenu:function(e,d,c,f){c=c||a.addMenuItemToBottom;f=f||function(){};a.addItemToMenu({"-1":{"menu-item-type":"custom","menu-item-url":e,"menu-item-title":d}},c,f)},addItemToMenu:function(e,c,g){var f=b("#menu").val(),d=b("#menu-settings-column-nonce").val();c=c||function(){};g=g||function(){};params={action:"add-menu-item",menu:f,"menu-settings-column-nonce":d,"menu-item":e};b.post(ajaxurl,params,function(h){var i=b("#menu-instructions");c(h,params);if(!i.hasClass("menu-instructions-inactive")&&i.siblings().length){i.addClass("menu-instructions-inactive")}g()})},addMenuItemToBottom:function(c,d){b(c).hideAdvancedMenuItemFields().appendTo(a.targetList)},addMenuItemToTop:function(c,d){b(c).hideAdvancedMenuItemFields().prependTo(a.targetList)},attachUnsavedChangesListener:function(){b("#menu-management input, #menu-management select, #menu-management, #menu-management textarea").change(function(){a.registerChange()});if(0!=b("#menu-to-edit").length){window.onbeforeunload=function(){if(a.menusChanged){return navMenuL10n.saveAlert}}}else{b("#menu-settings-column").find("input,select").prop("disabled",true).end().find("a").attr("href","#").unbind("click")}},registerChange:function(){a.menusChanged=true},attachTabsPanelListeners:function(){b("#menu-settings-column").bind("click",function(h){var f,d,i,c,g=b(h.target);if(g.hasClass("nav-tab-link")){d=/#(.*)$/.exec(h.target.href);if(d&&d[1]){d=d[1]}else{return false}i=g.parents(".inside").first();b("input",i).removeAttr("checked");b(".tabs-panel-active",i).removeClass("tabs-panel-active").addClass("tabs-panel-inactive");b("#"+d,i).removeClass("tabs-panel-inactive").addClass("tabs-panel-active");b(".tabs",i).removeClass("tabs");g.parent().addClass("tabs");b(".quick-search",i).focus();return false}else{if(g.hasClass("select-all")){f=/#(.*)$/.exec(h.target.href);if(f&&f[1]){c=b("#"+f[1]+" .tabs-panel-active .menu-item-title input");if(c.length===c.filter(":checked").length){c.removeAttr("checked")}else{c.prop("checked",true)}return false}}else{if(g.hasClass("submit-add-to-menu")){a.registerChange();if(h.target.id&&"submit-customlinkdiv"==h.target.id){a.addCustomLink(a.addMenuItemToBottom)}else{if(h.target.id&&-1!=h.target.id.indexOf("submit-")){b("#"+h.target.id.replace(/submit-/,"")).addSelectedToMenu(a.addMenuItemToBottom)}}return false}else{if(g.hasClass("page-numbers")){b.post(ajaxurl,h.target.href.replace(/.*\?/,"").replace(/action=([^&]*)/,"")+"&action=menu-get-metabox",function(m){if(-1==m.indexOf("replace-id")){return}var l=b.parseJSON(m),e=document.getElementById(l["replace-id"]),k=document.createElement("div"),j=document.createElement("div");if(!l.markup||!e){return}j.innerHTML=l.markup?l.markup:"";e.parentNode.insertBefore(k,e);k.parentNode.removeChild(e);k.parentNode.insertBefore(j,k);k.parentNode.removeChild(k)});return false}}}}})},initTabManager:function(){var h=b(".nav-tabs-wrapper"),j=h.children(".nav-tabs"),g=j.children(".nav-tab-active"),m=j.children(".nav-tab"),e=0,o,f,l,d,k,i={},c=a.isRTL?"margin-right":"margin-left",p=a.isRTL?"margin-left":"margin-right",n=2;a.refreshMenuTabs=function(q){var t=h.width(),s=0,r={};f=h.offset().left;o=f+t;if(!q){g.makeTabVisible()}if(m.last().isTabVisible()){s=h.width()-e;s=s>0?0:s;r[c]=s+"px";j.animate(r,100,"linear")}if(t>e){l.add(d).hide()}else{l.add(d).show()}};b.fn.extend({makeTabVisible:function(){var u=this.eq(0),v,s,r={},q=0;if(!u.length){return this}v=u.offset().left;s=v+u.outerWidth();if(s>o){q=o-s}else{if(v<f){q=f-v}}if(!q){return this}r[c]="+="+a.negateIfRTL*q+"px";j.animate(r,Math.abs(q)*n,"linear");return this},isTabVisible:function(){var r=this.eq(0),s=r.offset().left,q=s+r.outerWidth();return(q<=o&&s>=f)?true:false}});m.each(function(){e+=b(this).outerWidth(true)});i.padding=0;i[p]=(-1*e)+"px";j.css(i);l=b('<div class="nav-tabs-arrow nav-tabs-arrow-left"><a>&laquo;</a></div>');d=b('<div class="nav-tabs-arrow nav-tabs-arrow-right"><a>&raquo;</a></div>');h.wrap('<div class="nav-tabs-nav"/>').parent().prepend(l).append(d);a.refreshMenuTabs();b(window).resize(function(){if(k){clearTimeout(k)}k=setTimeout(a.refreshMenuTabs,200)});b.each([{arrow:l,next:"next",last:"first",operator:"+="},{arrow:d,next:"prev",last:"last",operator:"-="}],function(){var q=this;this.arrow.mousedown(function(){var t=Math.abs(parseInt(j.css(c))),r=t,s={};if("-="==q.operator){r=Math.abs(e-h.width())-t}if(!r){return}s[c]=q.operator+r+"px";j.animate(s,r*n,"linear")}).mouseup(function(){var s,r;j.stop(true);s=m[q.last]();while((r=s[q.next]())&&r.length&&!r.isTabVisible()){s=r}s.makeTabVisible()})})},eventOnClickEditLink:function(d){var c,e,f=/#(.*)$/.exec(d.href);if(f&&f[1]){c=b("#"+f[1]);e=c.parent();if(0!=e.length){if(e.hasClass("menu-item-edit-inactive")){if(!c.data("menu-item-data")){c.data("menu-item-data",c.getItemData())}c.slideDown("fast");e.removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active")}else{c.slideUp("fast");e.removeClass("menu-item-edit-active").addClass("menu-item-edit-inactive")}return false}}},eventOnClickCancelLink:function(d){var c=b(d).closest(".menu-item-settings");c.setItemData(c.data("menu-item-data"));return false},eventOnClickMenuSave:function(e){var f="",c=b("#menu-name"),d=c.val();if(!d||d==c.attr("title")||!d.replace(/\s+/,"")){c.parent().addClass("form-invalid");return false}b("#nav-menu-theme-locations select").each(function(){f+='<input type="hidden" name="'+this.name+'" value="'+b(this).val()+'" />'});b("#update-nav-menu").append(f);a.menuList.find(".menu-item-data-position").val(function(g){return g+1});window.onbeforeunload=null;return true},eventOnClickMenuDelete:function(c){if(confirm(navMenuL10n.warnDeleteMenu)){window.onbeforeunload=null;return true}return false},eventOnClickMenuItemDelete:function(c){var d=parseInt(c.id.replace("delete-",""),10);a.removeMenuItem(b("#menu-item-"+d));a.registerChange();return false},processQuickSearchQueryResponse:function(g,k,c){var e,i,f={},d=document.getElementById("nav-menu-meta"),j=new RegExp("menu-item\\[([^\\]]*)","g"),h=b("<div>").html(g).find("li"),l;if(!h.length){b(".categorychecklist",c).html("<li><p>"+navMenuL10n.noResultsFound+"</p></li>");b(".spinner",c).hide();return}h.each(function(){l=b(this);e=j.exec(l.html());if(e&&e[1]){i=e[1];while(d.elements["menu-item["+i+"][menu-item-type]"]||f[i]){i--}f[i]=true;if(i!=e[1]){l.html(l.html().replace(new RegExp("menu-item\\["+e[1]+"\\]","g"),"menu-item["+i+"]"))}}});b(".categorychecklist",c).html(h);b(".spinner",c).hide()},removeMenuItem:function(d){var c=d.childMenuItems();d.addClass("deleting").animate({opacity:0,height:0},350,function(){var e=b("#menu-instructions");d.remove();c.shiftDepthClass(-1).updateParentMenuItemDBId();if(!e.siblings().length){e.removeClass("menu-instructions-inactive")}})},depthToPx:function(c){return c*a.options.menuItemDepthPerLevel},pxToDepth:function(c){return Math.floor(c/a.options.menuItemDepthPerLevel)}};b(document).ready(function(){wpNavMenu.init()})})(jQuery);
    2  Kein Zeilenumbruch am Ende der Datei
     1var wpNavMenu;(function(a){var b=wpNavMenu={options:{menuItemDepthPerLevel:30,globalMaxDepth:11},menuList:undefined,targetList:undefined,menusChanged:false,isRTL:!!("undefined"!=typeof isRtl&&isRtl),negateIfRTL:"undefined"!=typeof isRtl&&isRtl?-1:1,init:function(){b.menuList=a("#menu-to-edit");b.targetList=b.menuList;this.jQueryExtensions();this.attachMenuEditListeners();this.setupInputWithDefaultTitle();this.attachQuickSearchListeners();this.attachThemeLocationsListeners();this.attachTabsPanelListeners();this.attachUnsavedChangesListener();if(b.menuList.length)this.initSortables();this.initToggles();this.initTabManager()},jQueryExtensions:function(){a.fn.extend({menuItemDepth:function(){var a=b.isRTL?this.eq(0).css("margin-right"):this.eq(0).css("margin-left");return b.pxToDepth(a&&-1!=a.indexOf("px")?a.slice(0,-2):0)},updateDepthClass:function(b,c){return this.each(function(){var d=a(this);c=c||d.menuItemDepth();a(this).removeClass("menu-item-depth-"+c).addClass("menu-item-depth-"+b)})},shiftDepthClass:function(b){return this.each(function(){var c=a(this),d=c.menuItemDepth();a(this).removeClass("menu-item-depth-"+d).addClass("menu-item-depth-"+(d+b))})},childMenuItems:function(){var b=a();this.each(function(){var c=a(this),d=c.menuItemDepth(),e=c.next();while(e.length&&e.menuItemDepth()>d){b=b.add(e);e=e.next()}});return b},updateParentMenuItemDBId:function(){return this.each(function(){var b=a(this),c=b.find(".menu-item-data-parent-id"),d=b.menuItemDepth(),e=b.prev();if(d==0){c.val(0)}else{while(!e[0]||!e[0].className||-1==e[0].className.indexOf("menu-item")||e.menuItemDepth()!=d-1)e=e.prev();c.val(e.find(".menu-item-data-db-id").val())}})},hideAdvancedMenuItemFields:function(){return this.each(function(){var b=a(this);a(".hide-column-tog").not(":checked").each(function(){b.find(".field-"+a(this).val()).addClass("hidden-field")})})},addSelectedToMenu:function(c){if(0==a("#menu-to-edit").length){return false}return this.each(function(){var d=a(this),e={},f=d.find(".tabs-panel-active .categorychecklist li input:checked"),g=new RegExp("menu-item\\[([^\\]]*)");c=c||b.addMenuItemToBottom;if(!f.length)return false;d.find(".spinner").show();a(f).each(function(){var d=a(this),f=g.exec(d.attr("name")),h="undefined"==typeof f[1]?0:parseInt(f[1],10);if(this.className&&-1!=this.className.indexOf("add-to-top"))c=b.addMenuItemToTop;e[h]=d.closest("li").getItemData("add-menu-item",h)});b.addItemToMenu(e,c,function(){f.removeAttr("checked");d.find(".spinner").hide()})})},getItemData:function(a,b){a=a||"menu-item";var c={},d,e=["menu-item-db-id","menu-item-object-id","menu-item-object","menu-item-parent-id","menu-item-position","menu-item-type","menu-item-title","menu-item-url","menu-item-description","menu-item-attr-title","menu-item-target","menu-item-classes","menu-item-xfn"];if(!b&&a=="menu-item"){b=this.find(".menu-item-data-db-id").val()}if(!b)return c;this.find("input").each(function(){var f;d=e.length;while(d--){if(a=="menu-item")f=e[d]+"["+b+"]";else if(a=="add-menu-item")f="menu-item["+b+"]["+e[d]+"]";if(this.name&&f==this.name){c[e[d]]=this.value}}});return c},setItemData:function(b,c,d){c=c||"menu-item";if(!d&&c=="menu-item"){d=a(".menu-item-data-db-id",this).val()}if(!d)return this;this.find("input").each(function(){var e=a(this),f;a.each(b,function(a,b){if(c=="menu-item")f=a+"["+d+"]";else if(c=="add-menu-item")f="menu-item["+d+"]["+a+"]";if(f==e.attr("name")){e.val(b)}})});return this}})},initToggles:function(){postboxes.add_postbox_toggles("nav-menus");columns.useCheckboxesForHidden();columns.checked=function(b){a(".field-"+b).removeClass("hidden-field")};columns.unchecked=function(b){a(".field-"+b).addClass("hidden-field")};b.menuList.hideAdvancedMenuItemFields()},initSortables:function(){function q(a){var c;g=a.placeholder.prev();h=a.placeholder.next();if(g[0]==a.item[0])g=g.prev();if(h[0]==a.item[0])h=h.next();i=g.length?g.offset().top+g.height():0;j=h.length?h.offset().top+h.height()/3:0;e=h.length?h.menuItemDepth():0;if(g.length)f=(c=g.menuItemDepth()+1)>b.options.globalMaxDepth?b.options.globalMaxDepth:c;else f=0}function r(a,b){a.placeholder.updateDepthClass(b,c);c=b}function s(){if(!n[0].className)return 0;var a=n[0].className.match(/menu-max-depth-(\d+)/);return a&&a[1]?parseInt(a[1]):0}function t(c){var d,e=p;if(c===0){return}else if(c>0){d=o+c;if(d>p)e=d}else if(c<0&&o==p){while(!a(".menu-item-depth-"+e,b.menuList).length&&e>0)e--}n.removeClass("menu-max-depth-"+p).addClass("menu-max-depth-"+e);p=e}var c=0,d,e,f,g,h,i,j,k,l,m=b.menuList.offset().left,n=a("body"),o,p=s();m+=b.isRTL?b.menuList.width():0;b.menuList.sortable({handle:".menu-item-handle",placeholder:"sortable-placeholder",start:function(c,e){var f,g,h,i,j;if(b.isRTL)e.item[0].style.right="auto";l=e.item.children(".menu-item-transport");d=e.item.menuItemDepth();r(e,d);h=e.item.next()[0]==e.placeholder[0]?e.item.next():e.item;i=h.childMenuItems();l.append(i);f=l.outerHeight();f+=f>0?e.placeholder.css("margin-top").slice(0,-2)*1:0;f+=e.helper.outerHeight();k=f;f-=2;e.placeholder.height(f);o=d;i.each(function(){var b=a(this).menuItemDepth();o=b>o?b:o});g=e.helper.find(".menu-item-handle").outerWidth();g+=b.depthToPx(o-d);g-=2;e.placeholder.width(g);j=e.placeholder.next();j.css("margin-top",k+"px");e.placeholder.detach();a(this).sortable("refresh");e.item.after(e.placeholder);j.css("margin-top",0);q(e)},stop:function(a,e){var f,g=c-d;f=l.children().insertAfter(e.item);if(g!=0){e.item.updateDepthClass(c);f.shiftDepthClass(g);t(g)}b.registerChange(e.item);e.item.updateParentMenuItemDBId();e.item[0].style.top=0;if(b.isRTL){e.item[0].style.left="auto";e.item[0].style.right=0}b.refreshMenuTabs(true)},change:function(a,c){if(!c.placeholder.parent().hasClass("menu"))g.length?g.after(c.placeholder):b.menuList.prepend(c.placeholder);q(c)},sort:function(d,g){var l=g.helper.offset(),n=b.isRTL?l.left+g.helper.width():l.left,o=b.negateIfRTL*b.pxToDepth(n-m);if(o>f||l.top<i)o=f;else if(o<e)o=e;if(o!=c)r(g,o);if(j&&l.top+k>j){h.after(g.placeholder);q(g);a(this).sortable("refreshPositions")}}})},attachMenuEditListeners:function(){var b=this;a("#update-nav-menu").bind("click",function(a){if(a.target&&a.target.className){if(-1!=a.target.className.indexOf("item-edit")){return b.eventOnClickEditLink(a.target)}else if(-1!=a.target.className.indexOf("menu-save")){return b.eventOnClickMenuSave(a.target)}else if(-1!=a.target.className.indexOf("menu-delete")){return b.eventOnClickMenuDelete(a.target)}else if(-1!=a.target.className.indexOf("item-delete")){return b.eventOnClickMenuItemDelete(a.target)}else if(-1!=a.target.className.indexOf("item-cancel")){return b.eventOnClickCancelLink(a.target)}}});a('#add-custom-links input[type="text"]').keypress(function(b){if(b.keyCode===13){b.preventDefault();a("#submit-customlinkdiv").click()}})},setupInputWithDefaultTitle:function(){var b="input-with-default-title";a("."+b).each(function(){var c=a(this),d=c.attr("title"),e=c.val();c.data(b,d);if(""==e)c.val(d);else if(d==e)return;else c.removeClass(b)}).focus(function(){var c=a(this);if(c.val()==c.data(b))c.val("").removeClass(b)}).blur(function(){var c=a(this);if(""==c.val())c.addClass(b).val(c.data(b))})},attachThemeLocationsListeners:function(){var b=a("#nav-menu-theme-locations"),c={};c["action"]="menu-locations-save";c["menu-settings-column-nonce"]=a("#menu-settings-column-nonce").val();b.find('input[type="submit"]').click(function(){b.find("select").each(function(){c[this.name]=a(this).val()});b.find(".spinner").show();a.post(ajaxurl,c,function(a){b.find(".spinner").hide()});return false})},attachQuickSearchListeners:function(){var c;a(".quick-search").keypress(function(d){var e=a(this);if(13==d.which){b.updateQuickSearchResults(e);return false}if(c)clearTimeout(c);c=setTimeout(function(){b.updateQuickSearchResults(e)},400)}).attr("autocomplete","off")},updateQuickSearchResults:function(c){var d,e,f=2,g=c.val();if(g.length<f)return;d=c.parents(".tabs-panel");e={action:"menu-quick-search","response-format":"markup",menu:a("#menu").val(),"menu-settings-column-nonce":a("#menu-settings-column-nonce").val(),q:g,type:c.attr("name")};a(".spinner",d).show();a.post(ajaxurl,e,function(a){b.processQuickSearchQueryResponse(a,e,d)})},addCustomLink:function(c){var d=a("#custom-menu-item-url").val(),e=a("#custom-menu-item-name").val();c=c||b.addMenuItemToBottom;if(""==d||"http://"==d)return false;a(".customlinkdiv .spinner").show();this.addLinkToMenu(d,e,c,function(){a(".customlinkdiv .spinner").hide();a("#custom-menu-item-name").val("").blur();a("#custom-menu-item-url").val("http://")})},addLinkToMenu:function(a,c,d,e){d=d||b.addMenuItemToBottom;e=e||function(){};b.addItemToMenu({"-1":{"menu-item-type":"custom","menu-item-url":a,"menu-item-title":c}},d,e)},addItemToMenu:function(b,c,d){var e=a("#menu").val(),f=a("#menu-settings-column-nonce").val();c=c||function(){};d=d||function(){};params={action:"add-menu-item",menu:e,"menu-settings-column-nonce":f,"menu-item":b};a.post(ajaxurl,params,function(b){var e=a("#menu-instructions");c(b,params);if(!e.hasClass("menu-instructions-inactive")&&e.siblings().length)e.addClass("menu-instructions-inactive");d()})},addMenuItemToBottom:function(c,d){a(c).hideAdvancedMenuItemFields().appendTo(b.targetList)},addMenuItemToTop:function(c,d){a(c).hideAdvancedMenuItemFields().prependTo(b.targetList)},attachUnsavedChangesListener:function(){a("#menu-management input, #menu-management select, #menu-management, #menu-management textarea").change(function(c){var d=a(c.target).parents(".menu-item");b.registerChange(d)});if(0!=a("#menu-to-edit").length){window.onbeforeunload=function(){if(b.menusChanged)return navMenuL10n.saveAlert}}else{a("#menu-settings-column").find("input,select").prop("disabled",true).end().find("a").attr("href","#").unbind("click")}},registerChange:function(a){if(a!==undefined){a.removeClass("menu-item-unchanged")}b.menusChanged=true},attachTabsPanelListeners:function(){a("#menu-settings-column").bind("click",function(c){var d,e,f,g,h=a(c.target);if(h.hasClass("nav-tab-link")){e=/#(.*)$/.exec(c.target.href);if(e&&e[1])e=e[1];else return false;f=h.parents(".inside").first();a("input",f).removeAttr("checked");a(".tabs-panel-active",f).removeClass("tabs-panel-active").addClass("tabs-panel-inactive");a("#"+e,f).removeClass("tabs-panel-inactive").addClass("tabs-panel-active");a(".tabs",f).removeClass("tabs");h.parent().addClass("tabs");a(".quick-search",f).focus();return false}else if(h.hasClass("select-all")){d=/#(.*)$/.exec(c.target.href);if(d&&d[1]){g=a("#"+d[1]+" .tabs-panel-active .menu-item-title input");if(g.length===g.filter(":checked").length)g.removeAttr("checked");else g.prop("checked",true);return false}}else if(h.hasClass("submit-add-to-menu")){b.registerChange();if(c.target.id&&"submit-customlinkdiv"==c.target.id)b.addCustomLink(b.addMenuItemToBottom);else if(c.target.id&&-1!=c.target.id.indexOf("submit-"))a("#"+c.target.id.replace(/submit-/,"")).addSelectedToMenu(b.addMenuItemToBottom);return false}else if(h.hasClass("page-numbers")){a.post(ajaxurl,c.target.href.replace(/.*\?/,"").replace(/action=([^&]*)/,"")+"&action=menu-get-metabox",function(b){if(-1==b.indexOf("replace-id"))return;var c=a.parseJSON(b),d=document.getElementById(c["replace-id"]),e=document.createElement("div"),f=document.createElement("div");if(!c["markup"]||!d)return;f.innerHTML=c["markup"]?c["markup"]:"";d.parentNode.insertBefore(e,d);e.parentNode.removeChild(d);e.parentNode.insertBefore(f,e);e.parentNode.removeChild(e)});return false}})},initTabManager:function(){var c=a(".nav-tabs-wrapper"),d=c.children(".nav-tabs"),e=d.children(".nav-tab-active"),f=d.children(".nav-tab"),g=0,h,i,j,k,l,m={},n=b.isRTL?"margin-right":"margin-left",o=b.isRTL?"margin-left":"margin-right",p=2;b.refreshMenuTabs=function(a){var b=c.width(),l=0,m={};i=c.offset().left;h=i+b;if(!a)e.makeTabVisible();if(f.last().isTabVisible()){l=c.width()-g;l=l>0?0:l;m[n]=l+"px";d.animate(m,100,"linear")}if(b>g)j.add(k).hide();else j.add(k).show()};a.fn.extend({makeTabVisible:function(){var a=this.eq(0),c,e,f={},g=0;if(!a.length)return this;c=a.offset().left;e=c+a.outerWidth();if(e>h)g=h-e;else if(c<i)g=i-c;if(!g)return this;f[n]="+="+b.negateIfRTL*g+"px";d.animate(f,Math.abs(g)*p,"linear");return this},isTabVisible:function(){var a=this.eq(0),b=a.offset().left,c=b+a.outerWidth();return c<=h&&b>=i?true:false}});f.each(function(){g+=a(this).outerWidth(true)});m["padding"]=0;m[o]=-1*g+"px";d.css(m);j=a('<div class="nav-tabs-arrow nav-tabs-arrow-left"><a>«</a></div>');k=a('<div class="nav-tabs-arrow nav-tabs-arrow-right"><a>»</a></div>');c.wrap('<div class="nav-tabs-nav"/>').parent().prepend(j).append(k);b.refreshMenuTabs();a(window).resize(function(){if(l)clearTimeout(l);l=setTimeout(b.refreshMenuTabs,200)});a.each([{arrow:j,next:"next",last:"first",operator:"+="},{arrow:k,next:"prev",last:"last",operator:"-="}],function(){var a=this;this.arrow.mousedown(function(){var b=Math.abs(parseInt(d.css(n))),e=b,f={};if("-="==a.operator)e=Math.abs(g-c.width())-b;if(!e)return;f[n]=a.operator+e+"px";d.animate(f,e*p,"linear")}).mouseup(function(){var b,c;d.stop(true);b=f[a.last]();while((c=b[a.next]())&&c.length&&!c.isTabVisible()){b=c}b.makeTabVisible()})})},eventOnClickEditLink:function(b){var c,d,e=/#(.*)$/.exec(b.href);if(e&&e[1]){c=a("#"+e[1]);d=c.parent();if(0!=d.length){if(d.hasClass("menu-item-edit-inactive")){if(!c.data("menu-item-data")){c.data("menu-item-data",c.getItemData())}c.slideDown("fast");d.removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active")}else{c.slideUp("fast");d.removeClass("menu-item-edit-active").addClass("menu-item-edit-inactive")}return false}}},eventOnClickCancelLink:function(b){var c=a(b).closest(".menu-item-settings");c.setItemData(c.data("menu-item-data"));return false},eventOnClickMenuSave:function(c){var d="",e=a("#menu-name"),f=e.val();if(!f||f==e.attr("title")||!f.replace(/\s+/,"")){e.parent().addClass("form-invalid");return false}a("#nav-menu-theme-locations select").each(function(){d+='<input type="hidden" name="'+this.name+'" value="'+a(this).val()+'" />'});a("#update-nav-menu").append(d);b.menuList.find(".menu-item-data-position").val(function(a){return a+1});b.menuList.find(".menu-item-unchanged :input").each(function(){a(this).attr("disabled","disabled")});window.onbeforeunload=null;return true},eventOnClickMenuDelete:function(a){if(confirm(navMenuL10n.warnDeleteMenu)){window.onbeforeunload=null;return true}return false},eventOnClickMenuItemDelete:function(c){var d=parseInt(c.id.replace("delete-",""),10);b.removeMenuItem(a("#menu-item-"+d),d);b.registerChange();return false},processQuickSearchQueryResponse:function(b,c,d){var e,f,g={},h=document.getElementById("nav-menu-meta"),i=new RegExp("menu-item\\[([^\\]]*)","g"),j=a("<div>").html(b).find("li"),k;if(!j.length){a(".categorychecklist",d).html("<li><p>"+navMenuL10n.noResultsFound+"</p></li>");a(".spinner",d).hide();return}j.each(function(){k=a(this);e=i.exec(k.html());if(e&&e[1]){f=e[1];while(h.elements["menu-item["+f+"][menu-item-type]"]||g[f]){f--}g[f]=true;if(f!=e[1]){k.html(k.html().replace(new RegExp("menu-item\\["+e[1]+"\\]","g"),"menu-item["+f+"]"))}}});a(".categorychecklist",d).html(j);a(".spinner",d).hide()},removeMenuItem:function(b,c){var d=b.childMenuItems();var e='<input type="hidden" name="menu-item-delete['+c+']" value="'+c+'" />';a("#update-nav-menu").append(e);b.addClass("deleting").animate({opacity:0,height:0},350,function(){var c=a("#menu-instructions");b.remove();d.shiftDepthClass(-1).updateParentMenuItemDBId();if(!c.siblings().length)c.removeClass("menu-instructions-inactive")})},depthToPx:function(a){return a*b.options.menuItemDepthPerLevel},pxToDepth:function(a){return Math.floor(a/b.options.menuItemDepthPerLevel)}};a(document).ready(function(){wpNavMenu.init()})})(jQuery)
     2 Kein Zeilenumbruch am Ende der Datei
  • wp-admin/nav-menus.php

     
    309309                        // Update menu items
    310310
    311311                        if ( ! is_wp_error( $_menu_object ) ) {
    312                                 $unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array('orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID', 'post_status' => 'draft,publish') );
    313                                 $menu_items = array();
     312
     313                                // Loop through all the menu items' which should be deleted
     314                                if ( ! empty( $_POST['menu-item-delete'] ) ) {
     315                                        foreach ( (array) $_POST['menu-item-delete'] as $_key => $k ) {
     316                                                if ( is_nav_menu_item( $_key ) ) {
     317                                                        wp_delete_post( $_key );
     318                                                }
     319                                        }
     320                                }
     321
     322                                $menu_items_sorted_by_position = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'orderby' => 'menu_order', 'output' => ARRAY_A, 'output_key' => 'menu_order', 'post_status' => 'draft,publish' ) );
     323                                $unchanged_menu_items = array();
     324                                $changed_menu_items = array();
    314325                                // Index menu items by db ID
    315                                 foreach( $unsorted_menu_items as $_item )
    316                                         $menu_items[$_item->db_id] = $_item;
     326                                foreach ( $menu_items_sorted_by_position as $_item )
     327                                        $unchanged_menu_items[ $_item->db_id ] = $_item;
    317328
    318329                                $post_fields = array( 'menu-item-db-id', 'menu-item-object-id', 'menu-item-object', 'menu-item-parent-id', 'menu-item-position', 'menu-item-type', 'menu-item-title', 'menu-item-url', 'menu-item-description', 'menu-item-attr-title', 'menu-item-target', 'menu-item-classes', 'menu-item-xfn' );
    319330                                wp_defer_term_counting(true);
     
    333344
    334345                                                if ( is_wp_error( $menu_item_db_id ) )
    335346                                                        $messages[] = '<div id="message" class="error"><p>' . $menu_item_db_id->get_error_message() . '</p></div>';
    336                                                 elseif ( isset( $menu_items[$menu_item_db_id] ) )
    337                                                         unset( $menu_items[$menu_item_db_id] );
    338                                         }
    339                                 }
    340 
    341                                 // Remove menu items from the menu that weren't in $_POST
    342                                 if ( ! empty( $menu_items ) ) {
    343                                         foreach ( array_keys( $menu_items ) as $menu_item_id ) {
    344                                                 if ( is_nav_menu_item( $menu_item_id ) ) {
    345                                                         wp_delete_post( $menu_item_id );
     347                                                else {
     348                                                        if ( isset( $unchanged_menu_items[ $menu_item_db_id ] ) )
     349                                                                unset( $unchanged_menu_items[ $menu_item_db_id ] );
     350                                                        $changed_menu_items[ $args['menu-item-position'] ] = (object) array(
     351                                                                'db_id' => $menu_item_db_id,
     352                                                                'menu_order' => $args[ 'menu-item-position' ],
     353                                                                'menu_item_parent' => $args[ 'menu-item-parent-id' ]
     354                                                        );
    346355                                                }
    347356                                        }
    348357                                }
     358                                wp_update_menu_item_positions( $menu_items_sorted_by_position, $unchanged_menu_items, $changed_menu_items );
    349359
    350360                                // Store 'auto-add' pages.
    351361                                $auto_add = ! empty( $_POST['auto-add-pages'] );
     
    368378                                do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
    369379
    370380                                $messages[] = '<div id="message" class="updated"><p>' . sprintf( __('The <strong>%s</strong> menu has been updated.'), $nav_menu_selected_title ) . '</p></div>';
    371                                 unset( $menu_items, $unsorted_menu_items );
     381                                unset( $unchanged_menu_items, $changed_menu_items, $menu_items_sorted_by_position );
    372382                        }
    373383                }
    374384                break;