Simple Local Avatars - Version 2.1

Version Description

  • New: All avatar uploads now go into the media library. Don't worry - users without the ability to upload files cannot otherwise see the contents of your media library. This allows local avatars to respect other functionality your site may have around uploaded images, such as external hosting.
  • New: REST API support for getting and updating.
  • New: Use .org language packs rather than bundling translations.
  • Fixed: Avoid an ArgumentCountError.
  • Fixed: A couple of internationalization issues.
Download this release

Release Info

Developer helen
Plugin Icon 128x128 Simple Local Avatars
Version 2.1
Comparing to
See all releases

Code changes from version 2.0 to 2.1

localization/simple-local-avatars-be_BY.mo DELETED
Binary file
localization/simple-local-avatars-be_BY.po DELETED
@@ -1,60 +0,0 @@
1
- # Copyright (C) 2010 Simple Local Avatars
2
- # This file is distributed under the same license as the Simple Local Avatars package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Simple Local Avatars 1.1\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-local-avatars\n"
7
- "POT-Creation-Date: 2011-01-18 16:36:12+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2011-11-03 19:09+0200\n"
12
- "Last-Translator: \n"
13
- "Language-Team: Web Geeks\n"
14
- "X-Poedit-Language: Belarusian\n"
15
- "X-Poedit-Country: BELARUS\n"
16
-
17
- #: simple-local-avatars.php:104
18
- msgid "Local Avatar Permissions"
19
- msgstr "Лакальныя налады аватара"
20
-
21
- #: simple-local-avatars.php:120
22
- msgid "Only allow users with file upload capabilities to upload local avatars (Authors and above)"
23
- msgstr "Толькі карыстачы вызначанай катэгорыі могуць загружаць аватары (Аўтары і вышэй)"
24
-
25
- #: simple-local-avatars.php:128
26
- msgid "Avatar"
27
- msgstr "Аватар"
28
-
29
- #: simple-local-avatars.php:132
30
- msgid "Upload Avatar"
31
- msgstr "Загрузіць аватар"
32
-
33
- #: simple-local-avatars.php:148
34
- msgid "No local avatar is set. Use the upload field to add a local avatar."
35
- msgstr "Няма установленого лакальнага аватара. Выкарыстоўвайце загрузку, каб дадаць аватар."
36
-
37
- #: simple-local-avatars.php:151
38
- msgid "Delete local avatar"
39
- msgstr "Выдаліць лакальны аватар"
40
-
41
- #: simple-local-avatars.php:152
42
- msgid "Replace the local avatar by uploading a new avatar, or erase the local avatar (falling back to a gravatar) by checking the delete option."
43
- msgstr "Замяніць лакальны аватар загрузіўшы новы малюнак ці сцерці лакальны аватар пазначыўшы опцыю выдалення. (па змаўчанні вернецца gravatar)"
44
-
45
- #: simple-local-avatars.php:158
46
- msgid "No local avatar is set. Set up your avatar at Gravatar.com."
47
- msgstr "Лакальны аватар не ўсталяваны. Усталяваць ваш аватар на Gravatar.com"
48
-
49
- #: simple-local-avatars.php:161
50
- msgid "You do not have media management permissions. To change your local avatar, contact the blog administrator."
51
- msgstr "Вашых паўнамоцтваў не досыць для змены аватара. Каб змяніць лакальны аватар, звяжыцеся з адміністратарам сайта."
52
-
53
- #. Plugin Name of the plugin/theme
54
- msgid "Simple Local Avatars"
55
- msgstr "Лакальны аватар"
56
-
57
- #. Description of the plugin/theme
58
- msgid "Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar! Simple and lightweight."
59
- msgstr "Дадаць запампоўку аватара да профіля карыстача, калі ў бягучага карыстача ёсць паўнамоцтвы. Генераваць такія ж памеры, як на Gravatar-е. Проста і лёгка."
60
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
localization/simple-local-avatars-de_DE.mo DELETED
Binary file
localization/simple-local-avatars-de_DE.po DELETED
@@ -1,58 +0,0 @@
1
- # Copyright (C) 2010 Simple Local Avatars
2
- # This file is distributed under the same license as the Simple Local Avatars package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Simple Local Avatars 1.1\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-local-avatars\n"
7
- "POT-Creation-Date: 2011-01-18 16:36:12+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2011-01-18 14:17-0500\n"
12
- "Last-Translator: Jake Goldman <jakemgold@emailgroups.net>\n"
13
- "Language-Team: \n"
14
- "X-Poedit-Language: German\n"
15
-
16
- #: simple-local-avatars.php:104
17
- msgid "Local Avatar Permissions"
18
- msgstr "Profilbild-Berechtigungen"
19
-
20
- #: simple-local-avatars.php:120
21
- msgid "Only allow users with file upload capabilities to upload local avatars (Authors and above)"
22
- msgstr "Erlaube ausschließlich Benutzern mit der Berechtigung zum Bearbeiten von Dateien das Hochladen von Profilbildern (Autoren und darüber)"
23
-
24
- #: simple-local-avatars.php:128
25
- msgid "Avatar"
26
- msgstr "Profilbild"
27
-
28
- #: simple-local-avatars.php:132
29
- msgid "Upload Avatar"
30
- msgstr "Profilbild hochladen"
31
-
32
- #: simple-local-avatars.php:148
33
- msgid "No local avatar is set. Use the upload field to add a local avatar."
34
- msgstr "Es ist kein Profilbild festgelegt. Klicke „Durchsuchen…“, um ein Profilbild hochzuladen."
35
-
36
- #: simple-local-avatars.php:151
37
- msgid "Delete local avatar"
38
- msgstr "Profilbild löschen"
39
-
40
- #: simple-local-avatars.php:152
41
- msgid "Replace the local avatar by uploading a new avatar, or erase the local avatar (falling back to a gravatar) by checking the delete option."
42
- msgstr "Ersetze das Profilbild, indem du ein neues hochlädst, oder lösche das Profilbild (dann wird ggf. dein Gravatar angezeigt), indem du „Profilbild löschen“ auswählst."
43
-
44
- #: simple-local-avatars.php:158
45
- msgid "No local avatar is set. Set up your avatar at Gravatar.com."
46
- msgstr "Es ist kein Profilbild festgelegt. Lade dein Profilbild bei Gravatar.com hoch."
47
-
48
- #: simple-local-avatars.php:161
49
- msgid "You do not have media management permissions. To change your local avatar, contact the blog administrator."
50
- msgstr "Du hast keine Berechtigung zur Bearbeitung von Mediadateien. Um dein Profilbild zu ändern, kontaktiere den Administrator dieser Website."
51
-
52
- #. Plugin Name of the plugin/theme
53
- msgid "Simple Local Avatars"
54
- msgstr "Simple Local Avatars (Einfache lokale Profilbilder)"
55
-
56
- #. Description of the plugin/theme
57
- msgid "Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar! Simple and lightweight."
58
- msgstr "Fügt ein Feld zum Hochladen eines Profilbilds (Avatar) hinzu, sofern der Benutzer zum Bearbeiten von Mediadateien berechtigt ist. Generiert die erforderlichen Maße, genau wie Gravatar! Einfach und schlank."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
localization/simple-local-avatars-es_ES.mo DELETED
Binary file
localization/simple-local-avatars-es_ES.po DELETED
@@ -1,59 +0,0 @@
1
- # Copyright (C) 2010 Simple Local Avatars
2
- # This file is distributed under the same license as the Simple Local Avatars package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Simple Local Avatars 1.1\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-local-avatars\n"
7
- "POT-Creation-Date: 2011-01-18 16:36:12+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2011-01-26 10:57+0100\n"
12
- "Last-Translator: KLAMM <http://retroriff.com>\n"
13
- "Language-Team: \n"
14
- "X-Poedit-Language: Spanish\n"
15
-
16
- #: simple-local-avatars.php:104
17
- msgid "Local Avatar Permissions"
18
- msgstr "Permisos de Local Avatar"
19
-
20
- #: simple-local-avatars.php:120
21
- msgid "Only allow users with file upload capabilities to upload local avatars (Authors and above)"
22
- msgstr "Sólo aceptar usuarios con permisos para subir avatares locales (Autores y superiores)"
23
-
24
- #: simple-local-avatars.php:128
25
- msgid "Avatar"
26
- msgstr "Avatar"
27
-
28
- #: simple-local-avatars.php:132
29
- msgid "Upload Avatar"
30
- msgstr "Subir avatar"
31
-
32
- #: simple-local-avatars.php:148
33
- msgid "No local avatar is set. Use the upload field to add a local avatar."
34
- msgstr "No se ha configurado ningún avatar. Usa el formulario para subir tu propio avatar."
35
-
36
- #: simple-local-avatars.php:151
37
- msgid "Delete local avatar"
38
- msgstr "Eliminar avatar"
39
-
40
- #: simple-local-avatars.php:152
41
- msgid "Replace the local avatar by uploading a new avatar, or erase the local avatar (falling back to a gravatar) by checking the delete option."
42
- msgstr "Substituye el avatar subiendo uno nuevo, o borrando el avatar actual seleccionando la opción de eliminar (en su lugar se utilizará Gravatar.com)."
43
-
44
- #: simple-local-avatars.php:158
45
- msgid "No local avatar is set. Set up your avatar at Gravatar.com."
46
- msgstr "No se ha configurado ningún avatar. Configura tu avatar en Gravatar.com."
47
-
48
- #: simple-local-avatars.php:161
49
- msgid "You do not have media management permissions. To change your local avatar, contact the blog administrator."
50
- msgstr "No tienes los permisos necesarios. Para cambiar tu avatar contacta con el administrador del blog."
51
-
52
- #. Plugin Name of the plugin/theme
53
- msgid "Simple Local Avatars"
54
- msgstr "Simple Local Avatars"
55
-
56
- #. Description of the plugin/theme
57
- msgid "Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar! Simple and lightweight."
58
- msgstr "Añade un campo para subir un avatar a los perfiles de usuario siempre que éstos tengan los permisos adecuados. Redimensiona las imágenes de la misma manera que Gravatar. Simple y ligero."
59
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
localization/simple-local-avatars-fr_FR.mo DELETED
Binary file
localization/simple-local-avatars-fr_FR.po DELETED
@@ -1,59 +0,0 @@
1
- # Copyright (C) 2010 Simple Local Avatars
2
- # This file is distributed under the same license as the Simple Local Avatars package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Simple Local Avatars 1.1\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-local-avatars\n"
7
- "POT-Creation-Date: 2011-01-18 16:36:12+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2011-01-27 00:16+0100\n"
12
- "Last-Translator: Valentin Brandt <nitraxer@gmail.com>\n"
13
- "Language-Team: \n"
14
- "X-Poedit-Language: German\n"
15
-
16
- #: simple-local-avatars.php:104
17
- msgid "Local Avatar Permissions"
18
- msgstr "Permissions des avatars"
19
-
20
- #: simple-local-avatars.php:120
21
- msgid "Only allow users with file upload capabilities to upload local avatars (Authors and above)"
22
- msgstr "Autoriser uniquement les utilisateurs ayant les capacités d'envoyer un avatar sur le serveur (auteurs)"
23
-
24
- #: simple-local-avatars.php:128
25
- msgid "Avatar"
26
- msgstr "Avatar"
27
-
28
- #: simple-local-avatars.php:132
29
- msgid "Upload Avatar"
30
- msgstr "Envoyer un Avatar"
31
-
32
- #: simple-local-avatars.php:148
33
- msgid "No local avatar is set. Use the upload field to add a local avatar."
34
- msgstr "Il n'y aucun avatar local. Utilisez le champ de téléchargement pour ajouter un avatar local."
35
-
36
- #: simple-local-avatars.php:151
37
- msgid "Delete local avatar"
38
- msgstr "Supprimer l'avatar local"
39
-
40
- #: simple-local-avatars.php:152
41
- msgid "Replace the local avatar by uploading a new avatar, or erase the local avatar (falling back to a gravatar) by checking the delete option."
42
- msgstr "Remplacer l'avatar local en envoyant un nouvel avatar, ou effacez-le (vous allez retomber à un gravatar, si disponible) en cochant l'option de suppression."
43
-
44
- #: simple-local-avatars.php:158
45
- msgid "No local avatar is set. Set up your avatar at Gravatar.com."
46
- msgstr "Aucun avatar local. Configurez votre avatar sur Gravatar.com."
47
-
48
- #: simple-local-avatars.php:161
49
- msgid "You do not have media management permissions. To change your local avatar, contact the blog administrator."
50
- msgstr "Vous n'avez pas les autorisations nécessaire pour gérer les médias. Pour changer votre avatar local, contacter l'administrateur du blog."
51
-
52
- #. Plugin Name of the plugin/theme
53
- msgid "Simple Local Avatars"
54
- msgstr "Simple Local Avatars"
55
-
56
- #. Description of the plugin/theme
57
- msgid "Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar! Simple and lightweight."
58
- msgstr "Ajoute un champ d'envoi d'avatar pour les profils utilisateurs, si l'utilisateur dispose des autorisations pour gérer les médias du blog. Il est possible de générer de nouvelles tailles, à la demande ! Simple et léger."
59
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
localization/simple-local-avatars-hu_HU.mo DELETED
Binary file
localization/simple-local-avatars-hu_HU.po DELETED
@@ -1,83 +0,0 @@
1
- # Copyright (C) 2010 Simple Local Avatars
2
- # This file is distributed under the same license as the Simple Local Avatars package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Simple Local Avatars 1.1\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-local-avatars\n"
7
- "POT-Creation-Date: 2011-01-18 16:36:12+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2013-02-04 22:13+0100\n"
12
- "Last-Translator: Zahalka Bence <bence.zahalka@invitel.hu>\n"
13
- "Language-Team: Bence Zahalka\n"
14
- "Language: magyar\n"
15
- "X-Generator: Poedit 1.5.4\n"
16
- "X-Poedit-Basepath: ..\n"
17
-
18
- #: simple-local-avatars.php:104
19
- msgid "Local Avatar Permissions"
20
- msgstr "Lokális profilkép engedélyek"
21
-
22
- #: simple-local-avatars.php:120
23
- msgid ""
24
- "Only allow users with file upload capabilities to upload local avatars "
25
- "(Authors and above)"
26
- msgstr ""
27
- "Csak azok a felhasználók tölthessenek fel saját avatárt, akik fájlokat is "
28
- "tölthetnek fel (Szerzők, vagy magasabb jogosultsági szintűek)"
29
-
30
- #: simple-local-avatars.php:128
31
- msgid "Avatar"
32
- msgstr "Profilkép"
33
-
34
- #: simple-local-avatars.php:132
35
- msgid "Upload Avatar"
36
- msgstr "Profilkép feltöltése"
37
-
38
- #: simple-local-avatars.php:148
39
- msgid "No local avatar is set. Use the upload field to add a local avatar."
40
- msgstr ""
41
- "Még nincs profilkép feltöltve. Saját profilkép hozzáadásához használd a "
42
- "feltöltés mezőt!"
43
-
44
- #: simple-local-avatars.php:151
45
- msgid "Delete local avatar"
46
- msgstr "Profilkép törlése"
47
-
48
- #: simple-local-avatars.php:152
49
- msgid ""
50
- "Replace the local avatar by uploading a new avatar, or erase the local "
51
- "avatar (falling back to a gravatar) by checking the delete option."
52
- msgstr ""
53
- "A meglévő profilkép lecserélhető egy új profilkép feltöltésével, vagy a "
54
- "meglévő törlésével (ekkor a gravatar képed lesz használva), ha bepipálod a "
55
- "törlés mezőt."
56
-
57
- #: simple-local-avatars.php:158
58
- msgid "No local avatar is set. Set up your avatar at Gravatar.com."
59
- msgstr ""
60
- "Nincs lokális profilképed. Állíts be magadnak egy profilképet a Gravatar.com "
61
- "oldalon!"
62
-
63
- #: simple-local-avatars.php:161
64
- msgid ""
65
- "You do not have media management permissions. To change your local avatar, "
66
- "contact the blog administrator."
67
- msgstr ""
68
- "Nincs médiafájl-kezelési jogosultságod! A profilképed megváltoztatásához meg "
69
- "kell keresned az oldal valamelyik adminisztrátorát."
70
-
71
- #. Plugin Name of the plugin/theme
72
- msgid "Simple Local Avatars"
73
- msgstr "Egyszerű helyi profilképek"
74
-
75
- #. Description of the plugin/theme
76
- msgid ""
77
- "Adds an avatar upload field to user profiles if the current user has media "
78
- "permissions. Generates requested sizes on demand just like Gravatar! Simple "
79
- "and lightweight."
80
- msgstr ""
81
- "A felhasználói profilhoz hozzáad egy profilkép feltöltése mezőt, ha a "
82
- "felhasználónak van médiakezelési jogosultsága. A szükséges képméreteket "
83
- "éppúgy legenerálja, mint a Gravatar. Egyszerű és pehelykönnyű."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
localization/simple-local-avatars-it_IT.mo DELETED
Binary file
localization/simple-local-avatars-it_IT.po DELETED
@@ -1,59 +0,0 @@
1
- # Copyright (C) 2010 Simple Local Avatars
2
- # This file is distributed under the same license as the Simple Local Avatars package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Simple Local Avatars 1.1\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-local-avatars\n"
7
- "POT-Creation-Date: 2011-01-18 16:36:12+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2011-01-18 21:35+0100\n"
12
- "Last-Translator: MARCO <marco@teethgrinder.net>\n"
13
- "Language-Team: \n"
14
- "X-Poedit-Language: Italian\n"
15
-
16
- #: simple-local-avatars.php:104
17
- msgid "Local Avatar Permissions"
18
- msgstr "Permessi per Avatar Locali"
19
-
20
- #: simple-local-avatars.php:120
21
- msgid "Only allow users with file upload capabilities to upload local avatars (Authors and above)"
22
- msgstr "Consentire solo agli utenti con permessi di upload di caricare avatar locali (Autori e superiori) "
23
-
24
- #: simple-local-avatars.php:128
25
- msgid "Avatar"
26
- msgstr "Avatar"
27
-
28
- #: simple-local-avatars.php:132
29
- msgid "Upload Avatar"
30
- msgstr "Caricare l'Avatar"
31
-
32
- #: simple-local-avatars.php:148
33
- msgid "No local avatar is set. Use the upload field to add a local avatar."
34
- msgstr "Nessun avatar locale è stato definito. Usa il campo di upload per aggiungerne uno."
35
-
36
- #: simple-local-avatars.php:151
37
- msgid "Delete local avatar"
38
- msgstr "Cancella l'avatar locale"
39
-
40
- #: simple-local-avatars.php:152
41
- msgid "Replace the local avatar by uploading a new avatar, or erase the local avatar (falling back to a gravatar) by checking the delete option."
42
- msgstr "Sostituire l'avatar locale caricandone uno nuovo, o cancellarlo (tornando al Gravatar) selezionando l'opzione di eliminazione."
43
-
44
- #: simple-local-avatars.php:158
45
- msgid "No local avatar is set. Set up your avatar at Gravatar.com."
46
- msgstr "Non è impostato alcun avatar locale. Utilizza Gravatar.com per impostarne uno."
47
-
48
- #: simple-local-avatars.php:161
49
- msgid "You do not have media management permissions. To change your local avatar, contact the blog administrator."
50
- msgstr "Non hai i permessi necessari. Per cambiare il tuo avatar locale contatta l'amministratore del blog."
51
-
52
- #. Plugin Name of the plugin/theme
53
- msgid "Simple Local Avatars"
54
- msgstr "Simple Local Avatars"
55
-
56
- #. Description of the plugin/theme
57
- msgid "Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar! Simple and lightweight."
58
- msgstr "Aggiunge un campo per permettere l'upload di un avatar personalizzato agli utenti che dispongono di adeguati permessi. Ridimensiona l'immagine come Gravatar! Semplice e leggero"
59
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
localization/simple-local-avatars-nb_NO.mo DELETED
Binary file
localization/simple-local-avatars-nb_NO.po DELETED
@@ -1,59 +0,0 @@
1
- # Copyright (C) 2010 Simple Local Avatars
2
- # This file is distributed under the same license as the Simple Local Avatars package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Simple Local Avatars 1.1\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-local-avatars\n"
7
- "POT-Creation-Date: 2011-01-18 16:36:12+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2011-01-18 23:22+0100\n"
12
- "Last-Translator: Øyvind Enger <enger@morsom.no>\n"
13
- "Language-Team: \n"
14
- "X-Poedit-Language: German\n"
15
-
16
- #: simple-local-avatars.php:104
17
- msgid "Local Avatar Permissions"
18
- msgstr "Innstilling for lokale profilbilder"
19
-
20
- #: simple-local-avatars.php:120
21
- msgid "Only allow users with file upload capabilities to upload local avatars (Authors and above)"
22
- msgstr "Kun brukere med rettigheter til å laste opp filer, kan legge inn nye lokale profilbilder. (Forfattere og høyere)"
23
-
24
- #: simple-local-avatars.php:128
25
- msgid "Avatar"
26
- msgstr "Profilbilde"
27
-
28
- #: simple-local-avatars.php:132
29
- msgid "Upload Avatar"
30
- msgstr "Last opp profilbilde"
31
-
32
- #: simple-local-avatars.php:148
33
- msgid "No local avatar is set. Use the upload field to add a local avatar."
34
- msgstr "Et lokalt profilbilde er ikke definert. Bruk skjemafeltet over for å laste opp et nytt lokalt profilbilde."
35
-
36
- #: simple-local-avatars.php:151
37
- msgid "Delete local avatar"
38
- msgstr "Slett lokalt profilbilde"
39
-
40
- #: simple-local-avatars.php:152
41
- msgid "Replace the local avatar by uploading a new avatar, or erase the local avatar (falling back to a gravatar) by checking the delete option."
42
- msgstr "Erstatt det lokale profilbildet ved å laste opp et nytt profilbilde, eller slett det lokale profilbildet (vil gå tilbake til å vise gravatar) ved å krysse av valget om sletting."
43
-
44
- #: simple-local-avatars.php:158
45
- msgid "No local avatar is set. Set up your avatar at Gravatar.com."
46
- msgstr "Et lokalt profilbilde er ikke definert. Definer ditt profilbilde på Gravatar.com."
47
-
48
- #: simple-local-avatars.php:161
49
- msgid "You do not have media management permissions. To change your local avatar, contact the blog administrator."
50
- msgstr "Du har ikke rettigheter til å redigere media. For å endre ditt lokale profilbilde, ta kontakt med administratoren for nettsiden."
51
-
52
- #. Plugin Name of the plugin/theme
53
- msgid "Simple Local Avatars"
54
- msgstr "Simple Local Avatars"
55
-
56
- #. Description of the plugin/theme
57
- msgid "Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar! Simple and lightweight."
58
- msgstr "Legger til et felt for opplasting av lokale profilbilder dersom brukeren har rettigheter til å redigere media. Genererer riktig størrelse ved behov akkurat som Gravatar! Enkelt og greit."
59
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
localization/simple-local-avatars-pt_BR.mo DELETED
Binary file
localization/simple-local-avatars-pt_BR.po DELETED
@@ -1,61 +0,0 @@
1
- # Copyright (C) 2010 Simple Local Avatars
2
- # This file is distributed under the same license as the Simple Local Avatars package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Simple Local Avatars 1.1\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-local-avatars\n"
7
- "POT-Creation-Date: 2011-01-18 16:36:12+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2011-12-28 13:18-0300\n"
12
- "Last-Translator: Billy Blay <billy.blay@gmail.com>\n"
13
- "Language-Team: Billy Blay <billy.blay@gmail.com>\n"
14
- "X-Poedit-Language: Portuguese\n"
15
- "X-Poedit-Country: BRAZIL\n"
16
- "X-Poedit-SourceCharset: utf-8\n"
17
-
18
- #: simple-local-avatars.php:104
19
- msgid "Local Avatar Permissions"
20
- msgstr "Permissões do Local Avatar"
21
-
22
- #: simple-local-avatars.php:120
23
- msgid "Only allow users with file upload capabilities to upload local avatars (Authors and above)"
24
- msgstr "Só aceitar usuarios com permisões para enviar avatares locais (Autores e superiores)"
25
-
26
- #: simple-local-avatars.php:128
27
- msgid "Avatar"
28
- msgstr "Avatar"
29
-
30
- #: simple-local-avatars.php:132
31
- msgid "Upload Avatar"
32
- msgstr "Enviar avatar"
33
-
34
- #: simple-local-avatars.php:148
35
- msgid "No local avatar is set. Use the upload field to add a local avatar."
36
- msgstr "Não há nenhum avatar configurado. Use o formulário de envio para adicionar um novo avatar."
37
-
38
- #: simple-local-avatars.php:151
39
- msgid "Delete local avatar"
40
- msgstr "Deletar avatar"
41
-
42
- #: simple-local-avatars.php:152
43
- msgid "Replace the local avatar by uploading a new avatar, or erase the local avatar (falling back to a gravatar) by checking the delete option."
44
- msgstr "Substituir o avatar enviando um novo, ou apague o avatar atual selecionando a opção de deletar (em seu lugar se utilizará o Gravatar.com)."
45
-
46
- #: simple-local-avatars.php:158
47
- msgid "No local avatar is set. Set up your avatar at Gravatar.com."
48
- msgstr "Não há nenhum avatar configurado. Configure seu avatar em Gravatar.com."
49
-
50
- #: simple-local-avatars.php:161
51
- msgid "You do not have media management permissions. To change your local avatar, contact the blog administrator."
52
- msgstr "Você não tem permissão para mudar seu avatar contate o administrador do blog."
53
-
54
- #. Plugin Name of the plugin/theme
55
- msgid "Simple Local Avatars"
56
- msgstr "Simple Local Avatars"
57
-
58
- #. Description of the plugin/theme
59
- msgid "Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar! Simple and lightweight."
60
- msgstr "Adicione um avatar no campo de upload de perfis de usuário se o usuário atual tem permissões de mídia. Gere tamanhos solicitada como no Gravatar! Simples e leve."
61
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
localization/simple-local-avatars-ru_RU.mo DELETED
Binary file
localization/simple-local-avatars-ru_RU.po DELETED
@@ -1,60 +0,0 @@
1
- # Copyright (C) 2010 Simple Local Avatars
2
- # This file is distributed under the same license as the Simple Local Avatars package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Simple Local Avatars 1.1\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-local-avatars\n"
7
- "POT-Creation-Date: 2011-01-18 16:36:12+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2011-04-03 00:40+0200\n"
12
- "Last-Translator: seo-semjanin <slan82@bk.ru>\n"
13
- "Language-Team: seo-semjanin <slan82@bk.ru>\n"
14
- "X-Poedit-Language: Russian\n"
15
- "X-Poedit-Country: RUSSIAN FEDERATION\n"
16
-
17
- #: simple-local-avatars.php:104
18
- msgid "Local Avatar Permissions"
19
- msgstr "Локальные настройки аватара"
20
-
21
- #: simple-local-avatars.php:120
22
- msgid "Only allow users with file upload capabilities to upload local avatars (Authors and above)"
23
- msgstr "Только пользователи определенной категории могут загружать аватары (Авторы и выше)"
24
-
25
- #: simple-local-avatars.php:128
26
- msgid "Avatar"
27
- msgstr "Аватар"
28
-
29
- #: simple-local-avatars.php:132
30
- msgid "Upload Avatar"
31
- msgstr "Загрузить аватар"
32
-
33
- #: simple-local-avatars.php:148
34
- msgid "No local avatar is set. Use the upload field to add a local avatar."
35
- msgstr "Нет установленого локального аватара. Используйте загрузку, чтобы добавить аватар."
36
-
37
- #: simple-local-avatars.php:151
38
- msgid "Delete local avatar"
39
- msgstr "Удалить локальный аватар"
40
-
41
- #: simple-local-avatars.php:152
42
- msgid "Replace the local avatar by uploading a new avatar, or erase the local avatar (falling back to a gravatar) by checking the delete option."
43
- msgstr "Заменить локальный аватар загрузив новое изображение или стереть локальный аватар обозначив опцию удаления. (по умолчанию вернется gravatar)"
44
-
45
- #: simple-local-avatars.php:158
46
- msgid "No local avatar is set. Set up your avatar at Gravatar.com."
47
- msgstr "Локальный аватар не установлен. Установить ваш аватар на Gravatar.com"
48
-
49
- #: simple-local-avatars.php:161
50
- msgid "You do not have media management permissions. To change your local avatar, contact the blog administrator."
51
- msgstr "Ваших полномочий не достаточно для смены аватара. Чтобы сменить локальный аватар, свяжитесь с администратором сайта."
52
-
53
- #. Plugin Name of the plugin/theme
54
- msgid "Simple Local Avatars"
55
- msgstr "Локальный аватар"
56
-
57
- #. Description of the plugin/theme
58
- msgid "Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar! Simple and lightweight."
59
- msgstr "Добавить закачку аватара к профилю пользователя, если у текущего пользователя есть полномочия. Генерировать такие же размеры, как на Gravatar-е. Просто и легко."
60
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,10 +1,11 @@
1
  === Simple Local Avatars ===
2
  Contributors: jakemgold, 10up, thinkoomph
3
- Donate link: http://10up.com/plugins/simple-local-avatars-wordpress/
4
  Tags: avatar, gravatar, user photos, users, profile
5
- Requires at least: 3.5
6
- Tested up to: 3.6
7
- Stable tag: 2.0
 
8
 
9
  Adds an avatar upload field to user profiles. Generates requested sizes on demand just like Gravatar!
10
 
@@ -42,8 +43,15 @@ You can also use `get_simple_local_avatar()` (with the same arguments) to retrei
42
 
43
  == Changelog ==
44
 
 
 
 
 
 
 
 
45
  = 2.0 =
46
- * Choose or upload an avatar from the media library (for user's with appropriate capabilities)!
47
  * Local avatars are rated for appropriateness, just like Gravatar
48
  * A new setting under Discussion enables administrators to turn off Gravatar (only use local avatars)
49
  * Delete the local avatar with a single button click (like everywhere else in WordPress)
@@ -101,6 +109,9 @@ You can also use `get_simple_local_avatar()` (with the same arguments) to retrei
101
 
102
  == Upgrade Notice ==
103
 
 
 
 
104
  = 2.0 =
105
  Upgraded to take advantage of *WordPress 3.5 and newer*. Does not support older versions! This has also *not* been tested with front end profile plug-ins - feedback welcome. Note that several language strings have been added or modified - revised translations would be welcome!
106
 
1
  === Simple Local Avatars ===
2
  Contributors: jakemgold, 10up, thinkoomph
3
+ Donate link: https://10up.com/plugins/simple-local-avatars-wordpress/
4
  Tags: avatar, gravatar, user photos, users, profile
5
+ Requires at least: 4.6
6
+ Tested up to: 4.9.8
7
+ Stable tag: 2.1
8
+ Text Domain: simple-local-avatars
9
 
10
  Adds an avatar upload field to user profiles. Generates requested sizes on demand just like Gravatar!
11
 
43
 
44
  == Changelog ==
45
 
46
+ = 2.1 =
47
+ * *New:* All avatar uploads now go into the media library. Don't worry - users without the ability to upload files cannot otherwise see the contents of your media library. This allows local avatars to respect other functionality your site may have around uploaded images, such as external hosting.
48
+ * *New:* REST API support for getting and updating.
49
+ * *New:* Use .org language packs rather than bundling translations.
50
+ * *Fixed:* Avoid an `ArgumentCountError`.
51
+ * *Fixed:* A couple of internationalization issues.
52
+
53
  = 2.0 =
54
+ * Choose or upload an avatar from the media library (for users with appropriate capabilities)!
55
  * Local avatars are rated for appropriateness, just like Gravatar
56
  * A new setting under Discussion enables administrators to turn off Gravatar (only use local avatars)
57
  * Delete the local avatar with a single button click (like everywhere else in WordPress)
109
 
110
  == Upgrade Notice ==
111
 
112
+ = 2.1 =
113
+ *Important note:* All avatar uploads now go into the media library. Don't worry - users without the ability to upload files cannot otherwise see the contents of your media library. This allows local avatars to respect other functionality your site may have around uploaded images, such as external hosting.
114
+
115
  = 2.0 =
116
  Upgraded to take advantage of *WordPress 3.5 and newer*. Does not support older versions! This has also *not* been tested with front end profile plug-ins - feedback welcome. Note that several language strings have been added or modified - revised translations would be welcome!
117
 
screenshot-1.png DELETED
Binary file
simple-local-avatars.php CHANGED
@@ -1,13 +1,14 @@
1
  <?php
2
  /**
3
- Plugin Name: Simple Local Avatars
4
- Plugin URI: http://10up.com/plugins/simple-local-avatars-wordpress/
5
- Description: Adds an avatar upload field to user profiles. Generates requested sizes on demand, just like Gravatar! Simple and lightweight.
6
- Version: 2.0
7
- Author: Jake Goldman, 10up
8
- Author URI: http://10up.com
9
- License: GPLv2 or later
10
- */
 
11
 
12
  /**
13
  * add field to user profiles
@@ -21,8 +22,6 @@ class Simple_Local_Avatars {
21
  * Set up the hooks and default values
22
  */
23
  public function __construct() {
24
- load_plugin_textdomain( 'simple-local-avatars', false, dirname( plugin_basename( __FILE__ ) ) . '/localization/' );
25
-
26
  $this->options = (array) get_option( 'simple_local_avatars' );
27
  $this->avatar_ratings = array(
28
  'G' => __('G &#8212; Suitable for all audiences'),
@@ -49,6 +48,8 @@ class Simple_Local_Avatars {
49
  add_action( 'user_edit_form_tag', array( $this, 'user_edit_form_tag' ) );
50
 
51
  add_filter( 'avatar_defaults', array( $this, 'avatar_defaults' ) );
 
 
52
  }
53
 
54
  /**
@@ -61,7 +62,7 @@ class Simple_Local_Avatars {
61
  * @param string $alt Alternative text to use in image tag. Defaults to blank
62
  * @return string <img> tag for the user's avatar
63
  */
64
- public function get_avatar( $avatar = '', $id_or_email, $size = 96, $default = '', $alt = '' ) {
65
  if ( is_numeric( $id_or_email ) )
66
  $user_id = (int) $id_or_email;
67
  elseif ( is_string( $id_or_email ) && ( $user = get_user_by( 'email', $id_or_email ) ) )
@@ -154,8 +155,28 @@ class Simple_Local_Avatars {
154
  }
155
 
156
  register_setting( 'discussion', 'simple_local_avatars', array( $this, 'sanitize_options' ) );
157
- add_settings_field( 'simple-local-avatars-only', __('Local Avatars Only','simple-local-avatars'), array( $this, 'avatar_settings_field' ), 'discussion', 'avatars', array( 'key' => 'only', 'desc' => 'Only allow local avatars (still uses Gravatar for default avatars)' ) );
158
- add_settings_field( 'simple-local-avatars-caps', __('Local Upload Permissions','simple-local-avatars'), array( $this, 'avatar_settings_field' ), 'discussion', 'avatars', array( 'key' => 'caps', 'desc' => 'Only allow users with file upload capabilities to upload local avatars (Authors and above)' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  }
160
 
161
  /**
@@ -214,7 +235,7 @@ class Simple_Local_Avatars {
214
  echo '
215
  <label for="simple-local-avatars-' . $args['key'] . '">
216
  <input type="checkbox" name="simple_local_avatars[' . $args['key'] . ']" id="simple-local-avatars-' . $args['key'] . '" value="1" ' . checked( $this->options[$args['key']], 1, false ) . ' />
217
- ' . __($args['desc'],'simple-local-avatars') . '
218
  </label>
219
  ';
220
  }
@@ -252,11 +273,16 @@ class Simple_Local_Avatars {
252
  '_wpnonce' => $this->remove_nonce,
253
  ) );
254
  ?>
 
 
 
 
255
  <p style="display: inline-block; width: 26em;">
256
  <span class="description"><?php _e( 'Choose an image from your computer:' ); ?></span><br />
257
  <input type="file" name="simple-local-avatar" id="simple-local-avatar" class="standard-text" />
258
  <span class="spinner" id="simple-local-avatar-spinner"></span>
259
  </p>
 
260
  <p>
261
  <?php if ( current_user_can( 'upload_files' ) && did_action( 'wp_enqueue_media' ) ) : ?><a href="#" class="button hide-if-no-js" id="simple-local-avatar-media"><?php _e( 'Choose from Media Library', 'simple-local-avatars' ); ?></a> &nbsp;<?php endif; ?>
262
  <a href="<?php echo $remove_url; ?>" class="button item-delete submitdelete deletion" id="simple-local-avatar-remove"<?php if ( empty( $profileuser->simple_local_avatar ) ) echo ' style="display:none;"'; ?>><?php _e('Delete local avatar','simple-local-avatars'); ?></a>
@@ -284,7 +310,7 @@ class Simple_Local_Avatars {
284
  echo "\n\t<label><input type='radio' name='simple_local_avatar_rating' value='" . esc_attr( $key ) . "' " . checked( $profileuser->simple_local_avatar_rating, $key, false ) . "/> $rating</label><br />";
285
  endforeach;
286
  ?>
287
- <p class="description"><?php _e( 'If the local avatar is inappropriate for this site, Gravatar will be attempted.' ); ?></p>
288
  </fieldset></td>
289
  </tr>
290
  </table>
@@ -342,14 +368,14 @@ class Simple_Local_Avatars {
342
  }
343
 
344
  // front end (theme my profile etc) support
345
- if ( ! function_exists( 'wp_handle_upload' ) )
346
- require_once( ABSPATH . 'wp-admin/includes/file.php' );
347
 
348
  // allow developers to override file size upload limit for avatars
349
  add_filter( 'upload_size_limit', array( $this, 'upload_size_limit' ) );
350
 
351
  $this->user_id_being_edited = $user_id; // make user_id known to unique_filename_callback function
352
- $avatar = wp_handle_upload( $_FILES['simple-local-avatar'], array(
353
  'mimes' => array(
354
  'jpg|jpeg|jpe' => 'image/jpeg',
355
  'gif' => 'image/gif',
@@ -361,26 +387,18 @@ class Simple_Local_Avatars {
361
 
362
  remove_filter( 'upload_size_limit', array( $this, 'upload_size_limit' ) );
363
 
364
- if ( empty($avatar['file']) ) { // handle failures
365
- switch ( $avatar['error'] ) {
366
- case 'File type does not meet security guidelines. Try another.' :
367
- $this->avatar_upload_error = __('Please upload a valid image file for the avatar.','simple-local-avatars');
368
- break;
369
- default :
370
- $this->avatar_upload_error = '<strong>' . __('There was an error uploading the avatar:','simple-local-avatars') . '</strong> ' . esc_html( $avatar['error'] );
371
- }
372
-
373
  add_action( 'user_profile_update_errors', array( $this, 'user_profile_update_errors' ) );
374
-
375
  return;
376
  }
377
 
378
- $this->assign_new_user_avatar( $avatar['url'], $user_id );
379
 
380
  endif;
381
 
382
  // handle rating
383
- if ( isset( $avatar['url'] ) || $avatar = get_user_meta( $user_id, 'simple_local_avatar', true ) ) {
384
  if ( empty( $_POST['simple_local_avatar_rating'] ) || ! array_key_exists( $_POST['simple_local_avatar_rating'], $this->avatar_ratings ) )
385
  $_POST['simple_local_avatar_rating'] = key( $this->avatar_ratings );
386
 
@@ -506,6 +524,48 @@ class Simple_Local_Avatars {
506
  public function user_profile_update_errors( WP_Error $errors ) {
507
  $errors->add( 'avatar_error', $this->avatar_upload_error );
508
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
509
  }
510
 
511
  $simple_local_avatars = new Simple_Local_Avatars;
@@ -526,7 +586,7 @@ function get_simple_local_avatar( $id_or_email, $size = 96, $default = '', $alt
526
  if ( empty ( $avatar ) ) {
527
  remove_action( 'get_avatar', array( $simple_local_avatars, 'get_avatar' ) );
528
  $avatar = get_avatar( $id_or_email, $size, $default, $alt );
529
- add_action( 'get_avatar', array( $simple_local_avatars, 'get_avatar' ) );
530
  }
531
 
532
  return $avatar;
@@ -602,4 +662,4 @@ function simple_local_avatars_uninstall() {
602
  endforeach;
603
 
604
  delete_option('simple_local_avatars');
605
- }
1
  <?php
2
  /**
3
+ * Plugin Name: Simple Local Avatars
4
+ * Plugin URI: https://10up.com/plugins/simple-local-avatars-wordpress/
5
+ * Description: Adds an avatar upload field to user profiles. Generates requested sizes on demand, just like Gravatar! Simple and lightweight.
6
+ * Version: 2.1
7
+ * Author: Jake Goldman, 10up
8
+ * Author URI: https://10up.com
9
+ * License: GPLv2 or later
10
+ * Text Domain: simple-local-avatars
11
+ */
12
 
13
  /**
14
  * add field to user profiles
22
  * Set up the hooks and default values
23
  */
24
  public function __construct() {
 
 
25
  $this->options = (array) get_option( 'simple_local_avatars' );
26
  $this->avatar_ratings = array(
27
  'G' => __('G &#8212; Suitable for all audiences'),
48
  add_action( 'user_edit_form_tag', array( $this, 'user_edit_form_tag' ) );
49
 
50
  add_filter( 'avatar_defaults', array( $this, 'avatar_defaults' ) );
51
+
52
+ add_action( 'rest_api_init', array( $this, 'register_rest_fields' ) );
53
  }
54
 
55
  /**
62
  * @param string $alt Alternative text to use in image tag. Defaults to blank
63
  * @return string <img> tag for the user's avatar
64
  */
65
+ public function get_avatar( $avatar = '', $id_or_email = '', $size = 96, $default = '', $alt = '' ) {
66
  if ( is_numeric( $id_or_email ) )
67
  $user_id = (int) $id_or_email;
68
  elseif ( is_string( $id_or_email ) && ( $user = get_user_by( 'email', $id_or_email ) ) )
155
  }
156
 
157
  register_setting( 'discussion', 'simple_local_avatars', array( $this, 'sanitize_options' ) );
158
+ add_settings_field(
159
+ 'simple-local-avatars-only',
160
+ __('Local Avatars Only','simple-local-avatars'),
161
+ array( $this, 'avatar_settings_field' ),
162
+ 'discussion',
163
+ 'avatars',
164
+ array(
165
+ 'key' => 'only',
166
+ 'desc' => __( 'Only allow local avatars (still uses Gravatar for default avatars)', 'simple-local-avatars' )
167
+ )
168
+ );
169
+ add_settings_field(
170
+ 'simple-local-avatars-caps',
171
+ __('Local Upload Permissions','simple-local-avatars'),
172
+ array( $this, 'avatar_settings_field' ),
173
+ 'discussion',
174
+ 'avatars',
175
+ array(
176
+ 'key' => 'caps',
177
+ 'desc' => __( 'Only allow users with file upload capabilities to upload local avatars (Authors and above)', 'simple-local-avatars' )
178
+ )
179
+ );
180
  }
181
 
182
  /**
235
  echo '
236
  <label for="simple-local-avatars-' . $args['key'] . '">
237
  <input type="checkbox" name="simple_local_avatars[' . $args['key'] . ']" id="simple-local-avatars-' . $args['key'] . '" value="1" ' . checked( $this->options[$args['key']], 1, false ) . ' />
238
+ ' . $args['desc'] . '
239
  </label>
240
  ';
241
  }
273
  '_wpnonce' => $this->remove_nonce,
274
  ) );
275
  ?>
276
+ <?php
277
+ // if user is author and above hide the choose file option
278
+ // force them to use the WP Media Selector
279
+ if ( ! current_user_can( 'upload_files' ) ) { ?>
280
  <p style="display: inline-block; width: 26em;">
281
  <span class="description"><?php _e( 'Choose an image from your computer:' ); ?></span><br />
282
  <input type="file" name="simple-local-avatar" id="simple-local-avatar" class="standard-text" />
283
  <span class="spinner" id="simple-local-avatar-spinner"></span>
284
  </p>
285
+ <?php } ?>
286
  <p>
287
  <?php if ( current_user_can( 'upload_files' ) && did_action( 'wp_enqueue_media' ) ) : ?><a href="#" class="button hide-if-no-js" id="simple-local-avatar-media"><?php _e( 'Choose from Media Library', 'simple-local-avatars' ); ?></a> &nbsp;<?php endif; ?>
288
  <a href="<?php echo $remove_url; ?>" class="button item-delete submitdelete deletion" id="simple-local-avatar-remove"<?php if ( empty( $profileuser->simple_local_avatar ) ) echo ' style="display:none;"'; ?>><?php _e('Delete local avatar','simple-local-avatars'); ?></a>
310
  echo "\n\t<label><input type='radio' name='simple_local_avatar_rating' value='" . esc_attr( $key ) . "' " . checked( $profileuser->simple_local_avatar_rating, $key, false ) . "/> $rating</label><br />";
311
  endforeach;
312
  ?>
313
+ <p class="description"><?php _e( 'If the local avatar is inappropriate for this site, Gravatar will be attempted.', 'simple-local-avatars' ); ?></p>
314
  </fieldset></td>
315
  </tr>
316
  </table>
368
  }
369
 
370
  // front end (theme my profile etc) support
371
+ if ( ! function_exists( 'media_handle_upload' ) )
372
+ require_once( ABSPATH . 'wp-admin/includes/media.php' );
373
 
374
  // allow developers to override file size upload limit for avatars
375
  add_filter( 'upload_size_limit', array( $this, 'upload_size_limit' ) );
376
 
377
  $this->user_id_being_edited = $user_id; // make user_id known to unique_filename_callback function
378
+ $avatar_id = media_handle_upload( 'simple-local-avatar', 0, array(), array(
379
  'mimes' => array(
380
  'jpg|jpeg|jpe' => 'image/jpeg',
381
  'gif' => 'image/gif',
387
 
388
  remove_filter( 'upload_size_limit', array( $this, 'upload_size_limit' ) );
389
 
390
+ if ( is_wp_error( $avatar_id ) ) { // handle failures.
391
+ $this->avatar_upload_error = '<strong>' . __( 'There was an error uploading the avatar:', 'simple-local-avatars' ) . '</strong> ' . esc_html( $avatar_id->get_error_message() );
 
 
 
 
 
 
 
392
  add_action( 'user_profile_update_errors', array( $this, 'user_profile_update_errors' ) );
 
393
  return;
394
  }
395
 
396
+ $this->assign_new_user_avatar( $avatar_id, $user_id );
397
 
398
  endif;
399
 
400
  // handle rating
401
+ if ( isset( $avatar_id ) || $avatar = get_user_meta( $user_id, 'simple_local_avatar', true ) ) {
402
  if ( empty( $_POST['simple_local_avatar_rating'] ) || ! array_key_exists( $_POST['simple_local_avatar_rating'], $this->avatar_ratings ) )
403
  $_POST['simple_local_avatar_rating'] = key( $this->avatar_ratings );
404
 
524
  public function user_profile_update_errors( WP_Error $errors ) {
525
  $errors->add( 'avatar_error', $this->avatar_upload_error );
526
  }
527
+
528
+ /**
529
+ * Registers the simple_local_avatar field in the REST API.
530
+ */
531
+ public function register_rest_fields() {
532
+ register_rest_field( 'user', 'simple_local_avatar', array(
533
+ 'get_callback' => array( $this, 'get_avatar_rest' ),
534
+ 'update_callback' => array( $this, 'set_avatar_rest' ),
535
+ 'schema' => array(
536
+ 'description' => 'The users simple local avatar',
537
+ 'type' => 'object',
538
+ )
539
+ ));
540
+ }
541
+
542
+ /**
543
+ * Returns the simple_local_avatar meta key for the given user.
544
+ *
545
+ * @param object $user User object
546
+ */
547
+ public function get_avatar_rest( $user ) {
548
+ $local_avatar = get_user_meta( $user['id'], 'simple_local_avatar', true );
549
+ if ( empty( $local_avatar ) ) {
550
+ return;
551
+ }
552
+ return $local_avatar;
553
+ }
554
+
555
+ /**
556
+ * Updates the simple local avatar from a REST request.
557
+ *
558
+ * Since we are just adding a field to the existing user endpoint
559
+ * we don't need to worry about ensuring the calling user has proper permissions.
560
+ * Only the user or an administrator would be able to change the avatar.
561
+ *
562
+ * @param array $input Input submitted via REST request.
563
+ * @param object $user The user making the request.
564
+ */
565
+ public function set_avatar_rest( $input, $user ) {
566
+ $this->assign_new_user_avatar($input['media_id'], $user->ID);
567
+ }
568
+
569
  }
570
 
571
  $simple_local_avatars = new Simple_Local_Avatars;
586
  if ( empty ( $avatar ) ) {
587
  remove_action( 'get_avatar', array( $simple_local_avatars, 'get_avatar' ) );
588
  $avatar = get_avatar( $id_or_email, $size, $default, $alt );
589
+ add_action( 'get_avatar', array( $simple_local_avatars, 'get_avatar' ), 10, 5 );
590
  }
591
 
592
  return $avatar;
662
  endforeach;
663
 
664
  delete_option('simple_local_avatars');
665
+ }