WP User Avatar - Version 1.5.6

Version Description

  • Update: Use cache for wpua_has_gravatar
Download this release

Release Info

Developer bangbay
Plugin Icon 128x128 WP User Avatar
Version 1.5.6
Comparing to
See all releases

Code changes from version 1.5.4 to 1.5.6

includes/tinymce.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/**
3
* @package WP User Avatar
4
- * @version 1.5.4
5
*/
6
7
if(!defined('ABSPATH')){
1
<?php
2
/**
3
* @package WP User Avatar
4
+ * @version 1.5.6
5
*/
6
7
if(!defined('ABSPATH')){
includes/tinymce/editor_plugin.js CHANGED
@@ -1 +1 @@
1
- (function(){tinymce.PluginManager.requireLangPack('wpUserAvatar');tinymce.create('tinymce.plugins.wpUserAvatar',{init:function(ed,url){ed.addCommand('mceWpUserAvatar',function(){ed.windowManager.open({file:ajaxurl+'?action=wp_user_avatar_tinymce',width:500,height:265,inline:1},{plugin_url:url})});ed.addButton('wpUserAvatar',{title:'Insert WP User Avatar',cmd:'mceWpUserAvatar',image:url+'/../../images/wp-user-avatar-32x32.png'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('wpUserAvatar',n.nodeName=='IMG')})},createControl:function(n,cm){return null},getInfo:function(){return{longname:'WP User Avatar',author:'Bangbay Siboliban',authorurl:'http://siboliban.org/',infourl:'http://wordpress.org/extend/plugins/wp-user-avatar/',version:"1.5.4"}}});tinymce.PluginManager.add('wpUserAvatar',tinymce.plugins.wpUserAvatar)})();
1
+ (function(){tinymce.PluginManager.requireLangPack('wpUserAvatar');tinymce.create('tinymce.plugins.wpUserAvatar',{init:function(ed,url){ed.addCommand('mceWpUserAvatar',function(){ed.windowManager.open({file:ajaxurl+'?action=wp_user_avatar_tinymce',width:500,height:265,inline:1},{plugin_url:url})});ed.addButton('wpUserAvatar',{title:'Insert WP User Avatar',cmd:'mceWpUserAvatar',image:url+'/../../images/wp-user-avatar-32x32.png'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('wpUserAvatar',n.nodeName=='IMG')})},createControl:function(n,cm){return null},getInfo:function(){return{longname:'WP User Avatar',author:'Bangbay Siboliban',authorurl:'http://siboliban.org/',infourl:'http://wordpress.org/extend/plugins/wp-user-avatar/',version:"1.5.6"}}});tinymce.PluginManager.add('wpUserAvatar',tinymce.plugins.wpUserAvatar)})();
includes/tinymce/window.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/**
3
* @package WP User Avatar
4
- * @version 1.5.4
5
*/
6
7
if(!defined('ABSPATH')){
1
<?php
2
/**
3
* @package WP User Avatar
4
+ * @version 1.5.6
5
*/
6
7
if(!defined('ABSPATH')){
lang/wp-user-avatar-de_DE.mo CHANGED
Binary file
lang/wp-user-avatar-de_DE.po CHANGED
@@ -4,9 +4,9 @@
4
#
5
msgid ""
6
msgstr ""
7
- "Project-Id-Version: WP User Avatar 1.5.4\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
- "PO-Revision-Date: 2013-07-31 00:00-0000\n"
10
"Language: de_DE\n"
11
"Last-Translator: WP User Avatar\n"
12
"Language-Team: WP User Avatar\n"
@@ -14,29 +14,29 @@ msgstr ""
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
- #: wp-user-avatar.php:341
18
- #: wp-user-avatar.php:798
19
msgid "Click %s to save your changes"
20
msgstr "Klicken Sie %s, um Ihre Änderungen zu speichern"
21
22
- #: wp-user-avatar.php:870
23
msgid "Add avatar button to Visual Editor"
24
msgstr "Einen Avatar-Knopf zum WYSIWYG-Editor hinzufügen"
25
26
- #: wp-user-avatar.php:875
27
msgid "Allow Contributors & Subscribers to upload avatars"
28
msgstr "Mitarbeiter und Abonnenten erlauben, Avatare hochzuladen"
29
30
- #: wp-user-avatar.php:880
31
msgid "Disable Gravatar and use only local avatars"
32
msgstr "Gravatar deaktivieren und nur lokale Avatare verwenden"
33
34
- #: wp-user-avatar.php:888
35
- #: wp-user-avatar.php:893
36
msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
msgstr "Dateigrößenbeschränkung (nur für Mitarbeiter und Abonnenten)"
38
39
- #: wp-user-avatar.php:902
40
msgid "Allow users to edit avatars"
41
msgstr "Benutzer erlauben, Avatare bearbeiten"
42
4
#
5
msgid ""
6
msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5.6\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
+ "PO-Revision-Date: 2013-08-08 00:00-0000\n"
10
"Language: de_DE\n"
11
"Last-Translator: WP User Avatar\n"
12
"Language-Team: WP User Avatar\n"
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
+ #: wp-user-avatar.php:340
18
+ #: wp-user-avatar.php:799
19
msgid "Click %s to save your changes"
20
msgstr "Klicken Sie %s, um Ihre Änderungen zu speichern"
21
22
+ #: wp-user-avatar.php:871
23
msgid "Add avatar button to Visual Editor"
24
msgstr "Einen Avatar-Knopf zum WYSIWYG-Editor hinzufügen"
25
26
+ #: wp-user-avatar.php:876
27
msgid "Allow Contributors & Subscribers to upload avatars"
28
msgstr "Mitarbeiter und Abonnenten erlauben, Avatare hochzuladen"
29
30
+ #: wp-user-avatar.php:881
31
msgid "Disable Gravatar and use only local avatars"
32
msgstr "Gravatar deaktivieren und nur lokale Avatare verwenden"
33
34
+ #: wp-user-avatar.php:889
35
+ #: wp-user-avatar.php:894
36
msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
msgstr "Dateigrößenbeschränkung (nur für Mitarbeiter und Abonnenten)"
38
39
+ #: wp-user-avatar.php:903
40
msgid "Allow users to edit avatars"
41
msgstr "Benutzer erlauben, Avatare bearbeiten"
42
lang/wp-user-avatar-es_ES.mo CHANGED
Binary file
lang/wp-user-avatar-es_ES.po CHANGED
@@ -4,9 +4,9 @@
4
#
5
msgid ""
6
msgstr ""
7
- "Project-Id-Version: WP User Avatar 1.5.4\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
- "PO-Revision-Date: 2013-07-31 00:00-0000\n"
10
"Language: es_ES\n"
11
"Last-Translator: WP User Avatar\n"
12
"Language-Team: WP User Avatar\n"
@@ -14,29 +14,29 @@ msgstr ""
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
- #: wp-user-avatar.php:341
18
- #: wp-user-avatar.php:798
19
msgid "Click %s to save your changes"
20
msgstr "Haz clic %s para guardar los cambios"
21
22
- #: wp-user-avatar.php:870
23
msgid "Add avatar button to Visual Editor"
24
msgstr "Añadir botón avatar al editor visual"
25
26
- #: wp-user-avatar.php:875
27
msgid "Allow Contributors & Subscribers to upload avatars"
28
msgstr "Permitir los colaboradores y los suscriptores subir avatares"
29
30
- #: wp-user-avatar.php:880
31
msgid "Disable Gravatar and use only local avatars"
32
msgstr "Desactivar Gravatar y utilizar sólo los avatares locales"
33
34
- #: wp-user-avatar.php:888
35
- #: wp-user-avatar.php:893
36
msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
msgstr "Sube límite de tamaño (para colaboradores y suscriptores)"
38
39
- #: wp-user-avatar.php:902
40
msgid "Allow users to edit avatars"
41
msgstr "Permitir a los usuarios editar avatar"
42
4
#
5
msgid ""
6
msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5.6\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
+ "PO-Revision-Date: 2013-08-08 00:00-0000\n"
10
"Language: es_ES\n"
11
"Last-Translator: WP User Avatar\n"
12
"Language-Team: WP User Avatar\n"
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
+ #: wp-user-avatar.php:340
18
+ #: wp-user-avatar.php:799
19
msgid "Click %s to save your changes"
20
msgstr "Haz clic %s para guardar los cambios"
21
22
+ #: wp-user-avatar.php:871
23
msgid "Add avatar button to Visual Editor"
24
msgstr "Añadir botón avatar al editor visual"
25
26
+ #: wp-user-avatar.php:876
27
msgid "Allow Contributors & Subscribers to upload avatars"
28
msgstr "Permitir los colaboradores y los suscriptores subir avatares"
29
30
+ #: wp-user-avatar.php:881
31
msgid "Disable Gravatar and use only local avatars"
32
msgstr "Desactivar Gravatar y utilizar sólo los avatares locales"
33
34
+ #: wp-user-avatar.php:889
35
+ #: wp-user-avatar.php:894
36
msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
msgstr "Sube límite de tamaño (para colaboradores y suscriptores)"
38
39
+ #: wp-user-avatar.php:903
40
msgid "Allow users to edit avatars"
41
msgstr "Permitir a los usuarios editar avatar"
42
lang/wp-user-avatar-fr_FR.mo CHANGED
Binary file
lang/wp-user-avatar-fr_FR.po CHANGED
@@ -4,9 +4,9 @@
4
#
5
msgid ""
6
msgstr ""
7
- "Project-Id-Version: WP User Avatar 1.5.4\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
- "PO-Revision-Date: 2013-07-31 00:00-0000\n"
10
"Language: fr_FR\n"
11
"Last-Translator: WP User Avatar\n"
12
"Language-Team: WP User Avatar\n"
@@ -14,29 +14,29 @@ msgstr ""
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
- #: wp-user-avatar.php:341
18
- #: wp-user-avatar.php:798
19
msgid "Click %s to save your changes"
20
msgstr "Cliquez sur %s pour enregistrer vos modifications"
21
22
- #: wp-user-avatar.php:870
23
msgid "Add avatar button to Visual Editor"
24
msgstr "Ajouter le bouton avatar sur l'éditeur visuel"
25
26
- #: wp-user-avatar.php:875
27
msgid "Allow Contributors & Subscribers to upload avatars"
28
msgstr "Permettre aux contributeurs et aux abonnés d'envoyer des avatars"
29
30
- #: wp-user-avatar.php:880
31
msgid "Disable Gravatar and use only local avatars"
32
msgstr "Désactiver Gravatar et utiliser les avatars fournis"
33
34
- #: wp-user-avatar.php:888
35
- #: wp-user-avatar.php:893
36
msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
msgstr "Taille limite d'envoi de fichiers (pour contributeurs et abonnés)"
38
39
- #: wp-user-avatar.php:902
40
msgid "Allow users to edit avatars"
41
msgstr "Permettre aux utilisateurs de modifier avatar"
42
4
#
5
msgid ""
6
msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5.6\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
+ "PO-Revision-Date: 2013-08-08 00:00-0000\n"
10
"Language: fr_FR\n"
11
"Last-Translator: WP User Avatar\n"
12
"Language-Team: WP User Avatar\n"
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
+ #: wp-user-avatar.php:340
18
+ #: wp-user-avatar.php:799
19
msgid "Click %s to save your changes"
20
msgstr "Cliquez sur %s pour enregistrer vos modifications"
21
22
+ #: wp-user-avatar.php:871
23
msgid "Add avatar button to Visual Editor"
24
msgstr "Ajouter le bouton avatar sur l'éditeur visuel"
25
26
+ #: wp-user-avatar.php:876
27
msgid "Allow Contributors & Subscribers to upload avatars"
28
msgstr "Permettre aux contributeurs et aux abonnés d'envoyer des avatars"
29
30
+ #: wp-user-avatar.php:881
31
msgid "Disable Gravatar and use only local avatars"
32
msgstr "Désactiver Gravatar et utiliser les avatars fournis"
33
34
+ #: wp-user-avatar.php:889
35
+ #: wp-user-avatar.php:894
36
msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
msgstr "Taille limite d'envoi de fichiers (pour contributeurs et abonnés)"
38
39
+ #: wp-user-avatar.php:903
40
msgid "Allow users to edit avatars"
41
msgstr "Permettre aux utilisateurs de modifier avatar"
42
lang/wp-user-avatar-sv_SE.mo CHANGED
Binary file
lang/wp-user-avatar-sv_SE.po CHANGED
@@ -4,9 +4,9 @@
4
#
5
msgid ""
6
msgstr ""
7
- "Project-Id-Version: WP User Avatar 1.5.4\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
- "PO-Revision-Date: 2013-07-31 00:00-0000\n"
10
"Language: sv_SE\n"
11
"Last-Translator: Mattias Tengblad <mst@eyesx.com>\n"
12
"Language-Team: WordPress Sverige <info@wpsv.se>\n"
@@ -14,29 +14,29 @@ msgstr ""
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
- #: wp-user-avatar.php:341
18
- #: wp-user-avatar.php:798
19
msgid "Click %s to save your changes"
20
msgstr "Klicka på %s för att spara dina ändringar"
21
22
- #: wp-user-avatar.php:870
23
msgid "Add avatar button to Visual Editor"
24
msgstr "Lägg till knapp för avatarer i den visuella redigeraren"
25
26
- #: wp-user-avatar.php:875
27
msgid "Allow Contributors & Subscribers to upload avatars"
28
msgstr "Tillåt medarbetare & prenumeranter att ladda upp avatarer"
29
30
- #: wp-user-avatar.php:880
31
msgid "Disable Gravatar and use only local avatars"
32
msgstr "Inaktivera Gravatar och använd endast lokala avatarer"
33
34
- #: wp-user-avatar.php:888
35
- #: wp-user-avatar.php:893
36
msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
msgstr "Storleksgräns för uppladdningar (endast för medarbetare & prenumeranter)"
38
39
- #: wp-user-avatar.php:902
40
msgid "Allow users to edit avatars"
41
msgstr "Tillåt användare att redigera avatarer"
42
4
#
5
msgid ""
6
msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5.6\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
+ "PO-Revision-Date: 2013-08-08 00:00-0000\n"
10
"Language: sv_SE\n"
11
"Last-Translator: Mattias Tengblad <mst@eyesx.com>\n"
12
"Language-Team: WordPress Sverige <info@wpsv.se>\n"
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
+ #: wp-user-avatar.php:340
18
+ #: wp-user-avatar.php:799
19
msgid "Click %s to save your changes"
20
msgstr "Klicka på %s för att spara dina ändringar"
21
22
+ #: wp-user-avatar.php:871
23
msgid "Add avatar button to Visual Editor"
24
msgstr "Lägg till knapp för avatarer i den visuella redigeraren"
25
26
+ #: wp-user-avatar.php:876
27
msgid "Allow Contributors & Subscribers to upload avatars"
28
msgstr "Tillåt medarbetare & prenumeranter att ladda upp avatarer"
29
30
+ #: wp-user-avatar.php:881
31
msgid "Disable Gravatar and use only local avatars"
32
msgstr "Inaktivera Gravatar och använd endast lokala avatarer"
33
34
+ #: wp-user-avatar.php:889
35
+ #: wp-user-avatar.php:894
36
msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
msgstr "Storleksgräns för uppladdningar (endast för medarbetare & prenumeranter)"
38
39
+ #: wp-user-avatar.php:903
40
msgid "Allow users to edit avatars"
41
msgstr "Tillåt användare att redigera avatarer"
42
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: bangbay
4
Donate link: http://siboliban.org/donate
5
Tags: author image, author photo, author avatar, avatar, bbPress, profile avatar, profile image, user avatar, user image, user photo
6
Requires at least: 3.5
7
- Tested up to: 3.7-alpha-24927
8
- Stable tag: 1.5.4
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
@@ -230,6 +230,13 @@ Outputs:
230
231
== Changelog ==
232
233
= 1.5.4 =
234
* Add: Option to enable avatar editing privilege for Subscribers
235
* Add: Swedish translation
4
Donate link: http://siboliban.org/donate
5
Tags: author image, author photo, author avatar, avatar, bbPress, profile avatar, profile image, user avatar, user image, user photo
6
Requires at least: 3.5
7
+ Tested up to: 3.6
8
+ Stable tag: 1.5.6
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
230
231
== Changelog ==
232
233
+ = 1.5.6 =
234
+ * Update: Use cache for wpua_has_gravatar
235
+
236
+ = 1.5.5 =
237
+ * Bug Fix: Hide "Edit Image" button if Contributors & Subscribers can't edit avatar
238
+ * Bug Fix: Remove edit_posts capability if Subscribers can't edit avatar
239
+
240
= 1.5.4 =
241
* Add: Option to enable avatar editing privilege for Subscribers
242
* Add: Swedish translation
uninstall.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/**
3
* @package WP User Avatar
4
- * @version 1.5.4
5
*/
6
7
// Remove user metadata and options on plugin delete
1
<?php
2
/**
3
* @package WP User Avatar
4
+ * @version 1.5.6
5
*/
6
7
// Remove user metadata and options on plugin delete
wp-user-avatar.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/**
3
* @package WP User Avatar
4
- * @version 1.5.4
5
*/
6
/*
7
Plugin Name: WP User Avatar
@@ -9,7 +9,7 @@ Plugin URI: http://wordpress.org/plugins/wp-user-avatar/
9
Description: Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar.
10
Author: Bangbay Siboliban
11
Author URI: http://siboliban.org/
12
- Version: 1.5.4
13
Text Domain: wp-user-avatar
14
Domain Path: /lang/
15
*/
@@ -20,7 +20,7 @@ if(!defined('ABSPATH')){
20
}
21
22
// Define paths and variables
23
- define('WPUA_VERSION', ' 1.5.4');
24
define('WPUA_FOLDER', basename(dirname(__FILE__)));
25
define('WPUA_ABSPATH', trailingslashit(str_replace('\\', '/', WP_PLUGIN_DIR.'/'.WPUA_FOLDER)));
26
define('WPUA_URLPATH', trailingslashit(plugins_url(WPUA_FOLDER)));
@@ -38,7 +38,6 @@ $mustache_medium = WPUA_URLPATH.'images/wp-user-avatar-300x300.png';
38
$mustache_thumbnail = WPUA_URLPATH.'images/wp-user-avatar-150x150.png';
39
$mustache_avatar = WPUA_URLPATH.'images/wp-user-avatar-96x96.png';
40
$mustache_admin = WPUA_URLPATH.'images/wp-user-avatar-32x32.png';
41
- $ssl = is_ssl() ? 's' : "";
42
43
// Check for updates
44
$wpua_default_avatar_updated = get_option('wp_user_avatar_default_avatar_updated');
@@ -501,7 +500,6 @@ if(!class_exists('wp_user_avatar')){
501
502
// Returns true if user has Gravatar-hosted image
503
function wpua_has_gravatar($id_or_email, $has_gravatar=false, $user="", $email=""){
504
- global $ssl;
505
if(!is_object($id_or_email) && !empty($id_or_email)){
506
// Find user by ID or e-mail address
507
$user = is_numeric($id_or_email) ? get_user_by('id', $id_or_email) : get_user_by('email', $id_or_email);
@@ -509,12 +507,15 @@ if(!class_exists('wp_user_avatar')){
509
$email = !empty($user) ? $user->user_email : "";
510
}
511
// Check if Gravatar image returns 200 (OK) or 404 (Not Found)
512
- if(!empty($email)){
513
- $hash = md5(strtolower(trim($email)));
514
- $gravatar = 'http'.$ssl.'://www.gravatar.com/avatar/'.$hash.'?d=404';
515
- $headers = @get_headers($gravatar);
516
- $has_gravatar = !preg_match("|200|", $headers[0]) ? false : true;
517
- }
518
return $has_gravatar;
519
}
520
1
<?php
2
/**
3
* @package WP User Avatar
4
+ * @version 1.5.6
5
*/
6
/*
7
Plugin Name: WP User Avatar
9
Description: Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar.
10
Author: Bangbay Siboliban
11
Author URI: http://siboliban.org/
12
+ Version: 1.5.6
13
Text Domain: wp-user-avatar
14
Domain Path: /lang/
15
*/
20
}
21
22
// Define paths and variables
23
+ define('WPUA_VERSION', ' 1.5.6');
24
define('WPUA_FOLDER', basename(dirname(__FILE__)));
25
define('WPUA_ABSPATH', trailingslashit(str_replace('\\', '/', WP_PLUGIN_DIR.'/'.WPUA_FOLDER)));
26
define('WPUA_URLPATH', trailingslashit(plugins_url(WPUA_FOLDER)));
38
$mustache_thumbnail = WPUA_URLPATH.'images/wp-user-avatar-150x150.png';
39
$mustache_avatar = WPUA_URLPATH.'images/wp-user-avatar-96x96.png';
40
$mustache_admin = WPUA_URLPATH.'images/wp-user-avatar-32x32.png';
41
42
// Check for updates
43
$wpua_default_avatar_updated = get_option('wp_user_avatar_default_avatar_updated');
500
501
// Returns true if user has Gravatar-hosted image
502
function wpua_has_gravatar($id_or_email, $has_gravatar=false, $user="", $email=""){
503
if(!is_object($id_or_email) && !empty($id_or_email)){
504
// Find user by ID or e-mail address
505
$user = is_numeric($id_or_email) ? get_user_by('id', $id_or_email) : get_user_by('email', $id_or_email);
507
$email = !empty($user) ? $user->user_email : "";
508
}
509
// Check if Gravatar image returns 200 (OK) or 404 (Not Found)
510
+ $hash = md5(strtolower(trim($email)));
511
+ $gravatar = 'http://www.gravatar.com/avatar/'.$hash.'?d=404';
512
+ $data = wp_cache_get($hash);
513
+ if(false === $data){
514
+ $response = wp_remote_head($gravatar);
515
+ $data = is_wp_error($response) ? 'not200' : $response['response']['code'];
516
+ wp_cache_set($hash, $data, $group="", $expire=60*5);
517
+ }
518
+ $has_gravatar = ($data == '200') ? true : false;
519
return $has_gravatar;
520
}
521