Admin Bar - show fullsite name in the tooltip. Correct some escaping. Fixes #16197 props nacin.

git-svn-id: https://develop.svn.wordpress.org/trunk@17269 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2011-01-12 16:02:56 +00:00
parent 6356b0a0b8
commit 0105bcadf7
2 changed files with 12 additions and 7 deletions

View File

@ -114,11 +114,13 @@ function wp_admin_bar_my_sites_menu() {
//$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="' . esc_attr__( 'Blavatar' ) . '" width="16" height="16" class="blavatar"/>';
$blogname = empty( $blog->blogname ) ? $blog->domain : $blog->blogname;
$full_blogname = $blogname = empty( $blog->blogname ) ? $blog->domain : $blog->blogname;
if ( strlen( $blogname ) > 15 )
$blogname = substr( $blogname, 0, 15 ) . '&hellip;';
else
$full_blogname = '';
$wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-' . $blog->userblog_id, 'title' => $blavatar . $blogname, 'href' => get_admin_url($blog->userblog_id), ) );
$wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-' . $blog->userblog_id, 'title' => $blavatar . $blogname, 'href' => get_admin_url($blog->userblog_id), 'meta' => array( 'title' => $full_blogname ) ) );
$wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-d', 'title' => __( 'Dashboard' ), 'href' => get_admin_url($blog->userblog_id) ) );
if ( current_user_can_for_blog( $blog->userblog_id, 'edit_posts' ) ) {

View File

@ -53,7 +53,7 @@ class WP_Admin_Bar {
'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 => '' );
'meta' => false // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' );
);
$r = wp_parse_args( $args, $defaults );
@ -117,15 +117,18 @@ class WP_Admin_Bar {
<li class="<?php echo $menuclass . "ab-$id" ?><?php
if ( ! empty( $menu_item['meta']['class'] ) ) :
echo ' ' . $menu_item['meta']['class'];
echo ' ' . esc_attr( $menu_item['meta']['class'] );
endif;
?>">
<a href="<?php echo strip_tags( $menu_item['href'] ) ?>"<?php
<a href="<?php echo esc_url( $menu_item['href'] ) ?>"<?php
if ( ! empty( $menu_item['meta']['onclick'] ) ) :
?> onclick="<?php echo $menu_item['meta']['onclick']; ?>"<?php
?> onclick="<?php echo esc_js( $menu_item['meta']['onclick'] ); ?>"<?php
endif;
if ( ! empty( $menu_item['meta']['target'] ) ) :
?> target="<?php echo $menu_item['meta']['target']; ?>"<?php
?> target="<?php echo esc_attr( $menu_item['meta']['target'] ); ?>"<?php
endif;
if ( ! empty( $menu_item['meta']['title'] ) ) :
?> title="<?php echo esc_attr( $menu_item['meta']['title'] ); ?>"<?php
endif;
?>><?php