<!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>[13366] trunk: Reorg nav menu files.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13366">13366</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-02-24 08:06:36 +0000 (Wed, 24 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Reorg nav menu files. see <a href="http://trac.wordpress.org/ticket/11817">#11817</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminmenuphp">trunk/wp-admin/menu.php</a></li>
<li><a href="#trunkwpincludesgeneraltemplatephp">trunk/wp-includes/general-template.php</a></li>
<li><a href="#trunkwpsettingsphp">trunk/wp-settings.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesnavmenuphp">trunk/wp-admin/includes/nav-menu.php</a></li>
<li><a href="#trunkwpadminnavmenusphp">trunk/wp-admin/nav-menus.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>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkwpadmincustomnavigationphp">trunk/wp-admin/custom-navigation.php</a></li>
<li><a href="#trunkwpincludescustomnavigationphp">trunk/wp-includes/custom-navigation.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincustomnavigationphp"></a>
<div class="delfile"><h4>Deleted: trunk/wp-admin/custom-navigation.php (13365 => 13366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/custom-navigation.php        2010-02-24 07:58:14 UTC (rev 13365)
+++ trunk/wp-admin/custom-navigation.php        2010-02-24 08:06:36 UTC (rev 13366)
</span><span class="lines">@@ -1,509 +0,0 @@
</span><del>-&lt;?php
-/**
- * WordPress Administration for Navigation Menus
- * Interface functions
- *
- * @author Jeffikus &lt;pearce.jp@gmail.com&gt;
- * @version 1.1.0
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-require_once('admin.php');
-
-if ( ! current_user_can('switch_themes') )
-        wp_die( __( 'Cheatin&amp;#8217; uh?' ));
-
-wp_admin_css( 'custom-navigation' );
-wp_enqueue_script( 'jquery' );
-wp_enqueue_script( 'jquery-ui-draggable' );
-wp_enqueue_script( 'jquery-ui-droppable' );
-wp_enqueue_script( 'jquery-ui-sortable' );
-wp_enqueue_script( 'jquery-ui-dialog' );
-wp_enqueue_script( 'custom-navigation-dynamic-functions' );
-wp_enqueue_script( 'custom-navigation-default-items' );
-wp_enqueue_script( 'jquery-autocomplete' );
-wp_enqueue_script( 'custom-navigation-php-functions' );
-
-require_once('admin-header.php');
-require_once (ABSPATH . WPINC . '/custom-navigation.php');
-
-function wp_reset_nav_menu() {
-        wp_custom_navigation_setup(true);
-
-        return true;
-}
-
-$messagesdiv = '';
-$menu_id_in_edit = 0;
-$updated = false;
-
-// Check which menu is selected and if menu is in edit already
-if ( isset( $_GET['edit_menu'] ) ) {
-        $menu_selected_id = (int) $_GET['edit_menu'];
-        $updated = true;
-} elseif ( isset( $_POST[ 'menu_id_in_edit' ] ) ) {
-        $menu_selected_id = (int) $_POST[ 'menu_id_in_edit' ];
-} else {
-        $menu_selected_id = 0;
-}
-
-if ( isset( $_POST[ 'delete_menu' ] ) &amp;&amp; $menu_selected_id &gt; 0 ) {
-        wp_delete_nav_menu( $menu_selected_id );
-        $menu_selected_id = 0;
-        $updated = true;
-}
-
-// Default Menu to show
-$custom_menus = wp_get_nav_menus();
-if ( ! $menu_selected_id &amp;&amp; ! empty( $custom_menus ) )
-        $menu_selected_id = $custom_menus[0]-&gt;term_id;
-
-$menu_title = '';
-if ( $menu_selected_id &gt; 0 ) {
-        foreach ( $custom_menus as $menu ) {
-                if ( $menu-&gt;term_id == $menu_selected_id ) {
-                        $menu_title = $menu-&gt;name;
-                        break;
-                }
-        }
-}
-
-if ( isset( $_POST['set_wp_menu'] ) ) {
-        // @todo validate set_wp_menu
-        update_option( 'wp_custom_nav_menu', $_POST['enable_wp_menu'] );
-        $updated = true;
-        $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . __('Menu has been updated!') . '&lt;/p&gt;&lt;/div&gt;';
-}
-
-if ( isset( $_POST['licount'] ) )
-        $postCounter = $_POST['licount'];
-else
-        $postCounter = 0;
-
-// Create a new menu. Menus are stored as terms in the 'menu' taxonomy.
-if ( isset( $_POST['add_menu'] ) &amp;&amp; ! $updated ) {
-        $insert_menu_name = $_POST['add_menu_name'];
-
-        if ( $insert_menu_name != '' ) {
-                $menu = wp_create_nav_menu($insert_menu_name);
-                if ( is_wp_error($menu) ) {
-                        $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;error fade below-h2&quot;&gt;&lt;p&gt;' . esc_html( $menu-&gt;get_error_message() ) . '&lt;/p&gt;&lt;/div&gt;';
-                } else {
-                        $custom_menus[$menu-&gt;term_id] = $menu;
-                        $menu_selected_id = $menu-&gt;term_id;
-                        $menu_id_in_edit = $menu_selected_id;
-                        $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . esc_html( sprintf( __('&quot;%s&quot; menu has been created!'), $menu-&gt;name ) ) . '&lt;/p&gt;&lt;/div&gt;';
-                        $postCounter = 0;
-                }
-        } else {
-                $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;error fade below-h2&quot;&gt;&lt;p&gt;' . __('Please enter a valid menu name.') . '&lt;/p&gt;&lt;/div&gt;';
-        }
-        $updated = true;
-}
-
-if ( isset($_POST['reset_wp_menu']) &amp;&amp; ! $updated ) {
-        $success = wp_reset_nav_menu();
-        if ( $success ) {
-                // DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
-                $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . __('The menu has been reset.') . '&lt;/p&gt;&lt;/div&gt;';
-                // GET reset menu id
-                $custom_menus = array();
-                $menu_selected_id = 0;
-        } else {
-                // DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
-                $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;error fade below-h2&quot;&gt;&lt;p&gt;' . __('The menu could not be reset. Please try again.') . '&lt;/p&gt;&lt;/div&gt;';
-        }
-} elseif ( $postCounter &gt; 0 &amp;&amp; $menu_selected_id &gt; 0 &amp;&amp; ! $updated ) {
-        $menu_items = wp_get_nav_menu_items( $menu_selected_id, array('orderby' =&gt; 'ID', 'output' =&gt; ARRAY_A, 'output_key' =&gt; 'ID') );
-        $parent_menu_ids = array();
-
-        // Loop through all POST variables
-        for ( $k = 1; $k &lt;= $postCounter; $k++ ) {
-                if (isset($_POST['dbid'.$k])) { $db_id = $_POST['dbid'.$k]; } else { $db_id = 0; }
-                if (isset($_POST['postmenu'.$k])) { $object_id = $_POST['postmenu'.$k]; } else { $object_id = 0; }
-                if (isset($_POST['parent'.$k])) { $parent_id = $_POST['parent'.$k]; } else { $parent_id = 0; }
-                if (isset($_POST['title'.$k])) { $custom_title = $_POST['title'.$k]; } else { $custom_title = ''; }
-                if (isset($_POST['linkurl'.$k])) { $custom_linkurl = $_POST['linkurl'.$k]; } else { $custom_linkurl = ''; }
-                if (isset($_POST['description'.$k])) { $custom_description = $_POST['description'.$k]; } else { $custom_description = ''; }
-                // doesn't seem to be used by UI
-                if (isset($_POST['icon'.$k])) { $icon = $_POST['icon'.$k]; } else { $icon = 0; }
-                if (isset($_POST['position'.$k])) { $position = $_POST['position'.$k]; } else { $position = 0; }
-                if (isset($_POST['linktype'.$k])) { $linktype = $_POST['linktype'.$k]; } else { $linktype = 'custom'; }
-                if (isset($_POST['anchortitle'.$k])) { $custom_anchor_title = $_POST['anchortitle'.$k]; } else { $custom_anchor_title = $custom_title; }
-                if (isset($_POST['newwindow'.$k])) { $new_window = $_POST['newwindow'.$k]; } else { $new_window = 0; }
-
-                $post = array( 'post_status' =&gt; 'publish', 'post_type' =&gt; 'nav_menu_item', 'post_author' =&gt; $user_ID,
-                        'ping_status' =&gt; 0, 'post_parent' =&gt; 0, 'menu_order' =&gt; $position,
-                        'guid' =&gt; $custom_linkurl, 'post_excerpt' =&gt; $custom_anchor_title, 'tax_input' =&gt; array( 'nav_menu' =&gt; $menu_title ),
-                        'post_content' =&gt; $custom_description, 'post_title' =&gt; $custom_title );
-                if ( $new_window )
-                        $post['post_content_filtered'] = '_blank';
-                else
-                        $post['post_content_filtered'] = '';
-                if ( $parent_id &gt; 0 &amp;&amp; isset( $parent_menu_ids[ $parent_id ] ) )
-                        $post[ 'post_parent' ] = $parent_menu_ids[ $parent_id ];
-
-                // New menu item
-                if ( $db_id == 0 ) {
-                        $db_id = wp_insert_post( $post );
-                } elseif ( isset( $menu_items[$db_id] ) ) {
-                        $post['ID'] = $db_id;
-                        wp_update_post( $post );
-                        unset( $menu_items[$db_id] );
-                }
-                $parent_menu_ids[ $k ] = $db_id;
-
-                update_post_meta($db_id, 'menu_type', $linktype);
-                update_post_meta($db_id, 'object_id', $object_id);
-        }
-        if ( !empty( $menu_items ) ) {
-                foreach ( array_keys( $menu_items ) as $menu_id ) {
-                        wp_delete_post( $menu_id );
-                }
-        }
-        // DISPLAY SUCCESS MESSAGE IF POST CORRECT
-        $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . __('The menu has been updated.') . '&lt;/p&gt;&lt;/div&gt;';
-}
-
-?&gt;
-&lt;div class=&quot;wrap&quot;&gt;
-&lt;?php screen_icon(); ?&gt;
-&lt;h2 class=&quot;maintitle&quot;&gt;&lt;?php esc_html_e('Menus') ?&gt;&lt;/h2&gt;
-        &lt;div class=&quot;hide-if-js error&quot;&gt;&lt;p&gt;&lt;?php _e('You do not have JavaScript enabled in your browser. Please enable it to access the Menus functionality.'); ?&gt;&lt;/p&gt;&lt;/div&gt;
-        &lt;div class=&quot;hide-if-no-js&quot;&gt;
-        &lt;div id=&quot;pages-left&quot;&gt;
-                &lt;ul class=&quot;subsubsub&quot;&gt;
-&lt;?php                if ( ! empty( $custom_menus ) ) {
-                                foreach ( $custom_menus as $menu ) {
-                                        $sep = end($custom_menus) == $menu ? '' : ' | ';
-                                        // $menu_term = get_term( $menu, 'nav_menu' );
-                                        if ( ( $menu_id_in_edit == $menu-&gt;term_id ) || ( $menu_selected_id == $menu-&gt;term_id ) ) { ?&gt;
-                                                &lt;li&gt;&lt;?php echo esc_html( $menu-&gt;name ) . $sep; ?&gt;&lt;/li&gt;
-&lt;?php                                } else { ?&gt;
-                        &lt;li&gt;&lt;a href='custom-navigation.php?edit_menu=&lt;?php echo esc_attr($menu-&gt;term_id); ?&gt;'&gt;&lt;?php echo esc_html( $menu-&gt;name ); ?&gt;&lt;/a&gt;&lt;?php echo $sep; ?&gt;&lt;/li&gt;
-&lt;?php                                }
-                                }
-                        } else { ?&gt;
-                        &lt;li&gt;&lt;?php _e( 'Default' ); ?&gt;&lt;/li&gt;
-&lt;?php                } ?&gt;
-                &lt;/ul&gt;
-                &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
-                &lt;div class=&quot;inside&quot;&gt;
-                &lt;?php
-                        // CHECK if custom menu has been enabled
-                        $enabled_menu = get_option('wp_custom_nav_menu');
-                        $checked = strtolower($enabled_menu);
-
-                        if ( $checked != 'true' )
-                                echo '&lt;div id=&quot;message-enabled&quot; class=&quot;error fade below-h2&quot;&gt;&lt;p&gt;&lt;strong&gt;' . __('Menu editing has not been Enabled yet. Please enable it in order to use it --------&gt;') . '&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;';
-                ?&gt;
-                &lt;?php echo $messagesdiv; ?&gt;
-                &lt;form onsubmit=&quot;updatepostdata()&quot; action=&quot;custom-navigation.php&quot; method=&quot;post&quot;  enctype=&quot;multipart/form-data&quot;&gt;
-
-                &lt;input type=&quot;hidden&quot; name=&quot;licount&quot; id=&quot;licount&quot; value=&quot;0&quot; /&gt;
-                &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;
-
-                &lt;div class=&quot;sidebar-name&quot;&gt;
-
-                        &lt;div class=&quot;sidebar-name-arrow&quot;&gt;
-                                &lt;br/&gt;
-                        &lt;/div&gt;
-                        &lt;h3&gt;&lt;?php echo esc_html($menu_title); ?&gt;&lt;/h3&gt;
-
-                &lt;/div&gt;
-
-                &lt;div id=&quot;nav-container&quot;&gt;
-                        &lt;ul id=&quot;custom-nav&quot;&gt;
-
-                &lt;?php
-                //DISPLAY existing menu
-                if ( $menu_selected_id &gt; 0 ) {
-                        // SET output type
-                        $output_type = &quot;backend&quot;;
-                        // MAIN OUTPUT FUNCTION
-                        wp_custom_navigation_output( 'type='.$output_type.'&amp;name='.$menu_title.'&amp;id='.$menu_selected_id );
-                }
-                ?&gt;
-
-                        &lt;/ul&gt;
-                &lt;/div&gt;&lt;!-- /#nav-container --&gt;
-
-                &lt;p class=&quot;submit&quot;&gt;
-
-                &lt;script type=&quot;text/javascript&quot;&gt;
-                        updatepostdata();
-                &lt;/script&gt;
-                &lt;!-- &lt;input id=&quot;delete_menu&quot; name=&quot;delete_menu&quot; type=&quot;submit&quot; value=&quot;&lt;?php esc_attr_e('Delete This Menu'); ?&gt;&quot; /&gt; --&gt;
-                &lt;input id=&quot;save_bottom&quot; name=&quot;save_bottom&quot; type=&quot;submit&quot; value=&quot;&lt;?php esc_attr_e('Save All Changes'); ?&gt;&quot; /&gt;&lt;/p&gt;
-                &lt;/div&gt;&lt;!-- /.inside --&gt;
-        &lt;/div&gt;
-
-        &lt;div id=&quot;menu-right&quot;&gt;
-                &lt;div class=&quot;widgets-holder-wrap&quot;&gt;
-                        &lt;div class=&quot;sidebar-name&quot;&gt;
-                                &lt;div class=&quot;sidebar-name-arrow&quot;&gt;&lt;/div&gt;
-                                &lt;h3&gt;&lt;?php esc_html_e('Setup Menus'); ?&gt;&lt;/h3&gt;
-                        &lt;/div&gt;
-                        &lt;div class=&quot;widget-holder&quot;&gt;
-
-                                &lt;?php
-                                // Setup custom menu
-                                $enabled_menu = get_option('wp_custom_nav_menu');
-                                $checked = strtolower($enabled_menu);
-                                ?&gt;
-
-                                &lt;span &gt;
-                                        &lt;label&gt;&lt;?php _e('Enable'); ?&gt;&lt;/label&gt;&lt;input type=&quot;radio&quot; name=&quot;enable_wp_menu&quot; value=&quot;true&quot; &lt;?php if ($checked=='true') { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
-                                        &lt;label&gt;&lt;?php _e('Disable'); ?&gt;&lt;/label&gt;&lt;input type=&quot;radio&quot; name=&quot;enable_wp_menu&quot; value=&quot;false&quot; &lt;?php if ($checked=='true') { } else { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
-                                &lt;/span&gt;&lt;!-- /.checkboxes --&gt;
-
-                                &lt;input id=&quot;set_wp_menu&quot; type=&quot;submit&quot; value=&quot;&lt;?php esc_attr_e('Set Menu'); ?&gt;&quot; name=&quot;set_wp_menu&quot; class=&quot;button&quot; /&gt;&lt;br /&gt;
-
-                                &lt;span&gt;
-                                        &lt;label&gt;&lt;?php _e('Reset Menu to Default'); ?&gt;&lt;/label&gt;
-                                        &lt;input id=&quot;reset_wp_menu&quot; type=&quot;submit&quot; value=&quot;Reset&quot; name=&quot;reset_wp_menu&quot; class=&quot;button&quot; onclick=&quot;return confirm('&lt;?php _e('Are you sure you want to reset the menu to its default settings?'); ?&gt;');&quot; /&gt;
-                                &lt;/span&gt;
-                                &lt;br /&gt;&lt;br /&gt;
-                                &lt;span&gt;
-                                &lt;input id=&quot;add_menu_name&quot; name=&quot;add_menu_name&quot; type=&quot;text&quot; value=&quot;&quot;  /&gt;
-                                &lt;input id=&quot;add_menu&quot; type=&quot;submit&quot; value=&quot;&lt;?php esc_attr_e('Add Menu'); ?&gt;&quot; name=&quot;add_menu&quot; class=&quot;button&quot; /&gt;
-                                &lt;/span&gt;
-                        &lt;/div&gt;
-                &lt;/div&gt;&lt;!-- /.widgets-holder-wrap --&gt;
-                &lt;?php $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options'); ?&gt;
-                &lt;div class=&quot;widgets-holder-wrap&quot; style=&quot;display:none;&quot;&gt;
-                        &lt;div class=&quot;sidebar-name&quot;&gt;
-                                &lt;div class=&quot;sidebar-name-arrow&quot;&gt;&lt;/div&gt;
-                                &lt;h3&gt;&lt;?php esc_html_e('Top Level Menu Descriptions'); ?&gt;&lt;/h3&gt;
-                        &lt;/div&gt;
-                        &lt;div class=&quot;widget-holder&quot;&gt;
-                                &lt;span&gt;&lt;?php _e('Display Descriptions in Top Level Menu?'); ?&gt;&lt;/span&gt;
-
-                                &lt;?php
-                                // UPDATE and DISPLAY Menu Description Option
-                                if ( isset($_POST['menu-descriptions']) ) {
-                                        if ( !isset($_POST['switch_menu']) ) {
-                                                $menu_options_to_edit = $_POST['menu_id_in_edit'];
-                                                update_option('wp_settings_custom_nav_'.$menu_options_to_edit.'_descriptions',$_POST['menu-descriptions']);
-                                        }
-                                }
-
-                                if ( $menu_id_in_edit &gt; 0 )
-                                        $checkedraw = get_option('wp_settings_custom_nav_'.$menu_id_in_edit.'_descriptions');
-                                else
-                                        $checkedraw = get_option('wp_settings_custom_nav_'.$menu_selected_id.'_descriptions');
-
-                                $checked = strtolower($checkedraw);
-
-                                if ( $advanced_option_descriptions == 'no' )
-                                        $checked = 'no';
-                                ?&gt;
-
-                                &lt;span class=&quot;checkboxes&quot;&gt;
-                                        &lt;label&gt;&lt;?php _e('Yes'); ?&gt;&lt;/label&gt;&lt;input type=&quot;radio&quot; name=&quot;menu-descriptions&quot; value=&quot;yes&quot; &lt;?php if ($checked=='yes') { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
-                                        &lt;label&gt;&lt;?php _e('No'); ?&gt;&lt;/label&gt;&lt;input type=&quot;radio&quot; name=&quot;menu-descriptions&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;/form&gt;
-                                &lt;div class=&quot;fix&quot;&gt;&lt;/div&gt;
-                        &lt;/div&gt;
-                &lt;/div&gt;&lt;!-- /.widgets-holder-wrap --&gt;
-
-                &lt;div class=&quot;widgets-holder-wrap&quot;&gt;
-                        &lt;div class=&quot;sidebar-name&quot;&gt;
-                                &lt;div class=&quot;sidebar-name-arrow&quot;&gt;&lt;/div&gt;
-                                &lt;h3&gt;&lt;?php esc_html_e('Add an Existing Page'); ?&gt;&lt;/h3&gt;
-                        &lt;/div&gt;
-                        &lt;div class=&quot;widget-holder&quot;&gt;
-
-                                &lt;?php
-                                $pages_args = array(
-                                'child_of' =&gt; 0,
-                                'sort_order' =&gt; 'ASC',
-                                'sort_column' =&gt; 'post_title',
-                                'hierarchical' =&gt; 1,
-                                'exclude' =&gt; '',
-                                'include' =&gt; '',
-                                'meta_key' =&gt; '',
-                                'meta_value' =&gt; '',
-                                'authors' =&gt; '',
-                                'parent' =&gt; -1,
-                                'exclude_tree' =&gt; '',
-                                'number' =&gt; '',
-                                'offset' =&gt; 0 );
-
-                                //GET all pages
-                                $pages_array = get_pages($pages_args);
-                                $page_name = '';
-                                //CHECK if pages exist
-                                if ( $pages_array ) {
-                                        foreach ( $pages_array as $post ) {
-                                                //Add page name to
-                                                $page_name .= htmlentities($post-&gt;post_title).'|';
-                                        }
-                                } else {
-                                        $page_name = __('No pages available');
-                                }
-                                ?&gt;
-
-                                &lt;script&gt;
-                                        jQuery(document).ready(function(){
-
-                                                //GET PHP pages
-                                                var dataposts = &quot;&lt;?php echo esc_js($page_name); ?&gt;&quot;.split(&quot;|&quot;);
-
-                                                //Set autocomplete
-                                                jQuery(&quot;#page-search&quot;).autocomplete(dataposts);
-
-                                                //Handle autocomplete result
-                                                jQuery(&quot;#page-search&quot;).result(function(event, data, formatted) {
-                                                        jQuery('#existing-pages').css('display','block');
-                                                        jQuery(&quot;#existing-pages dt:contains('&quot; + data + &quot;')&quot;).css(&quot;display&quot;, &quot;block&quot;);
-
-                                                        jQuery('#show-pages').hide();
-                                                        jQuery('#hide-pages').show();
-
-                                                });
-                                                jQuery('#existing-pages').css('display','none');
-                                        });
-                                &lt;/script&gt;
-
-                                &lt;input type=&quot;text&quot; onfocus=&quot;jQuery('#page-search').attr('value','');&quot; id=&quot;page-search&quot; value=&quot;&lt;?php esc_attr_e('Search Pages'); ?&gt;&quot; /&gt;
-
-                                &lt;a id=&quot;show-pages&quot; style=&quot;cursor:pointer;&quot; onclick=&quot;jQuery('#existing-pages').css('display','block');jQuery('#page-search').attr('value','');jQuery('#existing-pages dt').css('display','block');jQuery('#show-pages').hide();jQuery('#hide-pages').show();&quot;&gt;View All&lt;/a&gt;
-                                &lt;a id=&quot;hide-pages&quot; style=&quot;cursor:pointer;&quot; onclick=&quot;jQuery('#existing-pages').css('display','none');jQuery('#page-search').attr('value','Search Pages');jQuery('#existing-pages dt').css('display','none');jQuery('#show-pages').show();jQuery('#hide-pages').hide();&quot;&gt;Hide All&lt;/a&gt;
-
-                                &lt;script type=&quot;text/javascript&quot;&gt;
-                                        jQuery('#hide-pages').hide();
-                                &lt;/script&gt;
-
-                                &lt;ul id=&quot;existing-pages&quot; class=&quot;list&quot;&gt;
-                                        &lt;?php
-                                                $intCounter = 0;
-                                                //Get default Pages
-                                                $intCounter = wp_custom_nav_get_pages($intCounter,'default');
-                                        ?&gt;
-                                &lt;/ul&gt;
-
-                                &lt;div class=&quot;fix&quot;&gt;&lt;/div&gt;
-
-                        &lt;/div&gt;
-                &lt;/div&gt;&lt;!-- /.widgets-holder-wrap --&gt;
-
-                &lt;div class=&quot;widgets-holder-wrap&quot;&gt;
-                        &lt;div class=&quot;sidebar-name&quot;&gt;
-                                &lt;div class=&quot;sidebar-name-arrow&quot;&gt;&lt;/div&gt;
-                                &lt;h3&gt;&lt;?php esc_html_e('Add an Existing Category'); ?&gt;&lt;/h3&gt;
-                        &lt;/div&gt;
-                        &lt;div class=&quot;widget-holder&quot;&gt;
-
-                                &lt;?php
-                                // Custom GET categories query
-                                // @todo Use API
-                                $categories = $wpdb-&gt;get_results(&quot;SELECT term_id FROM $wpdb-&gt;term_taxonomy WHERE taxonomy = 'category' ORDER BY term_id ASC&quot;);
-                                $cat_name = '';
-                                //CHECK for results
-                                if ( $categories ) {
-                                        foreach ( $categories as $category ) {
-                                                $cat_id = $category-&gt;term_id;
-
-                                                $cat_args = array(
-                                                        'orderby' =&gt; 'name',
-                                                        'include' =&gt; $cat_id,
-                                                        'hierarchical' =&gt; 1,
-                                                        'order' =&gt; 'ASC'
-                                                );
-
-                                                $category_names=get_categories($cat_args);
-
-                                                if ( isset($category_names[0]-&gt;name) ) {
-                                                        // Add category name to data string
-                                                        $cat_name .= htmlentities($category_names[0]-&gt;name).'|';
-                                                }
-                                        }
-                                } else {
-                                        $cat_name = __('No categories available');
-                                }
-                                ?&gt;
-
-                                &lt;script&gt;
-                                        jQuery(document).ready(function(){
-
-                                                //GET PHP categories
-                                                var datacats = &quot;&lt;?php echo esc_js($cat_name); ?&gt;&quot;.split(&quot;|&quot;);
-
-                                                //Set autocomplete
-                                                jQuery(&quot;#cat-search&quot;).autocomplete(datacats);
-
-                                                //Handle autocomplete result
-                                                jQuery(&quot;#cat-search&quot;).result(function(event, data, formatted) {
-                                                        jQuery('#existing-categories').css('display','block');
-                                                        jQuery(&quot;#existing-categories dt:contains('&quot; + data + &quot;')&quot;).css(&quot;display&quot;, &quot;block&quot;);
-
-                                                        jQuery('#show-cats').hide();
-                                                        jQuery('#hide-cats').show();
-
-                                                });
-                                                jQuery('#existing-categories').css('display','none');
-
-                                        });
-                                &lt;/script&gt;
-
-                                &lt;input type=&quot;text&quot; onfocus=&quot;jQuery('#cat-search').attr('value','');&quot; id=&quot;cat-search&quot; value=&quot;&lt;?php esc_attr_e('Search Categories'); ?&gt;&quot; /&gt;
-
-                                &lt;a id=&quot;show-cats&quot; style=&quot;cursor:pointer;&quot; onclick=&quot;jQuery('#existing-categories').css('display','block');jQuery('#cat-search').attr('value','');jQuery('#existing-categories dt').css('display','block');jQuery('#show-cats').hide();jQuery('#hide-cats').show();&quot;&gt;View All&lt;/a&gt;
-                                &lt;a id=&quot;hide-cats&quot; style=&quot;cursor:pointer;&quot; onclick=&quot;jQuery('#existing-categories').css('display','none');jQuery('#cat-search').attr('value','Search Categories');jQuery('#existing-categories dt').css('display','none');jQuery('#show-cats').show();jQuery('#hide-cats').hide();&quot;&gt;Hide All&lt;/a&gt;
-
-                                &lt;script type=&quot;text/javascript&quot;&gt;
-                                        jQuery('#hide-cats').hide();
-                                &lt;/script&gt;
-
-                                &lt;ul id=&quot;existing-categories&quot; class=&quot;list&quot;&gt;
-                                        &lt;?php
-                                                // Get default Categories
-                                                $intCounter = wp_custom_nav_get_categories($intCounter, 'default');
-                                        ?&gt;
-                                &lt;/ul&gt;
-
-                                &lt;div class=&quot;fix&quot;&gt;&lt;/div&gt;
-
-                        &lt;/div&gt;
-                &lt;/div&gt;&lt;!-- /.widgets-holder-wrap --&gt;
-
-                &lt;div class=&quot;widgets-holder-wrap&quot;&gt;
-                        &lt;div class=&quot;sidebar-name&quot;&gt;
-                                &lt;div class=&quot;sidebar-name-arrow&quot;&gt;&lt;/div&gt;
-                                &lt;h3&gt;&lt;?php esc_html_e('Add a Custom Url'); ?&gt;&lt;/h3&gt;
-                        &lt;/div&gt;
-                        &lt;div class=&quot;widget-holder&quot;&gt;
-                                &lt;input id=&quot;custom_menu_item_url&quot; type=&quot;text&quot; value=&quot;http://&quot;  /&gt;
-                                &lt;label&gt;&lt;?php _e('URL'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                                &lt;?php $templatedir = get_bloginfo('url'); ?&gt;
-                                &lt;input type=&quot;hidden&quot; id=&quot;templatedir&quot; value=&quot;&lt;?php echo esc_attr($templatedir); ?&gt;&quot; /&gt;
-                                &lt;input id=&quot;custom_menu_item_name&quot; type=&quot;text&quot; value=&quot;Menu Item&quot; onfocus=&quot;jQuery('#custom_menu_item_name').attr('value','');&quot;  /&gt;
-                                &lt;label&gt;&lt;?php _e('Menu Text'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                                &lt;input id=&quot;custom_menu_item_description&quot; type=&quot;text&quot; value=&quot;&lt;?php esc_attr_e('A description'); ?&gt;&quot; &lt;?php if ($advanced_option_descriptions == 'no') { ?&gt;style=&quot;display:none;&quot;&lt;?php } ?&gt; onfocus=&quot;jQuery('#custom_menu_item_description').attr('value','');&quot; /&gt;
-                                &lt;label &lt;?php if ($advanced_option_descriptions == 'no') { ?&gt;style=&quot;display:none;&quot;&lt;?php } ?&gt; &gt;&lt;?php _e('Description'); ?&gt;&lt;/label&gt;
-                                &lt;a class=&quot;addtomenu&quot; onclick=&quot;appendToList('&lt;?php echo $templatedir; ?&gt;','Custom','','','','0','');jQuery('#custom_menu_item_name').attr('value','Menu Item');jQuery('#custom_menu_item_description').attr('value','A description');&quot;&gt;&lt;?php _e('Add to menu'); ?&gt;&lt;/a&gt;
-                                &lt;div class=&quot;fix&quot;&gt;&lt;/div&gt;
-                        &lt;/div&gt;
-                &lt;/div&gt;&lt;!-- /.widgets-holder-wrap --&gt;
-        &lt;/div&gt;&lt;!-- /.hide-if-no-js --&gt;
-        &lt;/div&gt;
-&lt;/div&gt;
-
-&lt;div id=&quot;dialog-confirm&quot; style=&quot;display:none;&quot; title=&quot;&lt;?php esc_attr_e('Edit Menu Item'); ?&gt;&quot;&gt;
-        &lt;/label&gt;&lt;input id=&quot;edittitle&quot; type=&quot;text&quot; name=&quot;edittitle&quot; value=&quot;&quot; /&gt;&lt;label class=&quot;editlabel&quot; for=&quot;edittitle&quot;&gt;&lt;?php _e('Menu Title'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-        &lt;input id=&quot;editlink&quot; type=&quot;text&quot; name=&quot;editlink&quot; value=&quot;&quot; /&gt;&lt;label class=&quot;editlabel&quot; for=&quot;editlink&quot;&gt;&lt;?php _e('URL'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-        &lt;input id=&quot;editanchortitle&quot; type=&quot;text&quot; name=&quot;editanchortitle&quot; value=&quot;&quot; /&gt;&lt;label class=&quot;editlabel&quot; for=&quot;editanchortitle&quot;&gt;&lt;?php _e('Link Title'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-        &lt;select id=&quot;editnewwindow&quot; name=&quot;editnewwindow&quot;&gt;
-                &lt;option value=&quot;1&quot;&gt;&lt;?php _e('Yes'); ?&gt;&lt;/option&gt;
-                &lt;option value=&quot;0&quot;&gt;&lt;?php _e('No'); ?&gt;&lt;/option&gt;
-        &lt;/select&gt;&lt;label class=&quot;editlabel&quot; for=&quot;editnewwindow&quot;&gt;&lt;?php _e('Open Link in a new window'); ?&gt;&lt;/label&gt;
-        &lt;input id=&quot;editdescription&quot; type=&quot;text&quot; name=&quot;editdescription&quot; value=&quot;&quot; &lt;?php if ($advanced_option_descriptions == 'no') { ?&gt;style=&quot;display:none;&quot;&lt;?php } ?&gt; /&gt;&lt;label class=&quot;editlabel&quot; for=&quot;editdescription&quot; &lt;?php if ($advanced_option_descriptions == 'no') { ?&gt;style=&quot;display:none;&quot;&lt;?php } ?&gt; &gt;&lt;?php _e('Description'); ?&gt;&lt;/label&gt;&lt;br /&gt;
-&lt;/div&gt;
-
-&lt;?php
-
-include(&quot;admin-footer.php&quot;);
</del></span></pre></div>
<a id="trunkwpadminincludesnavmenuphp"></a>
<div class="addfile"><h4>Added: trunk/wp-admin/includes/nav-menu.php (0 => 13366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/nav-menu.php                                (rev 0)
+++ trunk/wp-admin/includes/nav-menu.php        2010-02-24 08:06:36 UTC (rev 13366)
</span><span class="lines">@@ -0,0 +1,236 @@
</span><ins>+&lt;?php
+
+/*-----------------------------------------------------------------------------------*/
+/* 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
+/*-----------------------------------------------------------------------------------*/
+
+// Outputs All Pages and Sub Items
+function wp_nav_menu_get_pages($counter, $type) {
+
+        $pages_args = array(
+                    'child_of' =&gt; 0,
+                        'sort_order' =&gt; 'ASC',
+                        'sort_column' =&gt; 'post_title',
+                        'hierarchical' =&gt; 1,
+                        'exclude' =&gt; '',
+                        'include' =&gt; '',
+                        'meta_key' =&gt; '',
+                        'meta_value' =&gt; '',
+                        'authors' =&gt; '',
+                        'parent' =&gt; -1,
+                        'exclude_tree' =&gt; '',
+                        'number' =&gt; '',
+                        'offset' =&gt; 0 );
+
+        //GET all pages
+        $pages_array = get_pages($pages_args);
+
+        $intCounter = $counter;
+        $parentli = $intCounter;
+
+        if ( !$pages_array ) {
+                echo 'Not Found';
+                return $intCounter;
+        }
+
+        // Display Loop
+        foreach ( $pages_array as $post ) {
+                if ( $post-&gt;post_parent == 0 ) {
+                        $post = wp_setup_nav_menu_item($post, 'page', $intCounter);
+                        if ( $type == 'menu' ) {
+                                ?&gt;
+
+                                &lt;li id=&quot;menu-&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo $intCounter; ?&gt;&quot;&gt;
+                                        &lt;?php
+                                                wp_print_nav_menu_item($post, 'menu', $intCounter);
+                                                $parentli = $post-&gt;ID;
+                                                $intCounter++;
+                                                $intCounter = wp_custom_navigation_default_sub_items($post-&gt;ID, $intCounter, $parentli, 'pages', 'menu');
+                                        ?&gt;
+                                &lt;/li&gt;
+
+                                &lt;?php
+                        } elseif ( $type == 'default' ) {
+                                // Sidebar Menu
+                                ?&gt;
+                                 &lt;li&gt;
+                                        &lt;?php
+                                                wp_print_nav_menu_item($post, 'default');
+                                                $parentli = $post-&gt;ID;
+                                                $intCounter++;
+                                                $intCounter = wp_nav_menu_sub_items($post-&gt;ID, $intCounter, $parentli, 'pages', 'default');
+                                         ?&gt;
+                                &lt;/li&gt;
+
+                                &lt;?php
+                        }
+                }
+        }
+
+        return $intCounter;
+}
+
+// Outputs All Categories and Sub Items
+function wp_nav_menu_get_categories($counter, $type) {
+
+        $category_args = array(
+                        'type'                     =&gt; 'post',
+                        'child_of'                 =&gt; 0,
+                        'orderby'                  =&gt; 'name',
+                        'order'                    =&gt; 'ASC',
+                        'hide_empty'               =&gt; false,
+                        'include_last_update_time' =&gt; false,
+                        'hierarchical'             =&gt; 1,
+                        'exclude'                  =&gt; '',
+                        'include'                  =&gt; '',
+                        'number'                   =&gt; '',
+                        'pad_counts'               =&gt; false );
+
+        $intCounter = $counter;
+
+        // Get all categories
+        $categories_array = get_categories($category_args);
+
+        if ( !$categories_array ) {
+                _e('Not Found');
+                return $intCounter;
+        }
+
+        // Display Loop
+        foreach ( $categories_array as $cat_item ) {
+                if ( $cat_item-&gt;parent == 0 ) {
+                        $cat_item = wp_setup_nav_menu_item($cat_item, 'category', $intCounter);
+                        // Custom Menu
+                        if ( $type == 'menu' ) {
+                                ?&gt;
+
+                                &lt;li id=&quot;menu-&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo $intCounter; ?&gt;&quot;&gt;
+                                        &lt;?php
+                                                wp_print_nav_menu_item($cat_item, 'menu');
+                                                $parentli = $cat_item-&gt;cat_ID;
+                                                $intCounter++;
+                                                $intCounter = wp_nav_menu_sub_items($cat_item-&gt;cat_ID, $intCounter, $parentli, 'categories', 'menu');
+                                        ?&gt;
+
+                                &lt;/li&gt;
+
+                                &lt;?php
+                        } elseif ( $type == 'default' ) {
+                                // Sidebar Menu
+                                ?&gt;
+                                &lt;li&gt;
+                                        &lt;?php
+                                                wp_print_nav_menu_item($cat_item, 'default');
+                                                $parentli = $cat_item-&gt;cat_ID;
+                                                $intCounter++;
+                                                $intCounter = wp_nav_menu_sub_items($cat_item-&gt;cat_ID, $intCounter, $parentli, 'categories', 'default');
+                                        ?&gt;
+
+                                &lt;/li&gt;
+
+                                &lt;?php
+                        }
+                }
+        }
+
+        return $intCounter;
+}
+
+//RECURSIVE Sub Menu Items of default categories and pages
+function wp_nav_menu_sub_items($childof, $intCounter, $parentli, $type, $output_type) {
+
+        $counter = $intCounter;
+
+        // Custom Menu
+        if ( $output_type == 'menu' ) {
+                $sub_args = array(
+                'child_of' =&gt; $childof,
+                'hide_empty' =&gt; false,
+                'parent' =&gt; $childof);
+        } elseif ( $output_type == 'default' ) {
+                // Sidebar Menu
+                $sub_args = array(
+                'child_of' =&gt; $childof,
+                'hide_empty' =&gt; false,
+                'parent' =&gt; $childof);
+        }
+
+        if ( $type == 'categories' ) {
+                // Get Sub Category Items
+                $item_type = 'category';
+                $sub_array = get_categories($sub_args);
+        } elseif ($type == 'pages') {
+                // Get Sub Page Items
+                $item_type = 'page';
+                $sub_array = get_pages($sub_args);
+        } else {
+                $item_type = 'custom';
+                $sub_array = array();
+        }
+
+
+        if ( $sub_array ) {
+                ?&gt;
+                &lt;ul id=&quot;sub-custom-nav-&lt;?php echo $type ?&gt;&quot;&gt;
+
+                &lt;?php
+                // Display Loop
+                foreach ( $sub_array as $sub_item ) {
+                        $sub_item = wp_setup_nav_menu_item($sub_item, $item_type, $counter);
+
+                        if ( $output_type == 'menu' ) {
+                                ?&gt;
+                                &lt;li id=&quot;menu-&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $counter; ?&gt;&quot;&gt;
+                                        &lt;?php
+                                                wp_print_nav_menu_item($sub_item, 'menu');
+                                                $counter++;
+                                                $counter = wp_nav_menu_sub_items($sub_item-&gt;ID, $counter, $sub_item-&gt;ID, $type, 'menu');
+                                        ?&gt;
+
+                                &lt;/li&gt;
+                                &lt;?php
+                        } elseif ( $output_type == 'default' ) {
+                                // Sidebar Menu
+                                ?&gt;
+                                &lt;li&gt;
+                                        &lt;?php
+                                                wp_print_nav_menu_item($sub_item, 'default');
+                                                //$counter++;
+                                                $counter = wp_nav_menu_sub_items($sub_item-&gt;ID, $counter, $sub_item-&gt;ID, $type, 'default');
+                                        ?&gt;
+                                &lt;/li&gt;
+
+                                &lt;?php
+                        }
+                }
+                ?&gt;
+
+                &lt;/ul&gt;
+
+        &lt;?php
+        }
+
+        return $counter;
+}
+
+function wp_nav_menu_setup($override = false) {
+        // Custom Navigation Menu Setup
+
+        // Override for menu descriptions
+        update_option('wp_settings_custom_nav_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') );
+}
+
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: trunk/wp-admin/includes/nav-menu.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx">   + native
</span></span></pre></div>
<a id="trunkwpadminmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu.php (13365 => 13366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu.php        2010-02-24 07:58:14 UTC (rev 13365)
+++ trunk/wp-admin/menu.php        2010-02-24 08:06:36 UTC (rev 13366)
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">         $submenu['themes.php'][5]  = array(__('Themes'), 'switch_themes', 'themes.php');
</span><span class="cx">         $submenu['themes.php'][10] = array(_x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php');
</span><span class="cx">         $submenu['themes.php'][15] = array(__('Add New Themes'), 'install_themes', 'theme-install.php');
</span><del>-        $submenu['themes.php'][20] = array(__('Menus'), 'switch_themes', 'custom-navigation.php');
</del><ins>+        $submenu['themes.php'][20] = array(__('Menus'), 'switch_themes', 'nav-menus.php');
</ins><span class="cx"> 
</span><span class="cx"> $update_plugins = get_site_transient( 'update_plugins' );
</span><span class="cx"> $update_count = 0;
</span></span></pre></div>
<a id="trunkwpadminnavmenusphpfromrev13363trunkwpadmincustomnavigationphp"></a>
<div class="copfile"><h4>Copied: trunk/wp-admin/nav-menus.php (from rev 13363, trunk/wp-admin/custom-navigation.php) (0 => 13366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/nav-menus.php                                (rev 0)
+++ trunk/wp-admin/nav-menus.php        2010-02-24 08:06:36 UTC (rev 13366)
</span><span class="lines">@@ -0,0 +1,515 @@
</span><ins>+&lt;?php
+/**
+ * WordPress Administration for Navigation Menus
+ * Interface functions
+ *
+ * @author Jeffikus &lt;pearce.jp@gmail.com&gt;
+ * @version 1.1.0
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+require_once('admin.php');
+
+if ( ! current_user_can('switch_themes') )
+        wp_die( __( 'Cheatin&amp;#8217; uh?' ));
+
+wp_admin_css( 'custom-navigation' );
+wp_enqueue_script( 'jquery' );
+wp_enqueue_script( 'jquery-ui-draggable' );
+wp_enqueue_script( 'jquery-ui-droppable' );
+wp_enqueue_script( 'jquery-ui-sortable' );
+wp_enqueue_script( 'jquery-ui-dialog' );
+wp_enqueue_script( 'custom-navigation-dynamic-functions' );
+wp_enqueue_script( 'custom-navigation-default-items' );
+wp_enqueue_script( 'jquery-autocomplete' );
+wp_enqueue_script( 'custom-navigation-php-functions' );
+
+require_once('admin-header.php');
+require_once(ABSPATH . 'wp-admin/includes/nav-menu.php');
+
+function wp_reset_nav_menu() {
+        wp_custom_navigation_setup(true);
+
+        return true;
+}
+
+$messagesdiv = '';
+$menu_id_in_edit = 0;
+$updated = false;
+
+// Check which menu is selected and if menu is in edit already
+if ( isset( $_GET['edit_menu'] ) ) {
+        $menu_selected_id = (int) $_GET['edit_menu'];
+        $updated = true;
+} elseif ( isset( $_POST[ 'menu_id_in_edit' ] ) ) {
+        $menu_selected_id = (int) $_POST[ 'menu_id_in_edit' ];
+} else {
+        $menu_selected_id = 0;
+}
+
+if ( isset( $_POST[ 'delete_menu' ] ) &amp;&amp; $menu_selected_id &gt; 0 ) {
+        wp_delete_nav_menu( $menu_selected_id );
+        $menu_selected_id = 0;
+        $updated = true;
+}
+
+// Default Menu to show
+$custom_menus = wp_get_nav_menus();
+if ( ! $menu_selected_id &amp;&amp; ! empty( $custom_menus ) )
+        $menu_selected_id = $custom_menus[0]-&gt;term_id;
+
+$menu_title = '';
+if ( $menu_selected_id &gt; 0 ) {
+        foreach ( $custom_menus as $menu ) {
+                if ( $menu-&gt;term_id == $menu_selected_id ) {
+                        $menu_title = $menu-&gt;name;
+                        break;
+                }
+        }
+}
+
+if ( isset( $_POST['set_wp_menu'] ) ) {
+        // @todo validate set_wp_menu
+        update_option( 'wp_custom_nav_menu', $_POST['enable_wp_menu'] );
+        $updated = true;
+        $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . __('Menu has been updated!') . '&lt;/p&gt;&lt;/div&gt;';
+}
+
+if ( isset( $_POST['licount'] ) )
+        $postCounter = $_POST['licount'];
+else
+        $postCounter = 0;
+
+// Create a new menu. Menus are stored as terms in the 'menu' taxonomy.
+if ( isset( $_POST['add_menu'] ) &amp;&amp; ! $updated ) {
+        $insert_menu_name = $_POST['add_menu_name'];
+
+        if ( $insert_menu_name != '' ) {
+                $menu = wp_create_nav_menu($insert_menu_name);
+                if ( is_wp_error($menu) ) {
+                        $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;error fade below-h2&quot;&gt;&lt;p&gt;' . esc_html( $menu-&gt;get_error_message() ) . '&lt;/p&gt;&lt;/div&gt;';
+                } else {
+                        $custom_menus[$menu-&gt;term_id] = $menu;
+                        $menu_selected_id = $menu-&gt;term_id;
+                        $menu_id_in_edit = $menu_selected_id;
+                        $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . esc_html( sprintf( __('&quot;%s&quot; menu has been created!'), $menu-&gt;name ) ) . '&lt;/p&gt;&lt;/div&gt;';
+                        $postCounter = 0;
+                }
+        } else {
+                $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;error fade below-h2&quot;&gt;&lt;p&gt;' . __('Please enter a valid menu name.') . '&lt;/p&gt;&lt;/div&gt;';
+        }
+        $updated = true;
+}
+
+if ( isset($_POST['reset_wp_menu']) &amp;&amp; ! $updated ) {
+        $success = wp_reset_nav_menu();
+        if ( $success ) {
+                // DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
+                $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . __('The menu has been reset.') . '&lt;/p&gt;&lt;/div&gt;';
+                // GET reset menu id
+                $custom_menus = array();
+                $menu_selected_id = 0;
+        } else {
+                // DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
+                $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;error fade below-h2&quot;&gt;&lt;p&gt;' . __('The menu could not be reset. Please try again.') . '&lt;/p&gt;&lt;/div&gt;';
+        }
+} elseif ( $postCounter &gt; 0 &amp;&amp; $menu_selected_id &gt; 0 &amp;&amp; ! $updated ) {
+        $menu_items = wp_get_nav_menu_items( $menu_selected_id, array('orderby' =&gt; 'ID', 'output' =&gt; ARRAY_A, 'output_key' =&gt; 'ID') );
+        $parent_menu_ids = array();
+
+        // Loop through all POST variables
+        for ( $k = 1; $k &lt;= $postCounter; $k++ ) {
+                if (isset($_POST['dbid'.$k])) { $db_id = $_POST['dbid'.$k]; } else { $db_id = 0; }
+                if (isset($_POST['postmenu'.$k])) { $object_id = $_POST['postmenu'.$k]; } else { $object_id = 0; }
+                if (isset($_POST['parent'.$k])) { $parent_id = $_POST['parent'.$k]; } else { $parent_id = 0; }
+                if (isset($_POST['title'.$k])) { $custom_title = $_POST['title'.$k]; } else { $custom_title = ''; }
+                if (isset($_POST['linkurl'.$k])) { $custom_linkurl = $_POST['linkurl'.$k]; } else { $custom_linkurl = ''; }
+                if (isset($_POST['description'.$k])) { $custom_description = $_POST['description'.$k]; } else { $custom_description = ''; }
+                // doesn't seem to be used by UI
+                if (isset($_POST['icon'.$k])) { $icon = $_POST['icon'.$k]; } else { $icon = 0; }
+                if (isset($_POST['position'.$k])) { $position = $_POST['position'.$k]; } else { $position = 0; }
+                if (isset($_POST['linktype'.$k])) { $linktype = $_POST['linktype'.$k]; } else { $linktype = 'custom'; }
+                if (isset($_POST['anchortitle'.$k])) { $custom_anchor_title = $_POST['anchortitle'.$k]; } else { $custom_anchor_title = $custom_title; }
+                if (isset($_POST['newwindow'.$k])) { $new_window = $_POST['newwindow'.$k]; } else { $new_window = 0; }
+
+                $post = array( 'post_status' =&gt; 'publish', 'post_type' =&gt; 'nav_menu_item', 'post_author' =&gt; $user_ID,
+                        'ping_status' =&gt; 0, 'post_parent' =&gt; 0, 'menu_order' =&gt; $position,
+                        'guid' =&gt; $custom_linkurl, 'post_excerpt' =&gt; $custom_anchor_title, 'tax_input' =&gt; array( 'nav_menu' =&gt; $menu_title ),
+                        'post_content' =&gt; $custom_description, 'post_title' =&gt; $custom_title );
+                if ( $new_window )
+                        $post['post_content_filtered'] = '_blank';
+                else
+                        $post['post_content_filtered'] = '';
+                if ( $parent_id &gt; 0 &amp;&amp; isset( $parent_menu_ids[ $parent_id ] ) )
+                        $post[ 'post_parent' ] = $parent_menu_ids[ $parent_id ];
+
+                // New menu item
+                if ( $db_id == 0 ) {
+                        $db_id = wp_insert_post( $post );
+                } elseif ( isset( $menu_items[$db_id] ) ) {
+                        $post['ID'] = $db_id;
+                        wp_update_post( $post );
+                        unset( $menu_items[$db_id] );
+                }
+                $parent_menu_ids[ $k ] = $db_id;
+
+                update_post_meta($db_id, 'menu_type', $linktype);
+                update_post_meta($db_id, 'object_id', $object_id);
+        }
+        if ( !empty( $menu_items ) ) {
+                foreach ( array_keys( $menu_items ) as $menu_id ) {
+                        wp_delete_post( $menu_id );
+                }
+        }
+        // DISPLAY SUCCESS MESSAGE IF POST CORRECT
+        $messagesdiv = '&lt;div id=&quot;message&quot; class=&quot;updated fade below-h2&quot;&gt;&lt;p&gt;' . __('The menu has been updated.') . '&lt;/p&gt;&lt;/div&gt;';
+}
+
+?&gt;
+&lt;div class=&quot;wrap&quot;&gt;
+&lt;?php screen_icon(); ?&gt;
+&lt;h2 class=&quot;maintitle&quot;&gt;&lt;?php esc_html_e('Menus') ?&gt;&lt;/h2&gt;
+
+        &lt;div id=&quot;no-js&quot;&gt;&lt;h3&gt;&lt;?php _e('You do not have JavaScript enabled in your browser. Please enable it to access the Menus functionality.'); ?&gt;&lt;/h3&gt;&lt;/div&gt;
+        &lt;div id=&quot;pages-left&quot;&gt;
+                &lt;ul class=&quot;subsubsub&quot;&gt;
+&lt;?php                if ( ! empty( $custom_menus ) ) {
+                                foreach ( $custom_menus as $menu ) {
+                                        $sep = end($custom_menus) == $menu ? '' : ' | ';
+                                        // $menu_term = get_term( $menu, 'nav_menu' );
+                                        if ( ( $menu_id_in_edit == $menu-&gt;term_id ) || ( $menu_selected_id == $menu-&gt;term_id ) ) { ?&gt;
+                                                &lt;li&gt;&lt;?php echo esc_html( $menu-&gt;name ) . $sep; ?&gt;&lt;/li&gt;
+&lt;?php                                } else { ?&gt;
+                        &lt;li&gt;&lt;a href='nav-menus.php?edit_menu=&lt;?php echo esc_attr($menu-&gt;term_id); ?&gt;'&gt;&lt;?php echo esc_html( $menu-&gt;name ); ?&gt;&lt;/a&gt;&lt;?php echo $sep; ?&gt;&lt;/li&gt;
+&lt;?php                                }
+                                }
+                        } else { ?&gt;
+                        &lt;li&gt;&lt;?php _e( 'Default' ); ?&gt;&lt;/li&gt;
+&lt;?php                } ?&gt;
+                &lt;/ul&gt;
+                &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
+                &lt;div class=&quot;inside&quot;&gt;
+                &lt;?php
+                        // CHECK if custom menu has been enabled
+                        $enabled_menu = get_option('wp_custom_nav_menu');
+                        $checked = strtolower($enabled_menu);
+
+                        if ( $checked != 'true' )
+                                echo '&lt;div id=&quot;message-enabled&quot; class=&quot;error fade below-h2&quot;&gt;&lt;p&gt;&lt;strong&gt;' . __('Menu editing has not been Enabled yet. Please enable it in order to use it --------&gt;') . '&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;';
+                ?&gt;
+                &lt;?php echo $messagesdiv; ?&gt;
+                &lt;form onsubmit=&quot;updatepostdata()&quot; action=&quot;nav-menus.php&quot; method=&quot;post&quot;  enctype=&quot;multipart/form-data&quot;&gt;
+
+                &lt;input type=&quot;hidden&quot; name=&quot;licount&quot; id=&quot;licount&quot; value=&quot;0&quot; /&gt;
+                &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;
+
+                &lt;div class=&quot;sidebar-name&quot;&gt;
+
+                        &lt;div class=&quot;sidebar-name-arrow&quot;&gt;
+                                &lt;br/&gt;
+                        &lt;/div&gt;
+                        &lt;h3&gt;&lt;?php echo esc_html($menu_title); ?&gt;&lt;/h3&gt;
+
+                &lt;/div&gt;
+
+                &lt;div id=&quot;nav-container&quot;&gt;
+                        &lt;ul id=&quot;custom-nav&quot;&gt;
+
+                &lt;?php
+                //DISPLAY existing menu
+                if ( $menu_selected_id &gt; 0 ) {
+                        // SET output type
+                        $output_type = &quot;backend&quot;;
+                        // MAIN OUTPUT FUNCTION
+                        wp_print_nav_menu( 'type='.$output_type.'&amp;name='.$menu_title.'&amp;id='.$menu_selected_id );
+                }
+                ?&gt;
+
+                        &lt;/ul&gt;
+                &lt;/div&gt;&lt;!-- /#nav-container --&gt;
+
+                &lt;p class=&quot;submit&quot;&gt;
+
+                &lt;script type=&quot;text/javascript&quot;&gt;
+                        updatepostdata();
+                &lt;/script&gt;
+                &lt;!-- &lt;input id=&quot;delete_menu&quot; name=&quot;delete_menu&quot; type=&quot;submit&quot; value=&quot;&lt;?php esc_attr_e('Delete This Menu'); ?&gt;&quot; /&gt; --&gt;
+                &lt;input id=&quot;save_bottom&quot; name=&quot;save_bottom&quot; type=&quot;submit&quot; value=&quot;&lt;?php esc_attr_e('Save All Changes'); ?&gt;&quot; /&gt;&lt;/p&gt;
+                &lt;/div&gt;&lt;!-- /.inside --&gt;
+        &lt;/div&gt;
+
+        &lt;div id=&quot;menu-right&quot;&gt;
+                &lt;div class=&quot;widgets-holder-wrap&quot;&gt;
+                        &lt;div class=&quot;sidebar-name&quot;&gt;
+                                &lt;div class=&quot;sidebar-name-arrow&quot;&gt;&lt;/div&gt;
+                                &lt;h3&gt;&lt;?php esc_html_e('Setup Menus'); ?&gt;&lt;/h3&gt;
+                        &lt;/div&gt;
+                        &lt;div class=&quot;widget-holder&quot;&gt;
+
+                                &lt;?php
+                                // Setup custom menu
+                                $enabled_menu = get_option('wp_custom_nav_menu');
+                                $checked = strtolower($enabled_menu);
+                                ?&gt;
+
+                                &lt;span &gt;
+                                        &lt;label&gt;&lt;?php _e('Enable'); ?&gt;&lt;/label&gt;&lt;input type=&quot;radio&quot; name=&quot;enable_wp_menu&quot; value=&quot;true&quot; &lt;?php if ($checked=='true') { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
+                                        &lt;label&gt;&lt;?php _e('Disable'); ?&gt;&lt;/label&gt;&lt;input type=&quot;radio&quot; name=&quot;enable_wp_menu&quot; value=&quot;false&quot; &lt;?php if ($checked=='true') { } else { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
+                                &lt;/span&gt;&lt;!-- /.checkboxes --&gt;
+
+                                &lt;input id=&quot;set_wp_menu&quot; type=&quot;submit&quot; value=&quot;&lt;?php esc_attr_e('Set Menu'); ?&gt;&quot; name=&quot;set_wp_menu&quot; class=&quot;button&quot; /&gt;&lt;br /&gt;
+
+                                &lt;span&gt;
+                                        &lt;label&gt;&lt;?php _e('Reset Menu to Default'); ?&gt;&lt;/label&gt;
+                                        &lt;input id=&quot;reset_wp_menu&quot; type=&quot;submit&quot; value=&quot;Reset&quot; name=&quot;reset_wp_menu&quot; class=&quot;button&quot; onclick=&quot;return confirm('&lt;?php _e('Are you sure you want to reset the menu to its default settings?'); ?&gt;');&quot; /&gt;
+                                &lt;/span&gt;
+                                &lt;br /&gt;&lt;br /&gt;
+                                &lt;span&gt;
+                                &lt;input id=&quot;add_menu_name&quot; name=&quot;add_menu_name&quot; type=&quot;text&quot; value=&quot;&quot;  /&gt;
+                                &lt;input id=&quot;add_menu&quot; type=&quot;submit&quot; value=&quot;&lt;?php esc_attr_e('Add Menu'); ?&gt;&quot; name=&quot;add_menu&quot; class=&quot;button&quot; /&gt;
+                                &lt;/span&gt;
+                        &lt;/div&gt;
+                &lt;/div&gt;&lt;!-- /.widgets-holder-wrap --&gt;
+                &lt;?php $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options'); ?&gt;
+                &lt;div class=&quot;widgets-holder-wrap&quot; style=&quot;display:none;&quot;&gt;
+                        &lt;div class=&quot;sidebar-name&quot;&gt;
+                                &lt;div class=&quot;sidebar-name-arrow&quot;&gt;&lt;/div&gt;
+                                &lt;h3&gt;&lt;?php esc_html_e('Top Level Menu Descriptions'); ?&gt;&lt;/h3&gt;
+                        &lt;/div&gt;
+                        &lt;div class=&quot;widget-holder&quot;&gt;
+                                &lt;span&gt;&lt;?php _e('Display Descriptions in Top Level Menu?'); ?&gt;&lt;/span&gt;
+
+                                &lt;?php
+                                // UPDATE and DISPLAY Menu Description Option
+                                if ( isset($_POST['menu-descriptions']) ) {
+                                        if ( !isset($_POST['switch_menu']) ) {
+                                                $menu_options_to_edit = $_POST['menu_id_in_edit'];
+                                                update_option('wp_settings_custom_nav_'.$menu_options_to_edit.'_descriptions',$_POST['menu-descriptions']);
+                                        }
+                                }
+
+                                if ( $menu_id_in_edit &gt; 0 )
+                                        $checkedraw = get_option('wp_settings_custom_nav_'.$menu_id_in_edit.'_descriptions');
+                                else
+                                        $checkedraw = get_option('wp_settings_custom_nav_'.$menu_selected_id.'_descriptions');
+
+                                $checked = strtolower($checkedraw);
+
+                                if ( $advanced_option_descriptions == 'no' )
+                                        $checked = 'no';
+                                ?&gt;
+
+                                &lt;span class=&quot;checkboxes&quot;&gt;
+                                        &lt;label&gt;&lt;?php _e('Yes'); ?&gt;&lt;/label&gt;&lt;input type=&quot;radio&quot; name=&quot;menu-descriptions&quot; value=&quot;yes&quot; &lt;?php if ($checked=='yes') { echo 'checked=&quot;checked&quot;'; } ?&gt; /&gt;
+                                        &lt;label&gt;&lt;?php _e('No'); ?&gt;&lt;/label&gt;&lt;input type=&quot;radio&quot; name=&quot;menu-descriptions&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;/form&gt;
+                                &lt;div class=&quot;fix&quot;&gt;&lt;/div&gt;
+                        &lt;/div&gt;
+                &lt;/div&gt;&lt;!-- /.widgets-holder-wrap --&gt;
+
+                &lt;div class=&quot;widgets-holder-wrap&quot;&gt;
+                        &lt;div class=&quot;sidebar-name&quot;&gt;
+                                &lt;div class=&quot;sidebar-name-arrow&quot;&gt;&lt;/div&gt;
+                                &lt;h3&gt;&lt;?php esc_html_e('Add an Existing Page'); ?&gt;&lt;/h3&gt;
+                        &lt;/div&gt;
+                        &lt;div class=&quot;widget-holder&quot;&gt;
+
+                                &lt;?php
+                                $pages_args = array(
+                                'child_of' =&gt; 0,
+                                'sort_order' =&gt; 'ASC',
+                                'sort_column' =&gt; 'post_title',
+                                'hierarchical' =&gt; 1,
+                                'exclude' =&gt; '',
+                                'include' =&gt; '',
+                                'meta_key' =&gt; '',
+                                'meta_value' =&gt; '',
+                                'authors' =&gt; '',
+                                'parent' =&gt; -1,
+                                'exclude_tree' =&gt; '',
+                                'number' =&gt; '',
+                                'offset' =&gt; 0 );
+
+                                //GET all pages
+                                $pages_array = get_pages($pages_args);
+                                $page_name = '';
+                                //CHECK if pages exist
+                                if ( $pages_array ) {
+                                        foreach ( $pages_array as $post ) {
+                                                //Add page name to
+                                                $page_name .= htmlentities($post-&gt;post_title).'|';
+                                        }
+                                } else {
+                                        $page_name = __('No pages available');
+                                }
+                                ?&gt;
+
+                                &lt;script&gt;
+                                        jQuery(document).ready(function(){
+
+                                                //GET PHP pages
+                                                var dataposts = &quot;&lt;?php echo esc_js($page_name); ?&gt;&quot;.split(&quot;|&quot;);
+
+                                                //Set autocomplete
+                                                jQuery(&quot;#page-search&quot;).autocomplete(dataposts);
+
+                                                //Handle autocomplete result
+                                                jQuery(&quot;#page-search&quot;).result(function(event, data, formatted) {
+                                                        jQuery('#existing-pages').css('display','block');
+                                                        jQuery(&quot;#existing-pages dt:contains('&quot; + data + &quot;')&quot;).css(&quot;display&quot;, &quot;block&quot;);
+
+                                                        jQuery('#show-pages').hide();
+                                                        jQuery('#hide-pages').show();
+
+                                                });
+                                                jQuery('#existing-pages').css('display','none');
+                                        });
+                                &lt;/script&gt;
+
+                                &lt;input type=&quot;text&quot; onfocus=&quot;jQuery('#page-search').attr('value','');&quot; id=&quot;page-search&quot; value=&quot;&lt;?php esc_attr_e('Search Pages'); ?&gt;&quot; /&gt;
+
+                                &lt;a id=&quot;show-pages&quot; style=&quot;cursor:pointer;&quot; onclick=&quot;jQuery('#existing-pages').css('display','block');jQuery('#page-search').attr('value','');jQuery('#existing-pages dt').css('display','block');jQuery('#show-pages').hide();jQuery('#hide-pages').show();&quot;&gt;View All&lt;/a&gt;
+                                &lt;a id=&quot;hide-pages&quot; style=&quot;cursor:pointer;&quot; onclick=&quot;jQuery('#existing-pages').css('display','none');jQuery('#page-search').attr('value','Search Pages');jQuery('#existing-pages dt').css('display','none');jQuery('#show-pages').show();jQuery('#hide-pages').hide();&quot;&gt;Hide All&lt;/a&gt;
+
+                                &lt;script type=&quot;text/javascript&quot;&gt;
+                                        jQuery('#hide-pages').hide();
+                                &lt;/script&gt;
+
+                                &lt;ul id=&quot;existing-pages&quot; class=&quot;list&quot;&gt;
+                                        &lt;?php
+                                                $intCounter = 0;
+                                                //Get default Pages
+                                                $intCounter = wp_nav_menu_get_pages($intCounter,'default');
+                                        ?&gt;
+                                &lt;/ul&gt;
+
+                                &lt;div class=&quot;fix&quot;&gt;&lt;/div&gt;
+
+                        &lt;/div&gt;
+                &lt;/div&gt;&lt;!-- /.widgets-holder-wrap --&gt;
+
+                &lt;div class=&quot;widgets-holder-wrap&quot;&gt;
+                        &lt;div class=&quot;sidebar-name&quot;&gt;
+                                &lt;div class=&quot;sidebar-name-arrow&quot;&gt;&lt;/div&gt;
+                                &lt;h3&gt;&lt;?php esc_html_e('Add an Existing Category'); ?&gt;&lt;/h3&gt;
+                        &lt;/div&gt;
+                        &lt;div class=&quot;widget-holder&quot;&gt;
+
+                                &lt;?php
+                                // Custom GET categories query
+                                // @todo Use API
+                                $categories = $wpdb-&gt;get_results(&quot;SELECT term_id FROM $wpdb-&gt;term_taxonomy WHERE taxonomy = 'category' ORDER BY term_id ASC&quot;);
+                                $cat_name = '';
+                                //CHECK for results
+                                if ( $categories ) {
+                                        foreach ( $categories as $category ) {
+                                                $cat_id = $category-&gt;term_id;
+
+                                                $cat_args = array(
+                                                        'orderby' =&gt; 'name',
+                                                        'include' =&gt; $cat_id,
+                                                        'hierarchical' =&gt; 1,
+                                                        'order' =&gt; 'ASC'
+                                                );
+
+                                                $category_names=get_categories($cat_args);
+
+                                                if ( isset($category_names[0]-&gt;name) ) {
+                                                        // Add category name to data string
+                                                        $cat_name .= htmlentities($category_names[0]-&gt;name).'|';
+                                                }
+                                        }
+                                } else {
+                                        $cat_name = __('No categories available');
+                                }
+                                ?&gt;
+
+                                &lt;script&gt;
+                                        jQuery(document).ready(function(){
+
+                                                //GET PHP categories
+                                                var datacats = &quot;&lt;?php echo esc_js($cat_name); ?&gt;&quot;.split(&quot;|&quot;);
+
+                                                //Set autocomplete
+                                                jQuery(&quot;#cat-search&quot;).autocomplete(datacats);
+
+                                                //Handle autocomplete result
+                                                jQuery(&quot;#cat-search&quot;).result(function(event, data, formatted) {
+                                                        jQuery('#existing-categories').css('display','block');
+                                                        jQuery(&quot;#existing-categories dt:contains('&quot; + data + &quot;')&quot;).css(&quot;display&quot;, &quot;block&quot;);
+
+                                                        jQuery('#show-cats').hide();
+                                                        jQuery('#hide-cats').show();
+
+                                                });
+                                                jQuery('#existing-categories').css('display','none');
+
+                                        });
+                                &lt;/script&gt;
+
+                                &lt;input type=&quot;text&quot; onfocus=&quot;jQuery('#cat-search').attr('value','');&quot; id=&quot;cat-search&quot; value=&quot;&lt;?php esc_attr_e('Search Categories'); ?&gt;&quot; /&gt;
+
+                                &lt;a id=&quot;show-cats&quot; style=&quot;cursor:pointer;&quot; onclick=&quot;jQuery('#existing-categories').css('display','block');jQuery('#cat-search').attr('value','');jQuery('#existing-categories dt').css('display','block');jQuery('#show-cats').hide();jQuery('#hide-cats').show();&quot;&gt;View All&lt;/a&gt;
+                                &lt;a id=&quot;hide-cats&quot; style=&quot;cursor:pointer;&quot; onclick=&quot;jQuery('#existing-categories').css('display','none');jQuery('#cat-search').attr('value','Search Categories');jQuery('#existing-categories dt').css('display','none');jQuery('#show-cats').show();jQuery('#hide-cats').hide();&quot;&gt;Hide All&lt;/a&gt;
+
+                                &lt;script type=&quot;text/javascript&quot;&gt;
+                                        jQuery('#hide-cats').hide();
+                                &lt;/script&gt;
+
+                                &lt;ul id=&quot;existing-categories&quot; class=&quot;list&quot;&gt;
+                                        &lt;?php
+                                                // Get default Categories
+                                                $intCounter = wp_nav_menu_get_categories($intCounter, 'default');
+                                        ?&gt;
+                                &lt;/ul&gt;
+
+                                &lt;div class=&quot;fix&quot;&gt;&lt;/div&gt;
+
+                        &lt;/div&gt;
+                &lt;/div&gt;&lt;!-- /.widgets-holder-wrap --&gt;
+
+                &lt;div class=&quot;widgets-holder-wrap&quot;&gt;
+                        &lt;div class=&quot;sidebar-name&quot;&gt;
+                                &lt;div class=&quot;sidebar-name-arrow&quot;&gt;&lt;/div&gt;
+                                &lt;h3&gt;&lt;?php esc_html_e('Add a Custom Url'); ?&gt;&lt;/h3&gt;
+                        &lt;/div&gt;
+                        &lt;div class=&quot;widget-holder&quot;&gt;
+                                &lt;input id=&quot;custom_menu_item_url&quot; type=&quot;text&quot; value=&quot;http://&quot;  /&gt;
+                                &lt;label&gt;&lt;?php _e('URL'); ?&gt;&lt;/label&gt;&lt;br /&gt;
+                                &lt;?php $templatedir = get_bloginfo('url'); ?&gt;
+                                &lt;input type=&quot;hidden&quot; id=&quot;templatedir&quot; value=&quot;&lt;?php echo esc_attr($templatedir); ?&gt;&quot; /&gt;
+                                &lt;input id=&quot;custom_menu_item_name&quot; type=&quot;text&quot; value=&quot;Menu Item&quot; onfocus=&quot;jQuery('#custom_menu_item_name').attr('value','');&quot;  /&gt;
+                                &lt;label&gt;&lt;?php _e('Menu Text'); ?&gt;&lt;/label&gt;&lt;br /&gt;
+                                &lt;input id=&quot;custom_menu_item_description&quot; type=&quot;text&quot; value=&quot;&lt;?php esc_attr_e('A description'); ?&gt;&quot; &lt;?php if ($advanced_option_descriptions == 'no') { ?&gt;style=&quot;display:none;&quot;&lt;?php } ?&gt; onfocus=&quot;jQuery('#custom_menu_item_description').attr('value','');&quot; /&gt;
+                                &lt;label &lt;?php if ($advanced_option_descriptions == 'no') { ?&gt;style=&quot;display:none;&quot;&lt;?php } ?&gt; &gt;&lt;?php _e('Description'); ?&gt;&lt;/label&gt;
+                                &lt;a class=&quot;addtomenu&quot; onclick=&quot;appendToList('&lt;?php echo $templatedir; ?&gt;','Custom','','','','0','');jQuery('#custom_menu_item_name').attr('value','Menu Item');jQuery('#custom_menu_item_description').attr('value','A description');&quot;&gt;&lt;?php _e('Add to menu'); ?&gt;&lt;/a&gt;
+                                &lt;div class=&quot;fix&quot;&gt;&lt;/div&gt;
+                        &lt;/div&gt;
+                &lt;/div&gt;&lt;!-- /.widgets-holder-wrap --&gt;
+
+   &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;script type=&quot;text/javascript&quot;&gt;
+        document.getElementById('pages-left').style.display='block';
+        document.getElementById('menu-right').style.display='block';
+        document.getElementById('no-js').style.display='none';
+&lt;/script&gt;
+
+&lt;div id=&quot;dialog-confirm&quot; title=&quot;&lt;?php esc_attr_e('Edit Menu Item'); ?&gt;&quot;&gt;
+        &lt;/label&gt;&lt;input id=&quot;edittitle&quot; type=&quot;text&quot; name=&quot;edittitle&quot; value=&quot;&quot; /&gt;&lt;label class=&quot;editlabel&quot; for=&quot;edittitle&quot;&gt;&lt;?php _e('Menu Title'); ?&gt;&lt;/label&gt;&lt;br /&gt;
+        &lt;input id=&quot;editlink&quot; type=&quot;text&quot; name=&quot;editlink&quot; value=&quot;&quot; /&gt;&lt;label class=&quot;editlabel&quot; for=&quot;editlink&quot;&gt;&lt;?php _e('URL'); ?&gt;&lt;/label&gt;&lt;br /&gt;
+        &lt;input id=&quot;editanchortitle&quot; type=&quot;text&quot; name=&quot;editanchortitle&quot; value=&quot;&quot; /&gt;&lt;label class=&quot;editlabel&quot; for=&quot;editanchortitle&quot;&gt;&lt;?php _e('Link Title'); ?&gt;&lt;/label&gt;&lt;br /&gt;
+        &lt;select id=&quot;editnewwindow&quot; name=&quot;editnewwindow&quot;&gt;
+                &lt;option value=&quot;1&quot;&gt;&lt;?php _e('Yes'); ?&gt;&lt;/option&gt;
+                &lt;option value=&quot;0&quot;&gt;&lt;?php _e('No'); ?&gt;&lt;/option&gt;
+        &lt;/select&gt;&lt;label class=&quot;editlabel&quot; for=&quot;editnewwindow&quot;&gt;&lt;?php _e('Open Link in a new window'); ?&gt;&lt;/label&gt;
+        &lt;input id=&quot;editdescription&quot; type=&quot;text&quot; name=&quot;editdescription&quot; value=&quot;&quot; &lt;?php if ($advanced_option_descriptions == 'no') { ?&gt;style=&quot;display:none;&quot;&lt;?php } ?&gt; /&gt;&lt;label class=&quot;editlabel&quot; for=&quot;editdescription&quot; &lt;?php if ($advanced_option_descriptions == 'no') { ?&gt;style=&quot;display:none;&quot;&lt;?php } ?&gt; &gt;&lt;?php _e('Description'); ?&gt;&lt;/label&gt;&lt;br /&gt;
+&lt;/div&gt;
+
+&lt;?php
+
+include(&quot;admin-footer.php&quot;);
</ins></span></pre></div>
<a id="trunkwpincludescustomnavigationphp"></a>
<div class="delfile"><h4>Deleted: trunk/wp-includes/custom-navigation.php (13365 => 13366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/custom-navigation.php        2010-02-24 07:58:14 UTC (rev 13365)
+++ trunk/wp-includes/custom-navigation.php        2010-02-24 08:06:36 UTC (rev 13366)
</span><span class="lines">@@ -1,542 +0,0 @@
</span><del>-&lt;?php
-/**
- * WordPress Administration Custom Navigation
- * General Functions
- *
- * @author Jeffikus &lt;pearce.jp@gmail.com&gt;
- * @version 1.1.0
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-function wp_custom_navigation_setup($override = false) {
-        // Custom Navigation Menu Setup
-
-        // Override for menu descriptions
-        update_option('wp_settings_custom_nav_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') );
-}
-
-function wp_delete_nav_menu( $menu_id ) {
-        $menu_id = (int) $menu_id;
-        if ( !$menu_id  )
-                return false;
-
-        $menu_objects = get_objects_in_term( $menu_id, 'nav_menu' );
-        if ( !empty( $menu_objects ) ) {
-                foreach ( $menu_objects as $item ) {
-                        wp_delete_post( $item );
-                }
-        }
-        wp_delete_term( $menu_id, 'nav_menu' );
-}
-
-function wp_create_nav_menu( $menu_name ) {
-        $menu_exists = get_term_by( 'name', $menu_name, 'nav_menu' );
-
-        if ( $menu_exists )
-                return WP_Error('menu_exists', sprintf( __('A menu named &quot;%s&quot; already exists; please try another name.'), $menu_exists-&gt;name ));
-
-        $menu = wp_insert_term( $menu_name, 'nav_menu' );
-        if ( is_wp_error($menu) )
-                return $menu;
-
-        return get_term( $menu['term_id'], 'nav_menu');
-}
-
-function wp_get_nav_menu( $menu ) {
-        return get_term( (int) $menu, 'nav_menu');
-}
-
-function wp_get_nav_menus() {
-        return get_terms( 'nav_menu', array( 'hide_empty' =&gt; false ) );
-}
-
-function wp_get_nav_menu_items( $menu, $args = array() ) {
-        $items = get_objects_in_term( (int) $menu, 'nav_menu' );
-
-        if ( ! empty( $items ) ) {
-                $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' );
-                $args = wp_parse_args($args, $defaults);
-                if ( count( $items ) &gt; 1 )        
-                        $args['include'] = implode( ',', $items );
-                else
-                        $args['include'] = $items[0];
-
-                $items = get_posts( $args );
-
-                if ( ARRAY_A == $args['output'] ) {
-                        $output = array();
-                        foreach ( $items as $item ) {
-                                $output[$item-&gt;$args['output_key']] = $item;
-                        }
-                        unset($items);
-                        ksort($output);
-                        return $output;
-                }
-        }
-        return $items;
-}
-
-function setup_menu_item($menu_item, $type = 'item', $position = 0) {
-        global $parent_menu_order;
-
-        if ( 'item' == $type ) {
-                $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);
-                if ( isset( $parent_menu_order[ $menu_item-&gt;post_parent ] ) )
-                        $menu_item-&gt;parent_item = $parent_menu_order[ $menu_item-&gt;post_parent ];
-                else
-                        $menu_item-&gt;parent_item = 0;
-        } elseif ( 'category' == $type ) {
-                $menu_item-&gt;type = $type;
-                $menu_item-&gt;object_id = $menu_item-&gt;term_id;
-                $menu_item-&gt;ID = $menu_item-&gt;term_id;
-                $menu_item-&gt;parent_item = $menu_item-&gt;parent;
-                $menu_item-&gt;menu_order = $position;
-        } elseif ( 'page' == $type ) {
-                $menu_item-&gt;type = $type;
-                $menu_item-&gt;object_id = $menu_item-&gt;ID;
-                $menu_item-&gt;parent_item = $menu_item-&gt;post_parent;
-                $menu_item-&gt;menu_order = $position;
-        }
-
-        switch ( $menu_item-&gt;type ) {
-                // Page Menu Item
-                case 'page':
-                        if ( $menu_item-&gt;guid == '' )
-                                $menu_item-&gt;link = get_permalink( $menu_item-&gt;object_id );
-                        else
-                                $menu_item-&gt;link = $menu_item-&gt;guid;
-
-                        if ( $menu_item-&gt;post_title == '' )
-                                $menu_item-&gt;title = htmlentities( get_the_title( $menu_item-&gt;object_id ) );
-                        else
-                                $menu_item-&gt;title = htmlentities( $menu_item-&gt;post_title );
-
-                        if ( $menu_item-&gt;post_content == '' )
-                                $menu_item-&gt;description = htmlentities( get_post_meta( $menu_item-&gt;ID, 'page-description', true ) );
-                        else
-                                $menu_item-&gt;description = htmlentities( $menu_item-&gt;post_content );
-                        $menu_item-&gt;target = '';
-                        $menu_item-&gt;append = 'Page';
-                break;
-                // Category Menu Item
-                case 'category':
-                        if ( empty($menu_item-&gt;guid) )
-                                $menu_item-&gt;link = get_category_link( $menu_item-&gt;object_id );
-                        else
-                                $menu_item-&gt;link = $menu_item-&gt;guid;
-
-                        if ( empty($menu_item-&gt;post_title) ) {
-                                $title_raw = get_category( $menu_item-&gt;object_id );
-                                $menu_item-&gt;title =  htmlentities($title_raw-&gt;cat_name);
-                        } else {
-                                $menu_item-&gt;title = htmlentities( $menu_item-&gt;post_title );
-                        }
-
-                        if ( empty($menu_item-&gt;post_content) )
-                                $menu_item-&gt;description = htmlentities( strip_tags( category_description( $menu_item-&gt;object_id ) ) );
-                        else
-                                $menu_item-&gt;description = htmlentities( $menu_item-&gt;post_content );
-                        $menu_item-&gt;target = '';
-                        $menu_item-&gt;append = 'Category';
-                break;
-                default:
-                        // Custom Menu Item
-                        $menu_item-&gt;link = $menu_item-&gt;guid;
-                        $menu_item-&gt;title =  htmlentities( $menu_item-&gt;post_title );
-                        $menu_item-&gt;description = htmlentities( $menu_item-&gt;post_content );
-                        $menu_item-&gt;target = 'target=&quot;_blank&quot;';
-                        $menu_item-&gt;append = 'Custom';
-                break;
-        }
-
-        $menu_item-&gt;li_class = '';
-        global $wp_query;
-        if ( $menu_item-&gt;ID == $wp_query-&gt;get_queried_object_id() )
-                $menu_item-&gt;li_class = 'class=&quot;current_page_item&quot;';
-
-        $menu_item-&gt;anchor_title = '';
-/* @todo: update to use tax/post data
-
-                        //SET anchor title
-                        if (isset($wp_custom_nav_menu_items-&gt;custom_anchor_title)) {
-                                $anchor_title = htmlentities($wp_custom_nav_menu_items-&gt;custom_anchor_title);
-                        }
-                        else {
-                                $anchor_title = $title;
-                        }
-
-                        if ($queried_id == $wp_custom_nav_menu_items-&gt;post_id) {
-                                $li_class = 'class=&quot;current_page_item&quot;';
-                        }
-
-                        if (isset($wp_custom_nav_menu_items-&gt;new_window)) {
-                                if ($wp_custom_nav_menu_items-&gt;new_window &gt; 0) {
-                                        $target = 'target=&quot;_blank&quot;';
-                                }
-                                else {
-                                        $target = '';
-                                }
-                        }
-*/
-
-        return $menu_item;
-}
-
-function output_menu_item($menu_item, $context, $args = array() ) {
-        switch( $context ) {
-                case 'backend':
-                case 'menu':
-?&gt;
-                                                &lt;dl&gt;
-                                                        &lt;dt&gt;
-                                                                &lt;span class=&quot;title&quot;&gt;&lt;?php echo esc_html($menu_item-&gt;title); ?&gt;&lt;/span&gt;
-                                                                &lt;span class=&quot;controls&quot;&gt;
-                                                                &lt;span class=&quot;type&quot;&gt;&lt;?php echo esc_html($menu_item-&gt;type); ?&gt;&lt;/span&gt;
-                                                                &lt;a id=&quot;edit&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; onclick=&quot;edititem(&lt;?php echo $menu_item-&gt;menu_order; ?&gt;)&quot; value=&quot;&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot;&gt;&lt;img class=&quot;edit&quot; alt=&quot;&lt;?php esc_attr_e('Edit Menu Item'); ?&gt;&quot; title=&quot;&lt;?php esc_attr_e('Edit Menu Item'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-edit.png'); ?&gt;&quot; /&gt;&lt;/a&gt;
-                                                                &lt;a id=&quot;remove&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; onclick=&quot;removeitem(&lt;?php echo $menu_item-&gt;menu_order; ?&gt;)&quot; value=&quot;&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot;&gt;&lt;img class=&quot;remove&quot; alt=&quot;&lt;?php esc_attr_e('Remove from Custom Menu'); ?&gt;&quot; title=&quot;&lt;?php esc_attr_e('Remove from Custom Menu'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-close.png'); ?&gt;&quot; /&gt;&lt;/a&gt;
-                                                                &lt;a id=&quot;view&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; target=&quot;_blank&quot; href=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot;&gt;&lt;img alt=&quot;&lt;?php esc_attr_e('View Page'); ?&gt;&quot; title=&quot;&lt;?php esc_attr_e('View Page'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-viewpage.png'); ?&gt;&quot; /&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 $menu_item-&gt;title; ?&gt;&lt;/a&gt;
-                                                &lt;?php } ?&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;dbid&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;dbid&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;ID; ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;postmenu&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;postmenu&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;ID; ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;parent&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;parent&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;parent_item; ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;title&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;title&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;title; ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;linkurl&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;linkurl&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;description&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;description&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;description; ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;icon&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;icon&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;0&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;position&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;position&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;linktype&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;linktype&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;type; ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;anchortitle&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;anchortitle&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo esc_html( $menu_item-&gt;post_excerpt ); ?&gt;&quot; /&gt;
-                                                &lt;input type=&quot;hidden&quot; name=&quot;newwindow&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;newwindow&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo ( '' == $menu_item-&gt;post_content_filtered ? '0' : '1' ); ?&gt;&quot; /&gt;
-&lt;?php
-                break;
-
-                case 'frontend':
-                        // Override for menu descriptions
-                        $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options');
-                        if ( $advanced_option_descriptions == 'no' )
-                                $args['desc'] = 2;
-?&gt;
-                        &lt;a title=&quot;&lt;?php echo $menu_item-&gt;anchor_title; ?&gt;&quot; href=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot; &lt;?php echo $menu_item-&gt;target; ?&gt;&gt;&lt;?php echo $args['before_title'] . $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;
-
-                case 'default':
-                        $templatedir = get_bloginfo('url');
-?&gt;
-                                        &lt;dl&gt;
-                                        &lt;dt&gt;
-                                        &lt;span class=&quot;title&quot;&gt;&lt;?php echo $menu_item-&gt;title; ?&gt;&lt;/span&gt; &lt;a onclick=&quot;appendToList('&lt;?php echo $templatedir; ?&gt;','&lt;?php echo $menu_item-&gt;append; ?&gt;','&lt;?php echo $menu_item-&gt;title; ?&gt;','&lt;?php echo $menu_item-&gt;link; ?&gt;','&lt;?php echo $menu_item-&gt;ID; ?&gt;','&lt;?php echo $menu_item-&gt;parent_item ?&gt;','&lt;?php echo $menu_item-&gt;description; ?&gt;')&quot; name=&quot;&lt;?php echo $menu_item-&gt;title; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot;&gt;&lt;img alt=&quot;&lt;?php esc_attr_e('Add to Custom Menu'); ?&gt;&quot; title=&quot;&lt;?php esc_attr_e('Add to Custom Menu'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-add.png'); ?&gt;&quot; /&gt;&lt;/a&gt; &lt;/dt&gt;
-                                        &lt;/dl&gt;
-&lt;?php
-                break;
-        }
-}
-
-/*-----------------------------------------------------------------------------------*/
-/* 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
-/*-----------------------------------------------------------------------------------*/
-
-/*-----------------------------------------------------------------------------------*/
-/* Main Output Function
-/* args list
-/* type - frontend or backend
-/* name - name of your menu
-/* id - id of menu in db
-/* desc - 1 = show descriptions, 2 = dont show descriptions
-/* before_title - html before title is outputted in &lt;a&gt; tag
-/* after_title - html after title is outputted in &lt;a&gt; tag
-/*-----------------------------------------------------------------------------------*/
-function wp_custom_navigation_output( $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;
-                }
-
-            // Display Loop
-                foreach ( $menu_items as $key =&gt; $menu_item ) {
-                        $menu_item = setup_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
-                        output_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                        }
-        }                
-}
-
-// Outputs All Pages and Sub Items
-function wp_custom_nav_get_pages($counter, $type) {
-
-        $pages_args = array(
-                    'child_of' =&gt; 0,
-                        'sort_order' =&gt; 'ASC',
-                        'sort_column' =&gt; 'post_title',
-                        'hierarchical' =&gt; 1,
-                        'exclude' =&gt; '',
-                        'include' =&gt; '',
-                        'meta_key' =&gt; '',
-                        'meta_value' =&gt; '',
-                        'authors' =&gt; '',
-                        'parent' =&gt; -1,
-                        'exclude_tree' =&gt; '',
-                        'number' =&gt; '',
-                        'offset' =&gt; 0 );
-
-        //GET all pages
-        $pages_array = get_pages($pages_args);
-
-        $intCounter = $counter;
-        $parentli = $intCounter;
-
-        if ( !$pages_array ) {
-                echo 'Not Found';
-                return $intCounter;
-        }
-
-        // Display Loop
-        foreach ( $pages_array as $post ) {
-                if ( $post-&gt;post_parent == 0 ) {
-                        $post = setup_menu_item($post, 'page', $intCounter);
-                        if ( $type == 'menu' ) {
-                                ?&gt;
-
-                                &lt;li id=&quot;menu-&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo $intCounter; ?&gt;&quot;&gt;
-                                        &lt;?php
-                                                output_menu_item($post, 'menu', $intCounter);
-                                                $parentli = $post-&gt;ID;
-                                                $intCounter++;
-                                                $intCounter = wp_custom_navigation_default_sub_items($post-&gt;ID, $intCounter, $parentli, 'pages', 'menu');
-                                        ?&gt;
-                                &lt;/li&gt;
-
-                                &lt;?php
-                        } elseif ( $type == 'default' ) {
-                                // Sidebar Menu
-                                ?&gt;
-                                 &lt;li&gt;
-                                        &lt;?php
-                                                output_menu_item($post, 'default');
-                                                $parentli = $post-&gt;ID;
-                                                $intCounter++;
-                                                $intCounter = wp_custom_navigation_default_sub_items($post-&gt;ID, $intCounter, $parentli, 'pages', 'default');
-                                         ?&gt;
-                                &lt;/li&gt;
-
-                                &lt;?php
-                        }
-                }
-        }
-
-        return $intCounter;
-}
-
-// Outputs All Categories and Sub Items
-function wp_custom_nav_get_categories($counter, $type) {
-
-        $category_args = array(
-                        'type'                     =&gt; 'post',
-                        'child_of'                 =&gt; 0,
-                        'orderby'                  =&gt; 'name',
-                        'order'                    =&gt; 'ASC',
-                        'hide_empty'               =&gt; false,
-                        'include_last_update_time' =&gt; false,
-                        'hierarchical'             =&gt; 1,
-                        'exclude'                  =&gt; '',
-                        'include'                  =&gt; '',
-                        'number'                   =&gt; '',
-                        'pad_counts'               =&gt; false );
-
-        $intCounter = $counter;
-
-        // Get all categories
-        $categories_array = get_categories($category_args);
-
-        if ( !$categories_array ) {
-                _e('Not Found');
-                return $intCounter;
-        }
-
-        // Display Loop
-        foreach ( $categories_array as $cat_item ) {
-                if ( $cat_item-&gt;parent == 0 ) {
-                        $cat_item = setup_menu_item($cat_item, 'category', $intCounter);
-                        // Custom Menu
-                        if ( $type == 'menu' ) {
-                                ?&gt;
-
-                                &lt;li id=&quot;menu-&lt;?php echo $intCounter; ?&gt;&quot; value=&quot;&lt;?php echo $intCounter; ?&gt;&quot;&gt;
-                                        &lt;?php
-                                                output_menu_item($cat_item, 'menu');
-                                                $parentli = $cat_item-&gt;cat_ID;
-                                                $intCounter++;
-                                                $intCounter = wp_custom_navigation_default_sub_items($cat_item-&gt;cat_ID, $intCounter, $parentli, 'categories', 'menu');
-                                        ?&gt;
-
-                                &lt;/li&gt;
-
-                                &lt;?php
-                        } elseif ( $type == 'default' ) {
-                                // Sidebar Menu
-                                ?&gt;
-                                &lt;li&gt;
-                                        &lt;?php
-                                                output_menu_item($cat_item, 'default');
-                                                $parentli = $cat_item-&gt;cat_ID;
-                                                $intCounter++;
-                                                $intCounter = wp_custom_navigation_default_sub_items($cat_item-&gt;cat_ID, $intCounter, $parentli, 'categories', 'default');
-                                        ?&gt;
-
-                                &lt;/li&gt;
-
-                                &lt;?php
-                        }
-                }
-        }
-
-        return $intCounter;
-}
-
-//RECURSIVE Sub Menu Items of default categories and pages
-function wp_custom_navigation_default_sub_items($childof, $intCounter, $parentli, $type, $output_type) {
-
-        $counter = $intCounter;
-
-        // Custom Menu
-        if ( $output_type == 'menu' ) {
-                $sub_args = array(
-                'child_of' =&gt; $childof,
-                'hide_empty' =&gt; false,
-                'parent' =&gt; $childof);
-        } elseif ( $output_type == 'default' ) {
-                // Sidebar Menu
-                $sub_args = array(
-                'child_of' =&gt; $childof,
-                'hide_empty' =&gt; false,
-                'parent' =&gt; $childof);
-        }
-
-        if ( $type == 'categories' ) {
-                // Get Sub Category Items
-                $item_type = 'category';
-                $sub_array = get_categories($sub_args);
-        } elseif ($type == 'pages') {
-                // Get Sub Page Items
-                $item_type = 'page';
-                $sub_array = get_pages($sub_args);
-        } else {
-                $item_type = 'custom';
-                $sub_array = array();
-        }
-
-
-        if ( $sub_array ) {
-                ?&gt;
-                &lt;ul id=&quot;sub-custom-nav-&lt;?php echo $type ?&gt;&quot;&gt;
-
-                &lt;?php
-                // Display Loop
-                foreach ( $sub_array as $sub_item ) {
-                        $sub_item = setup_menu_item($sub_item, $item_type, $counter);
-
-                        if ( $output_type == 'menu' ) {
-                                ?&gt;
-                                &lt;li id=&quot;menu-&lt;?php echo $counter; ?&gt;&quot; value=&quot;&lt;?php echo $counter; ?&gt;&quot;&gt;
-                                        &lt;?php
-                                                output_menu_item($sub_item, 'menu');
-                                                $counter++;
-                                                $counter = wp_custom_navigation_default_sub_items($sub_item-&gt;ID, $counter, $sub_item-&gt;ID, $type, 'menu');
-                                        ?&gt;
-
-                                &lt;/li&gt;
-                                &lt;?php
-                        } elseif ( $output_type == 'default' ) {
-                                // Sidebar Menu
-                                ?&gt;
-                                &lt;li&gt;
-                                        &lt;?php
-                                                output_menu_item($sub_item, 'default');
-                                                //$counter++;
-                                                $counter = wp_custom_navigation_default_sub_items($sub_item-&gt;ID, $counter, $sub_item-&gt;ID, $type, 'default');
-                                        ?&gt;
-                                &lt;/li&gt;
-
-                                &lt;?php
-                        }
-                }
-                ?&gt;
-
-                &lt;/ul&gt;
-
-        &lt;?php
-        }
-
-        return $counter;
-}
-
-?&gt;
</del></span></pre></div>
<a id="trunkwpincludesgeneraltemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/general-template.php (13365 => 13366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/general-template.php        2010-02-24 07:58:14 UTC (rev 13365)
+++ trunk/wp-includes/general-template.php        2010-02-24 08:06:36 UTC (rev 13366)
</span><span class="lines">@@ -2215,16 +2215,4 @@
</span><span class="cx">         return apply_filters( &quot;get_the_generator_{$type}&quot;, $gen, $type );
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/**
- * Outputs a navigation menu.
- *
- * @since 3.0.0
- *
- * @param array $args Arguments
- */
-function wp_nav_menu( $args = array() ) {
-        require_once (ABSPATH . WPINC . '/custom-navigation.php');
-        wp_custom_navigation_output($args);
-}
-
</del><span class="cx"> ?&gt;
</span></span></pre></div>
<a id="trunkwpincludesnavmenutemplatephp"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/nav-menu-template.php (0 => 13366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/nav-menu-template.php                                (rev 0)
+++ trunk/wp-includes/nav-menu-template.php        2010-02-24 08:06:36 UTC (rev 13366)
</span><span class="lines">@@ -0,0 +1,132 @@
</span><ins>+&lt;?php
+
+/**
+ * Outputs a navigation menu.
+ *
+ * @since 3.0.0
+ *
+ * @param array $args Arguments
+ */
+function wp_nav_menu( $args = array() ) {
+        wp_print_nav_menu($args);
+}
+
+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;
+                }
+
+            // 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                }
+        }
+}
+
+function wp_print_nav_menu_item($menu_item, $context, $args = array() ) {
+        switch ( $context ) {
+                case 'backend':
+                case 'menu':
+?&gt;
+                                                &lt;dl&gt;
+                                                        &lt;dt&gt;
+                                                                &lt;span class=&quot;title&quot;&gt;&lt;?php echo esc_html($menu_item-&gt;title); ?&gt;&lt;/span&gt;
+                                                                &lt;span class=&quot;controls&quot;&gt;
+                                                                &lt;span class=&quot;type&quot;&gt;&lt;?php echo esc_html($menu_item-&gt;type); ?&gt;&lt;/span&gt;
+                                                                &lt;a id=&quot;edit&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; onclick=&quot;edititem(&lt;?php echo $menu_item-&gt;menu_order; ?&gt;)&quot; value=&quot;&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot;&gt;&lt;img class=&quot;edit&quot; alt=&quot;&lt;?php esc_attr_e('Edit Menu Item'); ?&gt;&quot; title=&quot;&lt;?php esc_attr_e('Edit Menu Item'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-edit.png'); ?&gt;&quot; /&gt;&lt;/a&gt;
+                                                                &lt;a id=&quot;remove&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; onclick=&quot;removeitem(&lt;?php echo $menu_item-&gt;menu_order; ?&gt;)&quot; value=&quot;&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot;&gt;&lt;img class=&quot;remove&quot; alt=&quot;&lt;?php esc_attr_e('Remove from Custom Menu'); ?&gt;&quot; title=&quot;&lt;?php esc_attr_e('Remove from Custom Menu'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-close.png'); ?&gt;&quot; /&gt;&lt;/a&gt;
+                                                                &lt;a id=&quot;view&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; target=&quot;_blank&quot; href=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot;&gt;&lt;img alt=&quot;&lt;?php esc_attr_e('View Page'); ?&gt;&quot; title=&quot;&lt;?php esc_attr_e('View Page'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-viewpage.png'); ?&gt;&quot; /&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 $menu_item-&gt;title; ?&gt;&lt;/a&gt;
+                                                &lt;?php } ?&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;dbid&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;dbid&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;ID; ?&gt;&quot; /&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;postmenu&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;postmenu&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;ID; ?&gt;&quot; /&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;parent&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;parent&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;parent_item; ?&gt;&quot; /&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;title&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;title&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;title; ?&gt;&quot; /&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;linkurl&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;linkurl&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot; /&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;description&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;description&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;description; ?&gt;&quot; /&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;icon&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;icon&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;0&quot; /&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;position&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;position&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; /&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;linktype&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;linktype&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;type; ?&gt;&quot; /&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;anchortitle&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;anchortitle&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo esc_html( $menu_item-&gt;post_excerpt ); ?&gt;&quot; /&gt;
+                                                &lt;input type=&quot;hidden&quot; name=&quot;newwindow&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; id=&quot;newwindow&lt;?php echo $menu_item-&gt;menu_order; ?&gt;&quot; value=&quot;&lt;?php echo ( '' == $menu_item-&gt;post_content_filtered ? '0' : '1' ); ?&gt;&quot; /&gt;
+&lt;?php
+                break;
+
+                case 'frontend':
+                        // Override for menu descriptions
+                        $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options');
+                        if ( $advanced_option_descriptions == 'no' )
+                                $args['desc'] = 2;
+?&gt;
+                        &lt;a title=&quot;&lt;?php echo $menu_item-&gt;anchor_title; ?&gt;&quot; href=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot; &lt;?php echo $menu_item-&gt;target; ?&gt;&gt;&lt;?php echo $args['before_title'] . $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;
+
+                case 'default':
+                        $templatedir = get_bloginfo('url');
+?&gt;
+                                        &lt;dl&gt;
+                                        &lt;dt&gt;
+                                        &lt;span class=&quot;title&quot;&gt;&lt;?php echo $menu_item-&gt;title; ?&gt;&lt;/span&gt; &lt;a onclick=&quot;appendToList('&lt;?php echo $templatedir; ?&gt;','&lt;?php echo $menu_item-&gt;append; ?&gt;','&lt;?php echo $menu_item-&gt;title; ?&gt;','&lt;?php echo $menu_item-&gt;link; ?&gt;','&lt;?php echo $menu_item-&gt;ID; ?&gt;','&lt;?php echo $menu_item-&gt;parent_item ?&gt;','&lt;?php echo $menu_item-&gt;description; ?&gt;')&quot; name=&quot;&lt;?php echo $menu_item-&gt;title; ?&gt;&quot; value=&quot;&lt;?php echo $menu_item-&gt;link; ?&gt;&quot;&gt;&lt;img alt=&quot;&lt;?php esc_attr_e('Add to Custom Menu'); ?&gt;&quot; title=&quot;&lt;?php esc_attr_e('Add to Custom Menu'); ?&gt;&quot; src=&quot;&lt;?php echo admin_url('images/ico-add.png'); ?&gt;&quot; /&gt;&lt;/a&gt; &lt;/dt&gt;
+                                        &lt;/dl&gt;
+&lt;?php
+                break;
+        }
+}
+
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: trunk/wp-includes/nav-menu-template.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx">   + native
</span></span></pre></div>
<a id="trunkwpincludesnavmenuphp"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/nav-menu.php (0 => 13366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/nav-menu.php                                (rev 0)
+++ trunk/wp-includes/nav-menu.php        2010-02-24 08:06:36 UTC (rev 13366)
</span><span class="lines">@@ -0,0 +1,178 @@
</span><ins>+&lt;?php
+/**
+ * Navigation Menu functions
+ *
+ * @package WordPress
+ * @subpackage Navigation Menus
+ * @since 3.0.0
+ */
+
+function wp_delete_nav_menu( $menu_id ) {
+        $menu_id = (int) $menu_id;
+        if ( !$menu_id  )
+                return false;
+
+        $menu_objects = get_objects_in_term( $menu_id, 'nav_menu' );
+        if ( !empty( $menu_objects ) ) {
+                foreach ( $menu_objects as $item ) {
+                        wp_delete_post( $item );
+                }
+        }
+        wp_delete_term( $menu_id, 'nav_menu' );
+}
+
+function wp_create_nav_menu( $menu_name ) {
+        $menu_exists = get_term_by( 'name', $menu_name, 'nav_menu' );
+
+        if ( $menu_exists )
+                return WP_Error('menu_exists', sprintf( __('A menu named &quot;%s&quot; already exists; please try another name.'), $menu_exists-&gt;name ));
+
+        $menu = wp_insert_term( $menu_name, 'nav_menu' );
+        if ( is_wp_error($menu) )
+                return $menu;
+
+        return get_term( $menu['term_id'], 'nav_menu');
+}
+
+function wp_get_nav_menu( $menu ) {
+        return get_term( (int) $menu, 'nav_menu');
+}
+
+function wp_get_nav_menus() {
+        return get_terms( 'nav_menu', array( 'hide_empty' =&gt; false ) );
+}
+
+function wp_get_nav_menu_items( $menu, $args = array() ) {
+        $items = get_objects_in_term( (int) $menu, 'nav_menu' );
+
+        if ( ! empty( $items ) ) {
+                $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' );
+                $args = wp_parse_args($args, $defaults);
+                if ( count( $items ) &gt; 1 )        
+                        $args['include'] = implode( ',', $items );
+                else
+                        $args['include'] = $items[0];
+
+                $items = get_posts( $args );
+
+                if ( ARRAY_A == $args['output'] ) {
+                        $output = array();
+                        foreach ( $items as $item ) {
+                                $output[$item-&gt;$args['output_key']] = $item;
+                        }
+                        unset($items);
+                        ksort($output);
+                        return $output;
+                }
+        }
+        return $items;
+}
+
+function wp_setup_nav_menu_item($menu_item, $type = 'item', $position = 0) {
+        global $parent_menu_order;
+
+        if ( 'item' == $type ) {
+                $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);
+                if ( isset( $parent_menu_order[ $menu_item-&gt;post_parent ] ) )
+                        $menu_item-&gt;parent_item = $parent_menu_order[ $menu_item-&gt;post_parent ];
+                else
+                        $menu_item-&gt;parent_item = 0;
+        } elseif ( 'category' == $type ) {
+                $menu_item-&gt;type = $type;
+                $menu_item-&gt;object_id = $menu_item-&gt;term_id;
+                $menu_item-&gt;ID = $menu_item-&gt;term_id;
+                $menu_item-&gt;parent_item = $menu_item-&gt;parent;
+                $menu_item-&gt;menu_order = $position;
+        } elseif ( 'page' == $type ) {
+                $menu_item-&gt;type = $type;
+                $menu_item-&gt;object_id = $menu_item-&gt;ID;
+                $menu_item-&gt;parent_item = $menu_item-&gt;post_parent;
+                $menu_item-&gt;menu_order = $position;
+        }
+
+        switch ( $menu_item-&gt;type ) {
+                // Page Menu Item
+                case 'page':
+                        if ( $menu_item-&gt;guid == '' )
+                                $menu_item-&gt;link = get_permalink( $menu_item-&gt;object_id );
+                        else
+                                $menu_item-&gt;link = $menu_item-&gt;guid;
+
+                        if ( $menu_item-&gt;post_title == '' )
+                                $menu_item-&gt;title = htmlentities( get_the_title( $menu_item-&gt;object_id ) );
+                        else
+                                $menu_item-&gt;title = htmlentities( $menu_item-&gt;post_title );
+
+                        if ( $menu_item-&gt;post_content == '' )
+                                $menu_item-&gt;description = htmlentities( get_post_meta( $menu_item-&gt;ID, 'page-description', true ) );
+                        else
+                                $menu_item-&gt;description = htmlentities( $menu_item-&gt;post_content );
+                        $menu_item-&gt;target = '';
+                        $menu_item-&gt;append = 'Page';
+                break;
+                // Category Menu Item
+                case 'category':
+                        if ( empty($menu_item-&gt;guid) )
+                                $menu_item-&gt;link = get_category_link( $menu_item-&gt;object_id );
+                        else
+                                $menu_item-&gt;link = $menu_item-&gt;guid;
+
+                        if ( empty($menu_item-&gt;post_title) ) {
+                                $title_raw = get_category( $menu_item-&gt;object_id );
+                                $menu_item-&gt;title =  htmlentities($title_raw-&gt;cat_name);
+                        } else {
+                                $menu_item-&gt;title = htmlentities( $menu_item-&gt;post_title );
+                        }
+
+                        if ( empty($menu_item-&gt;post_content) )
+                                $menu_item-&gt;description = htmlentities( strip_tags( category_description( $menu_item-&gt;object_id ) ) );
+                        else
+                                $menu_item-&gt;description = htmlentities( $menu_item-&gt;post_content );
+                        $menu_item-&gt;target = '';
+                        $menu_item-&gt;append = 'Category';
+                break;
+                default:
+                        // Custom Menu Item
+                        $menu_item-&gt;link = $menu_item-&gt;guid;
+                        $menu_item-&gt;title =  htmlentities( $menu_item-&gt;post_title );
+                        $menu_item-&gt;description = htmlentities( $menu_item-&gt;post_content );
+                        $menu_item-&gt;target = 'target=&quot;_blank&quot;';
+                        $menu_item-&gt;append = 'Custom';
+                break;
+        }
+
+        $menu_item-&gt;li_class = '';
+        global $wp_query;
+        if ( $menu_item-&gt;ID == $wp_query-&gt;get_queried_object_id() )
+                $menu_item-&gt;li_class = 'class=&quot;current_page_item&quot;';
+
+        $menu_item-&gt;anchor_title = '';
+/* @todo: update to use tax/post data
+
+                        //SET anchor title
+                        if (isset($wp_custom_nav_menu_items-&gt;custom_anchor_title)) {
+                                $anchor_title = htmlentities($wp_custom_nav_menu_items-&gt;custom_anchor_title);
+                        }
+                        else {
+                                $anchor_title = $title;
+                        }
+
+                        if ($queried_id == $wp_custom_nav_menu_items-&gt;post_id) {
+                                $li_class = 'class=&quot;current_page_item&quot;';
+                        }
+
+                        if (isset($wp_custom_nav_menu_items-&gt;new_window)) {
+                                if ($wp_custom_nav_menu_items-&gt;new_window &gt; 0) {
+                                        $target = 'target=&quot;_blank&quot;';
+                                }
+                                else {
+                                        $target = '';
+                                }
+                        }
+*/
+
+        return $menu_item;
+}
+
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: trunk/wp-includes/nav-menu.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx">   + native
</span></span></pre></div>
<a id="trunkwpsettingsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-settings.php (13365 => 13366)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-settings.php        2010-02-24 07:58:14 UTC (rev 13365)
+++ trunk/wp-settings.php        2010-02-24 08:06:36 UTC (rev 13366)
</span><span class="lines">@@ -128,6 +128,8 @@
</span><span class="cx"> require( ABSPATH . WPINC . '/media.php' );
</span><span class="cx"> require( ABSPATH . WPINC . '/http.php' );
</span><span class="cx"> require( ABSPATH . WPINC . '/widgets.php' );
</span><ins>+require( ABSPATH . WPINC . '/nav-menu.php' );
+require( ABSPATH . WPINC . '/nav-menu-template.php' );
</ins><span class="cx"> 
</span><span class="cx"> // Load multisite-specific files.
</span><span class="cx"> if ( is_multisite() ) {
</span></span></pre>
</div>
</div>

</body>
</html>