Changeset 37754
- Timestamp:
- 06/20/2016 07:49:49 PM (8 years ago)
- Location:
- branches/4.5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.5
-
branches/4.5/src/wp-admin/nav-menus.php
r36852 r37754 50 50 $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'edit'; 51 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 52 148 /* 53 149 * If a JSON blob of navigation menu data is found, expand it and inject it 54 150 * into `$_POST` to avoid PHP `max_input_vars` limitations. See #14134. 55 151 */ 56 if ( isset( $_POST['nav-menu-data'] ) ) { 57 $data = json_decode( stripslashes( $_POST['nav-menu-data'] ) ); 58 if ( ! is_null( $data ) && $data ) { 59 foreach ( $data as $post_input_data ) { 60 // For input names that are arrays (e.g. `menu-item-db-id[3]`), derive the array path keys via regex. 61 if ( preg_match( '#(.*)\[(\w+)\]#', $post_input_data->name, $matches ) ) { 62 if ( empty( $_POST[ $matches[1] ] ) ) { 63 $_POST[ $matches[1] ] = array(); 64 } 65 // Cast input elements with a numeric array index to integers. 66 if ( is_numeric( $matches[2] ) ) { 67 $matches[2] = (int) $matches[2]; 68 } 69 $_POST[ $matches[1] ][ $matches[2] ] = wp_slash( $post_input_data->value ); 70 } else { 71 $_POST[ $post_input_data->name ] = wp_slash( $post_input_data->value ); 72 } 73 } 74 } 75 } 152 _wp_expand_nav_menu_post_data(); 153 76 154 switch ( $action ) { 77 155 case 'add-menu-item':
Note: See TracChangeset
for help on using the changeset viewer.