|
@@ 295-309 (lines=15) @@
|
| 292 |
|
// Prefer the core function get_avatar_url() if available, WP 4.2+ |
| 293 |
|
$image['src'] = get_avatar_url( $author->user_email, array( 'size' => $width ) ); |
| 294 |
|
} |
| 295 |
|
else { |
| 296 |
|
$has_filter = has_filter( 'pre_option_show_avatars', '__return_true' ); |
| 297 |
|
if ( ! $has_filter ) { |
| 298 |
|
add_filter( 'pre_option_show_avatars', '__return_true' ); |
| 299 |
|
} |
| 300 |
|
$avatar = get_avatar( $author->user_email, $width ); |
| 301 |
|
if ( ! $has_filter ) { |
| 302 |
|
remove_filter( 'pre_option_show_avatars', '__return_true' ); |
| 303 |
|
} |
| 304 |
|
|
| 305 |
|
if ( ! empty( $avatar ) && ! is_wp_error( $avatar ) ) { |
| 306 |
|
if ( preg_match( '/src=["\']([^"\']+)["\']/', $avatar, $matches ) ); |
| 307 |
|
$image['src'] = wp_specialchars_decode( $matches[1], ENT_QUOTES ); |
| 308 |
|
} |
| 309 |
|
} |
| 310 |
|
} |
| 311 |
|
|
| 312 |
|
if ( empty( $image ) ) { |
|
@@ 414-429 (lines=16) @@
|
| 411 |
|
else |
| 412 |
|
$image = $avatar; |
| 413 |
|
} |
| 414 |
|
} else { |
| 415 |
|
$has_filter = has_filter( 'pre_option_show_avatars', '__return_true' ); |
| 416 |
|
if ( !$has_filter ) { |
| 417 |
|
add_filter( 'pre_option_show_avatars', '__return_true' ); |
| 418 |
|
} |
| 419 |
|
$avatar = get_avatar( $email, $width ); |
| 420 |
|
|
| 421 |
|
if ( !$has_filter ) { |
| 422 |
|
remove_filter( 'pre_option_show_avatars', '__return_true' ); |
| 423 |
|
} |
| 424 |
|
|
| 425 |
|
if ( !empty( $avatar ) && !is_wp_error( $avatar ) ) { |
| 426 |
|
if ( preg_match( '/src=["\']([^"\']+)["\']/', $avatar, $matches ) ) |
| 427 |
|
$image = wp_specialchars_decode($matches[1], ENT_QUOTES); |
| 428 |
|
} |
| 429 |
|
} |
| 430 |
|
|
| 431 |
|
return $image; |
| 432 |
|
} |