Ticket #18188: 18188.3.diff
File 18188.3.diff, 4.7 KB (added by , 13 years ago) |
---|
-
wp-includes/admin-bar.php
287 287 if ( count( $wp_admin_bar->user->blogs ) < 1 && ! is_super_admin() ) 288 288 return; 289 289 290 $is_list_secondary = false; 291 290 292 $wp_admin_bar->add_menu( array( 291 293 'id' => 'my-sites', 292 294 'title' => __( 'My Sites' ), 293 295 'href' => admin_url( 'my-sites.php' ), 294 296 ) ); 295 297 296 if ( is_super_admin() ) { 298 if ( is_super_admin() && is_blog_admin() ) { 299 $is_list_secondary = true; 300 297 301 $wp_admin_bar->add_group( array( 298 302 'parent' => 'my-sites', 299 303 'id' => 'my-sites-super-admin', … … 332 336 ) ); 333 337 } 334 338 339 if ( is_network_admin() && is_super_admin() ) { 340 if ( 'sites' == get_current_screen()->parent_base && !empty( $_REQUEST['id'] ) ) { 341 $is_list_secondary = true; 342 $site = get_blog_details( intval( $_REQUEST['id'] ), true ); 343 $site->userblog_id = $site->blog_id; 344 _wp_admin_bar_site_menu( $site, 'edit-site', 'my-sites', $wp_admin_bar ); 345 } 346 } 347 335 348 // Add site links 336 349 $wp_admin_bar->add_group( array( 337 350 'parent' => 'my-sites', 338 351 'id' => 'my-sites-list', 339 352 'meta' => array( 340 'class' => is_super_admin()? 'ab-sub-secondary' : '',353 'class' => $is_list_secondary ? 'ab-sub-secondary' : '', 341 354 ), 342 355 ) ); 343 356 357 foreach ( (array) $wp_admin_bar->user->blogs as $blog ) { 358 if ( isset( $site ) && ( $site->userblog_id == $blog->userblog_id ) ) 359 continue; 360 _wp_admin_bar_site_menu( $blog, 'blog-' . $blog->userblog_id, 'my-sites-list', $wp_admin_bar ); 361 } 362 } 363 364 function _wp_admin_bar_site_menu( $blog, $menu_id, $parent, $wp_admin_bar ) { 344 365 $blue_wp_logo_url = includes_url('images/wpmini-blue.png'); 366 // @todo Replace with some favicon lookup. 367 //$blavatar = '<img src="' . esc_url( blavatar_url( blavatar_domain( $blog->siteurl ), 'img', 16, $blue_wp_logo_url ) ) . '" alt="Blavatar" width="16" height="16" />'; 368 $blavatar = '<img src="' . esc_url($blue_wp_logo_url) . '" alt="' . esc_attr__( 'Blavatar' ) . '" width="16" height="16" class="blavatar"/>'; 345 369 346 foreach ( (array) $wp_admin_bar->user->blogs as $blog ) { 347 // @todo Replace with some favicon lookup. 348 //$blavatar = '<img src="' . esc_url( blavatar_url( blavatar_domain( $blog->siteurl ), 'img', 16, $blue_wp_logo_url ) ) . '" alt="Blavatar" width="16" height="16" />'; 349 $blavatar = '<img src="' . esc_url($blue_wp_logo_url) . '" alt="' . esc_attr__( 'Blavatar' ) . '" width="16" height="16" class="blavatar"/>'; 370 $blogname = empty( $blog->blogname ) ? $blog->domain : $blog->blogname; 350 371 351 $blogname = empty( $blog->blogname ) ? $blog->domain : $blog->blogname; 352 $menu_id = 'blog-' . $blog->userblog_id; 372 $wp_admin_bar->add_menu( array( 373 'parent' => $parent, 374 'id' => $menu_id, 375 'title' => $blavatar . $blogname, 376 'href' => get_admin_url( $blog->userblog_id ), 377 ) ); 353 378 354 355 'parent' => 'my-sites-list',356 'id' => $menu_id,357 'title' => $blavatar . $blogname,358 'href'=> get_admin_url( $blog->userblog_id ),359 379 $wp_admin_bar->add_menu( array( 380 'parent' => $menu_id, 381 'id' => $menu_id . '-d', 382 'title' => __( 'Dashboard' ), 383 'href' => get_admin_url( $blog->userblog_id ), 384 ) ); 360 385 386 if ( current_user_can_for_blog( $blog->userblog_id, 'edit_posts' ) ) { 361 387 $wp_admin_bar->add_menu( array( 362 388 'parent' => $menu_id, 363 'id' => $menu_id . '- d',364 'title' => __( ' Dashboard' ),365 'href' => get_admin_url( $blog->userblog_id ),389 'id' => $menu_id . '-n', 390 'title' => __( 'New Post' ), 391 'href' => get_admin_url( $blog->userblog_id, 'post-new.php' ), 366 392 ) ); 367 368 if ( current_user_can_for_blog( $blog->userblog_id, 'edit_posts' ) ) {369 $wp_admin_bar->add_menu( array(370 'parent' => $menu_id,371 'id' => $menu_id . '-n',372 'title' => __( 'New Post' ),373 'href' => get_admin_url( $blog->userblog_id, 'post-new.php' ),374 ) );375 $wp_admin_bar->add_menu( array(376 'parent' => $menu_id,377 'id' => $menu_id . '-c',378 'title' => __( 'Manage Comments' ),379 'href' => get_admin_url( $blog->userblog_id, 'edit-comments.php' ),380 ) );381 }382 383 393 $wp_admin_bar->add_menu( array( 384 394 'parent' => $menu_id, 385 'id' => $menu_id . '- v',386 'title' => __( ' Visit Site' ),387 'href' => get_ home_url( $blog->userblog_id, '/' ),395 'id' => $menu_id . '-c', 396 'title' => __( 'Manage Comments' ), 397 'href' => get_admin_url( $blog->userblog_id, 'edit-comments.php' ), 388 398 ) ); 389 399 } 400 401 $wp_admin_bar->add_menu( array( 402 'parent' => $menu_id, 403 'id' => $menu_id . '-v', 404 'title' => __( 'Visit Site' ), 405 'href' => get_home_url( $blog->userblog_id, '/' ), 406 ) ); 390 407 } 391 408 392 409 /**