In get_avatar()
, revert the <img>
tag attributes to using single quotes, instead of double quotes. This behaviour was changed in [31107], but caused problems for code that attempted to parse the <img>
tag.
See #21195 git-svn-id: https://develop.svn.wordpress.org/trunk@31152 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
156a673660
commit
d0fab598e7
@ -2181,7 +2181,7 @@ function get_avatar( $id_or_email, $size = 96, $default = '', $alt = '', $args =
|
|||||||
}
|
}
|
||||||
|
|
||||||
$avatar = sprintf(
|
$avatar = sprintf(
|
||||||
'<img alt="%s" src="%s" class="%s" height="%d" width="%d" />',
|
"<img alt='%s' src='%s' class='%s' height='%d' width='%d' />",
|
||||||
esc_attr( $args['alt'] ),
|
esc_attr( $args['alt'] ),
|
||||||
esc_url( $url ),
|
esc_url( $url ),
|
||||||
esc_attr( join( ' ', $class ) ),
|
esc_attr( join( ' ', $class ) ),
|
||||||
|
@ -166,30 +166,30 @@ class Tests_Avatar extends WP_UnitTestCase {
|
|||||||
|
|
||||||
public function test_get_avatar() {
|
public function test_get_avatar() {
|
||||||
$img = get_avatar( 1 );
|
$img = get_avatar( 1 );
|
||||||
$this->assertEquals( preg_match( '|^<img alt="[^"]*" src="[^"]*" class="[^"]*" height="[^"]*" width="[^"]*" />$|', $img ), 1 );
|
$this->assertEquals( preg_match( "|^<img alt='[^']*' src='[^']*' class='[^']*' height='[^']*' width='[^']*' />$|", $img ), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_avatar_size() {
|
public function test_get_avatar_size() {
|
||||||
$size = '100';
|
$size = '100';
|
||||||
$img = get_avatar( 1, $size );
|
$img = get_avatar( 1, $size );
|
||||||
$this->assertEquals( preg_match( '|^<img .*height="' . $size . '".*width="' . $size . '"|', $img ), 1 );
|
$this->assertEquals( preg_match( "|^<img .*height='$size'.*width='$size'|", $img ), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_avatar_alt() {
|
public function test_get_avatar_alt() {
|
||||||
$alt = 'Mr Hyde';
|
$alt = 'Mr Hyde';
|
||||||
$img = get_avatar( 1, 96, '', $alt );
|
$img = get_avatar( 1, 96, '', $alt );
|
||||||
$this->assertEquals( preg_match( '|^<img alt="' . $alt . '"|', $img ), 1 );
|
$this->assertEquals( preg_match( "|^<img alt='$alt'|", $img ), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_avatar_class() {
|
public function test_get_avatar_class() {
|
||||||
$class = 'first';
|
$class = 'first';
|
||||||
$img = get_avatar( 1, 96, '', '', array( 'class' => $class ) );
|
$img = get_avatar( 1, 96, '', '', array( 'class' => $class ) );
|
||||||
$this->assertEquals( preg_match( '|^<img .*class="[^"]*' . $class . '[^"]*"|', $img ), 1 );
|
$this->assertEquals( preg_match( "|^<img .*class='[^']*{$class}[^']*'|", $img ), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_avatar_default_class() {
|
public function test_get_avatar_default_class() {
|
||||||
$img = get_avatar( 1, 96, '', '', array( 'force_default' => true ) );
|
$img = get_avatar( 1, 96, '', '', array( 'force_default' => true ) );
|
||||||
$this->assertEquals( preg_match( '|^<img .*class="[^"]*avatar-default[^"]*"|', $img ), 1 );
|
$this->assertEquals( preg_match( "|^<img .*class='[^']*avatar-default[^']*'|", $img ), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_avatar_force_display() {
|
public function test_get_avatar_force_display() {
|
||||||
|
Loading…
Reference in New Issue
Block a user