]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/nav-menus.php
WordPress 4.7.2
[autoinstalls/wordpress.git] / wp-admin / nav-menus.php
index ab15beded0d3d72ed4aab4b0889deea499f9ced6..19348c2348d0d7b0738bec0f28482f1313dcc360 100644 (file)
@@ -22,7 +22,7 @@ if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets'
 if ( ! current_user_can( 'edit_theme_options' ) ) {
        wp_die(
                '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
-               '<p>' . __( 'You are not allowed to edit theme options on this site.' ) . '</p>',
+               '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
                403
        );
 }
@@ -53,26 +53,8 @@ $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'edit';
  * If a JSON blob of navigation menu data is found, expand it and inject it
  * into `$_POST` to avoid PHP `max_input_vars` limitations. See #14134.
  */
-if ( isset( $_POST['nav-menu-data'] ) ) {
-       $data = json_decode( stripslashes( $_POST['nav-menu-data'] ) );
-       if ( ! is_null( $data ) && $data ) {
-               foreach ( $data as $post_input_data ) {
-                       // For input names that are arrays (e.g. `menu-item-db-id[3]`), derive the array path keys via regex.
-                       if ( preg_match( '#(.*)\[(\w+)\]#', $post_input_data->name, $matches ) ) {
-                               if ( empty( $_POST[ $matches[1] ] ) ) {
-                                       $_POST[ $matches[1] ] = array();
-                               }
-                               // Cast input elements with a numeric array index to integers.
-                               if ( is_numeric( $matches[2] ) ) {
-                                       $matches[2] = (int) $matches[2];
-                               }
-                               $_POST[ $matches[1] ][ $matches[2] ] = wp_slash( $post_input_data->value );
-                       } else {
-                               $_POST[ $post_input_data->name ] = wp_slash( $post_input_data->value );
-                       }
-               }
-       }
-}
+_wp_expand_nav_menu_post_data();
+
 switch ( $action ) {
        case 'add-menu-item':
                check_admin_referer( 'add-menu_item', 'menu-settings-column-nonce' );
@@ -536,7 +518,8 @@ if ( ! current_theme_supports( 'menus' ) && ! $num_locations )
 
 if ( ! $locations_screen ) : // Main tab
        $overview  = '<p>' . __( 'This screen is used for managing your custom navigation menus.' ) . '</p>';
-       $overview .= '<p>' . sprintf( __( 'Menus can be displayed in locations defined by your theme, even used in sidebars by adding a &#8220;Custom Menu&#8221; widget on the <a href="%1$s">Widgets</a> screen. If your theme does not support the custom menus feature (the default themes, %2$s and %3$s, do), you can learn about adding this support by following the Documentation link to the side.' ), admin_url( 'widgets.php' ), 'Twenty Fifteen', 'Twenty Fourteen' ) . '</p>';
+       /* translators: 1: Widgets admin screen URL, 2 and 3: The name of the default themes */
+       $overview .= '<p>' . sprintf( __( 'Menus can be displayed in locations defined by your theme, even used in sidebars by adding a &#8220;Custom Menu&#8221; widget on the <a href="%1$s">Widgets</a> screen. If your theme does not support the custom menus feature (the default themes, %2$s and %3$s, do), you can learn about adding this support by following the Documentation link to the side.' ), admin_url( 'widgets.php' ), 'Twenty Sixteen', 'Twenty Seventeen' ) . '</p>';
        $overview .= '<p>' . __( 'From this screen you can:' ) . '</p>';
        $overview .= '<ul><li>' . __( 'Create, edit, and delete menus' ) . '</li>';
        $overview .= '<li>' . __( 'Add, organize, and modify individual menu items' ) . '</li></ul>';
@@ -585,8 +568,8 @@ endif;
 
 get_current_screen()->set_help_sidebar(
        '<p><strong>' . __('For more information:') . '</strong></p>' .
-       '<p>' . __('<a href="https://codex.wordpress.org/Appearance_Menus_Screen" target="_blank">Documentation on Menus</a>') . '</p>' .
-       '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+       '<p>' . __('<a href="https://codex.wordpress.org/Appearance_Menus_Screen">Documentation on Menus</a>') . '</p>' .
+       '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
 );
 
 // Get the admin header.
@@ -603,7 +586,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
                                        array( 'autofocus' => $focus ),
                                        'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
                                ), admin_url( 'customize.php' ) ) ),
