title: In PHP how can I access a ":private" array in an object?
body: <p>Up until around 3.3beta1 items in the <code>WP_Admin_Bar Object</code> could be accessed using this type of syntax, for example to change the CSS class of one of the existing menu items:</p>
  
  <pre><code>$wp_admin_bar-&gt;menu-&gt;{'wp-logo'}['meta']['class'] = 'new-class';
  </code></pre>
  
  <p>When running <code>print_r($wp_admin_bar)</code> the output looked something like this:</p>
  
  <pre><code>WP_Admin_Bar Object
  (
      [menu] =&gt; stdClass Object
          (
              [my-account] =&gt; Array
                  (
  </code></pre>
  
  <p>However, around version <code>3.3beta2</code> the above syntax for changing a menu item's CSS class no longer works, and the output from <code>print_r($wp_admin_bar)</code> reveals a different structure for that object:</p>
  
  <pre><code>WP_Admin_Bar Object
  (
      [nodes:WP_Admin_Bar:private] =&gt; Array
          (
              [my-account] =&gt; stdClass Object
                  (
                      [id] =&gt; my-account
  
                  )
  </code></pre>
  
  <p>I realize that Wordpress may not want me fiddling with the menus this way, and if there was a more standardized way to do this I would love to use it, but as far as I know there are only two functions that are available to modify the admin bar, <code>add_menu_item</code> and <code>remove_menu_item</code>, and these do not give the flexibility to do things like changing the attributes of existing menu items.</p>
  
  <p>To confirm, I looked at <code>wp-includes/class-wp-admin-bar.php</code> it is clear that Wordpress has changed the way they define the variables.</p>
  
  <p>Old Class</p>
  
  <pre><code>class WP_Admin_Bar {
      var $menu;
      var $proto = 'http://';
      var $user;
  </code></pre>
  
  <p>New Class</p>
  
  <pre><code>class WP_Admin_Bar {
      private $nodes = array();
      private $root = array();
  
      public $proto = 'http://';
      public $user;
  </code></pre>
  
  <p>So my question is if I have access to the <code>global $wp_admin_bar</code> object, is there I way I can access the objects inside <code>nodes:WP_Admin_Bar:private</code>? And if not, is there another way to get to these objects, such as creating a new class that extends the <code>WP_Admin_Bar</code> class and then accessing the objects from there?</p>
  
  <p>ps: I'm trying to overcome this challenge without changing the core Wordpress files...</p>
  
  <p>Link to the file: <a href="http://phpxref.ftwr.co.uk/wordpress/nav.html?wp-includes/class-wp-admin-bar.php.source.html">http://phpxref.ftwr.co.uk/wordpress/nav.html?wp-includes/class-wp-admin-bar.php.source.html</a></p>