Avatar alt fixes from nbachiyski. fixes #7536

git-svn-id: http://svn.automattic.com/wordpress/trunk@9076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-10-03 03:20:54 +00:00
parent f286979c28
commit f03180a5e1
1 changed files with 9 additions and 4 deletions

View File

@ -1454,13 +1454,18 @@ if ( !function_exists( 'get_avatar' ) ) :
* @param int|string|object $id_or_email A user ID, email address, or comment object
* @param int $size Size of the avatar image
* @param string $default URL to a default image to use if no avatar is available
* @param string $alt Alternate text to use in image tag
* @param string $alt Alternate text to use in image tag, the default is Avatar
* @return string <img> tag for the user's avatar
*/
function get_avatar( $id_or_email, $size = '96', $default = '', $alt = 'Avatar' ) {
function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
if ( ! get_option('show_avatars') )
return false;
if ( false === $alt)
$alt = __( 'Avatar' );
$safe_alt = attribute_escape( $alt );
if ( !is_numeric($size) )
$size = '96';
@ -1517,9 +1522,9 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = 'Avatar'
if ( !empty( $rating ) )
$out .= "&amp;r={$rating}";
$avatar = "<img alt='{$alt}' src='{$out}' class='avatar avatar-{$size}' height='{$size}' width='{$size}' />";
$avatar = "<img alt='{$safe_alt}' src='{$out}' class='avatar avatar-{$size}' height='{$size}' width='{$size}' />";
} else {
$avatar = "<img alt='{$alt}' src='{$default}' class='avatar avatar-{$size} avatar-default' height='{$size}' width='{$size}' />";
$avatar = "<img alt='{$safe_alt}' src='{$default}' class='avatar avatar-{$size} avatar-default' height='{$size}' width='{$size}' />";
}
return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);