<!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>[15671] trunk: Admin bar, first pass.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15671">15671</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-09-27 20:26:36 +0000 (Mon, 27 Sep 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Admin bar, first pass. see <a href="http://trac.wordpress.org/ticket/14772">#14772</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesmsfunctionsphp">trunk/wp-includes/ms-functions.php</a></li>
<li><a href="#trunkwpincludesuserphp">trunk/wp-includes/user.php</a></li>
<li><a href="#trunkwpsettingsphp">trunk/wp-settings.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/wp-includes/admin-bar/</li>
<li><a href="#trunkwpincludesadminbaradminbarclassphp">trunk/wp-includes/admin-bar/admin-bar-class.php</a></li>
<li><a href="#trunkwpincludesadminbaradminbarcssphp">trunk/wp-includes/admin-bar/admin-bar-css.php</a></li>
<li><a href="#trunkwpincludesadminbaradminbardebugphp">trunk/wp-includes/admin-bar/admin-bar-debug.php</a></li>
<li><a href="#trunkwpincludesadminbaradminbarsuperadminphp">trunk/wp-includes/admin-bar/admin-bar-superadmin.php</a></li>
<li><a href="#trunkwpincludesadminbarphp">trunk/wp-includes/admin-bar.php</a></li>
<li><a href="#trunkwpincludesimagesadminbarspritertlpng">trunk/wp-includes/images/admin-bar-sprite-rtl.png</a></li>
<li><a href="#trunkwpincludesimagesadminbarspritepng">trunk/wp-includes/images/admin-bar-sprite.png</a></li>
<li><a href="#trunkwpincludesimageswpminibluepng">trunk/wp-includes/images/wpmini-blue.png</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesadminbaradminbarclassphp"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/admin-bar/admin-bar-class.php (0 => 15671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/admin-bar/admin-bar-class.php         (rev 0)
+++ trunk/wp-includes/admin-bar/admin-bar-class.php        2010-09-27 20:26:36 UTC (rev 15671)
</span><span class="lines">@@ -0,0 +1,168 @@
</span><ins>+<?php
+class WP_Admin_Bar {
+        var $user;
+        var $menu;
+        var $need_to_change_locale = false;
+        var $changed_locale = false;
+
+        function WP_Admin_Bar() {
+                global $current_user, $blog_id;
+
+                $this->user = new stdClass;
+                $this->menu = new stdClass;
+
+                /* Populate settings we need for the menu based on the current user. */
+                $this->user->blogs = get_ordered_blogs_of_user( $current_user->id );
+                if ( is_multisite() ) {
+                        $this->user->active_blog = get_active_blog_for_user( $current_user->id );
+                        $this->user->domain = ( $this->user->active_blog == 'username only' ) ? get_dashboard_blog() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) );
+                        $this->user->account_domain = $this->user->domain;
+                } else {
+                        $this->user->active_blog = $this->user->blogs[$blog_id];
+                        $this->user->domain = home_url();
+                        $this->user->account_domain = home_url();
+                }
+                $this->user->locale = get_locale();
+        }
+
+        function add_menu( $args = array() ) {
+                $defaults = array(
+                        'title' => false,
+                        'href' => false,
+                        'parent' => false, // false for a root menu, pass the ID value for a submenu of that menu.
+                        'id' => false, // defaults to a sanitized title value.
+                        'meta' => false // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '' );
+                );
+
+                $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' => $id,
+                                'title' => $title,
+                                'href' => $href
+                        );
+
+                        if ( !empty( $meta ) )
+                                $child['meta'] = $meta;
+
+                        $this->add_node( $parent, $this->menu, $child );
+                } else {
+                        /* Add the menu item */
+                        $this->menu->{$id} = array(
+                                'title' => $title,
+                                'href' => $href
+                        );
+
+                        if ( !empty( $meta ) )
+                                $this->menu->{$id}['meta'] = $meta;
+                }
+        }
+
+        function remove_menu( $id ) {
+                return $this->remove_node( $id, $this->menu );
+        }
+        
+        function render() {
+        ?>
+                <div id="wpadminbar" class="snap_nopreview no-grav">
+                        <div class="quicklinks">
+                                <ul>
+                                        <?php foreach ( (array) $this->menu as $id => $menu_item ) : ?>
+                                                <?php $this->recursive_render( $id, $menu_item ) ?>
+                                        <?php endforeach; ?>
+                                </ul>
+                        </div>
+
+                        <div id="adminbarsearch-wrap">
+                                <form action="<?php echo home_url(); ?>" method="get" id="adminbarsearch">
+                                        <input class="adminbar-input" name="s" id="s" type="text" value="<?php esc_attr_e( 'Search' ); ?>" maxlength="150" onfocus="this.value=(this.value=='<?php esc_attr_e( 'Search' ); ?>') ? '' : this.value;" onblur="this.value=(this.value=='') ? '<?php esc_attr_e( 'Search' ); ?>' : this.value;" /> <button type="submit" class="adminbar-button"><span><?php _e('Search'); ?></span></button>
+                                </form>
+                        </div>
+                </div>
+
+                <?php
+                /* Wipe the menu, might reduce memory usage, but probably not. */
+                $this->menu = null;
+        }
+
+        /* Helpers */
+        function recursive_render( $id, &$menu_item ) { ?>
+                <?php $menuclass = ( !empty( $menu_item['children'] ) ) ? 'menupop ' : ''; ?>
+
+                <li class="<?php echo $menuclass . "ab-$id" ?><?php if ( !empty( $menu_item['meta']['class'] ) ) : ?><?php echo ' ' . $menu_item['meta']['class'] ?><?php endif; ?>">
+                        <a href="<?php echo strip_tags( $menu_item['href'] ) ?>"<?php if ( !empty( $menu_item['meta']['onclick'] ) ) :?>onclick="<?php echo $menu_item['meta']['onclick'] ?>"<?php endif; ?><?php if ( !empty( $menu_item['meta']['target'] ) ) :?>target="<?php echo $menu_item['meta']['target'] ?>"<?php endif; ?>><?php if ( !empty( $menuclass ) ) : ?><span><?php endif; ?><?php echo $menu_item['title'] ?><?php if ( !empty( $menuclass ) ) : ?></span><?php endif; ?></a>
+
+                        <?php if ( !empty( $menu_item['children'] ) ) : ?>
+                        <ul>
+                                <?php foreach ( $menu_item['children'] as $child_id => $child_menu_item ) : ?>
+                                        <?php $this->recursive_render( $child_id, $child_menu_item ); ?>
+                                <?php endforeach; ?>
+                        </ul>
+                        <?php endif; ?>
+
+                        <?php if ( !empty( $menu_item['meta']['html'] ) ) : ?>
+                                <?php echo $menu_item['meta']['html']; ?>
+                        <?php endif; ?>
+                </li><?php
+        }
+
+        function add_node( $parent_id, &$menu, $child ) {
+                foreach( $menu as $id => &$menu_item ) {
+                        if ( $parent_id == $id ) {
+                                $menu->{$parent_id}['children']->{$child['id']} = $child;
+                                $child = null;
+                                return true;
+                        }
+
+                        if ( !empty( $menu->{$id}['children'] ) )
+                                $this->add_node( $parent_id, $menu->{$id}['children'], $child );
+                }
+                $child = null;
+
+                return false;
+        }
+
+        function remove_node( $id, &$menu ) {
+                foreach( $menu as $menu_item_id => &$menu_item ) {
+                        if ( $menu_item_id == $id ) {
+                                $menu_item = null;
+                                return true;
+                        }
+
+                        if ( !empty( $menu->{$menu_item_id}['children'] ) )
+                                $this->remove_node( $id, $menu->{$menu_item_id}['children'] );
+                }
+
+                return false;
+        }
+
+        function load_user_locale_translations() {
+                $this->need_to_change_locale = ( get_locale() != $this->user->locale );
+                if ( !$this->need_to_change_locale ) return;
+                $this->previous_translations = get_translations_for_domain( 'default' );
+                $this->adminbar_locale_filter = lambda( '$_', '$GLOBALS["wp_admin_bar"]->user->locale;' );
+                unload_textdomain( 'default' );
+                add_filter( 'locale', $this->adminbar_locale_filter );
+                load_default_textdomain();
+                $this->changed_locale = true;
+        }
+
+        function unload_user_locale_translations() {
+                global $l10n;
+                if ( !$this->changed_locale ) return;
+                remove_filter( 'locale', $this->adminbar_locale_filter );
+                $l10n['default'] = &$this->previous_translations;
+
+        }
+}
+?>
</ins><span class="cx">Property changes on: trunk/wp-includes/admin-bar/admin-bar-class.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx"> + native
</span></span></pre></div>
<a id="trunkwpincludesadminbaradminbarcssphp"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/admin-bar/admin-bar-css.php (0 => 15671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/admin-bar/admin-bar-css.php         (rev 0)
+++ trunk/wp-includes/admin-bar/admin-bar-css.php        2010-09-27 20:26:36 UTC (rev 15671)
</span><span class="lines">@@ -0,0 +1,453 @@
</span><ins>+<?php
+        header( 'Content-type: text/css' );
+        $proto = ( empty( $_GET['p'] ) ) ? 'http://' : 'https://';
+        $text_direction = $_GET['td'];
+        if ( 'ltr' == $text_direction || empty( $_GET['td'] ) )
+                $sprite = $_GET['inc'] . 'images/admin-bar-sprite.png?d=08102010';
+        else
+                $sprite = $_GET['inc'] . 'images/admin-bar-sprite-rtl.png?d=08102010';
+?>
+
+#wpadminbar { direction:ltr; background:#666 url(<?php echo $sprite; ?>) 0 -222px repeat-x; color:#ddd; font:12px Arial, Helvetica, sans-serif; height:28px; left:0; margin:0; position:fixed; top:0; width:100%; z-index:99999; min-width: 960px; }
+#wpadminbar ul, #wpadminbar ul li { position: relative; z-index: 99999; }
+#wpadminbar ul li img { vertical-align: middle !important; margin-right: 8px !important; border: none !important; padding: 0 !important; }
+#wpadminbar .quicklinks > ul > li > a { border-right: 1px solid #686868; border-left: 1px solid #808080; }
+#wpadminbar .quicklinks > ul > li.ab-subscriptions > a, #wpadminbar .quicklinks > ul > li:last-child > a { border-right: none; }
+#wpadminbar .quicklinks > ul > li.hover > a { border-left-color: #707070; }
+#wpadminbar a { outline: none; }
+#wpadminbar .avatar {border:1px solid #999 !important;padding:0 !important;margin:-3px 5px 0 0 !important;vertical-align:middle;float:none;display:inline !important; }
+#wpadminbar .menupop ul li a {color:#555 !important;text-shadow:none;font-weight:normal;white-space:nowrap;}
+#wpadminbar .menupop a > span {background:url(<?php echo $sprite; ?>) 100% 100.4% no-repeat;padding-right:.8em;line-height: 28px;}
+#wpadminbar .menupop ul li a > span { display: block; background:url(<?php echo $sprite; ?>) 100% 97.2% no-repeat;padding-right:1.5em;line-height: 28px;}
+#wpadminbar .menupop ul li a span#awaiting-mod { display: inline; background: #aaa; color: #fff; padding: 1px 5px; font-size: 10px; font-family: verdana; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }
+#wpadminbar .menupop ul li a:hover span#awaiting-mod { background: #fff; color: #888; }
+#wpadminbar .menupop ul {-moz-box-shadow:0 4px 8px rgba(0,0,0,0.1);-webkit-box-shadow:0 4px 8px rgba(0,0,0,0.1);background:#fff;display:none;position:absolute;border:1px solid #dfdfdf;border-top:none !important;float:none}
+html>body #wpadminbar .menupop ul {background:rgba(255,255,255,0.97);border-color:rgba(0,0,0,0.1);}
+#wpadminbar .menupop.ab-my-account ul, #wpadminbar .menupop.ab-my-dash ul, #wpadminbar .menupop.ab-new-post ul {min-width:140px}
+#wpadminbar .menupop li {float:none;margin:0;padding:0;background-image:none;}
+#wpadminbar .quicklinks a {border:none;color:#ddd !important;text-shadow:#555 0px -1px 0px;display:block;font:13px Arial, Helvetica, sans-serif;font-weight:normal;letter-spacing:normal;padding:0 0.85em;line-height:28px;text-decoration:none !important;}
+#wpadminbar .quicklinks a:hover {text-shadow:#333 0px -1px 0px;}
+#wpadminbar li.ab-privacy { float: right; background: #333; }
+#wpadminbar li.ab-privacy > a > span { background: none; padding: 0; }
+#wpadminbar li.ab-privacy span#priv-icon { display: block; text-indent: -999em; background:url(<?php echo $sprite; ?>) 40% 59.7% no-repeat; padding: 0; width: 13px; margin-right: -3px; }
+
+#wpadminbar li.ab-sadmin { float: right; background: #555 }
+#wpadminbar li.ab-sadmin ul, #wpadminbar li.ab-privacy ul { right: 0; float: right; }
+#wpadminbar li.ab-sadmin > a { font-size: 11px !important; padding: 0 7px !important; border: none !important; border-left: 1px solid #666 !important; }
+
+#wpadminbar li.ab-sadmin ul a, #wpadminbar li.ab-privacy a { border-right: none !important; border-left: none !important; }
+#wpadminbar li.ab-sadmin ul li { right: 0; float: right; text-align: left; width: 100%; }
+#wpadminbar li.ab-sadmin ul li a { padding-left: 1.75em; }
+#wpadminbar li.ab-sadmin ul li a > span { background:url(<?php echo $sprite; ?>) 0% 101.8% no-repeat;padding-left: 1.25em; margin-left: -1.25em; line-height: 28px; padding-right: 0 !important; }
+#wpadminbar li a.loading { background: url(</ajax-loader.gif) 10px 50% no-repeat !important; padding-left: 29px; }
+#wpadminbar li.subscribed a strong { background:url(<?php echo $sprite; ?>) 32% 59.8% no-repeat !important; text-indent: -999em; overflow: hidden; padding: 0 16px 0 0; height: 28px; display: block; float: left; margin-right: 2px; }
+
+#wpadminbar li:hover {background: #555 url(<?php echo $sprite; ?>) 0 -282px repeat-x;}
+#wpadminbar li li:hover { color:#fff !important; background: #888 url(<?php echo $sprite; ?>) 0 -222px repeat-x !important;text-shadow: #666 0px -1px 0px;}
+#wpadminbar li li:hover > a { color:#fff !important; }
+.quicklinks ul {list-style:none;margin:0;padding:0;text-align:left}
+.quicklinks ul li {float:left;margin:0}
+
+#adminbarlogin {float:left;display:inline;}
+
+#adminbarsearch {float:right; }
+#adminbarsearch {height: 18px;padding: 3px;}
+#adminbarsearch * {color: #555;font-size:12px;}
+#adminbarsearch label, #adminbarsearch a { height: 28px; color: #ccc; display:block;float:left;padding:3px 4px;text-shadow:0px -1px 0px #444;}
+#adminbarsearch a {text-decoration:underline;}
+#adminbarsearch a:hover {color:#fff;}
+
+#wpadminbar li.ab-me:hover, #wpadminbar li.ab-blog:hover { background:none;}
+#wpadminbar li.ab-me > a, #wpadminbar li.ab-blog > a { line-height: 18px !important; border: none !important; background:url(<?php echo $sprite; ?>) 100% 59.8% no-repeat; height: 28px; padding: 0 1.15em 0 0.7em; }
+#wpadminbar li.ab-me > a.hover, #wpadminbar li.ab-blog > a.hover { background-position: 67% 59.8%; }
+#wpadminbar li.ab-me img.avatar, #wpadminbar li.ab-blog img.avatar { margin: 4px 0 0 0 !important; vertical-align: middle; background: #eee; width: 16px !important; height: 16px !important; }
+#wpadminbar li.ab-my-account a, #wpadminbar li.ab-bloginfo a { border-left: none !important; padding-left: 0.7em !important; margin-top: 0 !important; }
+#wpadminbar li.ab-my-account > ul, #wpadminbar li.ab-bloginfo > ul { left: -7px; }
+#wpadminbar ul li img { width: 16px !important; height: 16px !important; }
+
+#wpadminbar ul li a strong.count { text-shadow: none; background: #ddd; color: #555; margin-left: 5px; padding: 1px 6px; top: -1px; position: relative; font-size: 9px; -moz-border-radius: 7px; -webkit-border-radius: 7px; border-radius: 7px; font-weight: normal }
+
+#wpadminbar #q {
+        line-height:normal !important;
+        width:140px !important;
+        margin-top:0px !important;
+}
+.adminbar-input {
+        display:block !important;
+        float:left !important;
+        font:12px Arial,Helvetica,sans-serif !important;
+        border:1px solid #626262 !important;
+        padding:2px 3px !important;
+        margin-right:3px !important;
+        background:#ddd url(<?php echo $sprite; ?>) top left no-repeat !important;
+        -webkit-border-radius:0 !important;
+        -khtml-border-radius:0 !important;
+        -moz-border-radius:0 !important;
+        border-radius:0 !important;
+        outline:none;
+        text-shadow:0 1px 0 #fff;
+}
+button.adminbar-button {
+        position:relative;
+        border:0;
+        cursor:pointer;
+        overflow:visible;
+        margin:0 !important;
+        float:left;
+        background:url(<?php echo $sprite; ?>) right -107px no-repeat;
+        padding:0 14px 0 0;
+        text-align:center;
+}
+button.adminbar-button span {
+        position:relative;
+        display:block;
+        white-space:nowrap;
+        height:19px;
+        background:url(<?php echo $sprite; ?>) left -69px no-repeat;
+        padding:3px 0 0 14px;
+        font:12px Arial,Helvetica,sans-serif !important;
+        font-weight:bold !important;
+        color:#444 !important;
+        text-shadow:0px 1px 0px #eee !important;
+}
+button.adminbar-button:active {
+        background-position:right -184px !important;
+        text-shadow:0px 1px 0px #eee !important;
+}
+button.adminbar-button:hover span {
+        color:#000 !important;
+}
+button.adminbar-button:active span {
+        background-position:left -146px !important;
+}
+button.adminbar-button::-moz-focus-inner {
+        border:none;
+}
+@media screen and (-webkit-min-device-pixel-ratio:0) {
+        button.adminbar-button span {
+                margin-top: -1px;
+        }
+}
+
+<?php if ( 'rtl' == $text_direction ) : ?>
+        #wpadminbar {
+                direction:rtl;
+                font-family: Tahoma, Arial ,sans-serif;
+                right:0;
+                left:auto;
+        }
+        #wpadminbar div, #wpadminbar ul, #wpadminbar ul li {
+                min-height: 0;
+        }
+        #wpadminbar ul li img { margin-left: 8px !important; margin-right: 0 !important; }
+        #wpadminbar .quicklinks > ul > li > a { border-left: 1px solid #686868; border-right: 1px solid #808080;}
+        #wpadminbar .quicklinks > ul > li.ab-subscriptions > a, #wpadminbar .quicklinks > ul > li:last-child > a { border-left: none; border-right: 1px solid #808080;}
+        #wpadminbar .quicklinks > ul > li.hover > a { border-right-color: #707070; border-left-color: #686868; }
+        #wpadminbar .avatar {margin: -3px 0 0 5px !important; float:none; }
+        #wpadminbar .menupop a > span {background-position: 0 100.4%; padding-left:.8em;}
+        #wpadminbar .menupop ul li a > span { background-position: 0% 97.2%; padding-right:0;padding-left:1.5em }
+        #wpadminbar .menupop ul {right: 0; width:100%; min-width:150px;}
+        #wpadminbar .ab-my-account ul { width:200px;}
+        #wpadminbar .ab-my-blogs ul { width:300px;}
+        #wpadminbar .ab-my-blogs ul ul { width:200px;}
+        #wpadminbar .ab-subscribe ul { width:150px;}
+        #wpadminbar .ab-bloginfo ul { width:200px;}
+        #wpadminbar .ab-subscribe ul { width:150px;}
+        #wpadminbar .ab-subscriptions ul { width:200px;}
+        #wpadminbar .menupop ul li {width:auto}
+        #wpadminbar .quicklinks a {font-family: Tahoma, Arial, Helvetica, sans-serif;}
+        #wpadminbar li.ab-privacy { float: left; }
+        #wpadminbar li.ab-privacy span#priv-icon { text-indent: 999em; background-position: 60% 59.7%; padding: 0; margin-right: 0; margin-left: -3px;}
+
+        #wpadminbar li.ab-sadmin { float: left; }
+        #wpadminbar li.ab-sadmin ul, #wpadminbar li.ab-privacy ul { right: auto; left: 0; float: left; }
+        #wpadminbar li.ab-sadmin > a { border-right: 1px solid #666 !important; border-left:none !important;}
+
+        #wpadminbar li.ab-sadmin ul a, #wpadminbar li.ab-privacy a { border-right: none !important; border-left: none !important; }
+        #wpadminbar li.ab-sadmin ul li { left: 0; right:auto; float: left; text-align: right; }
+
+
+        #wpadminbar li.ab-sadmin ul li a { padding-right: 1.75em; padding-left: 0 }
+        #wpadminbar li.ab-sadmin ul li a > span { background-position: 100% 101.8%; padding-right: 1.25em !important; padding-left: 0 !important; margin-right: -1.25em; margin-left: 0; }
+        #wpadminbar li a.loading { background-position: right 50% !important; padding-right: 29px; padding-left: 0;}
+        #wpadminbar li.subscribed a strong { background-position: 68% 59.8% !important; padding: 0 0 0 16px; float: right; margin-left: 2px; }
+
+
+        .quicklinks ul {text-align:right}
+        .quicklinks ul li {float:right;}
+
+        #adminbarlogin {float:right;}
+
+        #adminbarsearch {display:none;}
+        #adminbarsearch label, #adminbarsearch a { float:right;}
+
+        #wpadminbar li.ab-me > a, #wpadminbar li.ab-blog > a { background-position:0% 59.8%; padding: 0 0.7em 0 1.15em; }
+        #wpadminbar li.ab-me > a.hover, #wpadminbar li.ab-blog > a.hover { background-position: 33% 59.8%; }
+        #wpadminbar li.ab-my-account a, #wpadminbar li.ab-bloginfo a { border-right: none !important; padding-right: 0.7em !important; }
+        #wpadminbar li.ab-my-account > ul, #wpadminbar li.ab-bloginfo > ul { right: -7px; left:auto;}
+
+        #wpadminbar ul li a strong.count { margin-right: 5px; margin-left: 0; position:static}
+
+
+        .adminbar-input {
+                float:right !important;
+                font-family: Tahoma, Arial,Helvetica,sans-serif !important;
+                margin-right:3px !important;
+                margin-left:0 !important;
+                background-position: right top !important;
+        }
+        button.adminbar-button {
+                float:right;
+                background-position: left -107px;
+                padding:0 0 0 14px;
+        }
+        button.adminbar-button span {
+                background-position: right -69px;
+                padding:3px 14px 0 0;
+                font-family: Tahoma, Arial,Helvetica,sans-serif !important;
+        }
+        button.adminbar-button:active {
+                background-position:left -184px !important;
+        }
+        button.adminbar-button:active span {
+                background-position:right -146px !important;
+        }
+<?php
+endif;
+
+$current_theme = str_replace( '+', ' ', $_GET['t'] );
+$is_admin = $_GET['a'];
+$is_super_admin = $_GET['sa'];
+
+if ( ( empty($_GET['nobump']) || $is_admin ) && !strpos( $_SERVER['REQUEST_URI'], 'media-upload.php' ) ) : ?>
+        body { padding-top: 28px !important; }
+<?php endif; ?>
+
+<?php if ( in_array( $current_theme, array('H3', 'H4', 'The Journalist v1.9') ) ) { ?>
+        body { padding-top: 28px; background-position: 0px 28px; }
+<?php } ?>
+
+<?php if ( $is_super_admin ) : ?>
+        #querylist {
+                font-family: Arial, Tahoma, sans-serif;
+                display: none;
+                position: absolute;
+                top: 50px;
+                left: 50px;
+                right: 50px;
+                background: #fff;
+                padding: 20px;
+                -moz-box-shadow: 0 0 15px #888;
+                -webkit-box-shadow: 0 0 15px #888;
+                box-shadow: 0 0 15px #888;
+                z-index: 99999;
+                border: 10px solid #f0f0f0;
+                color: #000;
+                line-height: 150% !important;
+        }
+        #querylist pre {
+                font-size: 12px;
+                padding: 10px;
+        }
+        
+        #querylist h1 {
+                font-family: georgia, times, serif;
+                text-align: center;
+                font-size: 24px;
+                padding: 20px 5px;
+                background: #eee;
+                color: #555;
+                margin: 0;
+        }
+        #querylist div#debug-status {
+                background: #ccc;
+                color: #fff;
+                overflow: hidden;
+                height: 21px;
+                font-size: 14px;
+                font-family: georgia, times, serif;
+                padding: 7px 15px;
+        }
+        #querylist .left { float: left; }
+        #querylist .right { float: right; }
+        
+        #querylist h1, #querylist h2, #querylist h3 {
+                font-weight: normal;
+        }
+        
+        #querylist ul.debug-menu-links {
+                clear: left;
+                background: #ccc;
+                padding: 10px 15px 0;
+                overflow: hidden;
+                list-style: none;
+                margin: 0;
+                padding: 0 0 0 15px;
+        }
+                #querylist ul.debug-menu-links li {
+                        float: left;
+                        margin-right: 10px;
+                        margin-bottom: 0 !important;
+                }
+                
+                #querylist ul.debug-menu-links li a {
+                        outline: none;
+                        display: block;
+                        padding: 5px 9px;
+                        margin-right: 0;
+                        background: #bbb;
+                        color: #fff !important;
+                        text-decoration: none !important;
+                        font-weight: normal;
+                        font-size: 12px;
+                        color: #555;
+                        -webkit-border-top-right-radius: 4px;                        
+                        -webkit-border-top-left-radius: 4px;
+                        -moz-border-radius-topright: 4px;
+                        -moz-border-radius-topleft: 4px;
+                }
+                        #querylist ul.debug-menu-links li.current a {
+                                background: #fff;
+                                color: #555 !important;
+                        }
+        
+        #querylist h2 {
+                float: left;
+                min-width: 150px;
+                border: 1px solid #eee;
+                padding: 5px 10px 15px;
+                clear: none; important;
+                text-align: center;
+                font-family: georgia, times, serif;
+                font-size: 28px;
+                margin: 15px 10px 15px 0 !important;
+        }
+                #querylist h2 span {
+                        font-size: 12px;
+                        color: #888;
+                        text-transform: uppercase;
+                        white-space: nowrap;
+                        display: block;
+                        margin-bottom: 5px;
+                }
+
+        #object-cache-stats h2 {
+                border: none;
+                float: none;
+                text-align: left;
+                font-size: 22px;
+                margin-bottom: 0;
+        }
+
+        #object-cache-stats ul.debug-menu-links {
+                padding: 0;
+                margin: 0;
+                background: none;
+        }
+                #object-cache-stats ul.debug-menu-links li {
+                        float: left;
+                        margin-bottom: 10px !important;
+                        background: none !important;
+                        border: 1px solid #eee !important;
+                        color: #555 !important;
+                }
+                        #object-cache-stats ul.debug-menu-links li.current a {
+                                background: #ccc !important;
+                                color: #fff !important;
+                                -webkit-border-top-right-radius: 0;                        
+                                -webkit-border-top-left-radius: 0;
+                                -moz-border-radius-topright: 0;
+                                -moz-border-radius-topleft: 0;
+                        }
+                        
+                        #object-cache-stats ul.debug-menu-links li a {
+                                background: none;
+                                color: #555 !important;
+                                overflow: hidden;
+                        }
+        
+        #querylist h3 {
+                margin-bottom: 15px;
+        }
+
+        #querylist ol#wpd-queries {
+                padding: 0 !important;
+                margin: 0 !important;
+                list-style: none;
+                clear: left;
+        }
+                #querylist ol#wpd-queries li {
+                        padding: 10px;
+                        background: #f0f0f0;
+                        margin: 0 0 10px 0;
+                }
+                        #querylist ol#wpd-queries li div.qdebug {
+                                background: #e8e8e8;
+                                margin: 10px -10px -10px -10px;
+                                padding: 5px 150px 5px 5px;
+                                font-size: 11px;
+                                position: relative;
+                                min-height: 20px;
+                        }
+                        
+                        #querylist ol#wpd-queries li div.qdebug span {
+                                position: absolute;
+                                right: 10px;
+                                top: 5px;
+                                white-space: nowrap;
+                        }
+        
+        #querylist a {
+                text-decoration: underline !important;
+                color: blue !important;
+        }
+        #querylist a:hover {
+                text-decoration: none !important;
+        }
+        #querylist .debug-menu-target {
+                display: none;
+        }
+        
+        #querylist ol {
+                font: 12px Monaco, "Courier New", Courier, Fixed !important;
+                line-height: 180% !important;
+        }
+        
+        #wpadminbar #admin-bar-micro ul li {
+                list-style-type: none;
+                position: relative;
+                margin: 0;
+                padding: 0;
+        }
+        #wpadminbar #admin-bar-micro ul ul, #wpadminbar #admin-bar-micro #awaiting-mod, #wpadminbar .ab-sadmin .count-0 {
+                display: none !important;
+        }
+        #wpadminbar #admin-bar-micro ul li:hover > ul {
+                display: block;
+                position: absolute;
+                top: -1px;
+                left: 100%;
+        }
+        #wpadminbar #admin-bar-micro li a {
+                display: block;
+                text-decoration: none;
+        }
+        #wpadminbar #admin-bar-micro li li a {
+                background: #ddd;
+        }
+        #wpadminbar #admin-bar-micro li li li a {
+                background: #fff;
+        }
+        
+        <?php if ( 'rtl' == $text_direction ) : ?>
+        
+                #querylist {
+                        direction: ltr;
+                }
+                
+                #wpadminbar #admin-bar-micro ul li:hover > ul {
+                        left: auto;
+                        right: 100%;
+                }
+        <?php endif; ?>
+<?php endif; ?>
</ins><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: trunk/wp-includes/admin-bar/admin-bar-css.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx"> + native
</span></span></pre></div>
<a id="trunkwpincludesadminbaradminbardebugphp"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/admin-bar/admin-bar-debug.php (0 => 15671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/admin-bar/admin-bar-debug.php         (rev 0)
+++ trunk/wp-includes/admin-bar/admin-bar-debug.php        2010-09-27 20:26:36 UTC (rev 15671)
</span><span class="lines">@@ -0,0 +1,161 @@
</span><ins>+<?php
+/***
+ * Debug Functions
+ *
+ * When logged in as a super admin, these functions will run to provide
+ * debugging information when specific super admin menu items are selected.
+ *
+ * They are not used when a regular user is logged in.
+ */
+
+function wp_admin_bar_debug_menu() {
+        global $wp_admin_bar, $wpdb;
+
+        if ( !is_super_admin() || !apply_filters('wp_admin_bar_enable_debug_menu', false) )
+                return;
+
+        $queries = $wpdb->num_queries;
+        $seconds = timer_stop();
+
+        /* Add the main siteadmin menu item */
+        $wp_admin_bar->add_menu( array( 'id' => 'queries', 'title' => "{$queries}q/{$seconds}", 'href' => 'javascript:toggle_query_list()', 'meta' => array( 'class' => 'ab-sadmin' ) ) );
+}
+add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_debug_menu', 1000 );
+
+function wp_admin_bar_query_debug_list() {
+        global $wpdb, $wp_object_cache;
+
+        if ( !is_super_admin() )
+                return false;
+
+        $debugs = array();
+
+        if ( defined('SAVEQUERIES') && SAVEQUERIES )
+                $debugs['wpdb'] = array( __('Queries'), 'wp_admin_bar_debug_queries' );
+
+        if ( is_object($wp_object_cache) && method_exists($wp_object_cache, 'stats') )
+                $debugs['object-cache'] = array( __('Object Cache'), 'wp_admin_bar_debug_object_cache' );
+
+        $debugs = apply_filters( 'wp_admin_bar_debugs_list', $debugs );
+
+        if ( empty($debugs) )
+                return;
+
+?>
+        <script type="text/javascript">
+        /* <![CDATA[ */
+        var clickDebugLink = function( targetsGroupId, obj) {
+                var sectionDivs = document.getElementById( targetsGroupId ).childNodes;
+                for ( var i = 0; i < sectionDivs.length; i++ ) {
+                        if ( 1 != sectionDivs[i].nodeType ) {
+                                continue;
+                        }
+                        sectionDivs[i].style.display = 'none';
+                }
+                document.getElementById( obj.href.substr( obj.href.indexOf( '#' ) + 1 ) ).style.display = 'block';
+
+                for ( var i = 0; i < obj.parentNode.parentNode.childNodes.length; i++ ) {
+                        if ( 1 != obj.parentNode.parentNode.childNodes[i].nodeType ) {
+                                continue;
+                        }
+                        obj.parentNode.parentNode.childNodes[i].removeAttribute( 'class' );
+                }
+                obj.parentNode.setAttribute( 'class', 'current' );
+                return false;
+        };
+        /* ]]> */
+        </script>
+        <div align='left' id='querylist'>
+
+        <h1>Debugging blog #<?php echo $GLOBALS['blog_id']; ?> on <?php echo php_uname( 'n' ); ?></h1>
+        <div id="debug-status">
+                <p class="left"></p>
+                <p class="right">PHP Version: <?php echo phpversion(); ?></p>
+        </div>
+        <ul class="debug-menu-links">
+
+<?php        $current = ' class="current"'; foreach ( $debugs as $debug => $debug_output ) : ?>
+
+                <li<?php echo $current; ?>><a id="debug-menu-link-<?php echo $debug; ?>" href="#debug-menu-target-<?php echo $debug; ?>" onclick="try { return clickDebugLink( 'debug-menu-targets', this ); } catch (e) { return true; }"><?php echo $debug_output[0] ?></a></li>
+
+<?php        $current = ''; endforeach; ?>
+
+        </ul>
+
+        <div id="debug-menu-targets">
+
+<?php        $current = ' style="display: block"'; foreach ( $debugs as $debug => $debug_output ) : ?>
+
+        <div id="debug-menu-target-<?php echo $debug; ?>" class="debug-menu-target"<?php echo $current; ?>>
+                <?php echo str_replace( '&nbsp;', '', call_user_func( $debug_output[1] ) ); ?>
+        </div>
+
+<?php        $current = ''; endforeach; ?>
+
+        </div>
+
+<?php        do_action( 'wp_admin_bar_debug' ); ?>
+
+        </div>
+
+<?php
+}
+add_action( 'wp_after_admin_bar_render', 'wp_admin_bar_query_debug_list' );
+
+function wp_admin_bar_debug_queries() {
+        global $wpdb;
+
+        $queries = array();
+        $out = '';
+        $total_time = 0;
+
+        if ( !empty($wpdb->queries) ) {
+                $show_many = isset($_GET['debug_queries']);
+
+                if ( $wpdb->num_queries > 500 && !$show_many )
+                        $out .= "<p>There are too many queries to show easily! <a href='" . add_query_arg( 'debug_queries', 'true' ) . "'>Show them anyway</a>.</p>";
+
+                $out .= '<ol id="wpd-queries">';
+                $first_query = 0;
+                $counter = 0;
+
+                foreach ( $wpdb->queries as $q ) {
+                        list($query, $elapsed, $debug) = $q;
+
+                        $total_time += $elapsed;
+
+                        if ( !$show_many && ++$counter > 500 )
+                                continue;
+
+                        $query = nl2br(esc_html($query));
+
+                        // $dbhname, $host, $port, $name, $tcp, $elapsed
+                        $out .= "<li>$query<br/><div class='qdebug'>$debug <span>#{$counter} (" . number_format(sprintf('%0.1f', $elapsed * 1000), 1, '.', ',') . "ms)</span></div></li>\n";
+                }
+                $out .= '</ol>';
+        } else {
+                $out .= "<p><strong>There are no queries on this page, you won the prize!!! :)</strong></p>";
+        }
+
+        $query_count = '<h2><span>Total Queries:</span>' . number_format( $wpdb->num_queries ) . "</h2>\n";
+        $query_time = '<h2><span>Total query time:</span>' . number_format(sprintf('%0.1f', $total_time * 1000), 1) . "ms</h2>\n";
+        $memory_usage = '<h2><span>Peak Memory Used:</span>' . number_format( memory_get_peak_usage( ) ) . " bytes</h2>\n";
+
+        $out = $query_count . $query_time . $memory_usage . $out;
+
+        return $out;
+}
+
+function wp_admin_bar_debug_object_cache() {
+        global $wp_object_cache;
+        ob_start();
+        echo "<div id='object-cache-stats'>";
+                $wp_object_cache->stats();
+        echo "</div>";
+        $out = ob_get_contents();
+        ob_end_clean();
+
+        return $out;
+}
+
+?>
</ins><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: trunk/wp-includes/admin-bar/admin-bar-debug.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx"> + native
</span></span></pre></div>
<a id="trunkwpincludesadminbaradminbarsuperadminphp"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/admin-bar/admin-bar-superadmin.php (0 => 15671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/admin-bar/admin-bar-superadmin.php         (rev 0)
+++ trunk/wp-includes/admin-bar/admin-bar-superadmin.php        2010-09-27 20:26:36 UTC (rev 15671)
</span><span class="lines">@@ -0,0 +1,156 @@
</span><ins>+<?php
+/**
+ * Use the $wp_admin_bar global to add a menu for site admins and administrator controls.
+ */
+function wp_admin_bar_superadmin_menus() {
+        global $wp_admin_bar, $wpdb;
+
+        if ( !is_object( $wp_admin_bar ) || !is_super_admin() )
+                return false;
+
+        /* Add the "Super Admin" settings sub menu */
+        if ( is_multisite() )
+                wp_admin_bar_superadmin_settings_menu();
+}
+add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_superadmin_menus', 1000 );
+
+/**
+ *
+ * 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;
+
+        if ( !is_object( $wp_admin_bar ) || !is_super_admin() )
+                return false;
+
+        /* Add the main superadmin menu item */
+        $wp_admin_bar->add_menu( array( 'id' => 'superadmin', 'title' => '&mu;', 'href' => '', 'meta' => array( 'class' => 'ab-sadmin' ) ) );
+
+        wp_admin_bar_build_snackmenu();
+
+        /* Get the settings we need for the current blog */
+        $matureaction = $current_blog->mature ? 'unmatureblog' : 'matureblog';
+        $maturetext = $current_blog->mature ? esc_attr__('Unmark as mature') : esc_attr__('Mark as mature');
+        $suspendtext = $current_blog->spam ? esc_attr('Unsuspend blog') : esc_attr('Suspend blog');
+        $suspendaction = $current_blog->spam ? 'unspamblog' : 'spamblog';
+        $mature_url = admin_url( "ms-edit.php?action=confirm&amp;action2={$matureaction}&amp;id={$current_blog->blog_id}&amp;msg=" . urlencode( 'Are you sure you want to ' . strtolower( $maturetext ) . " {$current_blog->domain} as mature?" ) );
+        $suspend_url = admin_url( "ms-edit.php?action=confirm&amp;action2={$suspendaction}&amp;id={$current_blog->blog_id}&amp;msg=" . urlencode( 'Are you sure you want to ' . strtolower( $suspendtext ) . " {$current_blog->domain} ?" ) );
+
+        /* Add the submenu items to the Super Admin menu */
+        $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => __( 'Blog Dashboard' ), 'href' => admin_url(), 'position' => 10 ) );
+        $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => __( 'Blog Options' ), 'href' => admin_url( "ms-sites.php?action=blogs&amp;searchaction=id&amp;s={$current_blog->blog_id}" ), 'position' => 30 ) );
+        $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => "$maturetext", 'href' => $mature_url, 'position' => 50 ) );
+        $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => "$suspendtext", 'href' => $suspend_url, 'position' => 80 ) );
+}
+
+function wp_admin_bar_build_snackmenu() {
+        global $wp_admin_bar, $menu, $submenu, $pagenow;
+
+        if ( !is_object( $wp_admin_bar ) || !is_super_admin() )
+                return false;
+
+        // Hide moderation count, filter removed at the bottom of this function
+        add_filter( 'wp_count_comments', 'wp_admin_bar_removemodcount' );
+
+        require_once( ABSPATH . 'wp-admin/includes/admin.php' );
+
+        // menu.php assumes it is in the global scope and relies on the $wp_taxonomies global array
+        $wp_taxonomies = array();
+        require_once( ABSPATH . 'wp-admin/menu.php' );
+
+        /* Add the snack menu submenu to the superadmin menu */
+        $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => 'Snack Menu', 'href' => '/wp-admin/' ) );
+
+        /* Loop through the submenus and add them */
+        foreach ( (array) $menu as $key => $item ) {
+                $admin_is_parent = false;
+                $submenu_as_parent = false;
+
+                if ( $submenu_as_parent && !empty($submenu[$item[2]]) ) {
+                        $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
+                        $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
+                        $menu_file = $submenu[$item[2]][0][2];
+        
+                        if ( false !== $pos = strpos($menu_file, '?') )
+                                $menu_file = substr($menu_file, 0, $pos);
+                        if ( ( ('index.php' != $submenu[$item[2]][0][2]) && file_exists(WP_PLUGIN_DIR . "/$menu_file") ) || !empty($menu_hook)) {
+                                $admin_is_parent = true;
+                                $wp_admin_bar->add_menu( array( 'parent' => 'snack-menu', 'title' => $item[0], 'href' => admin_url("admin.php?page={$submenu[$item[2]][0][2]}") ) );
+                        } else {
+                                $wp_admin_bar->add_menu( array( 'parent' => 'snack-menu', 'title' => $item[0], 'href' => admin_url("{$submenu[$item[2]][0][2]}") ) );
+                        }
+                } else if ( current_user_can($item[1]) ) {
+                        $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
+                        $menu_file = $item[2];
+
+                        if ( false !== $pos = strpos($menu_file, '?') )
+                                $menu_file = substr($menu_file, 0, $pos);
+                        if ( ('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR . "/$menu_file") || !empty($menu_hook) ) {
+                                $admin_is_parent = true;
+                                $wp_admin_bar->add_menu( array( 'parent' => 'snack-menu', 'title' => $item[0], 'href' => admin_url("admin.php?page={$item[2]}") ) );
+                        } else {
+                                $wp_admin_bar->add_menu( array( 'parent' => 'snack-menu', 'title' => $item[0], 'href' => admin_url("{$item[2]}") ) );
+                        }
+                }
+
+                if ( !empty($submenu[$item[2]]) ) {
+                        $first = true;
+                        $unique_submenu = array();
+                        
+                        foreach ( $submenu[$item[2]] as $sub_key => $sub_item ) {
+                                if ( !current_user_can($sub_item[1]) || in_array( $sub_item[0], $unique_submenu ) )
+                                        continue;
+                        
+                                $unique_submenu[] = $sub_item[0];
+                                
+                                if ( $first )
+                                        $first = false;
+                                
+                                $menu_file = $item[2];
+                                if ( false !== $pos = strpos($menu_file, '?') )
+                                        $menu_file = substr($menu_file, 0, $pos);
+                                
+                                $menu_hook = get_plugin_page_hook($sub_item[2], $item[2]);
+                                $sub_file = $sub_item[2];
+                                if ( false !== $pos = strpos($sub_file, '?') )
+                                        $sub_file = substr($sub_file, 0, $pos);
+                                
+                                if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/$sub_file") ) || ! empty($menu_hook) ) {
+                                        // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
+                                
+                                        $parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($menu_file);
+                                        if ( $parent_exists )
+                                                $wp_admin_bar->add_menu( array( 'parent' => sanitize_title( $item[0] ), 'title' => $sub_item[0], 'href' => admin_url("{$item[2]}?page={$sub_item[2]}") ) );
+                                        elseif ( 'admin.php' == $pagenow || !$parent_exists )
+                                                $wp_admin_bar->add_menu( array( 'parent' => sanitize_title( $item[0] ), 'title' => $sub_item[0], 'href' => admin_url("admin.php?page={$sub_item[2]}") ) );
+                                        else
+                                                $wp_admin_bar->add_menu( array( 'parent' => sanitize_title( $item[0] ), 'title' => $sub_item[0], 'href' => admin_url("{$item[2]}?page={$sub_item[2]}") ) );
+                                } else {
+                                        $wp_admin_bar->add_menu( array( 'parent' => sanitize_title( $item[0] ), 'title' => $sub_item[0], 'href' => admin_url("{$sub_item[2]}") ) );
+                                }
+                        }
+                }
+        }
+
+        remove_filter( 'wp_count_comments', 'wp_admin_bar_removemodcount' );
+}
+
+// Short circuits wp_count_comments() for the front end
+function wp_admin_bar_removemodcount( $stats ) {
+        if ( is_admin() )
+                return $stats;
+
+        $stats = array(
+                'moderated' => 0,
+                'approved' => 0,
+                'spam' => 0,
+                'trash' => 0,
+                'post-trashed' => 0,
+                'total_comments' => 0,
+        );
+
+        return (object) $stats;
+}
+
+?>
</ins><span class="cx">Property changes on: trunk/wp-includes/admin-bar/admin-bar-superadmin.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx"> + native
</span></span></pre></div>
<a id="trunkwpincludesadminbarphp"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/admin-bar.php (0 => 15671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/admin-bar.php         (rev 0)
+++ trunk/wp-includes/admin-bar.php        2010-09-27 20:26:36 UTC (rev 15671)
</span><span class="lines">@@ -0,0 +1,346 @@
</span><ins>+<?php
+/**
+ * Admin Bar
+ *
+ * This code handles the building and rendering of the press bar.
+ */
+
+/**
+ * Instantiate the admin bar class and set it up as a global for access elsewhere.
+ */
+function wp_admin_bar_init() {
+        global $current_user, $pagenow, $wp_admin_bar;
+
+        /* Set the protocol constant used throughout this code */
+        if ( !defined( 'PROTO' ) )
+                if ( is_ssl() ) define( 'PROTO', 'https://' ); else define( 'PROTO', 'http://' );
+
+        /* Don't load the admin bar if the user is not logged in, or we are using press this */
+        if ( !is_user_logged_in() || 'press-this.php' == $pagenow )
+                return false;
+
+        /* Set up the settings we need to render menu items */
+        if ( !is_object( $current_user ) )
+                $current_user = wp_get_current_user();
+
+        /* Enqueue the JS files for the admin bar. */
+        if ( is_user_logged_in() )
+                wp_enqueue_script( 'jquery', false, false, false, true );
+        
+        /* Load the admin bar class code ready for instantiation */
+        require( ABSPATH . WPINC . '/admin-bar/admin-bar-class.php' );
+
+        /* Only load super admin menu code if the logged in user is a super admin */
+        if ( is_super_admin() ) {
+                require( ABSPATH . WPINC . '/admin-bar/admin-bar-debug.php' );
+                require( ABSPATH . WPINC . '/admin-bar/admin-bar-superadmin.php' );
+        }
+
+        /* Initialize the admin bar */
+        $wp_admin_bar = new wp_admin_bar();
+}
+add_action( 'init', 'wp_admin_bar_init' );
+
+/**
+ * Render the admin bar to the page based on the $wp_admin_bar->menu member var.
+ * This is called very late on the footer actions so that it will render after anything else being
+ * added to the footer.
+ *
+ * It includes the action "wp_before_admin_bar_render" which should be used to hook in and
+ * add new menus to the admin bar. That way you can be sure that you are adding at most optimal point,
+ * right before the admin bar is rendered. This also gives you access to the $post global, among others.
+ */
+function wp_admin_bar_render() {
+        global $wp_admin_bar;
+
+        if ( !is_object( $wp_admin_bar ) )
+                return false;
+                
+        $wp_admin_bar->load_user_locale_translations();
+
+        do_action( 'wp_before_admin_bar_render' );
+
+        $wp_admin_bar->render();
+
+        do_action( 'wp_after_admin_bar_render' );
+        
+        $wp_admin_bar->unload_user_locale_translations();
+}
+add_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
+add_action( 'admin_footer', 'wp_admin_bar_render', 1000 );
+
+/**
+ * Show the logged in user's gravatar as a separator.
+ */
+function wp_admin_bar_me_separator() {
+        global $wp_admin_bar, $current_user;
+
+        if ( !is_object( $wp_admin_bar ) )
+                return false;
+
+        $wp_admin_bar->add_menu( array( 'id' => 'me', 'title' => get_avatar( $current_user->ID, 16 ), 'href' => $wp_admin_bar->user->account_domain . 'wp-admin/profile.php' ) );
+}
+add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_me_separator', 10 );
+
+/**
+ * Use the $wp_admin_bar global to add the "My Account" menu and all submenus.
+ */
+function wp_admin_bar_my_account_menu() {
+        global $wp_admin_bar, $current_user;
+
+        if ( !is_object( $wp_admin_bar ) )
+                return false;
+
+        /* Add the 'My Account' menu */
+        $wp_admin_bar->add_menu( array( 'id' => 'my-account', 'title' => __( 'My Account' ), 'href' => admin_url('profile.php') ) );
+
+        /* Add the "My Account" sub menus */
+        $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Edit My Profile' ), 'href' => admin_url('profile.php') ) );
+        $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Global Dashboard' ), 'href' => admin_url() ) );
+        $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Log Out' ), 'href' => wp_logout_url() ) );
+}
+add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_my_account_menu', 20 );
+
+/**
+ * Use the $wp_admin_bar global to add the "My Blogs/[Blog Name]" menu and all submenus.
+ */
+function wp_admin_bar_my_blogs_menu() {
+        global $wpdb, $wp_admin_bar;
+
+        if ( !is_object( $wp_admin_bar ) )
+                return false;
+
+        /* Remove the global dashboard */
+        if ( is_multisite() ) {
+                foreach ( (array) $wp_admin_bar->user->blogs as $key => $blog ) {
+                        if ( get_dashboard_blog() == $blog->domain )
+                                unset( $wp_admin_bar->user->blogs[$key] );
+                }
+        }
+
+        /* Add the 'My Dashboards' menu if the user has more than one blog. */
+        if ( count( $wp_admin_bar->user->blogs ) > 1 ) {
+                $wp_admin_bar->add_menu( array( 'id' => 'my-blogs', 'title' => __( 'My Blogs' ), 'href' => $wp_admin_bar->user->account_domain ) );
+
+                $default = includes_url('images/wpmini-blue.png');
+
+                $counter = 2;
+                foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {
+                        $blogdomain = preg_replace( '!^https?://!', '', $blog->siteurl );
+                        // @todo Replace with some favicon lookup.
+                        //$blavatar = '<img src="' . esc_url( blavatar_url( blavatar_domain( $blog->siteurl ), 'img', 16, $default ) ) . '" alt="Blavatar" width="16" height="16" />';
+                        $blavatar = '<img src="' . esc_url($default) . '" alt="Blavatar" width="16" height="16" />';;
+
+                        $marker = '';
+                        if ( strlen($blog->blogname) > 35 )
+                                $marker = '...';
+
+                        if ( empty( $blog->blogname ) )
+                                $blogname = $blog->domain;
+                        else
+                                $blogname = substr( $blog->blogname, 0, 35 ) . $marker;
+
+                        if ( !isset( $blog->visible ) || $blog->visible === true ) {
+                                $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-' . $blog->userblog_id, 'title' => $blavatar . $blogname, 'href' => constant( 'PROTO' ) . $blogdomain . '/wp-admin/' ) );
+                                $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-d', 'title' => __( 'Dashboard' ), 'href' => constant( 'PROTO' ) . $blogdomain . '/wp-admin/' ) );
+                                $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-n', 'title' => __( 'New Post' ), 'href' => constant( 'PROTO' ) . $blogdomain . '/wp-admin/post-new.php' ) );
+                                // @todo, stats plugins should add this:
+                                //$wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-s', 'title' => __( 'Blog Stats' ), 'href' => constant( 'PROTO' ) . $blogdomain . '/wp-admin/index.php?page=stats' ) );
+                                $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-c', 'title' => __( 'Manage Comments' ), 'href' => constant( 'PROTO' ) . $blogdomain . '/wp-admin/edit-comments.php' ) );
+                                $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-v', 'title' => __( 'Read Blog' ), 'href' => constant( 'PROTO' ) . $blogdomain ) );
+                        }
+                        $counter++;
+                }
+
+                /* Add the "Manage Blogs" menu item */
+                // @todo, use dashboard blog.
+                $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'manage-blogs', 'title' => __( 'Manage Blogs' ), admin_url('my-sites.php') ) );
+
+        /* Add the 'My Dashboard' menu if the user only has one blog. */
+        } else {
+                $wp_admin_bar->add_menu( array( 'id' => 'my-blogs', 'title' => __( 'My Blog' ), 'href' => $wp_admin_bar->user->account_domain ) );
+
+                $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-d', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
+                $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-n', 'title' => __( 'New Post' ), 'href' => admin_url('post-new.php') ) );
+                // @todo Stats plugins should add this.
+                //$wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-s', 'title' => __( 'Blog Stats' ), 'href' => admin_ur;('index.php?page=stats') ) );
+                $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-c', 'title' => __( 'Manage Comments' ), 'href' => admin_url('edit-comments.php') ) );
+                $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-v', 'title' => __( 'Read Blog' ), 'href' => home_url() ) );
+        }
+}
+add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_my_blogs_menu', 30 );
+
+/**
+ * Show the blavatar of the current blog as a separator.
+ */
+function wp_admin_bar_blog_separator() {
+        global $wp_admin_bar, $current_user, $current_blog;
+
+        if ( !is_object( $wp_admin_bar ) )
+                return false;
+
+        $default = includes_url('images/wpmini-blue.png');
+
+        $wp_admin_bar->add_menu( array( 'id' => 'blog', 'title' => '<img class="avatar" src="' . $default . '" alt="' . __( 'Current blog avatar' ) . '" width="16" height="16" />', 'href' => home_url() ) );
+}
+add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_blog_separator', 40 );
+
+/**
+ * Use the $wp_admin_bar global to add a menu for blog info, accessable to all users.
+ */
+function wp_admin_bar_bloginfo_menu() {
+        global $wp_admin_bar;
+
+        if ( !is_object( $wp_admin_bar ) )
+                return false;
+
+        /* Add the Blog Info menu */
+        $wp_admin_bar->add_menu( array( 'id' => 'bloginfo', 'title' => __( 'Blog Info' ), 'href' => '' ) );
+
+        $wp_admin_bar->add_menu( array( 'parent' => 'bloginfo', 'title' => __( 'Get Shortlink' ), 'href' => '', 'meta' => array( 'onclick' => 'javascript:function wpcomshort() { var url=document.location;var links=document.getElementsByTagName(&#39;link&#39;);var found=0;for(var i = 0, l; l = links[i]; i++){if(l.getAttribute(&#39;rel&#39;)==&#39;shortlink&#39;) {found=l.getAttribute(&#39;href&#39;);break;}}if (!found) {for (var i = 0; l = document.links[i]; i++) {if (l.getAttribute(&#39;rel&#39;) == &#39;shortlink&#39;) {found = l.getAttribute(&#39;href&#39;);break;}}}if (found) {prompt(&#39;URL:&#39;, found);} else {alert(&#39;No shortlink available for this page&#39;); } return false; } wpcomshort();' ) ) );
+}
+add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_bloginfo_menu', 50 );
+
+/**
+ * Use the $wp_admin_bar global to add the "Edit Post" menu when viewing a single post.
+ */
+function wp_admin_bar_edit_menu() {
+        global $post, $wp_admin_bar;
+
+        if ( !is_object( $wp_admin_bar ) )
+                return false;
+
+        if ( !is_single() && !is_page() )
+                return false;
+
+        if ( !$post_type_object = get_post_type_object( $post->post_type ) )
+                return false;
+
+        if ( !current_user_can( $post_type_object->cap->edit_post, $post->ID ) )
+                return false;
+
+        $wp_admin_bar->add_menu( array( 'id' => 'edit', 'title' => __( 'Edit' ), 'href' => get_edit_post_link( $post->ID ) ) );
+}
+add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_edit_menu', 100 );
+
+/**
+ * Load up the CSS needed to render the admin bar nice and pretty.
+ */
+function wp_admin_bar_css() {
+        global $pagenow, $wp_locale;
+
+        if ( !is_user_logged_in() )
+                return false;
+
+        if ( 'press-this.php' == $pagenow )
+                return;
+
+        $nobump = false;
+
+        /* Wish we could use wp_enqueue_style() here, but it will not let us pass GET params to the stylesheet correctly. */
+        ?>
+        <link rel="stylesheet" href="<?php echo includes_url('admin-bar/admin-bar-css.php') . '?t=' . get_current_theme() . '&amp;a=' . is_admin() . '&amp;p=' . is_ssl() . '&amp;sa=' . is_super_admin() . '&amp;td=' . $wp_locale->text_direction . '&amp;inc=' . includes_url() . '&amp;nobump=' . $nobump; ?>" type="text/css" />
+        <!--[if IE 6]><style type="text/css">#wpadminbar, #wpadminbar .menupop a span, #wpadminbar .menupop ul li a:hover, #wpadminbar .myaccount a, .quicklinks a:hover,#wpadminbar .menupop:hover { background-image: none !important; } #wpadminbar .myaccount a { margin-left:0 !important; padding-left:12px !important;}</style><![endif]-->
+        <style type="text/css" media="print">#wpadminbar { display:none; }</style><?php
+}
+add_action( 'wp_head', 'wp_admin_bar_css' );
+add_action( 'admin_head', 'wp_admin_bar_css' );
+
+/**
+ * Load up the JS needed to allow the admin bar to function correctly.
+ */
+function wp_admin_bar_js() {
+        global $wp_admin_bar;
+
+        if ( !is_object( $wp_admin_bar ) )
+                return false;
+
+        ?>
+        <script type="text/javascript">
+/*        <![CDATA[ */
+                function pressthis(step) {if (step == 1) {if(navigator.userAgent.indexOf('Safari') >= 0) {Q=getSelection();}else {if(window.getSelection)Q=window.getSelection().toString();else if(document.selection)Q=document.selection.createRange().text;else Q=document.getSelection().toString();}} else {location.href='<?php echo $wp_admin_bar->user->account_domain; ?>wp-admin/post-new.php?text='+encodeURIComponent(Q.toString())+'&amp;popupurl='+encodeURIComponent(location.href)+'&amp;popuptitle='+encodeURIComponent(document.title);}}
+                function toggle_query_list() { var querylist = document.getElementById( 'querylist' );if( querylist.style.display == 'block' ) {querylist.style.display='none';} else {querylist.style.display='block';}}
+
+                jQuery( function() {
+                        (function(jq){jq.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=jq.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){jq(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;jq(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{jq(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);
+                        (function(jq){jq.fn.superfish=function(op){var sf=jq.fn.superfish,c=sf.c,jqarrow=jq([''].join('')),over=function(){var jqjq=jq(this),menu=getMenu(jqjq);clearTimeout(menu.sfTimer);jqjq.showSuperfishUl().siblings().hideSuperfishUl();},out=function(){var jqjq=jq(this),menu=getMenu(jqjq),o=sf.op;clearTimeout(menu.sfTimer);menu.sfTimer=setTimeout(function(){o.retainPath=(jq.inArray(jqjq[0],o.jqpath)>-1);jqjq.hideSuperfishUl();if(o.jqpath.length&&jqjq.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.jqpath);}},o.delay);},getMenu=function(jqmenu){var menu=jqmenu.parents(['ul.',c.menuClass,':first'].join(''))[0];sf.op=sf.o[menu.serial];return menu;},addArrow=function(jqa){jqa.addClass(c.anchorClass).append(jqarrow.clone());};return this.each(function(){var s=this.serial=sf.o.length;var o=jq.extend({},sf.defaults,op);o.jqpath=jq('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){jq(this).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass);});sf.o[s]=sf.op=o;jq('li:has(ul)',this)[(jq.fn.hoverIntent&&!o.disableHI)?'hoverIntent':'hover'](over,out).each(function(){if(o.autoArrows)addArrow(jq('>a:first-child',this));}).not('.'+c.bcClass).hideSuperfishUl();var jqa=jq('a',this);jqa.each(function(i){var jqli=jqa.eq(i).parents('li');jqa.eq(i).focus(function(){over.call(jqli);}).blur(function(){out.call(jqli);});});o.onInit.call(this);}).each(function(){var menuClasses=[c.menuClass];if(sf.op.dropShadows&&!(jq.browser.msie&&jq.browser.version<7))menuClasses.push(c.shadowClass);jq(this).addClass(menuClasses.join(' '));});};var sf=jq.fn.superfish;sf.o=[];sf.op={};sf.IE7fix=function(){var o=sf.op;if(jq.browser.msie&&jq.browser.version>6&&o.dropShadows&&o.animation.opacity!=undefined) this.toggleClass(sf.c.shadowClass+'-off');};sf.c={bcClass:'sf-breadcrumb',menuClass:'sf-js-enabled',anchorClass:'sf-with-ul',arrowClass:'sf-sub-indicator',shadowClass:'sf-shadow'};sf.defaults={hoverClass:'sfHover',pathClass:'overideThisToUse',pathLevels:1,delay:600,animation:{opacity:'show'},speed:100,autoArrows:false,dropShadows:false,disableHI:false,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};jq.fn.extend({hideSuperfishUl:function(){var o=sf.op,not=(o.retainPath===true)?o.jqpath:'';o.retainPath=false;var jqul=jq(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass).find('>ul').hide().css('visibility','hidden');o.onHide.call(jqul);return this;},showSuperfishUl:function(){var o=sf.op,sh=sf.c.shadowClass+'-off',jqul=this.addClass(o.hoverClass).find('>ul:hidden').css('visibility','visible');sf.IE7fix.call(jqul);o.onBeforeShow.call(jqul);jqul.animate(o.animation,o.speed,function(){sf.IE7fix.call(jqul);o.onShow.call(jqul);});return this;}});})(jQuery);
+
+                        <?php if ( is_single() ) : ?>
+                        if ( jQuery(this).width() < 1100 ) jQuery("#adminbarsearch").hide();
+                        <?php endif; ?>
+                                
+                        jQuery( '#wpadminbar li.ab-my-account, #wpadminbar li.ab-bloginfo' ).mouseover( function() {
+                                if ( jQuery(this).hasClass( 'ab-my-account' ) ) jQuery('#wpadminbar li.ab-me > a').addClass('hover');
+                                if ( jQuery(this).hasClass( 'ab-bloginfo' ) ) jQuery('#wpadminbar li.ab-blog > a').addClass('hover');
+                        });
+                        
+                        jQuery( '#wpadminbar li.ab-my-account, #wpadminbar li.ab-bloginfo' ).mouseout( function() {
+                                if ( jQuery(this).hasClass( 'ab-my-account' ) ) jQuery('#wpadminbar li.ab-me > a').removeClass('hover');
+                                if ( jQuery(this).hasClass( 'ab-bloginfo' ) ) jQuery('#wpadminbar li.ab-blog > a').removeClass('hover');
+                        });
+
+                        <?php if ( is_single() ) : ?>
+                        jQuery(window).resize( function() {
+                                if ( jQuery(this).width() < 1100 )
+                                        jQuery("#adminbarsearch").hide();
+                                
+                                if ( jQuery(this).width() > 1100 )
+                                        jQuery("#adminbarsearch").show();
+                        });
+                        <?php endif; ?>
+                        
+                        jQuery( '#wpadminbar ul ul li a' ).mouseover( function() {
+                                var root = jQuery(this).parents('div.quicklinks ul > li');
+                                var par = jQuery(this).parent();
+                                var children = par.children('ul');
+                                if ( root.hasClass('ab-sadmin') )
+                                        jQuery(children[0]).css('<?php echo( is_rtl() ? 'left' : 'right' ); ?>',par.parents('ul').width() - 1 +'px' );
+                                else
+                                        jQuery(children[0]).css('<?php echo( is_rtl() ? 'right' : 'left' ); ?>',par.parents('ul').width() +'px' );
+                                
+                                jQuery(children[0]).css('top', '0' );
+                        });
+                        
+                        <?php if ( is_user_logged_in() ) : // Hash links scroll 32px back so admin bar doesn't cover. ?>
+                                if ( window.location.hash ) window.scrollBy(0,-32);
+                        <?php endif; ?>
+                
+                });
+
+                jQuery( function() {
+                        jQuery('#wpadminbar').appendTo('body');
+                        jQuery("#wpadminbar ul").superfish();
+                });
+
+                /*        ]]> */
+        </script><?php
+}
+add_action( 'wp_footer', 'wp_admin_bar_js' );
+add_action( 'admin_footer', 'wp_admin_bar_js' );
+
+/**
+ * Return a rendered admin bar via AJAX for use on pages that do not run inside the
+ * WP environment. Used on bbPress forum pages to show the admin bar.
+ */
+function wp_admin_bar_ajax_render() {
+        global $wp_admin_bar;
+
+        wp_admin_bar_js();
+        wp_admin_bar_css();
+        wp_admin_bar_render();
+        die;
+}
+add_action( 'wp_ajax_adminbar_render', 'wp_admin_bar_ajax_render' );
+
+function is_admin_bar() {
+        return ( 0 === strpos($_SERVER['REQUEST_URI'], '/js/admin-bar') );
+}
+
+function wp_admin_bar_lang($locale) {
+        if ( is_admin_bar() )
+                $locale = get_locale();
+        return $locale;
+}
+add_filter('locale', 'wp_admin_bar_lang');
+
+?>
</ins><span class="cx">Property changes on: trunk/wp-includes/admin-bar.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx"> + native
</span></span></pre></div>
<a id="trunkwpincludesimagesadminbarspritertlpng"></a>
<div class="binary"><h4>Added: trunk/wp-includes/images/admin-bar-sprite-rtl.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/wp-includes/images/admin-bar-sprite-rtl.png
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:mime-type
</span><span class="cx"> + application/octet-stream
</span><a id="trunkwpincludesimagesadminbarspritepng"></a>
<div class="binary"><h4>Added: trunk/wp-includes/images/admin-bar-sprite.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/wp-includes/images/admin-bar-sprite.png
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:mime-type
</span><span class="cx"> + application/octet-stream
</span><a id="trunkwpincludesimageswpminibluepng"></a>
<div class="binary"><h4>Added: trunk/wp-includes/images/wpmini-blue.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/wp-includes/images/wpmini-blue.png
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:mime-type
</span><span class="cx"> + application/octet-stream
</span><a id="trunkwpincludesmsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-functions.php (15670 => 15671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-functions.php        2010-09-27 07:29:18 UTC (rev 15670)
+++ trunk/wp-includes/ms-functions.php        2010-09-27 20:26:36 UTC (rev 15671)
</span><span class="lines">@@ -30,46 +30,6 @@
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function get_blogs_of_user( $id, $all = false ) {
-        global $wpdb;
-
-        $cache_suffix = $all ? '_all' : '_short';
-        $return = wp_cache_get( 'blogs_of_user_' . $id . $cache_suffix, 'users' );
-        if ( $return )
-                return apply_filters( 'get_blogs_of_user', $return, $id, $all );
-
-        $user = get_userdata( (int) $id );
-        if ( !$user )
-                return false;
-
-        $blogs = $match = array();
-        $prefix_length = strlen($wpdb->base_prefix);
-        foreach ( (array) $user as $key => $value ) {
-                if ( $prefix_length && substr($key, 0, $prefix_length) != $wpdb->base_prefix )
-                        continue;
-                if ( substr($key, -12, 12) != 'capabilities' )
-                        continue;
-                if ( preg_match( '/^' . $wpdb->base_prefix . '((\d+)_)?capabilities$/', $key, $match ) ) {
-                        if ( count( $match ) > 2 )
-                                $blog_id = $match[ 2 ];
-                        else
-                                $blog_id = 1;
-                        $blog = get_blog_details( $blog_id );
-                        if ( $blog && isset( $blog->domain ) && ( $all == true || $all == false && ( $blog->archived == 0 && $blog->spam == 0 && $blog->deleted == 0 ) ) ) {
-                                $blogs[ $blog_id ]->userblog_id        = $blog_id;
-                                $blogs[ $blog_id ]->blogname                = $blog->blogname;
-                                $blogs[ $blog_id ]->domain                = $blog->domain;
-                                $blogs[ $blog_id ]->path                        = $blog->path;
-                                $blogs[ $blog_id ]->site_id                = $blog->site_id;
-                                $blogs[ $blog_id ]->siteurl                = $blog->siteurl;
-                        }
-                }
-        }
-
-        wp_cache_add( 'blogs_of_user_' . $id . $cache_suffix, $blogs, 'users', 5 );
-        return apply_filters( 'get_blogs_of_user', $blogs, $id, $all );
-}
-
</del><span class="cx"> function get_active_blog_for_user( $user_id ) { // get an active blog for user - either primary blog or from blogs list
</span><span class="cx">         global $wpdb;
</span><span class="cx">         $blogs = get_blogs_of_user( $user_id );
</span><span class="lines">@@ -366,21 +326,6 @@
</span><span class="cx">         return $url;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function is_blog_user( $blog_id = 0 ) {
-        global $wpdb;
-
-        $current_user = wp_get_current_user();
-        if ( !$blog_id )
-                $blog_id = $wpdb->blogid;
-
-        $cap_key = $wpdb->base_prefix . $blog_id . '_capabilities';
-
-        if ( is_array($current_user->$cap_key) && in_array(1, $current_user->$cap_key) )
-                return true;
-
-        return false;
-}
-
</del><span class="cx"> function is_email_address_unsafe( $user_email ) {
</span><span class="cx">         $banned_names = get_site_option( 'banned_email_domains' );
</span><span class="cx">         if ($banned_names && !is_array( $banned_names ))
</span></span></pre></div>
<a id="trunkwpincludesuserphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/user.php (15670 => 15671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/user.php        2010-09-27 07:29:18 UTC (rev 15670)
+++ trunk/wp-includes/user.php        2010-09-27 20:26:36 UTC (rev 15671)
</span><span class="lines">@@ -575,6 +575,167 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Get the blogs a user belong to.
+ *
+ * $since 3.0.0
+ *
+ * @param int $id User Id
+ * @param bool $all Whether to retrieve all blog details or an abbreviated set of details. Default is abbreviated.
+ * @return array A list of the user's blogs.
+ */
+function get_blogs_of_user( $id, $all = false ) {
+        global $wpdb;
+
+        if ( !is_multisite() ) {
+                global $blog_id;
+                $blogs = array();
+                $blogs[ $blog_id ]->userblog_id = $blog_id;
+                $blogs[ $blog_id ]->blogname = get_option('blogname');
+                $blogs[ $blog_id ]->domain = '';
+                $blogs[ $blog_id ]->path = '';
+                $blogs[ $blog_id ]->site_id = 1;
+                $blogs[ $blog_id ]->siteurl = get_option('siteurl');
+                return $blogs;
+        }
+
+        $cache_suffix = $all ? '_all' : '_short';
+        $return = wp_cache_get( 'blogs_of_user_' . $id . $cache_suffix, 'users' );
+        if ( $return )
+                return apply_filters( 'get_blogs_of_user', $return, $id, $all );
+
+        $user = get_userdata( (int) $id );
+        if ( !$user )
+                return false;
+
+        $blogs = $match = array();
+        $prefix_length = strlen($wpdb->base_prefix);
+        foreach ( (array) $user as $key => $value ) {
+                if ( $prefix_length && substr($key, 0, $prefix_length) != $wpdb->base_prefix )
+                        continue;
+                if ( substr($key, -12, 12) != 'capabilities' )
+                        continue;
+                if ( preg_match( '/^' . $wpdb->base_prefix . '((\d+)_)?capabilities$/', $key, $match ) ) {
+                        if ( count( $match ) > 2 )
+                                $blog_id = $match[ 2 ];
+                        else
+                                $blog_id = 1;
+                        $blog = get_blog_details( $blog_id );
+                        if ( $blog && isset( $blog->domain ) && ( $all == true || $all == false && ( $blog->archived == 0 && $blog->spam == 0 && $blog->deleted == 0 ) ) ) {
+                                $blogs[ $blog_id ]->userblog_id        = $blog_id;
+                                $blogs[ $blog_id ]->blogname                = $blog->blogname;
+                                $blogs[ $blog_id ]->domain                = $blog->domain;
+                                $blogs[ $blog_id ]->path                        = $blog->path;
+                                $blogs[ $blog_id ]->site_id                = $blog->site_id;
+                                $blogs[ $blog_id ]->siteurl                = $blog->siteurl;
+                        }
+                }
+        }
+
+        wp_cache_add( 'blogs_of_user_' . $id . $cache_suffix, $blogs, 'users', 5 );
+        return apply_filters( 'get_blogs_of_user', $blogs, $id, $all );
+}
+
+function get_ordered_blogs_of_user( $user_id, $visibility = true ) {
+        $newblogs = $ordered = array();
+        $blogs = get_blogs_of_user( $user_id );
+        $order_meta = get_user_meta( $user_id, 'blog_order' );
+        $visible_meta = get_user_meta( $user_id, 'blog_visibility' );
+        
+        $order = $order_meta;
+        if ( !is_array( $order ) )
+                $order = array();
+
+        $visible = $visible_meta;
+        if ( !is_array( $visible ) )
+                $visible = array();
+        
+        // Index the blogs by userblog_id and set the visibility flag
+        // Visibility is on by default, unless a linked site then off
+        foreach ( $blogs AS $blog ) {
+                $blog->visible = true;
+
+                if ( isset( $visible[$blog->userblog_id] ) )
+                        $blog->visible = $visible[$blog->userblog_id];
+
+                $newblogs[$blog->userblog_id] = $blog;
+        }
+
+        // Add the blogs to our list by order
+        foreach ( (array)$order AS $id ) {
+                // A previous change was saving the entire blog details into ordered, not just the blog ID - this detects it
+                if ( is_object( $id ) && isset( $id->userblog_id ) )
+                        $id = $id->userblog_id;
+                        
+                if ( is_numeric( $id ) && isset( $newblogs[intval( $id )] ) ) {
+                        $ordered[$id] = $newblogs[$id];
+                        unset( $newblogs[$id] );
+                }
+        }
+
+        // Add any blog not yet ordered to the end
+        foreach ( $newblogs AS $blog ) {
+                $ordered[$blog->userblog_id] = $blog;
+        }
+
+        // If we're only interested in visible blogs then remove the rest
+        if ( $visibility ) {
+                foreach ( (array)$ordered AS $pos => $blog ) {
+                        if ( $blog->visible == false )
+                                unset( $ordered[$pos] );
+                }
+        }
+
+/*
+        // Set the order and visible options if the user doesn't have any,
+        // but rate limit it so that the global DB doesn't get hammered
+        if ( !is_array( $order_meta ) && ( 1 == mt_rand( 1, 10 ) ) )
+                update_usermeta( $user_id, 'blog_order', array() );
+
+        if ( !is_array( $visible_meta ) && ( 1 == mt_rand( 1, 10 ) ) )
+                update_usermeta( $user_id, 'blog_visibility', array() );
+*/
+
+        return apply_filters( 'ordered_blogs', $ordered );
+}
+
+function set_blog_visibility( $blog_id, $visible ) {
+        global $current_user;
+
+        if ( is_blog_user( $blog_id ) ) {
+                $visibility = get_user_meta( $current_user->ID, 'blog_visibility' );
+                if ( !is_array( $visibility ) )
+                        $visibility = array();
+
+                $visibility[$blog_id] = $visible;
+
+                update_user_meta( $current_user->ID, 'blog_visibility', $visibility );
+        }
+}
+
+/**
+ * Checks if the current user belong to a given blog.
+ *
+ * @since 3.0.0
+ *
+ * @param int $blog_id Blog ID
+ * @return bool True if the current users belong to $blog_id, false if not.
+ */
+function is_blog_user( $blog_id = 0 ) {
+        global $wpdb;
+
+        $current_user = wp_get_current_user();
+        if ( !$blog_id )
+                $blog_id = $wpdb->blogid;
+
+        $cap_key = $wpdb->base_prefix . $blog_id . '_capabilities';
+
+        if ( is_array($current_user->$cap_key) && in_array(1, $current_user->$cap_key) )
+                return true;
+
+        return false;
+}
+
+/**
</ins><span class="cx"> * Add meta data field to a user.
</span><span class="cx"> *
</span><span class="cx"> * Post meta data is called "Custom Fields" on the Administration Panels.
</span></span></pre></div>
<a id="trunkwpsettingsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-settings.php (15670 => 15671)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-settings.php        2010-09-27 07:29:18 UTC (rev 15670)
+++ trunk/wp-settings.php        2010-09-27 20:26:36 UTC (rev 15671)
</span><span class="lines">@@ -133,6 +133,7 @@
</span><span class="cx"> require( ABSPATH . WPINC . '/widgets.php' );
</span><span class="cx"> require( ABSPATH . WPINC . '/nav-menu.php' );
</span><span class="cx"> require( ABSPATH . WPINC . '/nav-menu-template.php' );
</span><ins>+require( ABSPATH . WPINC . '/admin-bar.php' );
</ins><span class="cx">
</span><span class="cx"> // Load multisite-specific files.
</span><span class="cx"> if ( is_multisite() ) {
</span></span></pre>
</div>
</div>
</body>
</html>