parent
57f6ac5bad
commit
990b5bf231
|
@ -30,13 +30,15 @@ Gravatar lets users self-rate their images to be used at appropriate audiences.
|
|||
See more information at [Gravatar][1].
|
||||
|
||||
## Alternative Configuration
|
||||
Open the .htconfig.php file and add "gravatar" to the list of activated addons:
|
||||
Open the config/local.ini.php file and add "gravatar" to the list of activated addons:
|
||||
|
||||
$a->config['system']['addon'] = "..., gravatar";
|
||||
[system]
|
||||
addon = ...,gravatar
|
||||
|
||||
You can add two configuration variables for the addon:
|
||||
|
||||
$a->config['gravatar']['default_avatar'] = "identicon";
|
||||
$a->config['gravatar']['rating'] = "g";
|
||||
[gravatar]
|
||||
default_avatar = identicon
|
||||
rating = g
|
||||
|
||||
[1]: http://www.gravatar.com/site/implement/images/ "See documentation at Gravatar for more information"
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php return <<<INI
|
||||
|
||||
; Warning: Don't change this file! It only holds the default config values for this addon.
|
||||
; Instead overwrite these config values in config/local.ini.php in your Friendica directory
|
||||
|
||||
[gravatar]
|
||||
; default_avatar (String)
|
||||
; If no avatar was found for an email Gravatar can create some pseudo-random generated avatars based on an email hash.
|
||||
; You can choose between these presets:
|
||||
; - gravatar : default static Gravatar logo
|
||||
; - mm : (mystery-man) a static image
|
||||
; - identicon: a generated geometric pattern based on email hash
|
||||
; - monsterid: a generated 'monster' with different colors, faces, etc. based on email hash
|
||||
; - wavatar : faces with different features and backgrounds based on email hash
|
||||
; - retro : 8-bit arcade-styled pixelated faces based on email hash
|
||||
default_avatar = gravatar
|
||||
|
||||
; rating (String)
|
||||
; Gravatar lets users self-rate their images to be used at appropriate audiences.
|
||||
; Choose which are appropriate for your friendica site:
|
||||
; - g : suitable for display on all wesites with any audience type
|
||||
; - pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence
|
||||
; - r : may contain such things as harsh profanity, intense violence, nudity, or hard drug use
|
||||
; - x : may contain hardcore sexual imagery or extremely disurbing violence
|
||||
rating = g
|
||||
|
||||
INI;
|
||||
//Keep this line
|
|
@ -13,6 +13,7 @@ use Friendica\Core\L10n;
|
|||
* Installs the addon hook
|
||||
*/
|
||||
function gravatar_install() {
|
||||
Addon::registerHook('load_config', 'addon/gravatar/gravatar.php', 'gravatar_load_config');
|
||||
Addon::registerHook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup');
|
||||
|
||||
logger("registered gravatar in avatar_lookup hook");
|
||||
|
@ -22,11 +23,17 @@ function gravatar_install() {
|
|||
* Removes the addon hook
|
||||
*/
|
||||
function gravatar_uninstall() {
|
||||
Addon::unregisterHook('load_config', 'addon/gravatar/gravatar.php', 'gravatar_load_config');
|
||||
Addon::unregisterHook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup');
|
||||
|
||||
logger("unregistered gravatar in avatar_lookup hook");
|
||||
}
|
||||
|
||||
function gravatar_load_config(\Friendica\App $a)
|
||||
{
|
||||
$a->loadConfigFile(__DIR__. '/config/gravatar.ini.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up the avatar at gravatar.com and returns the URL.
|
||||
*
|
||||
|
@ -34,7 +41,7 @@ function gravatar_uninstall() {
|
|||
* @param &$b array
|
||||
*/
|
||||
function gravatar_lookup($a, &$b) {
|
||||
$default_avatar = Config::get('gravatar', 'default_img');
|
||||
$default_avatar = Config::get('gravatar', 'default_avatar');
|
||||
$rating = Config::get('gravatar', 'rating');
|
||||
|
||||
// setting default value if nothing configured
|
||||
|
@ -60,7 +67,7 @@ function gravatar_lookup($a, &$b) {
|
|||
function gravatar_addon_admin (&$a, &$o) {
|
||||
$t = get_markup_template( "admin.tpl", "addon/gravatar/" );
|
||||
|
||||
$default_avatar = Config::get('gravatar', 'default_img');
|
||||
$default_avatar = Config::get('gravatar', 'default_avatar');
|
||||
$rating = Config::get('gravatar', 'rating');
|
||||
|
||||
// set default values for first configuration
|
||||
|
@ -109,7 +116,7 @@ function gravatar_addon_admin_post (&$a) {
|
|||
|
||||
$default_avatar = ((x($_POST, 'avatar')) ? notags(trim($_POST['avatar'])) : 'identicon');
|
||||
$rating = ((x($_POST, 'rating')) ? notags(trim($_POST['rating'])) : 'g');
|
||||
Config::set('gravatar', 'default_img', $default_avatar);
|
||||
Config::set('gravatar', 'default_avatar', $default_avatar);
|
||||
Config::set('gravatar', 'rating', $rating);
|
||||
info(L10n::t('Gravatar settings updated.') .EOL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue