Changeset 47557 for trunk/src/wp-admin/nav-menus.php
- Timestamp:
- 04/09/2020 03:41:04 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/nav-menus.php
r47198 r47557 105 105 ) 106 106 ) { 107 108 $parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0; 107 if ( in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true ) ) { 108 $parent_db_id = (int) $menu_item_data['menu_item_parent']; 109 } else { 110 $parent_db_id = 0; 111 } 109 112 110 113 $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) ); … … 132 135 } elseif ( 133 136 ! empty( $menu_item_data['menu_item_parent'] ) && 134 in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids)137 in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true ) 135 138 ) { 136 139 $menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true ); … … 169 172 if ( 170 173 ! empty( $menu_item_data['menu_item_parent'] ) && 171 in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders )) &&174 in_array( (int) $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ), true ) && 172 175 isset( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) && 173 176 ( $menu_item_data['menu_item_parent'] == $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) 174 177 ) { 175 $parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0; 178 if ( in_array( (int) $menu_item_data['menu_item_parent'], $orders_to_dbids, true ) ) { 179 $parent_db_id = (int) $menu_item_data['menu_item_parent']; 180 } else { 181 $parent_db_id = 0; 182 } 183 176 184 $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) ); 177 185 … … 199 207 ) { 200 208 $_possible_parent_id = (int) get_post_meta( $orders_to_dbids[ $dbids_to_orders[ $parent_db_id ] - 1 ], '_menu_item_menu_item_parent', true ); 201 if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ) ) ) {209 if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ), true ) ) { 202 210 $menu_item_data['menu_item_parent'] = $_possible_parent_id; 203 211 } else { … … 226 234 empty( $menu_item_data['menu_order'] ) || 227 235 empty( $menu_item_data['menu_item_parent'] ) || 228 ! in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders )) ||236 ! in_array( (int) $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ), true ) || 229 237 empty( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] ) || 230 238 $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] != $menu_item_data['menu_item_parent'] … … 801 809 echo esc_html( $_nav_menu->truncated_name ); 802 810 803 if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) {811 if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations, true ) ) { 804 812 $locations_assigned_to_this_menu = array(); 805 foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) { 813 814 foreach ( array_keys( $menu_locations, $_nav_menu->term_id, true ) as $menu_location_key ) { 806 815 if ( isset( $locations[ $menu_location_key ] ) ) { 807 816 $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ]; … … 816 825 * @param int $locations Number of menu locations to list. Default 3. 817 826 */ 818 $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) ); 827 $locations_listed_per_menu = absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ); 828 829 $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, $locations_listed_per_menu ); 819 830 820 831 // Adds ellipses following the number of locations defined in $assigned_locations. … … 957 968 if ( ! isset( $auto_add ) ) { 958 969 $auto_add = get_option( 'nav_menu_options' ); 970 959 971 if ( ! isset( $auto_add['auto_add'] ) ) { 960 972 $auto_add = false; 961 } elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) ) {973 } elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'], true ) ) { 962 974 $auto_add = true; 963 975 } else {
Note: See TracChangeset
for help on using the changeset viewer.