-                               __( 'Manage in Customizer' )
+                               __( 'Manage with Live Preview' )
                        );
                endif;
                ?>
@@ -711,7 +694,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
                                                        }
 
                                                        /**
-                                                        * Filter the number of locations listed per menu in the drop-down select.
+                                                        * Filters the number of locations listed per menu in the drop-down select.
                                                         *
                                                         * @since 3.6.0
                                                         *
@@ -731,7 +714,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
                                        </option>
                                <?php endforeach; ?>
                        </select>
-                       <span class="submit-btn"><input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Select' ); ?>"></span>
+                       <span class="submit-btn"><input type="submit" class="button" value="<?php esc_attr_e( 'Select' ); ?>"></span>
                        <span class="add-new-menu-action">
                                <?php printf( __( 'or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?>
                        </span><!-- /add-new-menu-action -->
@@ -777,7 +760,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
                                                        <label class="menu-name-label" for="menu-name"><?php _e( 'Menu Name' ); ?></label>
                                                        <input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox" <?php echo $menu_name_val . $menu_name_aria_desc; ?> />
                                                        <div class="publishing-action">
-                                                               <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?>
+                                                               <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'primary large menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?>
                                                        </div><!-- END .publishing-action -->
                                                </div><!-- END .major-publishing-actions -->
                                        </div><!-- END .nav-menu-header -->
@@ -816,17 +799,19 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
                                                                                $auto_add = false;
                                                                } ?>
 
-                                                               <dl class="auto-add-pages">
-                                                                       <dt class="howto"><?php _e( 'Auto add pages' ); ?></dt>
-                                                                       <dd class="checkbox-input"><input type="checkbox"<?php checked( $auto_add ); ?> name="auto-add-pages" id="auto-add-pages" value="1" /> <label for="auto-add-pages"><?php printf( __('Automatically add new top-level pages to this menu' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?></label></dd>
-                                                               </dl>
+                                                               <fieldset class="menu-settings-group auto-add-pages">
+                                                                       <legend class="menu-settings-group-name howto"><?php _e( 'Auto add pages' ); ?></legend>
+                                                                       <div class="menu-settings-input checkbox-input">
+                                                                               <input type="checkbox"<?php checked( $auto_add ); ?> name="auto-add-pages" id="auto-add-pages" value="1" /> <label for="auto-add-pages"><?php printf( __('Automatically add new top-level pages to this menu' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?></label>
+                                                                       </div>
+                                                               </fieldset>
 
                                                                <?php if ( current_theme_supports( 'menus' ) ) : ?>
 
-                                                                       <dl class="menu-theme-locations">
-                                                                               <dt class="howto"><?php _e( 'Theme locations' ); ?></dt>
+                                                                       <fieldset class="menu-settings-group menu-theme-locations">
+                                                                               <legend class="menu-settings-group-name howto"><?php _e( 'Display location' ); ?></legend>
                                                                                <?php foreach ( $locations as $location => $description ) : ?>
-                                                                               <dd class="checkbox-input">
+                                                                               <div class="menu-settings-input checkbox-input">
                                                                                        <input type="checkbox"<?php checked( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ); ?> name="menu-locations[<?php echo esc_attr( $location ); ?>]" id="locations-<?php echo esc_attr( $location ); ?>" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
                                                                                        <label for="locations-<?php echo esc_attr( $location ); ?>"><?php echo $description; ?></label>
                                                                                        <?php if ( ! empty( $menu_locations[ $location ] ) && $menu_locations[ $location ] != $nav_menu_selected_id ) : ?>
@@ -837,9 +822,9 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
                                                                                                        );
                                                                                                ?></span>
                                                                                        <?php endif; ?>
-                                                                               </dd>
+                                                                               </div>
                                                                                <?php endforeach; ?>
-                                                                       </dl>
+                                                                       </fieldset>
 
                                                                <?php endif; ?>
 
@@ -854,7 +839,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
                                                        </span><!-- END .delete-action -->
                                                        <?php endif; ?>
                                                        <div class="publishing-action">
-                                                               <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_footer' ) ); ?>
+                                                               <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'primary large menu-save', 'save_menu', false, array( 'id' => 'save_menu_footer' ) ); ?>
                                                        </div><!-- END .publishing-action -->
                                                </div><!-- END .major-publishing-actions -->
                                        </div><!-- /#nav-menu-footer -->