X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/e0feb3b2e5b436a06bbb04fbc838d1cd6ec95399..b22765f41bf0b2021b9beb9120ee0ac91fa89292:/wp-admin/nav-menus.php diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php index ed9d0523..72de2a92 100644 --- a/wp-admin/nav-menus.php +++ b/wp-admin/nav-menus.php @@ -19,8 +19,13 @@ if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' wp_die( __( 'Your theme does not support navigation menus or widgets.' ) ); // Permissions Check -if ( ! current_user_can('edit_theme_options') ) - wp_die( __( 'Cheatin’ uh?' ), 403 ); +if ( ! current_user_can( 'edit_theme_options' ) ) { + wp_die( + '

' . __( 'Cheatin’ uh?' ) . '

' . + '

' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '

', + 403 + ); +} wp_enqueue_script( 'nav-menu' ); @@ -44,6 +49,12 @@ $num_locations = count( array_keys( $locations ) ); // Allowed actions: add, update, delete $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. + */ +_wp_expand_nav_menu_post_data(); + switch ( $action ) { case 'add-menu-item': check_admin_referer( 'add-menu_item', 'menu-settings-column-nonce' ); @@ -67,7 +78,7 @@ switch ( $action ) { // Set up the data we need in one pass through the array of menu items. $dbids_to_orders = array(); $orders_to_dbids = array(); - foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) { + foreach ( (array) $ordered_menu_items as $ordered_menu_item_object ) { if ( isset( $ordered_menu_item_object->ID ) ) { if ( isset( $ordered_menu_item_object->menu_order ) ) { $dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order; @@ -140,7 +151,7 @@ switch ( $action ) { // Set up the data we need in one pass through the array of menu items. $dbids_to_orders = array(); $orders_to_dbids = array(); - foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) { + foreach ( (array) $ordered_menu_items as $ordered_menu_item_object ) { if ( isset( $ordered_menu_item_object->ID ) ) { if ( isset( $ordered_menu_item_object->menu_order ) ) { $dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order; @@ -460,7 +471,7 @@ if ( ! $nav_menu_selected_title && is_nav_menu( $nav_menu_selected_id ) ) { } // Generate truncated menu names. -foreach( (array) $nav_menus as $key => $_nav_menu ) { +foreach ( (array) $nav_menus as $key => $_nav_menu ) { $nav_menus[$key]->truncated_name = wp_html_excerpt( $_nav_menu->name, 40, '…' ); } @@ -574,12 +585,12 @@ 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; ?> - @@ -642,7 +653,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' ); -

+

@@ -668,7 +679,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' ); - +