Changeset 47550 for trunk/src/wp-admin/includes/nav-menu.php
- Timestamp:
- 04/05/2020 03:00:44 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/nav-menu.php
r47219 r47550 26 26 $object_type = isset( $request['object_type'] ) ? $request['object_type'] : ''; 27 27 $query = isset( $request['q'] ) ? $request['q'] : ''; 28 $response_format = isset( $request['response-format'] ) && in_array( $request['response-format'], array( 'json', 'markup' ) ) ? $request['response-format'] : 'json'; 28 $response_format = isset( $request['response-format'] ) ? $request['response-format'] : ''; 29 30 if ( ! $response_format || ! in_array( $response_format, array( 'json', 'markup' ), true ) ) { 31 $response_format = 'json'; 32 } 29 33 30 34 if ( 'markup' == $response_format ) { … … 185 189 foreach ( array_keys( $wp_meta_boxes['nav-menus'][ $context ] ) as $priority ) { 186 190 foreach ( $wp_meta_boxes['nav-menus'][ $context ][ $priority ] as $box ) { 187 if ( in_array( $box['id'], $initial_meta_boxes ) ) {191 if ( in_array( $box['id'], $initial_meta_boxes, true ) ) { 188 192 unset( $box['id'] ); 189 193 } else { … … 337 341 $post_type_name = $box['args']->name; 338 342 $post_type = get_post_type_object( $post_type_name ); 343 $tab_name = $post_type_name . '-tab'; 339 344 340 345 // Paginate browsing for large numbers of post objects. 341 346 $per_page = 50; 342 $pagenum = isset( $_REQUEST[ $ post_type_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;347 $pagenum = isset( $_REQUEST[ $tab_name ] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; 343 348 $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0; 344 349 … … 448 453 'base' => add_query_arg( 449 454 array( 450 $ post_type_name . '-tab'=> 'all',451 'paged' 452 'item-type' 453 'item-object' 455 $tab_name => 'all', 456 'paged' => '%#%', 457 'item-type' => 'post_type', 458 'item-object' => $post_type_name, 454 459 ) 455 460 ), … … 474 479 475 480 $current_tab = 'most-recent'; 476 if ( isset( $_REQUEST[ $post_type_name . '-tab' ] ) && in_array( $_REQUEST[ $post_type_name . '-tab' ], array( 'all', 'search' ) ) ) { 477 $current_tab = $_REQUEST[ $post_type_name . '-tab' ]; 481 482 if ( isset( $_REQUEST[ $tab_name ] ) && in_array( $_REQUEST[ $tab_name ], array( 'all', 'search' ), true ) ) { 483 $current_tab = $_REQUEST[ $tab_name ]; 478 484 } 479 485 … … 495 501 $search_url = ''; 496 502 if ( $nav_menu_selected_id ) { 497 $most_recent_url = esc_url( add_query_arg( $ post_type_name . '-tab', 'most-recent', remove_query_arg( $removed_args ) ) );498 $view_all_url = esc_url( add_query_arg( $ post_type_name . '-tab', 'all', remove_query_arg( $removed_args ) ) );499 $search_url = esc_url( add_query_arg( $ post_type_name . '-tab', 'search', remove_query_arg( $removed_args ) ) );503 $most_recent_url = esc_url( add_query_arg( $tab_name, 'most-recent', remove_query_arg( $removed_args ) ) ); 504 $view_all_url = esc_url( add_query_arg( $tab_name, 'all', remove_query_arg( $removed_args ) ) ); 505 $search_url = esc_url( add_query_arg( $tab_name, 'search', remove_query_arg( $removed_args ) ) ); 500 506 } 501 507 ?> … … 653 659 <p class="button-controls wp-clearfix" data-items-type="posttype-<?php echo esc_attr( $post_type_name ); ?>"> 654 660 <span class="list-controls hide-if-no-js"> 655 <input type="checkbox"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> id="<?php echo esc_attr( $ post_type_name . '-tab'); ?>" class="select-all" />656 <label for="<?php echo esc_attr( $ post_type_name . '-tab'); ?>"><?php _e( 'Select All' ); ?></label>661 <input type="checkbox"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> id="<?php echo esc_attr( $tab_name ); ?>" class="select-all" /> 662 <label for="<?php echo esc_attr( $tab_name ); ?>"><?php _e( 'Select All' ); ?></label> 657 663 </span> 658 664 … … 689 695 $taxonomy_name = $box['args']->name; 690 696 $taxonomy = get_taxonomy( $taxonomy_name ); 697 $tab_name = $taxonomy_name . '-tab'; 691 698 692 699 // Paginate browsing for large numbers of objects. 693 700 $per_page = 50; 694 $pagenum = isset( $_REQUEST[ $ta xonomy_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;701 $pagenum = isset( $_REQUEST[ $tab_name ] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; 695 702 $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0; 696 703 … … 733 740 'base' => add_query_arg( 734 741 array( 735 $ta xonomy_name . '-tab'=> 'all',736 'paged' 737 'item-type' 738 'item-object' 742 $tab_name => 'all', 743 'paged' => '%#%', 744 'item-type' => 'taxonomy', 745 'item-object' => $taxonomy_name, 739 746 ) 740 747 ), … … 759 766 760 767 $current_tab = 'most-used'; 761 if ( isset( $_REQUEST[ $taxonomy_name . '-tab' ] ) && in_array( $_REQUEST[ $taxonomy_name . '-tab' ], array( 'all', 'most-used', 'search' ) ) ) { 762 $current_tab = $_REQUEST[ $taxonomy_name . '-tab' ]; 768 769 if ( isset( $_REQUEST[ $tab_name ] ) && in_array( $_REQUEST[ $tab_name ], array( 'all', 'most-used', 'search' ), true ) ) { 770 $current_tab = $_REQUEST[ $tab_name ]; 763 771 } 764 772 … … 780 788 $search_url = ''; 781 789 if ( $nav_menu_selected_id ) { 782 $most_used_url = esc_url( add_query_arg( $ta xonomy_name . '-tab', 'most-used', remove_query_arg( $removed_args ) ) );783 $view_all_url = esc_url( add_query_arg( $ta xonomy_name . '-tab', 'all', remove_query_arg( $removed_args ) ) );784 $search_url = esc_url( add_query_arg( $ta xonomy_name . '-tab', 'search', remove_query_arg( $removed_args ) ) );790 $most_used_url = esc_url( add_query_arg( $tab_name, 'most-used', remove_query_arg( $removed_args ) ) ); 791 $view_all_url = esc_url( add_query_arg( $tab_name, 'all', remove_query_arg( $removed_args ) ) ); 792 $search_url = esc_url( add_query_arg( $tab_name, 'search', remove_query_arg( $removed_args ) ) ); 785 793 } 786 794 ?> … … 883 891 <p class="button-controls wp-clearfix" data-items-type="taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>"> 884 892 <span class="list-controls hide-if-no-js"> 885 <input type="checkbox"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> id="<?php echo esc_attr( $ta xonomy_name . '-tab'); ?>" class="select-all" />886 <label for="<?php echo esc_attr( $ta xonomy_name . '-tab'); ?>"><?php _e( 'Select All' ); ?></label>893 <input type="checkbox"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> id="<?php echo esc_attr( $tab_name ); ?>" class="select-all" /> 894 <label for="<?php echo esc_attr( $tab_name ); ?>"><?php _e( 'Select All' ); ?></label> 887 895 </span> 888 896 … … 921 929 ! isset( $_item_object_data['menu-item-type'] ) || 922 930 // Or URL is the default. 923 in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ) ) ||931 in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ), true ) || 924 932 // Or it's not a custom menu item (but not the custom home page). 925 933 ! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) ||
Note: See TracChangeset
for help on using the changeset viewer.