From 990b5bf231283265181e5201ca578fe3cf761432 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 27 Jun 2018 23:12:50 -0400 Subject: [PATCH] [gravatar] Add addon config - Update mentions to .htconfig.php --- gravatar/README.md | 10 ++++++---- gravatar/config/gravatar.ini.php | 28 ++++++++++++++++++++++++++++ gravatar/gravatar.php | 13 ++++++++++--- 3 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 gravatar/config/gravatar.ini.php diff --git a/gravatar/README.md b/gravatar/README.md index 0145570b..b2144f51 100644 --- a/gravatar/README.md +++ b/gravatar/README.md @@ -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" diff --git a/gravatar/config/gravatar.ini.php b/gravatar/config/gravatar.ini.php new file mode 100644 index 00000000..d7118856 --- /dev/null +++ b/gravatar/config/gravatar.ini.php @@ -0,0 +1,28 @@ +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); }