<!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>[13802] trunk: Various bug fixes and improvements to menu management.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13802">13802</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-03-22 19:56:16 +0000 (Mon, 22 Mar 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Various bug fixes and improvements to menu management. props ptahdunbar, see <a href="http://trac.wordpress.org/ticket/11817">#11817</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadmincssnavmenucss">trunk/wp-admin/css/nav-menu.css</a></li>
<li><a href="#trunkwpadmincssnavmenudevcss">trunk/wp-admin/css/nav-menu.dev.css</a></li>
<li><a href="#trunkwpadminincludesnavmenuphp">trunk/wp-admin/includes/nav-menu.php</a></li>
<li><a href="#trunkwpadminincludesupgradephp">trunk/wp-admin/includes/upgrade.php</a></li>
<li><a href="#trunkwpadminjsnavmenudevjs">trunk/wp-admin/js/nav-menu.dev.js</a></li>
<li><a href="#trunkwpadminjsnavmenujs">trunk/wp-admin/js/nav-menu.js</a></li>
<li><a href="#trunkwpadminnavmenusphp">trunk/wp-admin/nav-menus.php</a></li>
<li><a href="#trunkwpincludesclassesphp">trunk/wp-includes/classes.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="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
<li><a href="#trunkwpincludestaxonomyphp">trunk/wp-includes/taxonomy.php</a></li>
<li><a href="#trunkwpincludesversionphp">trunk/wp-includes/version.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-ajax.php (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-admin/admin-ajax.php        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -1004,7 +1004,7 @@
</span><span class="cx">                 update_user_option($user-&gt;ID, &quot;closedpostboxes_$page&quot;, $closed);
</span><span class="cx"> 
</span><span class="cx">         if ( is_array($hidden) ) {
</span><del>-                $hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv') ); // postboxes that are always shown
</del><ins>+                $hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv', 'manage-menu', 'create-menu') ); // postboxes that are always shown
</ins><span class="cx">                 update_user_option($user-&gt;ID, &quot;meta-box-hidden_$page&quot;, $hidden);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -1395,6 +1395,33 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         die( '0' );
</span><ins>+case 'save-custom-link':        
+        if ( ! current_user_can('manage_links') )
+                die('-1');
+        
+        $link_name = isset( $_POST['link_name'] ) ? esc_html($_POST['link_name']) : null;
+        $link_url = isset( $_POST['link_url'] ) ? esc_url_raw($_POST['link_url']) : null;
+        
+        if ( !$link_name || !$link_url )
+                die('-1');
+        
+        $post = array(
+                'post_status' =&gt; 'draft', 'post_type' =&gt; 'nav_menu_item', 'ping_status' =&gt; 0,
+                'post_author' =&gt; $user_ID, 'post_title' =&gt; $link_name, 'post_excerpt' =&gt; '',
+                'post_parent' =&gt; 0, 'menu_order' =&gt; 0, 'post_content' =&gt; '',
+        );
+        
+        $link_id = wp_insert_post( $post );
+        
+        update_post_meta( $link_id, '_menu_item_type', 'custom' );
+        update_post_meta( $link_id, '_menu_item_object_id', (int) $link_id );
+        update_post_meta( $link_id, '_menu_item_object', 'custom' );
+        update_post_meta( $link_id, '_menu_item_target', '_self' );
+        update_post_meta( $link_id, '_menu_item_classes', '' );
+        update_post_meta( $link_id, '_menu_item_xfn', '' );
+        update_post_meta( $link_id, '_menu_item_url', $link_url );
+        
+        die( json_encode($link_id) );
</ins><span class="cx"> default :
</span><span class="cx">         do_action( 'wp_ajax_' . $_POST['action'] );
</span><span class="cx">         die('0');
</span></span></pre></div>
<a id="trunkwpadmincssnavmenucss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/nav-menu.css (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/nav-menu.css        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-admin/css/nav-menu.css        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -1 +1 @@
</span><del>-#menu-management{clear:both;}#menu-management .inside{padding:0 10px;}#menu-container .submit{margin:0 0 10px;padding:0;}.submitdelete{font-size:11px;}#cancel-save{color:#f00;text-decoration:underline;font-size:11px;margin-left:20px;margin-top:5px;}#cancel-save:hover{background-color:#F00;color:#fff;}.button-controls{float:left;}.add-to-menu{float:right;}#manage-menu .inside{padding:0;}#create-menu-name{width:159px;}#available-links{margin:15px 0 0;}#available-links dt{display:block;}#add-custom-link .howto{font-size:11px;}#add-custom-link label span{display:block;float:left;margin-top:5px;padding-right:5px;}.menu-item-textbox{float:right;width:220px;}.howto span{margin-top:4px;display:block;float:left;}.show-all,.hide-all{cursor:pointer;}.hide-all{display:none;}.quick-search{width:190px;}.list-wrap{display:none;clear:both;}.list-container{max-height:200px;overflow-y:auto;padding:10px 10px 5px;border:1px solid #DFDFDF;-moz-border-radius:4px;}.postbox p.submit{margin-bottom:0;}.list li{display:none;margin:0;margin-bottom:5px;}.list li .menu-item-title{cursor:pointer;display:block;}.list li .menu-item-title input{margin-right:3px;margin-top:-3px;}.list li ul li .menu-item-title{margin-left:14px;}.list li ul li ul li .menu-item-title{margin-left:28px;}.list li ul li ul li ul li .menu-item-title{margin-left:42px;}.list li ul li ul li ul li ul li .menu-item-title{margin-left:56px;}.list li ul li ul li ul li ul li ul li .menu-item-title{margin-left:70px;}.list li ul li ul li ul li ul li ul li ul li .menu-item-title{margin-left:84px;}.list li ul li ul li ul li ul li ul li ul li ul li .menu-item-title{margin-left:98px;}.list li ul li ul li ul li ul li ul li ul li ul li ul li .menu-item-title{margin-left:112px;}#menu-container .inside{padding-bottom:10px;}.menu ul{width:100%;}.menu li{margin:0;}.menu li dl dt{-webkit-border-bottom-left-radius:6px;-webkit-border-bottom-right-radius:6px;-webkit-border-top-left-radius:6px;-webkit-border-top-right-radius:6px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;border-top-left-radius:6px;border-top-right-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-topleft:6px;-moz-border-radius-topright:6px;border:1px solid #E6E6E6;position:relative;padding-left:10px;background-color:#f1f1f1;height:35px;line-height:35px;}.menu li dl dt:hover{cursor:move;}.menu li ul li{margin-left:20px;opacity:.7;}.menu li ul li ul li{opacity:.9;}.menu li ul li ul li ul li{opacity:.9;}.menu li ul li ul li ul li ul li{opacity:.95;}.dropzone{height:7px;margin:3px 0 3px 0;}.ui-draggable-dragging{width:600px;}.item-type{text-transform:uppercase;font-size:11px;color:#999;padding-right:10px;}.item-controls{font-size:11px;position:absolute;right:15px;top:-1px;}.item-controls a{text-decoration:none;}.item-controls a:hover{cursor:pointer;}.item-controls .menu-item-delete:hover{color:#f00;}#menu-item-settings{display:none;}#cancel-save{cursor:pointer;}#cancel-save:hover{color:#fff!important;}#update-menu-item{color:#fff!important;}#update-menu-item:hover,#update-menu-item:active,#update-menu-item:focus{color:#eaf2fa!important;border-color:#13455b!important;}
</del><span class="cx">\ No newline at end of file
</span><ins>+#menu-management{clear:both;}#menu-management .inside{padding:0 10px;}#menu-container .submit{margin:0 0 10px;padding:0;}.submitdelete{font-size:11px;}#cancel-save{color:#f00;text-decoration:underline;font-size:11px;margin-left:20px;margin-top:5px;}#cancel-save:hover{background-color:#F00;color:#fff;}.list-controls{float:left;}.add-to-menu{float:right;}.button-controls{margin:10px 0;}.show-all,.hide-all{cursor:pointer;}.hide-all{display:none;}#create-menu-name{width:159px;}#manage-menu .inside{padding:0;}#available-links dt{display:block;}#add-custom-link .howto{font-size:11px;}#add-custom-link label span{display:block;float:left;margin-top:5px;padding-right:5px;}.menu-item-textbox{float:right;width:220px;}.howto span{margin-top:4px;display:block;float:left;}.quick-search{width:190px;}.list-wrap{display:none;clear:both;margin-bottom:10px;}.list-container{max-height:200px;overflow-y:auto;padding:10px 10px 5px;border:1px solid #DFDFDF;-moz-border-radius:4px;}.postbox p.submit{margin-bottom:0;}.list li{display:none;margin:0;margin-bottom:5px;}.list li .menu-item-title{cursor:pointer;display:block;}.list li .menu-item-title input{margin-right:3px;margin-top:-3px;}.list li ul li .menu-item-title{margin-left:14px;}.list li ul li ul li .menu-item-title{margin-left:28px;}.list li ul li ul li ul li .menu-item-title{margin-left:42px;}.list li ul li ul li ul li ul li .menu-item-title{margin-left:56px;}.list li ul li ul li ul li ul li ul li .menu-item-title{margin-left:70px;}.list li ul li ul li ul li ul li ul li ul li .menu-item-title{margin-left:84px;}.list li ul li ul li ul li ul li ul li ul li ul li .menu-item-title{margin-left:98px;}.list li ul li ul li ul li ul li ul li ul li ul li ul li .menu-item-title{margin-left:112px;}#menu-container .inside{padding-bottom:10px;}.menu ul{width:100%;}.menu li{margin:0;}.menu li dl dt{-webkit-border-radius:6px;border-radius:6px;-moz-border-radius:6px;border:1px solid #E6E6E6;position:relative;padding-left:10px;background-color:#f1f1f1;height:35px;line-height:35px;}.menu li dl dt:hover{cursor:move;}.menu li ul li{margin-left:20px;opacity:.7;}.menu li ul li ul li{opacity:.9;}.menu li ul li ul li ul li{opacity:.9;}.menu li ul li ul li ul li ul li{opacity:.95;}.dropzone{height:7px;margin:3px 0 3px 0;}.ui-draggable-dragging{width:600px;}.item-type{text-transform:uppercase;font-size:11px;color:#999;padding-right:10px;}.item-controls{font-size:11px;position:absolute;right:15px;top:-1px;}.item-controls a{text-decoration:none;}.item-controls a:hover{cursor:pointer;}.item-controls .menu-item-delete:hover{color:#f00;}#menu-item-settings{display:none;}#cancel-save{cursor:pointer;}#cancel-save:hover{color:#fff!important;}#update-menu-item{color:#fff!important;}#update-menu-item:hover,#update-menu-item:active,#update-menu-item:focus{color:#eaf2fa!important;border-color:#13455b!important;}.button-controls:after,#menu-item-url-wrap:after,#menu-item-name-wrap:after{content:&quot;.&quot;;display:block;height:0;clear:both;visibility:hidden;}.button-controls,#menu-item-url-wrap,#menu-item-name-wrap{display:block;}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadmincssnavmenudevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/nav-menu.dev.css (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/nav-menu.dev.css        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-admin/css/nav-menu.dev.css        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -20,28 +20,26 @@
</span><span class="cx"> #cancel-save:hover { background-color: #FF0000; color: #fff; }
</span><span class="cx"> 
</span><span class="cx"> /* Button Secondary Actions */
</span><del>-.button-controls { float: left; }
</del><ins>+.list-controls { float: left; }
</ins><span class="cx"> .add-to-menu { float: right; }
</span><ins>+.button-controls { margin: 10px 0; }
+.show-all, .hide-all { cursor: pointer; }
+.hide-all { display: none; }
</ins><span class="cx"> 
</span><del>-#manage-menu .inside { padding: 0px 0px; }
-
</del><span class="cx"> /* Create Menu */
</span><span class="cx"> #create-menu-name { width: 159px; }
</span><ins>+#manage-menu .inside { padding: 0px 0px; }
</ins><span class="cx"> 
</span><span class="cx"> /* Custom Links */
</span><del>-#available-links { margin: 15px 0px 0px; }
</del><span class="cx"> #available-links dt { display: block; }
</span><span class="cx"> #add-custom-link .howto { font-size: 11px; }
</span><span class="cx"> #add-custom-link label span { display: block; float: left; margin-top: 5px; padding-right: 5px; }
</span><span class="cx"> .menu-item-textbox { float: right; width: 220px; }
</span><span class="cx"> .howto span { margin-top: 4px; display: block; float: left; }
</span><span class="cx"> 
</span><del>-/* Pages/Categories */
-.show-all, .hide-all { cursor: pointer; }
-.hide-all { display: none; }
-
</del><ins>+/* Menu item types */
</ins><span class="cx"> .quick-search { width: 190px; }
</span><del>-.list-wrap { display: none; clear: both; }
</del><ins>+.list-wrap { display: none; clear: both; margin-bottom: 10px; }
</ins><span class="cx"> .list-container { max-height: 200px; overflow-y: auto; padding: 10px 10px 5px; border: 1px solid #DFDFDF; -moz-border-radius: 4px; }
</span><span class="cx"> .postbox p.submit { margin-bottom: 0; }
</span><span class="cx"> 
</span><span class="lines">@@ -60,12 +58,12 @@
</span><span class="cx"> .list li ul li ul li ul li ul li ul li ul li ul li .menu-item-title  { margin-left: 98px; }
</span><span class="cx"> .list li ul li ul li ul li ul li ul li ul li ul li ul li .menu-item-title  { margin-left: 112px; }
</span><span class="cx"> 
</span><del>-/* Menu */
</del><ins>+/* Nav Menu */
</ins><span class="cx"> #menu-container .inside { padding-bottom: 10px; }
</span><span class="cx"> 
</span><span class="cx"> .menu ul { width: 100%; }
</span><span class="cx"> .menu li { margin: 0; }
</span><del>-.menu li dl dt { -webkit-border-bottom-left-radius: 6px; -webkit-border-bottom-right-radius: 6px; -webkit-border-top-left-radius: 6px; -webkit-border-top-right-radius: 6px; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomleft: 6px; -moz-border-radius-bottomright: 6px; -moz-border-radius-topleft: 6px; -moz-border-radius-topright: 6px; border: 1px solid #E6E6E6;position: relative; padding-left:10px; background-color: #f1f1f1; height: 35px; line-height: 35px; }
</del><ins>+.menu li dl dt { -webkit-border-radius: 6px; border-radius: 6px; -moz-border-radius: 6px; border: 1px solid #E6E6E6; position: relative; padding-left: 10px; background-color: #f1f1f1; height: 35px; line-height: 35px; }
</ins><span class="cx"> .menu li dl dt:hover { cursor: move; }
</span><span class="cx"> 
</span><span class="cx"> .menu li .item-title { }
</span><span class="lines">@@ -78,7 +76,7 @@
</span><span class="cx"> .dropzone { height: 7px; margin: 3px 0 3px 0; }
</span><span class="cx"> .ui-draggable-dragging  { width: 600px; }
</span><span class="cx"> 
</span><del>-/* Menu Controls */
</del><ins>+/* Menu item controls */
</ins><span class="cx"> .item-type { text-transform: uppercase; font-size: 11px; color: #999999; padding-right: 10px; }
</span><span class="cx"> .item-controls { font-size: 11px; position: absolute; right: 15px; top: -1px; }
</span><span class="cx"> .item-controls a { text-decoration: none; }
</span><span class="lines">@@ -92,4 +90,8 @@
</span><span class="cx"> #update-menu-item { color: #fff !important; }
</span><span class="cx"> #update-menu-item:hover,
</span><span class="cx"> #update-menu-item:active,
</span><del>-#update-menu-item:focus { color: #eaf2fa !important; border-color: #13455b !important; }
</del><span class="cx">\ No newline at end of file
</span><ins>+#update-menu-item:focus { color: #eaf2fa !important; border-color: #13455b !important; }
+
+/* Clearfix */
+.button-controls:after, #menu-item-url-wrap:after, #menu-item-name-wrap:after { content: &quot;.&quot;; display: block; height: 0; clear: both; visibility: hidden; }
+.button-controls, #menu-item-url-wrap, #menu-item-name-wrap { display: block; }
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/nav-menu.php (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/nav-menu.php        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-admin/includes/nav-menu.php        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -1,10 +1,46 @@
</span><span class="cx"> &lt;?php
</span><ins>+/**
+ * Register nav menu metaboxes
+ *
+ * @since 3.0.0
+ **/
+function wp_nav_menu_metaboxes_setup() {
+        add_meta_box( 'add-custom-links', __('Add Custom Links'), 'wp_nav_menu_item_link_metabox', 'nav-menus', 'side', 'default' );
+        wp_nav_menu_post_type_metaboxes();
+        wp_nav_menu_taxonomy_metaboxes();
+}
</ins><span class="cx"> 
</span><del>-/* Register Metaboxes */
-add_meta_box( 'create-menu', __('Create Menu'), 'wp_nav_menu_create_metabox', 'menus', 'side', 'core' );
-add_meta_box( 'add-custom-links', __('Add Custom Links'), 'wp_nav_menu_item_link_metabox', 'menus', 'side', 'default' );
-wp_nav_menu_post_type_metaboxes();
-wp_nav_menu_taxonomy_metaboxes();
</del><ins>+/**
+ * Limit the amount of meta boxes to just links, pages and cats for first time users.
+ *
+ * @since 3.0.0
+ **/
+function wp_initial_nav_menu_meta_boxes() {
+        global $wp_meta_boxes;
+        
+        if ( !get_user_option( 'meta-box-hidden_nav-menus' ) &amp;&amp; is_array($wp_meta_boxes) ) {
+                
+                $initial_meta_boxes = array( 'manage-menu', 'create-menu', 'add-custom-links', 'add-page', 'add-category' );
+                $hidden_meta_boxes = array();
+                
+                foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) {
+                        foreach ( array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority ) {
+                                foreach ( $wp_meta_boxes['nav-menus'][$context][$priority] as $box ) {
+                                        if ( in_array( $box['id'], $initial_meta_boxes ) ) {
+                                                unset( $box['id'] );
+                                        } else {
+                                                $hidden_meta_boxes[] = $box['id'];
+                                        }
+                                }
+                        }
+                }
+                $user = wp_get_current_user();
+                update_user_meta( $user-&gt;ID, 'meta-box-hidden_nav-menus', $hidden_meta_boxes );
+                
+                // returns all the hidden metaboxes to the js function: wpNavMenu.initial_meta_boxes()
+                return join( ',', $hidden_meta_boxes );
+        }
+}
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Creates metaboxes for any post type menu item.
</span><span class="lines">@@ -15,15 +51,11 @@
</span><span class="cx">         $post_types = get_post_types( array( 'public' =&gt; true ), 'object' );
</span><span class="cx"> 
</span><span class="cx">         if ( !$post_types )
</span><del>-                return false;
</del><ins>+                return;
</ins><span class="cx"> 
</span><del>-        $allowed_types = apply_filters('post_types_allowed_in_menus', array('page'));
</del><span class="cx">         foreach ( $post_types as $post_type ) {
</span><del>-                if ( !in_array($post_type-&gt;name, $allowed_types) )
-                        continue;
</del><span class="cx">                 $id = $post_type-&gt;name;
</span><del>-
-                add_meta_box( &quot;add-{$id}&quot;, sprintf( __('Add an Existing %s'), $post_type-&gt;singular_label ), 'wp_nav_menu_item_post_type_metabox', 'menus', 'side', 'default', $post_type );
</del><ins>+                add_meta_box( &quot;add-{$id}&quot;, sprintf( __('Add an Existing %s'), $post_type-&gt;singular_label ), 'wp_nav_menu_item_post_type_metabox', 'nav-menus', 'side', 'default', $post_type );
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -36,15 +68,12 @@
</span><span class="cx">         $taxonomies = get_taxonomies( array( 'show_ui' =&gt; true ), 'object' );
</span><span class="cx"> 
</span><span class="cx">         if ( !$taxonomies )
</span><del>-                return false;
</del><ins>+                return;
</ins><span class="cx"> 
</span><del>-        $allowed_types = apply_filters('taxonomies_allowed_in_menus', array('category'));
</del><span class="cx">         foreach ( $taxonomies as $tax ) {
</span><del>-                if ( !in_array($tax-&gt;name, $allowed_types) )
-                        continue;
</del><span class="cx">                 $id = $tax-&gt;name;
</span><span class="cx"> 
</span><del>-                add_meta_box( &quot;add-{$id}&quot;, sprintf( __('Add an Existing %s'), $tax-&gt;singular_label ), 'wp_nav_menu_item_taxonomy_metabox', 'menus', 'side', 'default', $tax );
</del><ins>+                add_meta_box( &quot;add-{$id}&quot;, sprintf( __('Add an Existing %s'), $tax-&gt;singular_label ), 'wp_nav_menu_item_taxonomy_metabox', 'nav-menus', 'side', 'default', $tax );
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -98,11 +127,11 @@
</span><span class="cx">  * @since 3.0.0
</span><span class="cx">  */
</span><span class="cx"> function wp_nav_menu_item_link_metabox() {
</span><del>-        $args = array( 'post_status' =&gt; 'any', 'post_type' =&gt; 'nav_menu_item', 'meta_value' =&gt; 'custom', 'showposts' =&gt; -1 );
</del><ins>+        // @note: hacky query, see #12660
+        $args = array( 'post_type' =&gt; 'nav_menu_item', 'post_status' =&gt; 'any', 'meta_key' =&gt; '_menu_item_type', 'numberposts' =&gt; -1, 'orderby' =&gt; 'title', );
</ins><span class="cx"> 
</span><span class="cx">         // @todo transient caching of these results with proper invalidation on updating links
</span><del>-        $query = new WP_Query( $args );
-
</del><ins>+        $links = get_posts( $args );
</ins><span class="cx">         ?&gt;
</span><span class="cx">         &lt;p id=&quot;menu-item-url-wrap&quot;&gt;
</span><span class="cx">                 &lt;label class=&quot;howto&quot; for=&quot;menu-item-url&quot;&gt;
</span><span class="lines">@@ -110,7 +139,6 @@
</span><span class="cx">                         &lt;input id=&quot;custom-menu-item-url&quot; name=&quot;custom-menu-item-url&quot; type=&quot;text&quot; class=&quot;code menu-item-textbox&quot; value=&quot;http://&quot; /&gt;
</span><span class="cx">                 &lt;/label&gt;
</span><span class="cx">         &lt;/p&gt;
</span><del>-        &lt;br class=&quot;clear&quot; /&gt;
</del><span class="cx">         &lt;p id=&quot;menu-item-name-wrap&quot;&gt;
</span><span class="cx">                 &lt;label class=&quot;howto&quot; for=&quot;custom-menu-item-name&quot;&gt;
</span><span class="cx">                         &lt;span&gt;&lt;?php _e('Text'); ?&gt;&lt;/span&gt;
</span><span class="lines">@@ -119,19 +147,22 @@
</span><span class="cx">         &lt;/p&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;p class=&quot;button-controls&quot;&gt;
</span><del>-                &lt;a class=&quot;show-all&quot;&gt;&lt;?php _e('View All'); ?&gt;&lt;/a&gt;
-                &lt;a class=&quot;hide-all&quot;&gt;&lt;?php _e('Hide All'); ?&gt;&lt;/a&gt;
</del><ins>+                &lt;span class=&quot;lists-controls&quot;&gt;
+                        &lt;a class=&quot;show-all&quot;&gt;&lt;?php _e('View All'); ?&gt;&lt;/a&gt;
+                        &lt;a class=&quot;hide-all&quot;&gt;&lt;?php _e('Hide All'); ?&gt;&lt;/a&gt;
+                &lt;/span&gt;
+                
+                &lt;span class=&quot;add-to-menu&quot;&gt;
+                        &lt;a class=&quot;button&quot;&gt;&lt;?php _e('Add to Menu'); ?&gt;&lt;/a&gt;
+                &lt;/span&gt;
</ins><span class="cx">         &lt;/p&gt;
</span><span class="cx">         &lt;div id=&quot;available-links&quot; class=&quot;list-wrap&quot;&gt;
</span><span class="cx">                 &lt;div class=&quot;list-container&quot;&gt;
</span><span class="cx">                         &lt;ul class=&quot;list&quot;&gt;
</span><del>-                                &lt;?php echo wp_nav_menu_get_items( $query-&gt;posts, 'custom' ); ?&gt;
</del><ins>+                                &lt;?php echo wp_nav_menu_get_items( $links, 'custom', 'custom' ); ?&gt;
</ins><span class="cx">                         &lt;/ul&gt;
</span><span class="cx">                 &lt;/div&gt;&lt;!-- /.list-container--&gt;
</span><span class="cx">         &lt;/div&gt;&lt;!-- /#available-links--&gt;
</span><del>-        &lt;p class=&quot;add-to-menu&quot;&gt;
-                &lt;a class=&quot;button&quot;&gt;&lt;?php _e('Add to Menu'); ?&gt;&lt;/a&gt;
-        &lt;/p&gt;
</del><span class="cx">         &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
</span><span class="cx">         &lt;?php
</span><span class="cx"> }
</span><span class="lines">@@ -145,24 +176,19 @@
</span><span class="cx">  * @param string $post_type The post type object.
</span><span class="cx">  */
</span><span class="cx"> function wp_nav_menu_item_post_type_metabox( $object, $post_type ) {
</span><del>-        $args = array( 'post_type' =&gt; $post_type['args']-&gt;name, 'post_status' =&gt; 'publish', 'showposts' =&gt; -1 );
</del><ins>+        $args = array( 'post_type' =&gt; $post_type['args']-&gt;name, 'numberposts' =&gt; -1, 'orderby' =&gt; 'title', );
</ins><span class="cx"> 
</span><del>-        if ( 'attachment' == $post_type['args']-&gt;name )
-                $args['post_status'] = 'any';
-
</del><span class="cx">         // @todo transient caching of these results with proper invalidation on updating of a post of this type
</span><del>-        $query = new WP_Query( $args );
</del><ins>+        $posts = get_posts( $args );
</ins><span class="cx"> 
</span><del>-        if ( !$query-&gt;posts )
</del><ins>+        if ( !$posts )
</ins><span class="cx">                 $error = '&lt;li id=&quot;error&quot;&gt;'. sprintf( __( 'No %s exists' ), $post_type['args']-&gt;label ) .'&lt;/li&gt;';
</span><span class="cx"> 
</span><span class="cx">         $pt_names = '';
</span><del>-        if ( is_array($query-&gt;posts) ) {
-                foreach ( $query-&gt;posts as $post ) {
</del><ins>+        if ( is_array($posts) ) {
+                foreach ( $posts as $post ) {
</ins><span class="cx">                         if ( $post-&gt;post_title ) {
</span><span class="cx">                                 $pt_names .= htmlentities( $post-&gt;post_title ) .'|';
</span><del>-                        } else {
-                                $pt_names = sprintf( __('No %s exists'), $post_type['args']-&gt;label );
</del><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -175,26 +201,29 @@
</span><span class="cx">         &lt;/p&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;p class=&quot;button-controls&quot;&gt;
</span><del>-                &lt;a class=&quot;show-all&quot;&gt;&lt;?php _e('View All'); ?&gt;&lt;/a&gt;
-                &lt;a class=&quot;hide-all&quot;&gt;&lt;?php _e('Hide All'); ?&gt;&lt;/a&gt;
</del><ins>+                &lt;span class=&quot;lists-controls&quot;&gt;
+                        &lt;a class=&quot;show-all&quot;&gt;&lt;?php _e('View All'); ?&gt;&lt;/a&gt;
+                        &lt;a class=&quot;hide-all&quot;&gt;&lt;?php _e('Hide All'); ?&gt;&lt;/a&gt;
+                &lt;/span&gt;
+                
+                &lt;span class=&quot;add-to-menu&quot;&gt;
+                        &lt;a class=&quot;button&quot;&gt;&lt;?php _e('Add to Menu'); ?&gt;&lt;/a&gt;
+                &lt;/span&gt;
</ins><span class="cx">         &lt;/p&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;div id=&quot;existing-&lt;?php echo esc_attr( $id ); ?&gt;&quot; class=&quot;list-wrap&quot;&gt;
</span><span class="cx">                 &lt;div class=&quot;list-container&quot;&gt;
</span><span class="cx">                         &lt;ul class=&quot;list&quot;&gt;
</span><del>-                                &lt;?php echo isset( $error ) ? $error : wp_nav_menu_get_items( $query-&gt;posts, 'post_type', $id ); ?&gt;
</del><ins>+                                &lt;?php echo isset( $error ) ? $error : wp_nav_menu_get_items( $posts, 'post_type', $id ); ?&gt;
</ins><span class="cx">                         &lt;/ul&gt;
</span><span class="cx">                 &lt;/div&gt;&lt;!-- /.list-container--&gt;
</span><span class="cx">         &lt;/div&gt;&lt;!-- /#existing-categories--&gt;
</span><del>-        &lt;p class=&quot;add-to-menu&quot;&gt;
-                &lt;a class=&quot;button-secondary&quot;&gt;&lt;?php _e('Add to Menu'); ?&gt;&lt;/a&gt;
-        &lt;/p&gt;
</del><span class="cx">         &lt;input type=&quot;hidden&quot; class=&quot;autocomplete&quot; name=&quot;autocomplete-&lt;?php echo esc_attr( $id ); ?&gt;-names&quot; value=&quot;&lt;?php echo esc_js( $pt_names ); ?&gt;&quot; /&gt;
</span><span class="cx">         &lt;br class=&quot;clear&quot; /&gt;
</span><span class="cx">         &lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;
</span><span class="cx">                 // &lt;![CDATA[
</span><span class="cx">                 jQuery(document).ready(function(){
</span><del>-                        wp_nav_menu_autocomplete('&lt;?php echo esc_attr($id); ?&gt;');
</del><ins>+                        wpNavMenu.autocomplete('&lt;?php echo esc_attr($id); ?&gt;');
</ins><span class="cx">                 });
</span><span class="cx">                 // ]]&gt;
</span><span class="cx">         &lt;/script&gt;
</span><span class="lines">@@ -227,8 +256,6 @@
</span><span class="cx">                 foreach ( $terms as $term ) {
</span><span class="cx">                         if ( $term-&gt;name ) {
</span><span class="cx">                                 $term_names .= htmlentities( $term-&gt;name ) .'|';
</span><del>-                        } else {
-                                $term_names = sprintf( __('No %s exists'), $taxonomy['args']-&gt;label );
</del><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -241,8 +268,14 @@
</span><span class="cx">         &lt;/p&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;p class=&quot;button-controls&quot;&gt;
</span><del>-                &lt;a class=&quot;show-all&quot;&gt;&lt;?php _e('View All'); ?&gt;&lt;/a&gt;
-                &lt;a class=&quot;hide-all&quot;&gt;&lt;?php _e('Hide All'); ?&gt;&lt;/a&gt;
</del><ins>+                &lt;span class=&quot;lists-controls&quot;&gt;
+                        &lt;a class=&quot;show-all&quot;&gt;&lt;?php _e('View All'); ?&gt;&lt;/a&gt;
+                        &lt;a class=&quot;hide-all&quot;&gt;&lt;?php _e('Hide All'); ?&gt;&lt;/a&gt;
+                &lt;/span&gt;
+                
+                &lt;span class=&quot;add-to-menu&quot;&gt;
+                        &lt;a class=&quot;button&quot;&gt;&lt;?php _e('Add to Menu'); ?&gt;&lt;/a&gt;
+                &lt;/span&gt;
</ins><span class="cx">         &lt;/p&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;div id=&quot;existing-&lt;?php echo esc_attr( $id ); ?&gt;&quot; class=&quot;list-wrap&quot;&gt;
</span><span class="lines">@@ -252,15 +285,12 @@
</span><span class="cx">                         &lt;/ul&gt;
</span><span class="cx">                 &lt;/div&gt;&lt;!-- /.list-container--&gt;
</span><span class="cx">         &lt;/div&gt;&lt;!-- /#existing-categories--&gt;
</span><del>-        &lt;p class=&quot;add-to-menu&quot;&gt;
-                &lt;a class=&quot;button-secondary&quot;&gt;&lt;?php _e('Add to Menu'); ?&gt;&lt;/a&gt;
-        &lt;/p&gt;
</del><span class="cx">         &lt;input type=&quot;hidden&quot; class=&quot;autocomplete&quot; name=&quot;autocomplete-&lt;?php echo esc_attr($id); ?&gt;-names&quot; value=&quot;&lt;?php echo esc_js( $term_names ); ?&gt;&quot; /&gt;
</span><span class="cx">         &lt;br class=&quot;clear&quot; /&gt;
</span><span class="cx">         &lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;
</span><span class="cx">                 // &lt;![CDATA[
</span><span class="cx">                 jQuery(document).ready(function(){
</span><del>-                        wp_nav_menu_autocomplete('&lt;?php echo esc_attr($id); ?&gt;');
</del><ins>+                        wpNavMenu.autocomplete('&lt;?php echo esc_attr($id); ?&gt;');
</ins><span class="cx">                 });
</span><span class="cx">                 // ]]&gt;
</span><span class="cx">         &lt;/script&gt;
</span><span class="lines">@@ -290,15 +320,20 @@
</span><span class="cx">                 if ( !isset($menu_item-&gt;post_parent) )
</span><span class="cx">                         $menu_item-&gt;post_parent = $menu_item-&gt;parent;
</span><span class="cx"> 
</span><del>-                // Cleanest way to get all attachements
-                if ( 'attachment' == $object )
</del><ins>+                // Get all attachements and links
+                if ( in_array($object, array( 'attachment', 'custom' )) )
</ins><span class="cx">                         $menu_item-&gt;post_parent = 0;
</span><span class="cx"> 
</span><span class="cx">                 if ( 0 == $menu_item-&gt;post_parent ) {
</span><span class="cx">                         // Set up the menu item
</span><span class="cx">                         $menu_item = wp_setup_nav_menu_item( $menu_item, $object_type, $object );
</span><ins>+                        
+                        // No blank titles
+                        if ( empty($menu_item-&gt;title) )
+                                continue;
+                        
</ins><span class="cx">                         $attributes = ( 'backend' == $context ) ? ' id=&quot;menu-item-'. $i .'&quot; value=&quot;'. $i .'&quot;' : '';
</span><del>-
</del><ins>+                        
</ins><span class="cx">                         $output .= '&lt;li'. $attributes .'&gt;';
</span><span class="cx">                         $output .= wp_get_nav_menu_item( $menu_item, $object_type, $object );
</span><span class="cx">                         $output .= wp_get_nav_menu_sub_items( $menu_item-&gt;ID, $object_type, $object, $context );
</span></span></pre></div>
<a id="trunkwpadminincludesupgradephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/upgrade.php (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/upgrade.php        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-admin/includes/upgrade.php        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -1105,13 +1105,26 @@
</span><span class="cx">  * @since 3.0.0
</span><span class="cx">  */
</span><span class="cx"> function upgrade_300() {
</span><del>-        global $wp_current_db_version;
</del><ins>+        global $wp_current_db_version, $wpdb;
</ins><span class="cx"> 
</span><span class="cx">         if ( $wp_current_db_version &lt; 12751 ) {
</span><span class="cx">                 populate_roles_300();
</span><span class="cx">                 if ( is_multisite() &amp;&amp; is_main_site() &amp;&amp; ! defined( 'MULTISITE' ) &amp;&amp; get_site_option( 'siteurl' ) === false )
</span><span class="cx">                         add_site_option( 'siteurl', '' );
</span><span class="cx">         }
</span><ins>+
+        // 3.0-alpha nav menu postmeta changes. can be removed before release
+        if ( $wp_current_db_version &gt;= 13226 &amp;&amp; $wp_current_db_version &lt; 13802 ) {
+                // remove old nav menu post meta keys
+                $wpdb-&gt;query( &quot;DELETE FROM $wpdb-&gt;postmeta WHERE meta_key IN( 'menu_type', 'object_id', 'menu_new_window', 'menu_link', '_menu_item_append', 'menu_item_append' )&quot; );
+                // update nav menu post meta keys to underscore prefixes
+                $wpdb-&gt;update( $wpdb-&gt;postmeta, array( 'meta_key' =&gt; '_menu_item_type' ), array( 'meta_key' =&gt; 'menu_item_type' ) );
+                $wpdb-&gt;update( $wpdb-&gt;postmeta, array( 'meta_key' =&gt; '_menu_item_object_id' ), array( 'meta_key' =&gt; 'menu_item_object_id' ) );
+                $wpdb-&gt;update( $wpdb-&gt;postmeta, array( 'meta_key' =&gt; '_menu_item_target' ), array( 'meta_key' =&gt; 'menu_item_target' ) );
+                $wpdb-&gt;update( $wpdb-&gt;postmeta, array( 'meta_key' =&gt; '_menu_item_classes' ), array( 'meta_key' =&gt; 'menu_item_classes' ) );
+                $wpdb-&gt;update( $wpdb-&gt;postmeta, array( 'meta_key' =&gt; '_menu_item_xfn' ), array( 'meta_key' =&gt; 'menu_item_xfn' ) );
+                $wpdb-&gt;update( $wpdb-&gt;postmeta, array( 'meta_key' =&gt; '_menu_item_url' ), array( 'meta_key' =&gt; 'menu_item_url' ) );
+        }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.dev.js (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.dev.js        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-admin/js/nav-menu.dev.js        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -1,489 +1,491 @@
</span><span class="cx"> /**
</span><del>- * WordPress Administration Custom Navigation
</del><ins>+ * WordPress Administration Navigation Menu
</ins><span class="cx">  * Interface JS functions
</span><span class="cx">  *
</span><del>- * @version 1.1.0
</del><ins>+ * @version 2.0.0
</ins><span class="cx">  *
</span><span class="cx">  * @package WordPress
</span><span class="cx">  * @subpackage Administration
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-function wp_nav_menu_autocomplete( id ) {
-        jQuery('#add-'+ id +' .quick-search').autocomplete(jQuery( '#add-'+ id +' .autocomplete' ).val().split('|'));
</del><ins>+var wpNavMenu;
</ins><span class="cx"> 
</span><del>-        jQuery('#add-'+ id +' .quick-search').result(function(event, data, formatted) {
-                jQuery('#add-'+ id +' .list-wrap').css( 'display', 'block' );
-                jQuery(&quot;#add-&quot;+ id +&quot; .list-wrap li:contains('&quot; + data + &quot;')&quot;).css( 'display', 'block' );
-                jQuery('#add-'+ id +' .show-all').hide();
-                jQuery('#add-'+ id +' .hide-all').show();
-        });
-}
</del><ins>+(function($) {
+        
+        wpNavMenu = {
+                
+                // Functions that run on init.
+                init : function() {
+                        
+                        wpNavMenu.initial_meta_boxes();
+                        
+                        wpNavMenu.drag_and_drop();
+                        
+                        // Delete AYS
+                        $('#update-nav-menu .deletion').click(function(){
+                                if ( confirm( navMenuL10n.warnDelete ) ) {
+                                        return true;
+                                } else {
+                                        return false;
+                                };
+                        });
</ins><span class="cx"> 
</span><del>-/**
- * Populate the thickbox window with the selected menu items
- *
- * @param int id - the id of the menu li to edit.
- */
-function wp_edit_menu_item( id ) {
-        var item_type = jQuery('#menu-item-type' + id).val();
-        var item_title = jQuery('#menu-item-title' + id).val();
-        var item_link = jQuery('#menu-item-url' + id).val();
-        var item_attr_title = jQuery('#menu-item-attr-title' + id).val();
-        var item_target = jQuery('#menu-item-target' + id).val();
-        var item_description = jQuery('#menu-item-description' + id).val();
-        var item_classes = jQuery('#menu-item-classes' + id).val();
-        var item_xfn = jQuery('#menu-item-xfn' + id).val();
</del><ins>+                        // Handle Save Button Clicks
+                        $('#update-nav-menu').submit(function(){
+                                wpNavMenu.update_post_data();
+                        });
</ins><span class="cx"> 
</span><del>-        // Only allow custom links to be editable.
-        if ( 'custom' != item_type )
-                jQuery( '#edit-menu-item-url' ).attr('disabled', 'disabled' );
</del><ins>+                        // Handle some return keypresses
+                        $('#create-menu-name').keypress(function(e){
+                                if ( 13 == e.keyCode ) {
+                                        $('#create-menu-button').click();
+                                        return false;
+                                }
+                        });
</ins><span class="cx"> 
</span><del>-        // Populate the fields for thickbox
-        jQuery( '#edit-menu-item-id' ).val(id);
-        jQuery( '#edit-menu-item-title' ).val(item_title);
-        jQuery( '#edit-menu-item-url' ).val(item_link);
-        jQuery( '#edit-menu-item-attr-title' ).val(item_attr_title);
-        jQuery( '#edit-menu-item-target' ).val(item_target);
-        jQuery( &quot;#edit-menu-item-target option[value='&quot; + item_target  + &quot;']&quot; ).attr('selected', 'selected');
-        jQuery( '#edit-menu-item-description' ).val(item_description);
-        jQuery( '#edit-menu-item-classes' ).val(item_classes);
-        jQuery( '#edit-menu-item-xfn' ).val(item_xfn);
</del><ins>+                        $('#custom-menu-item-url, #custom-menu-item-name').keypress(function(e){
+                                if ( 13 == e.keyCode ) {
+                                        $('#add-custom-links a.button').click();
+                                        return false;
+                                }
+                        }).focus(function(){
+                                if ( $(this).val() == $(this).attr('defaultValue') &amp;&amp; $(this).attr('id') != 'custom-menu-item-url' ) {
+                                        $(this).val('');
+                                }
+                        }).blur(function(){
+                                if ( $(this).val() == '' ) {
+                                        $(this).val($(this).attr('defaultValue'));
+                                }
+                        });
</ins><span class="cx"> 
</span><del>-        // focus
-        jQuery( '#edit-menu-item-title' ).focus();
-};
</del><ins>+                        $('#create-menu-name').focus(function(){
+                                if ( $(this).val() == $(this).attr('defaultValue') ) {
+                                        $(this).val('');
+                                }
+                        }).blur(function(){
+                                if ( $(this).val() == '' ) {
+                                        $(this).val($(this).attr('defaultValue'));
+                                }
+                        });
</ins><span class="cx"> 
</span><del>-/**
- * Update the values for the menu item being editing
- */
-function wp_update_menu_item() {
-        var id = jQuery('#edit-menu-item-id').val();
-        var item_title = jQuery('#edit-menu-item-title').val();
-        var item_link = jQuery('#edit-menu-item-url').val();
-        var item_attr_title = jQuery('#edit-menu-item-attr-title').val();
-        var item_target = jQuery('#edit-menu-item-target').val();
-        var item_description = jQuery('#edit-menu-item-description').val();
-        var item_classes = jQuery('#edit-menu-item-classes').val();
-        var item_xfn = jQuery('#edit-menu-item-xfn').val();
</del><ins>+                        // close postboxes that should be closed
+                        $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
</ins><span class="cx"> 
</span><del>-        // update menu item settings
-        jQuery('.menu #menu-item' + id).find('span.item-title').html(item_title);
-        jQuery('.menu #menu-item-title' + id).val(item_title);
-        jQuery('.menu #menu-item-url' + id).val(item_link);
-        jQuery('.menu #menu-item-attr-title' + id).val(item_attr_title);
-        jQuery('.menu #menu-item-target' + id).val(item_target);
-        jQuery('.menu #menu-item-description' + id).val(item_description);
-        jQuery('.menu #menu-item-classes' + id).val(item_classes);
-        jQuery('.menu #menu-item-xfn' + id).val(item_xfn);
</del><ins>+                        // postboxes setup
+                        postboxes.add_postbox_toggles('nav-menus');
</ins><span class="cx"> 
</span><del>-        jQuery('.menu #menu-item' + id + ' dt:first').animate( { backgroundColor: '#FFFF33' }, { duration: 'normal', complete: function() { jQuery(this).css( 'backgroundColor', '' ); }});
-}
</del><ins>+                        // Clear the quick search textbox
+                        $('.quick-search').click(function(){
+                                $(this).attr( 'value', '' );
+                        });
</ins><span class="cx"> 
</span><del>-/**
- * Removes a menu item from current menu
- *
- * @param int o - the id of the menu li to remove.
- */
-function wp_remove_menu_item( o ) {
-        var todelete = document.getElementById('menu-item' + o);
</del><ins>+                        // Quick Search submit
+                        $('.quick-search-submit').click(function(){
+                                $(this).siblings('.quick-search').search();
+                        });
</ins><span class="cx"> 
</span><del>-        if ( todelete ) {
-                // Give some feedback to the user
-                jQuery( todelete ).find('dt').each(function(){
-                        jQuery(this).animate( { backgroundColor: '#FF3333' }, { duration: 'normal', complete: function() { jQuery(this).parent().parent().remove() } } );
-                });
-        }
-};
</del><ins>+                        // Edit menu item
+                        $('#menu-container .item-edit').click(function(){
+                                wpNavMenu.edit_menu_item( $(this).attr('value') );
+                        });
</ins><span class="cx"> 
</span><del>-/**
- * Adds the item to the menu
- *
- * @param string item_db_id - The menu item's db id.
- * @param string item_object_id - The menu item's object id.
- * @param string item_type - The menu item's object type.
- * @param string item_append - The menu item's nice name.
- * @param string item_parent_id - The menu item's parent id.
- * @param string item_title - The menu item title.
- * @param string item_url - The menu item url
- * @param string item_description - The menu item description.
- * @param string item_attr_title - The title attribute.
- * @param string item_target - The target attribute.
- * @param string item_classes - Optional. Additional CSS classes for the menu item
- * @param string item_xfn - Optional. The rel attribute.
- */
-function wp_add_item_to_menu( item_db_id, item_object_id, item_type, item_append, item_parent_id, item_title, item_url, item_description, item_attr_title, item_target, item_classes, item_xfn ) {
-        var randomnumber = wp_get_unique_menu_id();
-        var hidden = wp_get_hidden_inputs( randomnumber, item_db_id, item_object_id, item_type, item_append, item_parent_id, item_title, item_url, item_description, item_attr_title, item_target, item_classes, item_xfn );
</del><ins>+                        // Delete menu item
+                        $('#menu-container .item-delete').click(function(){
+                                wpNavMenu.remove_menu_item( $(this).attr('value') );
+                        });
</ins><span class="cx"> 
</span><del>-        // Adds the item in the queue
-        jQuery('.menu').append('&lt;li id=&quot;menu-item' + randomnumber + '&quot; value=&quot;' + randomnumber + '&quot;&gt;&lt;div class=&quot;dropzone ui-droppable&quot;&gt;&lt;/div&gt;&lt;dl class=&quot;ui-droppable&quot;&gt;&lt;dt&gt;&lt;span class=&quot;item-title&quot;&gt;' + item_title + '&lt;/span&gt;&lt;span class=&quot;item-controls&quot;&gt;&lt;span class=&quot;item-type&quot;&gt;' + item_append + '&lt;/span&gt;&lt;a class=&quot;item-edit thickbox&quot; id=&quot;edit' + randomnumber + '&quot; value=&quot;' + randomnumber +'&quot; onClick=&quot;wp_edit_menu_item('+ randomnumber +')&quot; title=&quot;' + navMenuL10n.thickbox + '&quot; href=&quot;#TB_inline?height=540&amp;width=300&amp;inlineId=menu-item-settings&quot;&gt;' + navMenuL10n.edit + '&lt;/a&gt; | &lt;a class=&quot;item-delete&quot; id=&quot;delete' + randomnumber + '&quot; value=&quot;' + randomnumber +'&quot;&gt;Delete&lt;/a&gt;&lt;/span&gt;&lt;/dt&gt;&lt;/dl&gt;' + hidden + '&lt;/li&gt;');
</del><ins>+                        // Update menu item settings (thickbox)
+                        $('#update-menu-item').click(function(){
+                                wpNavMenu.update_menu_item();
+                                tb_remove();
+                        });
</ins><span class="cx"> 
</span><del>-        // Give some feedback to the user
-        jQuery( '.menu #menu-item' + randomnumber + ' dt:first' ).animate( { backgroundColor: '#FFFF33' }, { duration: 'normal', complete: function() { jQuery(this).css( 'backgroundColor', '' ); }});
</del><ins>+                        // Close thickbox
+                        $('#cancel-save').click(function(){
+                                tb_remove();
+                        });
</ins><span class="cx"> 
</span><del>-        // Enable drag-n-drop
-        wp_drag_and_drop();
</del><ins>+                        // Show All Button
+                        $('.show-all').click(function(e){
+                                $(e.currentTarget).parent().parent().siblings('.list-wrap').css( 'display', 'block' );
+                                $(e.currentTarget).parent().parent().siblings('.list-wrap').find('li').css( 'display', 'block' );
+                                $(e.currentTarget).hide();
+                                $(e.currentTarget).siblings('.hide-all').show();
+                        });
</ins><span class="cx"> 
</span><del>-        // Reload thickbox
-        tb_init('a.thickbox, area.thickbox, input.thickbox');
-};
</del><ins>+                        // Hide All Button
+                        $('.hide-all').click(function(e){
+                                $(e.currentTarget).parent().parent().siblings('.list-wrap').css( 'display', 'none' );
+                                $(e.currentTarget).parent().parent().siblings('.list-wrap').find('li').css( 'display', 'none' );
+                                $(e.currentTarget).hide();
+                                $(e.currentTarget).siblings('.show-all').show();
+                        });
</ins><span class="cx"> 
</span><del>-/**
- * Grabs items from the queue and adds them to the menu.
- *
- * @param string button - a reference to the button that was clicked
- */
-function wp_add_checked_items_to_menu( button ) {
-        // Grab checked items
-        var items = jQuery(button).siblings('.list-wrap').find(':checked');
</del><ins>+                        // Add menu items into the menu
+                        $('.add-to-menu').click(function(e){
+                                wpNavMenu.add_checked_items_to_menu(e.currentTarget);
+                        });
</ins><span class="cx"> 
</span><del>-        // If nothing was checked, cancel
-        if ( 0 == items.length )
-                return false;
</del><ins>+                        // Create a new link then add it to the menu
+                        $('#add-custom-links .add-to-menu a').click(function(e){
+                                // Add link to menu
+                                if ( $('#custom-menu-item-url').val() == $('#custom-menu-item-url').attr('defaultValue') )
+                                        return; // Do not allow &quot;http://&quot; submissions to go through
</ins><span class="cx"> 
</span><del>-        // Loop through each item, grab it's hidden data and add it to the menu.
-        jQuery(items).each(function(){
-                var item_type = jQuery(this).parent().siblings('.menu-item-type').val();
</del><ins>+                                wpNavMenu.add_custom_link( $('#custom-menu-item-name').val(), $('#custom-menu-item-url').val() );
+                                
+                                // Reset the fields back to their defaults
+                                $('#custom-menu-item-name').val($('#custom-menu-item-name').attr('defaultValue'));
+                                $('#custom-menu-item-url' ).val($('#custom-menu-item-url' ).attr('defaultValue')).focus();
+                        });
+                },
+                
+                add_custom_link : function( link_name, link_url ) {
+                        var params = {
+                                action: 'save-custom-link',
+                                link_name: link_name,
+                                link_url: link_url
+                        }
+                        
+                        $.post( ajaxurl, params, function(link_id) {
+                                if ( '-1' == link_id )
+                                        return;
</ins><span class="cx"> 
</span><del>-                if ( 'custom' == item_type ) {
-                        var item_attr_title = jQuery(this).parent().siblings('.menu-item-attr-title').val();
-                        var item_target = jQuery(this).parent().siblings('.menu-item-target').val();
-                        var item_classes = jQuery(this).parent().siblings('.menu-item-classes').val();
-                        var item_xfn = jQuery(this).parent().siblings('.menu-item-xfn').val();
-                } else {
-                        var item_attr_title = '';
-                        var item_target = '_self';
-                        var item_classes = '';
-                        var item_xfn = '';
-                };
</del><ins>+                                wpNavMenu.add_to_menu( link_id, link_id, 'custom', 'custom', navMenuL10n.custom, 0, link_name, link_url, '', '', '_self', '', '' );
+                        }, 'json');
+                },
+                
+                /**
+                 * In combination with the php function wp_initial_nav_menu_meta_boxes(),
+                 * this function limits the metaboxes for first time users to just links, pages and cats.
+                 */
+                initial_meta_boxes : function() {
+                        var hidden = $('#hidden-metaboxes').val().split( ',' );
</ins><span class="cx"> 
</span><del>-                var item_db_id = jQuery(this).parent().siblings('.menu-item-db-id').val();
-                var item_object_id = jQuery(this).parent().siblings('.menu-item-object-id').val();
-                var item_append = jQuery(this).parent().siblings('.menu-item-append').val();
-                var item_parent_id = jQuery(this).parent().siblings('.menu-item-parent-id').val();
-                var item_title = jQuery(this).parent().siblings('.menu-item-title').val();
-                var item_url = jQuery(this).parent().siblings('.menu-item-url').val();
-                var item_description = jQuery(this).parent().siblings('.menu-item-description').val();
</del><ins>+                        if ( '' != hidden ) {
+                                for ( var i = 0; i &lt; hidden.length; i++ ) {
+                                        $( '#' + hidden[i] ).attr( 'style', 'display: none;' );
+                                        $( '#' + hidden[i] + '-hide' ).attr( 'checked', false );
+                                };
+                        };
+                },
+                
+                // Makes the menu items drag and droppable.
+                drag_and_drop : function() {
+                        // Make sure all li's have dropzones
+                        $('.menu li').each(function(){
+                                if ( !$(this).children('.dropzone').attr('class') ) {
+                                        $(this).prepend('&lt;div class=&quot;dropzone&quot;&gt;&lt;/div&gt;');
+                                };
+                        });
</ins><span class="cx"> 
</span><del>-                if ( undefined == item_description ) {
-                        item_description = '';
-                };
</del><ins>+                        // make menu item draggable
+                        $('.menu li').draggable({
+                                handle: ' &gt; dl',
+                                opacity: .8,
+                                addClasses: false,
+                                helper: 'clone',
+                                zIndex: 100
+                        });
</ins><span class="cx"> 
</span><del>-                // Add the menu item to the menu
-                wp_add_item_to_menu( item_db_id, item_object_id, item_type, item_append, item_parent_id, item_title, item_url, item_description, item_attr_title, item_target, item_classes, item_xfn );
</del><ins>+                        // make menu item droppable
+                        $('.menu li dl, .menu li .dropzone').droppable({
+                                accept: '.menu li',
+                                tolerance: 'pointer',
+                                drop: function(e, ui) {
+                                        var li = $(this).parent();
+                                        var child = !$(this).hasClass('dropzone');
</ins><span class="cx"> 
</span><del>-                // uncheck the menu item in the list
-                jQuery(this).attr( 'checked', false );
-        });
-};
</del><ins>+                                        // Append UL to first child
+                                        if ( child &amp;&amp; li.children('ul').length == 0 ) {
+                                                li.append( '&lt;ul class=&quot;sub-menu&quot; /&gt;' );
+                                        }
+                                        // Make it draggable
+                                        if ( child ) {
+                                                li.children('ul').append( ui.draggable );
+                                        } else {
+                                                li.before( ui.draggable );
+                                        }
</ins><span class="cx"> 
</span><del>-/**
- * Makes the menu items drag and droppable.
- */
-function wp_drag_and_drop() {
-        // Make sure all li's have dropzones
-        jQuery('.menu li').each(function(){
-                if ( !jQuery(this).children('.dropzone').attr('class') ) {
-                        jQuery(this).prepend('&lt;div class=&quot;dropzone&quot;&gt;&lt;/div&gt;');
-                };
-        });
</del><ins>+                                        li.find('dl,.dropzone').css({ backgroundColor: '', borderColor: '' });
</ins><span class="cx"> 
</span><del>-        // make menu item draggable
-        jQuery('.menu li').draggable({
-                handle: ' &gt; dl',
-                opacity: .8,
-                addClasses: false,
-                helper: 'clone',
-                zIndex: 100
-        });
</del><ins>+                                        var draggablevalue = ui.draggable.attr('value');
+                                        var droppablevalue = li.attr('value');
</ins><span class="cx"> 
</span><del>-        // make menu item droppable
-        jQuery('.menu li dl, .menu li .dropzone').droppable({
-                accept: '.menu li',
-                tolerance: 'pointer',
-                drop: function(e, ui) {
-                        var li = jQuery(this).parent();
-                        var child = !jQuery(this).hasClass('dropzone');
</del><ins>+                                        li.find('#menu-' + draggablevalue).find('#parent' + draggablevalue).val(droppablevalue);
+                                        $(this).parent().find('dt').removeAttr('style');
+                                        $(this).parent().find('div:first').removeAttr('style');
</ins><span class="cx"> 
</span><del>-                        // Append UL to first child
-                        if ( child &amp;&amp; li.children('ul').length == 0 ) {
-                                li.append( '&lt;ul class=&quot;sub-menu&quot; /&gt;' );
-                        }
-                        // Make it draggable
-                        if ( child ) {
-                                li.children('ul').append( ui.draggable );
-                        } else {
-                                li.before( ui.draggable );
-                        }
-
-                        li.find('dl,.dropzone').css({ backgroundColor: '', borderColor: '' });
-
-                        var draggablevalue = ui.draggable.attr('value');
-                        var droppablevalue = li.attr('value');
-
-                        li.find('#menu-' + draggablevalue).find('#parent' + draggablevalue).val(droppablevalue);
-                        jQuery(this).parent().find('dt').removeAttr('style');
-                        jQuery(this).parent().find('div:first').removeAttr('style');
-
</del><ins>+                                },
+                                over: function(e) {
+                                    // Add child
+                                        if ( $(this).attr('class') == 'dropzone ui-droppable' ) {
+                                            $(this).parent().find('div:first').css({ background: '#f5f5f5', border: '1px dashed #bbb', margin: '10px 0px', height: '40px' });
+                                    }
+                                        // Add above
+                                    else if ( $(this).attr('class') == 'ui-droppable' ) {
+                                                $(this).parent().find('dt:first').css('background', '#d8d8d8');
+                                    } else {
+                                                // Do nothing
+                                    }
+                               },
+                            out: function() {
+                                $(this).parent().find('dt').removeAttr('style');
+                                $(this).parent().find('div:first').removeAttr('style');
+                                $(this).filter('.dropzone').css({ borderColor: '' });
+                            }
+                        });
</ins><span class="cx">                 },
</span><del>-                over: function() {
-                            // Add child
-                            if ( jQuery(this).attr('class') == 'dropzone ui-droppable' ) {
-                                    jQuery(this).parent().find('div:first').css('background', 'none').css('height', '50px');
-                            }
-                            // Add above
-                            else if ( jQuery(this).attr('class') == 'ui-droppable' ) {
-                                    jQuery(this).parent().find('dt:first').css('background', '#d8d8d8');
-                            } else {
-                                        // do nothing
-                            }
-                            var parentid = jQuery(this).parent().attr('id');
</del><ins>+        
+                // Prepares menu items for POST.
+                update_post_data : function() {
+                        var i = 0; // counter
</ins><span class="cx"> 
</span><del>-                       },
-                    out: function() {
-                        jQuery(this).parent().find('dt').removeAttr('style');
-                        jQuery(this).parent().find('div:first').removeAttr('style');
-                        jQuery(this).filter('.dropzone').css({ borderColor: '' });
-                    }
-                }
-        );
-}
</del><ins>+                        $('.menu li').each(function(){
+                                i = i + 1; // the menu order for each item
</ins><span class="cx"> 
</span><del>-/**
- * Prepares menu items for POST.
- */
-function wp_update_post_data() {
-        var i = 0;
</del><ins>+                                var j = $(this).attr('value'); // reference to the current menu item (e.g. li#menu-item + j)
</ins><span class="cx"> 
</span><del>-         jQuery('.menu li').each(function(i) {
-                i = i + 1;
-             var j = jQuery(this).attr('value');
</del><ins>+                                // Grab the menu item id
+                                var id = $(this).children('input[name=menu-item-db-id[]]').val();
</ins><span class="cx"> 
</span><del>-             jQuery(this).find('#menu-item-position' + j).attr('value', i);
-             jQuery(this).attr('id','menu-item' + i);
-             jQuery(this).attr('value', i);
</del><ins>+                                // Update the li value to equal the menu order
+                                $(this).attr('value', i);
</ins><span class="cx"> 
</span><del>-             jQuery(this).find('#menu-item-db-id' + j).attr('id','menu-item-db-id' + i);
-             jQuery(this).find('#menu-item-object-id' + j).attr('id','menu-item-object-id' + i);
-                jQuery(this).find('#menu-item-append' + j).attr('id', 'menu-item-append' + i);
-                jQuery(this).find('#menu-item-type' + j).attr('id', 'menu-item-type' + i);
-                jQuery(this).find('#menu-item-position' + j).attr('id', 'menu-item-position' + i);
</del><ins>+                                // Update the position
+                                $(this).children('input[name=menu-item-position[]]').attr( 'value', i );
</ins><span class="cx"> 
</span><del>-             var p = jQuery(this).find('#menu-item-parent-id' + j).parent().parent().parent().attr('value');
-                jQuery(this).find('#menu-item-parent-id' + j).attr('id','menu-item-parent-id' + i);
-                if (p) {
-                        // Do nothing
-                } else {
-                        // reset p to be top level
-                        p = 0;
-                }
-                jQuery(this).find('#menu-item-parent-id' + j).attr('value', p);
</del><ins>+                                // Update the parent id
+                                var pid = $(this).parent('.sub-menu').siblings('input[name=menu-item-object-id[]]').val();
+                                
+                                if ( undefined == pid ) {
+                                        pid = 0;
+                                };
</ins><span class="cx"> 
</span><del>-                jQuery(this).find('#menu-item-title' + j).attr('id','menu-item-title' + i);
-                jQuery(this).find('#menu-item-url' + j).attr('id','menu-item-url' + i);
-                jQuery(this).find('#menu-item-description' + j).attr('id','menu-item-description' + i);
-                jQuery(this).find('#menu-item-classes' + j).attr('id','menu-item-classes' + i);
-                jQuery(this).find('#menu-item-xfn' + j).attr('id','menu-item-xfn' + i);
-                jQuery(this).find('#menu-item-description' + j).attr('id','menu-item-description' + i);
-                jQuery(this).find('#menu-item-attr-title' + j).attr('id','menu-item-attr-title' + i);
-                jQuery(this).find('#menu-item-target' + j).attr('id','menu-item-target' + i);
</del><ins>+                                $(this).children('input[name=menu-item-parent-id[]]').attr( 'value', pid );
</ins><span class="cx"> 
</span><del>-                jQuery('#li-count').attr( 'value', i );
-   });
-};
</del><ins>+                                // Update the menu item count
+                                $('#li-count').attr( 'value', i );
+                        });
+                },
+                
+                /**
+                 * Enables autocomplete for nav menu types.
+                 *
+                 * @param int id - the id of the menu item type.
+                 */
+                autocomplete : function( id ) {
+                        $('#add-'+ id +' .quick-search').autocomplete( $( '#add-'+ id +' .autocomplete' ).val().split('|') );
</ins><span class="cx"> 
</span><del>-/**
- * Gets a unique number based on how many items are in the menu
- */
-function wp_get_unique_menu_id() {
-        var count = jQuery('.menu li').length + 1;
-        var randomnumber = count;
-        var validatetest = 0;
</del><ins>+                        $('#add-'+ id +' .quick-search').result(function( event, data, formatted ) {
+                                $('#add-'+ id +' .list-wrap').css( 'display', 'block' );
+                                $(&quot;#add-&quot;+ id +&quot; .list-wrap li:contains('&quot; + data + &quot;')&quot;).css( 'display', 'block' );
+                                $('#add-'+ id +' .show-all').hide();
+                                $('#add-'+ id +' .hide-all').show();
+                        });
+                },
+                
+                /**
+                 * Populate the thickbox window with the selected menu items
+                 *
+                 * @param int id - the id of the menu item to edit.
+                 */
+                edit_menu_item : function( id ) {
+                        var item_type = $('#menu-item-' + id).children('input[name=menu-item-type[]]').val();
+                        var item_title = $('#menu-item-' + id).children('input[name=menu-item-title[]]').val();
+                        var item_link = $('#menu-item-' + id).children('input[name=menu-item-url[]]').val();
+                        var item_attr_title = $('#menu-item-' + id).children('input[name=menu-item-attr-title[]]').val();
+                        var item_target = $('#menu-item-' + id).children('input[name=menu-item-target[]]').val();
+                        var item_description = $('#menu-item-' + id).children('input[name=menu-item-description[]]').val();
+                        var item_classes = $('#menu-item-' + id).children('input[name=menu-item-classes[]]').val();
+                        var item_xfn = $('#menu-item-' + id).children('input[name=menu-item-xfn[]]').val();
</ins><span class="cx"> 
</span><del>-        try {
-                var test = document.getElementById( 'menu-' + randomnumber.toString() ).value;
-        }
-        catch ( err ) {
-                validatetest = 1;
-        }
</del><ins>+                        // Only allow custom links to be editable.
+                        if ( 'custom' != item_type )
+                                $( '#edit-menu-item-url' ).attr('disabled', 'disabled' );
</ins><span class="cx"> 
</span><del>-        while ( validatetest == 0 ) {
-                randomnumber = randomnumber + 1;
-                try {
-                        var test2 = document.getElementById( 'menu-' + randomnumber.toString() ).value;
-                }
-                catch ( err ) {
-                        validatetest = 1;
-                }
-        }
-        return randomnumber;
-}
</del><ins>+                        // Populate the fields for thickbox
+                        $( '#edit-menu-item-id' ).val(id);
+                        $( '#edit-menu-item-title' ).val(item_title);
+                        $( '#edit-menu-item-url' ).val(item_link);
+                        $( '#edit-menu-item-attr-title' ).val(item_attr_title);
+                        $( '#edit-menu-item-target' ).val(item_target);
+                        $( &quot;#edit-menu-item-target option[value='&quot; + item_target  + &quot;']&quot; ).attr('selected', 'selected');
+                        $( '#edit-menu-item-description' ).val(item_description);
+                        $( '#edit-menu-item-classes' ).val(item_classes);
+                        $( '#edit-menu-item-xfn' ).val(item_xfn);
</ins><span class="cx"> 
</span><del>-/**
- * Returns all the nessecary hidden inputs for each menu item.
- *
- * @param string item_db_id - The menu item's db id.
- * @param string item_object_id - The menu item's object id.
- * @param string item_type - The menu item's object type.
- * @param string item_append - The menu item's nice name.
- * @param string item_parent_id - The menu item's parent id.
- * @param string item_title - The menu item title.
- * @param string item_url - The menu item url
- * @param string item_description - The menu item description.
- * @param string item_attr_title - The title attribute.
- * @param string item_target - The target attribute.
- * @param string item_classes - Optional. Additional CSS classes for the menu item
- * @param string item_xfn - Optional. The rel attribute.
- */
-function wp_get_hidden_inputs( randomnumber, item_db_id, item_object_id, item_type, item_append, item_parent_id, item_title, item_url, item_description, item_attr_title, item_target, item_classes, item_xfn ) {
-        var hidden = '';
</del><ins>+                        // @todo: focus on #edit-menu-item-title
+                },
+                
+                /**
+                 * Update the values for the menu item being editing
+                 */
+                update_menu_item : function() {
+                        var id = $('#edit-menu-item-id').val();
+                        var item_title = $('#edit-menu-item-title').val();
+                        var item_link = $('#edit-menu-item-url').val();
+                        var item_attr_title = $('#edit-menu-item-attr-title').val();
+                        var item_target = $('#edit-menu-item-target').val();
+                        var item_description = $('#edit-menu-item-description').val();
+                        var item_classes = $('#edit-menu-item-classes').val();
+                        var item_xfn = $('#edit-menu-item-xfn').val();
</ins><span class="cx"> 
</span><del>-        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-db-id[]&quot; id=&quot;menu-item-db-id' + randomnumber + '&quot; value=&quot;' + item_db_id + '&quot; /&gt;';
-        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-object-id[]&quot; id=&quot;menu-item-object-id' + randomnumber + '&quot; value=&quot;' + item_object_id + '&quot; /&gt;';
-        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-type[]&quot; id=&quot;menu-item-type' + randomnumber + '&quot; value=&quot;' + item_type + '&quot; /&gt;';
-        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-append[]&quot; id=&quot;menu-item-append' + randomnumber + '&quot; value=&quot;' + item_append + '&quot; /&gt;';
-        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-parent-id[]&quot; id=&quot;menu-item-parent-id' + randomnumber + '&quot; value=&quot;' + item_parent_id + '&quot; /&gt;';
-        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-position[]&quot; id=&quot;menu-item-position' + randomnumber + '&quot; value=&quot;' + randomnumber + '&quot; /&gt;';
-        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-title[]&quot; id=&quot;menu-item-title' + randomnumber + '&quot; value=&quot;' + item_title + '&quot; /&gt;';
-        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-attr-title[]&quot; id=&quot;menu-item-attr-title' + randomnumber + '&quot; value=&quot;' + item_attr_title + '&quot; /&gt;';
-        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-url[]&quot; id=&quot;menu-item-url' + randomnumber + '&quot; value=&quot;' + item_url + '&quot; /&gt;';
-        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-target[]&quot; id=&quot;menu-item-target' + randomnumber + '&quot; value=&quot;' + item_target + '&quot; /&gt;';
-        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-description[]&quot; id=&quot;menu-item-description' + randomnumber + '&quot; value=&quot;' + item_description + '&quot; /&gt;';
-        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-classes[]&quot; id=&quot;menu-item-classes' + randomnumber + '&quot; value=&quot;' + item_classes + '&quot; /&gt;';
-        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-xfn[]&quot; id=&quot;menu-item-xfn' + randomnumber + '&quot; value=&quot;' + item_xfn + '&quot; /&gt;';
</del><ins>+                        // update menu item settings
+                        $('.menu #menu-item-' + id).find('span.item-title:first').html(item_title);
</ins><span class="cx"> 
</span><del>-        return hidden;
-}
</del><ins>+                        $('#menu-item-' + id).children('input[name=menu-item-title[]]').val(item_title);
+                        $('#menu-item-' + id).children('input[name=menu-item-url[]]').val(item_link);
+                        $('#menu-item-' + id).children('input[name=menu-item-attr-title[]]').val(item_attr_title);
+                        $('#menu-item-' + id).children('input[name=menu-item-target[]]').val(item_target);
+                        $('#menu-item-' + id).children('input[name=menu-item-description[]]').val(item_description);
+                        $('#menu-item-' + id).children('input[name=menu-item-classes[]]').val(item_classes);
+                        $('#menu-item-' + id).children('input[name=menu-item-xfn[]]').val(item_xfn);
</ins><span class="cx"> 
</span><del>-/**
- * WordPress Administration Custom Navigation
- * Interface $ functions
- *
- * @version 2.0.0
- *
- * @package WordPress
- * @subpackage Administration
- */
</del><ins>+                        $('.menu #menu-item-' + id + ' dt:first').animate( { backgroundColor: '#FFFF33' }, { duration: 'normal', complete: function() { $(this).css( 'backgroundColor', '' ); }});
+                },
+                
+                /**
+                 * Removes a menu item from current menu
+                 *
+                 * @param int id - the id of the menu item to remove.
+                 */
+                remove_menu_item : function( id ) {
+                        var todelete = $('#menu-item-' + id);
</ins><span class="cx"> 
</span><del>-/**
- * Init Functions
- */
-jQuery(document).ready(function($){
</del><ins>+                        if ( todelete ) {
+                                // Give some feedback to the user
+                                $( todelete ).find('dt').each(function(){
+                                        $(this).animate( { backgroundColor: '#FF3333' }, { duration: 'normal', complete: function() { $(this).parent().parent().remove() } } );
+                                });
+                        }
+                },
+                
+                /**
+                 * Adds the item to the menu
+                 *
+                 * @param string item_db_id - The menu item's db id.
+                 * @param string item_object_id - The menu item's object id.
+                 * @param string item_object - The menu item's object name.
+                 * @param string item_type - The menu item's object type.
+                 * @param string item_append - The menu item's nice name.
+                 * @param string item_parent_id - The menu item's parent id.
+                 * @param string item_title - The menu item title.
+                 * @param string item_url - The menu item url
+                 * @param string item_description - The menu item description.
+                 * @param string item_attr_title - The title attribute.
+                 * @param string item_target - The target attribute.
+                 * @param string item_classes - Optional. Additional CSS classes for the menu item
+                 * @param string item_xfn - Optional. The rel attribute.
+                 */
+                add_to_menu : function( item_db_id, item_object_id, item_object, item_type, item_append, item_parent_id, item_title, item_url, item_description, item_attr_title, item_target, item_classes, item_xfn ) {
+                        var randomnumber = $('.menu li').length + 1;
+                        var hidden = wpNavMenu.get_hidden_inputs( randomnumber, item_db_id, item_object_id, item_object, item_type, item_parent_id, item_title, item_url, item_description, item_attr_title, item_target, item_classes, item_xfn );
+                        
+                        // Adds the item to the menu
+                        $('.menu').append('&lt;li id=&quot;menu-item-' + randomnumber + '&quot; value=&quot;' + randomnumber + '&quot;&gt;&lt;div class=&quot;dropzone ui-droppable&quot;&gt;&lt;/div&gt;&lt;dl class=&quot;ui-droppable&quot;&gt;&lt;dt&gt;&lt;span class=&quot;item-title&quot;&gt;' + item_title + '&lt;/span&gt;&lt;span class=&quot;item-controls&quot;&gt;&lt;span class=&quot;item-type&quot;&gt;' + item_append + '&lt;/span&gt;&lt;a class=&quot;item-edit thickbox&quot; id=&quot;edit' + randomnumber + '&quot; value=&quot;' + randomnumber +'&quot; onclick=&quot;wpNavMenu.edit_menu_item('+ randomnumber +');&quot; title=&quot;' + navMenuL10n.thickbox + '&quot; href=&quot;#TB_inline?height=540&amp;width=300&amp;inlineId=menu-item-settings&quot;&gt;' + navMenuL10n.edit + '&lt;/a&gt; | &lt;a class=&quot;item-delete&quot; id=&quot;delete' + randomnumber + '&quot; value=&quot;' + randomnumber +'&quot; onclick=&quot;wpNavMenu.remove_menu_item('+ randomnumber +');&quot;&gt;Delete&lt;/a&gt;&lt;/span&gt;&lt;/dt&gt;&lt;/dl&gt;' + hidden + '&lt;/li&gt;');
</ins><span class="cx"> 
</span><del>-        wp_drag_and_drop();
</del><ins>+                        // Give some feedback to the user
+                        $( '.menu #menu-item-' + randomnumber + ' dt:first' ).animate( { backgroundColor: '#FFFF33' }, { duration: 'normal', complete: function() { $(this).css( 'backgroundColor', '' ); }});
</ins><span class="cx"> 
</span><del>-        // Delete AYS
-        $('#update-nav-menu .deletion').click(function(){
-                if ( confirm( navMenuL10n.warnDelete ) ) {
-                        return true;
-                } else {
-                        return false;
-                };
-        });
</del><ins>+                        // Enable drag-n-drop
+                        wpNavMenu.drag_and_drop();
</ins><span class="cx"> 
</span><del>-        // Handle Save Button Clicks
-        $('#save_menu').click(function(){
-                return wp_update_post_data();
-        });
</del><ins>+                        // Reload thickbox
+                        tb_init('a.thickbox, area.thickbox, input.thickbox');
+                },
+                
+                /**
+                 * Grabs items from the queue and adds them to the menu.
+                 *
+                 * @param string button - a reference to the button that was clicked
+                 */
+                add_checked_items_to_menu : function( button ) {
+                        // Grab checked items
+                        var items = $(button).parent().siblings('.list-wrap').find(':checked');
</ins><span class="cx"> 
</span><del>-        // Handle some return keypresses
-        $('#create-menu-name').keypress(function(e){
-                if ( 13 == e.keyCode ) {
-                        $('#create-menu-button').click();
-                        return false;
-                }
-        });
</del><ins>+                        // If nothing was checked, cancel
+                        if ( 0 == items.length )
+                                return false;
</ins><span class="cx"> 
</span><del>-        $('#custom-menu-item-url, #custom-menu-item-name').keypress(function(e){
-                if ( 13 == e.keyCode ) {
-                        $('#add-custom-links a.button').click();
-                        return false;
-                }
-        }).focus(function(){
-                if ( $(this).val() == $(this).attr('defaultValue') &amp;&amp; $(this).attr('id') != 'custom-menu-item-url' ) {
-                        $(this).val('');
-                }
-        }).blur(function(){
-                if ( $(this).val() == '' ) {
-                        $(this).val($(this).attr('defaultValue'));
-                }
-        });
</del><ins>+                        // Loop through each item, grab it's hidden data and add it to the menu.
+                        $(items).each(function(){
+                                var item_type = $(this).parent().siblings('.menu-item-type').val();
</ins><span class="cx"> 
</span><del>-        $('#create-menu-name').focus(function(){
-                if ( $(this).val() == $(this).attr('defaultValue') ) {
-                        $(this).val('');
-                }
-        }).blur(function(){
-                if ( $(this).val() == '' ) {
-                        $(this).val($(this).attr('defaultValue'));
-                }
-        });
</del><ins>+                                if ( 'custom' == item_type ) {
+                                        var item_attr_title = $(this).parent().siblings('.menu-item-attr-title').val();
+                                        var item_target = $(this).parent().siblings('.menu-item-target').val();
+                                        var item_classes = $(this).parent().siblings('.menu-item-classes').val();
+                                        var item_xfn = $(this).parent().siblings('.menu-item-xfn').val();
+                                } else {
+                                        var item_attr_title = '';
+                                        var item_target = '_self';
+                                        var item_classes = '';
+                                        var item_xfn = '';
+                                };
</ins><span class="cx"> 
</span><del>-        // close postboxes that should be closed
-        $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
</del><ins>+                                var item_db_id = $(this).parent().siblings('.menu-item-db-id').val();
+                                var item_object_id = $(this).parent().siblings('.menu-item-object-id').val();
+                                var item_object = $(this).parent().siblings('.menu-item-object').val();
+                                var item_append = $(this).parent().siblings('.menu-item-append').val();
+                                var item_parent_id = $(this).parent().siblings('.menu-item-parent-id').val();
+                                var item_title = $(this).parent().siblings('.menu-item-title').val();
+                                var item_url = $(this).parent().siblings('.menu-item-url').val();
+                                var item_description = $(this).parent().siblings('.menu-item-description').val();
</ins><span class="cx"> 
</span><del>-        // postboxes setup
-        postboxes.add_postbox_toggles('menus');
</del><ins>+                                if ( undefined == item_description ) {
+                                        item_description = '';
+                                };
</ins><span class="cx"> 
</span><del>-        // Clear the quick search textbox
-        $('.quick-search').click(function(){
-                $(this).attr( 'value', '' );
-        });
</del><ins>+                                if ( undefined == item_attr_title ) {
+                                        item_attr_title = '';
+                                };
</ins><span class="cx"> 
</span><del>-        // Quick Search submit
-        $('.quick-search-submit').click(function(){
-                $(this).siblings('.quick-search').search();
-        });
</del><ins>+                                // Add the menu item to the menu
+                                wpNavMenu.add_to_menu( item_db_id, item_object_id, item_object, item_type, item_append, item_parent_id, item_title, item_url, item_description, item_attr_title, item_target, item_classes, item_xfn );
</ins><span class="cx"> 
</span><del>-        // Edit menu item
-        $('#menu-container .item-edit').click(function(){
-                return wp_edit_menu_item( $(this).attr('value') );
-        });
</del><ins>+                                // uncheck the menu item in the list
+                                $(this).attr( 'checked', false );
+                        });
+                },
+                
+                /**
+                 * Returns all the nessecary hidden inputs for each menu item.
+                 *
+                 * @param string item_db_id - The menu item's db id.
+                 * @param string item_object_id - The menu item's object id.
+                 * @param string item_object - The menu item's object name.
+                 * @param string item_type - The menu item's object type.
+                 * @param string item_append - The menu item's nice name.
+                 * @param string item_parent_id - The menu item's parent id.
+                 * @param string item_title - The menu item title.
+                 * @param string item_url - The menu item url
+                 * @param string item_description - The menu item description.
+                 * @param string item_attr_title - The title attribute.
+                 * @param string item_target - The target attribute.
+                 * @param string item_classes - Optional. Additional CSS classes for the menu item
+                 * @param string item_xfn - Optional. The rel attribute.
+                 */
+                get_hidden_inputs : function( randomnumber, item_db_id, item_object_id, item_object, item_type, item_parent_id, item_title, item_url, item_description, item_attr_title, item_target, item_classes, item_xfn ) {
+                        var hidden = '';
</ins><span class="cx"> 
</span><del>-        // Delete menu item
-        $('#menu-container .item-delete').live( 'click', function(e){
-                return wp_remove_menu_item( $(this).attr('value') );
-        });
</del><ins>+                        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-db-id[]&quot; value=&quot;' + item_db_id + '&quot; /&gt;';
+                        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-object-id[]&quot; value=&quot;' + item_object_id + '&quot; /&gt;';
+                        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-object[]&quot; value=&quot;' + item_object + '&quot; /&gt;';
+                        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-type[]&quot; value=&quot;' + item_type + '&quot; /&gt;';
+                        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-parent-id[]&quot; value=&quot;' + item_parent_id + '&quot; /&gt;';
+                        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-position[]&quot; value=&quot;' + randomnumber + '&quot; /&gt;';
+                        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-title[]&quot; value=&quot;' + item_title + '&quot; /&gt;';
+                        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-attr-title[]&quot; value=&quot;' + item_attr_title + '&quot; /&gt;';
+                        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-url[]&quot; value=&quot;' + item_url + '&quot; /&gt;';
+                        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-target[]&quot; value=&quot;' + item_target + '&quot; /&gt;';
+                        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-description[]&quot; value=&quot;' + item_description + '&quot; /&gt;';
+                        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-classes[]&quot; value=&quot;' + item_classes + '&quot; /&gt;';
+                        hidden += '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-xfn[]&quot; value=&quot;' + item_xfn + '&quot; /&gt;';
</ins><span class="cx"> 
</span><del>-        // Update menu item settings (thickbox)
-        $('#update-menu-item').click(function(){
-                wp_update_menu_item();
-                return tb_remove();
-        });
-
-        // Close thickbox
-        $('#cancel-save').click(function(){
-                return tb_remove();
-        });
-
-        // Show All Button
-        $('.show-all').click(function(e){
-                jQuery(e.currentTarget).parent().siblings('.list-wrap').css( 'display', 'block' );
-                jQuery(e.currentTarget).parent().siblings('.list-wrap').find('li').css( 'display', 'block' );
-                jQuery(e.currentTarget).hide();
-                jQuery(e.currentTarget).siblings('.hide-all').show();
-        });
-
-        // Hide All Button
-        $('.hide-all').click(function(e){
-                jQuery(e.currentTarget).parent().siblings('.list-wrap').css( 'display', 'none' );
-                jQuery(e.currentTarget).parent().siblings('.list-wrap').find('li').css( 'display', 'none' );
-                jQuery(e.currentTarget).hide();
-                jQuery(e.currentTarget).siblings('.show-all').show();
-        });
-
-        // Add menu items into the menu
-        $('.add-to-menu').click(function(e){
-                return wp_add_checked_items_to_menu(e.currentTarget);
-        });
-
-        // Create a new link then add it to the menu
-        $('#add-custom-links .add-to-menu a').click(function(e){
-                // Add link to menu
-                if ( $('#custom-menu-item-url').val() == $('#custom-menu-item-url').attr('defaultValue') )
-                        return; // Do not allow &quot;http://&quot; submissions to go through
-                wp_add_item_to_menu( 0, '', 'custom', navMenuL10n.custom, 0, $('#custom-menu-item-name').val(), $('#custom-menu-item-url').val(), '', '', '_self', '', '' );
-                $('#custom-menu-item-name').val($('#custom-menu-item-name').attr('defaultValue'));
-                $('#custom-menu-item-url' ).val($('#custom-menu-item-url' ).attr('defaultValue')).focus();
-        });
-});
</del><span class="cx">\ No newline at end of file
</span><ins>+                        return hidden;
+                }
+        }
+        
+        $(document).ready(function($){ wpNavMenu.init(); });
+})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjsnavmenujs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu.js (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu.js        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-admin/js/nav-menu.js        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -1 +1 @@
</span><del>-function wp_nav_menu_autocomplete(a){jQuery(&quot;#add-&quot;+a+&quot; .quick-search&quot;).autocomplete(jQuery(&quot;#add-&quot;+a+&quot; .autocomplete&quot;).val().split(&quot;|&quot;));jQuery(&quot;#add-&quot;+a+&quot; .quick-search&quot;).result(function(b,d,c){jQuery(&quot;#add-&quot;+a+&quot; .list-wrap&quot;).css(&quot;display&quot;,&quot;block&quot;);jQuery(&quot;#add-&quot;+a+&quot; .list-wrap li:contains('&quot;+d+&quot;')&quot;).css(&quot;display&quot;,&quot;block&quot;);jQuery(&quot;#add-&quot;+a+&quot; .show-all&quot;).hide();jQuery(&quot;#add-&quot;+a+&quot; .hide-all&quot;).show()})}function wp_edit_menu_item(a){var f=jQuery(&quot;#menu-item-type&quot;+a).val();var b=jQuery(&quot;#menu-item-title&quot;+a).val();var g=jQuery(&quot;#menu-item-url&quot;+a).val();var c=jQuery(&quot;#menu-item-attr-title&quot;+a).val();var d=jQuery(&quot;#menu-item-target&quot;+a).val();var h=jQuery(&quot;#menu-item-description&quot;+a).val();var e=jQuery(&quot;#menu-item-classes&quot;+a).val();var i=jQuery(&quot;#menu-item-xfn&quot;+a).val();if(&quot;custom&quot;!=f){jQuery(&quot;#edit-menu-item-url&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;)}jQuery(&quot;#edit-menu-item-id&quot;).val(a);jQuery(&quot;#edit-menu-item-title&quot;).val(b);jQuery(&quot;#edit-menu-item-url&quot;).val(g);jQuery(&quot;#edit-menu-item-attr-title&quot;).val(c);jQuery(&quot;#edit-menu-item-target&quot;).val(d);jQuery(&quot;#edit-menu-item-target option[value='&quot;+d+&quot;']&quot;).attr(&quot;selected&quot;,&quot;selected&quot;);jQuery(&quot;#edit-menu-item-description&quot;).val(h);jQuery(&quot;#edit-menu-item-classes&quot;).val(e);jQuery(&quot;#edit-menu-item-xfn&quot;).val(i);jQuery(&quot;#edit-menu-item-title&quot;).focus()}function wp_update_menu_item(){var h=jQuery(&quot;#edit-menu-item-id&quot;).val();var f=jQuery(&quot;#edit-menu-item-title&quot;).val();var b=jQuery(&quot;#edit-menu-item-url&quot;).val();var g=jQuery(&quot;#edit-menu-item-attr-title&quot;).val();var d=jQuery(&quot;#edit-menu-item-target&quot;).val();var c=jQuery(&quot;#edit-menu-item-description&quot;).val();var a=jQuery(&quot;#edit-menu-item-classes&quot;).val();var e=jQuery(&quot;#edit-menu-item-xfn&quot;).val();jQuery(&quot;.menu #menu-item&quot;+h).find(&quot;span.item-title&quot;).html(f);jQuery(&quot;.menu #menu-item-title&quot;+h).val(f);jQuery(&quot;.menu #menu-item-url&quot;+h).val(b);jQuery(&quot;.menu #menu-item-attr-title&quot;+h).val(g);jQuery(&quot;.menu #menu-item-target&quot;+h).val(d);jQuery(&quot;.menu #menu-item-description&quot;+h).val(c);jQuery(&quot;.menu #menu-item-classes&quot;+h).val(a);jQuery(&quot;.menu #menu-item-xfn&quot;+h).val(e);jQuery(&quot;.menu #menu-item&quot;+h+&quot; dt:first&quot;).animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}})}function wp_remove_menu_item(b){var a=document.getElementById(&quot;menu-item&quot;+b);if(a){jQuery(a).find(&quot;dt&quot;).each(function(){jQuery(this).animate({backgroundColor:&quot;#FF3333&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).parent().parent().remove()}})})}}function wp_add_item_to_menu(a,k,f,n,l,b,m,h,e,d,c,i){var j=wp_get_unique_menu_id();var g=wp_get_hidden_inputs(j,a,k,f,n,l,b,m,h,e,d,c,i);jQuery(&quot;.menu&quot;).append('&lt;li id=&quot;menu-item'+j+'&quot; value=&quot;'+j+'&quot;&gt;&lt;div class=&quot;dropzone ui-droppable&quot;&gt;&lt;/div&gt;&lt;dl class=&quot;ui-droppable&quot;&gt;&lt;dt&gt;&lt;span class=&quot;item-title&quot;&gt;'+b+'&lt;/span&gt;&lt;span class=&quot;item-controls&quot;&gt;&lt;span class=&quot;item-type&quot;&gt;'+n+'&lt;/span&gt;&lt;a class=&quot;item-edit thickbox&quot; id=&quot;edit'+j+'&quot; value=&quot;'+j+'&quot; onClick=&quot;wp_edit_menu_item('+j+')&quot; title=&quot;'+navMenuL10n.thickbox+'&quot; href=&quot;#TB_inline?height=540&amp;width=300&amp;inlineId=menu-item-settings&quot;&gt;'+navMenuL10n.edit+'&lt;/a&gt; | &lt;a class=&quot;item-delete&quot; id=&quot;delete'+j+'&quot; value=&quot;'+j+'&quot;&gt;Delete&lt;/a&gt;&lt;/span&gt;&lt;/dt&gt;&lt;/dl&gt;'+g+&quot;&lt;/li&gt;&quot;);jQuery(&quot;.menu #menu-item&quot;+j+&quot; dt:first&quot;).animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}});wp_drag_and_drop();tb_init(&quot;a.thickbox, area.thickbox, input.thickbox&quot;)}function wp_add_checked_items_to_menu(b){var a=jQuery(b).siblings(&quot;.list-wrap&quot;).find(&quot;:checked&quot;);if(0==a.length){return false}jQuery(a).each(function(){var h=jQuery(this).parent().siblings(&quot;.menu-item-type&quot;).val();if(&quot;custom&quot;==h){var e=jQuery(this).parent().siblings(&quot;.menu-item-attr-title&quot;).val();var f=jQuery(this).parent().siblings(&quot;.menu-item-target&quot;).val();var g=jQuery(this).parent().siblings(&quot;.menu-item-classes&quot;).val();var j=jQuery(this).parent().siblings(&quot;.menu-item-xfn&quot;).val()}else{var e=&quot;&quot;;var f=&quot;_self&quot;;var g=&quot;&quot;;var j=&quot;&quot;}var c=jQuery(this).parent().siblings(&quot;.menu-item-db-id&quot;).val();var k=jQuery(this).parent().siblings(&quot;.menu-item-object-id&quot;).val();var n=jQuery(this).parent().siblings(&quot;.menu-item-append&quot;).val();var l=jQuery(this).parent().siblings(&quot;.menu-item-parent-id&quot;).val();var d=jQuery(this).parent().siblings(&quot;.menu-item-title&quot;).val();var m=jQuery(this).parent().siblings(&quot;.menu-item-url&quot;).val();var i=jQuery(this).parent().siblings(&quot;.menu-item-description&quot;).val();if(undefined==i){i=&quot;&quot;}wp_add_item_to_menu(c,k,h,n,l,d,m,i,e,f,g,j);jQuery(this).attr(&quot;checked&quot;,false)})}function wp_drag_and_drop(){jQuery(&quot;.menu li&quot;).each(function(){if(!jQuery(this).children(&quot;.dropzone&quot;).attr(&quot;class&quot;)){jQuery(this).prepend('&lt;div class=&quot;dropzone&quot;&gt;&lt;/div&gt;')}});jQuery(&quot;.menu li&quot;).draggable({handle:&quot; &gt; dl&quot;,opacity:0.8,addClasses:false,helper:&quot;clone&quot;,zIndex:100});jQuery(&quot;.menu li dl, .menu li .dropzone&quot;).droppable({accept:&quot;.menu li&quot;,tolerance:&quot;pointer&quot;,drop:function(f,d){var a=jQuery(this).parent();var g=!jQuery(this).hasClass(&quot;dropzone&quot;);if(g&amp;&amp;a.children(&quot;ul&quot;).length==0){a.append('&lt;ul class=&quot;sub-menu&quot; /&gt;')}if(g){a.children(&quot;ul&quot;).append(d.draggable)}else{a.before(d.draggable)}a.find(&quot;dl,.dropzone&quot;).css({backgroundColor:&quot;&quot;,borderColor:&quot;&quot;});var c=d.draggable.attr(&quot;value&quot;);var b=a.attr(&quot;value&quot;);a.find(&quot;#menu-&quot;+c).find(&quot;#parent&quot;+c).val(b);jQuery(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);jQuery(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;)},over:function(){if(jQuery(this).attr(&quot;class&quot;)==&quot;dropzone ui-droppable&quot;){jQuery(this).parent().find(&quot;div:first&quot;).css(&quot;background&quot;,&quot;none&quot;).css(&quot;height&quot;,&quot;50px&quot;)}else{if(jQuery(this).attr(&quot;class&quot;)==&quot;ui-droppable&quot;){jQuery(this).parent().find(&quot;dt:first&quot;).css(&quot;background&quot;,&quot;#d8d8d8&quot;)}else{}}var a=jQuery(this).parent().attr(&quot;id&quot;)},out:function(){jQuery(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);jQuery(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;);jQuery(this).filter(&quot;.dropzone&quot;).css({borderColor:&quot;&quot;})}})}function wp_update_post_data(){var a=0;jQuery(&quot;.menu li&quot;).each(function(c){c=c+1;var b=jQuery(this).attr(&quot;value&quot;);jQuery(this).find(&quot;#menu-item-position&quot;+b).attr(&quot;value&quot;,c);jQuery(this).attr(&quot;id&quot;,&quot;menu-item&quot;+c);jQuery(this).attr(&quot;value&quot;,c);jQuery(this).find(&quot;#menu-item-db-id&quot;+b).attr(&quot;id&quot;,&quot;menu-item-db-id&quot;+c);jQuery(this).find(&quot;#menu-item-object-id&quot;+b).attr(&quot;id&quot;,&quot;menu-item-object-id&quot;+c);jQuery(this).find(&quot;#menu-item-append&quot;+b).attr(&quot;id&quot;,&quot;menu-item-append&quot;+c);jQuery(this).find(&quot;#menu-item-type&quot;+b).attr(&quot;id&quot;,&quot;menu-item-type&quot;+c);jQuery(this).find(&quot;#menu-item-position&quot;+b).attr(&quot;id&quot;,&quot;menu-item-position&quot;+c);var d=jQuery(this).find(&quot;#menu-item-parent-id&quot;+b).parent().parent().parent().attr(&quot;value&quot;);jQuery(this).find(&quot;#menu-item-parent-id&quot;+b).attr(&quot;id&quot;,&quot;menu-item-parent-id&quot;+c);if(d){}else{d=0}jQuery(this).find(&quot;#menu-item-parent-id&quot;+b).attr(&quot;value&quot;,d);jQuery(this).find(&quot;#menu-item-title&quot;+b).attr(&quot;id&quot;,&quot;menu-item-title&quot;+c);jQuery(this).find(&quot;#menu-item-url&quot;+b).attr(&quot;id&quot;,&quot;menu-item-url&quot;+c);jQuery(this).find(&quot;#menu-item-description&quot;+b).attr(&quot;id&quot;,&quot;menu-item-description&quot;+c);jQuery(this).find(&quot;#menu-item-classes&quot;+b).attr(&quot;id&quot;,&quot;menu-item-classes&quot;+c);jQuery(this).find(&quot;#menu-item-xfn&quot;+b).attr(&quot;id&quot;,&quot;menu-item-xfn&quot;+c);jQuery(this).find(&quot;#menu-item-description&quot;+b).attr(&quot;id&quot;,&quot;menu-item-description&quot;+c);jQuery(this).find(&quot;#menu-item-attr-title&quot;+b).attr(&quot;id&quot;,&quot;menu-item-attr-title&quot;+c);jQuery(this).find(&quot;#menu-item-target&quot;+b).attr(&quot;id&quot;,&quot;menu-item-target&quot;+c);jQuery(&quot;#li-count&quot;).attr(&quot;value&quot;,c)})}function wp_get_unique_menu_id(){var d=jQuery(&quot;.menu li&quot;).length+1;var e=d;var a=0;try{var f=document.getElementById(&quot;menu-&quot;+e.toString()).value}catch(c){a=1}while(a==0){e=e+1;try{var b=document.getElementById(&quot;menu-&quot;+e.toString()).value}catch(c){a=1}}return e}function wp_get_hidden_inputs(j,a,k,f,n,l,b,m,h,e,d,c,i){var g=&quot;&quot;;g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-db-id[]&quot; id=&quot;menu-item-db-id'+j+'&quot; value=&quot;'+a+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-object-id[]&quot; id=&quot;menu-item-object-id'+j+'&quot; value=&quot;'+k+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-type[]&quot; id=&quot;menu-item-type'+j+'&quot; value=&quot;'+f+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-append[]&quot; id=&quot;menu-item-append'+j+'&quot; value=&quot;'+n+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-parent-id[]&quot; id=&quot;menu-item-parent-id'+j+'&quot; value=&quot;'+l+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-position[]&quot; id=&quot;menu-item-position'+j+'&quot; value=&quot;'+j+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-title[]&quot; id=&quot;menu-item-title'+j+'&quot; value=&quot;'+b+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-attr-title[]&quot; id=&quot;menu-item-attr-title'+j+'&quot; value=&quot;'+e+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-url[]&quot; id=&quot;menu-item-url'+j+'&quot; value=&quot;'+m+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-target[]&quot; id=&quot;menu-item-target'+j+'&quot; value=&quot;'+d+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-description[]&quot; id=&quot;menu-item-description'+j+'&quot; value=&quot;'+h+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-classes[]&quot; id=&quot;menu-item-classes'+j+'&quot; value=&quot;'+c+'&quot; /&gt;';g+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-xfn[]&quot; id=&quot;menu-item-xfn'+j+'&quot; value=&quot;'+i+'&quot; /&gt;';return g}jQuery(document).ready(function(a){wp_drag_and_drop();a(&quot;#update-nav-menu .deletion&quot;).click(function(){if(confirm(navMenuL10n.warnDelete)){return true}else{return false}});a(&quot;#save_menu&quot;).click(function(){return wp_update_post_data()});a(&quot;#create-menu-name&quot;).keypress(function(b){if(13==b.keyCode){a(&quot;#create-menu-button&quot;).click();return false}});a(&quot;#custom-menu-item-url, #custom-menu-item-name&quot;).keypress(function(b){if(13==b.keyCode){a(&quot;#add-custom-links a.button&quot;).click();return false}}).focus(function(){if(a(this).val()==a(this).attr(&quot;defaultValue&quot;)&amp;&amp;a(this).attr(&quot;id&quot;)!=&quot;custom-menu-item-url&quot;){a(this).val(&quot;&quot;)}}).blur(function(){if(a(this).val()==&quot;&quot;){a(this).val(a(this).attr(&quot;defaultValue&quot;))}});a(&quot;#create-menu-name&quot;).focus(function(){if(a(this).val()==a(this).attr(&quot;defaultValue&quot;)){a(this).val(&quot;&quot;)}}).blur(function(){if(a(this).val()==&quot;&quot;){a(this).val(a(this).attr(&quot;defaultValue&quot;))}});a(&quot;.if-js-closed&quot;).removeClass(&quot;if-js-closed&quot;).addClass(&quot;closed&quot;);postboxes.add_postbox_toggles(&quot;menus&quot;);a(&quot;.quick-search&quot;).click(function(){a(this).attr(&quot;value&quot;,&quot;&quot;)});a(&quot;.quick-search-submit&quot;).click(function(){a(this).siblings(&quot;.quick-search&quot;).search()});a(&quot;#menu-container .item-edit&quot;).click(function(){return wp_edit_menu_item(a(this).attr(&quot;value&quot;))});a(&quot;#menu-container .item-delete&quot;).live(&quot;click&quot;,function(b){return wp_remove_menu_item(a(this).attr(&quot;value&quot;))});a(&quot;#update-menu-item&quot;).click(function(){wp_update_menu_item();return tb_remove()});a(&quot;#cancel-save&quot;).click(function(){return tb_remove()});a(&quot;.show-all&quot;).click(function(b){jQuery(b.currentTarget).parent().siblings(&quot;.list-wrap&quot;).css(&quot;display&quot;,&quot;block&quot;);jQuery(b.currentTarget).parent().siblings(&quot;.list-wrap&quot;).find(&quot;li&quot;).css(&quot;display&quot;,&quot;block&quot;);jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(&quot;.hide-all&quot;).show()});a(&quot;.hide-all&quot;).click(function(b){jQuery(b.currentTarget).parent().siblings(&quot;.list-wrap&quot;).css(&quot;display&quot;,&quot;none&quot;);jQuery(b.currentTarget).parent().siblings(&quot;.list-wrap&quot;).find(&quot;li&quot;).css(&quot;display&quot;,&quot;none&quot;);jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(&quot;.show-all&quot;).show()});a(&quot;.add-to-menu&quot;).click(function(b){return wp_add_checked_items_to_menu(b.currentTarget)});a(&quot;#add-custom-links .add-to-menu a&quot;).click(function(b){if(a(&quot;#custom-menu-item-url&quot;).val()==a(&quot;#custom-menu-item-url&quot;).attr(&quot;defaultValue&quot;)){return}wp_add_item_to_menu(0,&quot;&quot;,&quot;custom&quot;,navMenuL10n.custom,0,a(&quot;#custom-menu-item-name&quot;).val(),a(&quot;#custom-menu-item-url&quot;).val(),&quot;&quot;,&quot;&quot;,&quot;_self&quot;,&quot;&quot;,&quot;&quot;);a(&quot;#custom-menu-item-name&quot;).val(a(&quot;#custom-menu-item-name&quot;).attr(&quot;defaultValue&quot;));a(&quot;#custom-menu-item-url&quot;).val(a(&quot;#custom-menu-item-url&quot;).attr(&quot;defaultValue&quot;)).focus()})});
</del><span class="cx">\ No newline at end of file
</span><ins>+var wpNavMenu;(function(a){wpNavMenu={init:function(){wpNavMenu.initial_meta_boxes();wpNavMenu.drag_and_drop();a(&quot;#update-nav-menu .deletion&quot;).click(function(){if(confirm(navMenuL10n.warnDelete)){return true}else{return false}});a(&quot;#update-nav-menu&quot;).submit(function(){wpNavMenu.update_post_data()});a(&quot;#create-menu-name&quot;).keypress(function(b){if(13==b.keyCode){a(&quot;#create-menu-button&quot;).click();return false}});a(&quot;#custom-menu-item-url, #custom-menu-item-name&quot;).keypress(function(b){if(13==b.keyCode){a(&quot;#add-custom-links a.button&quot;).click();return false}}).focus(function(){if(a(this).val()==a(this).attr(&quot;defaultValue&quot;)&amp;&amp;a(this).attr(&quot;id&quot;)!=&quot;custom-menu-item-url&quot;){a(this).val(&quot;&quot;)}}).blur(function(){if(a(this).val()==&quot;&quot;){a(this).val(a(this).attr(&quot;defaultValue&quot;))}});a(&quot;#create-menu-name&quot;).focus(function(){if(a(this).val()==a(this).attr(&quot;defaultValue&quot;)){a(this).val(&quot;&quot;)}}).blur(function(){if(a(this).val()==&quot;&quot;){a(this).val(a(this).attr(&quot;defaultValue&quot;))}});a(&quot;.if-js-closed&quot;).removeClass(&quot;if-js-closed&quot;).addClass(&quot;closed&quot;);postboxes.add_postbox_toggles(&quot;nav-menus&quot;);a(&quot;.quick-search&quot;).click(function(){a(this).attr(&quot;value&quot;,&quot;&quot;)});a(&quot;.quick-search-submit&quot;).click(function(){a(this).siblings(&quot;.quick-search&quot;).search()});a(&quot;#menu-container .item-edit&quot;).click(function(){wpNavMenu.edit_menu_item(a(this).attr(&quot;value&quot;))});a(&quot;#menu-container .item-delete&quot;).click(function(){wpNavMenu.remove_menu_item(a(this).attr(&quot;value&quot;))});a(&quot;#update-menu-item&quot;).click(function(){wpNavMenu.update_menu_item();tb_remove()});a(&quot;#cancel-save&quot;).click(function(){tb_remove()});a(&quot;.show-all&quot;).click(function(b){a(b.currentTarget).parent().parent().siblings(&quot;.list-wrap&quot;).css(&quot;display&quot;,&quot;block&quot;);a(b.currentTarget).parent().parent().siblings(&quot;.list-wrap&quot;).find(&quot;li&quot;).css(&quot;display&quot;,&quot;block&quot;);a(b.currentTarget).hide();a(b.currentTarget).siblings(&quot;.hide-all&quot;).show()});a(&quot;.hide-all&quot;).click(function(b){a(b.currentTarget).parent().parent().siblings(&quot;.list-wrap&quot;).css(&quot;display&quot;,&quot;none&quot;);a(b.currentTarget).parent().parent().siblings(&quot;.list-wrap&quot;).find(&quot;li&quot;).css(&quot;display&quot;,&quot;none&quot;);a(b.currentTarget).hide();a(b.currentTarget).siblings(&quot;.show-all&quot;).show()});a(&quot;.add-to-menu&quot;).click(function(b){wpNavMenu.add_checked_items_to_menu(b.currentTarget)});a(&quot;#add-custom-links .add-to-menu a&quot;).click(function(b){if(a(&quot;#custom-menu-item-url&quot;).val()==a(&quot;#custom-menu-item-url&quot;).attr(&quot;defaultValue&quot;)){return}wpNavMenu.add_custom_link(a(&quot;#custom-menu-item-name&quot;).val(),a(&quot;#custom-menu-item-url&quot;).val());a(&quot;#custom-menu-item-name&quot;).val(a(&quot;#custom-menu-item-name&quot;).attr(&quot;defaultValue&quot;));a(&quot;#custom-menu-item-url&quot;).val(a(&quot;#custom-menu-item-url&quot;).attr(&quot;defaultValue&quot;)).focus()})},add_custom_link:function(c,b){var d={action:&quot;save-custom-link&quot;,link_name:c,link_url:b};a.post(ajaxurl,d,function(e){if(&quot;-1&quot;==e){return}wpNavMenu.add_to_menu(e,e,&quot;custom&quot;,&quot;custom&quot;,navMenuL10n.custom,0,c,b,&quot;&quot;,&quot;&quot;,&quot;_self&quot;,&quot;&quot;,&quot;&quot;)},&quot;json&quot;)},initial_meta_boxes:function(){var c=a(&quot;#hidden-metaboxes&quot;).val().split(&quot;,&quot;);if(&quot;&quot;!=c){for(var b=0;b&lt;c.length;b++){a(&quot;#&quot;+c[b]).attr(&quot;style&quot;,&quot;display: none;&quot;);a(&quot;#&quot;+c[b]+&quot;-hide&quot;).attr(&quot;checked&quot;,false)}}},drag_and_drop:function(){a(&quot;.menu li&quot;).each(function(){if(!a(this).children(&quot;.dropzone&quot;).attr(&quot;class&quot;)){a(this).prepend('&lt;div class=&quot;dropzone&quot;&gt;&lt;/div&gt;')}});a(&quot;.menu li&quot;).draggable({handle:&quot; &gt; dl&quot;,opacity:0.8,addClasses:false,helper:&quot;clone&quot;,zIndex:100});a(&quot;.menu li dl, .menu li .dropzone&quot;).droppable({accept:&quot;.menu li&quot;,tolerance:&quot;pointer&quot;,drop:function(g,f){var b=a(this).parent();var h=!a(this).hasClass(&quot;dropzone&quot;);if(h&amp;&amp;b.children(&quot;ul&quot;).length==0){b.append('&lt;ul class=&quot;sub-menu&quot; /&gt;')}if(h){b.children(&quot;ul&quot;).append(f.draggable)}else{b.before(f.draggable)}b.find(&quot;dl,.dropzone&quot;).css({backgroundColor:&quot;&quot;,borderColor:&quot;&quot;});var d=f.draggable.attr(&quot;value&quot;);var c=b.attr(&quot;value&quot;);b.find(&quot;#menu-&quot;+d).find(&quot;#parent&quot;+d).val(c);a(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);a(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;)},over:function(b){if(a(this).attr(&quot;class&quot;)==&quot;dropzone ui-droppable&quot;){a(this).parent().find(&quot;div:first&quot;).css({background:&quot;#f5f5f5&quot;,border:&quot;1px dashed #bbb&quot;,margin:&quot;10px 0px&quot;,height:&quot;40px&quot;})}else{if(a(this).attr(&quot;class&quot;)==&quot;ui-droppable&quot;){a(this).parent().find(&quot;dt:first&quot;).css(&quot;background&quot;,&quot;#d8d8d8&quot;)}else{}}},out:function(){a(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);a(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;);a(this).filter(&quot;.dropzone&quot;).css({borderColor:&quot;&quot;})}})},update_post_data:function(){var b=0;a(&quot;.menu li&quot;).each(function(){b=b+1;var d=a(this).attr(&quot;value&quot;);var e=a(this).children(&quot;input[name=menu-item-db-id[]]&quot;).val();a(this).attr(&quot;value&quot;,b);a(this).children(&quot;input[name=menu-item-position[]]&quot;).attr(&quot;value&quot;,b);var c=a(this).parent(&quot;.sub-menu&quot;).siblings(&quot;input[name=menu-item-object-id[]]&quot;).val();if(undefined==c){c=0}a(this).children(&quot;input[name=menu-item-parent-id[]]&quot;).attr(&quot;value&quot;,c);a(&quot;#li-count&quot;).attr(&quot;value&quot;,b)})},autocomplete:function(b){a(&quot;#add-&quot;+b+&quot; .quick-search&quot;).autocomplete(a(&quot;#add-&quot;+b+&quot; .autocomplete&quot;).val().split(&quot;|&quot;));a(&quot;#add-&quot;+b+&quot; .quick-search&quot;).result(function(c,e,d){a(&quot;#add-&quot;+b+&quot; .list-wrap&quot;).css(&quot;display&quot;,&quot;block&quot;);a(&quot;#add-&quot;+b+&quot; .list-wrap li:contains('&quot;+e+&quot;')&quot;).css(&quot;display&quot;,&quot;block&quot;);a(&quot;#add-&quot;+b+&quot; .show-all&quot;).hide();a(&quot;#add-&quot;+b+&quot; .hide-all&quot;).show()})},edit_menu_item:function(b){var g=a(&quot;#menu-item-&quot;+b).children(&quot;input[name=menu-item-type[]]&quot;).val();var c=a(&quot;#menu-item-&quot;+b).children(&quot;input[name=menu-item-title[]]&quot;).val();var h=a(&quot;#menu-item-&quot;+b).children(&quot;input[name=menu-item-url[]]&quot;).val();var d=a(&quot;#menu-item-&quot;+b).children(&quot;input[name=menu-item-attr-title[]]&quot;).val();var e=a(&quot;#menu-item-&quot;+b).children(&quot;input[name=menu-item-target[]]&quot;).val();var i=a(&quot;#menu-item-&quot;+b).children(&quot;input[name=menu-item-description[]]&quot;).val();var f=a(&quot;#menu-item-&quot;+b).children(&quot;input[name=menu-item-classes[]]&quot;).val();var j=a(&quot;#menu-item-&quot;+b).children(&quot;input[name=menu-item-xfn[]]&quot;).val();if(&quot;custom&quot;!=g){a(&quot;#edit-menu-item-url&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;)}a(&quot;#edit-menu-item-id&quot;).val(b);a(&quot;#edit-menu-item-title&quot;).val(c);a(&quot;#edit-menu-item-url&quot;).val(h);a(&quot;#edit-menu-item-attr-title&quot;).val(d);a(&quot;#edit-menu-item-target&quot;).val(e);a(&quot;#edit-menu-item-target option[value='&quot;+e+&quot;']&quot;).attr(&quot;selected&quot;,&quot;selected&quot;);a(&quot;#edit-menu-item-description&quot;).val(i);a(&quot;#edit-menu-item-classes&quot;).val(f);a(&quot;#edit-menu-item-xfn&quot;).val(j)},update_menu_item:function(){var i=a(&quot;#edit-menu-item-id&quot;).val();var g=a(&quot;#edit-menu-item-title&quot;).val();var c=a(&quot;#edit-menu-item-url&quot;).val();var h=a(&quot;#edit-menu-item-attr-title&quot;).val();var e=a(&quot;#edit-menu-item-target&quot;).val();var d=a(&quot;#edit-menu-item-description&quot;).val();var b=a(&quot;#edit-menu-item-classes&quot;).val();var f=a(&quot;#edit-menu-item-xfn&quot;).val();a(&quot;.menu #menu-item-&quot;+i).find(&quot;span.item-title:first&quot;).html(g);a(&quot;#menu-item-&quot;+i).children(&quot;input[name=menu-item-title[]]&quot;).val(g);a(&quot;#menu-item-&quot;+i).children(&quot;input[name=menu-item-url[]]&quot;).val(c);a(&quot;#menu-item-&quot;+i).children(&quot;input[name=menu-item-attr-title[]]&quot;).val(h);a(&quot;#menu-item-&quot;+i).children(&quot;input[name=menu-item-target[]]&quot;).val(e);a(&quot;#menu-item-&quot;+i).children(&quot;input[name=menu-item-description[]]&quot;).val(d);a(&quot;#menu-item-&quot;+i).children(&quot;input[name=menu-item-classes[]]&quot;).val(b);a(&quot;#menu-item-&quot;+i).children(&quot;input[name=menu-item-xfn[]]&quot;).val(f);a(&quot;.menu #menu-item-&quot;+i+&quot; dt:first&quot;).animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){a(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}})},remove_menu_item:function(c){var b=a(&quot;#menu-item-&quot;+c);if(b){a(b).find(&quot;dt&quot;).each(function(){a(this).animate({backgroundColor:&quot;#FF3333&quot;},{duration:&quot;normal&quot;,complete:function(){a(this).parent().parent().remove()}})})}},add_to_menu:function(b,m,c,h,p,n,d,o,j,g,f,e,k){var l=a(&quot;.menu li&quot;).length+1;var i=wpNavMenu.get_hidden_inputs(l,b,m,c,h,n,d,o,j,g,f,e,k);a(&quot;.menu&quot;).append('&lt;li id=&quot;menu-item-'+l+'&quot; value=&quot;'+l+'&quot;&gt;&lt;div class=&quot;dropzone ui-droppable&quot;&gt;&lt;/div&gt;&lt;dl class=&quot;ui-droppable&quot;&gt;&lt;dt&gt;&lt;span class=&quot;item-title&quot;&gt;'+d+'&lt;/span&gt;&lt;span class=&quot;item-controls&quot;&gt;&lt;span class=&quot;item-type&quot;&gt;'+p+'&lt;/span&gt;&lt;a class=&quot;item-edit thickbox&quot; id=&quot;edit'+l+'&quot; value=&quot;'+l+'&quot; onclick=&quot;wpNavMenu.edit_menu_item('+l+');&quot; title=&quot;'+navMenuL10n.thickbox+'&quot; href=&quot;#TB_inline?height=540&amp;width=300&amp;inlineId=menu-item-settings&quot;&gt;'+navMenuL10n.edit+'&lt;/a&gt; | &lt;a class=&quot;item-delete&quot; id=&quot;delete'+l+'&quot; value=&quot;'+l+'&quot; onclick=&quot;wpNavMenu.remove_menu_item('+l+');&quot;&gt;Delete&lt;/a&gt;&lt;/span&gt;&lt;/dt&gt;&lt;/dl&gt;'+i+&quot;&lt;/li&gt;&quot;);a(&quot;.menu #menu-item-&quot;+l+&quot; dt:first&quot;).animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){a(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}});wpNavMenu.drag_and_drop();tb_init(&quot;a.thickbox, area.thickbox, input.thickbox&quot;)},add_checked_items_to_menu:function(c){var b=a(c).parent().siblings(&quot;.list-wrap&quot;).find(&quot;:checked&quot;);if(0==b.length){return false}a(b).each(function(){var j=a(this).parent().siblings(&quot;.menu-item-type&quot;).val();if(&quot;custom&quot;==j){var g=a(this).parent().siblings(&quot;.menu-item-attr-title&quot;).val();var h=a(this).parent().siblings(&quot;.menu-item-target&quot;).val();var i=a(this).parent().siblings(&quot;.menu-item-classes&quot;).val();var l=a(this).parent().siblings(&quot;.menu-item-xfn&quot;).val()}else{var g=&quot;&quot;;var h=&quot;_self&quot;;var i=&quot;&quot;;var l=&quot;&quot;}var d=a(this).parent().siblings(&quot;.menu-item-db-id&quot;).val();var m=a(this).parent().siblings(&quot;.menu-item-object-id&quot;).val();var e=a(this).parent().siblings(&quot;.menu-item-object&quot;).val();var p=a(this).parent().siblings(&quot;.menu-item-append&quot;).val();var n=a(this).parent().siblings(&quot;.menu-item-parent-id&quot;).val();var f=a(this).parent().siblings(&quot;.menu-item-title&quot;).val();var o=a(this).parent().siblings(&quot;.menu-item-url&quot;).val();var k=a(this).parent().siblings(&quot;.menu-item-description&quot;).val();if(undefined==k){k=&quot;&quot;}if(undefined==g){g=&quot;&quot;}wpNavMenu.add_to_menu(d,m,e,j,p,n,f,o,k,g,h,i,l);a(this).attr(&quot;checked&quot;,false)})},get_hidden_inputs:function(l,b,m,c,h,n,d,o,j,g,f,e,k){var i=&quot;&quot;;i+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-db-id[]&quot; value=&quot;'+b+'&quot; /&gt;';i+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-object-id[]&quot; value=&quot;'+m+'&quot; /&gt;';i+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-object[]&quot; value=&quot;'+c+'&quot; /&gt;';i+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-type[]&quot; value=&quot;'+h+'&quot; /&gt;';i+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-parent-id[]&quot; value=&quot;'+n+'&quot; /&gt;';i+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-position[]&quot; value=&quot;'+l+'&quot; /&gt;';i+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-title[]&quot; value=&quot;'+d+'&quot; /&gt;';i+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-attr-title[]&quot; value=&quot;'+g+'&quot; /&gt;';i+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-url[]&quot; value=&quot;'+o+'&quot; /&gt;';i+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-target[]&quot; value=&quot;'+f+'&quot; /&gt;';i+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-description[]&quot; value=&quot;'+j+'&quot; /&gt;';i+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-classes[]&quot; value=&quot;'+e+'&quot; /&gt;';i+='&lt;input type=&quot;hidden&quot; name=&quot;menu-item-xfn[]&quot; value=&quot;'+k+'&quot; /&gt;';return i}};a(document).ready(function(b){wpNavMenu.init()})})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminnavmenusphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/nav-menus.php (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/nav-menus.php        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-admin/nav-menus.php        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -12,6 +12,9 @@
</span><span class="cx"> /** Load WordPress Administration Bootstrap */
</span><span class="cx"> require_once( 'admin.php' );
</span><span class="cx"> 
</span><ins>+// Load all the nav menu interface functions
+require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );
+
</ins><span class="cx"> // Permissions Check
</span><span class="cx"> if ( ! current_user_can('switch_themes') )
</span><span class="cx">         wp_die( __( 'Cheatin&amp;#8217; uh?' ));
</span><span class="lines">@@ -37,9 +40,6 @@
</span><span class="cx"> // Thickbox
</span><span class="cx"> add_thickbox();
</span><span class="cx"> 
</span><del>-// Load all the nav menu interface functions
-require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );
-
</del><span class="cx"> // Container for any messages displayed to the user
</span><span class="cx"> $messages_div = '';
</span><span class="cx"> 
</span><span class="lines">@@ -57,9 +57,15 @@
</span><span class="cx">                 check_admin_referer( 'delete-nav_menu-' . $nav_menu_selected_id );
</span><span class="cx"> 
</span><span class="cx">                 if ( is_nav_menu($nav_menu_selected_id) ) {
</span><del>-                        wp_delete_nav_menu( $nav_menu_selected_id );
-                        $messages_div = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . __('Menu successfully deleted.') . '&lt;/p&gt;&lt;/div&gt;';
-                        $nav_menu_selected_id = 0;
</del><ins>+                        $delete_nav_menu = wp_delete_nav_menu( $nav_menu_selected_id );
+                        
+                        if ( is_wp_error($delete_nav_menu) ) {
+                                $messages_div = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . $delete_nav_menu-&gt;get_error_message() . '&lt;/p&gt;&lt;/div&gt;';
+                        } else {
+                                $messages_div = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . __('The menu has been successfully deleted.') . '&lt;/p&gt;&lt;/div&gt;';
+                                $nav_menu_selected_id = 0; // Reset the selected menu
+                        }
+                        unset( $delete_nav_menu );
</ins><span class="cx">                 }
</span><span class="cx">                 break;
</span><span class="cx"> 
</span><span class="lines">@@ -75,36 +81,45 @@
</span><span class="cx">                                         $add_nav_menu = wp_create_nav_menu( $add_nav_menu );
</span><span class="cx"> 
</span><span class="cx">                                         if ( is_wp_error( $add_nav_menu ) ) {
</span><del>-                                                $messages_div = '&lt;div id=&quot;message&quot; class=&quot;error fade below-h2&quot;&gt;&lt;p&gt;' . $add_nav_menu-&gt;get_error_message() . '&lt;/p&gt;&lt;/div&gt;';
</del><ins>+                                                $messages_div = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . $add_nav_menu-&gt;get_error_message() . '&lt;/p&gt;&lt;/div&gt;';
</ins><span class="cx">                                         } else {
</span><span class="cx">                                                 $nav_menu_selected_id = $add_nav_menu-&gt;term_id;
</span><span class="cx">                                                 $nav_menu_selected_title = $add_nav_menu-&gt;name;
</span><del>-                                                $messages_div = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . sprintf( __('The &lt;strong&gt;%s&lt;/strong&gt; menu has been successfully created.'), esc_html( $add_nav_menu-&gt;name ) ) . '&lt;/p&gt;&lt;/div&gt;';
</del><ins>+                                                $messages_div = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . sprintf( __('The &lt;strong&gt;%s&lt;/strong&gt; menu has been successfully created.'), $add_nav_menu-&gt;name ) . '&lt;/p&gt;&lt;/div&gt;';
</ins><span class="cx">                                         }
</span><span class="cx">                                 } else {
</span><del>-                                        $messages_div = '&lt;div id=&quot;message&quot; class=&quot;error fade below-h2&quot;&gt;&lt;p&gt;' . __('Please enter a valid menu name.') . '&lt;/p&gt;&lt;/div&gt;';
</del><ins>+                                        $messages_div = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . __('Please enter a valid menu name.') . '&lt;/p&gt;&lt;/div&gt;';
</ins><span class="cx">                                 }
</span><del>-                                unset($add_nav_menu);
</del><ins>+                                unset( $add_nav_menu );
</ins><span class="cx">                         }
</span><span class="cx">                 } else {
</span><ins>+                        
+                        // @todo wrap this into wp_update_nav_menu_object();
</ins><span class="cx">                         if ( isset($_POST['menu-name']) ) {
</span><span class="cx">                                 $old_nav_menu = get_term( $nav_menu_selected_id, 'nav_menu', ARRAY_A );
</span><span class="cx">                                 $args = array( 'name' =&gt; $_POST['menu-name'], 'slug' =&gt; null, 'description' =&gt; $old_nav_menu['description'], 'parent' =&gt; $old_nav_menu['parent'], );
</span><span class="cx">                                 $new_nav_menu = wp_update_term( $nav_menu_selected_id, 'nav_menu', $args );
</span><span class="cx">                         }
</span><del>-
</del><ins>+                        
</ins><span class="cx">                         // Update menu items
</span><del>-                        $update_nav_items = isset( $_POST['li-count'] ) ? (int) $_POST['li-count'] : 0;
</del><ins>+                        
+                        // @todo: wrap update logic into wp_update_nav_menu();
+                        $update_count = isset( $_POST['li-count'] ) ? (int) $_POST['li-count'] : 0;
</ins><span class="cx">                         $update_nav_menu = is_nav_menu( $nav_menu_selected_id );
</span><span class="cx"> 
</span><span class="cx">                         if ( !is_wp_error($update_nav_menu) ) {
</span><span class="cx">                                 $menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array('orderby' =&gt; 'ID', 'output' =&gt; ARRAY_A, 'output_key' =&gt; 'ID') );
</span><del>-                                $parent_menu_ids = array();
-
</del><ins>+                                
</ins><span class="cx">                                 // Loop through all POST variables
</span><del>-                                for ( $k = 0; $k &lt; $update_nav_items; $k++ ) {
</del><ins>+                                for ( $k = 0; $k &lt; $update_count; $k++ ) {
+                                        
+                                        // Menu item title can't be blank
+                                        if ( '' == $_POST['menu-item-title'][$k] )
+                                                continue;
+                                        
</ins><span class="cx">                                         $menu_item_db_id       = isset( $_POST['menu-item-db-id'][$k] )       ? $_POST['menu-item-db-id'][$k]       : 0;
</span><span class="cx">                                         $menu_item_object_id   = isset( $_POST['menu-item-object-id'][$k] )   ? $_POST['menu-item-object-id'][$k]   : 0;
</span><ins>+                                        $menu_item_object      = isset( $_POST['menu-item-object'][$k] )      ? $_POST['menu-item-object'][$k]      : '';
</ins><span class="cx">                                         $menu_item_parent_id   = isset( $_POST['menu-item-parent-id'][$k] )   ? $_POST['menu-item-parent-id'][$k]   : 0;
</span><span class="cx">                                         $menu_item_position    = isset( $_POST['menu-item-position'][$k] )    ? $_POST['menu-item-position'][$k]    : 0;
</span><span class="cx">                                         $menu_item_type        = isset( $_POST['menu-item-type'][$k] )        ? $_POST['menu-item-type'][$k]        : 'custom';
</span><span class="lines">@@ -113,41 +128,40 @@
</span><span class="cx">                                         $menu_item_url         = isset( $_POST['menu-item-url'][$k] )         ? $_POST['menu-item-url'][$k]         : '';
</span><span class="cx">                                         $menu_item_description = isset( $_POST['menu-item-description'][$k] ) ? $_POST['menu-item-description'][$k] : '';
</span><span class="cx">                                         $menu_item_attr_title  = isset( $_POST['menu-item-attr-title'][$k] )  ? $_POST['menu-item-attr-title'][$k]  : '';
</span><del>-                                        $menu_item_target      = isset( $_POST['menu-item-target'][$k] )      ? $_POST['menu-item-target'][$k]      : 0;
</del><ins>+                                        $menu_item_target      = isset( $_POST['menu-item-target'][$k] )      ? $_POST['menu-item-target'][$k]      : '_self';
</ins><span class="cx">                                         $menu_item_classes     = isset( $_POST['menu-item-classes'][$k] )     ? $_POST['menu-item-classes'][$k]     : '';
</span><span class="cx">                                         $menu_item_xfn         = isset( $_POST['menu-item-xfn'][$k] )         ? $_POST['menu-item-xfn'][$k]         : '';
</span><span class="cx"> 
</span><del>-                                        // Menu item title can't be blank
-                                        if ( '' == $menu_item_title )
-                                                continue;
-
-                                        // Populate the menu item
-                                        $post = array( 'post_status' =&gt; 'publish', 'post_type' =&gt; 'nav_menu_item', 'post_author' =&gt; $user_ID,
-                                                'ping_status' =&gt; 0, 'post_parent' =&gt; $menu_item_parent_id, 'menu_order' =&gt; $menu_item_position,
-                                                'post_excerpt' =&gt; $menu_item_attr_title, 'tax_input' =&gt; array( 'nav_menu' =&gt; $update_nav_menu-&gt;name ),
-                                                'post_content' =&gt; $menu_item_description, 'post_title' =&gt; $menu_item_title );
-
</del><ins>+                                        // Populate the menu item object
+                                        $post = array(
+                                                'post_status' =&gt; 'publish', 'post_type' =&gt; 'nav_menu_item', 'ping_status' =&gt; 0,
+                                                'post_author' =&gt; $user_ID, 'tax_input' =&gt; array( 'nav_menu' =&gt; $update_nav_menu-&gt;name ),
+                                                'post_title' =&gt; $menu_item_title, 'post_excerpt' =&gt; $menu_item_attr_title,
+                                                'post_parent' =&gt; $menu_item_parent_id, 'menu_order' =&gt; $menu_item_position,
+                                                'post_content' =&gt; $menu_item_description,
+                                        );
+                                        
</ins><span class="cx">                                         // New menu item
</span><span class="cx">                                         if ( $menu_item_db_id == 0 ) {
</span><span class="cx">                                                 $menu_item_db_id = wp_insert_post( $post );
</span><del>-                                        } elseif ( isset( $menu_items[$menu_item_db_id] ) ) {
</del><ins>+                                        
+                                        // Update existing menu item
+                                        } elseif ( isset($menu_items[$menu_item_db_id]) || ( 'custom' == $menu_item_type &amp;&amp; 0 != $menu_item_db_id ) ) {
</ins><span class="cx">                                                 $post['ID'] = $menu_item_db_id;
</span><span class="cx">                                                 wp_update_post( $post );
</span><span class="cx">                                                 unset( $menu_items[$menu_item_db_id] );
</span><span class="cx">                                         }
</span><del>-                                        $parent_menu_ids[$k] = $menu_item_db_id;
</del><span class="cx"> 
</span><del>-                                        // @todo sanitize type append and ID.
-                                        update_post_meta( $menu_item_db_id, 'menu_item_type', $menu_item_type );
-                                        update_post_meta( $menu_item_db_id, 'menu_item_append', $menu_item_append );
-                                        update_post_meta( $menu_item_db_id, 'menu_item_object_id', $menu_item_object_id );
-                                        update_post_meta( $menu_item_db_id, 'menu_item_target', sanitize_key($menu_item_target) );
</del><ins>+                                        update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key($menu_item_type) );
+                                        update_post_meta( $menu_item_db_id, '_menu_item_object_id', (int) $menu_item_object_id );
+                                        update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key($menu_item_object) );
+                                        update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key($menu_item_target) );
</ins><span class="cx">                                         // @todo handle sanitizing multiple classes separated by whitespace.
</span><del>-                                        update_post_meta( $menu_item_db_id, 'menu_item_classes', sanitize_html_class($menu_item_classes) );
-                                        update_post_meta( $menu_item_db_id, 'menu_item_xfn', sanitize_html_class($menu_item_xfn) );
</del><ins>+                                        update_post_meta( $menu_item_db_id, '_menu_item_classes', sanitize_html_class($menu_item_classes) );
+                                        update_post_meta( $menu_item_db_id, '_menu_item_xfn', sanitize_html_class($menu_item_xfn) );
</ins><span class="cx"> 
</span><span class="cx">                                         // @todo: only save custom link urls.
</span><del>-                                        update_post_meta( $menu_item_db_id, 'menu_item_url', esc_url_raw( $menu_item_url ) );
</del><ins>+                                        update_post_meta( $menu_item_db_id, '_menu_item_url', esc_url_raw($menu_item_url) );
</ins><span class="cx">                                 }
</span><span class="cx"> 
</span><span class="cx">                                 // Remove menu items from the menu that weren't in $_POST
</span><span class="lines">@@ -156,7 +170,11 @@
</span><span class="cx">                                                 wp_delete_post( $menu_item_id );
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><del>-                                $messages_div = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . __('The menu has been updated.') . '&lt;/p&gt;&lt;/div&gt;';
</del><ins>+                                
+                                do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
+                                
+                                $messages_div = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . sprintf( __('The &lt;strong&gt;%s&lt;/strong&gt; menu has been updated.'), $update_nav_menu-&gt;name ) . '&lt;/p&gt;&lt;/div&gt;';
+                                unset( $update_nav_menu, $update_count, $menu_items );
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">                 break;
</span><span class="lines">@@ -190,15 +208,24 @@
</span><span class="cx">         $nav_menu_selected_title = $nav_menu_selected_title-&gt;name;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// Create Menu Metabox
+add_meta_box( 'create-menu', __('Create Menu'), 'wp_nav_menu_create_metabox', 'nav-menus', 'side', 'core' );
+
</ins><span class="cx"> // The user has no menus.
</span><span class="cx"> if ( !is_nav_menu( $nav_menu_selected_id ) ) {
</span><del>-        if ( current_theme_supports('nav-menus') ) {
-                $messages_div = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . __('You do not have any menus. Create a new menu.') . '&lt;/p&gt;&lt;/div&gt;';
-        } else {
-                $messages_div = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . __('The current theme does not support menus.') . '&lt;/p&gt;&lt;/div&gt;';
-        }
</del><ins>+        $messages_div = '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . __('You do not have any menus. Create a new menu.') . '&lt;/p&gt;&lt;/div&gt;';
+        
+// The theme supports menus
+} elseif ( current_theme_supports('nav-menus') ) {
+        
+        // Register nav menu metaboxes
+        add_meta_box( 'manage-menu', __( 'Menu Settings' ), 'wp_nav_menu_manage_menu_metabox', 'nav-menus', 'side', 'high', array( $nav_menu_selected_id, $nav_menu_selected_title ) );
+        wp_nav_menu_metaboxes_setup();
+
+// The theme does not support menus
</ins><span class="cx"> } else {
</span><del>-        add_meta_box( 'manage-menu', __( 'Menu Settings' ), 'wp_nav_menu_manage_menu_metabox', 'menus', 'side', 'high', array( $nav_menu_selected_id, $nav_menu_selected_title ) );
</del><ins>+        remove_meta_box( 'create-menu', 'nav-menus', 'side' );
+        $messages_div = '&lt;div id=&quot;message&quot; class=&quot;error&quot;&gt;&lt;p&gt;' . __('The current theme does not support menus.') . '&lt;/p&gt;&lt;/div&gt;';
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Get the admin header
</span><span class="lines">@@ -210,7 +237,7 @@
</span><span class="cx">         &lt;?php echo $messages_div; ?&gt;
</span><span class="cx">         &lt;div class=&quot;hide-if-js error&quot;&gt;&lt;p&gt;&lt;?php _e('You do not have JavaScript enabled in your browser. Please enable it to access the Menus functionality.'); ?&gt;&lt;/p&gt;&lt;/div&gt;
</span><span class="cx"> 
</span><del>-        &lt;?php if ( !empty($nav_menus) &amp;&amp; count($nav_menus) &gt; 1 ) : ?&gt;
</del><ins>+        &lt;?php if ( !empty($nav_menus) &amp;&amp; count($nav_menus) &gt; 1 &amp;&amp; current_theme_supports('nav-menus') ) : ?&gt;
</ins><span class="cx">         &lt;ul class=&quot;subsubsub&quot;&gt;
</span><span class="cx">                 &lt;?php
</span><span class="cx">                         foreach ( $nav_menus as $_nav_menu ) {
</span><span class="lines">@@ -226,35 +253,30 @@
</span><span class="cx">         &lt;?php endif; ?&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;div id=&quot;menu-management&quot; class=&quot;metabox-holder has-right-sidebar&quot;&gt;
</span><del>-                &lt;form id=&quot;update-nav-menu&quot; onsubmit=&quot;wp_update_post_data();&quot; action=&quot;&lt;?php echo admin_url( 'nav-menus.php' ); ?&gt;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
</del><ins>+                &lt;form id=&quot;update-nav-menu&quot; action=&quot;&lt;?php echo admin_url( 'nav-menus.php' ); ?&gt;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
</ins><span class="cx">                         &lt;?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?&gt;
</span><span class="cx">                         &lt;?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?&gt;
</span><span class="cx">                         &lt;?php wp_nonce_field( 'update-nav_menu' ); ?&gt;
</span><span class="cx">                         &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;update&quot; /&gt;
</span><del>-                        &lt;input type=&quot;hidden&quot; name=&quot;li-count&quot; id=&quot;li-count&quot; value=&quot;0&quot; /&gt;
</del><ins>+                        &lt;input type=&quot;hidden&quot; name=&quot;li-count&quot; id=&quot;li-count&quot; value=&quot;-1&quot; /&gt;
</ins><span class="cx">                         &lt;input type=&quot;hidden&quot; name=&quot;menu&quot; id=&quot;menu&quot; value=&quot;&lt;?php echo esc_attr( $nav_menu_selected_id ); ?&gt;&quot; /&gt;
</span><del>-
</del><ins>+                        &lt;input type=&quot;hidden&quot; id=&quot;hidden-metaboxes&quot; value=&quot;&lt;?php echo wp_initial_nav_menu_meta_boxes(); ?&gt;&quot; /&gt;
</ins><span class="cx">                         &lt;div id=&quot;post-body&quot;&gt;
</span><span class="cx">                                 &lt;div id=&quot;post-body-content&quot;&gt;
</span><del>-                                        &lt;?php if ( is_nav_menu($nav_menu_selected_id) ) : ?&gt;
</del><ins>+                                        &lt;?php if ( is_nav_menu($nav_menu_selected_id) &amp;&amp; current_theme_supports('nav-menus') ) : ?&gt;
</ins><span class="cx">                                                 &lt;div id=&quot;menu-container&quot; class=&quot;postbox&quot;&gt;
</span><span class="cx">                                                         &lt;h3 class=&quot;hndle&quot;&gt;&lt;?php echo esc_html( $nav_menu_selected_title ); ?&gt;&lt;/h3&gt;
</span><span class="cx">                                                         &lt;div class=&quot;inside&quot;&gt;
</span><del>-
</del><span class="cx">                                                                 &lt;?php echo wp_get_nav_menu( array( 'context' =&gt; 'backend', 'menu' =&gt; $nav_menu_selected_id ) ); ?&gt;
</span><del>-
</del><span class="cx">                                                         &lt;/div&gt;&lt;!-- /.inside --&gt;
</span><span class="cx">                                                 &lt;!-- /#nav-menu-canvas .postbox--&gt;
</span><span class="cx">                                                 &lt;/div&gt;
</span><del>-                                                &lt;script type=&quot;text/javascript&quot;&gt;
-                                                        wp_update_post_data();
-                                                &lt;/script&gt;
</del><span class="cx">                                         &lt;?php endif; ?&gt;
</span><span class="cx">                                 &lt;/div&gt;&lt;!-- /#post-body-content--&gt;
</span><span class="cx">                         &lt;/div&gt;&lt;!--- /#post-body --&gt;
</span><span class="cx">                         &lt;div id=&quot;menu-settings-column&quot; class=&quot;inner-sidebar&quot;&gt;
</span><span class="cx"> 
</span><del>-                                &lt;?php do_meta_boxes( 'menus', 'side', null ); ?&gt;
</del><ins>+                                &lt;?php do_meta_boxes( 'nav-menus', 'side', null ); ?&gt;
</ins><span class="cx"> 
</span><span class="cx">                         &lt;/div&gt;&lt;!-- /#menu-settings-column --&gt;
</span><span class="cx">                 &lt;/form&gt;&lt;!--/#update-nav-menu--&gt;
</span></span></pre></div>
<a id="trunkwpincludesclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/classes.php (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/classes.php        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-includes/classes.php        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -934,7 +934,7 @@
</span><span class="cx">                         else
</span><span class="cx">                                 $children_elements[ $e-&gt;$parent_field ][] = $e;
</span><span class="cx">                 }
</span><del>-
</del><ins>+                
</ins><span class="cx">                 /*
</span><span class="cx">                  * when none of the elements is top level
</span><span class="cx">                  * assume the first one must be root of the sub elements
</span><span class="lines">@@ -1124,6 +1124,102 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * Create HTML list of nav menu items.
+ *
+ * @package WordPress
+ * @since 3.0.0
+ * @uses Walker
+ */
+class Walker_Nav_Menu extends Walker {
+        /**
+         * @see Walker::$tree_type
+         * @since 3.0.0
+         * @var string
+         */
+        var $tree_type = array( 'post_type', 'taxonomy', 'custom' );
+
+        /**
+         * @see Walker::$db_fields
+         * @since 3.0.0
+         * @todo Decouple this.
+         * @var array
+         */
+        var $db_fields = array( 'parent' =&gt; 'post_parent', 'id' =&gt; 'object_id' );
+
+        /**
+         * @see Walker::start_lvl()
+         * @since 3.0.0
+         *
+         * @param string $output Passed by reference. Used to append additional content.
+         * @param int $depth Depth of page. Used for padding.
+         */
+        function start_lvl(&amp;$output, $depth) {
+                $indent = str_repeat(&quot;\t&quot;, $depth);
+                $output .= &quot;\n$indent&lt;ul class=\&quot;sub-menu\&quot;&gt;\n&quot;;
+        }
+
+        /**
+         * @see Walker::end_lvl()
+         * @since 3.0.0
+         *
+         * @param string $output Passed by reference. Used to append additional content.
+         * @param int $depth Depth of page. Used for padding.
+         */
+        function end_lvl(&amp;$output, $depth) {
+                $indent = str_repeat(&quot;\t&quot;, $depth);
+                $output .= &quot;$indent&lt;/ul&gt;\n&quot;;
+        }
+
+        /**
+         * @see Walker::start_el()
+         * @since 3.0.0
+         *
+         * @param string $output Passed by reference. Used to append additional content.
+         * @param object $item Menu item data object.
+         * @param int $depth Depth of menu item. Used for padding.
+         * @param int $current_page Menu item ID.
+         * @param array $args
+         */
+        function start_el(&amp;$output, $item, $depth, $args) {
+                $indent = ( $depth ) ? str_repeat( &quot;\t&quot;, $depth ) : '';
+                
+                if ( 'frontend' == $args-&gt;context ) {
+                        global $wp_query;
+                        
+                        $css_class = array( 'menu-item', 'menu-item-type-'. $item-&gt;type, $item-&gt;classes );
+                        
+                        if ( 'custom' != $item-&gt;object )
+                                $css_class[] = 'menu-item-object-'. $item-&gt;object;
+                        
+                        if ( $item-&gt;object_id == $wp_query-&gt;get_queried_object_id() )
+                                $css_class[] = 'current-menu-item';
+                        
+                        // @todo add classes for parent/child relationships
+
+                        $css_class = join( ' ', apply_filters('nav_menu_css_class', $css_class, $item) );
+                }
+                        
+                $maybe_value = ( 'backend' == $args-&gt;context ) ? ' value=&quot;'. $item-&gt;ID .'&quot;' : '';
+                $maybe_classes = ( 'frontend' == $args-&gt;context ) ? ' class=&quot;'. $css_class .'&quot;' : '';
+                
+                $output .= $indent . '&lt;li id=&quot;menu-item-'. $item-&gt;ID .'&quot;'. $maybe_value . $maybe_classes .'&gt;' . wp_get_nav_menu_item( $item, $args-&gt;context, $args );
+        }
+
+        /**
+         * @see Walker::end_el()
+         * @since 3.0.0
+         *
+         * @param string $output Passed by reference. Used to append additional content.
+         * @param object $item Page data object. Not used.
+         * @param int $depth Depth of page. Not Used.
+         */
+        function end_el(&amp;$output, $item, $depth) {
+                $output .= &quot;&lt;/li&gt;\n&quot;;
+        }
+
+}
+
+/**
</ins><span class="cx">  * Create HTML list of pages.
</span><span class="cx">  *
</span><span class="cx">  * @package WordPress
</span></span></pre></div>
<a id="trunkwpincludesnavmenutemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/nav-menu-template.php (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/nav-menu-template.php        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-includes/nav-menu-template.php        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -9,13 +9,11 @@
</span><span class="cx">  * menu_class - CSS class to use for the div container of the menu list. Defaults to 'menu'.
</span><span class="cx">  * format - Whether to format the ul. Defaults to 'div'.
</span><span class="cx">  * fallback_cb - If the menu doesn't exists, a callback function will fire. Defaults to 'wp_page_menu'.
</span><del>- * before_link - Output text before the link.
- * after_link - Output text after the link.
- * before_title - Output text before the link text.
- * before_title - Output text after the link text.
</del><ins>+ * before - Text before the link text.
+ * after - Text after the link text.
+ * link_before - Text before the link.
+ * link_after - Text after the link.
</ins><span class="cx">  * echo - Whether to echo the menu or return it. Defaults to echo.
</span><del>- *
- * TODO:
</del><span class="cx">  * show_home - If you set this argument, then it will display the link to the home page. The show_home argument really just needs to be set to the value of the text of the link.
</span><span class="cx">  *
</span><span class="cx">  * @since 3.0.0
</span><span class="lines">@@ -24,7 +22,8 @@
</span><span class="cx">  */
</span><span class="cx"> function wp_nav_menu( $args = array() ) {
</span><span class="cx">         $defaults = array( 'menu' =&gt; '', 'container' =&gt; 'div', 'container_class' =&gt; '', 'menu_class' =&gt; 'menu', 'echo' =&gt; true,
</span><del>-        'fallback_cb' =&gt; 'wp_page_menu', 'before_link' =&gt; '', 'after_link' =&gt; '', 'before_title' =&gt; '', 'after_title' =&gt; '', );
</del><ins>+        'fallback_cb' =&gt; 'wp_page_menu', 'before' =&gt; '', 'after' =&gt; '', 'link_before' =&gt; '', 'link_after' =&gt; '',
+        'depth' =&gt; 0, 'walker' =&gt; '' );
</ins><span class="cx"> 
</span><span class="cx">         $args = wp_parse_args( $args, $defaults );
</span><span class="cx">         $args = apply_filters( 'wp_nav_menu_args', $args );
</span><span class="lines">@@ -83,8 +82,8 @@
</span><span class="cx">  * @return mixed $output False if menu doesn't exists, else, returns the menu.
</span><span class="cx">  **/
</span><span class="cx"> function wp_get_nav_menu( $args = array() ) {
</span><del>-        $defaults = array( 'menu' =&gt; '', 'menu_class' =&gt; 'menu', 'context' =&gt; 'frontend',
-        'fallback_cb' =&gt; '', 'before_link' =&gt; '', 'after_link' =&gt; '', 'before_title' =&gt; '', 'after_title' =&gt; '', );
</del><ins>+        $defaults = array( 'menu' =&gt; '', 'menu_class' =&gt; 'menu', 'context' =&gt; 'frontend', 'depth' =&gt; 0,
+        'fallback_cb' =&gt; '', 'walker' =&gt; '', 'before' =&gt; '', 'after' =&gt; '', 'link_before' =&gt; '', 'link_after' =&gt; '', );
</ins><span class="cx">         
</span><span class="cx">         $args = wp_parse_args( $args, $defaults );
</span><span class="cx">         $args = apply_filters( 'wp_get_nav_menu_args', $args );
</span><span class="lines">@@ -93,55 +92,28 @@
</span><span class="cx">         // Variable setup
</span><span class="cx">         $nav_menu = '';
</span><span class="cx">         $items = '';
</span><del>-        $current_parent = 0;
-        $parent_stack = array();
-        $parent_menu_order = array();
</del><span class="cx">         
</span><span class="cx">         // Get the menu object
</span><span class="cx">         $menu = wp_get_nav_menu_object( $args-&gt;menu );
</span><span class="cx">         
</span><span class="cx">         // If the menu exists, get it's items.
</span><span class="cx">         if ( $menu &amp;&amp; !is_wp_error($menu) )
</span><del>-                $menu_items = wp_get_nav_menu_items( $menu-&gt;term_id, 'backend' );
</del><ins>+                $menu_items = wp_get_nav_menu_items( $menu-&gt;term_id, $args-&gt;context );
</ins><span class="cx">         
</span><span class="cx">         // If no menu was found or if the menu has no items, call the fallback_cb
</span><span class="cx">         if ( !$menu || is_wp_error($menu) || ( isset($menu_items) &amp;&amp; empty($menu_items) ) ) {
</span><del>-                if ( function_exists($args-&gt;fallback_cb) ) {
-                        $_args = array_merge( (array)$args, array('echo' =&gt; false) );
</del><ins>+                if ( function_exists($args-&gt;fallback_cb) || is_callable( $args-&gt;fallback_cb ) ) {
+                        $_args = array_merge( (array) $args, array('echo' =&gt; false) );
</ins><span class="cx">                         return call_user_func( $args-&gt;fallback_cb, $_args );
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-        
-        foreach ( $menu_items as $key =&gt; $menu_item ) {
-                // Set up the $menu_item variables
-                $menu_item = wp_setup_nav_menu_item( $menu_item, 'frontend' );
-
-                $type = $menu_item-&gt;append;
-                $maybe_value = 'frontend' == $args-&gt;context ? '' : ' value=&quot;'. $menu_item-&gt;ID .'&quot;';
-                $classes = 'frontend' == $args-&gt;context ? ' class=&quot;menu-item-type-'. $type . $menu_item-&gt;li_class .'&quot;' : '';
</del><span class="cx">                 
</span><del>-                $items .= '&lt;li id=&quot;menu-item-'. $menu_item-&gt;ID .'&quot;'. $maybe_value . $classes .'&gt;';
-                $items .= wp_get_nav_menu_item( $menu_item, $args-&gt;context, $args );
-                
-                // Indent children
-                $last_item = ( count( $menu_items ) == $menu_item-&gt;menu_order );
-                if ( $last_item || $current_parent != $menu_items[$key + 1]-&gt;post_parent ) {
-                        if ( $last_item || in_array( $menu_items[$key + 1]-&gt;post_parent, $parent_stack ) ) {
-                                $items .= '&lt;/li&gt;';
-                                while ( !empty( $parent_stack ) &amp;&amp; ($last_item || $menu_items[$key + 1]-&gt;post_parent != $current_parent ) ) {
-                                        $items .= '&lt;/ul&gt;&lt;/li&gt;';
-                                        $current_parent = array_pop( $parent_stack );
-                                }
-                        } else {
-                                array_push( $parent_stack, $current_parent );
-                                $current_parent = $menu_item-&gt;ID;
-                                $items .= '&lt;ul class=&quot;sub-menu&quot;&gt;';
-                        }
-                } else {
-                        $items .= '&lt;/li&gt;';
-                }
-        }
</del><ins>+        // Set up the $menu_item variables
+        foreach ( (array) $menu_items as $key =&gt; $menu_item )
+                $menu_items[$menu_item-&gt;menu_order] = wp_setup_nav_menu_item( $menu_item, 'frontend' );
</ins><span class="cx">         
</span><ins>+        $items .= walk_nav_menu_tree( $menu_items, $args-&gt;depth, $args );
+        
</ins><span class="cx">         // CSS class
</span><span class="cx">         $ul_class = $args-&gt;menu_class ? ' class=&quot;'. $args-&gt;menu_class .'&quot;' : '';
</span><span class="cx">         $nav_menu .= '&lt;ul'. $ul_class .'&gt;';
</span><span class="lines">@@ -174,93 +146,68 @@
</span><span class="cx">         $output = '';
</span><span class="cx">         switch ( $context ) {
</span><span class="cx">                 case 'frontend':
</span><del>-                        $attributes  = ( isset($menu_item-&gt;anchor_title) &amp;&amp; '' != $menu_item-&gt;anchor_title ) ? ' title=&quot;'. esc_attr($menu_item-&gt;anchor_title) .'&quot;' : '';
</del><ins>+                        $attributes  = ( isset($menu_item-&gt;attr_title) &amp;&amp; '' != $menu_item-&gt;attr_title ) ? ' title=&quot;'. esc_attr($menu_item-&gt;attr_title) .'&quot;' : '';
</ins><span class="cx">                         $attributes .= ( isset($menu_item-&gt;target) &amp;&amp; '' != $menu_item-&gt;target ) ? ' target=&quot;'. esc_attr($menu_item-&gt;target) .'&quot;' : '';
</span><del>-                        $attributes .= ( isset($menu_item-&gt;classes) &amp;&amp; '' != $menu_item-&gt;classes ) ? ' class=&quot;'. esc_attr($menu_item-&gt;classes) .'&quot;' : '';
</del><span class="cx">                         $attributes .= ( isset($menu_item-&gt;xfn) &amp;&amp; '' != $menu_item-&gt;xfn ) ? ' rel=&quot;'. esc_attr($menu_item-&gt;xfn) .'&quot;' : '';
</span><span class="cx">                         $attributes .= ( isset($menu_item-&gt;url) &amp;&amp; '' != $menu_item-&gt;url ) ? ' href=&quot;'. esc_attr($menu_item-&gt;url) .'&quot;' : '';
</span><span class="cx">                         
</span><del>-                        $output .= esc_html( $args-&gt;before_link );
</del><ins>+                        $output .= esc_html( $args-&gt;before );
</ins><span class="cx">                         $output .= '&lt;a'. $attributes .'&gt;';
</span><del>-                        $output .= esc_html( $args-&gt;before_title . $menu_item-&gt;title . $args-&gt;after_title );
</del><ins>+                        $output .= esc_html( $args-&gt;link_before . apply_filters('the_title', $menu_item-&gt;title) . $args-&gt;link_after );
</ins><span class="cx">                         $output .= '&lt;/a&gt;';
</span><del>-                        $output .= esc_html( $args-&gt;after_link );
</del><ins>+                        $output .= esc_html( $args-&gt;after );
</ins><span class="cx">                         
</span><span class="cx">                         break;
</span><span class="cx">                 
</span><span class="cx">                 case 'backend':
</span><span class="cx">                         $output .= '&lt;dl&gt;&lt;dt&gt;';
</span><del>-                        $output .= '&lt;span class=&quot;item-title&quot;&gt;'. esc_html($menu_item-&gt;title) .'&lt;/span&gt;';
</del><ins>+                        $output .= '&lt;span class=&quot;item-title&quot;&gt;'. esc_html( $menu_item-&gt;title ) .'&lt;/span&gt;';
</ins><span class="cx">                         $output .= '&lt;span class=&quot;item-controls&quot;&gt;';
</span><del>-                        if ( 'custom' == $menu_item-&gt;type ) {
-                                $label = __('Custom');
-                        } elseif ( 'post_type' == $menu_item-&gt;type ) {
-                                $type_obj = get_post_type_object($menu_item-&gt;append);
-                                $label = $type_obj-&gt;singular_label;
-                        } elseif ( 'taxonomy' == $menu_item-&gt;type ) {
-                                $taxonomy = get_taxonomy($menu_item-&gt;append);
-                                $label = $taxonomy-&gt;singular_label;
-                        } else {
-                                $label = $menu_item-&gt;append;
-                        }
-                        $output .= '&lt;span class=&quot;item-type&quot;&gt;'. esc_html($label) .'&lt;/span&gt;';
</del><ins>+                        $output .= '&lt;span class=&quot;item-type&quot;&gt;'. esc_html( $menu_item-&gt;append ) .'&lt;/span&gt;';
</ins><span class="cx">                         
</span><span class="cx">                         // Actions
</span><del>-                        $output .= '&lt;a class=&quot;item-edit thickbox&quot; id=&quot;edit'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; title=&quot;'. __('Edit Menu Item') .'&quot; href=&quot;#TB_inline?height=540&amp;width=300&amp;inlineId=menu-item-settings&quot;&gt;'. __('Edit') .'&lt;/a&gt; | ';
-                        $output .= '&lt;a class=&quot;item-delete&quot; id=&quot;delete'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;menu_order ) .'&quot;&gt;'. __('Delete') .'&lt;/a&gt;';
</del><ins>+                        $output .= '&lt;a class=&quot;item-edit thickbox&quot; id=&quot;edit-'. esc_attr( $menu_item-&gt;ID ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;ID ) .'&quot; title=&quot;'. __('Edit Menu Item') .'&quot; href=&quot;#TB_inline?height=540&amp;width=300&amp;inlineId=menu-item-settings&quot;&gt;'. __('Edit') .'&lt;/a&gt; | ';
+                        $output .= '&lt;a class=&quot;item-delete&quot; id=&quot;delete-'. esc_attr( $menu_item-&gt;ID ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;ID ) .'&quot;&gt;'. __('Delete') .'&lt;/a&gt;';
</ins><span class="cx">                         
</span><del>-                        $output .= '&lt;/dt&gt;&lt;/dl&gt;';
</del><ins>+                        $output .= '&lt;/span&gt;&lt;/dt&gt;&lt;/dl&gt;';
</ins><span class="cx">                         
</span><span class="cx">                         // Menu Item Settings
</span><del>-                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-db-id[]&quot; id=&quot;menu-item-db-id'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;ID ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-object-id[]&quot; id=&quot;menu-item-object-id'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;object_id ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-parent-id[]&quot; id=&quot;menu-item-parent-id'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;post_parent ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-position[]&quot; id=&quot;menu-item-position'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-type[]&quot; id=&quot;menu-item-type'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;type ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-append[]&quot; id=&quot;menu-item-append'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;append ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-title[]&quot; id=&quot;menu-item-title'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;title ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-url[]&quot; id=&quot;menu-item-url'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;url ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-description[]&quot; id=&quot;menu-item-description'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;description ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-classes[]&quot; id=&quot;menu-item-classes'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;classes ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-xfn[]&quot; id=&quot;menu-item-xfn'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;xfn ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-attr-title[]&quot; id=&quot;menu-item-attr-title'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'.esc_attr( $menu_item-&gt;post_excerpt )  .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-target[]&quot; id=&quot;menu-item-target'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;target ) .'&quot; /&gt;';
</del><ins>+                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-db-id[]&quot; value=&quot;'. esc_attr( $menu_item-&gt;ID ) .'&quot; /&gt;';
+                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-object-id[]&quot; value=&quot;'. esc_attr( $menu_item-&gt;object_id ) .'&quot; /&gt;';
+                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-object[]&quot; value=&quot;'. esc_attr( $menu_item-&gt;object ) .'&quot; /&gt;';
+                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-parent-id[]&quot; value=&quot;'. esc_attr( $menu_item-&gt;post_parent ) .'&quot; /&gt;';
+                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-position[]&quot; value=&quot;'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; /&gt;';
+                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-type[]&quot; value=&quot;'. esc_attr( $menu_item-&gt;type ) .'&quot; /&gt;';
+                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-title[]&quot; value=&quot;'. esc_attr( $menu_item-&gt;title ) .'&quot; /&gt;';
+                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-url[]&quot; value=&quot;'. esc_attr( $menu_item-&gt;url ) .'&quot; /&gt;';
+                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-description[]&quot; value=&quot;'. esc_attr( $menu_item-&gt;description ) .'&quot; /&gt;';
+                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-classes[]&quot; value=&quot;'. esc_attr( $menu_item-&gt;classes ) .'&quot; /&gt;';
+                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-xfn[]&quot; value=&quot;'. esc_attr( $menu_item-&gt;xfn ) .'&quot; /&gt;';
+                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-attr-title[]&quot; value=&quot;'.esc_attr( $menu_item-&gt;post_excerpt )  .'&quot; /&gt;';
+                        $output .= '&lt;input type=&quot;hidden&quot; name=&quot;menu-item-target[]&quot; value=&quot;'. esc_attr( $menu_item-&gt;target ) .'&quot; /&gt;';
</ins><span class="cx">                         break;
</span><span class="cx">                 
</span><span class="cx">                 case 'custom':
</span><del>-                        $menu_id = 'menu-item-' . $menu_item-&gt;db_id;
-                        $output .= '&lt;label class=&quot;menu-item-title&quot;&gt;&lt;input type=&quot;checkbox&quot; id=&quot;'. esc_attr( $menu_id ) .'&quot; name=&quot;'. esc_attr( $menu_item-&gt;title ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;url ) .'&quot; /&gt;'. $menu_item-&gt;title .'&lt;/label&gt;';
</del><ins>+                case 'taxonomy':
+                case 'post_type':
+                        $output .= '&lt;label class=&quot;menu-item-title&quot;&gt;&lt;input type=&quot;checkbox&quot; id=&quot;'. esc_attr( 'menu-item-' . $menu_item-&gt;object_id ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;url ) .'&quot; /&gt;'. $menu_item-&gt;title .'&lt;/label&gt;';
</ins><span class="cx">                         
</span><span class="cx">                         // Menu item hidden fields
</span><del>-                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-db-id&quot; value=&quot;'. esc_attr( $menu_item-&gt;db_id ) .'&quot; /&gt;';
</del><ins>+                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-db-id&quot; value=&quot;0&quot; /&gt;';
</ins><span class="cx">                         $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-object-id&quot; value=&quot;'. esc_attr( $menu_item-&gt;object_id ) .'&quot; /&gt;';
</span><del>-                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-parent-id&quot; value=&quot;'. esc_attr( $menu_item-&gt;parent_id ) .'&quot; /&gt;';
</del><ins>+                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-object&quot; value=&quot;'. esc_attr( $menu_item-&gt;object ) .'&quot; /&gt;';
+                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-parent-id&quot; value=&quot;'. esc_attr( $menu_item-&gt;post_parent ) .'&quot; /&gt;';
</ins><span class="cx">                         $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-type&quot; value=&quot;'. esc_attr( $menu_item-&gt;type ) .'&quot; /&gt;';
</span><span class="cx">                         $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-append&quot; value=&quot;'. esc_attr( $menu_item-&gt;append ) .'&quot; /&gt;';
</span><span class="cx">                         $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-title&quot; value=&quot;'. esc_attr( $menu_item-&gt;title ) .'&quot; /&gt;';
</span><span class="cx">                         $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-url&quot; value=&quot;'. esc_attr( $menu_item-&gt;url ) .'&quot; /&gt;';
</span><ins>+                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-append&quot; value=&quot;'. esc_attr( $menu_item-&gt;append ) .'&quot; /&gt;';
</ins><span class="cx">                         $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-target&quot; value=&quot;'. esc_attr( $menu_item-&gt;target ) .'&quot; /&gt;';
</span><span class="cx">                         $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-attr_title&quot; value=&quot;'. esc_attr( $menu_item-&gt;attr_title ) .'&quot; /&gt;';
</span><span class="cx">                         $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-description&quot; value=&quot;'. esc_attr( $menu_item-&gt;description ) .'&quot; /&gt;';
</span><span class="cx">                         $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-classes&quot; value=&quot;'. esc_attr( $menu_item-&gt;classes ) .'&quot; /&gt;';
</span><span class="cx">                         $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-xfn&quot; value=&quot;'. esc_attr( $menu_item-&gt;xfn ) .'&quot; /&gt;';
</span><span class="cx">                         break;
</span><del>-                
-                case 'taxonomy':
-                case 'post_type':
-                        $menu_id = 'menu-item-' . $menu_item-&gt;db_id;
-                        $output .= '&lt;label class=&quot;menu-item-title&quot;&gt;&lt;input type=&quot;checkbox&quot; id=&quot;'. esc_attr( $menu_id ) .'&quot; name=&quot;'. esc_attr( $menu_item-&gt;title ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;url ) .'&quot; /&gt;'. $menu_item-&gt;title .'&lt;/label&gt;';
-                        
-                        // Menu item hidden fields
-                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-db-id&quot; value=&quot;0&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-object-id&quot; value=&quot;'. esc_attr( $menu_item-&gt;object_id ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-parent-id&quot; value=&quot;'. esc_attr( $menu_item-&gt;parent_id ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-type&quot; value=&quot;'. esc_attr( $menu_item-&gt;type ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-append&quot; value=&quot;'. esc_attr( $menu_item-&gt;append ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-title&quot; value=&quot;'. esc_attr( $menu_item-&gt;title ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-url&quot; value=&quot;'. esc_attr( $menu_item-&gt;url ) .'&quot; /&gt;';
-                        $output .= '&lt;input type=&quot;hidden&quot; class=&quot;menu-item-append&quot; value=&quot;'. esc_attr( $menu_item-&gt;append ) .'&quot; /&gt;';
-                        break;
</del><span class="cx">         }
</span><span class="cx">         
</span><span class="cx">         return $output;
</span></span></pre></div>
<a id="trunkwpincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/nav-menu.php (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/nav-menu.php        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-includes/nav-menu.php        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -8,26 +8,26 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Returns a Navigation Menu object
</del><ins>+ * Returns a navigation menu object.
</ins><span class="cx">  *
</span><span class="cx">  * @since 3.0.0
</span><span class="cx">  *
</span><span class="cx">  * @param string $menu Menu id
</span><del>- * @return mixed $menu|false
</del><ins>+ * @return mixed $menu|false Or WP_Error
</ins><span class="cx">  */
</span><span class="cx"> function wp_get_nav_menu_object( $menu ) {
</span><span class="cx">         return is_nav_menu( $menu );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Check if Menu exists.
</del><ins>+ * Check if navigation menu exists.
</ins><span class="cx">  *
</span><span class="cx">  * Returns the menu object, or false if the term doesn't exist.
</span><span class="cx">  *
</span><span class="cx">  * @since 3.0.0
</span><span class="cx">  *
</span><span class="cx">  * @param int|string $menu The menu to check
</span><del>- * @return mixed Menu Object, if exists.
</del><ins>+ * @return mixed Menu Object, if it exists. Else, false or WP_Error
</ins><span class="cx">  */
</span><span class="cx"> function is_nav_menu( $menu ) {
</span><span class="cx">         if ( !$menu )
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Creates a navigation menu.
</del><ins>+ * Create a Navigation Menu.
</ins><span class="cx">  *
</span><span class="cx">  * Optional args:
</span><span class="cx">  * slug - the url friendly version of the nav menu.
</span><span class="lines">@@ -58,13 +58,13 @@
</span><span class="cx">  *
</span><span class="cx">  * @param string $menu_name Menu Name
</span><span class="cx">  * @param string $args Optional.
</span><del>- * @return mixed Menu object|WP_Error
</del><ins>+ * @return mixed Menu object on sucess|WP_Error on failure
</ins><span class="cx">  */
</span><span class="cx"> function wp_create_nav_menu( $menu_name, $args = array() ) {
</span><span class="cx">         $menu_exists = get_term_by( 'name', $menu_name, 'nav_menu' );
</span><span class="cx"> 
</span><span class="cx">         if ( $menu_exists )
</span><del>-                return new WP_Error( 'menu_exists', sprintf( __('A menu named &amp;#8220;%s&amp;#8221; already exists; please try another name.'), esc_html( $menu_exists-&gt;name ) ) );
</del><ins>+                return new WP_Error( 'menu_exists', sprintf( __('A menu named &lt;strong&gt;%s&lt;/strong&gt; already exists; please try another name.'), esc_html( $menu_exists-&gt;name ) ) );
</ins><span class="cx"> 
</span><span class="cx">         if ( isset($args['slug']) )
</span><span class="cx">                 $slug = $args['slug'];
</span><span class="lines">@@ -76,16 +76,23 @@
</span><span class="cx">         if ( is_wp_error($menu) )
</span><span class="cx">                 return $menu;
</span><span class="cx"> 
</span><del>-        return get_term( $menu['term_id'], 'nav_menu') ;
</del><ins>+        $result = get_term( $menu['term_id'], 'nav_menu' );
+        
+        if ( $result &amp;&amp; !is_wp_error($result) ) {
+                do_action( 'wp_create_nav_menu', $menu['term_id'] );
+                return $result;
+        } else {
+                return $result;
+        }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Deletes a navigation menu.
</del><ins>+ * Delete a Navigation Menu.
</ins><span class="cx">  *
</span><span class="cx">  * @since 3.0.0
</span><span class="cx">  *
</span><span class="cx">  * @param string $menu name|id|slug
</span><del>- * @return bool true on success, else false.
</del><ins>+ * @return mixed Menu object on sucess|WP_Error on failure
</ins><span class="cx">  */
</span><span class="cx"> function wp_delete_nav_menu( $menu ) {
</span><span class="cx">         $menu = wp_get_nav_menu_object( $menu );
</span><span class="lines">@@ -98,11 +105,19 @@
</span><span class="cx">                         wp_delete_post( $item );
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-        wp_delete_term( $menu-&gt;term_id, 'nav_menu' );
</del><ins>+        
+        $result = wp_delete_term( $menu-&gt;term_id, 'nav_menu' );
+        
+        if ( $result &amp;&amp; !is_wp_error($result) ) {
+                do_action( 'wp_delete_nav_menu', $menu-&gt;term_id );
+                return $result;
+        } else {
+                return $result;
+        }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Returns all Navigation Menu objects.
</del><ins>+ * Returns all navigation menu objects.
</ins><span class="cx">  *
</span><span class="cx">  * @since 3.0.0
</span><span class="cx">  *
</span><span class="lines">@@ -153,62 +168,85 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Adds all the nav menu properties to the $menu_item.
</del><ins>+ * Retrieve the HTML list content for nav menu items.
</ins><span class="cx">  *
</span><ins>+ * @uses Walker_Nav_Menu to create HTML list content.
+ * @since 2.1.0
+ * @see Walker::walk() for parameters and return description.
+ */
+function walk_nav_menu_tree( $items, $depth, $r ) {
+        $walker = ( empty($r-&gt;walker) ) ? new Walker_Nav_Menu : $r-&gt;walker;
+        $args = array( $items, $depth, $r );
+        
+        return call_user_func_array(array(&amp;$walker, 'walk'), $args);
+}
+
+/**
+ * Adds all the navigation menu properties to the menu item.
+ *
</ins><span class="cx">  * @since 3.0.0
</span><span class="cx">  *
</span><span class="cx">  * @param string $menu_item The menu item to modify
</span><del>- * @param string $menu_item_type The menu item type (template, custom, post_type, taxonomy).
</del><ins>+ * @param string $menu_item_type The menu item type (frontend, custom, post_type, taxonomy).
</ins><span class="cx">  * @param string $menu_item_object Optional. The menu item object type (post type or taxonomy).
</span><del>- * @return object $menu_item The modtified menu item.
</del><ins>+ * @return object $menu_item The modified menu item.
</ins><span class="cx">  */
</span><span class="cx"> function wp_setup_nav_menu_item( $menu_item, $menu_item_type = null, $menu_item_object = '' ) {
</span><del>-        global $wp_query;
-
</del><span class="cx">         switch ( $menu_item_type ) {
</span><span class="cx">                 case 'frontend':
</span><span class="cx">                         $menu_item-&gt;db_id = (int) $menu_item-&gt;ID;
</span><del>-                        $menu_item-&gt;object_id = get_post_meta( $menu_item-&gt;ID, 'menu_item_object_id', true );
-                        $menu_item-&gt;parent_id = (int) $menu_item-&gt;post_parent;
-                        $menu_item-&gt;type = get_post_meta( $menu_item-&gt;ID, 'menu_item_type', true );
-
-                        $menu_item-&gt;append = get_post_meta( $menu_item-&gt;ID, 'menu_item_append', true );
-
</del><ins>+                        $menu_item-&gt;object_id = get_post_meta( $menu_item-&gt;ID, '_menu_item_object_id', true );
+                        $menu_item-&gt;object = get_post_meta( $menu_item-&gt;ID, '_menu_item_object', true );
+                        $menu_item-&gt;type = get_post_meta( $menu_item-&gt;ID, '_menu_item_type', true );
+                        
+                        if ( 'post_type' == $menu_item-&gt;type ) {
+                                $object = get_post_type_object( $menu_item-&gt;object );
+                                $menu_item-&gt;append = $object-&gt;singular_label;
+                                
+                        } elseif ( 'taxonomy' == $menu_item-&gt;type ) {
+                                $object = get_taxonomy( $menu_item-&gt;object );
+                                $menu_item-&gt;append = $object-&gt;singular_label;
+                                
+                        } else {
+                                $menu_item-&gt;append = __('Custom');
+                        }
+                        
</ins><span class="cx">                         $menu_item-&gt;title = $menu_item-&gt;post_title;
</span><del>-                        $menu_item-&gt;url = get_post_meta( $menu_item-&gt;ID, 'menu_item_url', true );
-                        $menu_item-&gt;target = get_post_meta( $menu_item-&gt;ID, 'menu_item_target', true );
</del><ins>+                        $menu_item-&gt;url = get_post_meta( $menu_item-&gt;ID, '_menu_item_url', true );
+                        $menu_item-&gt;target = get_post_meta( $menu_item-&gt;ID, '_menu_item_target', true );
</ins><span class="cx"> 
</span><span class="cx">                         $menu_item-&gt;attr_title = strip_tags( $menu_item-&gt;post_excerpt );
</span><span class="cx">                         $menu_item-&gt;description = strip_tags( $menu_item-&gt;post_content );
</span><span class="cx"> 
</span><del>-                        $menu_item-&gt;classes = get_post_meta( $menu_item-&gt;ID, 'menu_item_classes', true );;
-                        $menu_item-&gt;xfn = get_post_meta( $menu_item-&gt;ID, 'menu_item_xfn', true );
-                        $menu_item-&gt;li_class = ( $menu_item-&gt;object_id == $wp_query-&gt;get_queried_object_id() ) ? ' current_page_item' : '';
</del><ins>+                        $menu_item-&gt;classes = get_post_meta( $menu_item-&gt;ID, '_menu_item_classes', true );;
+                        $menu_item-&gt;xfn = get_post_meta( $menu_item-&gt;ID, '_menu_item_xfn', true );
</ins><span class="cx">                         break;
</span><span class="cx"> 
</span><span class="cx">                 case 'custom':
</span><del>-                        $menu_item-&gt;db_id = (int) $menu_item-&gt;ID;
</del><ins>+                        $menu_item-&gt;db_id = 0;
</ins><span class="cx">                         $menu_item-&gt;object_id = (int) $menu_item-&gt;ID;
</span><del>-                        $menu_item-&gt;parent_id = (int) $menu_item-&gt;post_parent;
-                        $menu_item-&gt;type = 'custom'; //$menu_item_type
-                        $menu_item-&gt;append = 'custom';
</del><ins>+                        $menu_item-&gt;object = 'custom';
+                        $menu_item-&gt;type = 'custom';
+                        $menu_item-&gt;append = __('custom');
</ins><span class="cx"> 
</span><span class="cx">                         $menu_item-&gt;attr_title = strip_tags( $menu_item-&gt;post_excerpt );
</span><span class="cx">                         $menu_item-&gt;description = strip_tags( $menu_item-&gt;post_content );
</span><span class="cx"> 
</span><span class="cx">                         $menu_item-&gt;title = $menu_item-&gt;post_title;
</span><del>-                        $menu_item-&gt;url = get_post_meta( $menu_item-&gt;ID, 'menu_item_url', true );
-                        $menu_item-&gt;target = get_post_meta( $menu_item-&gt;ID, 'menu_item_target', true );
</del><ins>+                        $menu_item-&gt;url = get_post_meta( $menu_item-&gt;ID, '_menu_item_url', true );
+                        $menu_item-&gt;target = get_post_meta( $menu_item-&gt;ID, '_menu_item_target', true );
+                        $menu_item-&gt;classes = '';
+                        $menu_item-&gt;xfn = '';
</ins><span class="cx">                         break;
</span><span class="cx"> 
</span><span class="cx">                 case 'post_type':
</span><span class="cx">                         $menu_item-&gt;db_id = 0;
</span><span class="cx">                         $menu_item-&gt;object_id = (int) $menu_item-&gt;ID;
</span><del>-                        $menu_item-&gt;parent_id = (int) $menu_item-&gt;post_parent;
</del><span class="cx">                         $menu_item-&gt;type = $menu_item_type;
</span><span class="cx"> 
</span><span class="cx">                         $object = get_post_type_object( $menu_item_object );
</span><del>-                        $menu_item-&gt;append = $object-&gt;name;
</del><ins>+                        $menu_item-&gt;object = $object-&gt;name;
+                        $menu_item-&gt;append = strtolower( $object-&gt;singular_label );
</ins><span class="cx"> 
</span><span class="cx">                         $menu_item-&gt;title = $menu_item-&gt;post_title;
</span><span class="cx">                         $menu_item-&gt;url = get_permalink( $menu_item-&gt;ID );
</span><span class="lines">@@ -216,29 +254,30 @@
</span><span class="cx"> 
</span><span class="cx">                         $menu_item-&gt;attr_title = '';
</span><span class="cx">                         $menu_item-&gt;description = strip_tags( $menu_item-&gt;post_content );
</span><ins>+                        $menu_item-&gt;classes = '';
+                        $menu_item-&gt;xfn = '';
</ins><span class="cx">                         break;
</span><span class="cx"> 
</span><span class="cx">                 case 'taxonomy':
</span><span class="cx">                         $menu_item-&gt;ID = $menu_item-&gt;term_id;
</span><span class="cx">                         $menu_item-&gt;db_id = 0;
</span><span class="cx">                         $menu_item-&gt;object_id = (int) $menu_item-&gt;term_id;
</span><del>-                        $menu_item-&gt;parent_id = (int) $menu_item-&gt;parent;
</del><ins>+                        $menu_item-&gt;post_parent = (int) $menu_item-&gt;parent;
</ins><span class="cx">                         $menu_item-&gt;type = $menu_item_type;
</span><span class="cx"> 
</span><span class="cx">                         $object = get_taxonomy( $menu_item_object );
</span><del>-                        $menu_item-&gt;append = $object-&gt;name;
</del><ins>+                        $menu_item-&gt;object = $object-&gt;name;
+                        $menu_item-&gt;append = strtolower( $object-&gt;singular_label );
</ins><span class="cx"> 
</span><span class="cx">                         $menu_item-&gt;title = $menu_item-&gt;name;
</span><span class="cx">                         $menu_item-&gt;url = get_term_link( $menu_item, $menu_item_object );
</span><span class="cx">                         $menu_item-&gt;target = '_self';
</span><span class="cx">                         $menu_item-&gt;attr_title = '';
</span><span class="cx">                         $menu_item-&gt;description = strip_tags( $menu_item-&gt;description );
</span><ins>+                        $menu_item-&gt;classes = '';
+                        $menu_item-&gt;xfn = '';
</ins><span class="cx">                         break;
</span><del>-        }
-
-        $menu_item-&gt;classes = get_post_meta( $menu_item-&gt;ID, 'menu_item_classes', true );
-        $menu_item-&gt;xfn = get_post_meta( $menu_item-&gt;ID, 'menu_item_xfn', true );
-
</del><ins>+        }        
</ins><span class="cx">         return $menu_item;
</span><span class="cx"> }
</span><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-includes/post.php        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -63,7 +63,9 @@
</span><span class="cx">                                                                                         'query_var' =&gt; false,
</span><span class="cx">                                                                                 ) );
</span><span class="cx"> 
</span><del>-        register_post_type( 'nav_menu_item', array(        'public' =&gt; false,
</del><ins>+        register_post_type( 'nav_menu_item', array(        'label' =&gt; __('Navigation Menu Items'),
+                                                                                                'singular_label' =&gt; __('Navigation Menu Item'),
+                                                                                                'public' =&gt; false,
</ins><span class="cx">                                                                                                 'show_ui' =&gt; false,
</span><span class="cx">                                                                                                 '_builtin' =&gt; true,
</span><span class="cx">                                                                                                 'capability_type' =&gt; 'post',
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-includes/script-loader.php        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -397,11 +397,9 @@
</span><span class="cx">                 ) );
</span><span class="cx"> 
</span><span class="cx">                 // Custom Navigation
</span><del>-                $scripts-&gt;add( 'nav-menu', &quot;/wp-admin/js/nav-menu$suffix.js&quot;, false, '20100317b' );
</del><ins>+                $scripts-&gt;add( 'nav-menu', &quot;/wp-admin/js/nav-menu$suffix.js&quot;, false, '20100322' );
</ins><span class="cx">                 $scripts-&gt;localize( 'nav-menu', 'navMenuL10n', array(
</span><span class="cx">                         'custom' =&gt; _x('Custom', 'menu nav item type'),
</span><del>-                        'page' =&gt; _x('Page', 'menu nav item type'),
-                        'category' =&gt; _x('Category', 'menu nav item type'),
</del><span class="cx">                         'thickbox' =&gt; _x('Edit Menu Item', 'Thickbox Title'),
</span><span class="cx">                         'edit' =&gt; _x('Edit', 'menu item edit text'),
</span><span class="cx">                         'warnDelete' =&gt; __( &quot;You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete.&quot; ),
</span><span class="lines">@@ -410,7 +408,6 @@
</span><span class="cx">                 $scripts-&gt;add( 'custom-background', &quot;/wp-admin/js/custom-background$suffix.js&quot;, array('farbtastic'), '20100321' );
</span><span class="cx">                 $scripts-&gt;add_data( 'custom-background', 'group', 1 );
</span><span class="cx">                 // See wp_just_in_time_script_localization() for translation data for this object
</span><del>-
</del><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludestaxonomyphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/taxonomy.php (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/taxonomy.php        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-includes/taxonomy.php        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -39,6 +39,8 @@
</span><span class="cx">                                                                                                 ) ) ;
</span><span class="cx"> 
</span><span class="cx">         register_taxonomy( 'nav_menu', 'nav_menu_item', array(        'hierarchical' =&gt; false,
</span><ins>+                                                                                                                'label' =&gt; __('Navigation Menus'),
+                                                                                                                'singular_label' =&gt; __('Navigation Menu'),
</ins><span class="cx">                                                                                                                 'query_var' =&gt; false,
</span><span class="cx">                                                                                                                 'rewrite' =&gt; false,
</span><span class="cx">                                                                                                                 'show_ui' =&gt; false,
</span></span></pre></div>
<a id="trunkwpincludesversionphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/version.php (13801 => 13802)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/version.php        2010-03-22 16:06:55 UTC (rev 13801)
+++ trunk/wp-includes/version.php        2010-03-22 19:56:16 UTC (rev 13802)
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @global int $wp_db_version
</span><span class="cx">  */
</span><del>-$wp_db_version = 13576;
</del><ins>+$wp_db_version = 13802;
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Holds the TinyMCE version
</span></span></pre>
</div>
</div>

</body>
</html>