<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16098] trunk/wp-includes: Kill the admin-bar directory.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16098">16098</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-10-30 06:40:04 +0000 (Sat, 30 Oct 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Kill the admin-bar directory. see <a href="http://trac.wordpress.org/ticket/14772">#14772</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesadminbarphp">trunk/wp-includes/admin-bar.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpincludesclasswpadminbarphp">trunk/wp-includes/class-wp-admin-bar.php</a></li>
<li><a href="#trunkwpincludesmsadminbarphp">trunk/wp-includes/ms-admin-bar.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li>trunk/wp-includes/admin-bar/</li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesadminbarphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/admin-bar.php (16097 => 16098)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/admin-bar.php        2010-10-30 06:14:15 UTC (rev 16097)
+++ trunk/wp-includes/admin-bar.php        2010-10-30 06:40:04 UTC (rev 16098)
</span><span class="lines">@@ -18,7 +18,7 @@
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         /* Load the admin bar class code ready for instantiation */
</span><del>-        require( ABSPATH . WPINC . '/admin-bar/admin-bar-class.php' );
</del><ins>+        require( ABSPATH . WPINC . '/class-wp-admin-bar.php' );
</ins><span class="cx"> 
</span><span class="cx">         /* Instantiate the admin bar */
</span><span class="cx">         $admin_bar_class = apply_filters( 'wp_admin_bar_class', 'WP_Admin_Bar' );
</span></span></pre></div>
<a id="trunkwpincludesclasswpadminbarphpfromrev16091trunkwpincludesadminbaradminbarclassphp"></a>
<div class="copfile"><h4>Copied: trunk/wp-includes/class-wp-admin-bar.php (from rev 16091, trunk/wp-includes/admin-bar/admin-bar-class.php) (0 => 16098)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-admin-bar.php                                (rev 0)
+++ trunk/wp-includes/class-wp-admin-bar.php        2010-10-30 06:40:04 UTC (rev 16098)
</span><span class="lines">@@ -0,0 +1,233 @@
</span><ins>+&lt;?php
+class WP_Admin_Bar {
+        var $changed_locale = false;
+        var $menu;
+        var $need_to_change_locale = false;
+        var $proto = 'http://';
+        var $user;
+
+        function initialize() {
+                /* Only load super admin menu code if the logged in user is a super admin */
+                if ( is_super_admin() ) {
+                        require( ABSPATH . WPINC . '/ms-admin-bar.php' );
+                }
+
+                /* Set the protocol used throughout this code */
+                if ( is_ssl() ) 
+                        $this-&gt;proto = 'https://';
+
+                $this-&gt;user = new stdClass;
+                $this-&gt;menu = new stdClass;
+
+                /* Populate settings we need for the menu based on the current user. */
+                $this-&gt;user-&gt;blogs = get_blogs_of_user( get_current_user_id() );
+                if ( is_multisite() ) {
+                        $this-&gt;user-&gt;active_blog = get_active_blog_for_user( get_current_user_id() );
+                        $this-&gt;user-&gt;domain = empty( $this-&gt;user-&gt;active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this-&gt;user-&gt;active_blog-&gt;blog_id ) );
+                        $this-&gt;user-&gt;account_domain = $this-&gt;user-&gt;domain;
+                } else {
+                        $this-&gt;user-&gt;active_blog = $this-&gt;user-&gt;blogs[get_current_blog_id()];
+                        $this-&gt;user-&gt;domain = trailingslashit( home_url() );
+                        $this-&gt;user-&gt;account_domain = $this-&gt;user-&gt;domain;
+                }
+                $this-&gt;user-&gt;locale = get_locale();
+
+                add_action( 'wp_head', 'wp_admin_bar_header' );
+                add_action( 'wp_head', 'wp_admin_body_style');
+
+                add_action( 'admin_head', 'wp_admin_bar_header' );
+                add_action( 'admin_head', 'wp_admin_body_style');
+
+                wp_enqueue_script( 'admin-bar' );
+                wp_enqueue_style( 'admin-bar' );
+
+                if ( is_super_admin() ) {
+                        wp_enqueue_style( 'super-admin-bar' );
+                }
+                
+                do_action( 'admin_bar_init' );
+        }
+
+        function add_menu( $args = array() ) {
+                $defaults = array(
+                        'title' =&gt; false,
+                        'href' =&gt; false,
+                        'parent' =&gt; false, // false for a root menu, pass the ID value for a submenu of that menu.
+                        'id' =&gt; false, // defaults to a sanitized title value.
+                        'meta' =&gt; false // array of any of the following options: array( 'html' =&gt; '', 'class' =&gt; '', 'onclick' =&gt; '', target =&gt; '' );
+                );
+
+                $r = wp_parse_args( $args, $defaults );
+                extract( $r, EXTR_SKIP );
+
+                if ( empty( $title ) )
+                        return false;
+
+                /* Make sure we have a valid ID */
+                if ( empty( $id ) )
+                        $id = esc_attr( sanitize_title( trim( $title ) ) );
+
+                if ( ! empty( $parent ) ) {
+                        /* Add the menu to the parent item */
+                        $child = array( 'id' =&gt; $id, 'title' =&gt; $title, 'href' =&gt; $href );
+
+                        if ( ! empty( $meta ) )
+                                $child['meta'] = $meta;
+
+                        $this-&gt;add_node( $parent, $this-&gt;menu, $child );
+                } else {
+                        /* Add the menu item */
+                        $this-&gt;menu-&gt;{$id} = array( 'title' =&gt; $title, 'href' =&gt; $href );
+
+                        if ( ! empty( $meta ) )
+                                $this-&gt;menu-&gt;{$id}['meta'] = $meta;
+                }
+        }
+
+        function remove_menu( $id ) {
+                return $this-&gt;remove_node( $id, $this-&gt;menu );
+        }
+
+        function render() {
+                ?&gt;
+                &lt;div id=&quot;wpadminbar&quot; class=&quot;snap_nopreview no-grav&quot;&gt;
+                        &lt;div class=&quot;quicklinks&quot;&gt;
+                                &lt;ul&gt;
+                                        &lt;?php foreach ( (array) $this-&gt;menu as $id =&gt; $menu_item ) : ?&gt;
+                                                &lt;?php $this-&gt;recursive_render( $id, $menu_item ) ?&gt;
+                                        &lt;?php endforeach; ?&gt;
+                                &lt;/ul&gt;
+                        &lt;/div&gt;
+
+                        &lt;div id=&quot;adminbarsearch-wrap&quot;&gt;
+                                &lt;form action=&quot;&lt;?php echo home_url(); ?&gt;&quot; method=&quot;get&quot; id=&quot;adminbarsearch&quot;&gt;
+                                        &lt;input class=&quot;adminbar-input&quot; name=&quot;s&quot; id=&quot;adminbar-search&quot; type=&quot;text&quot; title=&quot;&lt;?php esc_attr_e( 'Search' ); ?&gt;&quot; value=&quot;&quot; maxlength=&quot;150&quot; /&gt; 
+                                        &lt;button type=&quot;submit&quot; class=&quot;adminbar-button&quot;&gt;&lt;span&gt;&lt;?php _e('Search'); ?&gt;&lt;/span&gt;&lt;/button&gt;
+                                &lt;/form&gt;
+                        &lt;/div&gt;
+                &lt;/div&gt;
+
+                &lt;?php
+                /* Wipe the menu, might reduce memory usage, but probably not. */
+                $this-&gt;menu = null;
+        }
+
+        /* Helpers */
+        function recursive_render( $id, &amp;$menu_item ) { ?&gt;
+                &lt;?php $menuclass = ( ! empty( $menu_item['children'] ) ) ? 'menupop ' : ''; ?&gt;
+
+                &lt;li class=&quot;&lt;?php echo $menuclass . &quot;ab-$id&quot; ?&gt;&lt;?php 
+                        if ( ! empty( $menu_item['meta']['class'] ) ) : 
+                                echo ' ' . $menu_item['meta']['class'];
+                        endif; 
+                ?&gt;&quot;&gt;
+                        &lt;a href=&quot;&lt;?php echo strip_tags( $menu_item['href'] ) ?&gt;&quot;&lt;?php 
+                                if ( ! empty( $menu_item['meta']['onclick'] ) ) :
+                                        ?&gt; onclick=&quot;&lt;?php echo $menu_item['meta']['onclick']; ?&gt;&quot;&lt;?php 
+                                endif;
+                        if ( ! empty( $menu_item['meta']['target'] ) ) :
+                                ?&gt; target=&quot;&lt;?php echo $menu_item['meta']['target']; ?&gt;&quot;&lt;?php 
+                        endif; 
+                        
+                        ?&gt;&gt;&lt;?php 
+                        
+                        if ( ! empty( $menuclass ) ) : 
+                                ?&gt;&lt;span&gt;&lt;?php 
+                        endif; 
+                        
+                        echo $menu_item['title'];
+                        
+                        if ( ! empty( $menuclass ) ) : 
+                                ?&gt;&lt;/span&gt;&lt;?php 
+                        endif; 
+                        
+                        ?&gt;&lt;/a&gt;
+
+                        &lt;?php if ( ! empty( $menu_item['children'] ) ) : ?&gt;
+                        &lt;ul&gt;
+                                &lt;?php foreach ( $menu_item['children'] as $child_id =&gt; $child_menu_item ) : ?&gt;
+                                        &lt;?php $this-&gt;recursive_render( $child_id, $child_menu_item ); ?&gt;
+                                &lt;?php endforeach; ?&gt;
+                        &lt;/ul&gt;
+                        &lt;?php endif; ?&gt;
+
+                        &lt;?php if ( ! empty( $menu_item['meta']['html'] ) ) : ?&gt;
+                                &lt;?php echo $menu_item['meta']['html']; ?&gt;
+                        &lt;?php endif; ?&gt;
+                &lt;/li&gt;&lt;?php
+        }
+
+        function add_node( $parent_id, &amp;$menu, $child ) {
+                foreach( $menu as $id =&gt; &amp;$menu_item ) {
+                        if ( $parent_id == $id ) {
+                                $menu-&gt;{$parent_id}['children']-&gt;{$child['id']} = $child;
+                                $child = null;
+                                return true;
+                        }
+
+                        if ( ! empty( $menu-&gt;{$id}['children'] ) )
+                                $this-&gt;add_node( $parent_id, $menu-&gt;{$id}['children'], $child );
+                }
+                
+                $child = null;
+
+                return false;
+        }
+
+        function add_menus() {
+                add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_me_separator', 10 );
+                add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_my_account_menu', 20 );
+                add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_my_blogs_menu', 30 );
+                add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_edit_menu', 40 );
+                add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_new_content_menu', 50 );
+                add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_comments_menu', 60 );
+                add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_appearance_menu', 70 );
+                add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_updates_menu', 80 );
+                add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_shortlink_menu', 90 );
+
+                if ( is_multisite() &amp;&amp; is_super_admin() &amp;&amp; function_exists('wp_admin_bar_superadmin_settings_menu') )
+                        add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_superadmin_settings_menu', 1000 );
+
+                do_action('add_admin_bar_menus');
+        }
+
+        function remove_node( $id, &amp;$menu ) {
+                foreach( $menu as $menu_item_id =&gt; &amp;$menu_item ) {
+                        if ( $menu_item_id == $id ) {
+                                $menu_item = null;
+                                return true;
+                        }
+
+                        if ( ! empty( $menu-&gt;{$menu_item_id}['children'] ) )
+                                $this-&gt;remove_node( $id, $menu-&gt;{$menu_item_id}['children'] );
+                }
+
+                return false;
+        }
+
+        // TODO: Convert to a core feature for multisite or remove
+        function load_user_locale_translations() {
+                $this-&gt;need_to_change_locale = ( get_locale() != $this-&gt;user-&gt;locale );
+                if ( ! $this-&gt;need_to_change_locale ) 
+                        return;
+                /*
+                $this-&gt;previous_translations = get_translations_for_domain( 'default' );
+                $this-&gt;adminbar_locale_filter = lambda( '$_', '$GLOBALS[&quot;wp_admin_bar&quot;]-&gt;user-&gt;locale;' );
+                unload_textdomain( 'default' );
+                add_filter( 'locale', $this-&gt;adminbar_locale_filter );
+                load_default_textdomain();
+                $this-&gt;changed_locale = true;
+                */
+        }
+
+        function unload_user_locale_translations() {
+                global $l10n;
+                if ( ! $this-&gt;changed_locale ) 
+                        return;
+                /*
+                remove_filter( 'locale', $this-&gt;adminbar_locale_filter );
+                $l10n['default'] = &amp;$this-&gt;previous_translations;
+                */
+        }
+}
+?&gt;
</ins></span></pre></div>
<a id="trunkwpincludesmsadminbarphpfromrev16091trunkwpincludesadminbaradminbarsuperadminphp"></a>
<div class="copfile"><h4>Copied: trunk/wp-includes/ms-admin-bar.php (from rev 16091, trunk/wp-includes/admin-bar/admin-bar-superadmin.php) (0 => 16098)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-admin-bar.php                                (rev 0)
+++ trunk/wp-includes/ms-admin-bar.php        2010-10-30 06:40:04 UTC (rev 16098)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+&lt;?php
+
+/**
+ *
+ * Use the $wp_admin_bar global to add the super admin menu, providing admin options only visible to super admins.
+ */
+function wp_admin_bar_superadmin_settings_menu() {
+        global $wp_admin_bar, $current_blog, $current_user;
+
+        /* Add the main superadmin menu item */
+        $wp_admin_bar-&gt;add_menu( array(  'id' =&gt; 'superadmin', 'title' =&gt; '&amp;mu;', 'href' =&gt; '', 'meta' =&gt; array( 'class' =&gt; 'ab-sadmin' ), ) );
+
+        /* Get the settings we need for the current site */
+        $matureaction = $current_blog-&gt;mature ? 'unmatureblog' : 'matureblog';
+        $maturetext_confirm = $current_blog-&gt;mature ? 
+                sprintf( 
+                        esc_attr__( 'Are you sure you want to unmark %s as mature?' ),
+                        $current_blog-&gt;domain
+                ) : 
+                sprintf(
+                        esc_attr__( 'Are you sure you want to mark %s as mature?' ),
+                        $current_blog-&gt;domain
+                );
+
+        $suspendaction = $current_blog-&gt;spam ? 'unspamblog' : 'spamblog';
+        $suspendtext_confirm = $current_blog-&gt;spam ?
+                sprintf( 
+                        esc_attr__( 'Are you sure you want to unsuspend site %s?' ),
+                        $current_blog-&gt;domain
+                ) : 
+                sprintf(
+                        esc_attr__( 'Are you sure you want to suspend site %s?' ),
+                        $current_blog-&gt;domain
+                );
+                
+        $mature_url = network_admin_url( &quot;edit.php?action=confirm&amp;amp;action2={$matureaction}&amp;amp;id={$current_blog-&gt;blog_id}&amp;amp;msg=&quot; . urlencode( $maturetext_confirm ) );
+        $suspend_url = network_admin_url( &quot;edit.php?action=confirm&amp;amp;action2={$suspendaction}&amp;amp;id={$current_blog-&gt;blog_id}&amp;amp;msg=&quot; . urlencode( $suspendtext_confirm ) );
+
+        /* Add the submenu items to the Super Admin menu */
+        $wp_admin_bar-&gt;add_menu( array( 'parent' =&gt; 'superadmin', 'title' =&gt; __( 'Network Admin' ), 'href' =&gt; network_admin_url(), 'position' =&gt; 5, ) );
+        $wp_admin_bar-&gt;add_menu( array( 'parent' =&gt; 'superadmin', 'title' =&gt; __( 'Site Admin' ), 'href' =&gt; admin_url(), 'position' =&gt; 10, ) );
+        $wp_admin_bar-&gt;add_menu( array( 'parent' =&gt; 'superadmin', 'title' =&gt; __( 'Site Options' ), 'href' =&gt; network_admin_url( &quot;site-info.php?id={$current_blog-&gt;blog_id}&quot; ), 'position' =&gt; 30, ) );
+        $wp_admin_bar-&gt;add_menu( array( 'parent' =&gt; 'superadmin', 'title' =&gt; ( $current_blog-&gt;mature ? __('Unmark as mature') : __('Mark as mature') ), 'href' =&gt; $mature_url, 'position' =&gt; 50, ) );
+        $wp_admin_bar-&gt;add_menu( array( 'parent' =&gt; 'superadmin', 'title' =&gt; ( $current_blog-&gt;spam ? __('Unsuspend site') : __('Suspend site') ), 'href' =&gt; $suspend_url, 'position' =&gt; 80, ) );
+}
+
+?&gt;
</ins></span></pre>
</div>
</div>

</body>
</html>