X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f..b22765f41bf0b2021b9beb9120ee0ac91fa89292:/wp-admin/nav-menus.php diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php index 0dd34cf9..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?' ) ); +if ( ! current_user_can( 'edit_theme_options' ) ) { + wp_die( + '
' . __( '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; @@ -231,7 +242,7 @@ switch ( $action ) { check_admin_referer( 'delete-menu_item_' . $menu_item_id ); if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) ) - $messages[] = '' . __('The menu item has been successfully deleted.') . '
' . __('The menu item has been successfully deleted.') . '
' . $deletion->get_error_message() . '
' . $deletion->get_error_message() . '
' . __( 'The menu has been successfully deleted.' ) . '
' . __( 'The menu has been successfully deleted.' ) . '
' . $deletion->get_error_message() . '
' . $deletion->get_error_message() . '
' . __( 'Selected menus have been successfully deleted.' ) . '
' . __( 'Selected menus have been successfully deleted.' ) . '
' . $_nav_menu_selected_id->get_error_message() . '
' . $_nav_menu_selected_id->get_error_message() . '
' . __( 'Please enter a valid menu name.' ) . '
' . __( 'Please enter a valid menu name.' ) . '
' . __( 'Please enter a valid menu name.' ) . '
' . __( 'Please enter a valid menu name.' ) . '
' . $_nav_menu_selected_id->get_error_message() . '
' . $_nav_menu_selected_id->get_error_message() . '
' . __( 'Menu locations updated.' ) . '
' . __( 'Menu locations updated.' ) . '
' . __( 'This screen is used for managing your custom navigation menus.' ) . '
'; - $overview .= '' . sprintf( __( 'Menus can be displayed in locations defined by your theme, even used in sidebars by adding a “Custom Menu” widget on the Widgets 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 Fourteen', 'Twenty Thirteen' ) . '
'; + $overview .= '' . sprintf( __( 'Menus can be displayed in locations defined by your theme, even used in sidebars by adding a “Custom Menu” widget on the Widgets 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' ) . '
'; $overview .= '' . __( 'From this screen you can:' ) . '
'; $overview .= '' . __( 'Each custom menu may contain a mix of links to pages, categories, custom URLs or other content types. Menu links are added by selecting items from the expanding boxes in the left-hand column below.' ) . '
'; $editing_menus .= '' . __( 'Clicking the arrow to the right of any menu item in the editor will reveal a standard group of settings. Additional settings such as link target, CSS classes, link relationships, and link descriptions can be enabled and disabled via the Screen Options tab.' ) . '
'; $editing_menus .= '' . __('For more information:') . '
' . - '' . __('Documentation on Menus') . '
' . + '' . __('Documentation on Menus') . '
' . '' . __('Support Forums') . '
' ); @@ -549,20 +575,41 @@ get_current_screen()->set_help_sidebar( require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>' . __( 'Your theme supports one menu. Select which menu you would like to use.' ) . '
'; + } else { + echo '' . sprintf( _n( 'Your theme supports %s menu. Select which menu appears in each location.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . '
'; + } ?> -