From 366a05425d023c51318464c24cdb4ee75ef52c59 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 29 Jan 2009 17:58:16 +0000 Subject: [PATCH] Use secure.gravatar.com for SSL avatar requests. fixes #8988 for trunk git-svn-id: https://develop.svn.wordpress.org/trunk@10461 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/pluggable.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 0028b8cfad..f615adc4c5 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -1508,21 +1508,26 @@ function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) { $default = $avatar_default; } + if ( is_ssl() ) + $host = 'https://secure.gravatar.com'; + else + $host = 'http://www.gravatar.com'; + if ( 'mystery' == $default ) - $default = "http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com') + $default = "$host/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com') elseif ( 'blank' == $default ) $default = includes_url('images/blank.gif'); elseif ( !empty($email) && 'gravatar_default' == $default ) $default = ''; elseif ( 'gravatar_default' == $default ) - $default = "http://www.gravatar.com/avatar/s={$size}"; + $default = "$host/avatar/s={$size}"; elseif ( empty($email) ) - $default = "http://www.gravatar.com/avatar/?d=$default&s={$size}"; + $default = "$host/avatar/?d=$default&s={$size}"; elseif ( strpos($default, 'http://') === 0 ) $default = add_query_arg( 's', $size, $default ); if ( !empty($email) ) { - $out = 'http://www.gravatar.com/avatar/'; + $out = "$host/avatar/"; $out .= md5( strtolower( $email ) ); $out .= '?s='.$size; $out .= '&d=' . urlencode( $default );