Wordpress 3.5
[autoinstalls/wordpress.git] / wp-admin / includes / nav-menu.php
index 5fc73fcbbf8c65df2b8383f3d2e23aa57bcbffac..60644628d95a62765b8b130db1f259dc3e0a628f 100644 (file)
@@ -247,11 +247,12 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
                $output .= $indent . '<li>';
                $output .= '<label class="menu-item-title">';
                $output .= '<input type="checkbox" class="menu-item-checkbox';
-               if ( ! empty( $item->_add_to_top ) ) {
+               if ( property_exists( $item, 'front_or_home' ) && $item->front_or_home ) {
+                       $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $item->post_title );
                        $output .= ' add-to-top';
                }
                $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> ';
-               $output .= empty( $item->label ) ? esc_html( $item->title ) : esc_html( $item->label );
+               $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title );
                $output .= '</label>';
 
                // Menu item hidden fields
@@ -511,8 +512,8 @@ function wp_nav_menu_locations_meta_box() {
        }
        ?>
        <p class="button-controls">
-               <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
-               <?php submit_button( __( 'Save' ), 'primary', 'nav-menu-locations', false, disabled( $nav_menu_selected_id, 0, false ) ); ?>
+               <?php submit_button( __( 'Save' ), 'primary right', 'nav-menu-locations', false, disabled( $nav_menu_selected_id, 0, false ) ); ?>
+               <span class="spinner"></span>
        </p>
        <?php
 }
@@ -560,8 +561,8 @@ function wp_nav_menu_item_link_meta_box() {
 
                <p class="button-controls">
                        <span class="add-to-menu">
-                               <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
-                               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
+                               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
+                               <span class="spinner"></span>
                        </span>
                </p>
 
@@ -692,11 +693,11 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
                        ?>
                        <p class="quick-search-wrap">
                                <input type="search" class="quick-search input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-posttype-<?php echo $post_type_name; ?>" />
-                               <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
-                               <?php submit_button( __( 'Search' ), 'quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-posttype-' . $post_type_name ) ); ?>
+                               <span class="spinner"></span>
+                               <?php submit_button( __( 'Search' ), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-posttype-' . $post_type_name ) ); ?>
                        </p>
 
-                       <ul id="<?php echo $post_type_name; ?>-search-checklist" class="list:<?php echo $post_type_name?> categorychecklist form-no-clear">
+                       <ul id="<?php echo $post_type_name; ?>-search-checklist" data-wp-lists="list:<?php echo $post_type_name?>" class="categorychecklist form-no-clear">
                        <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
                                <?php
                                $args['walker'] = $walker;
@@ -718,7 +719,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
                                        <?php echo $page_links; ?>
                                </div>
                        <?php endif; ?>
-                       <ul id="<?php echo $post_type_name; ?>checklist" class="list:<?php echo $post_type_name?> categorychecklist form-no-clear">
+                       <ul id="<?php echo $post_type_name; ?>checklist" data-wp-lists="list:<?php echo $post_type_name?>" class="categorychecklist form-no-clear">
                                <?php
                                $args['walker'] = $walker;
 
@@ -727,13 +728,12 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
                                        $front_page = 'page' == get_option('show_on_front') ? (int) get_option( 'page_on_front' ) : 0;
                                        if ( ! empty( $front_page ) ) {
                                                $front_page_obj = get_post( $front_page );
-                                               $front_page_obj->_add_to_top = true;
-                                               $front_page_obj->label = sprintf( _x('Home: %s', 'nav menu front page title'), $front_page_obj->post_title );
+                                               $front_page_obj->front_or_home = true;
                                                array_unshift( $posts, $front_page_obj );
                                        } else {
                                                $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
                                                array_unshift( $posts, (object) array(
-                                                       '_add_to_top' => true,
+                                                       'front_or_home' => true,
                                                        'ID' => 0,
                                                        'object_id' => $_nav_menu_placeholder,
                                                        'post_content' => '',
@@ -779,8 +779,8 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
                        </span>
 
                        <span class="add-to-menu">
-                               <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
-                               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-post-type-menu-item" id="submit-posttype-<?php echo $post_type_name; ?>" />
+                               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-post-type-menu-item" id="submit-posttype-<?php echo $post_type_name; ?>" />
+                               <span class="spinner"></span>
                        </span>
                </p>
 
@@ -896,7 +896,7 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
                                        <?php echo $page_links; ?>
                                </div>
                        <?php endif; ?>
-                       <ul id="<?php echo $taxonomy_name; ?>checklist" class="list:<?php echo $taxonomy_name?> categorychecklist form-no-clear">
+                       <ul id="<?php echo $taxonomy_name; ?>checklist" data-wp-lists="list:<?php echo $taxonomy_name?>" class="categorychecklist form-no-clear">
                                <?php
                                $args['walker'] = $walker;
                                echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $terms), 0, (object) $args );
@@ -923,11 +923,11 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
                        ?>
                        <p class="quick-search-wrap">
                                <input type="search" class="quick-search input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" />
-                               <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
-                               <?php submit_button( __( 'Search' ), 'quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?>
+                               <span class="spinner"></span>
+                               <?php submit_button( __( 'Search' ), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?>
                        </p>
 
-                       <ul id="<?php echo $taxonomy_name; ?>-search-checklist" class="list:<?php echo $taxonomy_name?> categorychecklist form-no-clear">
+                       <ul id="<?php echo $taxonomy_name; ?>-search-checklist" data-wp-lists="list:<?php echo $taxonomy_name?>" class="categorychecklist form-no-clear">
                        <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
                                <?php
                                $args['walker'] = $walker;
@@ -955,8 +955,8 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
                        </span>
 
                        <span class="add-to-menu">
-                               <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
-                               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-taxonomy-menu-item" id="submit-taxonomy-<?php echo $taxonomy_name; ?>" />
+                               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-taxonomy-menu-item" id="submit-taxonomy-<?php echo $taxonomy_name; ?>" />
+                               <span class="spinner"></span>
                        </span>
                </p>
 
@@ -1150,7 +1150,7 @@ function wp_nav_menu_manage_columns() {
  */
 function _wp_delete_orphaned_draft_menu_items() {
        global $wpdb;
-       $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
+       $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
 
        // delete orphaned draft menu items
        $menu_items_to_delete = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < '%d'", $delete_timestamp ) );