diff --git a/wp-includes/custom-navigation.php b/wp-includes/custom-navigation.php
deleted file mode 100644
index 21cf6e047d..0000000000
--- a/wp-includes/custom-navigation.php
+++ /dev/null
@@ -1,542 +0,0 @@
-
- * @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->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 "%s" already exists; please try another name.'), $menu_exists->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' => 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' => 'menu_order', 'post_type' => 'nav_menu_item', 'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order' );
- $args = wp_parse_args($args, $defaults);
- if ( count( $items ) > 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->$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->type = get_post_meta($menu_item->ID, 'menu_type', true);
- $menu_item->object_id = get_post_meta($menu_item->ID, 'object_id', true);
- if ( isset( $parent_menu_order[ $menu_item->post_parent ] ) )
- $menu_item->parent_item = $parent_menu_order[ $menu_item->post_parent ];
- else
- $menu_item->parent_item = 0;
- } elseif ( 'category' == $type ) {
- $menu_item->type = $type;
- $menu_item->object_id = $menu_item->term_id;
- $menu_item->ID = $menu_item->term_id;
- $menu_item->parent_item = $menu_item->parent;
- $menu_item->menu_order = $position;
- } elseif ( 'page' == $type ) {
- $menu_item->type = $type;
- $menu_item->object_id = $menu_item->ID;
- $menu_item->parent_item = $menu_item->post_parent;
- $menu_item->menu_order = $position;
- }
-
- switch ( $menu_item->type ) {
- // Page Menu Item
- case 'page':
- if ( $menu_item->guid == '' )
- $menu_item->link = get_permalink( $menu_item->object_id );
- else
- $menu_item->link = $menu_item->guid;
-
- if ( $menu_item->post_title == '' )
- $menu_item->title = htmlentities( get_the_title( $menu_item->object_id ) );
- else
- $menu_item->title = htmlentities( $menu_item->post_title );
-
- if ( $menu_item->post_content == '' )
- $menu_item->description = htmlentities( get_post_meta( $menu_item->ID, 'page-description', true ) );
- else
- $menu_item->description = htmlentities( $menu_item->post_content );
- $menu_item->target = '';
- $menu_item->append = 'Page';
- break;
- // Category Menu Item
- case 'category':
- if ( empty($menu_item->guid) )
- $menu_item->link = get_category_link( $menu_item->object_id );
- else
- $menu_item->link = $menu_item->guid;
-
- if ( empty($menu_item->post_title) ) {
- $title_raw = get_category( $menu_item->object_id );
- $menu_item->title = htmlentities($title_raw->cat_name);
- } else {
- $menu_item->title = htmlentities( $menu_item->post_title );
- }
-
- if ( empty($menu_item->post_content) )
- $menu_item->description = htmlentities( strip_tags( category_description( $menu_item->object_id ) ) );
- else
- $menu_item->description = htmlentities( $menu_item->post_content );
- $menu_item->target = '';
- $menu_item->append = 'Category';
- break;
- default:
- // Custom Menu Item
- $menu_item->link = $menu_item->guid;
- $menu_item->title = htmlentities( $menu_item->post_title );
- $menu_item->description = htmlentities( $menu_item->post_content );
- $menu_item->target = 'target="_blank"';
- $menu_item->append = 'Custom';
- break;
- }
-
- $menu_item->li_class = '';
- global $wp_query;
- if ( $menu_item->ID == $wp_query->get_queried_object_id() )
- $menu_item->li_class = 'class="current_page_item"';
-
- $menu_item->anchor_title = '';
-/* @todo: update to use tax/post data
-
- //SET anchor title
- if (isset($wp_custom_nav_menu_items->custom_anchor_title)) {
- $anchor_title = htmlentities($wp_custom_nav_menu_items->custom_anchor_title);
- }
- else {
- $anchor_title = $title;
- }
-
- if ($queried_id == $wp_custom_nav_menu_items->post_id) {
- $li_class = 'class="current_page_item"';
- }
-
- if (isset($wp_custom_nav_menu_items->new_window)) {
- if ($wp_custom_nav_menu_items->new_window > 0) {
- $target = 'target="_blank"';
- }
- else {
- $target = '';
- }
- }
-*/
-
- return $menu_item;
-}
-
-function output_menu_item($menu_item, $context, $args = array() ) {
- switch( $context ) {
- case 'backend':
- case 'menu':
-?>
-
- -
- title); ?>
-
- type); ?>
-
-
-
-
-
-
-
-
-
-
title; ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
target; ?>>title . $args['after_title']; ?>description; ?>description; ?>
-
-
- -
- title; ?>
-
- tag
-/* after_title - html after title is outputted in
tag
-/*-----------------------------------------------------------------------------------*/
-function wp_custom_navigation_output( $args = array() ) {
- // Defaults
- $defaults = array( 'type' => 'frontend', 'name' => 'Menu 1', 'id' => 0, 'desc' => 2, 'before_title' => '', 'after_title' => '');
-
- $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->ID ] = $menu_item->menu_order;
- }
-
- // Display Loop
- foreach ( $menu_items as $key => $menu_item ) {
- $menu_item = setup_menu_item($menu_item);
- // List Items
- ?>
-post_parent != $current_parent ) ) { ?>
-
-
-
-ID; ?>
-
-
-
- 0,
- 'sort_order' => 'ASC',
- 'sort_column' => 'post_title',
- 'hierarchical' => 1,
- 'exclude' => '',
- 'include' => '',
- 'meta_key' => '',
- 'meta_value' => '',
- 'authors' => '',
- 'parent' => -1,
- 'exclude_tree' => '',
- 'number' => '',
- 'offset' => 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->post_parent == 0 ) {
- $post = setup_menu_item($post, 'page', $intCounter);
- if ( $type == 'menu' ) {
- ?>
-
-
-
-
- -
- ID;
- $intCounter++;
- $intCounter = wp_custom_navigation_default_sub_items($post->ID, $intCounter, $parentli, 'pages', 'default');
- ?>
-
-
- 'post',
- 'child_of' => 0,
- 'orderby' => 'name',
- 'order' => 'ASC',
- 'hide_empty' => false,
- 'include_last_update_time' => false,
- 'hierarchical' => 1,
- 'exclude' => '',
- 'include' => '',
- 'number' => '',
- 'pad_counts' => 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->parent == 0 ) {
- $cat_item = setup_menu_item($cat_item, 'category', $intCounter);
- // Custom Menu
- if ( $type == 'menu' ) {
- ?>
-
-
-
-
- -
- cat_ID;
- $intCounter++;
- $intCounter = wp_custom_navigation_default_sub_items($cat_item->cat_ID, $intCounter, $parentli, 'categories', 'default');
- ?>
-
-
-
- $childof,
- 'hide_empty' => false,
- 'parent' => $childof);
- } elseif ( $output_type == 'default' ) {
- // Sidebar Menu
- $sub_args = array(
- 'child_of' => $childof,
- 'hide_empty' => false,
- 'parent' => $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 ) {
- ?>
-
-
-
-
-
- -
- ID, $counter, $sub_item->ID, $type, 'default');
- ?>
-
-
-
-
-
-
-
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 84045b3b3b..0b2db652f0 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -2215,16 +2215,4 @@ function get_the_generator( $type = '' ) {
return apply_filters( "get_the_generator_{$type}", $gen, $type );
}
-/**
- * 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);
-}
-
?>
diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php
new file mode 100644
index 0000000000..ab894abcc8
--- /dev/null
+++ b/wp-includes/nav-menu-template.php
@@ -0,0 +1,132 @@
+ 'frontend', 'name' => 'Menu 1', 'id' => 0, 'desc' => 2, 'before_title' => '', 'after_title' => '');
+
+ $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->ID ] = $menu_item->menu_order;
+ }
+
+ // Display Loop
+ foreach ( $menu_items as $key => $menu_item ) {
+ $menu_item = wp_setup_nav_menu_item($menu_item);
+ // List Items
+ ?>
+post_parent != $current_parent ) ) { ?>
+
+
+
+ID; ?>
+
+
+
+
+
+ -
+ title); ?>
+
+ type); ?>
+
+
+
+
+
+
+
+
+
+ title; ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ target; ?>>title . $args['after_title']; ?>description; ?>description; ?>
+
+
+ -
+ title; ?>
+
+
\ No newline at end of file
diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php
new file mode 100644
index 0000000000..085ef4f030
--- /dev/null
+++ b/wp-includes/nav-menu.php
@@ -0,0 +1,178 @@
+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' => 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' => 'menu_order', 'post_type' => 'nav_menu_item', 'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order' );
+ $args = wp_parse_args($args, $defaults);
+ if ( count( $items ) > 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->$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->type = get_post_meta($menu_item->ID, 'menu_type', true);
+ $menu_item->object_id = get_post_meta($menu_item->ID, 'object_id', true);
+ if ( isset( $parent_menu_order[ $menu_item->post_parent ] ) )
+ $menu_item->parent_item = $parent_menu_order[ $menu_item->post_parent ];
+ else
+ $menu_item->parent_item = 0;
+ } elseif ( 'category' == $type ) {
+ $menu_item->type = $type;
+ $menu_item->object_id = $menu_item->term_id;
+ $menu_item->ID = $menu_item->term_id;
+ $menu_item->parent_item = $menu_item->parent;
+ $menu_item->menu_order = $position;
+ } elseif ( 'page' == $type ) {
+ $menu_item->type = $type;
+ $menu_item->object_id = $menu_item->ID;
+ $menu_item->parent_item = $menu_item->post_parent;
+ $menu_item->menu_order = $position;
+ }
+
+ switch ( $menu_item->type ) {
+ // Page Menu Item
+ case 'page':
+ if ( $menu_item->guid == '' )
+ $menu_item->link = get_permalink( $menu_item->object_id );
+ else
+ $menu_item->link = $menu_item->guid;
+
+ if ( $menu_item->post_title == '' )
+ $menu_item->title = htmlentities( get_the_title( $menu_item->object_id ) );
+ else
+ $menu_item->title = htmlentities( $menu_item->post_title );
+
+ if ( $menu_item->post_content == '' )
+ $menu_item->description = htmlentities( get_post_meta( $menu_item->ID, 'page-description', true ) );
+ else
+ $menu_item->description = htmlentities( $menu_item->post_content );
+ $menu_item->target = '';
+ $menu_item->append = 'Page';
+ break;
+ // Category Menu Item
+ case 'category':
+ if ( empty($menu_item->guid) )
+ $menu_item->link = get_category_link( $menu_item->object_id );
+ else
+ $menu_item->link = $menu_item->guid;
+
+ if ( empty($menu_item->post_title) ) {
+ $title_raw = get_category( $menu_item->object_id );
+ $menu_item->title = htmlentities($title_raw->cat_name);
+ } else {
+ $menu_item->title = htmlentities( $menu_item->post_title );
+ }
+
+ if ( empty($menu_item->post_content) )
+ $menu_item->description = htmlentities( strip_tags( category_description( $menu_item->object_id ) ) );
+ else
+ $menu_item->description = htmlentities( $menu_item->post_content );
+ $menu_item->target = '';
+ $menu_item->append = 'Category';
+ break;
+ default:
+ // Custom Menu Item
+ $menu_item->link = $menu_item->guid;
+ $menu_item->title = htmlentities( $menu_item->post_title );
+ $menu_item->description = htmlentities( $menu_item->post_content );
+ $menu_item->target = 'target="_blank"';
+ $menu_item->append = 'Custom';
+ break;
+ }
+
+ $menu_item->li_class = '';
+ global $wp_query;
+ if ( $menu_item->ID == $wp_query->get_queried_object_id() )
+ $menu_item->li_class = 'class="current_page_item"';
+
+ $menu_item->anchor_title = '';
+/* @todo: update to use tax/post data
+
+ //SET anchor title
+ if (isset($wp_custom_nav_menu_items->custom_anchor_title)) {
+ $anchor_title = htmlentities($wp_custom_nav_menu_items->custom_anchor_title);
+ }
+ else {
+ $anchor_title = $title;
+ }
+
+ if ($queried_id == $wp_custom_nav_menu_items->post_id) {
+ $li_class = 'class="current_page_item"';
+ }
+
+ if (isset($wp_custom_nav_menu_items->new_window)) {
+ if ($wp_custom_nav_menu_items->new_window > 0) {
+ $target = 'target="_blank"';
+ }
+ else {
+ $target = '';
+ }
+ }
+*/
+
+ return $menu_item;
+}
+
+?>
\ No newline at end of file
diff --git a/wp-settings.php b/wp-settings.php
index 25f7a1b475..b82673c8dd 100644
--- a/wp-settings.php
+++ b/wp-settings.php
@@ -128,6 +128,8 @@ require( ABSPATH . WPINC . '/shortcodes.php' );
require( ABSPATH . WPINC . '/media.php' );
require( ABSPATH . WPINC . '/http.php' );
require( ABSPATH . WPINC . '/widgets.php' );
+require( ABSPATH . WPINC . '/nav-menu.php' );
+require( ABSPATH . WPINC . '/nav-menu-template.php' );
// Load multisite-specific files.
if ( is_multisite() ) {