Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (6 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-admin/nav-menus.php

    r47093 r47122  
    1313require_once( dirname( __FILE__ ) . '/admin.php' );
    1414
    15 // Load all the nav menu interface functions
     15// Load all the nav menu interface functions.
    1616require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );
    1717
     
    2020}
    2121
    22 // Permissions Check
     22// Permissions check.
    2323if ( ! current_user_can( 'edit_theme_options' ) ) {
    2424    wp_die(
     
    3535}
    3636
    37 // Container for any messages displayed to the user
     37// Container for any messages displayed to the user.
    3838$messages = array();
    3939
    40 // Container that stores the name of the active menu
     40// Container that stores the name of the active menu.
    4141$nav_menu_selected_title = '';
    4242
    43 // The menu id of the current menu being edited
     43// The menu id of the current menu being edited.
    4444$nav_menu_selected_id = isset( $_REQUEST['menu'] ) ? (int) $_REQUEST['menu'] : 0;
    4545
    46 // Get existing menu locations assignments
     46// Get existing menu locations assignments.
    4747$locations      = get_registered_nav_menus();
    4848$menu_locations = get_nav_menu_locations();
    4949$num_locations  = count( array_keys( $locations ) );
    5050
    51 // Allowed actions: add, update, delete
     51// Allowed actions: add, update, delete.
    5252$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'edit';
    5353
     
    326326                    }
    327327                    if ( isset( $_REQUEST['zero-menu-state'] ) ) {
    328                         // If there are menu items, add them
     328                        // If there are menu items, add them.
    329329                        wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title );
    330                         // Auto-save nav_menu_locations
     330                        // Auto-save nav_menu_locations.
    331331                        $locations = get_nav_menu_locations();
    332332                        foreach ( $locations as $location => $menu_id ) {
    333333                                $locations[ $location ] = $nav_menu_selected_id;
    334                                 break; // There should only be 1
     334                                break; // There should only be 1.
    335335                        }
    336336                        set_theme_mod( 'nav_menu_locations', $locations );
     
    400400            $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] );
    401401            $menu_locations     = array_merge( $menu_locations, $new_menu_locations );
    402             // Set menu locations
     402            // Set menu locations.
    403403            set_theme_mod( 'nav_menu_locations', $menu_locations );
    404404
     
    472472    $nav_menu_selected_id = 0;
    473473} elseif ( empty( $nav_menu_selected_id ) && ! empty( $nav_menus ) && ! $add_new_screen ) {
    474     // if we have no selection yet, and we have menus, set to the first one in the list.
     474    // If we have no selection yet, and we have menus, set to the first one in the list.
    475475    $nav_menu_selected_id = $nav_menus[0]->term_id;
    476476}
     
    537537}
    538538
    539 if ( ! $locations_screen ) : // Main tab
     539if ( ! $locations_screen ) : // Main tab.
    540540    $overview  = '<p>' . __( 'This screen is used for managing your navigation menus.' ) . '</p>';
    541541    $overview .= '<p>' . sprintf(
     
    585585        )
    586586    );
    587 else : // Locations Tab.
     587else : // Locations tab.
    588588    $locations_overview  = '<p>' . __( 'This screen is used for globally assigning menus to locations defined by your theme.' ) . '</p>';
    589589    $locations_overview .= '<ul><li>' . __( 'To assign menus to one or more theme locations, <strong>select a menu from each location&#8217;s drop down.</strong> When you&#8217;re finished, <strong>click Save Changes</strong>' ) . '</li>';
     
    746746                        </td><!-- .menu-location-menus -->
    747747                    </tr><!-- .menu-locations-row -->
    748                 <?php } // foreach ?>
     748                <?php } // End foreach. ?>
    749749                </tbody>
    750750            </table>
Note: See TracChangeset for help on using the changeset viewer.