Changeset 35416
- Timestamp:
- 10/28/2015 06:05:05 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/menu.php
r35027 r35416 179 179 unset($id, $data, $subs, $first_sub); 180 180 181 // Remove any duplicated separators182 $separator_found = false;183 foreach ( $menu as $id => $data ) {184 if ( false !== strpos( $data[4], 'wp-menu-separator' ) ) {185 if ( ! $separator_found ) {186 $separator_found = true;187 } else {188 unset($menu[$id]);189 }190 } else {191 $separator_found = false;192 }193 }194 unset($id, $data);195 196 181 /** 197 182 * … … 319 304 } 320 305 306 // Prevent adjacent separators 307 $prev_menu_was_separator = false; 308 foreach ( $menu as $id => $data ) { 309 if ( false === stristr( $data[4], 'wp-menu-separator' ) ) { 310 311 // This item is not a separator, so falsey the toggler and do nothing 312 $prev_menu_was_separator = false; 313 } else { 314 315 // The previous item was a separator, so unset this one 316 if ( true === $prev_menu_was_separator ) { 317 unset( $menu[ $id ] ); 318 } 319 320 // This item is a separator, so truthy the toggler and move on 321 $prev_menu_was_separator = true; 322 } 323 } 324 unset( $id, $data, $prev_menu_was_separator ); 325 321 326 // Remove the last menu item if it is a separator. 322 327 $last_menu_key = array_keys( $menu );
Note: See TracChangeset
for help on using the changeset viewer.