mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 21:00:21 +00:00
Replace array_shift() with reset() where appropriate for performance.
Props SergeyBiryukov. Fixes #31259. git-svn-id: https://develop.svn.wordpress.org/trunk@31829 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -94,7 +94,7 @@ foreach ( $menu as $id => $data ) {
|
||||
if ( empty($submenu[$data[2]]) )
|
||||
continue;
|
||||
$subs = $submenu[$data[2]];
|
||||
$first_sub = array_shift($subs);
|
||||
$first_sub = reset( $subs );
|
||||
$old_parent = $data[2];
|
||||
$new_parent = $first_sub[2];
|
||||
/*
|
||||
@@ -163,7 +163,7 @@ foreach ( $menu as $id => $data ) {
|
||||
*/
|
||||
if ( ! empty( $submenu[$data[2]] ) && 1 == count ( $submenu[$data[2]] ) ) {
|
||||
$subs = $submenu[$data[2]];
|
||||
$first_sub = array_shift($subs);
|
||||
$first_sub = reset( $subs );
|
||||
if ( $data[2] == $first_sub[2] )
|
||||
unset( $submenu[$data[2]] );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user