@@ 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 ) ) { |
|
@@ 377-392 (lines=16) @@ | ||
374 | else |
|
375 | $image = $avatar; |
|
376 | } |
|
377 | } else { |
|
378 | $has_filter = has_filter( 'pre_option_show_avatars', '__return_true' ); |
|
379 | if ( !$has_filter ) { |
|
380 | add_filter( 'pre_option_show_avatars', '__return_true' ); |
|
381 | } |
|
382 | $avatar = get_avatar( $email, $width ); |
|
383 | ||
384 | if ( !$has_filter ) { |
|
385 | remove_filter( 'pre_option_show_avatars', '__return_true' ); |
|
386 | } |
|
387 | ||
388 | if ( !empty( $avatar ) && !is_wp_error( $avatar ) ) { |
|
389 | if ( preg_match( '/src=["\']([^"\']+)["\']/', $avatar, $matches ) ) |
|
390 | $image = wp_specialchars_decode($matches[1], ENT_QUOTES); |
|
391 | } |
|
392 | } |
|
393 | ||
394 | return $image; |
|
395 | } |