Menus: Revert larger menu support in Edit Menus screen in [36506].

JSON encoding the form as it exists on the page will not scale. 

See #14134.

Built from https://develop.svn.wordpress.org/trunk@36507


git-svn-id: http://core.svn.wordpress.org/trunk@36474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Eric Lewis 2016-02-10 14:11:26 +00:00
parent 48fdbf96de
commit a64dbc805b
4 changed files with 2 additions and 41 deletions

View File

@ -43,7 +43,6 @@ var wpNavMenu;
this.attachQuickSearchListeners();
this.attachThemeLocationsListeners();
this.attachMenuSaveSubmitListeners();
this.attachTabsPanelListeners();
@ -835,30 +834,6 @@ var wpNavMenu;
});
},
attachMenuSaveSubmitListeners : function() {
/*
* When a navigation menu is saved, store a JSON representation of all form data
* in a single input to avoid PHP `max_input_vars` limitations. See #14134.
*/
$('#update-nav-menu').submit(function() {
var navMenuData = {};
$('#update-nav-menu input').each(function(index, element) {
var name = $(element).attr('name');
var regex = /(.*)(?:\[(\d+)\])/;
if ( regex.test( name ) ) {
var matches = regex.exec(name);
if ( ! navMenuData[matches[1]] ) {
navMenuData[matches[1]] = [];
}
navMenuData[matches[1]][matches[2]] = $(element).val();
} else {
navMenuData[name] = $(element).val();
}
});
$('[name="nav-menu-data"]').val( JSON.stringify( navMenuData ) );
});
},
attachThemeLocationsListeners : function() {
var loc = $('#nav-menu-theme-locations'), params = {};
params.action = 'menu-locations-save';

File diff suppressed because one or more lines are too long

View File

@ -49,19 +49,6 @@ $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.
*/
if ( isset( $_POST['nav-menu-data'] ) ) {
$data = json_decode( stripslashes( $_POST['nav-menu-data'] ) );
if ( ! is_null( $data ) && $data ) {
foreach ( $data as $post_var => $post_data ) {
$_POST[$post_var] = $post_data;
}
}
}
switch ( $action ) {
case 'add-menu-item':
check_admin_referer( 'add-menu_item', 'menu-settings-column-nonce' );
@ -744,7 +731,6 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<div id="menu-management">
<form id="update-nav-menu" method="post" enctype="multipart/form-data">
<div class="menu-edit <?php if ( $add_new_screen ) echo 'blank-slate'; ?>">
<input type="hidden" name="nav-menu-data">
<?php
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36506';
$wp_version = '4.5-alpha-36507';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.