]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/nav-menu.php
WordPress 4.2
[autoinstalls/wordpress.git] / wp-admin / includes / nav-menu.php
index 44f3ee08435263e7a797ccff328847fb0c95053e..9575297463c7ca61df7c10bf1a051c4c023c5e79 100644 (file)
@@ -186,11 +186,11 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
                                <p class="field-move hide-if-no-js description description-wide">
                                        <label>
                                                <span><?php _e( 'Move' ); ?></span>
-                                               <a href="#" class="menus-move-up"><?php _e( 'Up one' ); ?></a>
-                                               <a href="#" class="menus-move-down"><?php _e( 'Down one' ); ?></a>
-                                               <a href="#" class="menus-move-left"></a>
-                                               <a href="#" class="menus-move-right"></a>
-                                               <a href="#" class="menus-move-top"><?php _e( 'To the top' ); ?></a>
+                                               <a href="#" class="menus-move menus-move-up" data-dir="up"><?php _e( 'Up one' ); ?></a>
+                                               <a href="#" class="menus-move menus-move-down" data-dir="down"><?php _e( 'Down one' ); ?></a>
+                                               <a href="#" class="menus-move menus-move-left" data-dir="left"></a>
+                                               <a href="#" class="menus-move menus-move-right" data-dir="right"></a>
+                                               <a href="#" class="menus-move menus-move-top" data-dir="top"><?php _e( 'To the top' ); ?></a>
                                        </label>
                                </p>
 
@@ -356,7 +356,7 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
                                if ( 'markup' == $response_format ) {
                                        echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $object_id ) ) ), 0, (object) $args );
                                } elseif ( 'json' == $response_format ) {
-                                       echo json_encode(
+                                       echo wp_json_encode(
                                                array(
                                                        'ID' => $object_id,
                                                        'post_title' => get_the_title( $object_id ),
@@ -373,7 +373,7 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
                                        echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_term( $object_id, $object_type ) ) ), 0, (object) $args );
                                } elseif ( 'json' == $response_format ) {
                                        $post_obj = get_term( $object_id, $object_type );
-                                       echo json_encode(
+                                       echo wp_json_encode(
                                                array(
                                                        'ID' => $object_id,
                                                        'post_title' => $post_obj->name,
@@ -401,7 +401,7 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
                                        $var_by_ref = get_the_ID();
                                        echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $var_by_ref ) ) ), 0, (object) $args );
                                } elseif ( 'json' == $response_format ) {
-                                       echo json_encode(
+                                       echo wp_json_encode(
                                                array(
                                                        'ID' => get_the_ID(),
                                                        'post_title' => get_the_title(),
@@ -422,7 +422,7 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
                                if ( 'markup' == $response_format ) {
                                        echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args );
                                } elseif ( 'json' == $response_format ) {
-                                       echo json_encode(
+                                       echo wp_json_encode(
                                                array(
                                                        'ID' => $term->term_id,
                                                        'post_title' => $term->name,
@@ -444,7 +444,7 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
 function wp_nav_menu_setup() {
        // Register meta boxes
        wp_nav_menu_post_type_meta_boxes();
-       add_meta_box( 'add-custom-links', __( 'Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
+       add_meta_box( 'add-custom-links', __( 'Custom Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
        wp_nav_menu_taxonomy_meta_boxes();
 
        // Register advanced menu items (columns)
@@ -550,7 +550,6 @@ function wp_nav_menu_taxonomy_meta_boxes() {
  * @since 3.6.0
  *
  * @uses global $one_theme_location_no_menus to determine if no menus exist
- * @uses disabled() to output the disabled attribute in $other_attributes param in submit_button()
  *
  * @param int|string $nav_menu_selected_id (id, name or slug) of the currently-selected menu
  * @return string Disabled attribute if at least one menu exists, false if not
@@ -793,8 +792,8 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
                                 * Filter the posts displayed in the 'View All' tab of the current
                                 * post type's menu items meta box.
                                 *
-                                * The dynamic portion of the hook name, $post_type_name,
-                                * refers to the slug of the current post type.
+                                * The dynamic portion of the hook name, `$post_type_name`, refers
+                                * to the slug of the current post type.
                                 *
                                 * @since 3.2.0
                                 *
@@ -1149,7 +1148,7 @@ function _wp_nav_menu_meta_box_object( $object = null ) {
  *
  * @since 3.0.0
  *
- * @param string $menu_id The ID of the menu to format.
+ * @param int $menu_id Optional. The ID of the menu to format. Default 0.
  * @return string|WP_Error $output The menu formatted to edit or error object on failure.
  */
 function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
@@ -1247,16 +1246,13 @@ add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
  *
  * @since 3.6.0
  *
- * @uses wp_get_nav_menu_items() to retrieve the nav menu's menu items
- * @uses wp_defer_term_counter() to enable then disable term counting
- *
  * @param int|string $nav_menu_selected_id (id, slug, or name ) of the currently-selected menu
  * @param string $nav_menu_selected_title Title of the currently-selected menu
  * @return array $messages The menu updated message
  */
 function wp_nav_menu_update_menu_items ( $nav_menu_selected_id, $nav_menu_selected_title ) {
        $unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID', 'post_status' => 'draft,publish' ) );
-
+       $messages = array();
        $menu_items = array();
        // Index menu items by db ID
        foreach ( $unsorted_menu_items as $_item )
@@ -1321,7 +1317,7 @@ function wp_nav_menu_update_menu_items ( $nav_menu_selected_id, $nav_menu_select
        /** This action is documented in wp-includes/nav-menu.php */
        do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
 
-       $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( '<strong>%1$s</strong> has been updated.' ), $nav_menu_selected_title ) . '</p></div>';
+       $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( __( '<strong>%1$s</strong> has been updated.' ), $nav_menu_selected_title ) . '</p></div>';
        unset( $menu_items, $unsorted_menu_items );
 
        return $messages;