Clean up admin bar node removal. Make it PHP4 safe and prevent display of blank spots. Props sorich87, SergeyBiryukov. fixes #16005

git-svn-id: http://svn.automattic.com/wordpress/trunk@17184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-12-30 19:04:32 +00:00
parent ade413d098
commit d0a0c31b1f
1 changed files with 5 additions and 5 deletions

View File

@ -190,12 +190,12 @@ class WP_Admin_Bar {
}
function remove_node( $id, &$menu ) {
foreach( $menu as $menu_item_id => &$menu_item ) {
if ( $menu_item_id == $id ) {
$menu_item = null;
return true;
}
if ( isset( $menu->$id ) ) {
unset( $menu->$id );
return true;
}
foreach( $menu as $menu_item_id => $menu_item ) {
if ( ! empty( $menu->{$menu_item_id}['children'] ) )
$this->remove_node( $id, $menu->{$menu_item_id}['children'] );
}