Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:33:45 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve comments in some wp-admin files per the documentation standards.

Follow-up to [47084].

Props passoniate, apedog.
Fixes #49223, #49227.

File:
1 edited

Legend:

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

    r46842 r47119  
    139139 */
    140140function wp_nav_menu_setup() {
    141     // Register meta boxes
     141    // Register meta boxes.
    142142    wp_nav_menu_post_type_meta_boxes();
    143143    add_meta_box( 'add-custom-links', __( 'Custom Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
    144144    wp_nav_menu_taxonomy_meta_boxes();
    145145
    146     // Register advanced menu items (columns)
     146    // Register advanced menu items (columns).
    147147    add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' );
    148148
     
    423423    }
    424424
    425     // @todo transient caching of these results with proper invalidation on updating of a post of this type
     425    // @todo Transient caching of these results with proper invalidation on updating of a post of this type.
    426426    $get_posts = new WP_Query;
    427427    $posts     = $get_posts->query( $args );
     
    922922                    // Or URL is the default.
    923923                    in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ) ) ||
    924                     ! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || // or it's not a custom menu item (but not the custom home page)
     924                    // Or it's not a custom menu item (but not the custom home page).
     925                    ! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) ||
    925926                    // Or it *is* a custom menu item that already exists.
    926927                    ! empty( $_item_object_data['menu-item-db-id'] )
     
    11431144    $messages            = array();
    11441145    $menu_items          = array();
    1145     // Index menu items by db ID
     1146    // Index menu items by DB ID.
    11461147    foreach ( $unsorted_menu_items as $_item ) {
    11471148        $menu_items[ $_item->db_id ] = $_item;
     
    11651166
    11661167    wp_defer_term_counting( true );
    1167     // Loop through all the menu items' POST variables
     1168    // Loop through all the menu items' POST variables.
    11681169    if ( ! empty( $_POST['menu-item-db-id'] ) ) {
    11691170        foreach ( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
    11701171
    1171             // Menu item title can't be blank
     1172            // Menu item title can't be blank.
    11721173            if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' == $_POST['menu-item-title'][ $_key ] ) {
    11731174                continue;
     
    11891190    }
    11901191
    1191     // Remove menu items from the menu that weren't in $_POST
     1192    // Remove menu items from the menu that weren't in $_POST.
    11921193    if ( ! empty( $menu_items ) ) {
    11931194        foreach ( array_keys( $menu_items ) as $menu_item_id ) {
     
    12141215        }
    12151216    }
    1216     // Remove nonexistent/deleted menus
     1217    // Remove non-existent/deleted menus.
    12171218    $nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) );
    12181219    update_option( 'nav_menu_options', $nav_menu_option );
     
    12531254        foreach ( $data as $post_input_data ) {
    12541255            // For input names that are arrays (e.g. `menu-item-db-id[3][4][5]`),
    1255             // derive the array path keys via regex and set the value in $_POST.
     1256            // derive the array path keys via regex and set the value in $_POST.
    12561257            preg_match( '#([^\[]*)(\[(.+)\])?#', $post_input_data->name, $matches );
    12571258
     
    12651266
    12661267            // Build the new array value from leaf to trunk.
    1267             for ( $i = count( $array_bits ) - 1; $i >= 0; $i -- ) {
     1268            for ( $i = count( $array_bits ) - 1; $i >= 0; $i-- ) {
    12681269                if ( $i == count( $array_bits ) - 1 ) {
    12691270                    $new_post_data[ $array_bits[ $i ] ] = wp_slash( $post_input_data->value );
Note: See TracChangeset for help on using the changeset viewer.