<!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>[14283] trunk: More nav menu fixes.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/14283">14283</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-04-28 18:30:32 +0000 (Wed, 28 Apr 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>More nav menu fixes. props filosofo. see <a href="http://trac.wordpress.org/ticket/13148">#13148</a>. fixes <a href="http://trac.wordpress.org/ticket/13155">#13155</a>, fixes <a href="http://trac.wordpress.org/ticket/13157">#13157</a>, fixes <a href="http://trac.wordpress.org/ticket/13138">#13138</a>, see <a href="http://trac.wordpress.org/ticket/13134">#13134</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesnavmenuphp">trunk/wp-admin/includes/nav-menu.php</a></li>
<li><a href="#trunkwpadminjsnavmenudevjs">trunk/wp-admin/js/nav-menu.dev.js</a></li>
<li><a href="#trunkwpadminjsnavmenujs">trunk/wp-admin/js/nav-menu.js</a></li>
<li><a href="#trunkwpincludesdefaultfiltersphp">trunk/wp-includes/default-filters.php</a></li>
<li><a href="#trunkwpincludesnavmenutemplatephp">trunk/wp-includes/nav-menu-template.php</a></li>
<li><a href="#trunkwpincludesnavmenuphp">trunk/wp-includes/nav-menu.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/nav-menu.php (14282 => 14283)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/nav-menu.php        2010-04-28 17:17:42 UTC (rev 14282)
+++ trunk/wp-admin/includes/nav-menu.php        2010-04-28 18:30:32 UTC (rev 14283)
</span><span class="lines">@@ -305,12 +305,15 @@
</span><span class="cx"> function wp_nav_menu_post_type_meta_boxes() {
</span><span class="cx">         $post_types = get_post_types( array( 'public' => true ), 'object' );
</span><span class="cx">
</span><del>-        if ( !$post_types )
</del><ins>+        if ( ! $post_types )
</ins><span class="cx">                 return;
</span><span class="cx">
</span><span class="cx">         foreach ( $post_types as $post_type ) {
</span><del>-                $id = $post_type->name;
-                add_meta_box( "add-{$id}", $post_type->label, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', 'default', $post_type );
</del><ins>+                $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type );
+                if ( $post_type ) {
+                        $id = $post_type->name;
+                        add_meta_box( "add-{$id}", $post_type->label, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', 'default', $post_type );
+                }
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -326,8 +329,11 @@
</span><span class="cx">                 return;
</span><span class="cx">
</span><span class="cx">         foreach ( $taxonomies as $tax ) {
</span><del>-                $id = $tax->name;
-                add_meta_box( "add-{$id}", $tax->label, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );
</del><ins>+                $tax = apply_filters( 'nav_menu_meta_box_object', $tax );
+                if ( $tax ) {
+                        $id = $tax->name;
+                        add_meta_box( "add-{$id}", $tax->label, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );
+                }
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -337,8 +343,8 @@
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> */
</span><span class="cx"> function wp_nav_menu_item_link_meta_box() {
</span><del>-        static $_placeholder;
-        $_placeholder = 0 > $_placeholder ? $_placeholder - 1 : -1;
</del><ins>+        global $_nav_menu_placeholder;
+        $_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1;
</ins><span class="cx">
</span><span class="cx">         // @note: hacky query, see #12660
</span><span class="cx">         $args = array( 'post_type' => 'nav_menu_item', 'post_status' => 'any', 'meta_key' => '_menu_item_type', 'numberposts' => -1, 'orderby' => 'title', );
</span><span class="lines">@@ -364,39 +370,27 @@
</span><span class="cx">         <div class="customlinkdiv">
</span><span class="cx">                 <ul id="customlink-tabs" class="customlink-tabs add-menu-item-tabs">
</span><span class="cx">                         <li <?php echo ( 'create' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="menu-tab-link" href="<?php echo add_query_arg('customlink-tab', 'create', remove_query_arg($removed_args)); ?>#tabs-panel-create-custom"><?php _e('Create New'); ?></a></li>
</span><del>-                        <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="menu-tab-link" href="<?php echo add_query_arg('customlink-tab', 'all', remove_query_arg($removed_args)); ?>#tabs-panel-all-custom"><?php _e('View All'); ?></a></li>
</del><span class="cx">                 </ul>
</span><span class="cx">
</span><span class="cx">                 <div class="tabs-panel <?php
</span><span class="cx">                         echo ( 'create' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
</span><span class="cx">                 ?>" id="tabs-panel-create-custom">
</span><del>-                        <input type="hidden" value="custom" name="menu-item[<?php echo $_placeholder; ?>][menu-item-type]" />
</del><ins>+                        <input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" />
</ins><span class="cx">                         <p id="menu-item-url-wrap">
</span><span class="cx">                                 <label class="howto" for="custom-menu-item-url">
</span><span class="cx">                                         <span><?php _e('URL'); ?></span>
</span><del>-                                        <input id="custom-menu-item-url" name="menu-item[<?php echo $_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" />
</del><ins>+                                        <input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" />
</ins><span class="cx">                                 </label>
</span><span class="cx">                         </p>
</span><span class="cx">
</span><span class="cx">                         <p id="menu-item-name-wrap">
</span><span class="cx">                                 <label class="howto" for="custom-menu-item-name">
</span><span class="cx">                                         <span><?php _e('Text'); ?></span>
</span><del>-                                        <input id="custom-menu-item-name" name="menu-item[<?php echo $_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox" value="<?php echo esc_attr( __('Menu Item') ); ?>" />
</del><ins>+                                        <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox" value="<?php echo esc_attr( __('Menu Item') ); ?>" />
</ins><span class="cx">                                 </label>
</span><span class="cx">                         </p>
</span><span class="cx">                 </div><!-- /.tabs-panel -->
</span><span class="cx">
</span><del>-                <div class="tabs-panel <?php
-                        echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
-                ?>" id="tabs-panel-all-custom">
-                        <ul id="customlinkchecklist" class="list:customlink customlinkchecklist form-no-clear">
-                                <?php
-                                $args['walker'] = new Walker_Nav_Menu_Checklist;
-                                echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $links), 0, (object) $args );
-                                ?>
-                        </ul>
-                </div><!-- /.tabs-panel -->
-
</del><span class="cx">                 <p class="button-controls">
</span><span class="cx">                         <span class="add-to-menu">
</span><span class="cx">                                 <input type="submit" class="button-secondary" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" />
</span><span class="lines">@@ -433,6 +427,9 @@
</span><span class="cx">                 'suppress_filters' => true,
</span><span class="cx">         );
</span><span class="cx">
</span><ins>+        if ( isset( $post_type['args']->_default_query ) )
+                $args = array_merge($args, (array) $post_type['args']->_default_query );
+
</ins><span class="cx">         // @todo transient caching of these results with proper invalidation on updating of a post of this type
</span><span class="cx">         $get_posts = new WP_Query;
</span><span class="cx">         $posts = $get_posts->query( $args );
</span><span class="lines">@@ -810,6 +807,48 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Adds custom arguments to some of the meta box object types.
+ *
+ * @since 3.0.0
+ *
+ * @access private
+ *
+ * @param object $object The post type or taxonomy meta-object.
+ * @return object The post type of taxonomy object.
+ */
+function _wp_nav_menu_meta_box_object( $object = null ) {
+        if ( isset( $object->name ) ) {
+                // don't show media meta box
+                if ( 'attachment' == $object->name )
+                        return false;
+        
+                // pages should show most recent
+                if ( 'page' == $object->name ) {
+                        $object->_default_query = array(
+                                'orderby' => 'post_date',
+                                'order' => 'DESC',
+                                'post_status' => 'publish',
+                        );
+
+                // posts should show only published items
+                } elseif ( 'post' == $object->name ) {
+                        $object->_default_query = array(
+                                'post_status' => 'publish',
+                        );
+
+                // cats should be in reverse chronological order
+                } elseif ( 'category' == $object->name ) {
+                        $object->_default_query = array(
+                                'orderby' => 'id',
+                                'order' => 'DESC',
+                        );
+                }
+        }
+        
+        return $object;
+}
+
+/**
</ins><span class="cx"> * Returns the menu item formatted to edit.
</span><span class="cx"> *
</span><span class="cx"> * @since 3.0.0
</span><span class="lines">@@ -818,8 +857,6 @@
</span><span class="cx"> * @return string|WP_Error $output The menu formatted to edit or error object on failure.
</span><span class="cx"> */
</span><span class="cx"> function wp_get_nav_menu_to_edit( $menu_item_id = 0 ) {
</span><del>-        static $_placeholder;
-        
</del><span class="cx">         $menu = wp_get_nav_menu_object( $menu_item_id );
</span><span class="cx">         
</span><span class="cx">         // If the menu exists, get its items.
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.dev.js (14282 => 14283)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.dev.js        2010-04-28 17:17:42 UTC (rev 14282)
+++ trunk/wp-admin/js/nav-menu.dev.js        2010-04-28 18:30:32 UTC (rev 14283)
</span><span class="lines">@@ -159,8 +159,16 @@
</span><span class="cx">                 if ( ! list )
</span><span class="cx">                         return;
</span><span class="cx">
</span><del>-                var menuListItems = list.getElementsByTagName('li'),
</del><ins>+                var dummyListItem = document.getElementById(list.id + '-dummy-list-item'),
+                menuListItems = list.getElementsByTagName('li'),
</ins><span class="cx">                 i = menuListItems.length;
</span><ins>+
+                if ( ! dummyListItem ) {
+                        dummyListItem = document.createElement('li');
+                        dummyListItem.id = list.id + '-dummy-list-item';
+                        list.appendChild(dummyListItem);
+                        this.setupListItemDragAndDrop(dummyListItem);
+                }
</ins><span class="cx">                 
</span><span class="cx">                 while ( i-- )
</span><span class="cx">                         this.setupListItemDragAndDrop(menuListItems[i]);
</span><span class="lines">@@ -234,19 +242,23 @@
</span><span class="cx">                 attachTabsPanelListeners : function() {
</span><span class="cx">                         $('#menu-settings-column').bind('click', function(e) {
</span><span class="cx">                                 if ( e.target && e.target.className && -1 != e.target.className.indexOf('menu-tab-link') ) {
</span><del>-                                        var i = e.target.parentNode,
-                                        activePanel,
</del><ins>+                                        var activePanel,
</ins><span class="cx">                                         panelIdMatch = /#(.*)$/.exec(e.target.href),
</span><del>-                                        tabPanels;
-                                        while ( ! i.className || -1 == i.className.indexOf('inside') ) {
-                                                i = i.parentNode;
-                                        }
-                                        $('.tabs-panel', i).each(function() {
</del><ins>+                                        tabPanels,
+                                        wrapper = getParentWrapper(e.target, 'inside'),
+                                        inputs = wrapper ? wrapper.getElementsByTagName('input') : [],
+                                        i = inputs.length;
+
+                                        // upon changing tabs, we want to uncheck all checkboxes
+                                        while( i-- )
+                                                inputs[i].checked = false;
+
+                                        $('.tabs-panel', wrapper).each(function() {
</ins><span class="cx">                                                 if ( this.className )
</span><span class="cx">                                                         this.className = this.className.replace('tabs-panel-active', 'tabs-panel-inactive');
</span><span class="cx">                                         });
</span><span class="cx">
</span><del>-                                        $('.tabs', i).each(function() {
</del><ins>+                                        $('.tabs', wrapper).each(function() {
</ins><span class="cx">                                                 this.className = this.className.replace('tabs', '');
</span><span class="cx">                                         });
</span><span class="cx">
</span><span class="lines">@@ -396,7 +408,7 @@
</span><span class="cx">                                         if ( that != currentDropzone || ( ! activeHovering && that.className && -1 != that.className.indexOf('sortable-placeholder') ) ) {
</span><span class="cx">                                                 that.className = that.className.replace(/sortable-placeholder/g, '');
</span><span class="cx">                                         }
</span><del>-                                }, 500);
</del><ins>+                                }, 800);
</ins><span class="cx">                         })(dropEl);
</span><span class="cx">                 },
</span><span class="cx">
</span><span class="lines">@@ -563,6 +575,7 @@
</span><span class="cx">                         if ( ! req )
</span><span class="cx">                                 req = {};
</span><span class="cx">                         var dropZone,
</span><ins>+                        dummyListItem = document.getElementById(menuList.id + '-dummy-list-item'),
</ins><span class="cx">                         i,
</span><span class="cx">                         listElements,
</span><span class="cx">                         wrap = document.createElement('ul');
</span><span class="lines">@@ -572,9 +585,14 @@
</span><span class="cx">                         i = listElements.length;
</span><span class="cx">                         while ( i-- ) {
</span><span class="cx">                                 this.setupListItemDragAndDrop(listElements[i]);
</span><del>-                                menuList.appendChild(listElements[i]);
</del><ins>+                                if ( dummyListItem )
+                                        menuList.insertBefore(listElements[i], dummyListItem);
+                                else
+                                        menuList.appendChild(listElements[i]);
</ins><span class="cx">                         }
</span><span class="cx">
</span><ins>+                        this.recalculateSortOrder(menuList);
+
</ins><span class="cx">                         /* set custom link form back to defaults */
</span><span class="cx">                         if ( customLinkNameInput && customLinkURLInput ) {
</span><span class="cx">                                 customLinkNameInput.value = customLinkNameDefault;
</span></span></pre></div>
<a id="trunkwpadminjsnavmenujs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.js (14282 => 14283)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.js        2010-04-28 17:17:42 UTC (rev 14282)
+++ trunk/wp-admin/js/nav-menu.js        2010-04-28 18:30:32 UTC (rev 14283)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var WPNavMenuHandler=function(){var h=jQuery,a=false,j=null,g,d,m,i,l={},n=function(p,t,q,s){if(p&&p[0]){var r=h.parseJSON(p[0]);if(r.post_title){if(r.ID&&r.post_type){l[r.post_title]={ID:r.ID,object_type:r.post_type}}return r.post_title}}},o=function(p,t,q,s){if(p&&p[0]){var r=h.parseJSON(p[0]);if(r.post_title){return r.post_title}}},b=function(v,u){if(!v){return false}u=u||document;var q=["menu-item-db-id","menu-item-object-id","menu-item-object","menu-item-parent-id","menu-item-position","menu-item-type","menu-item-append","menu-item-title","menu-item-url","menu-item-description","menu-item-attr-title","menu-item-target","menu-item-classes","menu-item-xfn"],p={},r=u.getElementsByTagName("input"),t=r.length,s,w=document.getElementById("nav-menu-meta-object-id").value;while(t--){s=q.length;while(s--){if(r[t]&&r[t].name&&"menu-item["+v+"]["+q[s]+"]"==r[t].name){p[q[s]]=r[t].value}}}return p},c=function(){var t=this.getElementsByTagName("input"),q=t.length,p,s,r;while(q--){if(-1!=t[q].name.indexOf("menu-item-parent-id["+parseInt(this.id.replace("menu-item-",""),10)+"]")){if(!this.parentNode.className||-1==this.parentNode.className.indexOf("sub-menu")){t[q].value=0}else{if("LI"==this.parentNode.parentNode.nodeName&&-1!=this.parentNode.parentNode.id.indexOf("menu-item-")){s=this.parentNode.parentNode;r=s.getElementsByTagName("input");p=r.length;while(p--){if(r[p].name&&-1!=r[p].name.indexOf("menu-item-object-id["+parseInt(s.id.replace("menu-item-",""),10)+"]")){t[q].value=parseInt(r[p].value,10);break}}}}break}}},e=function(p){var q=this;h(p).droppable({accept:".menu li",tolerance:"pointer",drop:function(s,r){q.eventOnDrop(r.draggable[0],this,r,s)},over:function(s,r){q.eventOnDragOver(r.draggable[0],this,r,s)},out:function(s,r){q.eventOnDragOut(r.draggable[0],this,r,s)}})},k,f=function(r){if(!r){return}var p=r.getElementsByTagName("li"),q=p.length;while(q--){this.setupListItemDragAndDrop(p[q])}};return{init:function(){k=document.getElementById("menu-to-edit");this.attachMenuEditListeners();this.attachMenuMetaListeners(document.getElementById("nav-menu-meta"));this.attachTabsPanelListeners();f.call(this,k);postboxes.add_postbox_toggles("nav-menus")},attachMenuEditListeners:function(){var p=this;h("#update-nav-menu").bind("click",function(q){if(q.target&&q.target.className){if(-1!=q.target.className.indexOf("item-edit")){return p.eventOnClickEditLink(q.target)}else{if(-1!=q.target.className.indexOf("menu-delete")){return p.eventOnClickMenuDelete(q.target)}else{if(-1!=q.target.className.indexOf("item-delete")){return p.eventOnClickMenuItemDelete(q.target)}}}}})},attachMenuMetaListeners:function(p){if(!p){return}var q=this;g=document.getElementById("custom-menu-item-name");d=document.getElementById("custom-menu-item-url");if(g){m="undefined"!=typeof g.defaultValue?g.defaultValue:g.getAttribute("value");i="undefined"!=typeof d.defaultValue?d.defaultValue:d.getAttribute("value");h(g).bind("focus",function(r){this.value=m==this.value?"":this.value});h(g).bind("blur",function(r){this.value=""==this.value?m:this.value})}h("input.quick-search").each(function(r,s){q.setupQuickSearchEventListeners(s)});h(p).bind("submit",function(r){return q.eventSubmitMetaForm.call(q,this,r)})},attachTabsPanelListeners:function(){h("#menu-settings-column").bind("click",function(t){if(t.target&&t.target.className&&-1!=t.target.className.indexOf("menu-tab-link")){var q=t.target.parentNode,u,p=/#(.*)$/.exec(t.target.href),s;while(!q.className||-1==q.className.indexOf("inside")){q=q.parentNode}h(".tabs-panel",q).each(function(){if(this.className){this.className=this.className.replace("tabs-panel-active","tabs-panel-inactive")}});h(".tabs",q).each(function(){this.className=this.className.replace("tabs","")});t.target.parentNode.className+=" tabs";if(p&&p[1]){u=document.getElementById(p[1]);if(u){u.className=u.className.replace("tabs-panel-inactive","tabs-panel-active")}}return false}else{if(t.target&&t.target.className&&-1!=t.target.className.indexOf("select-all")){var r=/#(.*)$/.exec(t.target.href);if(r&&r[1]){h("#"+r[1]+" .tabs-panel-active input[type=checkbox]").attr("checked","checked");return false}}}})},setupListItemDragAndDrop:function(r){var p=r.getElementsByTagName("dl"),s=this.makeListItemDropzone(r),q=p.length;e.call(this,s);this.makeListItemDraggable(r);while(q--){e.call(this,p[q])}},setupQuickSearchEventListeners:function(p){var q=this;h(p).autocomplete(ajaxurl+"?action=menu-quick-search&type="+p.name,{delay:500,formatItem:n,formatResult:o,minchars:2,multiple:false}).bind("blur",function(t){var r=l[this.value],s=this;if(r){h.post(ajaxurl+"?action=menu-quick-search&type=get-post-item&response-format=markup",r,function(u){q.processQuickSearchQueryResponse.call(q,u,r);l[s.value]=false})}})},eventOnClickEditLink:function(p){var r,q=/#(.*)$/.exec(p.href);if(q&&q[1]){r=document.getElementById(q[1]);if(r){if(-1!=r.className.indexOf("menu-item-edit-inactive")){r.className=r.className.replace("menu-item-edit-inactive","menu-item-edit-active")}else{r.className=r.className.replace("menu-item-edit-active","menu-item-edit-inactive")}return false}}},eventOnClickMenuDelete:function(p){if(confirm(navMenuL10n.warnDeleteMenu)){return true}else{return false}},eventOnClickMenuItemDelete:function(p){var s,r,q=this;if(confirm(navMenuL10n.warnDeleteMenuItem)){r=/_wpnonce=([a-zA-Z0-9]*)$/.exec(p.href);if(r&&r[1]){s=parseInt(p.id.replace("delete-",""),10);h.post(ajaxurl,{action:"delete-menu-item","menu-item":s,_wpnonce:r[1]},function(t){if("1"==t){q.removeMenuItem(document.getElementById("menu-item-"+s))}});return false}return true}else{return false}},eventOnDragOver:function(p,q){a=true;j=q;q.className+=" sortable-placeholder"},eventOnDragOut:function(p,q){a=false;(function(r){setTimeout(function(){if(r!=j||(!a&&r.className&&-1!=r.className.indexOf("sortable-placeholder"))){r.className=r.className.replace(/sortable-placeholder/g,"")}},500)})(q)},eventOnDrop:function(s,v){var t=!!(-1==v.className.indexOf("dropzone")),q=v.parentNode.getElementsByTagName("ul"),u=false,r=q.length,p;a=false;v.className=v.className.replace(/sortable-placeholder/g,"");if(t){while(r--){if(q[r]&&1!=q[r].className.indexOf("sub-menu")){u=true;p=q[r]}}if(!u){p=document.createElement("ul");p.className="sub-menu";v.parentNode.appendChild(p)}p.appendChild(s)}else{v.parentNode.parentNode.insertBefore(s,v.parentNode)}this.recalculateSortOrder(k);c.call(s)},eventSubmitMetaForm:function(q,w){var u=q.getElementsByTagName("input"),t=u.length,s,y,p,v,r={},x=function(){},z=new RegExp("menu-item\\[([^\\]]*)");q.className=q.className+" processing",that=this;r.action="";while(t--){if(u[t].name&&-1!=u[t].name.indexOf("menu-item-object-id")&&u[t].checked||("undefined"!=typeof u[t].id&&"custom-menu-item-url"==u[t].id&&""!=u[t].value&&"http://"!=u[t].value)){r.action="add-menu-item";x=that.processAddMenuItemResponse;v=z.exec(u[t].name);p="undefined"==typeof v[1]?0:parseInt(v[1],10);y=b(p);for(s in y){r["menu-item["+p+"]["+s+"]"]=y[s]}u[t].checked=false}else{if(""==r.action&&""!=u[t].value&&u[t].className&&-1!=u[t].className.search(/quick-search\b[^-]/)){r.action="menu-quick-search";r.q=u[t].value;r["response-format"]="markup";r.type=u[t].name;x=that.processQuickSearchQueryResponse}}}r.menu=q.elements.menu.value;r["menu-settings-column-nonce"]=q.elements["menu-settings-column-nonce"].value;h.post(ajaxurl,r,function(A){x.call(that,A,r);q.className=q.className.replace(/processing/g,"")});return false},makeListItemDraggable:function(p){h(p).draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100})},makeListItemDropzone:function(r){if(!r){return false}var q=r.getElementsByTagName("div"),p=q.length,s=document.createElement("div");while(p--){if(q[p].className&&-1!=q[p].className.indexOf("dropzone")&&(r==q[p].parentNode)){return q[p]}}s.className="dropzone";r.insertBefore(s,r.firstChild);return s},processAddMenuItemResponse:function(p,t){if(!t){t={}}var u,r,q,s=document.createElement("ul");s.innerHTML=p;q=s.getElementsByTagName("li");r=q.length;while(r--){this.setupListItemDragAndDrop(q[r]);k.appendChild(q[r])}if(g&&d){g.value=m;d.value=i}},processQuickSearchQueryResponse:function(t,y){if(!y){y={}}var q=document.createElement("ul"),p=document.getElementById("nav-menu-meta"),u,x,r,v,w=new RegExp("menu-item\\[([^\\]]*)"),s;r=w.exec(t);if(r&&r[1]){v=r[1];while(p.elements["menu-item["+v+"][menu-item-type]"]){v--}if(v!=r[1]){t=t.replace(new RegExp("menu-item\\["+r[1]+"\\]","g"),"menu-item["+v+"]")}}q.innerHTML=t;x=q.getElementsByTagName("li");if(x[0]&&y.object_type){s=document.getElementById(y.object_type+"-search-checklist");if(s){s.appendChild(x[0])}}else{if(y.type){r=/quick-search-posttype-([a-zA-Z_-]*)/.exec(y.type);if(r&&r[1]){s=document.getElementById(r[1]+"-search-checklist");if(s){u=x.length;while(u--){s.appendChild(x[u])}}}}}},recalculateSortOrder:function(r){var s=r.getElementsByTagName("input"),q,p=0;for(q=0;q<s.length;q++){if(s[q].name&&-1!=s[q].name.indexOf("menu-item-position")){s[q].value=++p}}},removeMenuItem:function(r){if(!r){return false}var s=r.getElementsByTagName("ul"),q,p;if(s[0]){q=s[0].getElementsByTagName("li");for(p=0;p<q.length;p++){if(q[p].id&&-1!=q[p].id.indexOf("menu-item-")&&q[p].parentNode==s[0]){r.parentNode.insertBefore(q[p],r)}}}r.className+=" deleting";h(r).fadeOut(350,function(){this.parentNode.removeChild(this)});this.recalculateSortOrder(k)}}};var wpNavMenu=new WPNavMenuHandler();jQuery(function(){wpNavMenu.init()});
</del><span class="cx">\ No newline at end of file
</span><ins>+var WPNavMenuHandler=function(){var i=jQuery,a=false,k=null,h,d,n,j,m={},o=function(q,u,r,t){if(q&&q[0]){var s=i.parseJSON(q[0]);if(s.post_title){if(s.ID&&s.post_type){m[s.post_title]={ID:s.ID,object_type:s.post_type}}return s.post_title}}},p=function(q,u,r,t){if(q&&q[0]){var s=i.parseJSON(q[0]);if(s.post_title){return s.post_title}}},b=function(w,v){if(!w){return false}v=v||document;var r=["menu-item-db-id","menu-item-object-id","menu-item-object","menu-item-parent-id","menu-item-position","menu-item-type","menu-item-append","menu-item-title","menu-item-url","menu-item-description","menu-item-attr-title","menu-item-target","menu-item-classes","menu-item-xfn"],q={},s=v.getElementsByTagName("input"),u=s.length,t,x=document.getElementById("nav-menu-meta-object-id").value;while(u--){t=r.length;while(t--){if(s[u]&&s[u].name&&"menu-item["+w+"]["+r[t]+"]"==s[u].name){q[r[t]]=s[u].value}}}return q},c=function(){var u=this.getElementsByTagName("input"),r=u.length,q,t,s;while(r--){if(-1!=u[r].name.indexOf("menu-item-parent-id["+parseInt(this.id.replace("menu-item-",""),10)+"]")){if(!this.parentNode.className||-1==this.parentNode.className.indexOf("sub-menu")){u[r].value=0}else{if("LI"==this.parentNode.parentNode.nodeName&&-1!=this.parentNode.parentNode.id.indexOf("menu-item-")){t=this.parentNode.parentNode;s=t.getElementsByTagName("input");q=s.length;while(q--){if(s[q].name&&-1!=s[q].name.indexOf("menu-item-object-id["+parseInt(t.id.replace("menu-item-",""),10)+"]")){u[r].value=parseInt(s[q].value,10);break}}}}break}}},e=function(r,t){var s=document.getElementById("nav-menu-meta"),q;while(r.parentNode&&(!r.className||-1==r.className.indexOf(t))&&r.parentNode!=s){r=r.parentNode}return r},f=function(q){var r=this;i(q).droppable({accept:".menu li",tolerance:"pointer",drop:function(t,s){r.eventOnDrop(s.draggable[0],this,s,t)},over:function(t,s){r.eventOnDragOver(s.draggable[0],this,s,t)},out:function(t,s){r.eventOnDragOut(s.draggable[0],this,s,t)}})},l,g=function(t){if(!t){return}var r=document.getElementById(t.id+"-dummy-list-item"),q=t.getElementsByTagName("li"),s=q.length;if(!r){r=document.createElement("li");r.id=t.id+"-dummy-list-item";t.appendChild(r);this.setupListItemDragAndDrop(r)}while(s--){this.setupListItemDragAndDrop(q[s])}};return{init:function(){l=document.getElementById("menu-to-edit");this.attachMenuEditListeners();this.attachMenuMetaListeners(document.getElementById("nav-menu-meta"));this.attachTabsPanelListeners();g.call(this,l);postboxes.add_postbox_toggles("nav-menus")},attachMenuEditListeners:function(){var q=this;i("#update-nav-menu").bind("click",function(r){if(r.target&&r.target.className){if(-1!=r.target.className.indexOf("item-edit")){return q.eventOnClickEditLink(r.target)}else{if(-1!=r.target.className.indexOf("menu-delete")){return q.eventOnClickMenuDelete(r.target)}else{if(-1!=r.target.className.indexOf("item-delete")){return q.eventOnClickMenuItemDelete(r.target)}}}}})},attachMenuMetaListeners:function(q){if(!q){return}var r=this;h=document.getElementById("custom-menu-item-name");d=document.getElementById("custom-menu-item-url");if(h){n="undefined"!=typeof h.defaultValue?h.defaultValue:h.getAttribute("value");j="undefined"!=typeof d.defaultValue?d.defaultValue:d.getAttribute("value");i(h).bind("focus",function(s){this.value=n==this.value?"":this.value});i(h).bind("blur",function(s){this.value=""==this.value?n:this.value})}i("input.quick-search").each(function(s,t){r.setupQuickSearchEventListeners(t)});i(q).bind("submit",function(s){return r.eventSubmitMetaForm.call(r,this,s)})},attachTabsPanelListeners:function(){i("#menu-settings-column").bind("click",function(v){if(v.target&&v.target.className&&-1!=v.target.className.indexOf("menu-tab-link")){var w,r=/#(.*)$/.exec(v.target.href),u,x=e(v.target,"inside"),q=x?x.getElementsByTagName("input"):[],s=q.length;while(s--){q[s].checked=false}i(".tabs-panel",x).each(function(){if(this.className){this.className=this.className.replace("tabs-panel-active","tabs-panel-inactive")}});i(".tabs",x).each(function(){this.className=this.className.replace("tabs","")});v.target.parentNode.className+=" tabs";if(r&&r[1]){w=document.getElementById(r[1]);if(w){w.className=w.className.replace("tabs-panel-inactive","tabs-panel-active")}}return false}else{if(v.target&&v.target.className&&-1!=v.target.className.indexOf("select-all")){var t=/#(.*)$/.exec(v.target.href);if(t&&t[1]){i("#"+t[1]+" .tabs-panel-active input[type=checkbox]").attr("checked","checked");return false}}}})},setupListItemDragAndDrop:function(s){var q=s.getElementsByTagName("dl"),t=this.makeListItemDropzone(s),r=q.length;f.call(this,t);this.makeListItemDraggable(s);while(r--){f.call(this,q[r])}},setupQuickSearchEventListeners:function(q){var r=this;i(q).autocomplete(ajaxurl+"?action=menu-quick-search&type="+q.name,{delay:500,formatItem:o,formatResult:p,minchars:2,multiple:false}).bind("blur",function(u){var s=m[this.value],t=this;if(s){i.post(ajaxurl+"?action=menu-quick-search&type=get-post-item&response-format=markup",s,function(v){r.processQuickSearchQueryResponse.call(r,v,s);m[t.value]=false})}})},eventOnClickEditLink:function(q){var s,r=/#(.*)$/.exec(q.href);if(r&&r[1]){s=document.getElementById(r[1]);if(s){if(-1!=s.className.indexOf("menu-item-edit-inactive")){s.className=s.className.replace("menu-item-edit-inactive","menu-item-edit-active")}else{s.className=s.className.replace("menu-item-edit-active","menu-item-edit-inactive")}return false}}},eventOnClickMenuDelete:function(q){if(confirm(navMenuL10n.warnDeleteMenu)){return true}else{return false}},eventOnClickMenuItemDelete:function(q){var t,s,r=this;if(confirm(navMenuL10n.warnDeleteMenuItem)){s=/_wpnonce=([a-zA-Z0-9]*)$/.exec(q.href);if(s&&s[1]){t=parseInt(q.id.replace("delete-",""),10);i.post(ajaxurl,{action:"delete-menu-item","menu-item":t,_wpnonce:s[1]},function(u){if("1"==u){r.removeMenuItem(document.getElementById("menu-item-"+t))}});return false}return true}else{return false}},eventOnDragOver:function(q,r){a=true;k=r;r.className+=" sortable-placeholder"},eventOnDragOut:function(q,r){a=false;(function(s){setTimeout(function(){if(s!=k||(!a&&s.className&&-1!=s.className.indexOf("sortable-placeholder"))){s.className=s.className.replace(/sortable-placeholder/g,"")}},800)})(r)},eventOnDrop:function(t,w){var u=!!(-1==w.className.indexOf("dropzone")),r=w.parentNode.getElementsByTagName("ul"),v=false,s=r.length,q;a=false;w.className=w.className.replace(/sortable-placeholder/g,"");if(u){while(s--){if(r[s]&&1!=r[s].className.indexOf("sub-menu")){v=true;q=r[s]}}if(!v){q=document.createElement("ul");q.className="sub-menu";w.parentNode.appendChild(q)}q.appendChild(t)}else{w.parentNode.parentNode.insertBefore(t,w.parentNode)}this.recalculateSortOrder(l);c.call(t)},eventSubmitMetaForm:function(r,y){var v,w=r.getElementsByTagName("input"),u=w.length,t,A,q,x,s={},z=function(){},B=new RegExp("menu-item\\[([^\\]]*)");that=this;s.action="";while(u--){if(w[u].name&&-1!=w[u].name.indexOf("menu-item-object-id")&&w[u].checked||("undefined"!=typeof w[u].id&&"custom-menu-item-url"==w[u].id&&""!=w[u].value&&"http://"!=w[u].value)){s.action="add-menu-item";z=that.processAddMenuItemResponse;x=B.exec(w[u].name);q="undefined"==typeof x[1]?0:parseInt(x[1],10);A=b(q);for(t in A){s["menu-item["+q+"]["+t+"]"]=A[t]}v=e(w[u],"inside");w[u].checked=false}else{if(""==s.action&&""!=w[u].value&&w[u].className&&-1!=w[u].className.search(/quick-search\b[^-]/)){v=e(w[u],"inside");s.action="menu-quick-search";s.q=w[u].value;s["response-format"]="markup";s.type=w[u].name;z=that.processQuickSearchQueryResponse}}}if(v){v.className=v.className+" processing",s.menu=r.elements.menu.value}s["menu-settings-column-nonce"]=r.elements["menu-settings-column-nonce"].value;i.post(ajaxurl,s,function(C){z.call(that,C,s);v.className=v.className.replace(/processing/g,"")});return false},makeListItemDraggable:function(q){i(q).draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100})},makeListItemDropzone:function(s){if(!s){return false}var r=s.getElementsByTagName("div"),q=r.length,t=document.createElement("div");while(q--){if(r[q].className&&-1!=r[q].className.indexOf("dropzone")&&(s==r[q].parentNode)){return r[q]}}t.className="dropzone";s.insertBefore(t,s.firstChild);return t},processAddMenuItemResponse:function(q,v){if(!v){v={}}var w,r=document.getElementById(l.id+"-dummy-list-item"),t,s,u=document.createElement("ul");u.innerHTML=q;s=u.getElementsByTagName("li");t=s.length;while(t--){this.setupListItemDragAndDrop(s[t]);if(r){l.insertBefore(s[t],r)}else{l.appendChild(s[t])}}this.recalculateSortOrder(l);if(h&&d){h.value=n;d.value=j}},processQuickSearchQueryResponse:function(u,z){if(!z){z={}}var r=document.createElement("ul"),q=document.getElementById("nav-menu-meta"),v,y,s,w,x=new RegExp("menu-item\\[([^\\]]*)"),t;s=x.exec(u);if(s&&s[1]){w=s[1];while(q.elements["menu-item["+w+"][menu-item-type]"]){w--}if(w!=s[1]){u=u.replace(new RegExp("menu-item\\["+s[1]+"\\]","g"),"menu-item["+w+"]")}}r.innerHTML=u;y=r.getElementsByTagName("li");if(y[0]&&z.object_type){t=document.getElementById(z.object_type+"-search-checklist");if(t){t.innerHTML="";t.appendChild(y[0])}}else{if(z.type){s=/quick-search-posttype-([a-zA-Z_-]*)/.exec(z.type);if(s&&s[1]){t=document.getElementById(s[1]+"-search-checklist");if(t){t.innerHTML="";v=y.length;while(v--){t.appendChild(y[v])}}}}}},recalculateSortOrder:function(s){var t=s.getElementsByTagName("input"),r,q=0;for(r=0;r<t.length;r++){if(t[r].name&&-1!=t[r].name.indexOf("menu-item-position")){t[r].value=++q}}},removeMenuItem:function(s){if(!s){return false}var t=s.getElementsByTagName("ul"),r,q;if(t[0]){r=t[0].getElementsByTagName("li");for(q=0;q<r.length;q++){if(r[q].id&&-1!=r[q].id.indexOf("menu-item-")&&r[q].parentNode==t[0]){s.parentNode.insertBefore(r[q],s)}}}s.className+=" deleting";i(s).fadeOut(350,function(){this.parentNode.removeChild(this)});this.recalculateSortOrder(l)}}};var wpNavMenu=new WPNavMenuHandler();jQuery(function(){wpNavMenu.init()});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesdefaultfiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/default-filters.php (14282 => 14283)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/default-filters.php        2010-04-28 17:17:42 UTC (rev 14282)
+++ trunk/wp-includes/default-filters.php        2010-04-28 18:30:32 UTC (rev 14283)
</span><span class="lines">@@ -169,6 +169,7 @@
</span><span class="cx"> add_filter( 'comments_open', '_close_comments_for_old_post', 10, 2 );
</span><span class="cx"> add_filter( 'pings_open', '_close_comments_for_old_post', 10, 2 );
</span><span class="cx"> add_filter( 'editable_slug', 'urldecode' );
</span><ins>+add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object' );
</ins><span class="cx">
</span><span class="cx"> // Atom SSL support
</span><span class="cx"> add_filter( 'atom_service_url','atom_service_url_filter' );
</span></span></pre></div>
<a id="trunkwpincludesnavmenutemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/nav-menu-template.php (14282 => 14283)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/nav-menu-template.php        2010-04-28 17:17:42 UTC (rev 14282)
+++ trunk/wp-includes/nav-menu-template.php        2010-04-28 18:30:32 UTC (rev 14283)
</span><span class="lines">@@ -132,10 +132,12 @@
</span><span class="cx">          * @param object $args
</span><span class="cx">          */
</span><span class="cx">         function start_el(&$output, $item, $depth, $args) {
</span><del>-                static $_placeholder;
-                $_placeholder = 0 > $_placeholder ? $_placeholder - 1 : -1;
-                $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_placeholder;
</del><ins>+                global $_nav_menu_placeholder;
+
+                $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
+                $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder;
</ins><span class="cx">                 $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0;
</span><ins>+                $possible_parent_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->post_parent : 0;
</ins><span class="cx">
</span><span class="cx">                 $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
</span><span class="cx">
</span><span class="lines">@@ -147,7 +149,7 @@
</span><span class="cx">                 // Menu item hidden fields
</span><span class="cx">                 $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />';
</span><span class="cx">                 $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="'. esc_attr( $item->object ) .'" />';
</span><del>-                $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="'. esc_attr( $item->post_parent ) .'" />';
</del><ins>+                $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="'. $possible_parent_id .'" />';
</ins><span class="cx">                 $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="'. esc_attr( $item->type ) .'" />';
</span><span class="cx">                 $output .= '<input type="hidden" class="menu-item-append" name="menu-item[' . $possible_object_id . '][menu-item-append]" value="'. esc_attr( $item->append ) .'" />';
</span><span class="cx">                 $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="'. esc_attr( $item->title ) .'" />';
</span></span></pre></div>
<a id="trunkwpincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/nav-menu.php (14282 => 14283)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/nav-menu.php        2010-04-28 17:17:42 UTC (rev 14282)
+++ trunk/wp-includes/nav-menu.php        2010-04-28 18:30:32 UTC (rev 14283)
</span><span class="lines">@@ -50,7 +50,12 @@
</span><span class="cx">         
</span><span class="cx">         $menu_obj = wp_get_nav_menu_object( $menu );
</span><span class="cx">
</span><del>-        if ( $menu_obj && ! is_wp_error( $menu_obj ) && ! empty( $menu_obj->term_id ) )
</del><ins>+        if (
+                $menu_obj &&
+                ! is_wp_error( $menu_obj ) &&
+                ! empty( $menu_obj->taxonomy ) &&
+                'nav_menu' == $menu_obj->taxonomy
+        )
</ins><span class="cx">                 return true;
</span><span class="cx">         
</span><span class="cx">         return false;
</span><span class="lines">@@ -143,7 +148,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @param int $menu_id The ID of the menu
</span><span class="cx"> * @param array $menu_data The array of menu data.
</span><del>- * @return int The menu's ID.
</del><ins>+ * @return int|error object The menu's ID or WP_Error object.
</ins><span class="cx"> */
</span><span class="cx"> function wp_update_nav_menu_object( $menu_id = 0, $menu_data = array() ) {
</span><span class="cx">         $menu_id = (int) $menu_id;
</span><span class="lines">@@ -151,11 +156,13 @@
</span><span class="cx">         $_menu = wp_get_nav_menu_object( $menu_id );
</span><span class="cx">
</span><span class="cx">         // menu doesn't already exist
</span><del>-        if ( ! $_menu || is_wp_error( $_menu ) ) {
</del><ins>+        if ( ! $_menu || is_wp_error( $_menu ) )
</ins><span class="cx">                 $_menu = wp_create_nav_menu( $menu_data['menu-name'] );
</span><del>-        }
</del><span class="cx">
</span><del>-        if ( $_menu && isset( $_menu->term_id ) && ! is_wp_error( $_menu ) ) {
</del><ins>+        if ( is_wp_error( $_menu ) )
+                return $_menu;
+
+        if ( $_menu && isset( $_menu->term_id ) ) {
</ins><span class="cx">                 $args = array(
</span><span class="cx">                         'description' => ( isset( $menu_data['description'] ) ? $menu_data['description'] : '' ),
</span><span class="cx">                         'name' => ( isset( $menu_data['menu-name'] ) ? $menu_data['menu-name'] : '' ),
</span><span class="lines">@@ -167,9 +174,10 @@
</span><span class="cx">
</span><span class="cx">                 $update_response = wp_update_term( $menu_id, 'nav_menu', $args );
</span><span class="cx">
</span><del>-                if ( ! is_wp_error( $update_response ) ) {
</del><ins>+                if ( ! is_wp_error( $update_response ) )
</ins><span class="cx">                         return $menu_id;
</span><del>-                }
</del><ins>+                else
+                        return $update_response;
</ins><span class="cx">         } else {
</span><span class="cx">                 return 0;
</span><span class="cx">         }
</span><span class="lines">@@ -237,6 +245,32 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         
</span><ins>+        if ( 'custom' != $args['menu-item-type'] ) {
+                /* if non-custom menu item, then:
+                        * use original object's URL
+                        * blank default title to sync with original object's
+                */
+
+                $args['menu-item-url'] = '';
+
+                $original_title = '';
+                if ( 'taxonomy' == $args['menu-item-type'] ) {
+                        $original_title = get_term_field( 'name', $args['menu-item-object-id'], $args['menu-item-object'], 'raw' );
+                } elseif ( 'post_type' == $args['menu-item-type'] ) {
+                        $original_object = get_post( $args['menu-item-object-id'] );
+                        $original_title = $original_object->post_title;
+                }
+
+                if ( empty( $args['menu-item-title'] ) || $args['menu-item-title'] == $original_title ) {
+                        $args['menu-item-title'] = '';
+
+                        // hack to get wp to create a post object when too many properties are empty
+                        if ( empty( $args['menu-item-description'] ) ) {
+                                $args['menu-item-description'] = ' ';
+                        }
+                }
+        }
+
</ins><span class="cx">         // Populate the menu item object
</span><span class="cx">         $post = array(
</span><span class="cx">                 'menu_order' => $args['menu-item-position'],
</span><span class="lines">@@ -363,6 +397,12 @@
</span><span class="cx">
</span><span class="cx">                 $items = get_posts( $args );
</span><span class="cx">
</span><ins>+                if ( is_wp_error( $items ) || ! is_array( $items ) ) {
+                        return false;
+                }
+
+                $items = array_map( 'wp_setup_nav_menu_item', $items );
+
</ins><span class="cx">                 if ( ARRAY_A == $args['output'] ) {
</span><span class="cx">                         $GLOBALS['_menu_item_sort_prop'] = $args['output_key'];
</span><span class="cx">                         usort($items, '_sort_nav_menu_items');
</span><span class="lines">@@ -410,18 +450,25 @@
</span><span class="cx">                                 $object = get_post_type_object( $menu_item->object );
</span><span class="cx">                                 $menu_item->append = $object->singular_label;
</span><span class="cx">                                 $menu_item->url = get_permalink( $menu_item->object_id );
</span><ins>+                        
+                                $original_object = get_post( $menu_item->object_id );
+                                $original_title = $original_object->post_title;
+                                $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title;
</ins><span class="cx">
</span><span class="cx">                         } elseif ( 'taxonomy' == $menu_item->type ) {
</span><span class="cx">                                 $object = get_taxonomy( $menu_item->object );
</span><span class="cx">                                 $menu_item->append = $object->singular_label;
</span><span class="cx">                                 $menu_item->url = get_term_link( (int) $menu_item->object_id, $menu_item->object );
</span><span class="cx">
</span><ins>+                                $original_title = get_term_field( 'name', $menu_item->object_id, $menu_item->object, 'raw' );
+                                $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title;
+
</ins><span class="cx">                         } else {
</span><span class="cx">                                 $menu_item->append = __('Custom');
</span><ins>+                                $menu_item->title = $menu_item->post_title;
</ins><span class="cx">                                 $menu_item->url = get_post_meta( $menu_item->ID, '_menu_item_url', true );
</span><span class="cx">                         }
</span><span class="cx">                         
</span><del>-                        $menu_item->title = $menu_item->post_title;
</del><span class="cx">                         $menu_item->target = get_post_meta( $menu_item->ID, '_menu_item_target', true );
</span><span class="cx">
</span><span class="cx">                         $menu_item->attr_title = strip_tags( $menu_item->post_excerpt );
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (14282 => 14283)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-04-28 17:17:42 UTC (rev 14282)
+++ trunk/wp-includes/script-loader.php        2010-04-28 18:30:32 UTC (rev 14283)
</span><span class="lines">@@ -393,7 +393,7 @@
</span><span class="cx">                 ) );
</span><span class="cx">
</span><span class="cx">                 // Custom Navigation
</span><del>-                $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100426' );
</del><ins>+                $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100428' );
</ins><span class="cx">                 $scripts->localize( 'nav-menu', 'navMenuL10n', array(
</span><span class="cx">                         'custom' => _x('Custom', 'menu nav item type'),
</span><span class="cx">                         'thickbox' => _x('Edit Menu Item', 'Thickbox Title'),
</span></span></pre>
</div>
</div>
</body>
</html>