WordPress.org

Make WordPress Core

Changeset 17184


Ignore:
Timestamp:
12/30/10 19:04:32 (4 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-admin-bar.php

    r16900 r17184  
    191191 
    192192    function remove_node( $id, &$menu ) { 
    193         foreach( $menu as $menu_item_id => &$menu_item ) { 
    194             if ( $menu_item_id == $id ) { 
    195                 $menu_item = null; 
    196                 return true; 
    197             } 
    198  
     193        if ( isset( $menu->$id ) ) { 
     194            unset( $menu->$id ); 
     195            return true; 
     196        } 
     197 
     198        foreach( $menu as $menu_item_id => $menu_item ) { 
    199199            if ( ! empty( $menu->{$menu_item_id}['children'] ) ) 
    200200                $this->remove_node( $id, $menu->{$menu_item_id}['children'] ); 
Note: See TracChangeset for help on using the changeset viewer.