Avatar alt fixes from nbachiyski. fixes #7536

git-svn-id: https://develop.svn.wordpress.org/trunk@9076 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-10-03 03:20:54 +00:00
parent 6018669f89
commit ede64bdbf9
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);