Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/nav-menu.php

    r47060 r47122  
    325325        );
    326326
    327         // double-check that we're not going to have one menu take the name of another
     327        // Double-check that we're not going to have one menu take the name of another.
    328328        $_possible_existing = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' );
    329329        if (
    … …  
    343343        }
    344344
    345         // menu doesn't already exist, so create a new menu
     345        // Menu doesn't already exist, so create a new menu.
    346346        if ( ! $_menu || is_wp_error( $_menu ) ) {
    347347                $menu_exists = get_term_by( 'name', $menu_data['menu-name'], 'nav_menu' );
    … …  
    420420        $menu_item_db_id = (int) $menu_item_db_id;
    421421
    422         // make sure that we don't convert non-nav_menu_item objects into nav_menu_item objects
     422        // Make sure that we don't convert non-nav_menu_item objects into nav_menu_item objects.
    423423        if ( ! empty( $menu_item_db_id ) && ! is_nav_menu_item( $menu_item_db_id ) ) {
    424424                return new WP_Error( 'update_nav_menu_item_failed', __( 'The given object ID is not that of a menu item.' ) );
    … …  
    496496                }
    497497
    498                 // hack to get wp to create a post object when too many properties are empty
     498                // Hack to get wp to create a post object when too many properties are empty.
    499499                if ( '' == $args['menu-item-title'] && '' == $args['menu-item-description'] ) {
    500500                        $args['menu-item-description'] = ' ';
    … …  
    502502        }
    503503
    504         // Populate the menu item object
     504        // Populate the menu item object.
    505505        $post = array(
    506506                'menu_order'   => $args['menu-item-position'],
    … …  
    515515        $update = 0 != $menu_item_db_id;
    516516
    517         // New menu item. Default is draft status
     517        // New menu item. Default is draft status.
    518518        if ( ! $update ) {
    519519                $post['ID']          = 0;
    … …  
    538538        }
    539539
    540         // Associate the menu item with the menu term
    541         // Only set the menu term if it isn't set to avoid unnecessary wp_get_object_terms()
     540        // Associate the menu item with the menu term.
     541        // Only set the menu term if it isn't set to avoid unnecessary wp_get_object_terms().
    542542        if ( $menu_id && ( ! $update || ! is_object_in_term( $menu_item_db_id, 'nav_menu', (int) $menu->term_id ) ) ) {
    543543                wp_set_object_terms( $menu_item_db_id, array( $menu->term_id ), 'nav_menu' );
    … …  
    569569        }
    570570
    571         // Update existing menu item. Default is publish status
     571        // Update existing menu item. Default is publish status.
    572572        if ( $update ) {
    573573                $post['ID']          = $menu_item_db_id;
    … …  
    702702        }
    703703
    704         // Get all posts and terms at once to prime the caches
     704        // Get all posts and terms at once to prime the caches.
    705705        if ( empty( $fetched[ $menu->term_id ] ) && ! wp_using_ext_object_cache() ) {
    706706                $fetched[ $menu->term_id ] = true;
    … …  
    749749        $items = array_map( 'wp_setup_nav_menu_item', $items );
    750750
    751         if ( ! is_admin() ) { // Remove invalid items only in front end
     751        if ( ! is_admin() ) { // Remove invalid items only on front end.
    752752                $items = array_filter( $items, '_is_valid_nav_menu_item' );
    753753        }
    … …  
    12461246                                                        continue 3;
    12471247                                                }
    1248                                         } // endforeach ( $slug_group as $slug )
    1249                                 } // endforeach ( $old_nav_menu_locations as $location => $menu_id )
    1250                         } // endforeach foreach ( $registered_nav_menus as $new_location => $name )
    1251                 } // endforeach ( $slug_group as $slug )
    1252         } // endforeach ( $common_slug_groups as $slug_group )
     1248                                        } // End foreach ( $slug_group as $slug ).
     1249                                } // End foreach ( $old_nav_menu_locations as $location => $menu_id ).
     1250                        } // End foreach foreach ( $registered_nav_menus as $new_location => $name ).
     1251                } // End foreach ( $slug_group as $slug ).
     1252        } // End foreach ( $common_slug_groups as $slug_group ).
    12531253
    12541254        return $new_nav_menu_locations;
Note: See TracChangeset for help on using the changeset viewer.