Ticket #14772: 14772.2.diff
File 14772.2.diff, 64.6 KB (added by , 13 years ago) |
---|
-
wp-includes/admin-bar.php
1 <?php 2 /** 3 * Admin Bar 4 * 5 * This code handles the building and rendering of the press bar. 6 */ 7 8 /** 9 * Instantiate the admin bar class and set it up as a global for access elsewhere. 10 */ 11 function wp_admin_bar_init() { 12 global $current_user, $pagenow, $wp_admin_bar; 13 14 /* Set the protocol constant used throughout this code */ 15 if ( !defined( 'PROTO' ) ) 16 if ( is_ssl() ) define( 'PROTO', 'https://' ); else define( 'PROTO', 'http://' ); 17 18 /* Don't load the admin bar if the user is not logged in, or we are using press this */ 19 if ( !is_user_logged_in() || 'press-this.php' == $pagenow ) 20 return false; 21 22 /* Set up the settings we need to render menu items */ 23 if ( !is_object( $current_user ) ) 24 $current_user = wp_get_current_user(); 25 26 /* Enqueue the JS files for the admin bar. */ 27 if ( is_user_logged_in() ) 28 wp_enqueue_script( 'jquery', false, false, false, true ); 29 30 /* Load the admin bar class code ready for instantiation */ 31 require( ABSPATH . WPINC . '/admin-bar/admin-bar-class.php' ); 32 33 /* Only load super admin menu code if the logged in user is a super admin */ 34 if ( is_super_admin() ) { 35 require( ABSPATH . WPINC . '/admin-bar/admin-bar-debug.php' ); 36 require( ABSPATH . WPINC . '/admin-bar/admin-bar-superadmin.php' ); 37 } 38 39 /* Initialize the admin bar */ 40 $wp_admin_bar = new wp_admin_bar(); 41 } 42 add_action( 'init', 'wp_admin_bar_init' ); 43 44 /** 45 * Render the admin bar to the page based on the $wp_admin_bar->menu member var. 46 * This is called very late on the footer actions so that it will render after anything else being 47 * added to the footer. 48 * 49 * It includes the action "wp_before_admin_bar_render" which should be used to hook in and 50 * add new menus to the admin bar. That way you can be sure that you are adding at most optimal point, 51 * right before the admin bar is rendered. This also gives you access to the $post global, among others. 52 */ 53 function wp_admin_bar_render() { 54 global $wp_admin_bar; 55 56 if ( !is_object( $wp_admin_bar ) ) 57 return false; 58 59 $wp_admin_bar->load_user_locale_translations(); 60 61 do_action( 'wp_before_admin_bar_render' ); 62 63 $wp_admin_bar->render(); 64 65 do_action( 'wp_after_admin_bar_render' ); 66 67 $wp_admin_bar->unload_user_locale_translations(); 68 } 69 add_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); 70 add_action( 'admin_footer', 'wp_admin_bar_render', 1000 ); 71 72 /** 73 * Show the logged in user's gravatar as a separator. 74 */ 75 function wp_admin_bar_me_separator() { 76 global $wp_admin_bar, $current_user; 77 78 if ( !is_object( $wp_admin_bar ) ) 79 return false; 80 81 $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' ) ); 82 } 83 add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_me_separator', 10 ); 84 85 /** 86 * Use the $wp_admin_bar global to add the "My Account" menu and all submenus. 87 */ 88 function wp_admin_bar_my_account_menu() { 89 global $wp_admin_bar, $current_user; 90 91 if ( !is_object( $wp_admin_bar ) ) 92 return false; 93 94 /* Add the 'My Account' menu */ 95 $wp_admin_bar->add_menu( array( 'id' => 'my-account', 'title' => __( 'My Account' ), 'href' => admin_url('profile.php') ) ); 96 97 /* Add the "My Account" sub menus */ 98 $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Edit My Profile' ), 'href' => admin_url('profile.php') ) ); 99 $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Global Dashboard' ), 'href' => admin_url() ) ); 100 $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Log Out' ), 'href' => wp_logout_url() ) ); 101 } 102 add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_my_account_menu', 20 ); 103 104 /** 105 * Use the $wp_admin_bar global to add the "My Blogs/[Blog Name]" menu and all submenus. 106 */ 107 function wp_admin_bar_my_blogs_menu() { 108 global $wpdb, $wp_admin_bar; 109 110 if ( !is_object( $wp_admin_bar ) ) 111 return false; 112 113 /* Remove the global dashboard */ 114 if ( is_multisite() ) { 115 foreach ( (array) $wp_admin_bar->user->blogs as $key => $blog ) { 116 if ( get_dashboard_blog() == $blog->domain ) 117 unset( $wp_admin_bar->user->blogs[$key] ); 118 } 119 } 120 121 /* Add the 'My Dashboards' menu if the user has more than one blog. */ 122 if ( count( $wp_admin_bar->user->blogs ) > 1 ) { 123 $wp_admin_bar->add_menu( array( 'id' => 'my-blogs', 'title' => __( 'My Blogs' ), 'href' => $wp_admin_bar->user->account_domain ) ); 124 125 $default = includes_url('images/wpmini-blue.png'); 126 127 $counter = 2; 128 foreach ( (array) $wp_admin_bar->user->blogs as $blog ) { 129 $blogdomain = preg_replace( '!^https?://!', '', $blog->siteurl ); 130 // @todo Replace with some favicon lookup. 131 //$blavatar = '<img src="' . esc_url( blavatar_url( blavatar_domain( $blog->siteurl ), 'img', 16, $default ) ) . '" alt="Blavatar" width="16" height="16" />'; 132 $blavatar = '<img src="' . esc_url($default) . '" alt="Blavatar" width="16" height="16" />';; 133 134 $marker = ''; 135 if ( strlen($blog->blogname) > 35 ) 136 $marker = '...'; 137 138 if ( empty( $blog->blogname ) ) 139 $blogname = $blog->domain; 140 else 141 $blogname = substr( $blog->blogname, 0, 35 ) . $marker; 142 143 if ( !isset( $blog->visible ) || $blog->visible === true ) { 144 $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-' . $blog->userblog_id, 'title' => $blavatar . $blogname, 'href' => constant( 'PROTO' ) . $blogdomain . '/wp-admin/' ) ); 145 $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/' ) ); 146 $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' ) ); 147 // @todo, stats plugins should add this: 148 //$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' ) ); 149 $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' ) ); 150 $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-v', 'title' => __( 'Read Blog' ), 'href' => constant( 'PROTO' ) . $blogdomain ) ); 151 } 152 $counter++; 153 } 154 155 /* Add the "Manage Blogs" menu item */ 156 // @todo, use dashboard blog. 157 $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'manage-blogs', 'title' => __( 'Manage Blogs' ), admin_url('my-sites.php') ) ); 158 159 /* Add the 'My Dashboard' menu if the user only has one blog. */ 160 } else { 161 $wp_admin_bar->add_menu( array( 'id' => 'my-blogs', 'title' => __( 'My Blog' ), 'href' => $wp_admin_bar->user->account_domain ) ); 162 163 $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-d', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); 164 $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-n', 'title' => __( 'New Post' ), 'href' => admin_url('post-new.php') ) ); 165 // @todo Stats plugins should add this. 166 //$wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-s', 'title' => __( 'Blog Stats' ), 'href' => admin_ur;('index.php?page=stats') ) ); 167 $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-c', 'title' => __( 'Manage Comments' ), 'href' => admin_url('edit-comments.php') ) ); 168 $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-1-v', 'title' => __( 'Read Blog' ), 'href' => home_url() ) ); 169 } 170 } 171 add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_my_blogs_menu', 30 ); 172 173 /** 174 * Show the blavatar of the current blog as a separator. 175 */ 176 function wp_admin_bar_blog_separator() { 177 global $wp_admin_bar, $current_user, $current_blog; 178 179 if ( !is_object( $wp_admin_bar ) ) 180 return false; 181 182 $default = includes_url('images/wpmini-blue.png'); 183 184 $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() ) ); 185 } 186 add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_blog_separator', 40 ); 187 188 /** 189 * Use the $wp_admin_bar global to add a menu for blog info, accessable to all users. 190 */ 191 function wp_admin_bar_bloginfo_menu() { 192 global $wp_admin_bar; 193 194 if ( !is_object( $wp_admin_bar ) ) 195 return false; 196 197 /* Add the Blog Info menu */ 198 $wp_admin_bar->add_menu( array( 'id' => 'bloginfo', 'title' => __( 'Blog Info' ), 'href' => '' ) ); 199 200 $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('link');var found=0;for(var i = 0, l; l = links[i]; i++){if(l.getAttribute('rel')=='shortlink') {found=l.getAttribute('href');break;}}if (!found) {for (var i = 0; l = document.links[i]; i++) {if (l.getAttribute('rel') == 'shortlink') {found = l.getAttribute('href');break;}}}if (found) {prompt('URL:', found);} else {alert('No shortlink available for this page'); } return false; } wpcomshort();' ) ) ); 201 } 202 add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_bloginfo_menu', 50 ); 203 204 /** 205 * Use the $wp_admin_bar global to add the "Edit Post" menu when viewing a single post. 206 */ 207 function wp_admin_bar_edit_menu() { 208 global $post, $wp_admin_bar; 209 210 if ( !is_object( $wp_admin_bar ) ) 211 return false; 212 213 if ( !is_single() && !is_page() ) 214 return false; 215 216 if ( !$post_type_object = get_post_type_object( $post->post_type ) ) 217 return false; 218 219 if ( !current_user_can( $post_type_object->cap->edit_post, $post->ID ) ) 220 return false; 221 222 $wp_admin_bar->add_menu( array( 'id' => 'edit', 'title' => __( 'Edit' ), 'href' => get_edit_post_link( $post->ID ) ) ); 223 } 224 add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_edit_menu', 100 ); 225 226 /** 227 * Load up the CSS needed to render the admin bar nice and pretty. 228 */ 229 function wp_admin_bar_css() { 230 global $pagenow, $wp_locale; 231 232 if ( !is_user_logged_in() ) 233 return false; 234 235 if ( 'press-this.php' == $pagenow ) 236 return; 237 238 $nobump = false; 239 240 /* Wish we could use wp_enqueue_style() here, but it will not let us pass GET params to the stylesheet correctly. */ 241 ?> 242 <link rel="stylesheet" href="<?php echo includes_url('admin-bar/admin-bar-css.php') . '?t=' . get_current_theme() . '&a=' . is_admin() . '&p=' . is_ssl() . '&sa=' . is_super_admin() . '&td=' . $wp_locale->text_direction . '&inc=' . includes_url() . '&nobump=' . $nobump; ?>" type="text/css" /> 243 <!--[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]--> 244 <style type="text/css" media="print">#wpadminbar { display:none; }</style><?php 245 } 246 add_action( 'wp_head', 'wp_admin_bar_css' ); 247 add_action( 'admin_head', 'wp_admin_bar_css' ); 248 249 /** 250 * Load up the JS needed to allow the admin bar to function correctly. 251 */ 252 function wp_admin_bar_js() { 253 global $wp_admin_bar; 254 255 if ( !is_object( $wp_admin_bar ) ) 256 return false; 257 258 ?> 259 <script type="text/javascript"> 260 /* <![CDATA[ */ 261 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())+'&popupurl='+encodeURIComponent(location.href)+'&popuptitle='+encodeURIComponent(document.title);}} 262 function toggle_query_list() { var querylist = document.getElementById( 'querylist' );if( querylist.style.display == 'block' ) {querylist.style.display='none';} else {querylist.style.display='block';}} 263 264 jQuery( function() { 265 (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); 266 ;(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); 267 268 <?php if ( is_single() ) : ?> 269 if ( jQuery(this).width() < 1100 ) jQuery("#adminbarsearch").hide(); 270 <?php endif; ?> 271 272 jQuery( '#wpadminbar li.ab-my-account, #wpadminbar li.ab-bloginfo' ).mouseover( function() { 273 if ( jQuery(this).hasClass( 'ab-my-account' ) ) jQuery('#wpadminbar li.ab-me > a').addClass('hover'); 274 if ( jQuery(this).hasClass( 'ab-bloginfo' ) ) jQuery('#wpadminbar li.ab-blog > a').addClass('hover'); 275 }); 276 277 jQuery( '#wpadminbar li.ab-my-account, #wpadminbar li.ab-bloginfo' ).mouseout( function() { 278 if ( jQuery(this).hasClass( 'ab-my-account' ) ) jQuery('#wpadminbar li.ab-me > a').removeClass('hover'); 279 if ( jQuery(this).hasClass( 'ab-bloginfo' ) ) jQuery('#wpadminbar li.ab-blog > a').removeClass('hover'); 280 }); 281 282 <?php if ( is_single() ) : ?> 283 jQuery(window).resize( function() { 284 if ( jQuery(this).width() < 1100 ) 285 jQuery("#adminbarsearch").hide(); 286 287 if ( jQuery(this).width() > 1100 ) 288 jQuery("#adminbarsearch").show(); 289 }); 290 <?php endif; ?> 291 292 jQuery( '#wpadminbar ul ul li a' ).mouseover( function() { 293 var root = jQuery(this).parents('div.quicklinks ul > li'); 294 var par = jQuery(this).parent(); 295 var children = par.children('ul'); 296 if ( root.hasClass('ab-sadmin') ) 297 jQuery(children[0]).css('<?php echo( is_rtl() ? 'left' : 'right' ); ?>',par.parents('ul').width() - 1 +'px' ); 298 else 299 jQuery(children[0]).css('<?php echo( is_rtl() ? 'right' : 'left' ); ?>',par.parents('ul').width() +'px' ); 300 301 jQuery(children[0]).css('top', '0' ); 302 }); 303 304 <?php if ( is_user_logged_in() ) : // Hash links scroll 32px back so admin bar doesn't cover. ?> 305 if ( window.location.hash ) window.scrollBy(0,-32); 306 <?php endif; ?> 307 308 }); 309 310 jQuery( function() { 311 jQuery('#wpadminbar').appendTo('body'); 312 jQuery("#wpadminbar ul").superfish(); 313 }); 314 315 /* ]]> */ 316 </script><?php 317 } 318 add_action( 'wp_footer', 'wp_admin_bar_js' ); 319 add_action( 'admin_footer', 'wp_admin_bar_js' ); 320 321 /** 322 * Return a rendered admin bar via AJAX for use on pages that do not run inside the 323 * WP environment. Used on bbPress forum pages to show the admin bar. 324 */ 325 function wp_admin_bar_ajax_render() { 326 global $wp_admin_bar; 327 328 wp_admin_bar_js(); 329 wp_admin_bar_css(); 330 wp_admin_bar_render(); 331 die; 332 } 333 add_action( 'wp_ajax_adminbar_render', 'wp_admin_bar_ajax_render' ); 334 335 ?> -
wp-includes/user.php
Property changes on: wp-includes/admin-bar.php ___________________________________________________________________ Added: svn:eol-style + native
575 575 } 576 576 577 577 /** 578 * Get the blogs a user belong to. 579 * 580 * $since 3.0.0 581 * 582 * @param int $id User Id 583 * @param bool $all Whether to retrieve all blog details or an abbreviated set of details. Default is abbreviated. 584 * @return array A list of the user's blogs. 585 */ 586 function get_blogs_of_user( $id, $all = false ) { 587 global $wpdb; 588 589 if ( !is_multisite() ) { 590 global $blog_id; 591 $blogs = array(); 592 $blogs[ $blog_id ]->userblog_id = $blog_id; 593 $blogs[ $blog_id ]->blogname = get_option('blogname'); 594 $blogs[ $blog_id ]->domain = ''; 595 $blogs[ $blog_id ]->path = ''; 596 $blogs[ $blog_id ]->site_id = 1; 597 $blogs[ $blog_id ]->siteurl = get_option('siteurl'); 598 return $blogs; 599 } 600 601 $cache_suffix = $all ? '_all' : '_short'; 602 $return = wp_cache_get( 'blogs_of_user_' . $id . $cache_suffix, 'users' ); 603 if ( $return ) 604 return apply_filters( 'get_blogs_of_user', $return, $id, $all ); 605 606 $user = get_userdata( (int) $id ); 607 if ( !$user ) 608 return false; 609 610 $blogs = $match = array(); 611 $prefix_length = strlen($wpdb->base_prefix); 612 foreach ( (array) $user as $key => $value ) { 613 if ( $prefix_length && substr($key, 0, $prefix_length) != $wpdb->base_prefix ) 614 continue; 615 if ( substr($key, -12, 12) != 'capabilities' ) 616 continue; 617 if ( preg_match( '/^' . $wpdb->base_prefix . '((\d+)_)?capabilities$/', $key, $match ) ) { 618 if ( count( $match ) > 2 ) 619 $blog_id = $match[ 2 ]; 620 else 621 $blog_id = 1; 622 $blog = get_blog_details( $blog_id ); 623 if ( $blog && isset( $blog->domain ) && ( $all == true || $all == false && ( $blog->archived == 0 && $blog->spam == 0 && $blog->deleted == 0 ) ) ) { 624 $blogs[ $blog_id ]->userblog_id = $blog_id; 625 $blogs[ $blog_id ]->blogname = $blog->blogname; 626 $blogs[ $blog_id ]->domain = $blog->domain; 627 $blogs[ $blog_id ]->path = $blog->path; 628 $blogs[ $blog_id ]->site_id = $blog->site_id; 629 $blogs[ $blog_id ]->siteurl = $blog->siteurl; 630 } 631 } 632 } 633 634 wp_cache_add( 'blogs_of_user_' . $id . $cache_suffix, $blogs, 'users', 5 ); 635 return apply_filters( 'get_blogs_of_user', $blogs, $id, $all ); 636 } 637 638 function get_ordered_blogs_of_user( $user_id, $visibility = true ) { 639 $newblogs = $ordered = array(); 640 $blogs = get_blogs_of_user( $user_id ); 641 $order_meta = get_user_meta( $user_id, 'blog_order' ); 642 $visible_meta = get_user_meta( $user_id, 'blog_visibility' ); 643 644 $order = $order_meta; 645 if ( !is_array( $order ) ) 646 $order = array(); 647 648 $visible = $visible_meta; 649 if ( !is_array( $visible ) ) 650 $visible = array(); 651 652 // Index the blogs by userblog_id and set the visibility flag 653 // Visibility is on by default, unless a linked site then off 654 foreach ( $blogs AS $blog ) { 655 $blog->visible = true; 656 657 if ( isset( $visible[$blog->userblog_id] ) ) 658 $blog->visible = $visible[$blog->userblog_id]; 659 660 $newblogs[$blog->userblog_id] = $blog; 661 } 662 663 // Add the blogs to our list by order 664 foreach ( (array)$order AS $id ) { 665 // A previous change was saving the entire blog details into ordered, not just the blog ID - this detects it 666 if ( is_object( $id ) && isset( $id->userblog_id ) ) 667 $id = $id->userblog_id; 668 669 if ( is_numeric( $id ) && isset( $newblogs[intval( $id )] ) ) { 670 $ordered[$id] = $newblogs[$id]; 671 unset( $newblogs[$id] ); 672 } 673 } 674 675 // Add any blog not yet ordered to the end 676 foreach ( $newblogs AS $blog ) { 677 $ordered[$blog->userblog_id] = $blog; 678 } 679 680 // If we're only interested in visible blogs then remove the rest 681 if ( $visibility ) { 682 foreach ( (array)$ordered AS $pos => $blog ) { 683 if ( $blog->visible == false ) 684 unset( $ordered[$pos] ); 685 } 686 } 687 688 /* 689 // Set the order and visible options if the user doesn't have any, 690 // but rate limit it so that the global DB doesn't get hammered 691 if ( !is_array( $order_meta ) && ( 1 == mt_rand( 1, 10 ) ) ) 692 update_usermeta( $user_id, 'blog_order', array() ); 693 694 if ( !is_array( $visible_meta ) && ( 1 == mt_rand( 1, 10 ) ) ) 695 update_usermeta( $user_id, 'blog_visibility', array() ); 696 */ 697 698 return apply_filters( 'ordered_blogs', $ordered ); 699 } 700 701 function set_blog_visibility( $blog_id, $visible ) { 702 global $current_user; 703 704 if ( is_blog_user( $blog_id ) ) { 705 $visibility = get_user_meta( $current_user->ID, 'blog_visibility' ); 706 if ( !is_array( $visibility ) ) 707 $visibility = array(); 708 709 $visibility[$blog_id] = $visible; 710 711 update_user_meta( $current_user->ID, 'blog_visibility', $visibility ); 712 } 713 } 714 715 /** 716 * Checks if the current user belong to a given blog. 717 * 718 * @since 3.0.0 719 * 720 * @param int $blog_id Blog ID 721 * @return bool True if the current users belong to $blog_id, false if not. 722 */ 723 function is_blog_user( $blog_id = 0 ) { 724 global $wpdb; 725 726 $current_user = wp_get_current_user(); 727 if ( !$blog_id ) 728 $blog_id = $wpdb->blogid; 729 730 $cap_key = $wpdb->base_prefix . $blog_id . '_capabilities'; 731 732 if ( is_array($current_user->$cap_key) && in_array(1, $current_user->$cap_key) ) 733 return true; 734 735 return false; 736 } 737 738 /** 578 739 * Add meta data field to a user. 579 740 * 580 741 * Post meta data is called "Custom Fields" on the Administration Panels. -
wp-includes/admin-bar/admin-bar-class.php
1 <?php 2 class WP_Admin_Bar { 3 var $user; 4 var $menu; 5 var $need_to_change_locale = false; 6 var $changed_locale = false; 7 8 function WP_Admin_Bar() { 9 global $current_user, $blog_id; 10 11 $this->user = new stdClass; 12 $this->menu = new stdClass; 13 14 /* Populate settings we need for the menu based on the current user. */ 15 $this->user->blogs = get_ordered_blogs_of_user( $current_user->id ); 16 if ( is_multisite() ) { 17 $this->user->active_blog = get_active_blog_for_user( $current_user->id ); 18 $this->user->domain = ( $this->user->active_blog == 'username only' ) ? get_dashboard_blog() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) ); 19 $this->user->account_domain = $this->user->domain; 20 } else { 21 $this->user->active_blog = $this->user->blogs[$blog_id]; 22 $this->user->domain = home_url(); 23 $this->user->account_domain = home_url(); 24 } 25 $this->user->locale = get_locale(); 26 } 27 28 function add_menu( $args = array() ) { 29 $defaults = array( 30 'title' => false, 31 'href' => false, 32 'parent' => false, // false for a root menu, pass the ID value for a submenu of that menu. 33 'id' => false, // defaults to a sanitized title value. 34 'meta' => false // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '' ); 35 ); 36 37 $r = wp_parse_args( $args, $defaults ); 38 extract( $r, EXTR_SKIP ); 39 40 if ( empty( $title ) ) 41 return false; 42 43 /* Make sure we have a valid ID */ 44 if ( empty( $id ) ) 45 $id = esc_attr( sanitize_title( trim( $title ) ) ); 46 47 if ( !empty( $parent ) ) { 48 /* Add the menu to the parent item */ 49 $child = array( 50 'id' => $id, 51 'title' => $title, 52 'href' => $href 53 ); 54 55 if ( !empty( $meta ) ) 56 $child['meta'] = $meta; 57 58 $this->add_node( $parent, $this->menu, $child ); 59 } else { 60 /* Add the menu item */ 61 $this->menu->{$id} = array( 62 'title' => $title, 63 'href' => $href 64 ); 65 66 if ( !empty( $meta ) ) 67 $this->menu->{$id}['meta'] = $meta; 68 } 69 } 70 71 function remove_menu( $id ) { 72 return $this->remove_node( $id, $this->menu ); 73 } 74 75 function render() { 76 ?> 77 <div id="wpadminbar" class="snap_nopreview no-grav"> 78 <div class="quicklinks"> 79 <ul> 80 <?php foreach ( (array) $this->menu as $id => $menu_item ) : ?> 81 <?php $this->recursive_render( $id, $menu_item ) ?> 82 <?php endforeach; ?> 83 </ul> 84 </div> 85 86 <div id="adminbarsearch-wrap"> 87 <form action="<?php echo home_url(); ?>" method="get" id="adminbarsearch"> 88 <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> 89 </form> 90 </div> 91 </div> 92 93 <?php 94 /* Wipe the menu, might reduce memory usage, but probably not. */ 95 $this->menu = null; 96 } 97 98 /* Helpers */ 99 function recursive_render( $id, &$menu_item ) { ?> 100 <?php $menuclass = ( !empty( $menu_item['children'] ) ) ? 'menupop ' : ''; ?> 101 102 <li class="<?php echo $menuclass . "ab-$id" ?><?php if ( !empty( $menu_item['meta']['class'] ) ) : ?><?php echo ' ' . $menu_item['meta']['class'] ?><?php endif; ?>"> 103 <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> 104 105 <?php if ( !empty( $menu_item['children'] ) ) : ?> 106 <ul> 107 <?php foreach ( $menu_item['children'] as $child_id => $child_menu_item ) : ?> 108 <?php $this->recursive_render( $child_id, $child_menu_item ); ?> 109 <?php endforeach; ?> 110 </ul> 111 <?php endif; ?> 112 113 <?php if ( !empty( $menu_item['meta']['html'] ) ) : ?> 114 <?php echo $menu_item['meta']['html']; ?> 115 <?php endif; ?> 116 </li><?php 117 } 118 119 function add_node( $parent_id, &$menu, $child ) { 120 foreach( $menu as $id => &$menu_item ) { 121 if ( $parent_id == $id ) { 122 $menu->{$parent_id}['children']->{$child['id']} = $child; 123 $child = null; 124 return true; 125 } 126 127 if ( !empty( $menu->{$id}['children'] ) ) 128 $this->add_node( $parent_id, $menu->{$id}['children'], $child ); 129 } 130 $child = null; 131 132 return false; 133 } 134 135 function remove_node( $id, &$menu ) { 136 foreach( $menu as $menu_item_id => &$menu_item ) { 137 if ( $menu_item_id == $id ) { 138 $menu_item = null; 139 return true; 140 } 141 142 if ( !empty( $menu->{$menu_item_id}['children'] ) ) 143 $this->remove_node( $id, $menu->{$menu_item_id}['children'] ); 144 } 145 146 return false; 147 } 148 149 function load_user_locale_translations() { 150 $this->need_to_change_locale = ( get_locale() != $this->user->locale ); 151 if ( !$this->need_to_change_locale ) return; 152 $this->previous_translations = get_translations_for_domain( 'default' ); 153 $this->adminbar_locale_filter = lambda( '$_', '$GLOBALS["wp_admin_bar"]->user->locale;' ); 154 unload_textdomain( 'default' ); 155 add_filter( 'locale', $this->adminbar_locale_filter ); 156 load_default_textdomain(); 157 $this->changed_locale = true; 158 } 159 160 function unload_user_locale_translations() { 161 global $l10n; 162 if ( !$this->changed_locale ) return; 163 remove_filter( 'locale', $this->adminbar_locale_filter ); 164 $l10n['default'] = &$this->previous_translations; 165 166 } 167 } 168 ?> -
wp-includes/admin-bar/admin-bar-debug.php
Property changes on: wp-includes/admin-bar/admin-bar-class.php ___________________________________________________________________ Added: svn:eol-style + native
1 <?php 2 /*** 3 * Debug Functions 4 * 5 * When logged in as a super admin, these functions will run to provide 6 * debugging information when specific super admin menu items are selected. 7 * 8 * They are not used when a regular user is logged in. 9 */ 10 11 function wp_admin_bar_query_debug_list() { 12 global $wpdb, $wp_object_cache; 13 14 if ( !is_super_admin() ) 15 return false; 16 17 $debugs = array(); 18 19 if ( defined('SAVEQUERIES') && SAVEQUERIES ) 20 $debugs['wpdb'] = array( __('Queries'), 'wp_admin_bar_debug_queries' ); 21 22 if ( is_object($wp_object_cache) && method_exists($wp_object_cache, 'stats') ) 23 $debugs['object-cache'] = array( __('Object Cache'), 'wp_admin_bar_debug_object_cache' ); 24 25 $debugs = apply_filters( 'wp_admin_bar_debugs_list', $debugs ); 26 27 if ( empty($debugs) ) 28 return; 29 30 ?> 31 <script type="text/javascript"> 32 /* <![CDATA[ */ 33 var clickDebugLink = function( targetsGroupId, obj) { 34 var sectionDivs = document.getElementById( targetsGroupId ).childNodes; 35 for ( var i = 0; i < sectionDivs.length; i++ ) { 36 if ( 1 != sectionDivs[i].nodeType ) { 37 continue; 38 } 39 sectionDivs[i].style.display = 'none'; 40 } 41 document.getElementById( obj.href.substr( obj.href.indexOf( '#' ) + 1 ) ).style.display = 'block'; 42 43 for ( var i = 0; i < obj.parentNode.parentNode.childNodes.length; i++ ) { 44 if ( 1 != obj.parentNode.parentNode.childNodes[i].nodeType ) { 45 continue; 46 } 47 obj.parentNode.parentNode.childNodes[i].removeAttribute( 'class' ); 48 } 49 obj.parentNode.setAttribute( 'class', 'current' ); 50 return false; 51 }; 52 /* ]]> */ 53 </script> 54 <div align='left' id='querylist'> 55 56 <h1>Debugging blog #<?php echo $GLOBALS['blog_id']; ?> on <?php echo php_uname( 'n' ); ?></h1> 57 <div id="debug-status"> 58 <p class="left"></p> 59 <p class="right">PHP Version: <?php echo phpversion(); ?></p> 60 </div> 61 <ul class="debug-menu-links"> 62 63 <?php $current = ' class="current"'; foreach ( $debugs as $debug => $debug_output ) : ?> 64 65 <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> 66 67 <?php $current = ''; endforeach; ?> 68 69 </ul> 70 71 <div id="debug-menu-targets"> 72 73 <?php $current = ' style="display: block"'; foreach ( $debugs as $debug => $debug_output ) : ?> 74 75 <div id="debug-menu-target-<?php echo $debug; ?>" class="debug-menu-target"<?php echo $current; ?>> 76 <?php echo str_replace( ' ', '', call_user_func( $debug_output[1] ) ); ?> 77 </div> 78 79 <?php $current = ''; endforeach; ?> 80 81 </div> 82 83 <?php do_action( 'wp_admin_bar_debug' ); ?> 84 85 </div> 86 87 <?php 88 } 89 add_action( 'wp_after_admin_bar_render', 'wp_admin_bar_query_debug_list' ); 90 91 function wp_admin_bar_debug_queries() { 92 global $wpdb; 93 94 $queries = array(); 95 $out = ''; 96 $total_time = 0; 97 98 if ( !empty($wpdb->queries) ) { 99 $show_many = isset($_GET['debug_queries']); 100 101 if ( $wpdb->num_queries > 500 && !$show_many ) 102 $out .= "<p>There are too many queries to show easily! <a href='" . add_query_arg( 'debug_queries', 'true' ) . "'>Show them anyway</a>.</p>"; 103 104 $out .= '<ol id="wpd-queries">'; 105 $first_query = 0; 106 $counter = 0; 107 108 foreach ( $wpdb->queries as $q ) { 109 list($query, $elapsed, $debug) = $q; 110 111 $total_time += $elapsed; 112 113 if ( !$show_many && ++$counter > 500 ) 114 continue; 115 116 $query = nl2br(esc_html($query)); 117 118 // $dbhname, $host, $port, $name, $tcp, $elapsed 119 $out .= "<li>$query<br/><div class='qdebug'>$debug <span>#{$counter} (" . number_format(sprintf('%0.1f', $elapsed * 1000), 1, '.', ',') . "ms)</span></div></li>\n"; 120 } 121 $out .= '</ol>'; 122 } else { 123 $out .= "<p><strong>There are no queries on this page, you won the prize!!! :)</strong></p>"; 124 } 125 126 $query_count = '<h2><span>Total Queries:</span>' . number_format( $wpdb->num_queries ) . "</h2>\n"; 127 $query_time = '<h2><span>Total query time:</span>' . number_format(sprintf('%0.1f', $total_time * 1000), 1) . "ms</h2>\n"; 128 $memory_usage = '<h2><span>Peak Memory Used:</span>' . number_format( memory_get_peak_usage( ) ) . " bytes</h2>\n"; 129 130 $out = $query_count . $query_time . $memory_usage . $out; 131 132 return $out; 133 } 134 135 function wp_admin_bar_debug_object_cache() { 136 global $wp_object_cache; 137 ob_start(); 138 echo "<div id='object-cache-stats'>"; 139 $wp_object_cache->stats(); 140 echo "</div>"; 141 $out = ob_get_contents(); 142 ob_end_clean(); 143 144 return $out; 145 } 146 147 function is_admin_bar() { 148 return ( 0 === strpos($_SERVER['REQUEST_URI'], '/js/admin-bar') ); 149 } 150 151 function wp_admin_bar_lang($locale) { 152 if ( is_admin_bar() ) 153 $locale = get_locale(); 154 return $locale; 155 } 156 add_filter('locale', 'wp_admin_bar_lang'); 157 158 ?> 159 No newline at end of file -
wp-includes/admin-bar/admin-bar-superadmin.php
Property changes on: wp-includes/admin-bar/admin-bar-debug.php ___________________________________________________________________ Added: svn:eol-style + native
1 <?php 2 /** 3 * Use the $wp_admin_bar global to add a menu for site admins and administrator controls. 4 */ 5 function wp_admin_bar_superadmin_menus() { 6 global $wp_admin_bar, $wpdb; 7 8 if ( !is_object( $wp_admin_bar ) || !is_super_admin() ) 9 return false; 10 11 $queries = $wpdb->num_queries; 12 $seconds = timer_stop(); 13 14 /* Add the main siteadmin menu item */ 15 $wp_admin_bar->add_menu( array( 'id' => 'queries', 'title' => "{$queries}q/{$seconds}", 'href' => 'javascript:toggle_query_list()', 'meta' => array( 'class' => 'ab-sadmin' ) ) ); 16 17 /* Add the "Super Admin" settings sub menu */ 18 if ( is_multisite() ) 19 wp_admin_bar_superadmin_settings_menu(); 20 } 21 add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_superadmin_menus', 1000 ); 22 23 /** 24 * 25 * Use the $wp_admin_bar global to add the super admin menu, providing admin options only visible to super admins. 26 */ 27 function wp_admin_bar_superadmin_settings_menu() { 28 global $wp_admin_bar, $current_blog, $current_user; 29 30 if ( !is_object( $wp_admin_bar ) || !is_super_admin() ) 31 return false; 32 33 /* Add the main superadmin menu item */ 34 $wp_admin_bar->add_menu( array( 'id' => 'superadmin', 'title' => 'μ', 'href' => '', 'meta' => array( 'class' => 'ab-sadmin' ) ) ); 35 36 wp_admin_bar_build_snackmenu(); 37 38 /* Get the settings we need for the current blog */ 39 $matureaction = $current_blog->mature ? 'unmatureblog' : 'matureblog'; 40 $maturetext = $current_blog->mature ? esc_attr__('Unmark as mature') : esc_attr__('Mark as mature'); 41 $suspendtext = $current_blog->spam ? esc_attr('Unsuspend blog') : esc_attr('Suspend blog'); 42 $suspendaction = $current_blog->spam ? 'unspamblog' : 'spamblog'; 43 $mature_url = admin_url( "ms-edit.php?action=confirm&action2={$matureaction}&id={$current_blog->blog_id}&msg=" . urlencode( 'Are you sure you want to ' . strtolower( $maturetext ) . " {$current_blog->domain} as mature?" ) ); 44 $suspend_url = admin_url( "ms-edit.php?action=confirm&action2={$suspendaction}&id={$current_blog->blog_id}&msg=" . urlencode( 'Are you sure you want to ' . strtolower( $suspendtext ) . " {$current_blog->domain} ?" ) ); 45 46 /* Add the submenu items to the Super Admin menu */ 47 $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => __( 'Blog Dashboard' ), 'href' => admin_url(), 'position' => 10 ) ); 48 $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => __( 'Blog Options' ), 'href' => admin_url( "ms-sites.php?action=blogs&searchaction=id&s={$current_blog->blog_id}" ), 'position' => 30 ) ); 49 $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => "$maturetext", 'href' => $mature_url, 'position' => 50 ) ); 50 $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => "$suspendtext", 'href' => $suspend_url, 'position' => 80 ) ); 51 } 52 53 function wp_admin_bar_build_snackmenu() { 54 global $wp_admin_bar, $menu, $submenu, $pagenow; 55 56 if ( !is_object( $wp_admin_bar ) || !is_super_admin() ) 57 return false; 58 59 // Hide moderation count, filter removed at the bottom of this function 60 add_filter( 'wp_count_comments', 'wp_admin_bar_removemodcount' ); 61 62 require_once( ABSPATH . 'wp-admin/includes/admin.php' ); 63 64 // menu.php assumes it is in the global scope and relies on the $wp_taxonomies global array 65 $wp_taxonomies = array(); 66 require_once( ABSPATH . 'wp-admin/menu.php' ); 67 68 /* Add the snack menu submenu to the superadmin menu */ 69 $wp_admin_bar->add_menu( array( 'parent' => 'superadmin', 'title' => 'Snack Menu', 'href' => '/wp-admin/' ) ); 70 71 /* Loop through the submenus and add them */ 72 foreach ( (array) $menu as $key => $item ) { 73 $admin_is_parent = false; 74 $submenu_as_parent = false; 75 76 if ( $submenu_as_parent && !empty($submenu[$item[2]]) ) { 77 $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index. 78 $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]); 79 $menu_file = $submenu[$item[2]][0][2]; 80 81 if ( false !== $pos = strpos($menu_file, '?') ) 82 $menu_file = substr($menu_file, 0, $pos); 83 if ( ( ('index.php' != $submenu[$item[2]][0][2]) && file_exists(WP_PLUGIN_DIR . "/$menu_file") ) || !empty($menu_hook)) { 84 $admin_is_parent = true; 85 $wp_admin_bar->add_menu( array( 'parent' => 'snack-menu', 'title' => $item[0], 'href' => admin_url("admin.php?page={$submenu[$item[2]][0][2]}") ) ); 86 } else { 87 $wp_admin_bar->add_menu( array( 'parent' => 'snack-menu', 'title' => $item[0], 'href' => admin_url("{$submenu[$item[2]][0][2]}") ) ); 88 } 89 } else if ( current_user_can($item[1]) ) { 90 $menu_hook = get_plugin_page_hook($item[2], 'admin.php'); 91 $menu_file = $item[2]; 92 93 if ( false !== $pos = strpos($menu_file, '?') ) 94 $menu_file = substr($menu_file, 0, $pos); 95 if ( ('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR . "/$menu_file") || !empty($menu_hook) ) { 96 $admin_is_parent = true; 97 $wp_admin_bar->add_menu( array( 'parent' => 'snack-menu', 'title' => $item[0], 'href' => admin_url("admin.php?page={$item[2]}") ) ); 98 } else { 99 $wp_admin_bar->add_menu( array( 'parent' => 'snack-menu', 'title' => $item[0], 'href' => admin_url("{$item[2]}") ) ); 100 } 101 } 102 103 if ( !empty($submenu[$item[2]]) ) { 104 $first = true; 105 $unique_submenu = array(); 106 107 foreach ( $submenu[$item[2]] as $sub_key => $sub_item ) { 108 if ( !current_user_can($sub_item[1]) || in_array( $sub_item[0], $unique_submenu ) ) 109 continue; 110 111 $unique_submenu[] = $sub_item[0]; 112 113 if ( $first ) 114 $first = false; 115 116 $menu_file = $item[2]; 117 if ( false !== $pos = strpos($menu_file, '?') ) 118 $menu_file = substr($menu_file, 0, $pos); 119 120 $menu_hook = get_plugin_page_hook($sub_item[2], $item[2]); 121 $sub_file = $sub_item[2]; 122 if ( false !== $pos = strpos($sub_file, '?') ) 123 $sub_file = substr($sub_file, 0, $pos); 124 125 if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/$sub_file") ) || ! empty($menu_hook) ) { 126 // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir 127 128 $parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($menu_file); 129 if ( $parent_exists ) 130 $wp_admin_bar->add_menu( array( 'parent' => sanitize_title( $item[0] ), 'title' => $sub_item[0], 'href' => admin_url("{$item[2]}?page={$sub_item[2]}") ) ); 131 elseif ( 'admin.php' == $pagenow || !$parent_exists ) 132 $wp_admin_bar->add_menu( array( 'parent' => sanitize_title( $item[0] ), 'title' => $sub_item[0], 'href' => admin_url("admin.php?page={$sub_item[2]}") ) ); 133 else 134 $wp_admin_bar->add_menu( array( 'parent' => sanitize_title( $item[0] ), 'title' => $sub_item[0], 'href' => admin_url("{$item[2]}?page={$sub_item[2]}") ) ); 135 } else { 136 $wp_admin_bar->add_menu( array( 'parent' => sanitize_title( $item[0] ), 'title' => $sub_item[0], 'href' => admin_url("{$sub_item[2]}") ) ); 137 } 138 } 139 } 140 } 141 142 remove_filter( 'wp_count_comments', 'wp_admin_bar_removemodcount' ); 143 } 144 145 // Short circuits wp_count_comments() for the front end 146 function wp_admin_bar_removemodcount( $stats ) { 147 if ( is_admin() ) 148 return $stats; 149 150 $stats = array( 151 'moderated' => 0, 152 'approved' => 0, 153 'spam' => 0, 154 'trash' => 0, 155 'post-trashed' => 0, 156 'total_comments' => 0, 157 ); 158 159 return (object) $stats; 160 } 161 162 ?> -
wp-includes/admin-bar/admin-bar-css.php
Property changes on: wp-includes/admin-bar/admin-bar-superadmin.php ___________________________________________________________________ Added: svn:eol-style + native
1 <?php 2 header( 'Content-type: text/css' ); 3 $proto = ( empty( $_GET['p'] ) ) ? 'http://' : 'https://'; 4 $text_direction = $_GET['td']; 5 if ( 'ltr' == $text_direction || empty( $_GET['td'] ) ) 6 $sprite = $_GET['inc'] . 'images/admin-bar-sprite.png?d=08102010'; 7 else 8 $sprite = $_GET['inc'] . 'images/admin-bar-sprite-rtl.png?d=08102010'; 9 ?> 10 11 #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; } 12 #wpadminbar ul, #wpadminbar ul li { position: relative; z-index: 99999; } 13 #wpadminbar ul li img { vertical-align: middle !important; margin-right: 8px !important; border: none !important; padding: 0 !important; } 14 #wpadminbar .quicklinks > ul > li > a { border-right: 1px solid #686868; border-left: 1px solid #808080; } 15 #wpadminbar .quicklinks > ul > li.ab-subscriptions > a, #wpadminbar .quicklinks > ul > li:last-child > a { border-right: none; } 16 #wpadminbar .quicklinks > ul > li.hover > a { border-left-color: #707070; } 17 #wpadminbar a { outline: none; } 18 #wpadminbar .avatar {border:1px solid #999 !important;padding:0 !important;margin:-3px 5px 0 0 !important;vertical-align:middle;float:none;display:inline !important; } 19 #wpadminbar .menupop ul li a {color:#555 !important;text-shadow:none;font-weight:normal;white-space:nowrap;} 20 #wpadminbar .menupop a > span {background:url(<?php echo $sprite; ?>) 100% 100.4% no-repeat;padding-right:.8em;line-height: 28px;} 21 #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;} 22 #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; } 23 #wpadminbar .menupop ul li a:hover span#awaiting-mod { background: #fff; color: #888; } 24 #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} 25 html>body #wpadminbar .menupop ul {background:rgba(255,255,255,0.97);border-color:rgba(0,0,0,0.1);} 26 #wpadminbar .menupop.ab-my-account ul, #wpadminbar .menupop.ab-my-dash ul, #wpadminbar .menupop.ab-new-post ul {min-width:140px} 27 #wpadminbar .menupop li {float:none;margin:0;padding:0;background-image:none;} 28 #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;} 29 #wpadminbar .quicklinks a:hover {text-shadow:#333 0px -1px 0px;} 30 #wpadminbar li.ab-privacy { float: right; background: #333; } 31 #wpadminbar li.ab-privacy > a > span { background: none; padding: 0; } 32 #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; } 33 34 #wpadminbar li.ab-sadmin { float: right; background: #555 } 35 #wpadminbar li.ab-sadmin ul, #wpadminbar li.ab-privacy ul { right: 0; float: right; } 36 #wpadminbar li.ab-sadmin > a { font-size: 11px !important; padding: 0 7px !important; border: none !important; border-left: 1px solid #666 !important; } 37 38 #wpadminbar li.ab-sadmin ul a, #wpadminbar li.ab-privacy a { border-right: none !important; border-left: none !important; } 39 #wpadminbar li.ab-sadmin ul li { right: 0; float: right; text-align: left; width: 100%; } 40 #wpadminbar li.ab-sadmin ul li a { padding-left: 1.75em; } 41 #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; } 42 #wpadminbar li a.loading { background: url(</ajax-loader.gif) 10px 50% no-repeat !important; padding-left: 29px; } 43 #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; } 44 45 #wpadminbar li:hover {background: #555 url(<?php echo $sprite; ?>) 0 -282px repeat-x;} 46 #wpadminbar li li:hover { color:#fff !important; background: #888 url(<?php echo $sprite; ?>) 0 -222px repeat-x !important;text-shadow: #666 0px -1px 0px;} 47 #wpadminbar li li:hover > a { color:#fff !important; } 48 .quicklinks ul {list-style:none;margin:0;padding:0;text-align:left} 49 .quicklinks ul li {float:left;margin:0} 50 51 #adminbarlogin {float:left;display:inline;} 52 53 #adminbarsearch {float:right; } 54 #adminbarsearch {height: 18px;padding: 3px;} 55 #adminbarsearch * {color: #555;font-size:12px;} 56 #adminbarsearch label, #adminbarsearch a { height: 28px; color: #ccc; display:block;float:left;padding:3px 4px;text-shadow:0px -1px 0px #444;} 57 #adminbarsearch a {text-decoration:underline;} 58 #adminbarsearch a:hover {color:#fff;} 59 60 #wpadminbar li.ab-me:hover, #wpadminbar li.ab-blog:hover { background:none;} 61 #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; } 62 #wpadminbar li.ab-me > a.hover, #wpadminbar li.ab-blog > a.hover { background-position: 67% 59.8%; } 63 #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; } 64 #wpadminbar li.ab-my-account a, #wpadminbar li.ab-bloginfo a { border-left: none !important; padding-left: 0.7em !important; margin-top: 0 !important; } 65 #wpadminbar li.ab-my-account > ul, #wpadminbar li.ab-bloginfo > ul { left: -7px; } 66 #wpadminbar ul li img { width: 16px !important; height: 16px !important; } 67 68 #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 } 69 70 #wpadminbar #q { 71 line-height:normal !important; 72 width:140px !important; 73 margin-top:0px !important; 74 } 75 .adminbar-input { 76 display:block !important; 77 float:left !important; 78 font:12px Arial,Helvetica,sans-serif !important; 79 border:1px solid #626262 !important; 80 padding:2px 3px !important; 81 margin-right:3px !important; 82 background:#ddd url(<?php echo $sprite; ?>) top left no-repeat !important; 83 -webkit-border-radius:0 !important; 84 -khtml-border-radius:0 !important; 85 -moz-border-radius:0 !important; 86 border-radius:0 !important; 87 outline:none; 88 text-shadow:0 1px 0 #fff; 89 } 90 button.adminbar-button { 91 position:relative; 92 border:0; 93 cursor:pointer; 94 overflow:visible; 95 margin:0 !important; 96 float:left; 97 background:url(<?php echo $sprite; ?>) right -107px no-repeat; 98 padding:0 14px 0 0; 99 text-align:center; 100 } 101 button.adminbar-button span { 102 position:relative; 103 display:block; 104 white-space:nowrap; 105 height:19px; 106 background:url(<?php echo $sprite; ?>) left -69px no-repeat; 107 padding:3px 0 0 14px; 108 font:12px Arial,Helvetica,sans-serif !important; 109 font-weight:bold !important; 110 color:#444 !important; 111 text-shadow:0px 1px 0px #eee !important; 112 } 113 button.adminbar-button:active { 114 background-position:right -184px !important; 115 text-shadow:0px 1px 0px #eee !important; 116 } 117 button.adminbar-button:hover span { 118 color:#000 !important; 119 } 120 button.adminbar-button:active span { 121 background-position:left -146px !important; 122 } 123 button.adminbar-button::-moz-focus-inner { 124 border:none; 125 } 126 @media screen and (-webkit-min-device-pixel-ratio:0) { 127 button.adminbar-button span { 128 margin-top: -1px; 129 } 130 } 131 132 <?php if ( 'rtl' == $text_direction ) : ?> 133 #wpadminbar { 134 direction:rtl; 135 font-family: Tahoma, Arial ,sans-serif; 136 right:0; 137 left:auto; 138 } 139 #wpadminbar div, #wpadminbar ul, #wpadminbar ul li { 140 min-height: 0; 141 } 142 #wpadminbar ul li img { margin-left: 8px !important; margin-right: 0 !important; } 143 #wpadminbar .quicklinks > ul > li > a { border-left: 1px solid #686868; border-right: 1px solid #808080;} 144 #wpadminbar .quicklinks > ul > li.ab-subscriptions > a, #wpadminbar .quicklinks > ul > li:last-child > a { border-left: none; border-right: 1px solid #808080;} 145 #wpadminbar .quicklinks > ul > li.hover > a { border-right-color: #707070; border-left-color: #686868; } 146 #wpadminbar .avatar {margin: -3px 0 0 5px !important; float:none; } 147 #wpadminbar .menupop a > span {background-position: 0 100.4%; padding-left:.8em;} 148 #wpadminbar .menupop ul li a > span { background-position: 0% 97.2%; padding-right:0;padding-left:1.5em } 149 #wpadminbar .menupop ul {right: 0; width:100%; min-width:150px;} 150 #wpadminbar .ab-my-account ul { width:200px;} 151 #wpadminbar .ab-my-blogs ul { width:300px;} 152 #wpadminbar .ab-my-blogs ul ul { width:200px;} 153 #wpadminbar .ab-subscribe ul { width:150px;} 154 #wpadminbar .ab-bloginfo ul { width:200px;} 155 #wpadminbar .ab-subscribe ul { width:150px;} 156 #wpadminbar .ab-subscriptions ul { width:200px;} 157 #wpadminbar .menupop ul li {width:auto} 158 #wpadminbar .quicklinks a {font-family: Tahoma, Arial, Helvetica, sans-serif;} 159 #wpadminbar li.ab-privacy { float: left; } 160 #wpadminbar li.ab-privacy span#priv-icon { text-indent: 999em; background-position: 60% 59.7%; padding: 0; margin-right: 0; margin-left: -3px;} 161 162 #wpadminbar li.ab-sadmin { float: left; } 163 #wpadminbar li.ab-sadmin ul, #wpadminbar li.ab-privacy ul { right: auto; left: 0; float: left; } 164 #wpadminbar li.ab-sadmin > a { border-right: 1px solid #666 !important; border-left:none !important;} 165 166 #wpadminbar li.ab-sadmin ul a, #wpadminbar li.ab-privacy a { border-right: none !important; border-left: none !important; } 167 #wpadminbar li.ab-sadmin ul li { left: 0; right:auto; float: left; text-align: right; } 168 169 170 #wpadminbar li.ab-sadmin ul li a { padding-right: 1.75em; padding-left: 0 } 171 #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; } 172 #wpadminbar li a.loading { background-position: right 50% !important; padding-right: 29px; padding-left: 0;} 173 #wpadminbar li.subscribed a strong { background-position: 68% 59.8% !important; padding: 0 0 0 16px; float: right; margin-left: 2px; } 174 175 176 .quicklinks ul {text-align:right} 177 .quicklinks ul li {float:right;} 178 179 #adminbarlogin {float:right;} 180 181 #adminbarsearch {display:none;} 182 #adminbarsearch label, #adminbarsearch a { float:right;} 183 184 #wpadminbar li.ab-me > a, #wpadminbar li.ab-blog > a { background-position:0% 59.8%; padding: 0 0.7em 0 1.15em; } 185 #wpadminbar li.ab-me > a.hover, #wpadminbar li.ab-blog > a.hover { background-position: 33% 59.8%; } 186 #wpadminbar li.ab-my-account a, #wpadminbar li.ab-bloginfo a { border-right: none !important; padding-right: 0.7em !important; } 187 #wpadminbar li.ab-my-account > ul, #wpadminbar li.ab-bloginfo > ul { right: -7px; left:auto;} 188 189 #wpadminbar ul li a strong.count { margin-right: 5px; margin-left: 0; position:static} 190 191 192 .adminbar-input { 193 float:right !important; 194 font-family: Tahoma, Arial,Helvetica,sans-serif !important; 195 margin-right:3px !important; 196 margin-left:0 !important; 197 background-position: right top !important; 198 } 199 button.adminbar-button { 200 float:right; 201 background-position: left -107px; 202 padding:0 0 0 14px; 203 } 204 button.adminbar-button span { 205 background-position: right -69px; 206 padding:3px 14px 0 0; 207 font-family: Tahoma, Arial,Helvetica,sans-serif !important; 208 } 209 button.adminbar-button:active { 210 background-position:left -184px !important; 211 } 212 button.adminbar-button:active span { 213 background-position:right -146px !important; 214 } 215 <?php 216 endif; 217 218 $current_theme = str_replace( '+', ' ', $_GET['t'] ); 219 $is_admin = $_GET['a']; 220 $is_super_admin = $_GET['sa']; 221 222 if ( ( empty($_GET['nobump']) || $is_admin ) && !strpos( $_SERVER['REQUEST_URI'], 'media-upload.php' ) ) : ?> 223 body { padding-top: 28px !important; } 224 <?php endif; ?> 225 226 <?php if ( in_array( $current_theme, array('H3', 'H4', 'The Journalist v1.9') ) ) { ?> 227 body { padding-top: 28px; background-position: 0px 28px; } 228 <?php } ?> 229 230 <?php if ( $is_super_admin ) : ?> 231 #querylist { 232 font-family: Arial, Tahoma, sans-serif; 233 display: none; 234 position: absolute; 235 top: 50px; 236 left: 50px; 237 right: 50px; 238 background: #fff; 239 padding: 20px; 240 -moz-box-shadow: 0 0 15px #888; 241 -webkit-box-shadow: 0 0 15px #888; 242 box-shadow: 0 0 15px #888; 243 z-index: 99999; 244 border: 10px solid #f0f0f0; 245 color: #000; 246 line-height: 150% !important; 247 } 248 #querylist pre { 249 font-size: 12px; 250 padding: 10px; 251 } 252 253 #querylist h1 { 254 font-family: georgia, times, serif; 255 text-align: center; 256 font-size: 24px; 257 padding: 20px 5px; 258 background: #eee; 259 color: #555; 260 margin: 0; 261 } 262 #querylist div#debug-status { 263 background: #ccc; 264 color: #fff; 265 overflow: hidden; 266 height: 21px; 267 font-size: 14px; 268 font-family: georgia, times, serif; 269 padding: 7px 15px; 270 } 271 #querylist .left { float: left; } 272 #querylist .right { float: right; } 273 274 #querylist h1, #querylist h2, #querylist h3 { 275 font-weight: normal; 276 } 277 278 #querylist ul.debug-menu-links { 279 clear: left; 280 background: #ccc; 281 padding: 10px 15px 0; 282 overflow: hidden; 283 list-style: none; 284 margin: 0; 285 padding: 0 0 0 15px; 286 } 287 #querylist ul.debug-menu-links li { 288 float: left; 289 margin-right: 10px; 290 margin-bottom: 0 !important; 291 } 292 293 #querylist ul.debug-menu-links li a { 294 outline: none; 295 display: block; 296 padding: 5px 9px; 297 margin-right: 0; 298 background: #bbb; 299 color: #fff !important; 300 text-decoration: none !important; 301 font-weight: normal; 302 font-size: 12px; 303 color: #555; 304 -webkit-border-top-right-radius: 4px; 305 -webkit-border-top-left-radius: 4px; 306 -moz-border-radius-topright: 4px; 307 -moz-border-radius-topleft: 4px; 308 } 309 #querylist ul.debug-menu-links li.current a { 310 background: #fff; 311 color: #555 !important; 312 } 313 314 #querylist h2 { 315 float: left; 316 min-width: 150px; 317 border: 1px solid #eee; 318 padding: 5px 10px 15px; 319 clear: none; important; 320 text-align: center; 321 font-family: georgia, times, serif; 322 font-size: 28px; 323 margin: 15px 10px 15px 0 !important; 324 } 325 #querylist h2 span { 326 font-size: 12px; 327 color: #888; 328 text-transform: uppercase; 329 white-space: nowrap; 330 display: block; 331 margin-bottom: 5px; 332 } 333 334 #memcache-stats h2 { 335 border: none; 336 float: none; 337 text-align: left; 338 font-size: 22px; 339 margin-bottom: 0; 340 } 341 342 #memcache-stats ul.debug-menu-links { 343 padding: 0; 344 margin: 0; 345 background: none; 346 } 347 #memcache-stats ul.debug-menu-links li { 348 float: left; 349 margin-bottom: 10px !important; 350 background: none !important; 351 border: 1px solid #eee !important; 352 color: #555 !important; 353 } 354 #memcache-stats ul.debug-menu-links li.current a { 355 background: #ccc !important; 356 color: #fff !important; 357 -webkit-border-top-right-radius: 0; 358 -webkit-border-top-left-radius: 0; 359 -moz-border-radius-topright: 0; 360 -moz-border-radius-topleft: 0; 361 } 362 363 #memcache-stats ul.debug-menu-links li a { 364 background: none; 365 color: #555 !important; 366 overflow: hidden; 367 } 368 369 #querylist h3 { 370 margin-bottom: 15px; 371 } 372 373 #querylist ol#wpd-queries { 374 padding: 0 !important; 375 margin: 0 !important; 376 list-style: none; 377 clear: left; 378 } 379 #querylist ol#wpd-queries li { 380 padding: 10px; 381 background: #f0f0f0; 382 margin: 0 0 10px 0; 383 } 384 #querylist ol#wpd-queries li div.qdebug { 385 background: #e8e8e8; 386 margin: 10px -10px -10px -10px; 387 padding: 5px 150px 5px 5px; 388 font-size: 11px; 389 position: relative; 390 min-height: 20px; 391 } 392 393 #querylist ol#wpd-queries li div.qdebug span { 394 position: absolute; 395 right: 10px; 396 top: 5px; 397 white-space: nowrap; 398 } 399 400 #querylist a { 401 text-decoration: underline !important; 402 color: blue !important; 403 } 404 #querylist a:hover { 405 text-decoration: none !important; 406 } 407 #querylist .debug-menu-target { 408 display: none; 409 } 410 411 #querylist ol { 412 font: 12px Monaco, "Courier New", Courier, Fixed !important; 413 line-height: 180% !important; 414 } 415 416 #wpadminbar #admin-bar-micro ul li { 417 list-style-type: none; 418 position: relative; 419 margin: 0; 420 padding: 0; 421 } 422 #wpadminbar #admin-bar-micro ul ul, #wpadminbar #admin-bar-micro #awaiting-mod, #wpadminbar .ab-sadmin .count-0 { 423 display: none !important; 424 } 425 #wpadminbar #admin-bar-micro ul li:hover > ul { 426 display: block; 427 position: absolute; 428 top: -1px; 429 left: 100%; 430 } 431 #wpadminbar #admin-bar-micro li a { 432 display: block; 433 text-decoration: none; 434 } 435 #wpadminbar #admin-bar-micro li li a { 436 background: #ddd; 437 } 438 #wpadminbar #admin-bar-micro li li li a { 439 background: #fff; 440 } 441 442 <?php if ( 'rtl' == $text_direction ) : ?> 443 444 #querylist { 445 direction: ltr; 446 } 447 448 #wpadminbar #admin-bar-micro ul li:hover > ul { 449 left: auto; 450 right: 100%; 451 } 452 <?php endif; ?> 453 <?php endif; ?> 454 No newline at end of file -
wp-includes/ms-functions.php
Property changes on: wp-includes/admin-bar/admin-bar-css.php ___________________________________________________________________ Added: svn:eol-style + native Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: wp-includes/images/admin-bar-sprite-rtl.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: wp-includes/images/admin-bar-sprite.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: wp-includes/images/wpmini-blue.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream
30 30 return false; 31 31 } 32 32 33 function get_blogs_of_user( $id, $all = false ) {34 global $wpdb;35 36 $cache_suffix = $all ? '_all' : '_short';37 $return = wp_cache_get( 'blogs_of_user_' . $id . $cache_suffix, 'users' );38 if ( $return )39 return apply_filters( 'get_blogs_of_user', $return, $id, $all );40 41 $user = get_userdata( (int) $id );42 if ( !$user )43 return false;44 45 $blogs = $match = array();46 $prefix_length = strlen($wpdb->base_prefix);47 foreach ( (array) $user as $key => $value ) {48 if ( $prefix_length && substr($key, 0, $prefix_length) != $wpdb->base_prefix )49 continue;50 if ( substr($key, -12, 12) != 'capabilities' )51 continue;52 if ( preg_match( '/^' . $wpdb->base_prefix . '((\d+)_)?capabilities$/', $key, $match ) ) {53 if ( count( $match ) > 2 )54 $blog_id = $match[ 2 ];55 else56 $blog_id = 1;57 $blog = get_blog_details( $blog_id );58 if ( $blog && isset( $blog->domain ) && ( $all == true || $all == false && ( $blog->archived == 0 && $blog->spam == 0 && $blog->deleted == 0 ) ) ) {59 $blogs[ $blog_id ]->userblog_id = $blog_id;60 $blogs[ $blog_id ]->blogname = $blog->blogname;61 $blogs[ $blog_id ]->domain = $blog->domain;62 $blogs[ $blog_id ]->path = $blog->path;63 $blogs[ $blog_id ]->site_id = $blog->site_id;64 $blogs[ $blog_id ]->siteurl = $blog->siteurl;65 }66 }67 }68 69 wp_cache_add( 'blogs_of_user_' . $id . $cache_suffix, $blogs, 'users', 5 );70 return apply_filters( 'get_blogs_of_user', $blogs, $id, $all );71 }72 73 33 function get_active_blog_for_user( $user_id ) { // get an active blog for user - either primary blog or from blogs list 74 34 global $wpdb; 75 35 $blogs = get_blogs_of_user( $user_id ); … … 366 326 return $url; 367 327 } 368 328 369 function is_blog_user( $blog_id = 0 ) {370 global $wpdb;371 372 $current_user = wp_get_current_user();373 if ( !$blog_id )374 $blog_id = $wpdb->blogid;375 376 $cap_key = $wpdb->base_prefix . $blog_id . '_capabilities';377 378 if ( is_array($current_user->$cap_key) && in_array(1, $current_user->$cap_key) )379 return true;380 381 return false;382 }383 384 329 function is_email_address_unsafe( $user_email ) { 385 330 $banned_names = get_site_option( 'banned_email_domains' ); 386 331 if ($banned_names && !is_array( $banned_names )) -
wp-settings.php
133 133 require( ABSPATH . WPINC . '/widgets.php' ); 134 134 require( ABSPATH . WPINC . '/nav-menu.php' ); 135 135 require( ABSPATH . WPINC . '/nav-menu-template.php' ); 136 require( ABSPATH . WPINC . '/admin-bar.php' ); 136 137 137 138 // Load multisite-specific files. 138 139 if ( is_multisite() ) {