<!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>[13512] trunk: Menu enhancements.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13512">13512</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-02-28 20:00:49 +0000 (Sun, 28 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Menu enhancements. Props ptahdunbar. fixes <a href="http://trac.wordpress.org/ticket/11817">#11817</a></pre>

<h3>Modified Paths</h3>
<ul>
<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="#trunkwpadminjsnavmenudefaultitemsdevjs">trunk/wp-admin/js/nav-menu-default-items.dev.js</a></li>
<li><a href="#trunkwpadminjsnavmenudefaultitemsjs">trunk/wp-admin/js/nav-menu-default-items.js</a></li>
<li><a href="#trunkwpadminjsnavmenudynamicfunctionsdevjs">trunk/wp-admin/js/nav-menu-dynamic-functions.dev.js</a></li>
<li><a href="#trunkwpadminjsnavmenudynamicfunctionsjs">trunk/wp-admin/js/nav-menu-dynamic-functions.js</a></li>
<li><a href="#trunkwpadminnavmenusphp">trunk/wp-admin/nav-menus.php</a></li>
<li><a href="#trunkwpcontentthemestwentytenheaderphp">trunk/wp-content/themes/twentyten/header.php</a></li>
<li><a href="#trunkwpincludesdefaultwidgetsphp">trunk/wp-includes/default-widgets.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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincssnavmenucss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/nav-menu.css (13511 => 13512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/nav-menu.css        2010-02-28 19:49:31 UTC (rev 13511)
+++ trunk/wp-admin/css/nav-menu.css        2010-02-28 20:00:49 UTC (rev 13512)
</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{color:#f00;text-decoration:underline;font-size:11px;float:left;margin-top:5px;}.submitdelete:hover{background-color:#F00;color:#fff;}.save{float:right;}.button-controls{float:left;}.add-to-menu{float:right;}#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-url,#menu-item-name{float:right;width:220px;}.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{margin:0;}.list dt{display:none;margin:0;overflow:hidden;margin-bottom:5px;}.list li .item-title{cursor:pointer;display:block;}.list li .item-title input{margin-right:3px;margin-top:-3px;}.list li ul li .item-title{margin-left:14px;}.list li ul li ul li .item-title{margin-left:28px;}.list li ul li ul li ul li .item-title{margin-left:42px;}.list li ul li ul li ul li ul li .item-title{margin-left:56px;}.list li ul li ul li ul li ul li ul li .item-title{margin-left:70px;}.list li ul li ul li ul li ul li ul li ul li .item-title{margin-left:84px;}.list li ul li ul li ul li ul li ul li ul li ul li .item-title{margin-left:98px;}.list li ul li ul li ul li ul li ul li ul li ul li ul li .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 .item-title{background:url(../images/ico-arrow.png) no-repeat 4px 5px;background-position:center left;padding-left:15px;}#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 .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;}.hide{display:none;}
</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{color:#f00;text-decoration:underline;font-size:11px;float:left;margin-top:5px;}.submitdelete:hover{background-color:#F00;color:#fff;}.save{float:right;}.button-controls{float:left;}.add-to-menu{float:right;}#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-url,#menu-item-name{float:right;width:220px;}.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 .item-title{cursor:pointer;display:block;}.list li .item-title input{margin-right:3px;margin-top:-3px;}.list li ul li .item-title{margin-left:14px;}.list li ul li ul li .item-title{margin-left:28px;}.list li ul li ul li ul li .item-title{margin-left:42px;}.list li ul li ul li ul li ul li .item-title{margin-left:56px;}.list li ul li ul li ul li ul li ul li .item-title{margin-left:70px;}.list li ul li ul li ul li ul li ul li ul li .item-title{margin-left:84px;}.list li ul li ul li ul li ul li ul li ul li ul li .item-title{margin-left:98px;}.list li ul li ul li ul li ul li ul li ul li ul li ul li .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 .item-title{background:url(../images/ico-arrow.png) no-repeat 4px 5px;background-position:center left;padding-left:15px;}.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 .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;}.hide{display:none;}
</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 (13511 => 13512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/nav-menu.dev.css        2010-02-28 19:49:31 UTC (rev 13511)
+++ trunk/wp-admin/css/nav-menu.dev.css        2010-02-28 20:00:49 UTC (rev 13512)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx"> .button-controls { float: left; }
</span><span class="cx"> .add-to-menu { float: right; }
</span><span class="cx"> 
</span><del>-/* CSS for switching the columns *//*
</del><ins>+/* CSS for switching the main columns *//*
</ins><span class="cx"> #menu-settings-column { clear: none; float: left; }
</span><span class="cx"> #menu-management #post-body { float: right; margin-left: -340px; margin-right: 0px; }
</span><span class="cx"> #menu-management #post-body-content { margin-left: 300px; margin-right: 0px; }
</span><span class="lines">@@ -48,8 +48,7 @@
</span><span class="cx"> .postbox p.submit { margin-bottom: 0; }
</span><span class="cx"> 
</span><span class="cx"> /* Listings */
</span><del>-.list li { margin: 0; }
-.list dt { display: none; margin: 0; overflow: hidden; margin-bottom: 5px; }
</del><ins>+.list li { display: none; margin: 0; margin-bottom: 5px; }
</ins><span class="cx"> 
</span><span class="cx"> .list li .item-title { cursor: pointer; display: block; }
</span><span class="cx"> .list li .item-title input { margin-right: 3px; margin-top: -3px; }
</span><span class="lines">@@ -66,16 +65,16 @@
</span><span class="cx"> /* Menu */
</span><span class="cx"> #menu-container .inside { padding-bottom: 10px; }
</span><span class="cx"> 
</span><del>-#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; }
</del><ins>+.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; }
</ins><span class="cx"> 
</span><del>-#menu li .item-title { background: url(../images/ico-arrow.png) no-repeat 4px 5px; background-position: center left; padding-left: 15px; }
-#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; }
</del><ins>+.menu li .item-title { background: url(../images/ico-arrow.png) no-repeat 4px 5px; background-position: center left; padding-left: 15px; }
+.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; }
</ins><span class="cx"> 
</span><span class="cx"> /* Drag and Drop */
</span><span class="cx"> .dropzone { height: 7px; margin: 3px 0 3px 0; }
</span></span></pre></div>
<a id="trunkwpadminincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/nav-menu.php (13511 => 13512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/nav-menu.php        2010-02-28 19:49:31 UTC (rev 13511)
+++ trunk/wp-admin/includes/nav-menu.php        2010-02-28 20:00:49 UTC (rev 13512)
</span><span class="lines">@@ -1,16 +1,72 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> 
</span><del>-/*-----------------------------------------------------------------------------------*/
-/* Custom Navigation Functions */
-/* wp_custom_navigation_output() displays the menu in the back/frontend
-/* wp_custom_nav_get_pages()
-/* wp_custom_nav_get_categories()
-/* wp_custom_navigation_default_sub_items() is a recursive sub menu item function
-/*-----------------------------------------------------------------------------------*/
</del><ins>+/**
+ * Displays a list of links and thier sub items.
+ *
+ * @since 3.0.0
+ *
+ * @param string $counter 
+ * @param string $context 
+ */
+function wp_nav_menu_get_custom_links( $counter, $context ) {
+        $available_links = new WP_Query(  );
+        
+        $args = array( 'post_status' =&gt; 'any', 'post_type' =&gt; 'nav_menu_item', 'meta_value' =&gt; 'custom' );
+        $link_objects = new WP_Query( $args );
+        
+        $items_counter = $counter;
</ins><span class="cx"> 
</span><del>-// Outputs All Pages and Sub Items
-function wp_nav_menu_get_pages($counter, $type) {
</del><ins>+        if ( !$link_objects-&gt;posts ) {
+                _e('Not Found');
+                return $items_counter;
+        }
+        
+        // Display Loop
+        foreach ( $link_objects-&gt;posts as $item ) {
+                if ( 0 == $item-&gt;parent ) {
+                        $item = wp_setup_nav_menu_item( $item, 'item', $items_counter );
+                        
+                        switch ( $context ) {
+                                case 'menu':
+                                        ?&gt;
+                                        &lt;li id=&quot;menu-&lt;?php echo $items_counter; ?&gt;&quot; value=&quot;&lt;?php echo $items_counter; ?&gt;&quot;&gt;
+                                                &lt;?php
+                                                        echo wp_get_nav_menu_item( $item, 'menu' );
+                                                        $parentli = $item-&gt;ID;
+                                                        $items_counter++;
+                                                        $items_counter = wp_nav_menu_sub_items( $item-&gt;ID, $items_counter, $parentli, 'categories', 'menu' );
+                                                ?&gt;
+                                        &lt;/li&gt;
+                                        &lt;?php
+                                        break;
+                                
+                                case 'default':
+                                        ?&gt;
+                                        &lt;li&gt;
+                                                &lt;?php
+                                                        echo wp_get_nav_menu_item( $item, 'default' );
+                                                        $parentli = $item-&gt;ID;
+                                                        $items_counter++;
+                                                        $items_counter = wp_nav_menu_sub_items( $item-&gt;ID, $items_counter, $parentli, 'categories', 'default' );
+                                                ?&gt;
+                                        &lt;/li&gt;
+                                        &lt;?php
+                                        break;
+                        }
+                }
+        }
+        return $items_counter;
+}
</ins><span class="cx"> 
</span><ins>+/**
+ * Displays a list of pages and thier sub items.
+ *
+ * @since 3.0.0
+ *
+ * @param string $counter 
+ * @param string $context 
+ */
+function wp_nav_menu_get_pages( $counter, $context ) {
</ins><span class="cx">         $pages_args = array(
</span><span class="cx">                     'child_of' =&gt; 0,
</span><span class="cx">                         'sort_order' =&gt; 'ASC',
</span><span class="lines">@@ -26,8 +82,8 @@
</span><span class="cx">                         'number' =&gt; '',
</span><span class="cx">                         'offset' =&gt; 0 );
</span><span class="cx"> 
</span><del>-        //GET all pages
-        $pages_array = get_pages($pages_args);
</del><ins>+        // Get all pages
+        $pages_array = get_pages( $pages_args );
</ins><span class="cx"> 
</span><span class="cx">         $items_counter = $counter;
</span><span class="cx">         $parentli = $items_counter;
</span><span class="lines">@@ -40,43 +96,45 @@
</span><span class="cx">         // Display Loop
</span><span class="cx">         foreach ( $pages_array as $post ) {
</span><span class="cx">                 if ( $post-&gt;post_parent == 0 ) {
</span><del>-                        $post = wp_setup_nav_menu_item($post, 'page', $items_counter);
-                        if ( $type == 'menu' ) {
</del><ins>+                        $post = wp_setup_nav_menu_item( $post, 'page', $items_counter );
+                        if ( $context == 'menu' ) {
</ins><span class="cx">                                 ?&gt;
</span><del>-
</del><span class="cx">                                 &lt;li id=&quot;menu-&lt;?php echo $items_counter; ?&gt;&quot; value=&quot;&lt;?php echo $items_counter; ?&gt;&quot;&gt;
</span><span class="cx">                                         &lt;?php
</span><del>-                                                wp_print_nav_menu_item($post, 'menu', $items_counter);
</del><ins>+                                                echo wp_get_nav_menu_item( $post, 'menu', $items_counter );
</ins><span class="cx">                                                 $parentli = $post-&gt;ID;
</span><span class="cx">                                                 $items_counter++;
</span><del>-                                                $items_counter = wp_custom_navigation_default_sub_items($post-&gt;ID, $items_counter, $parentli, 'pages', 'menu');
</del><ins>+                                                $items_counter = wp_nav_menu_sub_items( $post-&gt;ID, $items_counter, $parentli, 'pages', 'menu' );
</ins><span class="cx">                                         ?&gt;
</span><span class="cx">                                 &lt;/li&gt;
</span><del>-
</del><span class="cx">                                 &lt;?php
</span><del>-                        } elseif ( $type == 'default' ) {
</del><ins>+                        } elseif ( $context == 'default' ) {
</ins><span class="cx">                                 // Sidebar Menu
</span><span class="cx">                                 ?&gt;
</span><span class="cx">                                  &lt;li&gt;
</span><span class="cx">                                         &lt;?php
</span><del>-                                                wp_print_nav_menu_item($post, 'default');
</del><ins>+                                                echo wp_get_nav_menu_item( $post, 'default' );
</ins><span class="cx">                                                 $parentli = $post-&gt;ID;
</span><span class="cx">                                                 $items_counter++;
</span><del>-                                                $items_counter = wp_nav_menu_sub_items($post-&gt;ID, $items_counter, $parentli, 'pages', 'default');
</del><ins>+                                                $items_counter = wp_nav_menu_sub_items( $post-&gt;ID, $items_counter, $parentli, 'pages', 'default' );
</ins><span class="cx">                                          ?&gt;
</span><span class="cx">                                 &lt;/li&gt;
</span><del>-
</del><span class="cx">                                 &lt;?php
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-
</del><span class="cx">         return $items_counter;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Outputs All Categories and Sub Items
-function wp_nav_menu_get_categories($counter, $type) {
-
</del><ins>+/**
+ * Displays a list of categories and thier sub items.
+ *
+ * @since 3.0.0
+ *
+ * @param string $counter 
+ * @param string $context 
+ */
+function wp_nav_menu_get_categories( $counter, $context ) {
</ins><span class="cx">         $category_args = array(
</span><span class="cx">                         'type'                     =&gt; 'post',
</span><span class="cx">                         'child_of'                 =&gt; 0,
</span><span class="lines">@@ -93,7 +151,7 @@
</span><span class="cx">         $items_counter = $counter;
</span><span class="cx"> 
</span><span class="cx">         // Get all categories
</span><del>-        $categories_array = get_categories($category_args);
</del><ins>+        $categories_array = get_categories( $category_args );
</ins><span class="cx"> 
</span><span class="cx">         if ( !$categories_array ) {
</span><span class="cx">                 _e('Not Found');
</span><span class="lines">@@ -103,46 +161,49 @@
</span><span class="cx">         // Display Loop
</span><span class="cx">         foreach ( $categories_array as $cat_item ) {
</span><span class="cx">                 if ( $cat_item-&gt;parent == 0 ) {
</span><del>-                        $cat_item = wp_setup_nav_menu_item($cat_item, 'category', $items_counter);
</del><ins>+                        $cat_item = wp_setup_nav_menu_item( $cat_item, 'category', $items_counter );
</ins><span class="cx">                         // Custom Menu
</span><del>-                        if ( $type == 'menu' ) {
</del><ins>+                        if ( $context == 'menu' ) {
</ins><span class="cx">                                 ?&gt;
</span><del>-
</del><span class="cx">                                 &lt;li id=&quot;menu-&lt;?php echo $items_counter; ?&gt;&quot; value=&quot;&lt;?php echo $items_counter; ?&gt;&quot;&gt;
</span><span class="cx">                                         &lt;?php
</span><del>-                                                wp_print_nav_menu_item($cat_item, 'menu');
</del><ins>+                                                echo wp_get_nav_menu_item($cat_item, 'menu');
</ins><span class="cx">                                                 $parentli = $cat_item-&gt;cat_ID;
</span><span class="cx">                                                 $items_counter++;
</span><del>-                                                $items_counter = wp_nav_menu_sub_items($cat_item-&gt;cat_ID, $items_counter, $parentli, 'categories', 'menu');
</del><ins>+                                                $items_counter = wp_nav_menu_sub_items( $cat_item-&gt;cat_ID, $items_counter, $parentli, 'categories', 'menu' );
</ins><span class="cx">                                         ?&gt;
</span><del>-
</del><span class="cx">                                 &lt;/li&gt;
</span><del>-
</del><span class="cx">                                 &lt;?php
</span><del>-                        } elseif ( $type == 'default' ) {
</del><ins>+                        } elseif ( $context == 'default' ) {
</ins><span class="cx">                                 // Sidebar Menu
</span><span class="cx">                                 ?&gt;
</span><span class="cx">                                 &lt;li&gt;
</span><span class="cx">                                         &lt;?php
</span><del>-                                                wp_print_nav_menu_item($cat_item, 'default');
</del><ins>+                                                echo wp_get_nav_menu_item( $cat_item, 'default' );
</ins><span class="cx">                                                 $parentli = $cat_item-&gt;cat_ID;
</span><span class="cx">                                                 $items_counter++;
</span><del>-                                                $items_counter = wp_nav_menu_sub_items($cat_item-&gt;cat_ID, $items_counter, $parentli, 'categories', 'default');
</del><ins>+                                                $items_counter = wp_nav_menu_sub_items( $cat_item-&gt;cat_ID, $items_counter, $parentli, 'categories', 'default' );
</ins><span class="cx">                                         ?&gt;
</span><del>-
</del><span class="cx">                                 &lt;/li&gt;
</span><del>-
</del><span class="cx">                                 &lt;?php
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-
</del><span class="cx">         return $items_counter;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-//RECURSIVE Sub Menu Items of default categories and pages
-function wp_nav_menu_sub_items($childof, $items_counter, $parentli, $type, $output_type) {
-
</del><ins>+/**
+ * Recursive function that gets sub menu items.
+ *
+ * @since 3.0.0
+ *
+ * @param string $childof 
+ * @param string $items_counter 
+ * @param string $parentli 
+ * @param string $context 
+ * @param string $output_type 
+ */
+function wp_nav_menu_sub_items( $childof, $items_counter, $parentli, $context, $output_type ) {
</ins><span class="cx">         $counter = $items_counter;
</span><span class="cx"> 
</span><span class="cx">         // Custom Menu
</span><span class="lines">@@ -159,11 +220,11 @@
</span><span class="cx">                 'parent' =&gt; $childof);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ( $type == 'categories' ) {
</del><ins>+        if ( $context == 'categories' ) {
</ins><span class="cx">                 // Get Sub Category Items
</span><span class="cx">                 $item_type = 'category';
</span><span class="cx">                 $sub_array = get_categories($sub_args);
</span><del>-        } elseif ($type == 'pages') {
</del><ins>+        } elseif ($context == 'pages') {
</ins><span class="cx">                 // Get Sub Page Items
</span><span class="cx">                 $item_type = 'page';
</span><span class="cx">                 $sub_array = get_pages($sub_args);
</span><span class="lines">@@ -172,25 +233,21 @@
</span><span class="cx">                 $sub_array = array();
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-
</del><span class="cx">         if ( $sub_array ) {
</span><span class="cx">                 ?&gt;
</span><del>-                &lt;ul id=&quot;sub-menu-&lt;?php echo $type ?&gt;&quot;&gt;
-
</del><ins>+                &lt;ul id=&quot;sub-menu-&lt;?php echo $context ?&gt;&quot;&gt;
</ins><span class="cx">                 &lt;?php
</span><span class="cx">                 // Display Loop
</span><span class="cx">                 foreach ( $sub_array as $sub_item ) {
</span><del>-                        $sub_item = wp_setup_nav_menu_item($sub_item, $item_type, $counter);
-
</del><ins>+                        $sub_item = wp_setup_nav_menu_item( $sub_item, $item_type, $counter );
</ins><span class="cx">                         if ( $output_type == 'menu' ) {
</span><span class="cx">                                 ?&gt;
</span><span class="cx">                                 &lt;li id=&quot;menu-&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $counter; ?&gt;&quot;&gt;
</span><span class="cx">                                         &lt;?php
</span><del>-                                                wp_print_nav_menu_item($sub_item, 'menu');
</del><ins>+                                                echo wp_get_nav_menu_item( $sub_item, 'menu' );
</ins><span class="cx">                                                 $counter++;
</span><del>-                                                $counter = wp_nav_menu_sub_items($sub_item-&gt;ID, $counter, $sub_item-&gt;ID, $type, 'menu');
</del><ins>+                                                $counter = wp_nav_menu_sub_items( $sub_item-&gt;ID, $counter, $sub_item-&gt;ID, $context, 'menu' );
</ins><span class="cx">                                         ?&gt;
</span><del>-
</del><span class="cx">                                 &lt;/li&gt;
</span><span class="cx">                                 &lt;?php
</span><span class="cx">                         } elseif ( $output_type == 'default' ) {
</span><span class="lines">@@ -198,9 +255,9 @@
</span><span class="cx">                                 ?&gt;
</span><span class="cx">                                 &lt;li&gt;
</span><span class="cx">                                         &lt;?php
</span><del>-                                                wp_print_nav_menu_item($sub_item, 'default');
</del><ins>+                                                echo wp_get_nav_menu_item( $sub_item, 'default' );
</ins><span class="cx">                                                 //$counter++;
</span><del>-                                                $counter = wp_nav_menu_sub_items($sub_item-&gt;ID, $counter, $sub_item-&gt;ID, $type, 'default');
</del><ins>+                                                $counter = wp_nav_menu_sub_items( $sub_item-&gt;ID, $counter, $sub_item-&gt;ID, $context, 'default' );
</ins><span class="cx">                                         ?&gt;
</span><span class="cx">                                 &lt;/li&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -208,29 +265,9 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">                 ?&gt;
</span><del>-
</del><span class="cx">                 &lt;/ul&gt;
</span><del>-
</del><span class="cx">         &lt;?php
</span><span class="cx">         }
</span><del>-
</del><span class="cx">         return $counter;
</span><span class="cx"> }
</span><del>-/*
-function wp_nav_menu_setup($override = false) {
-        // Custom Navigation Menu Setup
-
-        // Override for menu descriptions
-        update_option('wp_settings_nav_menu_advanced_options', 'yes');
-
-        $menus = wp_get_nav_menus();
-         if ( !empty( $menus ) ) {
-                foreach ( $menus as $menu ) {
-                        wp_delete_nav_menu( $menu-&gt;term_id );
-                }
-        }
-
-        wp_create_nav_menu( __('Main') );
-}
-/**/
</del><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudefaultitemsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu-default-items.dev.js (13511 => 13512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu-default-items.dev.js        2010-02-28 19:49:31 UTC (rev 13511)
+++ trunk/wp-admin/js/nav-menu-default-items.dev.js        2010-02-28 20:00:49 UTC (rev 13512)
</span><span class="lines">@@ -13,9 +13,13 @@
</span><span class="cx">  */
</span><span class="cx"> jQuery(document).ready(function($){
</span><span class="cx">         
</span><ins>+        wp_drag_and_drop();
+        
+        wp_update_post_data();
+        
</ins><span class="cx">         // Handle Save Button Clicks
</span><span class="cx">         $('#save_menu').click(function(){
</span><del>-                wp_update_post_data();
</del><ins>+                return wp_update_post_data();
</ins><span class="cx">         });
</span><span class="cx">                 
</span><span class="cx">         // Clear the quick search textbox
</span><span class="lines">@@ -30,12 +34,12 @@
</span><span class="cx">         
</span><span class="cx">         // Edit menu item
</span><span class="cx">         $('#menu-container .item-edit').click(function(){
</span><del>-                wp_edit_menu_item( $(this).attr('value') );
</del><ins>+                return wp_edit_menu_item( $(this).attr('value') );
</ins><span class="cx">         });
</span><span class="cx">         
</span><span class="cx">         // Delete menu item
</span><span class="cx">         $('#menu-container .item-delete').live( 'click', function(){
</span><del>-                wp_remove_menu_item( $(this).attr('value') );
</del><ins>+                return wp_remove_menu_item( $(this).attr('value') );
</ins><span class="cx">         });
</span><span class="cx">         
</span><span class="cx">         // Update menu item settings (thickbox)
</span><span class="lines">@@ -50,7 +54,7 @@
</span><span class="cx">         
</span><span class="cx">         // Close thickbox
</span><span class="cx">         $('#cancel-save').click(function(){
</span><del>-                tb_remove();
</del><ins>+                return tb_remove();
</ins><span class="cx">         });
</span><span class="cx">         
</span><span class="cx">         // Show All Button
</span><span class="lines">@@ -58,7 +62,7 @@
</span><span class="cx">                 $(this).offsetParent().find('#add-buttons-actions').attr( 'style','margin-bottom: 10px;' );
</span><span class="cx">                 $(this).offsetParent().find('.list-wrap').css( 'display','block' );
</span><span class="cx">                 $(this).siblings('.quick-search').attr( 'value', '' );                
</span><del>-                $(this).offsetParent().find('.list-wrap dt').css( 'display', 'block' );
</del><ins>+                $(this).offsetParent().find('.list-wrap li').css( 'display', 'block' );
</ins><span class="cx">                 $(this).hide();
</span><span class="cx">                 $(this).siblings('.hide-all').show();
</span><span class="cx">         });
</span><span class="lines">@@ -68,31 +72,35 @@
</span><span class="cx">                 $(this).offsetParent().find('#add-buttons-actions').attr( 'style','margin-bottom: 0px;' );
</span><span class="cx">                 $(this).offsetParent().find('.list-wrap').css( 'display','none' );
</span><span class="cx">                 $(this).siblings('.quick-search').attr( 'value', 'Search' );
</span><del>-                $(this).offsetParent().find('.list-wrap dt').css( 'display', 'none' );
</del><ins>+                $(this).offsetParent().find('.list-wrap li').css( 'display', 'none' );
</ins><span class="cx">                 $(this).hide();
</span><span class="cx">                 $(this).siblings('.show-all').show();
</span><span class="cx">         });
</span><span class="cx">         
</span><ins>+        // Add menu item to queue
+        $('.list input').click(function(){
+                
+                var item_type = jQuery(this).parent().siblings('.item-type').val();
+                var item_title = jQuery(this).parent().siblings('.item-title').val();
+                var item_url = jQuery(this).parent().siblings('.item-url').val();
+                var item_id = jQuery(this).parent().siblings('.item-id').val();
+                var item_parent_id = jQuery(this).parent().siblings('.item-parent-id').val();
+                var item_description = jQuery(this).parent().siblings('.item-description').val();
+                
+                return wp_update_queue( $(this), item_type, item_title, item_url, item_id, item_parent_id, item_description );
+        });
+        
</ins><span class="cx">         // Add queued menu items into the menu
</span><span class="cx">         $('.enqueue a').click(function(){
</span><del>-                wp_add_queued_items_to_menu(this);
</del><ins>+                return wp_add_queued_items_to_menu(this);
</ins><span class="cx">         });
</span><span class="cx">         
</span><span class="cx">         // Create the link, add it to the menu + available links section
</span><span class="cx">         $('#add-custom-link .add-to-menu a').click(function(){
</span><span class="cx">                 var link_url = $(this).offsetParent().find('#menu-item-url').val();
</span><span class="cx">                 var link_name = $(this).offsetParent().find('#menu-item-name').val();
</span><del>-                var links = $(this).offsetParent().find('#available-links input:checked');
</del><span class="cx">                 
</span><del>-                // If links are checked in the available links section, add them to the menu
-                if ( links ) {
-                        for (var i = 0; i &lt; links.length; i++) {
-                                wp_add_item_to_menu( 'Custom', links[i].name, links[i].value, links[i].id.substring( 5, links[i].id.length ), 0, '' );
-                        };
-                        
-                        // Reset the checkboxes;
-                        $(links).attr('checked', false);
-                };
</del><ins>+                wp_add_queued_items_to_menu( this );
</ins><span class="cx">                                 
</span><span class="cx">                 // Don't save the link if it was left with it's default settings
</span><span class="cx">                 if ( 'http://' == link_url || 'Menu Item' == link_name )
</span><span class="lines">@@ -119,72 +127,4 @@
</span><span class="cx">                         wp_add_item_to_menu( 'Custom', params.link_name, params.link_url, params.link_id, 0, '' );
</span><span class="cx">                 }, 'json');
</span><span class="cx">         });
</span><del>-        
-        // Add dropzones
-    $('#menu li').prepend('&lt;div class=&quot;dropzone&quot;&gt;&lt;/div&gt;');
-
-        // Make menu items draggable
-        $('#menu li').draggable({
-                    handle: ' &gt; dl',
-                    opacity: .8,
-                    addClasses: false,
-                    helper: 'clone',
-                    zIndex: 100
-        });
-
-        // Make items droppable
-        $('#menu dl, #menu .dropzone').droppable({
-                accept: '#menu li',
-                tolerance: 'pointer',
-                
-                drop: function(e, ui) {
-                        var li = $(this).parent();
-                        var child = !$(this).hasClass('dropzone');
-                        
-                        // Add UL to first child
-                if ( child &amp;&amp; li.children('ul').length == 0 ) {
-                    li.append('&lt;ul id=&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);
-                        $(this).parent().find('dt').removeAttr('style');
-                        
-                        $(this).parent().find('div:first').removeAttr('style');
-            },
-            
-                over: function() {
-                    
-                    if ( 'dropzone ui-droppable' == $(this).attr('class') ) {
-                                // Add child
-                            $(this).parent().find('dt:first').css('background', 'none').css('height', '50px');
-                                
-                    } else if ($(this).attr('class') == 'ui-droppable') {
-                                // Add above
-                            $(this).parent().find('dt:first').css('background', '#d8d8d8');
-                                
-                    } else {
-                                // do nothing
-                    }
-                    var parentid = $(this).parent().attr('id');
-               },
-            out: function() {
-                $(this).parent().find('dt').removeAttr('style');
-                $(this).parent().find('div:first').removeAttr('style');
-                $(this).filter('.dropzone').css({ borderColor: '' });
-            },
-            deactivate: function() {
-                        //
-            }
-        });
</del><span class="cx"> });
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudefaultitemsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu-default-items.js (13511 => 13512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu-default-items.js        2010-02-28 19:49:31 UTC (rev 13511)
+++ trunk/wp-admin/js/nav-menu-default-items.js        2010-02-28 20:00:49 UTC (rev 13512)
</span><span class="lines">@@ -1 +1 @@
</span><del>-jQuery(document).ready(function($){$(&quot;#save_menu&quot;).click(function(){wp_update_post_data()});$(&quot;.quick-search&quot;).click(function(){$(this).attr(&quot;value&quot;,&quot;&quot;)});$(&quot;.quick-search-submit&quot;).click(function(){$(this).siblings(&quot;.quick-search&quot;).search()});$(&quot;#menu-container .item-edit&quot;).click(function(){wp_edit_menu_item($(this).attr(&quot;value&quot;))});$(&quot;#menu-container .item-delete&quot;).live(&quot;click&quot;,function(){wp_remove_menu_item($(this).attr(&quot;value&quot;))});$(&quot;#update-menu-item&quot;).click(function(){wp_update_menu_item();tb_remove();var id=$(&quot;#edit-item-id&quot;).val();$(&quot;#menu-&quot;+id+&quot; dt:first&quot;).animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}})});$(&quot;#cancel-save&quot;).click(function(){tb_remove()});$(&quot;.show-all&quot;).click(function(){$(this).offsetParent().find(&quot;#add-buttons-actions&quot;).attr(&quot;style&quot;,&quot;margin-bottom: 10px;&quot;);$(this).offsetParent().find(&quot;.list-wrap&quot;).css(&quot;display&quot;,&quot;block&quot;);$(this).siblings(&quot;.quick-search&quot;).attr(&quot;value&quot;,&quot;&quot;);$(this).offsetParent().find(&quot;.list-wrap dt&quot;).css(&quot;display&quot;,&quot;block&quot;);$(this).hide();$(this).siblings(&quot;.hide-all&quot;).show()});$(&quot;.hide-all&quot;).click(function(){$(this).offsetParent().find(&quot;#add-buttons-actions&quot;).attr(&quot;style&quot;,&quot;margin-bottom: 0px;&quot;);$(this).offsetParent().find(&quot;.list-wrap&quot;).css(&quot;display&quot;,&quot;none&quot;);$(this).siblings(&quot;.quick-search&quot;).attr(&quot;value&quot;,&quot;Search&quot;);$(this).offsetParent().find(&quot;.list-wrap dt&quot;).css(&quot;display&quot;,&quot;none&quot;);$(this).hide();$(this).siblings(&quot;.show-all&quot;).show()});$(&quot;.enqueue a&quot;).click(function(){wp_add_queued_items_to_menu(this)});$(&quot;#add-custom-link .add-to-menu a&quot;).click(function(){var link_url=$(this).offsetParent().find(&quot;#menu-item-url&quot;).val();var link_name=$(this).offsetParent().find(&quot;#menu-item-name&quot;).val();var links=$(this).offsetParent().find(&quot;#available-links input:checked&quot;);if(links){for(var i=0;i&lt;links.length;i++){wp_add_item_to_menu(&quot;Custom&quot;,links[i].name,links[i].value,links[i].id.substring(5,links[i].id.length),0,&quot;&quot;)}$(links).attr(&quot;checked&quot;,false)}if(&quot;http://&quot;==link_url||&quot;Menu Item&quot;==link_name){return}params={action:&quot;add-menu-link&quot;,link_url:link_url,link_name:link_name,};$.post(ajaxurl,params,function(response){if(null==response||&quot;-1&quot;==response){return false}params.link_id=response;wp_add_item_to_menu(&quot;Custom&quot;,params.link_name,params.link_url,params.link_id,0,&quot;&quot;)},&quot;json&quot;)});$(&quot;#menu li&quot;).prepend('&lt;div class=&quot;dropzone&quot;&gt;&lt;/div&gt;');$(&quot;#menu li&quot;).draggable({handle:&quot; &gt; dl&quot;,opacity:0.8,addClasses:false,helper:&quot;clone&quot;,zIndex:100});$(&quot;#menu dl, #menu .dropzone&quot;).droppable({accept:&quot;#menu li&quot;,tolerance:&quot;pointer&quot;,drop:function(e,ui){var li=$(this).parent();var child=!$(this).hasClass(&quot;dropzone&quot;);if(child&amp;&amp;li.children(&quot;ul&quot;).length==0){li.append('&lt;ul id=&quot;sub-menu&quot; /&gt;')}if(child){li.children(&quot;ul&quot;).append(ui.draggable)}else{li.before(ui.draggable)}li.find(&quot;dl,.dropzone&quot;).css({backgroundColor:&quot;&quot;,borderColor:&quot;&quot;});var draggablevalue=ui.draggable.attr(&quot;value&quot;);var droppablevalue=li.attr(&quot;value&quot;);li.find(&quot;#menu-&quot;+draggablevalue).find(&quot;#parent&quot;+draggablevalue).val(droppablevalue);$(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);$(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;)},over:function(){if(&quot;dropzone ui-droppable&quot;==$(this).attr(&quot;class&quot;)){$(this).parent().find(&quot;dt:first&quot;).css(&quot;background&quot;,&quot;none&quot;).css(&quot;height&quot;,&quot;50px&quot;)}else{if($(this).attr(&quot;class&quot;)==&quot;ui-droppable&quot;){$(this).parent().find(&quot;dt:first&quot;).css(&quot;background&quot;,&quot;#d8d8d8&quot;)}else{}}var parentid=$(this).parent().attr(&quot;id&quot;)},out:function(){$(this).parent().find(&quot;dt&quot;).removeAttr(&quot;style&quot;);$(this).parent().find(&quot;div:first&quot;).removeAttr(&quot;style&quot;);$(this).filter(&quot;.dropzone&quot;).css({borderColor:&quot;&quot;})},deactivate:function(){}})});
</del><span class="cx">\ No newline at end of file
</span><ins>+jQuery(document).ready(function($){wp_drag_and_drop();wp_update_post_data();$(&quot;#save_menu&quot;).click(function(){return wp_update_post_data()});$(&quot;.quick-search&quot;).click(function(){$(this).attr(&quot;value&quot;,&quot;&quot;)});$(&quot;.quick-search-submit&quot;).click(function(){$(this).siblings(&quot;.quick-search&quot;).search()});$(&quot;#menu-container .item-edit&quot;).click(function(){return wp_edit_menu_item($(this).attr(&quot;value&quot;))});$(&quot;#menu-container .item-delete&quot;).live(&quot;click&quot;,function(){return wp_remove_menu_item($(this).attr(&quot;value&quot;))});$(&quot;#update-menu-item&quot;).click(function(){wp_update_menu_item();tb_remove();var id=$(&quot;#edit-item-id&quot;).val();$(&quot;#menu-&quot;+id+&quot; dt:first&quot;).animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}})});$(&quot;#cancel-save&quot;).click(function(){return tb_remove()});$(&quot;.show-all&quot;).click(function(){$(this).offsetParent().find(&quot;#add-buttons-actions&quot;).attr(&quot;style&quot;,&quot;margin-bottom: 10px;&quot;);$(this).offsetParent().find(&quot;.list-wrap&quot;).css(&quot;display&quot;,&quot;block&quot;);$(this).siblings(&quot;.quick-search&quot;).attr(&quot;value&quot;,&quot;&quot;);$(this).offsetParent().find(&quot;.list-wrap li&quot;).css(&quot;display&quot;,&quot;block&quot;);$(this).hide();$(this).siblings(&quot;.hide-all&quot;).show()});$(&quot;.hide-all&quot;).click(function(){$(this).offsetParent().find(&quot;#add-buttons-actions&quot;).attr(&quot;style&quot;,&quot;margin-bottom: 0px;&quot;);$(this).offsetParent().find(&quot;.list-wrap&quot;).css(&quot;display&quot;,&quot;none&quot;);$(this).siblings(&quot;.quick-search&quot;).attr(&quot;value&quot;,&quot;Search&quot;);$(this).offsetParent().find(&quot;.list-wrap li&quot;).css(&quot;display&quot;,&quot;none&quot;);$(this).hide();$(this).siblings(&quot;.show-all&quot;).show()});$(&quot;.list input&quot;).click(function(){var item_type=jQuery(this).parent().siblings(&quot;.item-type&quot;).val();var item_title=jQuery(this).parent().siblings(&quot;.item-title&quot;).val();var item_url=jQuery(this).parent().siblings(&quot;.item-url&quot;).val();var item_id=jQuery(this).parent().siblings(&quot;.item-id&quot;).val();var item_parent_id=jQuery(this).parent().siblings(&quot;.item-parent-id&quot;).val();var item_description=jQuery(this).parent().siblings(&quot;.item-description&quot;).val();return wp_update_queue($(this),item_type,item_title,item_url,item_id,item_parent_id,item_description)});$(&quot;.enqueue a&quot;).click(function(){return wp_add_queued_items_to_menu(this)});$(&quot;#add-custom-link .add-to-menu a&quot;).click(function(){var link_url=$(this).offsetParent().find(&quot;#menu-item-url&quot;).val();var link_name=$(this).offsetParent().find(&quot;#menu-item-name&quot;).val();wp_add_queued_items_to_menu(this);if(&quot;http://&quot;==link_url||&quot;Menu Item&quot;==link_name){return}params={action:&quot;add-menu-link&quot;,link_url:link_url,link_name:link_name,};$.post(ajaxurl,params,function(response){if(null==response||&quot;-1&quot;==response){return false}params.link_id=response;wp_add_item_to_menu(&quot;Custom&quot;,params.link_name,params.link_url,params.link_id,0,&quot;&quot;)},&quot;json&quot;)})});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudynamicfunctionsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu-dynamic-functions.dev.js (13511 => 13512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu-dynamic-functions.dev.js        2010-02-28 19:49:31 UTC (rev 13511)
+++ trunk/wp-admin/js/nav-menu-dynamic-functions.dev.js        2010-02-28 20:00:49 UTC (rev 13512)
</span><span class="lines">@@ -24,43 +24,21 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><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-' + o);
-        
-        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() } } );
-                });
-                
-                wp_update_post_data();
-        }
-};
-
-/**
</del><span class="cx">  * Populate the thickbox window with the selected menu items
</span><span class="cx">  *
</span><span class="cx">  * @param int o - the id of the menu li to edit.
</span><span class="cx">  */
</span><span class="cx"> function wp_edit_menu_item( id ) {
</span><del>-        console.log('wp_edit_menu_item');
-        
</del><ins>+        var itemType = jQuery('#item-type' + id).val();
</ins><span class="cx">         var itemTitle = jQuery('#item-title' + id).val();
</span><span class="cx">         var itemURL = jQuery('#item-url' + id).val();
</span><span class="cx">         var itemAttrTitle = jQuery('#item-attr-title' + id).val();
</span><span class="cx">         var itemTarget = jQuery('#item-target' + id).val();
</span><span class="cx">         var itemDesc = jQuery('#item-description' + id).val();
</span><span class="cx">         
</span><del>-        console.log(id);
-        console.log(itemTitle);
-        console.log(itemURL);
-        console.log(itemAttrTitle);
-        console.log(itemTarget);
-        console.log(itemDesc);
</del><ins>+        // Disable the ability to edit the url for page and category items
+        if ( 'page' == itemType || 'category' == itemType )
+                jQuery( '#edit-item-url' ).attr('disabled', 'disabled' );
</ins><span class="cx">         
</span><span class="cx">         // Populate the fields for thickbox
</span><span class="cx">         jQuery( '#edit-item-id' ).val(id);
</span><span class="lines">@@ -83,13 +61,6 @@
</span><span class="cx">         var itemTarget = jQuery('#edit-item-target').val();
</span><span class="cx">         var itemDesc = jQuery('#edit-item-description').val();
</span><span class="cx">         
</span><del>-        console.log(id);
-        console.log(itemTitle);
-        console.log(itemURL);
-        console.log(itemAttrTitle);
-        console.log(itemTarget);
-        console.log(itemDesc);
-        
</del><span class="cx">         // update menu item settings        
</span><span class="cx">         jQuery('#menu-' + id).find('.item-title:first').html(itemTitle);
</span><span class="cx">         jQuery('#item-title' + id).val(itemTitle);
</span><span class="lines">@@ -100,29 +71,47 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * 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-' + o);
+        
+        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() } } );
+                });
+                
+                wp_update_post_data();
+        }
+};
+
+/**
</ins><span class="cx">  * Prepares menu items for POST
</span><span class="cx">  */
</span><span class="cx"> function wp_update_post_data() {
</span><span class="cx">         var i = 0;
</span><span class="cx">         
</span><del>-         jQuery('#menu li').each(function(i) {
</del><ins>+         jQuery('.menu li').each(function(i) {
</ins><span class="cx">                 i = i + 1;
</span><span class="cx">              var j = jQuery(this).attr('value');
</span><span class="cx"> 
</span><del>-             jQuery(this).find('#position' + j).attr('value', i);
</del><ins>+             jQuery(this).find('#item-position' + j).attr('value', i);
</ins><span class="cx">              jQuery(this).attr('id','menu-' + i);
</span><span class="cx">              jQuery(this).attr('value', i);
</span><span class="cx"> 
</span><del>-             jQuery(this).find('#dbid' + j).attr('name','dbid' + i);
-             jQuery(this).find('#dbid' + j).attr('id','dbid' + i);
</del><ins>+             jQuery(this).find('#item-dbid' + j).attr('name','item-dbid' + i);
+             jQuery(this).find('#item-dbid' + j).attr('id','item-dbid' + i);
</ins><span class="cx"> 
</span><del>-                jQuery(this).find('#postmenu' + j).attr('name','postmenu' + i);
-             jQuery(this).find('#postmenu' + j).attr('id','postmenu' + i);
</del><ins>+                jQuery(this).find('#item-postmenu' + j).attr('name','item-postmenu' + i);
+             jQuery(this).find('#item-postmenu' + j).attr('id','item-postmenu' + i);
</ins><span class="cx"> 
</span><del>-             var p = jQuery(this).find('#parent' + j).parent().parent().parent().attr('value');
</del><ins>+             var p = jQuery(this).find('#item-parent' + j).parent().parent().parent().attr('value');
</ins><span class="cx"> 
</span><del>-                jQuery(this).find('#parent' + j).attr('name','parent' + i);
-                jQuery(this).find('#parent' + j).attr('id','parent' + i);
</del><ins>+                jQuery(this).find('#item-parent' + j).attr('name','item-parent' + i);
+                jQuery(this).find('#item-parent' + j).attr('id','item-parent' + i);
</ins><span class="cx">                 
</span><span class="cx">                 if (p) {
</span><span class="cx">                         // Do nothing
</span><span class="lines">@@ -131,7 +120,7 @@
</span><span class="cx">                         p = 0;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                jQuery(this).find('#parent' + j).attr('value', p);
</del><ins>+                jQuery(this).find('#item-parent' + j).attr('value', p);
</ins><span class="cx"> 
</span><span class="cx">                 jQuery(this).find('#item-title' + j).attr('name','item-title' + i);
</span><span class="cx">                 jQuery(this).find('#item-title' + j).attr('id','item-title' + i);
</span><span class="lines">@@ -148,11 +137,11 @@
</span><span class="cx">                 jQuery(this).find('#item-target' + j).attr('name','item-target' + i);
</span><span class="cx">                 jQuery(this).find('#item-target' + j).attr('id','item-target' + i);
</span><span class="cx"> 
</span><del>-                jQuery(this).find('#position' + j).attr('name', 'position' + i);
-                jQuery(this).find('#position' + j).attr('id', 'position' + i);
</del><ins>+                jQuery(this).find('#item-position' + j).attr('name', 'item-position' + i);
+                jQuery(this).find('#item-position' + j).attr('id', 'item-position' + i);
</ins><span class="cx"> 
</span><del>-                jQuery(this).find('#linktype' + j).attr('name', 'linktype' + i);
-                jQuery(this).find('#linktype' + j).attr('id', 'linktype' + i);
</del><ins>+                jQuery(this).find('#item-type' + j).attr('name', 'item-type' + i);
+                jQuery(this).find('#item-type' + j).attr('id', 'item-type' + i);
</ins><span class="cx"> 
</span><span class="cx">                 jQuery('#li-count').attr( 'value', i );
</span><span class="cx">    });
</span><span class="lines">@@ -169,30 +158,20 @@
</span><span class="cx">  * @param int itemparentid - default 0.
</span><span class="cx">  * @param string itemdescription - the description of the menu item.
</span><span class="cx">  */
</span><del>-function wp_add_item_to_menu( additemtype, itemtext, itemurl, itemid, itemparentid, itemdescription ) {
-        var inputvaluevarname = '';
-        var inputvaluevarurl = '';
-        var inputitemid = '';
-        var inputparentid= '';
-        var inputdescription = '';
</del><ins>+function wp_add_item_to_menu( item_type, item_title, item_url, item_id, item_parent_id, item_description ) {
</ins><span class="cx">         var randomnumber = wp_get_unique_menu_id();
</span><del>-
-        inputvaluevarname = htmlentities(itemtext.toString());
-        inputvaluevarurl = itemurl.toString();
-        inputitemid = itemid;
-        inputparentid = itemparentid;
-        inputlinktype = 'custom';
-        inputdescription = htmlentities(itemdescription.toString());
</del><span class="cx">         
</span><span class="cx">         // Adds the item in the queue
</span><del>-        jQuery('#menu').append('&lt;li id=&quot;menu-' + 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;' + inputvaluevarname + '&lt;/span&gt;&lt;span class=&quot;item-controls&quot;&gt;&lt;span class=&quot;item-type&quot;&gt;' + additemtype + '&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=380&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;&lt;a class=&quot;hide&quot; href=&quot;' + inputvaluevarurl + '&quot;&gt;' + inputvaluevarname + '&lt;/a&gt;&lt;input type=&quot;hidden&quot; name=&quot;postmenu' + randomnumber + '&quot; id=&quot;postmenu' + randomnumber + '&quot; value=&quot;' + inputitemid + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;parent' + randomnumber + '&quot; id=&quot;parent' + randomnumber + '&quot; value=&quot;' + inputparentid + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-title' + randomnumber + '&quot; id=&quot;item-title' + randomnumber + '&quot; value=&quot;' + inputvaluevarname + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-url' + randomnumber + '&quot; id=&quot;item-url' + randomnumber + '&quot; value=&quot;' + inputvaluevarurl + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-description' + randomnumber + '&quot; id=&quot;item-description' + randomnumber + '&quot; value=&quot;' + inputdescription + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;position' + randomnumber + '&quot; id=&quot;position' + randomnumber + '&quot; value=&quot;' + randomnumber + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;linktype' + randomnumber + '&quot; id=&quot;linktype' + randomnumber + '&quot; value=&quot;' + inputlinktype + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-attr-title' + randomnumber + '&quot; id=&quot;item-attr-title' + randomnumber + '&quot; value=&quot;' + inputvaluevarname + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-target' + randomnumber + '&quot; id=&quot;item-target' + randomnumber + '&quot; value=&quot;0&quot; /&gt;&lt;/li&gt;');
</del><ins>+        jQuery('.menu').append('&lt;li id=&quot;menu-' + 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_type + '&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=380&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;&lt;input type=&quot;hidden&quot; name=&quot;item-postmenu' + randomnumber + '&quot; id=&quot;item-postmenu' + randomnumber + '&quot; value=&quot;' + item_id + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-parent' + randomnumber + '&quot; id=&quot;item-parent' + randomnumber + '&quot; value=&quot;' + item_parent_id + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-title' + randomnumber + '&quot; id=&quot;item-title' + randomnumber + '&quot; value=&quot;' + item_title + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-url' + randomnumber + '&quot; id=&quot;item-url' + randomnumber + '&quot; value=&quot;' + item_url + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-description' + randomnumber + '&quot; id=&quot;item-description' + randomnumber + '&quot; value=&quot;' + item_description + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-position' + randomnumber + '&quot; id=&quot;item-position' + randomnumber + '&quot; value=&quot;' + randomnumber + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-type' + randomnumber + '&quot; id=&quot;item-type' + randomnumber + '&quot; value=&quot;' + item_type + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-attr-title' + randomnumber + '&quot; id=&quot;item-attr-title' + randomnumber + '&quot; value=&quot;' + item_title + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-target' + randomnumber + '&quot; id=&quot;item-target' + randomnumber + '&quot; value=&quot;0&quot; /&gt;&lt;/li&gt;');
</ins><span class="cx">         
</span><span class="cx">         // Give some feedback to the user
</span><del>-        jQuery( '#menu #menu-' + randomnumber + ' dt:first' ).animate( { backgroundColor: '#FFFF33' }, { duration: 'normal', complete: function() { jQuery(this).css( 'backgroundColor', '' ); }});
</del><ins>+        jQuery( '.menu #menu-' + randomnumber + ' dt:first' ).animate( { backgroundColor: '#FFFF33' }, { duration: 'normal', complete: function() { jQuery(this).css( 'backgroundColor', '' ); }});
</ins><span class="cx">         
</span><span class="cx">         // Enable drag-n-drop
</span><span class="cx">         wp_drag_and_drop();
</span><span class="cx">         
</span><ins>+        wp_update_post_data();
+        
</ins><span class="cx">         // Reload thickbox
</span><span class="cx">         tb_init('a.thickbox, area.thickbox, input.thickbox');
</span><span class="cx"> };
</span><span class="lines">@@ -200,55 +179,26 @@
</span><span class="cx"> /*
</span><span class="cx">  * Queues items in perperation for appendToList
</span><span class="cx">  *
</span><del>- * @param string id - The menu item's id
- * @param string additemtype - Page, Category, or Custom.
- * @param string itemtext - menu text.
- * @param string itemurl - url of the menu.
- * @param int itemid - menu id.
- * @param int itemparentid - default 0.
- * @param string itemdescription - the description of the menu item.
</del><ins>+ * @param string type - Page, Category, or Custom.
+ * @param string link - menu text.
+ * @param string url - url of the menu.
+ * @param int id - menu id.
+ * @param int parent_id - default 0.
+ * @param string description - the description of the menu item.
</ins><span class="cx"> */
</span><del>-function wp_update_queue( additemtype, itemtext, itemurl, itemid, itemparentid, itemdescription ) {
-        var inputvaluevarname = '';
-        var inputvaluevarurl = '';
-        var inputitemid = '';
-        var inputparentid= '';
-        var inputdescription = '';
</del><ins>+function wp_update_queue( e, item_type, item_title, item_url, item_id, item_parent_id, item_description ) {
</ins><span class="cx">         var randomnumber = wp_get_unique_menu_id();
</span><del>-
-        if ( additemtype == navMenuL10n.page ) {
-                inputvaluevarname = htmlentities(itemtext.toString());
-                inputvaluevarurl = itemurl.toString();
-                inputitemid = itemid.toString();
-                inputparentid = '0';
-                inputlinktype = 'page';
-                inputdescription = htmlentities(itemdescription.toString());
-
-        } else if ( additemtype == navMenuL10n.category ) {
-                inputvaluevarname = htmlentities(itemtext.toString());
-                inputvaluevarurl = itemurl.toString();
-                inputitemid = itemid.toString();
-                inputparentid = '0';
-                inputlinktype = 'category';
-                inputdescription = htmlentities(itemdescription.toString());
-        }
-                        
-        // Adds or removes the item from the queue
-        if ( jQuery(menu_item_id = '#menu-item-' + inputitemid).attr('checked') ) {
-                
</del><ins>+        var menu_item_id = jQuery(e).attr('id');
+        
+        if ( jQuery(e).attr('checked') ) {
</ins><span class="cx">                 // Add menu item to the queue
</span><del>-                jQuery('#queue').append('&lt;li id=&quot;menu-' + 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;' + inputvaluevarname + '&lt;/span&gt;&lt;span class=&quot;item-controls&quot;&gt;&lt;span class=&quot;item-type&quot;&gt;' + additemtype + '&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=380&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;&lt;a class=&quot;hide&quot; href=&quot;' + inputvaluevarurl + '&quot;&gt;' + inputvaluevarname + '&lt;/a&gt;&lt;input type=&quot;hidden&quot; name=&quot;postmenu' + randomnumber + '&quot; id=&quot;postmenu' + randomnumber + '&quot; value=&quot;' + inputitemid + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;parent' + randomnumber + '&quot; id=&quot;parent' + randomnumber + '&quot; value=&quot;' + inputparentid + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-title' + randomnumber + '&quot; id=&quot;item-title' + randomnumber + '&quot; value=&quot;' + inputvaluevarname + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-url' + randomnumber + '&quot; id=&quot;item-url' + randomnumber + '&quot; value=&quot;' + inputvaluevarurl + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-description' + randomnumber + '&quot; id=&quot;item-description' + randomnumber + '&quot; value=&quot;' + inputdescription + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;position' + randomnumber + '&quot; id=&quot;position' + randomnumber + '&quot; value=&quot;' + randomnumber + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;linktype' + randomnumber + '&quot; id=&quot;linktype' + randomnumber + '&quot; value=&quot;' + inputlinktype + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-attr-title' + randomnumber + '&quot; id=&quot;item-attr-title' + randomnumber + '&quot; value=&quot;' + inputvaluevarname + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-target' + randomnumber + '&quot; id=&quot;item-target' + randomnumber + '&quot; value=&quot;0&quot; /&gt;&lt;/li&gt;');
-        } else {
</del><ins>+                jQuery('#queue').append('&lt;li id=&quot;menu-' + 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_type + '&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=380&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;&lt;input type=&quot;hidden&quot; name=&quot;item-postmenu' + randomnumber + '&quot; id=&quot;item-postmenu' + randomnumber + '&quot; value=&quot;' + item_id + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-parent' + randomnumber + '&quot; id=&quot;item-parent' + randomnumber + '&quot; value=&quot;' + item_parent_id + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-title' + randomnumber + '&quot; id=&quot;item-title' + randomnumber + '&quot; value=&quot;' + item_title + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-url' + randomnumber + '&quot; id=&quot;item-url' + randomnumber + '&quot; value=&quot;' + item_url + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-description' + randomnumber + '&quot; id=&quot;item-description' + randomnumber + '&quot; value=&quot;' + item_description + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-position' + randomnumber + '&quot; id=&quot;item-position' + randomnumber + '&quot; value=&quot;' + randomnumber + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-type' + randomnumber + '&quot; id=&quot;item-type' + randomnumber + '&quot; value=&quot;' + item_type + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-attr-title' + randomnumber + '&quot; id=&quot;item-attr-title' + randomnumber + '&quot; value=&quot;' + item_title + '&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-target' + randomnumber + '&quot; id=&quot;item-target' + randomnumber + '&quot; value=&quot;0&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-id' + randomnumber + '&quot; id=&quot;item-id' + randomnumber + '&quot; value=&quot;'+ menu_item_id +'&quot; /&gt;&lt;/li&gt;');
</ins><span class="cx">                 
</span><del>-                // Get the item in the queue
-                for ( var i = 0; i &lt; jQuery('#queue li input[name^=&quot;postmenu&quot;]').length; i++ ) {
-                        if ( itemid == jQuery('#queue li input[name^=&quot;postmenu&quot;]')[i].value ) {
-                                var menu_queue_id = jQuery('#queue li input[name^=&quot;postmenu&quot;]')[i].name.substring( 8, jQuery('#queue li input[name^=&quot;postmenu&quot;]')[i].name.length );
-                        };
</del><ins>+        } else {
+                // Remove the item from the queue
+                if ( menu_item_id == jQuery('#queue li input[name^=&quot;item-id&quot;]' ).val() ) {
+                        jQuery('#queue li input[name^=&quot;item-id&quot;]' ).parent().remove()
</ins><span class="cx">                 };
</span><del>-                
-                // Removes the item from the queue
-                jQuery('#queue li#menu-' + menu_queue_id).remove();
</del><span class="cx">         };
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -265,7 +215,7 @@
</span><span class="cx">         jQuery('#queue').empty();
</span><span class="cx">                 
</span><span class="cx">         // Appends HTML to the menu
</span><del>-        jQuery('#menu').append( items );
</del><ins>+        jQuery('.menu').append( items );
</ins><span class="cx"> 
</span><span class="cx">         // Give some feedback to the user
</span><span class="cx">         jQuery(items).each(function(){
</span><span class="lines">@@ -288,18 +238,25 @@
</span><span class="cx">  * Allow the items in the Menu to be dragged and dropped.
</span><span class="cx">  */
</span><span class="cx"> function wp_drag_and_drop() {
</span><ins>+        // 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;');
+                };
+        });
+
</ins><span class="cx">         // make menu item draggable
</span><del>-        jQuery('#menu li').draggable({
</del><ins>+        jQuery('.menu li').draggable({
</ins><span class="cx">                 handle: ' &gt; dl',
</span><span class="cx">                 opacity: .8,
</span><span class="cx">                 addClasses: false,
</span><span class="cx">                 helper: 'clone',
</span><del>-                zIndex: 100
</del><ins>+                zIndex: 100,
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         // make menu item droppable
</span><del>-        jQuery('#menu li dl, #menu li .dropzone').droppable({
-                accept: '#menu li',
</del><ins>+        jQuery('.menu li dl, .menu li .dropzone').droppable({
+                accept: '.menu li',
</ins><span class="cx">                 tolerance: 'pointer',
</span><span class="cx">                 drop: function(e, ui) {
</span><span class="cx">                         var li = jQuery(this).parent();
</span><span class="lines">@@ -307,7 +264,7 @@
</span><span class="cx">                         
</span><span class="cx">                         // Append UL to first child
</span><span class="cx">                         if ( child &amp;&amp; li.children('ul').length == 0 ) {
</span><del>-                                li.append( '&lt;ul/&gt;' );
</del><ins>+                                li.append( '&lt;ul class=&quot;sub-menu&quot; /&gt;' );
</ins><span class="cx">                         }
</span><span class="cx">                         // Make it draggable
</span><span class="cx">                         if ( child ) {
</span><span class="lines">@@ -322,18 +279,18 @@
</span><span class="cx">                         var droppablevalue = li.attr('value');
</span><span class="cx">                         
</span><span class="cx">                         li.find('#menu-' + draggablevalue).find('#parent' + draggablevalue).val(droppablevalue);
</span><del>-                        jQuery(this).parent().find(&quot;dt&quot;).removeAttr('style');
-                        jQuery(this).parent().find(&quot;div:first&quot;).removeAttr('style');
</del><ins>+                        jQuery(this).parent().find('dt').removeAttr('style');
+                        jQuery(this).parent().find('div:first').removeAttr('style');
</ins><span class="cx"> 
</span><span class="cx">                 },
</span><span class="cx">                 over: function() {
</span><span class="cx">                             // Add child
</span><span class="cx">                             if ( jQuery(this).attr('class') == 'dropzone ui-droppable' ) {
</span><del>-                                    jQuery(this).parent().find(&quot;div:first&quot;).css('background', 'none').css('height', '50px');
</del><ins>+                                    jQuery(this).parent().find('div:first').css('background', 'none').css('height', '50px');
</ins><span class="cx">                             }
</span><span class="cx">                             // Add above
</span><span class="cx">                             else if ( jQuery(this).attr('class') == 'ui-droppable' ) {
</span><del>-                                    jQuery(this).parent().find(&quot;dt:first&quot;).css('background', '#d8d8d8');
</del><ins>+                                    jQuery(this).parent().find('dt:first').css('background', '#d8d8d8');
</ins><span class="cx">                             } else {
</span><span class="cx">                                         // do nothing
</span><span class="cx">                             }
</span><span class="lines">@@ -341,8 +298,8 @@
</span><span class="cx"> 
</span><span class="cx">                        },
</span><span class="cx">                     out: function() {
</span><del>-                        jQuery(this).parent().find(&quot;dt&quot;).removeAttr('style');
-                        jQuery(this).parent().find(&quot;div:first&quot;).removeAttr('style');
</del><ins>+                        jQuery(this).parent().find('dt').removeAttr('style');
+                        jQuery(this).parent().find('div:first').removeAttr('style');
</ins><span class="cx">                         jQuery(this).filter('.dropzone').css({ borderColor: '' });
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="lines">@@ -353,7 +310,7 @@
</span><span class="cx">  * Gets a unique number based on how many items are in the menu
</span><span class="cx">  */
</span><span class="cx"> function wp_get_unique_menu_id() {
</span><del>-        var count = document.getElementById('menu').getElementsByTagName('li').length + 1;
</del><ins>+        var count = jQuery('.menu li').length + 1;
</ins><span class="cx">         var randomnumber = count;
</span><span class="cx">         var validatetest = 0;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudynamicfunctionsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu-dynamic-functions.js (13511 => 13512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu-dynamic-functions.js        2010-02-28 19:49:31 UTC (rev 13511)
+++ trunk/wp-admin/js/nav-menu-dynamic-functions.js        2010-02-28 20:00:49 UTC (rev 13512)
</span><span class="lines">@@ -1 +1 @@
</span><del>-function wp_update_links_list(e){var link='&lt;li&gt;&lt;dl&gt;&lt;dt&gt;&lt;label class=&quot;item-title&quot;&gt;&lt;input type=&quot;checkbox&quot; id=&quot;link-'+e.link_id+'&quot; name=&quot;'+e.link_name+'&quot; value=&quot;'+e.link_url+'&quot; /&gt;'+e.link_name+&quot;&lt;/label&gt;&lt;/dt&gt;&lt;/dl&gt;&lt;/li&gt;&quot;;jQuery(&quot;#available-links .list&quot;).prepend(link);jQuery(&quot;#available-links .list #link-&quot;+e.link_id).parent().animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}})}function wp_remove_menu_item(o){var todelete=document.getElementById(&quot;menu-&quot;+o);if(todelete){jQuery(todelete).find(&quot;dt&quot;).each(function(){jQuery(this).animate({backgroundColor:&quot;#FF3333&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).parent().parent().remove()}})});wp_update_post_data()}}function wp_edit_menu_item(id){console.log(&quot;wp_edit_menu_item&quot;);var itemTitle=jQuery(&quot;#item-title&quot;+id).val();var itemURL=jQuery(&quot;#item-url&quot;+id).val();var itemAttrTitle=jQuery(&quot;#item-attr-title&quot;+id).val();var itemTarget=jQuery(&quot;#item-target&quot;+id).val();var itemDesc=jQuery(&quot;#item-description&quot;+id).val();console.log(id);console.log(itemTitle);console.log(itemURL);console.log(itemAttrTitle);console.log(itemTarget);console.log(itemDesc);jQuery(&quot;#edit-item-id&quot;).val(id);jQuery(&quot;#edit-item-title&quot;).val(itemTitle);jQuery(&quot;#edit-item-url&quot;).val(itemURL);jQuery(&quot;#edit-item-attr-title&quot;).val(itemAttrTitle);jQuery(&quot;#edit-item-target&quot;).val(itemTarget);jQuery(&quot;#edit-item-target option[value='&quot;+itemTarget+&quot;']&quot;).attr(&quot;selected&quot;,&quot;selected&quot;);jQuery(&quot;#edit-item-description&quot;).val(itemDesc)}function wp_update_menu_item(){var id=jQuery(&quot;#edit-item-id&quot;).val();var itemTitle=jQuery(&quot;#edit-item-title&quot;).val();var itemURL=jQuery(&quot;#edit-item-url&quot;).val();var itemAttrTitle=jQuery(&quot;#edit-item-attr-title&quot;).val();var itemTarget=jQuery(&quot;#edit-item-target&quot;).val();var itemDesc=jQuery(&quot;#edit-item-description&quot;).val();console.log(id);console.log(itemTitle);console.log(itemURL);console.log(itemAttrTitle);console.log(itemTarget);console.log(itemDesc);jQuery(&quot;#menu-&quot;+id).find(&quot;.item-title:first&quot;).html(itemTitle);jQuery(&quot;#item-title&quot;+id).val(itemTitle);jQuery(&quot;#item-url&quot;+id).val(itemURL);jQuery(&quot;#item-attr-title&quot;+id).val(itemAttrTitle);jQuery(&quot;#item-target&quot;+id).val(itemTarget);jQuery(&quot;#item-description&quot;+id).val(itemDesc)}function wp_update_post_data(){var i=0;jQuery(&quot;#menu li&quot;).each(function(i){i=i+1;var j=jQuery(this).attr(&quot;value&quot;);jQuery(this).find(&quot;#position&quot;+j).attr(&quot;value&quot;,i);jQuery(this).attr(&quot;id&quot;,&quot;menu-&quot;+i);jQuery(this).attr(&quot;value&quot;,i);jQuery(this).find(&quot;#dbid&quot;+j).attr(&quot;name&quot;,&quot;dbid&quot;+i);jQuery(this).find(&quot;#dbid&quot;+j).attr(&quot;id&quot;,&quot;dbid&quot;+i);jQuery(this).find(&quot;#postmenu&quot;+j).attr(&quot;name&quot;,&quot;postmenu&quot;+i);jQuery(this).find(&quot;#postmenu&quot;+j).attr(&quot;id&quot;,&quot;postmenu&quot;+i);var p=jQuery(this).find(&quot;#parent&quot;+j).parent().parent().parent().attr(&quot;value&quot;);jQuery(this).find(&quot;#parent&quot;+j).attr(&quot;name&quot;,&quot;parent&quot;+i);jQuery(this).find(&quot;#parent&quot;+j).attr(&quot;id&quot;,&quot;parent&quot;+i);if(p){}else{p=0}jQuery(this).find(&quot;#parent&quot;+j).attr(&quot;value&quot;,p);jQuery(this).find(&quot;#item-title&quot;+j).attr(&quot;name&quot;,&quot;item-title&quot;+i);jQuery(this).find(&quot;#item-title&quot;+j).attr(&quot;id&quot;,&quot;item-title&quot;+i);jQuery(this).find(&quot;#item-url&quot;+j).attr(&quot;name&quot;,&quot;item-url&quot;+i);jQuery(this).find(&quot;#item-url&quot;+j).attr(&quot;id&quot;,&quot;item-url&quot;+i);jQuery(this).find(&quot;#item-description&quot;+j).attr(&quot;name&quot;,&quot;item-description&quot;+i);jQuery(this).find(&quot;#item-description&quot;+j).attr(&quot;id&quot;,&quot;item-description&quot;+i);jQuery(this).find(&quot;#item-attr-title&quot;+j).attr(&quot;name&quot;,&quot;item-attr-title&quot;+i);jQuery(this).find(&quot;#item-attr-title&quot;+j).attr(&quot;id&quot;,&quot;item-attr-title&quot;+i);jQuery(this).find(&quot;#item-target&quot;+j).attr(&quot;name&quot;,&quot;item-target&quot;+i);jQuery(this).find(&quot;#item-target&quot;+j).attr(&quot;id&quot;,&quot;item-target&quot;+i);jQuery(this).find(&quot;#position&quot;+j).attr(&quot;name&quot;,&quot;position&quot;+i);jQuery(this).find(&quot;#position&quot;+j).attr(&quot;id&quot;,&quot;position&quot;+i);jQuery(this).find(&quot;#linktype&quot;+j).attr(&quot;name&quot;,&quot;linktype&quot;+i);jQuery(this).find(&quot;#linktype&quot;+j).attr(&quot;id&quot;,&quot;linktype&quot;+i);jQuery(&quot;#li-count&quot;).attr(&quot;value&quot;,i)})}function wp_add_item_to_menu(additemtype,itemtext,itemurl,itemid,itemparentid,itemdescription){var inputvaluevarname=&quot;&quot;;var inputvaluevarurl=&quot;&quot;;var inputitemid=&quot;&quot;;var inputparentid=&quot;&quot;;var inputdescription=&quot;&quot;;var randomnumber=wp_get_unique_menu_id();inputvaluevarname=htmlentities(itemtext.toString());inputvaluevarurl=itemurl.toString();inputitemid=itemid;inputparentid=itemparentid;inputlinktype=&quot;custom&quot;;inputdescription=htmlentities(itemdescription.toString());jQuery(&quot;#menu&quot;).append('&lt;li id=&quot;menu-'+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;'+inputvaluevarname+'&lt;/span&gt;&lt;span class=&quot;item-controls&quot;&gt;&lt;span class=&quot;item-type&quot;&gt;'+additemtype+'&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=380&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;&lt;a class=&quot;hide&quot; href=&quot;'+inputvaluevarurl+'&quot;&gt;'+inputvaluevarname+'&lt;/a&gt;&lt;input type=&quot;hidden&quot; name=&quot;postmenu'+randomnumber+'&quot; id=&quot;postmenu'+randomnumber+'&quot; value=&quot;'+inputitemid+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;parent'+randomnumber+'&quot; id=&quot;parent'+randomnumber+'&quot; value=&quot;'+inputparentid+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-title'+randomnumber+'&quot; id=&quot;item-title'+randomnumber+'&quot; value=&quot;'+inputvaluevarname+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-url'+randomnumber+'&quot; id=&quot;item-url'+randomnumber+'&quot; value=&quot;'+inputvaluevarurl+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-description'+randomnumber+'&quot; id=&quot;item-description'+randomnumber+'&quot; value=&quot;'+inputdescription+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;position'+randomnumber+'&quot; id=&quot;position'+randomnumber+'&quot; value=&quot;'+randomnumber+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;linktype'+randomnumber+'&quot; id=&quot;linktype'+randomnumber+'&quot; value=&quot;'+inputlinktype+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-attr-title'+randomnumber+'&quot; id=&quot;item-attr-title'+randomnumber+'&quot; value=&quot;'+inputvaluevarname+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-target'+randomnumber+'&quot; id=&quot;item-target'+randomnumber+'&quot; value=&quot;0&quot; /&gt;&lt;/li&gt;');jQuery(&quot;#menu #menu-&quot;+randomnumber+&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_update_queue(additemtype,itemtext,itemurl,itemid,itemparentid,itemdescription){var inputvaluevarname=&quot;&quot;;var inputvaluevarurl=&quot;&quot;;var inputitemid=&quot;&quot;;var inputparentid=&quot;&quot;;var inputdescription=&quot;&quot;;var randomnumber=wp_get_unique_menu_id();if(additemtype==navMenuL10n.page){inputvaluevarname=htmlentities(itemtext.toString());inputvaluevarurl=itemurl.toString();inputitemid=itemid.toString();inputparentid=&quot;0&quot;;inputlinktype=&quot;page&quot;;inputdescription=htmlentities(itemdescription.toString())}else{if(additemtype==navMenuL10n.category){inputvaluevarname=htmlentities(itemtext.toString());inputvaluevarurl=itemurl.toString();inputitemid=itemid.toString();inputparentid=&quot;0&quot;;inputlinktype=&quot;category&quot;;inputdescription=htmlentities(itemdescription.toString())}}if(jQuery(menu_item_id=&quot;#menu-item-&quot;+inputitemid).attr(&quot;checked&quot;)){jQuery(&quot;#queue&quot;).append('&lt;li id=&quot;menu-'+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;'+inputvaluevarname+'&lt;/span&gt;&lt;span class=&quot;item-controls&quot;&gt;&lt;span class=&quot;item-type&quot;&gt;'+additemtype+'&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=380&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;&lt;a class=&quot;hide&quot; href=&quot;'+inputvaluevarurl+'&quot;&gt;'+inputvaluevarname+'&lt;/a&gt;&lt;input type=&quot;hidden&quot; name=&quot;postmenu'+randomnumber+'&quot; id=&quot;postmenu'+randomnumber+'&quot; value=&quot;'+inputitemid+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;parent'+randomnumber+'&quot; id=&quot;parent'+randomnumber+'&quot; value=&quot;'+inputparentid+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-title'+randomnumber+'&quot; id=&quot;item-title'+randomnumber+'&quot; value=&quot;'+inputvaluevarname+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-url'+randomnumber+'&quot; id=&quot;item-url'+randomnumber+'&quot; value=&quot;'+inputvaluevarurl+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-description'+randomnumber+'&quot; id=&quot;item-description'+randomnumber+'&quot; value=&quot;'+inputdescription+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;position'+randomnumber+'&quot; id=&quot;position'+randomnumber+'&quot; value=&quot;'+randomnumber+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;linktype'+randomnumber+'&quot; id=&quot;linktype'+randomnumber+'&quot; value=&quot;'+inputlinktype+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-attr-title'+randomnumber+'&quot; id=&quot;item-attr-title'+randomnumber+'&quot; value=&quot;'+inputvaluevarname+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-target'+randomnumber+'&quot; id=&quot;item-target'+randomnumber+'&quot; value=&quot;0&quot; /&gt;&lt;/li&gt;')}else{for(var i=0;i&lt;jQuery('#queue li input[name^=&quot;postmenu&quot;]').length;i++){if(itemid==jQuery('#queue li input[name^=&quot;postmenu&quot;]')[i].value){var menu_queue_id=jQuery('#queue li input[name^=&quot;postmenu&quot;]')[i].name.substring(8,jQuery('#queue li input[name^=&quot;postmenu&quot;]')[i].name.length)}}jQuery(&quot;#queue li#menu-&quot;+menu_queue_id).remove()}}function wp_add_queued_items_to_menu(button){var items=jQuery(&quot;#queue&quot;).children();jQuery(&quot;#queue&quot;).empty();jQuery(&quot;#menu&quot;).append(items);jQuery(items).each(function(){jQuery(this).find(&quot;dt&quot;).animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}})});jQuery(button).offsetParent().find(&quot;.list-container input&quot;).attr(&quot;checked&quot;,false);wp_update_post_data();wp_drag_and_drop();tb_init(&quot;a.thickbox, area.thickbox, input.thickbox&quot;)}function wp_drag_and_drop(){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(e,ui){var li=jQuery(this).parent();var child=!jQuery(this).hasClass(&quot;dropzone&quot;);if(child&amp;&amp;li.children(&quot;ul&quot;).length==0){li.append(&quot;&lt;ul/&gt;&quot;)}if(child){li.children(&quot;ul&quot;).append(ui.draggable)}else{li.before(ui.draggable)}li.find(&quot;dl,.dropzone&quot;).css({backgroundColor:&quot;&quot;,borderColor:&quot;&quot;});var draggablevalue=ui.draggable.attr(&quot;value&quot;);var droppablevalue=li.attr(&quot;value&quot;);li.find(&quot;#menu-&quot;+draggablevalue).find(&quot;#parent&quot;+draggablevalue).val(droppablevalue);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 parentid=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_get_unique_menu_id(){var count=document.getElementById(&quot;menu&quot;).getElementsByTagName(&quot;li&quot;).length+1;var randomnumber=count;var validatetest=0;try{var test=document.getElementById(&quot;menu-&quot;+randomnumber.toString()).value}catch(err){validatetest=1}while(validatetest==0){randomnumber=randomnumber+1;try{var test2=document.getElementById(&quot;menu-&quot;+randomnumber.toString()).value}catch(err){validatetest=1}}return randomnumber};
</del><span class="cx">\ No newline at end of file
</span><ins>+function wp_update_links_list(e){var link='&lt;li&gt;&lt;dl&gt;&lt;dt&gt;&lt;label class=&quot;item-title&quot;&gt;&lt;input type=&quot;checkbox&quot; id=&quot;link-'+e.link_id+'&quot; name=&quot;'+e.link_name+'&quot; value=&quot;'+e.link_url+'&quot; /&gt;'+e.link_name+&quot;&lt;/label&gt;&lt;/dt&gt;&lt;/dl&gt;&lt;/li&gt;&quot;;jQuery(&quot;#available-links .list&quot;).prepend(link);jQuery(&quot;#available-links .list #link-&quot;+e.link_id).parent().animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}})}function wp_edit_menu_item(id){var itemType=jQuery(&quot;#item-type&quot;+id).val();var itemTitle=jQuery(&quot;#item-title&quot;+id).val();var itemURL=jQuery(&quot;#item-url&quot;+id).val();var itemAttrTitle=jQuery(&quot;#item-attr-title&quot;+id).val();var itemTarget=jQuery(&quot;#item-target&quot;+id).val();var itemDesc=jQuery(&quot;#item-description&quot;+id).val();if(&quot;page&quot;==itemType||&quot;category&quot;==itemType){jQuery(&quot;#edit-item-url&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;)}jQuery(&quot;#edit-item-id&quot;).val(id);jQuery(&quot;#edit-item-title&quot;).val(itemTitle);jQuery(&quot;#edit-item-url&quot;).val(itemURL);jQuery(&quot;#edit-item-attr-title&quot;).val(itemAttrTitle);jQuery(&quot;#edit-item-target&quot;).val(itemTarget);jQuery(&quot;#edit-item-target option[value='&quot;+itemTarget+&quot;']&quot;).attr(&quot;selected&quot;,&quot;selected&quot;);jQuery(&quot;#edit-item-description&quot;).val(itemDesc)}function wp_update_menu_item(){var id=jQuery(&quot;#edit-item-id&quot;).val();var itemTitle=jQuery(&quot;#edit-item-title&quot;).val();var itemURL=jQuery(&quot;#edit-item-url&quot;).val();var itemAttrTitle=jQuery(&quot;#edit-item-attr-title&quot;).val();var itemTarget=jQuery(&quot;#edit-item-target&quot;).val();var itemDesc=jQuery(&quot;#edit-item-description&quot;).val();jQuery(&quot;#menu-&quot;+id).find(&quot;.item-title:first&quot;).html(itemTitle);jQuery(&quot;#item-title&quot;+id).val(itemTitle);jQuery(&quot;#item-url&quot;+id).val(itemURL);jQuery(&quot;#item-attr-title&quot;+id).val(itemAttrTitle);jQuery(&quot;#item-target&quot;+id).val(itemTarget);jQuery(&quot;#item-description&quot;+id).val(itemDesc)}function wp_remove_menu_item(o){var todelete=document.getElementById(&quot;menu-&quot;+o);if(todelete){jQuery(todelete).find(&quot;dt&quot;).each(function(){jQuery(this).animate({backgroundColor:&quot;#FF3333&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).parent().parent().remove()}})});wp_update_post_data()}}function wp_update_post_data(){var i=0;jQuery(&quot;.menu li&quot;).each(function(i){i=i+1;var j=jQuery(this).attr(&quot;value&quot;);jQuery(this).find(&quot;#item-position&quot;+j).attr(&quot;value&quot;,i);jQuery(this).attr(&quot;id&quot;,&quot;menu-&quot;+i);jQuery(this).attr(&quot;value&quot;,i);jQuery(this).find(&quot;#item-dbid&quot;+j).attr(&quot;name&quot;,&quot;item-dbid&quot;+i);jQuery(this).find(&quot;#item-dbid&quot;+j).attr(&quot;id&quot;,&quot;item-dbid&quot;+i);jQuery(this).find(&quot;#item-postmenu&quot;+j).attr(&quot;name&quot;,&quot;item-postmenu&quot;+i);jQuery(this).find(&quot;#item-postmenu&quot;+j).attr(&quot;id&quot;,&quot;item-postmenu&quot;+i);var p=jQuery(this).find(&quot;#item-parent&quot;+j).parent().parent().parent().attr(&quot;value&quot;);jQuery(this).find(&quot;#item-parent&quot;+j).attr(&quot;name&quot;,&quot;item-parent&quot;+i);jQuery(this).find(&quot;#item-parent&quot;+j).attr(&quot;id&quot;,&quot;item-parent&quot;+i);if(p){}else{p=0}jQuery(this).find(&quot;#item-parent&quot;+j).attr(&quot;value&quot;,p);jQuery(this).find(&quot;#item-title&quot;+j).attr(&quot;name&quot;,&quot;item-title&quot;+i);jQuery(this).find(&quot;#item-title&quot;+j).attr(&quot;id&quot;,&quot;item-title&quot;+i);jQuery(this).find(&quot;#item-url&quot;+j).attr(&quot;name&quot;,&quot;item-url&quot;+i);jQuery(this).find(&quot;#item-url&quot;+j).attr(&quot;id&quot;,&quot;item-url&quot;+i);jQuery(this).find(&quot;#item-description&quot;+j).attr(&quot;name&quot;,&quot;item-description&quot;+i);jQuery(this).find(&quot;#item-description&quot;+j).attr(&quot;id&quot;,&quot;item-description&quot;+i);jQuery(this).find(&quot;#item-attr-title&quot;+j).attr(&quot;name&quot;,&quot;item-attr-title&quot;+i);jQuery(this).find(&quot;#item-attr-title&quot;+j).attr(&quot;id&quot;,&quot;item-attr-title&quot;+i);jQuery(this).find(&quot;#item-target&quot;+j).attr(&quot;name&quot;,&quot;item-target&quot;+i);jQuery(this).find(&quot;#item-target&quot;+j).attr(&quot;id&quot;,&quot;item-target&quot;+i);jQuery(this).find(&quot;#item-position&quot;+j).attr(&quot;name&quot;,&quot;item-position&quot;+i);jQuery(this).find(&quot;#item-position&quot;+j).attr(&quot;id&quot;,&quot;item-position&quot;+i);jQuery(this).find(&quot;#item-type&quot;+j).attr(&quot;name&quot;,&quot;item-type&quot;+i);jQuery(this).find(&quot;#item-type&quot;+j).attr(&quot;id&quot;,&quot;item-type&quot;+i);jQuery(&quot;#li-count&quot;).attr(&quot;value&quot;,i)})}function wp_add_item_to_menu(item_type,item_title,item_url,item_id,item_parent_id,item_description){var randomnumber=wp_get_unique_menu_id();jQuery(&quot;.menu&quot;).append('&lt;li id=&quot;menu-'+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_type+'&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=380&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;&lt;input type=&quot;hidden&quot; name=&quot;item-postmenu'+randomnumber+'&quot; id=&quot;item-postmenu'+randomnumber+'&quot; value=&quot;'+item_id+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-parent'+randomnumber+'&quot; id=&quot;item-parent'+randomnumber+'&quot; value=&quot;'+item_parent_id+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-title'+randomnumber+'&quot; id=&quot;item-title'+randomnumber+'&quot; value=&quot;'+item_title+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-url'+randomnumber+'&quot; id=&quot;item-url'+randomnumber+'&quot; value=&quot;'+item_url+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-description'+randomnumber+'&quot; id=&quot;item-description'+randomnumber+'&quot; value=&quot;'+item_description+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-position'+randomnumber+'&quot; id=&quot;item-position'+randomnumber+'&quot; value=&quot;'+randomnumber+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-type'+randomnumber+'&quot; id=&quot;item-type'+randomnumber+'&quot; value=&quot;'+item_type+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-attr-title'+randomnumber+'&quot; id=&quot;item-attr-title'+randomnumber+'&quot; value=&quot;'+item_title+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-target'+randomnumber+'&quot; id=&quot;item-target'+randomnumber+'&quot; value=&quot;0&quot; /&gt;&lt;/li&gt;');jQuery(&quot;.menu #menu-&quot;+randomnumber+&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();wp_update_post_data();tb_init(&quot;a.thickbox, area.thickbox, input.thickbox&quot;)}function wp_update_queue(e,item_type,item_title,item_url,item_id,item_parent_id,item_description){var randomnumber=wp_get_unique_menu_id();var menu_item_id=jQuery(e).attr(&quot;id&quot;);if(jQuery(e).attr(&quot;checked&quot;)){jQuery(&quot;#queue&quot;).append('&lt;li id=&quot;menu-'+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_type+'&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=380&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;&lt;input type=&quot;hidden&quot; name=&quot;item-postmenu'+randomnumber+'&quot; id=&quot;item-postmenu'+randomnumber+'&quot; value=&quot;'+item_id+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-parent'+randomnumber+'&quot; id=&quot;item-parent'+randomnumber+'&quot; value=&quot;'+item_parent_id+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-title'+randomnumber+'&quot; id=&quot;item-title'+randomnumber+'&quot; value=&quot;'+item_title+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-url'+randomnumber+'&quot; id=&quot;item-url'+randomnumber+'&quot; value=&quot;'+item_url+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-description'+randomnumber+'&quot; id=&quot;item-description'+randomnumber+'&quot; value=&quot;'+item_description+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-position'+randomnumber+'&quot; id=&quot;item-position'+randomnumber+'&quot; value=&quot;'+randomnumber+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-type'+randomnumber+'&quot; id=&quot;item-type'+randomnumber+'&quot; value=&quot;'+item_type+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-attr-title'+randomnumber+'&quot; id=&quot;item-attr-title'+randomnumber+'&quot; value=&quot;'+item_title+'&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-target'+randomnumber+'&quot; id=&quot;item-target'+randomnumber+'&quot; value=&quot;0&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;item-id'+randomnumber+'&quot; id=&quot;item-id'+randomnumber+'&quot; value=&quot;'+menu_item_id+'&quot; /&gt;&lt;/li&gt;')}else{if(menu_item_id==jQuery('#queue li input[name^=&quot;item-id&quot;]').val()){jQuery('#queue li input[name^=&quot;item-id&quot;]').parent().remove()}}}function wp_add_queued_items_to_menu(button){var items=jQuery(&quot;#queue&quot;).children();jQuery(&quot;#queue&quot;).empty();jQuery(&quot;.menu&quot;).append(items);jQuery(items).each(function(){jQuery(this).find(&quot;dt&quot;).animate({backgroundColor:&quot;#FFFF33&quot;},{duration:&quot;normal&quot;,complete:function(){jQuery(this).css(&quot;backgroundColor&quot;,&quot;&quot;)}})});jQuery(button).offsetParent().find(&quot;.list-container input&quot;).attr(&quot;checked&quot;,false);wp_update_post_data();wp_drag_and_drop();tb_init(&quot;a.thickbox, area.thickbox, input.thickbox&quot;)}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(e,ui){var li=jQuery(this).parent();var child=!jQuery(this).hasClass(&quot;dropzone&quot;);if(child&amp;&amp;li.children(&quot;ul&quot;).length==0){li.append('&lt;ul class=&quot;sub-menu&quot; /&gt;')}if(child){li.children(&quot;ul&quot;).append(ui.draggable)}else{li.before(ui.draggable)}li.find(&quot;dl,.dropzone&quot;).css({backgroundColor:&quot;&quot;,borderColor:&quot;&quot;});var draggablevalue=ui.draggable.attr(&quot;value&quot;);var droppablevalue=li.attr(&quot;value&quot;);li.find(&quot;#menu-&quot;+draggablevalue).find(&quot;#parent&quot;+draggablevalue).val(droppablevalue);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 parentid=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_get_unique_menu_id(){var count=jQuery(&quot;.menu li&quot;).length+1;var randomnumber=count;var validatetest=0;try{var test=document.getElementById(&quot;menu-&quot;+randomnumber.toString()).value}catch(err){validatetest=1}while(validatetest==0){randomnumber=randomnumber+1;try{var test2=document.getElementById(&quot;menu-&quot;+randomnumber.toString()).value}catch(err){validatetest=1}}return randomnumber};
</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 (13511 => 13512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/nav-menus.php        2010-02-28 19:49:31 UTC (rev 13511)
+++ trunk/wp-admin/nav-menus.php        2010-02-28 20:00:49 UTC (rev 13512)
</span><span class="lines">@@ -43,9 +43,6 @@
</span><span class="cx"> $updated = false;
</span><span class="cx"> $advanced_option_descriptions = 'no';
</span><span class="cx"> 
</span><del>-// Get all menu link items
-$available_links = new WP_Query( array( 'post_status' =&gt; 'any', 'post_type' =&gt; 'nav_menu_item', 'meta_key' =&gt; 'menu_type', 'meta_value' =&gt; 'custom' ) );
-
</del><span class="cx"> // Check which menu is selected and if menu is in edit already
</span><span class="cx"> if ( isset( $_GET['edit-menu'] ) ) {
</span><span class="cx">         $menu_selected_id = (int) $_GET['edit-menu'];
</span><span class="lines">@@ -127,16 +124,16 @@
</span><span class="cx">         
</span><span class="cx">         // Loop through all POST variables
</span><span class="cx">         for ( $k = 1; $k &lt;= $post_counter; $k++ ) {
</span><del>-                $db_id = isset( $_POST['dbid'.$k] )? $_POST['dbid'.$k] : 0;
-                $object_id = isset( $_POST['postmenu'.$k] )? $_POST['postmenu'.$k] : 0;
-                $parent_id = isset( $_POST['parent'.$k] )? $_POST['parent'.$k] : 0;
</del><ins>+                $db_id = isset( $_POST['item-dbid'.$k] )? $_POST['item-dbid'.$k] : 0;
+                $object_id = isset( $_POST['item-postmenu'.$k] )? $_POST['item-postmenu'.$k] : 0;
+                $parent_id = isset( $_POST['item-parent'.$k] )? $_POST['item-parent'.$k] : 0;
</ins><span class="cx">                 $custom_title = isset( $_POST['item-title'.$k] )?  $_POST['item-title'.$k] : '';
</span><span class="cx">                 $custom_linkurl = ( isset( $_POST['item-url'.$k] ) &amp;&amp; 'custom' == $_POST['linktype'.$k] ) ? $_POST['item-url'.$k] : '';
</span><span class="cx">                 $custom_description = isset( $_POST['item-description'.$k] )? $_POST['item-description'.$k] : '';
</span><ins>+                
</ins><span class="cx">                 // doesn't seem to be used by UI
</span><del>-                $icon = isset( $_POST['icon'.$k] )? $_POST['icon'.$k] : 0;
-                $position = isset( $_POST['position'.$k] )? $_POST['position'.$k] : 0;
-                $linktype = isset( $_POST['linktype'.$k] )? $_POST['linktype'.$k] : 'custom';
</del><ins>+                $position = isset( $_POST['item-position'.$k] )? $_POST['item-position'.$k] : 0;
+                $linktype = isset( $_POST['item-type'.$k] )? $_POST['item-type'.$k] : 'custom';
</ins><span class="cx">                 $custom_anchor_title  = isset( $_POST['item-attr-title'.$k] )? $_POST['item-attr-title'.$k] : $custom_title;
</span><span class="cx">                 $new_window = isset( $_POST['item-target'.$k] )? $_POST['item-target'.$k] : 0;
</span><span class="cx"> 
</span><span class="lines">@@ -209,14 +206,10 @@
</span><span class="cx">                                                         &lt;div class=&quot;inside&quot;&gt;
</span><span class="cx">                                                                 &lt;input type=&quot;hidden&quot; name=&quot;li-count&quot; id=&quot;li-count&quot; value=&quot;0&quot; /&gt;
</span><span class="cx">                                                                 &lt;input type=&quot;hidden&quot; name=&quot;menu-id-in-edit&quot; id=&quot;menu-id-in-edit&quot; value=&quot;&lt;?php echo esc_attr( $menu_selected_id ); ?&gt;&quot; /&gt;
</span><del>-
-                                                                &lt;ul id=&quot;menu&quot;&gt;
</del><span class="cx">                                                                 &lt;?php
</span><del>-                                                                if ( $menu_selected_id &gt; 0 ) {
-                                                                        wp_print_nav_menu( array( 'type' =&gt; 'backend', 'name' =&gt; $menu_title, 'id' =&gt; $menu_selected_id ) );
-                                                                }
</del><ins>+                                                                if ( $menu_selected_id &gt; 0 )
+                                                                        echo wp_get_nav_menu( array( 'type' =&gt; 'backend', 'menu' =&gt; $menu_selected_id, 'ul_class' =&gt; 'menu' ) );
</ins><span class="cx">                                                                 ?&gt;
</span><del>-                                                                &lt;/ul&gt;&lt;!-- /#menu--&gt;
</del><span class="cx">                                                                 
</span><span class="cx">                                                                 &lt;div id=&quot;queue&quot; class=&quot;hide&quot;&gt;
</span><span class="cx">                                                                 &lt;/div&gt;&lt;!--/#queue--&gt;
</span><span class="lines">@@ -265,7 +258,6 @@
</span><span class="cx">                                                                 &lt;/label&gt;
</span><span class="cx">                                                         &lt;/p&gt;
</span><span class="cx">                                                         
</span><del>-                                        &lt;?php if ( $available_links-&gt;posts ) : ?&gt;
</del><span class="cx">                                                         &lt;p class=&quot;button-controls&quot;&gt;
</span><span class="cx">                                                                 &lt;a class=&quot;show-all button&quot;&gt;&lt;?php _e('View All'); ?&gt;&lt;/a&gt;
</span><span class="cx">                                                                 &lt;a class=&quot;hide-all button&quot;&gt;&lt;?php _e('Hide All'); ?&gt;&lt;/a&gt;
</span><span class="lines">@@ -273,24 +265,10 @@
</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
-                                                                        foreach ( $available_links-&gt;posts as $link ) :
-                                                                        $url = get_post_meta( $link-&gt;ID, 'menu_link' );
-                                                                        ?&gt;
-                                                                                &lt;li&gt;
-                                                                                        &lt;dl&gt;
-                                                                                                &lt;dt&gt;
-                                                                                                        &lt;label class=&quot;item-title&quot;&gt;&lt;input type=&quot;checkbox&quot; id=&quot;link-&lt;?php echo esc_attr($link-&gt;ID); ?&gt;&quot; name=&quot;&lt;?php echo esc_attr($link-&gt;post_title); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr($url[0]); ?&gt;&quot; /&gt;&lt;?php echo esc_html($link-&gt;post_title); ?&gt;&lt;/label&gt;
-                                                                                                &lt;/dt&gt;
-                                                                                        &lt;/dl&gt;
-                                                                                &lt;/li&gt;
-                                                                        &lt;?php
-                                                                        endforeach;
-                                                                        ?&gt;
</del><ins>+                                                                        &lt;?php $items_counter = wp_nav_menu_get_custom_links( 0, 'default' ); ?&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;?php endif; ?&gt;
</del><span class="cx">                                                         &lt;p class=&quot;add-to-menu&quot;&gt;
</span><span class="cx">                                                                 &lt;a class=&quot;button&quot;&gt;&lt;?php _e('Add to Menu'); ?&gt;&lt;/a&gt;
</span><span class="cx">                                                         &lt;/p&gt;
</span><span class="lines">@@ -325,7 +303,7 @@
</span><span class="cx">                                                                         
</span><span class="cx">                                                                         jQuery('#add-pages .quick-search').result(function(event, data, formatted) {
</span><span class="cx">                                                                                 jQuery('#add-pages .list-wrap').css('display','block');
</span><del>-                                                                                jQuery(&quot;#add-pages .list-wrap dt:contains('&quot; + data + &quot;')&quot;).css('display','block');
</del><ins>+                                                                                jQuery(&quot;#add-pages .list-wrap li:contains('&quot; + data + &quot;')&quot;).css('display','block');
</ins><span class="cx">                                                                                 jQuery('#add-pages .show-all').hide();
</span><span class="cx">                                                                                 jQuery('#add-pages .hide-all').show();
</span><span class="cx">                                                                         });
</span><span class="lines">@@ -344,7 +322,7 @@
</span><span class="cx">                                                         &lt;div id=&quot;existing-pages&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 $items_counter = wp_nav_menu_get_pages( 0, 'default' ); ?&gt;
</del><ins>+                                                                        &lt;?php $items_counter = wp_nav_menu_get_pages( $items_counter, 'default' ); ?&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-pages--&gt;
</span><span class="lines">@@ -387,7 +365,7 @@
</span><span class="cx">                                                                         jQuery('#add-categories .quick-search').autocomplete(categories);
</span><span class="cx">                                                                         jQuery('#add-categories .quick-search').result(function(event, data, formatted) {
</span><span class="cx">                                                                                 jQuery('#add-categories .list-wrap').css('display','block');
</span><del>-                                                                                jQuery(&quot;#add-categories .list-wrap dt:contains('&quot; + data + &quot;')&quot;).css('display','block');
</del><ins>+                                                                                jQuery(&quot;#add-categories .list-wrap li:contains('&quot; + data + &quot;')&quot;).css('display','block');
</ins><span class="cx">                                                                                 jQuery('#add-categories .show-all').hide();
</span><span class="cx">                                                                                 jQuery('#add-categories .hide-all').show();
</span><span class="cx">                                                                         });
</span></span></pre></div>
<a id="trunkwpcontentthemestwentytenheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-content/themes/twentyten/header.php (13511 => 13512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-content/themes/twentyten/header.php        2010-02-28 19:49:31 UTC (rev 13511)
+++ trunk/wp-content/themes/twentyten/header.php        2010-02-28 20:00:49 UTC (rev 13512)
</span><span class="lines">@@ -1,8 +1,8 @@
</span><span class="cx"> &lt;!DOCTYPE html&gt;
</span><span class="cx"> &lt;html &lt;?php language_attributes(); ?&gt;&gt;
</span><span class="cx"> &lt;head&gt;
</span><del>-        &lt;title&gt;&lt;?php
-                if ( is_single() ) {
</del><ins>+    &lt;title&gt;&lt;?php
+        if ( is_single() ) {
</ins><span class="cx">                         single_post_title(); echo ' | '; bloginfo('name');
</span><span class="cx">                 } elseif ( is_home() || is_front_page() ) {
</span><span class="cx">                         bloginfo('name'); echo ' | '; bloginfo('description'); twentyten_the_page_number();
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx">                 } else {
</span><span class="cx">                         wp_title(''); echo ' | '; bloginfo('name'); twentyten_the_page_number();
</span><span class="cx">                 }
</span><del>-        ?&gt;&lt;/title&gt;
</del><ins>+    ?&gt;&lt;/title&gt;
</ins><span class="cx"> 
</span><span class="cx">         &lt;meta http-equiv=&quot;content-type&quot; content=&quot;&lt;?php bloginfo('html_type'); ?&gt;; charset=&lt;?php bloginfo('charset'); ?&gt;&quot; /&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesdefaultwidgetsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/default-widgets.php (13511 => 13512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/default-widgets.php        2010-02-28 19:49:31 UTC (rev 13511)
+++ trunk/wp-includes/default-widgets.php        2010-02-28 20:00:49 UTC (rev 13512)
</span><span class="lines">@@ -1044,231 +1044,62 @@
</span><span class="cx">  class WP_Nav_Menu_Widget extends WP_Widget {
</span><span class="cx"> 
</span><span class="cx">         function WP_Nav_Menu_Widget() {
</span><del>-                $widget_ops = array('description' =&gt; __('Use this widget to add one of your navigation menus as a widget.') );
-                parent::WP_Widget( false, __('Navigation Menu'), $widget_ops );
</del><ins>+                $widget_ops = array( 'description' =&gt; __('Use this widget to add one of your navigation menus as a widget.') );
+                parent::WP_Widget( 'nav_menu', __('Navigation Menu'), $widget_ops );
</ins><span class="cx">         }
</span><del>-
</del><ins>+        
</ins><span class="cx">         function widget($args, $instance) {
</span><del>-                $navmenu = $instance['navmenu'];
-                $navtitle = $instance['navtitle'];
-                $navdeveloper = strtolower($instance['navdeveloper']);
-                $navdiv = strtolower($instance['navdiv']);
-                $navul = strtolower($instance['navul']);
-                $navdivid = $instance['navdivid'];
-                $navdivclass = $instance['navdivclass'];
-                $navulid = $instance['navulid'];
-                $navulclass = $instance['navulclass'];
-
-                // Override for menu descriptions
-                $advanced_option_descriptions = get_option('wp_settings_nav_menu_advanced_options');
-                if ( $advanced_option_descriptions == 'no' ) {
-                        $navwidgetdescription = 2;
-                } else {
-                        $navwidgetdescription = $instance['navwidgetdescription'];
-                }
-
</del><span class="cx">                 // Get menu
</span><del>-                if ( $navmenu &gt; 0 ) {
-                        $custom_menu = get_term( (int) $nav_menu, 'nav_menu' );
-                        $wp_custom_nav_menu_name = $custom_menu-&gt;name;
-                        $menuexists = true;
-                } else {
-                        $menuexists = false;
-                }
-
-                if ( $navdeveloper == 'yes' ) {
-                        // DISPLAY Custom DIV
-                        if ( $navdiv == 'yes' ) {
-                        ?&gt;
-                                &lt;div id=&quot;&lt;?php echo $navdivid;  ?&gt;&quot; class=&quot;&lt;?php echo $navdivclass; ?&gt;&quot;&gt;
-                        &lt;?php
-                                }
-                        } else {
-                                //DISPLAY default DIV
-                                ?&gt;
-                                &lt;div class=&quot;widget&quot;&gt;
-                                &lt;?php
-                        }
-                ?&gt;
-
-                &lt;h3&gt;&lt;?php echo $navtitle; ?&gt;&lt;/h3&gt;
-                &lt;?php
-                if ( $menuexists ) {
-                        if ( $navdeveloper == 'yes' ) {
-                                //DISPLAY Custom UL
-                                if ( $navul == 'yes' ) {
-                                        ?&gt;
-                                        &lt;ul id=&quot;&lt;?php echo $navulid;  ?&gt;&quot; class=&quot;&lt;?php echo $navulclass; ?&gt;&quot;&gt;
-                                        &lt;?php
-                                }
-                        } else {
-                                // DISPLAY default UL
-                                ?&gt;
-                                &lt;ul class=&quot;menu&quot;&gt;
-                                &lt;?php
-                        }
-                        wp_nav_menu( array('id' =&gt; $navmenu, 'name' =&gt; $wp_custom_nav_menu_name, 'desc' =&gt; $navwidgetdescription, 'format' =&gt; 'widget') );
-                        if ( $navdeveloper == 'yes' ) {
-                                // DISPLAY Custom UL
-                                if ( $navul == 'yes' ) {
-                                        ?&gt;
-                                        &lt;/ul&gt;
-                                        &lt;?php
-                                }
-                        } else {
-                                // DISPLAY default UL
-                                ?&gt;
-                                &lt;/ul&gt;
-                                &lt;?php
-                        }
-                } else {
-                        _e('You have not setup the custom navigation widget correctly, please check your settings in the backend.');
-                }
-
-                //DEVELOPER settings enabled
-                if ($navdeveloper == 'yes') {
-                        // DISPLAY Custom DIV
-                        if ( $navdiv == 'yes' ) {
-                                ?&gt;
-                                &lt;/div&gt;
-                                &lt;?php
-                        }
-                } else {
-                        // DISPLAY default DIV
-                        ?&gt;
-                        &lt;/div&gt;
-                        &lt;?php
-                }
-                ?&gt;&lt;!-- /#nav-container --&gt;
-                &lt;?php
</del><ins>+                $nav_menu = wp_get_nav_menu_object( $instance['nav_menu'] );
+                
+                if ( !$nav_menu )
+                        return;                
+                
+                echo $args['before_widget'];
+                
+                if ( isset($instance['title']) )
+                        echo $args['before_title'] . $instance['title'] . $args['after_title'];
+                
+                wp_nav_menu( array( 'menu' =&gt; $nav_menu ) );
+                
+                echo $args['after_widget'];
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function update($new_instance, $old_instance) {
-                return $new_instance;
</del><ins>+        function update( $new_instance, $old_instance ) {
+                $instance['title'] = strip_tags( stripslashes($new_instance['title']) );
+                $instance['nav_menu'] = (int) $new_instance['nav_menu'];
+                return $instance;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function form($instance) {
-                $navmenu = esc_attr($instance['navmenu']);
-                $navtitle = esc_attr($instance['navtitle']);
-                $navdeveloper = esc_attr($instance['navdeveloper']);
-                $navdiv = esc_attr($instance['navdiv']);
-                $navul = esc_attr($instance['navul']);
-                $navdivid = esc_attr($instance['navdivid']);
-                $navdivclass = esc_attr($instance['navdivclass']);
-                $navulid = esc_attr($instance['navulid']);
-                $navulclass = esc_attr($instance['navulclass']);
-                $navwidgetdescription = esc_attr($instance['navwidgetdescription']);
-
-                global $wpdb;
-
</del><ins>+        function form( $instance ) {
+                $title = isset( $instance['title'] ) ? $instance['title'] : '';
+                $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
+                
</ins><span class="cx">                 // Get menus
</span><del>-                $custom_menus = get_terms( 'nav_menu', array( 'hide_empty' =&gt; false ) );
-
-                if ( !$custom_menus) {
-                ?&gt;
-                        &lt;p&gt;
-                            &lt;label&gt;&lt;?php printf(__('No menus have been created yet.  &lt;a href=&quot;%s&quot;&gt;Creat some&lt;/a&gt;.'), admin_url('nav-menus.php')); ?&gt;&lt;/label&gt;
-                        &lt;/p&gt;
-                &lt;?php
</del><ins>+                $menus = get_terms( 'nav_menu', array( 'hide_empty' =&gt; false ) );
+                
+                // If no menus exists, direct the user to go and create some.
+                if ( !$menus ) {
+                        echo '&lt;p&gt;'. sprintf( __('No menus have been created yet. &lt;a href=&quot;%s&quot;&gt;Creat some&lt;/a&gt;.'), admin_url('nav-menus.php') ) .'&lt;/p&gt;';
</ins><span class="cx">                         return;
</span><span class="cx">                 }
</span><span class="cx">                 ?&gt;
</span><del>-
</del><span class="cx">                 &lt;p&gt;
</span><del>-                        &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('navmenu'); ?&gt;&quot;&gt;&lt;?php _e('Select Menu:'); ?&gt;&lt;/label&gt;
-
-                        &lt;select id=&quot;&lt;?php echo $this-&gt;get_field_id('navmenu'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navmenu'); ?&gt;&quot;&gt;
-                                &lt;?php
-                                foreach ( $custom_menus as $menu ) {
-                                        if ( $navmenu == $menu-&gt;term_id )
-                                                $selected_option = 'selected=&quot;selected&quot;';
-                                        else
-                                                $selected_option = '';
-                                        ?&gt;
-                                        &lt;option value=&quot;&lt;?php echo $menu-&gt;term_id; ?&gt;&quot; &lt;?php echo $selected_option; ?&gt;&gt;&lt;?php echo $menu-&gt;name; ?&gt;&lt;/option&gt;
-                                        &lt;?php
-                                }
-                                ?&gt;
-                        &lt;/select&gt;
</del><ins>+                        &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('title'); ?&gt;&quot;&gt;&lt;?php _e('Title:') ?&gt;&lt;/label&gt;
+                        &lt;input type=&quot;text&quot; class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id('title'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('title'); ?&gt;&quot; value=&quot;&lt;?php echo $title; ?&gt;&quot; /&gt;
</ins><span class="cx">                 &lt;/p&gt;
</span><del>-
</del><span class="cx">                 &lt;p&gt;
</span><del>-                        &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('navtitle'); ?&gt;&quot;&gt;&lt;?php _e('Title:'); ?&gt;&lt;/label&gt;
-                        &lt;input type=&quot;text&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navtitle'); ?&gt;&quot; value=&quot;&lt;?php echo $navtitle; ?&gt;&quot; class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id('navtitle'); ?&gt;&quot; /&gt;
-                &lt;/p&gt;
-
-                &lt;?php $checked = strtolower($navdeveloper); ?&gt;
-                &lt;p&gt;
-                        &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('navdeveloper'); ?&gt;&quot;&gt;&lt;?php _e('Advanced Options:'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                        &lt;span class=&quot;checkboxes&quot;&gt;
-                                &lt;label&gt;Yes&lt;/label&gt;&lt;input type=&quot;radio&quot; id=&quot;&lt;?php echo $this-&gt;get_field_name('navdeveloper'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navdeveloper'); ?&gt;&quot; value=&quot;yes&quot; &lt;?php if ($checked=='yes') { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
-                                &lt;label&gt;No&lt;/label&gt;&lt;input type=&quot;radio&quot; id=&quot;&lt;?php echo $this-&gt;get_field_name('navdeveloper'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navdeveloper'); ?&gt;&quot; value=&quot;no&quot; &lt;?php if ($checked=='yes') { } else { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
-                        &lt;/span&gt;&lt;!-- /.checkboxes --&gt;
-                &lt;/p&gt;
-
</del><ins>+                        &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('nav_menu'); ?&gt;&quot;&gt;&lt;?php _e('Select Menu:'); ?&gt;&lt;/label&gt;
+                        &lt;select id=&quot;&lt;?php echo $this-&gt;get_field_id('nav_menu'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('nav_menu'); ?&gt;&quot;&gt;
</ins><span class="cx">                 &lt;?php
</span><del>-                // Advanced settings
-                if ( $checked == 'yes' ) :
</del><ins>+                        foreach ( $menus as $menu ) {
+                                $selected = $nav_menu == $menu-&gt;term_id ? ' selected=&quot;selected&quot;' : '';
+                                echo '&lt;option'. $selected .' value=&quot;'. $menu-&gt;term_id .'&quot;&gt;'. $menu-&gt;name .'&lt;/option&gt;';
+                        }
</ins><span class="cx">                 ?&gt;
</span><del>-                &lt;p&gt;
-                &lt;?php $checked = strtolower($navdiv); ?&gt;
-                        &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('navdiv'); ?&gt;&quot;&gt;&lt;?php _e('Wrap in container DIV:'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                        &lt;span class=&quot;checkboxes&quot;&gt;
-                                &lt;label&gt;Yes&lt;/label&gt;&lt;input type=&quot;radio&quot; id=&quot;&lt;?php echo $this-&gt;get_field_name('navdiv'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navdiv'); ?&gt;&quot; value=&quot;yes&quot; &lt;?php if ($checked=='yes') { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
-                                &lt;label&gt;No&lt;/label&gt;&lt;input type=&quot;radio&quot; id=&quot;&lt;?php echo $this-&gt;get_field_name('navdiv'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navdiv'); ?&gt;&quot; value=&quot;no&quot; &lt;?php if ($checked=='yes') { } else { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
-                        &lt;/span&gt;&lt;!-- /.checkboxes --&gt;
</del><ins>+                        &lt;/select&gt;
</ins><span class="cx">                 &lt;/p&gt;
</span><span class="cx">                 &lt;?php
</span><del>-                if ( $checked == 'yes' ) {
-                ?&gt;
-
-                        &lt;p&gt;
-                                &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('navdivid'); ?&gt;&quot;&gt;&lt;?php _e('DIV id:'); ?&gt;&lt;/label&gt;
-                                &lt;input type=&quot;text&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navdivid'); ?&gt;&quot; value=&quot;&lt;?php echo $navdivid; ?&gt;&quot; class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id('navdivid'); ?&gt;&quot; /&gt;
-                        &lt;/p&gt;
-                        &lt;p&gt;
-                                &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('navdivclass'); ?&gt;&quot;&gt;&lt;?php _e('DIV class:'); ?&gt;&lt;/label&gt;
-                                &lt;input type=&quot;text&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navdivclass'); ?&gt;&quot; value=&quot;&lt;?php echo $navdivclass; ?&gt;&quot; class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id('navdivclass'); ?&gt;&quot; /&gt;
-                        &lt;/p&gt;
-                &lt;?php
-                }
-                
-                $checked = strtolower($navul);
-                ?&gt;
-
-                &lt;p&gt;
-                        &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('navul'); ?&gt;&quot;&gt;&lt;?php _e('Wrap in container UL:'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                        &lt;span class=&quot;checkboxes&quot;&gt;
-                                &lt;label&gt;Yes&lt;/label&gt;&lt;input type=&quot;radio&quot; id=&quot;&lt;?php echo $this-&gt;get_field_name('navul'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navul'); ?&gt;&quot; value=&quot;yes&quot; &lt;?php if ($checked=='yes') { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
-                                &lt;label&gt;No&lt;/label&gt;&lt;input type=&quot;radio&quot; id=&quot;&lt;?php echo $this-&gt;get_field_name('navul'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navul'); ?&gt;&quot; value=&quot;no&quot; &lt;?php if ($checked=='yes') { } else { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
-                        &lt;/span&gt;&lt;!-- /.checkboxes --&gt;
-                &lt;/p&gt;
-
-                &lt;?php
-                if ( $checked == 'yes' ) {
-                ?&gt;
-                        &lt;p&gt;
-                                &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('navulid'); ?&gt;&quot;&gt;&lt;?php _e('UL id:'); ?&gt;&lt;/label&gt;
-                                &lt;input type=&quot;text&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navulid'); ?&gt;&quot; value=&quot;&lt;?php echo $navulid; ?&gt;&quot; class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id('navulid'); ?&gt;&quot; /&gt;
-                        &lt;/p&gt;
-                        &lt;p&gt;
-                                &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('navulclass'); ?&gt;&quot;&gt;&lt;?php _e('UL class:'); ?&gt;&lt;/label&gt;
-                                &lt;input type=&quot;text&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navulclass'); ?&gt;&quot; value=&quot;&lt;?php echo $navulclass; ?&gt;&quot; class=&quot;widefat&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id('navulclass'); ?&gt;&quot; /&gt;
-                        &lt;/p&gt;
-                &lt;?php
-                }
-                $advanced_option_descriptions = get_option('wp_settings_nav_menu_advanced_options');
-                ?&gt;
-                &lt;p &lt;?php if ($advanced_option_descriptions == 'no') { ?&gt;style=&quot;display:none;&quot;&lt;?php } ?&gt;&gt;
-                   &lt;?php $checked = strtolower($navwidgetdescription); ?&gt;
-                        &lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id('navwidgetdescription'); ?&gt;&quot;&gt;&lt;?php _e('Show Top Level Descriptions:'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                        &lt;span class=&quot;checkboxes&quot;&gt;
-                                &lt;label&gt;Yes&lt;/label&gt;&lt;input type=&quot;radio&quot; id=&quot;&lt;?php echo $this-&gt;get_field_name('navwidgetdescription'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navwidgetdescription'); ?&gt;&quot; value=&quot;1&quot; &lt;?php if ($checked=='1') { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
-                                &lt;label&gt;No&lt;/label&gt;&lt;input type=&quot;radio&quot; id=&quot;&lt;?php echo $this-&gt;get_field_name('navwidgetdescription'); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name('navwidgetdescription'); ?&gt;&quot; value=&quot;2&quot; &lt;?php if ($checked=='1') { } else { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
-                        &lt;/span&gt;&lt;!-- /.checkboxes --&gt;
-                &lt;/p&gt;
-                &lt;?php
-                endif;
</del><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesnavmenutemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/nav-menu-template.php (13511 => 13512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/nav-menu-template.php        2010-02-28 19:49:31 UTC (rev 13511)
+++ trunk/wp-includes/nav-menu-template.php        2010-02-28 20:00:49 UTC (rev 13512)
</span><span class="lines">@@ -1,7 +1,6 @@
</span><span class="cx"> &lt;?php
</span><del>-
</del><span class="cx"> /**
</span><del>- * Outputs a navigation menu.
</del><ins>+ * Displays a navigation menu.
</ins><span class="cx">  *
</span><span class="cx">  * Optional $args contents:
</span><span class="cx">  *
</span><span class="lines">@@ -10,29 +9,33 @@
</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><ins>+ * 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.
+ * echo - Whether to echo the menu or return it. Defaults to echo.
</ins><span class="cx">  *
</span><span class="cx">  * TODO:
</span><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><del>- * link_before - Text before show_home argument text.
- * link_after - Text after show_home argument text.
- * echo - Whether to echo the menu or return it. Defaults to echo.
</del><span class="cx">  *
</span><span class="cx">  * @since 3.0.0
</span><span class="cx">  *
</span><span class="cx">  * @param array $args Arguments
</span><span class="cx">  */
</span><span class="cx"> function wp_nav_menu( $args = array() ) {
</span><del>-        $defaults = array( 'id' =&gt; '', 'slug' =&gt; '', 'menu_class' =&gt; 'menu', 'format' =&gt; 'div', 'fallback_cb' =&gt; 'wp_page_menu', 'echo' =&gt; true, 'link_before' =&gt; '', 'link_after' =&gt; '' );
</del><ins>+        $defaults = array( 'menu' =&gt; '', 'menu_class' =&gt; 'menu', 'format' =&gt; 'div', 'echo' =&gt; true,
+        'fallback_cb' =&gt; 'wp_page_menu', 'link_before' =&gt; '', 'link_after' =&gt; '', 'before_link' =&gt; '', 'after_link' =&gt; '', );
+        
</ins><span class="cx">         $args = wp_parse_args( $args, $defaults );
</span><ins>+        $args = apply_filters( 'wp_nav_menu_args', $args );
</ins><span class="cx">         $args = (object) $args;
</span><span class="cx">         
</span><del>-        // Get the menu
-        $menu = null;
-        if ( !empty($args-&gt;id) ) {
-                $menu = wp_get_nav_menu( $args-&gt;id );
-        } elseif ( !empty($args-&gt;slug) ) {
-                $menu = get_term_by( 'slug', $args-&gt;slug, 'nav_menu' );
-        } else {
</del><ins>+        // Get the nav menu
+        $menu = wp_get_nav_menu_object( $args-&gt;menu );
+                
+        // If we couldn't find a menu based off the name, id or slug,
+        // get the first menu that has items.
+        if ( !$menu ) {
</ins><span class="cx">                 $menus = wp_get_nav_menus();
</span><span class="cx">                 foreach ( $menus as $menu_maybe ) {
</span><span class="cx">                         if ( wp_get_nav_menu_items($menu_maybe-&gt;term_id) ) {
</span><span class="lines">@@ -42,137 +45,157 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        // If the menu doesn't exists, call the fallback_cb
-        if ( !$menu || is_wp_error($menu) )
-                return call_user_func($args-&gt;fallback_cb, $args );
-
</del><ins>+        $args-&gt;menu = $menu-&gt;term_id;
+        $nav_menu = '';
+        
</ins><span class="cx">         if ( 'div' == $args-&gt;format )
</span><del>-                echo '&lt;div class=&quot;' . esc_attr($args-&gt;menu_class) . '&quot;&gt;&lt;ul&gt;';
-
-        $args-&gt;id = $menu-&gt;term_id;
-
-        wp_print_nav_menu($args);
-                
</del><ins>+                $nav_menu .= '&lt;div id=&quot;menu-'. $menu-&gt;slug .'&quot; class=&quot;' . esc_attr($args-&gt;menu_class) . '&quot;&gt;';
+        
+        $nav_menu .= wp_get_nav_menu( $args );
+        
</ins><span class="cx">         if ( 'div' == $args-&gt;format )
</span><del>-                echo '&lt;/ul&gt;&lt;/div&gt;';
</del><ins>+                $nav_menu .= '&lt;/div&gt;';
+        
+        $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu );
+        
+        return $args-&gt;echo ? print $nav_menu : $nav_menu;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-function wp_print_nav_menu( $args = array() ) {
-                // Defaults
-                $defaults = array( 'type' =&gt; 'frontend', 'name' =&gt; 'Menu 1', 'id' =&gt; 0, 'desc' =&gt; 2, 'before_title' =&gt; '', 'after_title' =&gt; '');
-
-                $args = wp_parse_args($args, $defaults);
-                extract($args, EXTR_SKIP);
-
-                $menu_items = wp_get_nav_menu_items( $id );
-
-                $parent_stack = array();
-                $current_parent = 0;
-                $parent_menu_order = array();
-                // Setup parentage
-                foreach ( $menu_items as $menu_item ) {
-                        $parent_menu_order[ $menu_item-&gt;ID ] = $menu_item-&gt;menu_order;
</del><ins>+/**
+ * Returns a Navigation Menu.
+ *
+ * See wp_nav_menu() for args.
+ *
+ * @since 3.0.0
+ *
+ * @param array $args Arguments
+ * @return mixed $output False if menu doesn't exists, else, returns the menu.
+ **/
+function wp_get_nav_menu( $args = array() ) {
+        $defaults = array( 'menu' =&gt; '', 'menu_class' =&gt; 'menu', 'ul_class' =&gt; '', 'format' =&gt; 'div', 'type' =&gt; 'frontend',
+        'fallback_cb' =&gt; '', 'link_before' =&gt; '', 'link_after' =&gt; '', 'before_link' =&gt; '', 'after_link' =&gt; '', );
+        
+        $args = wp_parse_args( $args, $defaults );
+        $args = apply_filters( 'wp_get_nav_menu_args', $args );
+        $args = (object) $args;
+        
+        $menu = wp_get_nav_menu_object( $args-&gt;menu );
+        
+        // If no menu was found, call the fallback_cb
+        if ( !$menu || is_wp_error($menu) ) {
+                if ( function_exists($args-&gt;fallback_cb) )
+                        return call_user_func( $args-&gt;fallback_cb, $args );
+        }
+        
+        $menu_items = wp_get_nav_menu_items( $menu-&gt;term_id );
+        $nav_menu = '';
+        $parent_stack = array();
+        $current_parent = 0;
+        $parent_menu_order = array();
+        
+        // Setup parentage
+        foreach ( $menu_items as $menu_item )
+                $parent_menu_order[ $menu_item-&gt;ID ] = $menu_item-&gt;menu_order;
+        
+        $ul_class = isset($args-&gt;ul_class) ? ' class=&quot;'. $args-&gt;ul_class .'&quot;' : '';
+        $nav_menu .= '&lt;ul'. $ul_class .'&gt;';
+        
+        // Display Loop
+        foreach ( $menu_items as $key =&gt; $menu_item ) :
+                // Setup the $menu_item variables
+                $menu_item = wp_setup_nav_menu_item( $menu_item );
+                
+                $maybe_value = 'frontend' == $args-&gt;type ? '' : ' value=&quot;'. $menu_item-&gt;ID .'&quot;';
+                $classes = 'frontend' == $args-&gt;type ? 'class=&quot;menu-item-'. $menu_item-&gt;type . $menu_item-&gt;li_class .'&quot;' : '';
+                
+                $nav_menu .= '&lt;li id=&quot;menu-item-'. $menu_item-&gt;ID .'&quot;'. $maybe_value . $classes .'&gt;';
+                $nav_menu .= wp_get_nav_menu_item( $menu_item, $args-&gt;type, $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 ) ) {
+                                $nav_menu .= '&lt;/li&gt;';
+                                while ( !empty( $parent_stack ) &amp;&amp; ($last_item || $menu_items[ $key + 1 ]-&gt;post_parent != $current_parent ) ) {
+                                        $nav_menu .= '&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;
+                                $nav_menu .= '&lt;ul&gt;';
+                        }
+                } else {
+                        $nav_menu .= '&lt;/li&gt;';
</ins><span class="cx">                 }
</span><del>-
-            // Display Loop
-                foreach ( $menu_items as $key =&gt; $menu_item ) {
-                        $menu_item = wp_setup_nav_menu_item($menu_item);
-                        // List Items
-                        ?&gt;&lt;li id=&quot;menu-&lt;?php echo $menu_item-&gt;ID; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;ID; ?&gt;&quot; &lt;?php echo $menu_item-&gt;li_class; ?&gt;&gt;&lt;?php
-                        wp_print_nav_menu_item($menu_item, $type, $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 ) ) { ?&gt;
-                &lt;/li&gt;
-&lt;?php                                        while ( !empty( $parent_stack ) &amp;&amp; ($last_item || $menu_items[ $key + 1 ]-&gt;post_parent != $current_parent ) ) { ?&gt;
-                        &lt;/ul&gt;
-                &lt;/li&gt;
-&lt;?php                                        $current_parent = array_pop( $parent_stack );
-                                        } ?&gt;
-&lt;?php                                } else {
-                                        array_push( $parent_stack, $current_parent );
-                                        $current_parent = $menu_item-&gt;ID; ?&gt;
-                        &lt;ul&gt;
-&lt;?php                                }
-                        } else { ?&gt;
-                &lt;/li&gt;
-&lt;?php                }
-        }
</del><ins>+                
+        endforeach;
+        
+        $nav_menu .= '&lt;/ul&gt;';
+        
+        return apply_filters( 'wp_get_nav_menu', $nav_menu );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-function wp_print_nav_menu_item( $menu_item, $context, $args = array() ) {
</del><ins>+/**
+ * Returns a menu item.
+ *
+ * @since 3.0.0
+ *
+ * @param object $menu_item The menu item
+ * @param string $context frontend|backend|default
+ * @param array $args See wp_get_nav_menu().
+ **/
+function wp_get_nav_menu_item( $menu_item, $context, $args = array() ) {
+        $item = '';
</ins><span class="cx">         switch ( $context ) {
</span><ins>+                case 'frontend':
+                        $attr_title = ( isset($menu_item-&gt;anchor_title) &amp;&amp; '' != $menu_item-&gt;anchor_title ) ? ' title=&quot;'. esc_attr($menu_item-&gt;anchor_title) .'&quot;' : '';
+                        $href = isset($menu_item-&gt;link) ? ' href=&quot;'. esc_url($menu_item-&gt;link) .'&quot;' : '';
+                        
+                        $item .= '&lt;a'. $attr_title . $href . $menu_item-&gt;target .'&gt;';
+                        $item .= $args-&gt;before_link . esc_html( $menu_item-&gt;title ) . $args-&gt;after_link;
+                        $item .= '&lt;/a&gt;';
+                        
+                        break;
+                
</ins><span class="cx">                 case 'backend':
</span><del>-                case 'menu':
-?&gt;
-                                                &lt;dl&gt;
-                                                        &lt;dt&gt;
-                                                                &lt;span class=&quot;item-title&quot;&gt;&lt;?php echo esc_html($menu_item-&gt;title); ?&gt;&lt;/span&gt;
-                                                                &lt;span class=&quot;item-controls&quot;&gt;
-                                                                        &lt;span class=&quot;item-type&quot;&gt;&lt;?php echo esc_html($menu_item-&gt;type); ?&gt;&lt;/span&gt;
-                                                                        &lt;a class=&quot;item-edit thickbox&quot; id=&quot;edit&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; title=&quot;&lt;?php _e('Edit Menu Item'); ?&gt;&quot; href=&quot;#TB_inline?height=380&amp;width=300&amp;inlineId=menu-item-settings&quot;&gt;&lt;?php _e('Edit'); ?&gt;&lt;/a&gt; |
-                                                                        &lt;a class=&quot;item-delete&quot; id=&quot;delete&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot;&gt;&lt;?php _e('Delete'); ?&gt;&lt;/a&gt;
-                                                                &lt;/span&gt;
-                                                        &lt;/dt&gt;
-                                                &lt;/dl&gt;
-                                                &lt;?php if ( 'backend' == $context ) { ?&gt;
-                                                &lt;a&gt;&lt;span class=&quot;&quot;&gt;&lt;/span&gt;&lt;/a&gt;
-                                                &lt;?php } else { ?&gt;
-                                                &lt;a class=&quot;hide&quot; href=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot;&gt;&lt;?php echo esc_html( $menu_item-&gt;title ); ?&gt;&lt;/a&gt;
-                                                &lt;?php } ?&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;dbid&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; id=&quot;dbid&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( $menu_item-&gt;ID ); ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;postmenu&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; id=&quot;postmenu&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( get_post_meta( $menu_item-&gt;ID, 'object_id', true ) ); ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;parent&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; id=&quot;parent&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( $menu_item-&gt;parent_item ); ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;icon&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; id=&quot;icon&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; value=&quot;0&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;position&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; id=&quot;position&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;linktype&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; id=&quot;linktype&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( get_post_meta( $menu_item-&gt;ID, 'menu_type', true ) ); ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;item-title&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; id=&quot;item-title&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( $menu_item-&gt;title ); ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;item-url&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; id=&quot;item-url&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( $menu_item-&gt;link ); ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;item-description&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; id=&quot;item-description&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( $menu_item-&gt;description ); ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;item-attr-title&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; id=&quot;item-attr-title&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( $menu_item-&gt;post_excerpt ); ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;item-target&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; id=&quot;item-target&lt;?php echo esc_attr( $menu_item-&gt;menu_order ); ?&gt;&quot; value=&quot;&lt;?php echo ( get_post_meta( $menu_item-&gt;ID, 'menu_new_window', true ) ? '1' : '0' ); ?&gt;&quot; /&gt;
-&lt;?php
-                break;
-
-                case 'frontend':
-                        // Override for menu descriptions
-                        $advanced_option_descriptions = get_option('wp_settings_nav_menu_advanced_options');
-                        if ( $advanced_option_descriptions == 'no' )
-                                $args['desc'] = 2;
-?&gt;
-                        &lt;a title=&quot;&lt;?php echo esc_attr( $menu_item-&gt;anchor_title ); ?&gt;&quot; href=&quot;&lt;?php echo esc_url( $menu_item-&gt;link ); ?&gt;&quot; &lt;?php echo $menu_item-&gt;target; ?&gt;&gt;&lt;?php echo $args['before_title'] . esc_html( $menu_item-&gt;title ) . $args['after_title']; ?&gt;&lt;?php
-
-                                                        if ( $advanced_option_descriptions == 'no' ) {
-                                                                // 2 widget override do NOT display descriptions
-                                                                // 1 widget override display descriptions
-                                                                // 0 widget override not set
-                                                                if ( ($args['desc'] == 1) || ($args['desc'] == 0) ) {
-                                                                        ?&gt;&lt;span class=&quot;nav-description&quot;&gt;&lt;?php echo $menu_item-&gt;description; ?&gt;&lt;/span&gt;&lt;?php
-                                                                }
-                                                        } else {
-                                                                // 2 widget override do NOT display descriptions
-                                                                // 1 widget override display descriptions
-                                                                // 0 widget override not set
-                                                                if ( $args['desc'] == 1 ) {
-                                                                        ?&gt;&lt;span class=&quot;nav-description&quot;&gt;&lt;?php echo $menu_item-&gt;description; ?&gt;&lt;/span&gt;&lt;?php
-                                                                }
-                                                        }
-                                                ?&gt;&lt;/a&gt;
-&lt;?php
-                break;
-
</del><ins>+                        $item .= '&lt;dl&gt;&lt;dt&gt;';
+                        $item .= '&lt;span class=&quot;item-title&quot;&gt;'. esc_html($menu_item-&gt;title) .'&lt;/span&gt;';
+                        $item .= '&lt;span class=&quot;item-controls&quot;&gt;';
+                        $item .= '&lt;span class=&quot;item-type&quot;&gt;'. esc_html($menu_item-&gt;type) .'&lt;/span&gt;';
+                        
+                        // Actions
+                        $item .= '&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=380&amp;width=300&amp;inlineId=menu-item-settings&quot;&gt;'. __('Edit') .'&lt;/a&gt; | ';
+                        $item .= '&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;';
+                        
+                        $item .= '&lt;/dt&gt;&lt;/dl&gt;';
+                        
+                        // Menu Item Settings
+                        $item .= '&lt;input type=&quot;hidden&quot; id=&quot;item-dbid'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; name=&quot;item-dbid'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;ID ) .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; id=&quot;item-postmenu'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; name=&quot;item-postmenu'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( get_post_meta( $menu_item-&gt;ID, 'object_id', true ) ) .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; id=&quot;item-parent'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; name=&quot;item-parent'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;parent_item ) .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; id=&quot;item-position'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; name=&quot;item-position'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; id=&quot;item-type'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; name=&quot;item-type'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( get_post_meta( $menu_item-&gt;ID, 'menu_type', true ) ) .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; id=&quot;item-title'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; name=&quot;item-title'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;title ) .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; id=&quot;item-url'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; name=&quot;item-url'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;link ) .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; id=&quot;item-description'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; name=&quot;item-description'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( $menu_item-&gt;description ) .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; id=&quot;item-attr-title'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; name=&quot;item-attr-title'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'.esc_attr( $menu_item-&gt;post_excerpt )  .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; id=&quot;item-target'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; name=&quot;item-target'. esc_attr( $menu_item-&gt;menu_order ) .'&quot; value=&quot;'. esc_attr( get_post_meta( $menu_item-&gt;ID, 'menu_new_window', true ) ? '1' : '0' ) .'&quot; /&gt;';
+                        break;
+                        
</ins><span class="cx">                 case 'default':
</span><span class="cx">                         $menu_id = 'menu-item-' . $menu_item-&gt;ID;
</span><del>-?&gt;
-                                        &lt;dl&gt;
-                                                &lt;dt&gt;
-                                                        &lt;label class=&quot;item-title&quot;&gt;&lt;input type=&quot;checkbox&quot; id=&quot;&lt;?php echo esc_attr($menu_id); ?&gt;&quot; onclick=&quot;wp_update_queue('&lt;?php echo esc_js( $menu_item-&gt;append ); ?&gt;','&lt;?php echo esc_js( $menu_item-&gt;title ); ?&gt;','&lt;?php echo esc_js( $menu_item-&gt;link ); ?&gt;','&lt;?php echo esc_js( $menu_item-&gt;ID ); ?&gt;','&lt;?php echo esc_js( $menu_item-&gt;parent_item ); ?&gt;','&lt;?php echo esc_js( $menu_item-&gt;description ); ?&gt;')&quot; name=&quot;&lt;?php echo esc_attr( $menu_item-&gt;title ); ?&gt;&quot; value=&quot;&lt;?php echo esc_attr( $menu_item-&gt;link ); ?&gt;&quot; /&gt;&lt;?php echo $menu_item-&gt;title; ?&gt;&lt;/label&gt;
-                                                &lt;/dt&gt;
-                                        &lt;/dl&gt;
-&lt;?php
-                break;
</del><ins>+                        $item .= '&lt;label class=&quot;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;link ) .'&quot; /&gt;'. $menu_item-&gt;title .'&lt;/label&gt;';
+                        
+                        // Menu Item Settings
+                        $item .= '&lt;input type=&quot;hidden&quot; class=&quot;item-type&quot; value=&quot;'. esc_attr( $menu_item-&gt;append ) .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; class=&quot;item-title&quot; value=&quot;'. esc_attr( $menu_item-&gt;title ) .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; class=&quot;item-url&quot; value=&quot;'. esc_attr( $menu_item-&gt;link ) .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; class=&quot;item-dbid&quot; value=&quot;'. esc_attr( $menu_item-&gt;ID ) .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; class=&quot;item-parent&quot; value=&quot;'. esc_attr( $menu_item-&gt;parent_item ) .'&quot; /&gt;';
+                        $item .= '&lt;input type=&quot;hidden&quot; class=&quot;item-description&quot; value=&quot;'. esc_attr( $menu_item-&gt;description ) .'&quot; /&gt;';
+                        break;
</ins><span class="cx">         }
</span><ins>+        return apply_filters( 'wp_get_nav_menu_item', $item );
</ins><span class="cx"> }
</span><del>-
</del><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/nav-menu.php (13511 => 13512)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/nav-menu.php        2010-02-28 19:49:31 UTC (rev 13511)
+++ trunk/wp-includes/nav-menu.php        2010-02-28 20:00:49 UTC (rev 13512)
</span><span class="lines">@@ -7,22 +7,65 @@
</span><span class="cx">  * @since 3.0.0
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-// Deletes a nav menu
-function wp_delete_nav_menu( $menu_id ) {
-        $menu_id = (int) $menu_id;
-        if ( !$menu_id  )
-                return false;
</del><ins>+/**
+ * Returns a Navigation Menu object
+ *
+ * @since 3.0.0
+ *
+ * @param string $menu Menu id
+ * @return mixed $menu|false
+ */
+function wp_get_nav_menu_object( $menu ) {
+        return is_nav_menu( $menu );
+}
</ins><span class="cx"> 
</span><del>-        $menu_objects = get_objects_in_term( $menu_id, 'nav_menu' );
-        if ( !empty( $menu_objects ) ) {
-                foreach ( $menu_objects as $item ) {
-                        wp_delete_post( $item );
-                }
</del><ins>+/**
+ * Check if Menu exists.
+ *
+ * Returns the menu object, or false if the term doesn't exist.
+ *
+ * @since 3.0.0
+ *
+ * @param int|string $menu The menu to check
+ * @return mixed Menu Object, if exists.
+ */
+function is_nav_menu( $menu ) {
+        if ( $menu ) {
+                $menu = get_term( $menu, 'nav_menu' );
+        } elseif ( !$menu ) {
+                $menu = get_term_by( 'slug', $menu, 'nav_menu' );
+        } elseif( !$menu ) {
+                $menu = get_term_by( 'name', $menu, 'nav_menu' );
+        } else {
+                $menu = false;
</ins><span class="cx">         }
</span><del>-        wp_delete_term( $menu_id, 'nav_menu' );
</del><ins>+                
+        return $menu;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Creates a new nav menu
</del><ins>+/**
+ * Returns all Navigation Menu objects.
+ *
+ * @since 3.0.0
+ *
+ * @return array menu objects
+ */
+function wp_get_nav_menus() {
+        return get_terms( 'nav_menu', array( 'hide_empty' =&gt; false, 'orderby' =&gt; 'id' ) );
+}
+
+/**
+ * Creates a navigation menu.
+ *
+ * Optional args:
+ * slug - the url friendly version of the nav menu.
+ *
+ * @since 3.0.0
+ *
+ * @param string $menu_name Menu Name
+ * @param string $args Optional.
+ * @return mixed Menu object|WP_Error
+ */
</ins><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="lines">@@ -39,10 +82,39 @@
</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>+        return get_term( $menu['term_id'], 'nav_menu') ;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Creates a default menu if none exists
</del><ins>+/**
+ * Deletes a navigation menu.
+ *
+ * @since 3.0.0
+ *
+ * @param string $menu name|id|slug
+ * @return bool true on success, else false.
+ */
+function wp_delete_nav_menu( $menu ) {
+        $menu = wp_get_nav_menu_object( $menu );
+        if ( !$menu  )
+                return false;
+
+        $menu_objects = get_objects_in_term( $menu-&gt;term_id, 'nav_menu' );
+        if ( !empty( $menu_objects ) ) {
+                foreach ( $menu_objects as $item ) {
+                        wp_delete_post( $item );
+                }
+        }
+        wp_delete_term( $menu_id, 'nav_menu' );
+}
+
+/**
+ * Creates a nav menu named 'Menu 1'.
+ *
+ * This function is called if the user doesn't have any nav menus.
+ * It grabs the first 14 pages, and creates a new default menu.
+ *
+ * @since 3.0.0
+ */
</ins><span class="cx"> function wp_create_default_nav_menu() {
</span><span class="cx">         $menu = wp_create_nav_menu( __('Menu 1'), array('slug' =&gt; 'menu-1') );
</span><span class="cx"> 
</span><span class="lines">@@ -61,23 +133,26 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Get nav menu by id
-function wp_get_nav_menu( $menu ) {
-        return get_term( (int) $menu, 'nav_menu' );
-}
-
-// Get all nav menus
-function wp_get_nav_menus() {
-        return get_terms( 'nav_menu', array( 'hide_empty' =&gt; false, 'orderby' =&gt; 'id' ) );
-}
-
-// Get the nav menu items
</del><ins>+/**
+ * Returns the menu items of a navigation menu.
+ *
+ * @since 3.0.0
+ *
+ * @param string $menu menu name, id, or slug
+ * @param string $args 
+ * @return mixed $items array of menu items, else false.
+ */
</ins><span class="cx"> function wp_get_nav_menu_items( $menu, $args = array() ) {
</span><del>-        $items = get_objects_in_term( (int) $menu, 'nav_menu' );
</del><ins>+        $menu = wp_get_nav_menu_object( $menu );
+        
+        if ( !$menu )
+                return false;
+        
+        $items = get_objects_in_term( $menu-&gt;term_id, 'nav_menu' );
</ins><span class="cx"> 
</span><span class="cx">         if ( ! empty( $items ) ) {
</span><span class="cx">                 $defaults = array( 'orderby' =&gt; 'menu_order', 'post_type' =&gt; 'nav_menu_item', 'post_status' =&gt; 'publish', 'output' =&gt; ARRAY_A, 'output_key' =&gt; 'menu_order' );
</span><del>-                $args = wp_parse_args($args, $defaults);
</del><ins>+                $args = wp_parse_args( $args, $defaults );
</ins><span class="cx">                 if ( count( $items ) &gt; 1 )        
</span><span class="cx">                         $args['include'] = implode( ',', $items );
</span><span class="cx">                 else
</span><span class="lines">@@ -90,21 +165,30 @@
</span><span class="cx">                         foreach ( $items as $item ) {
</span><span class="cx">                                 $output[$item-&gt;$args['output_key']] = $item;
</span><span class="cx">                         }
</span><del>-                        unset($items);
-                        ksort($output);
</del><ins>+                        unset( $items );
+                        ksort( $output );
</ins><span class="cx">                         return $output;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         return $items;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// wp_setup_nav_menu_item()
-function wp_setup_nav_menu_item($menu_item, $type = 'item', $position = 0) {
</del><ins>+/**
+ * Returns a menu item with all it's nessecary data populated.
+ *
+ * @since 3.0.0
+ *
+ * @param string $menu_item Menu item.
+ * @param string $type item|category|page.
+ * @param string $position position of the menu item.
+ * @return $menu_item
+ */
+function wp_setup_nav_menu_item( $menu_item, $type = 'item', $position = 0 ) {
</ins><span class="cx">         global $parent_menu_order;
</span><span class="cx"> 
</span><span class="cx">         if ( 'item' == $type ) {
</span><del>-                $menu_item-&gt;type = get_post_meta($menu_item-&gt;ID, 'menu_type', true);
-                $menu_item-&gt;object_id = get_post_meta($menu_item-&gt;ID, 'object_id', true);
</del><ins>+                $menu_item-&gt;type = get_post_meta( $menu_item-&gt;ID, 'menu_type', true );
+                $menu_item-&gt;object_id = get_post_meta( $menu_item-&gt;ID, 'object_id', true );
</ins><span class="cx">                 $menu_item-&gt;target = ( get_post_meta( $menu_item-&gt;ID, 'menu_new_window', true ) ) ? 'target=&quot;_blank&quot;' : '';
</span><span class="cx">                 if ( isset( $parent_menu_order[ $menu_item-&gt;post_parent ] ) )
</span><span class="cx">                         $menu_item-&gt;parent_item = $parent_menu_order[ $menu_item-&gt;post_parent ];
</span><span class="lines">@@ -165,8 +249,9 @@
</span><span class="cx"> 
</span><span class="cx">         $menu_item-&gt;li_class = '';
</span><span class="cx">         global $wp_query;
</span><del>-        if ( $menu_item-&gt;ID == $wp_query-&gt;get_queried_object_id() )
-                $menu_item-&gt;li_class = 'class=&quot;current_page_item&quot;';
</del><ins>+        
+        if ( $menu_item-&gt;object_id == $wp_query-&gt;get_queried_object_id() )
+                $menu_item-&gt;li_class = ' current_page_item';
</ins><span class="cx"> 
</span><span class="cx">         $menu_item-&gt;anchor_title = '';
</span><span class="cx"> /* @todo: update to use tax/post data
</span><span class="lines">@@ -195,5 +280,4 @@
</span><span class="cx"> 
</span><span class="cx">         return $menu_item;
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>