Changeset 18919 for trunk/wp-includes/admin-bar.php
- Timestamp:
- 10/07/2011 07:52:26 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/admin-bar.php
r18916 r18919 220 220 221 221 /** 222 * Add the " Blog Name" menu in the front end.222 * Add the "Site Name" menu. 223 223 * 224 224 * @since 3.3.0 225 225 */ 226 function wp_admin_bar_blog_front_menu( $wp_admin_bar ) { 226 function wp_admin_bar_site_menu( $wp_admin_bar ) { 227 global $current_site; 228 227 229 if ( ! is_user_logged_in() ) 228 230 return; … … 232 234 if ( empty( $blogname ) ) 233 235 $blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() ); 236 237 if ( is_network_admin() ) { 238 $blogname = sprintf( __('Network Admin: %s'), esc_html( $current_site->site_name ) ); 239 } elseif ( is_user_admin() ) { 240 $blogname = sprintf( __('Global Dashboard: %s'), esc_html( $current_site->site_name ) ); 241 } 234 242 235 243 $title = wp_html_excerpt( $blogname, 40 ); … … 238 246 239 247 $wp_admin_bar->add_menu( array( 240 'id' => ' blog-name',248 'id' => 'site-name', 241 249 'title' => $title, 242 'href' => admin_url(), 243 ) ); 244 245 // Add Dashboard item. 246 $wp_admin_bar->add_menu( array( 247 'id' => 'dashboard', 248 'title' => __( 'Dashboard' ), 249 'href' => admin_url(), 250 'parent' => 'blog-name', 251 ) ); 252 253 wp_admin_bar_appearance_menu( $wp_admin_bar ); 254 } 255 256 /** 257 * Add the "Blog Name" menu in the admin. 258 * 259 * @since 3.3.0 260 */ 261 function wp_admin_bar_blog_admin_menu( $wp_admin_bar ) { 262 global $current_site; 263 264 if ( is_network_admin() ) { 265 $title = sprintf( __('Network Admin: %s'), esc_html($current_site->site_name) ); 266 $url = '#'; 267 } elseif ( is_user_admin() ) { 268 $title = sprintf( __('Global Dashboard: %s'), esc_html($current_site->site_name) ); 269 $url = '#'; 250 'href' => is_admin() ? home_url() : admin_url(), 251 ) ); 252 253 // Create submenu items. 254 255 if ( is_admin() ) { 256 // Add an option to visit the site. 257 $wp_admin_bar->add_menu( array( 258 'parent' => 'site-name', 259 'id' => 'view-site', 260 'title' => __( 'Visit Site' ), 261 'href' => home_url(), 262 ) ); 263 264 // We're on the front end, print a copy of the admin menu. 270 265 } else { 271 $title = get_bloginfo('name'); 272 $url = get_home_url(); 273 274 if ( empty( $title ) ) 275 $title = preg_replace( '#^(https?://)?(www.)?#', '', $url ); 276 } 277 278 $title_excerpt = wp_html_excerpt( $title, 40 ); 279 if ( $title != $title_excerpt ) 280 $title_excerpt = trim( $title_excerpt ) . '…'; 281 282 $wp_admin_bar->add_menu( array( 283 'id' => 'blog-name', 284 'title' => $title_excerpt, 285 'href' => $url, 286 ) ); 287 288 $wp_admin_bar->add_menu( array( 289 'parent' => 'blog-name', 290 'id' => 'view-site', 291 'title' => __( 'Visit Site' ), 292 'href' => home_url(), 293 ) ); 266 // Add the dashboard item. 267 $wp_admin_bar->add_menu( array( 268 'parent' => 'site-name', 269 'id' => 'dashboard', 270 'title' => __( 'Dashboard' ), 271 'href' => admin_url(), 272 ) ); 273 274 // Add the appearance menu. 275 wp_admin_bar_appearance_menu( $wp_admin_bar ); 276 } 294 277 } 295 278 … … 587 570 'title' => __('Appearance'), 588 571 'href' => admin_url('themes.php'), 589 'parent' => ' blog-name',572 'parent' => 'site-name', 590 573 ) ); 591 574
Note: See TracChangeset
for help on using the changeset viewer.