Changeset 47808 for trunk/src/wp-admin/includes/nav-menu.php
- Timestamp:
- 05/16/2020 06:40:52 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/nav-menu.php
r47747 r47808 32 32 } 33 33 34 if ( 'markup' == $response_format ) {34 if ( 'markup' === $response_format ) { 35 35 $args['walker'] = new Walker_Nav_Menu_Checklist; 36 36 } 37 37 38 if ( 'get-post-item' == $type ) {38 if ( 'get-post-item' === $type ) { 39 39 if ( post_type_exists( $object_type ) ) { 40 40 if ( isset( $request['ID'] ) ) { 41 41 $object_id = (int) $request['ID']; 42 if ( 'markup' == $response_format ) {42 if ( 'markup' === $response_format ) { 43 43 echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_post( $object_id ) ) ), 0, (object) $args ); 44 } elseif ( 'json' == $response_format ) {44 } elseif ( 'json' === $response_format ) { 45 45 echo wp_json_encode( 46 46 array( … … 56 56 if ( isset( $request['ID'] ) ) { 57 57 $object_id = (int) $request['ID']; 58 if ( 'markup' == $response_format ) {58 if ( 'markup' === $response_format ) { 59 59 echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_term( $object_id, $object_type ) ) ), 0, (object) $args ); 60 } elseif ( 'json' == $response_format ) {60 } elseif ( 'json' === $response_format ) { 61 61 $post_obj = get_term( $object_id, $object_type ); 62 62 echo wp_json_encode( … … 72 72 } 73 73 } elseif ( preg_match( '/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*\b)/', $type, $matches ) ) { 74 if ( 'posttype' == $matches[1] && get_post_type_object( $matches[2] ) ) {74 if ( 'posttype' === $matches[1] && get_post_type_object( $matches[2] ) ) { 75 75 $post_type_obj = _wp_nav_menu_meta_box_object( get_post_type_object( $matches[2] ) ); 76 76 $args = array_merge( … … 94 94 while ( $search_results_query->have_posts() ) { 95 95 $post = $search_results_query->next_post(); 96 if ( 'markup' == $response_format ) {96 if ( 'markup' === $response_format ) { 97 97 $var_by_ref = $post->ID; 98 98 echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_post( $var_by_ref ) ) ), 0, (object) $args ); 99 } elseif ( 'json' == $response_format ) {99 } elseif ( 'json' === $response_format ) { 100 100 echo wp_json_encode( 101 101 array( … … 108 108 } 109 109 } 110 } elseif ( 'taxonomy' == $matches[1] ) {110 } elseif ( 'taxonomy' === $matches[1] ) { 111 111 $terms = get_terms( 112 112 array( … … 121 121 } 122 122 foreach ( (array) $terms as $term ) { 123 if ( 'markup' == $response_format ) {123 if ( 'markup' === $response_format ) { 124 124 echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args ); 125 } elseif ( 'json' == $response_format ) {125 } elseif ( 'json' === $response_format ) { 126 126 echo wp_json_encode( 127 127 array( … … 232 232 $id = $post_type->name; 233 233 // Give pages a higher priority. 234 $priority = ( 'page' == $post_type->name ? 'core' : 'default' );234 $priority = ( 'page' === $post_type->name ? 'core' : 'default' ); 235 235 add_meta_box( "add-post-type-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type ); 236 236 } … … 369 369 */ 370 370 $important_pages = array(); 371 if ( 'page' == $post_type_name ) {371 if ( 'page' === $post_type_name ) { 372 372 $suppress_page_ids = array(); 373 373 374 374 // Insert Front Page or custom Home link. 375 $front_page = 'page' == get_option( 'show_on_front' ) ? (int) get_option( 'page_on_front' ) : 0;375 $front_page = 'page' === get_option( 'show_on_front' ) ? (int) get_option( 'page_on_front' ) : 0; 376 376 377 377 $front_page_obj = null; … … 401 401 402 402 // Insert Posts Page. 403 $posts_page = 'page' == get_option( 'show_on_front' ) ? (int) get_option( 'page_for_posts' ) : 0;403 $posts_page = 'page' === get_option( 'show_on_front' ) ? (int) get_option( 'page_for_posts' ) : 0; 404 404 405 405 if ( ! empty( $posts_page ) ) { … … 509 509 <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv"> 510 510 <ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs"> 511 <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>>511 <li <?php echo ( 'most-recent' === $current_tab ? ' class="tabs"' : '' ); ?>> 512 512 <a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-most-recent" href="<?php echo $most_recent_url; ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent"> 513 513 <?php _e( 'Most Recent' ); ?> 514 514 </a> 515 515 </li> 516 <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>516 <li <?php echo ( 'all' === $current_tab ? ' class="tabs"' : '' ); ?>> 517 517 <a class="nav-tab-link" data-type="<?php echo esc_attr( $post_type_name ); ?>-all" href="<?php echo $view_all_url; ?>#<?php echo $post_type_name; ?>-all"> 518 518 <?php _e( 'View All' ); ?> 519 519 </a> 520 520 </li> 521 <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>521 <li <?php echo ( 'search' === $current_tab ? ' class="tabs"' : '' ); ?>> 522 522 <a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-search" href="<?php echo $search_url; ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search"> 523 523 <?php _e( 'Search' ); ?> … … 526 526 </ul><!-- .posttype-tabs --> 527 527 528 <div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php echo ( 'most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php _e( 'Most Recent' ); ?>" tabindex="0">528 <div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php echo ( 'most-recent' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php _e( 'Most Recent' ); ?>" tabindex="0"> 529 529 <ul id="<?php echo $post_type_name; ?>checklist-most-recent" class="categorychecklist form-no-clear"> 530 530 <?php … … 561 561 </div><!-- /.tabs-panel --> 562 562 563 <div class="tabs-panel <?php echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search" role="region" aria-label="<?php echo $post_type->labels->search_items; ?>" tabindex="0">563 <div class="tabs-panel <?php echo ( 'search' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search" role="region" aria-label="<?php echo $post_type->labels->search_items; ?>" tabindex="0"> 564 564 <?php 565 565 if ( isset( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] ) ) { … … 599 599 </div><!-- /.tabs-panel --> 600 600 601 <div id="<?php echo $post_type_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $post_type->labels->all_items; ?>" tabindex="0">601 <div id="<?php echo $post_type_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php echo ( 'all' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $post_type->labels->all_items; ?>" tabindex="0"> 602 602 <?php if ( ! empty( $page_links ) ) : ?> 603 603 <div class="add-menu-item-pagelinks"> … … 796 796 <div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv"> 797 797 <ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs"> 798 <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>>798 <li <?php echo ( 'most-used' === $current_tab ? ' class="tabs"' : '' ); ?>> 799 799 <a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-pop" href="<?php echo $most_used_url; ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop"> 800 800 <?php echo esc_html( $taxonomy->labels->most_used ); ?> 801 801 </a> 802 802 </li> 803 <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>803 <li <?php echo ( 'all' === $current_tab ? ' class="tabs"' : '' ); ?>> 804 804 <a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-all" href="<?php echo $view_all_url; ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all"> 805 805 <?php _e( 'View All' ); ?> 806 806 </a> 807 807 </li> 808 <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>808 <li <?php echo ( 'search' === $current_tab ? ' class="tabs"' : '' ); ?>> 809 809 <a class="nav-tab-link" data-type="tabs-panel-search-taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>" href="<?php echo $search_url; ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>"> 810 810 <?php _e( 'Search' ); ?> … … 813 813 </ul><!-- .taxonomy-tabs --> 814 814 815 <div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php echo ( 'most-used' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $taxonomy->labels->most_used; ?>" tabindex="0">815 <div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php echo ( 'most-used' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $taxonomy->labels->most_used; ?>" tabindex="0"> 816 816 <ul id="<?php echo $taxonomy_name; ?>checklist-pop" class="categorychecklist form-no-clear" > 817 817 <?php … … 831 831 </div><!-- /.tabs-panel --> 832 832 833 <div id="tabs-panel-<?php echo $taxonomy_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $taxonomy->labels->all_items; ?>" tabindex="0">833 <div id="tabs-panel-<?php echo $taxonomy_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php echo ( 'all' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" role="region" aria-label="<?php echo $taxonomy->labels->all_items; ?>" tabindex="0"> 834 834 <?php if ( ! empty( $page_links ) ) : ?> 835 835 <div class="add-menu-item-pagelinks"> … … 850 850 </div><!-- /.tabs-panel --> 851 851 852 <div class="tabs-panel <?php echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>" role="region" aria-label="<?php echo $taxonomy->labels->search_items; ?>" tabindex="0">852 <div class="tabs-panel <?php echo ( 'search' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>" role="region" aria-label="<?php echo $taxonomy->labels->search_items; ?>" tabindex="0"> 853 853 <?php 854 854 if ( isset( $_REQUEST[ 'quick-search-taxonomy-' . $taxonomy_name ] ) ) { … … 932 932 in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ), true ) || 933 933 // Or it's not a custom menu item (but not the custom home page). 934 ! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) ||934 ! ( 'custom' === $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || 935 935 // Or it *is* a custom menu item that already exists. 936 936 ! empty( $_item_object_data['menu-item-db-id'] ) … … 988 988 if ( isset( $object->name ) ) { 989 989 990 if ( 'page' == $object->name ) {990 if ( 'page' === $object->name ) { 991 991 $object->_default_query = array( 992 992 'orderby' => 'menu_order title', … … 995 995 996 996 // Posts should show only published items. 997 } elseif ( 'post' == $object->name ) {997 } elseif ( 'post' === $object->name ) { 998 998 $object->_default_query = array( 999 999 'post_status' => 'publish', … … 1001 1001 1002 1002 // Categories should be in reverse chronological order. 1003 } elseif ( 'category' == $object->name ) {1003 } elseif ( 'category' === $object->name ) { 1004 1004 $object->_default_query = array( 1005 1005 'orderby' => 'id', … … 1067 1067 $some_invalid_menu_items = false; 1068 1068 foreach ( (array) $menu_items as $menu_item ) { 1069 if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status ) {1069 if ( isset( $menu_item->post_status ) && 'draft' === $menu_item->post_status ) { 1070 1070 $some_pending_menu_items = true; 1071 1071 } … … 1183 1183 1184 1184 // Menu item title can't be blank. 1185 if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' == $_POST['menu-item-title'][ $_key ] ) {1185 if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' === $_POST['menu-item-title'][ $_key ] ) { 1186 1186 continue; 1187 1187 }
Note: See TracChangeset
for help on using the changeset viewer.