X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=gravatar%2Fgravatar.php;h=894abda6d748c7dace81010926f3084defce3036;hb=a0344101f122248c3069a5dcfa3ebfcb67215d5a;hp=68083b386f48d50f19bd0113b6e7e7a81de06797;hpb=bd7a5594cccb98e806723f22956fc5a0f89f9776;p=friendica-addons.git diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index 68083b38..894abda6 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -8,12 +8,11 @@ use Friendica\App; use Friendica\BaseModule; -use Friendica\Core\Config; use Friendica\Core\Hook; -use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Util\ConfigFileLoader; use Friendica\Util\Strings; @@ -27,16 +26,6 @@ function gravatar_install() { Logger::log("registered gravatar in avatar_lookup hook"); } -/** - * Removes the addon hook - */ -function gravatar_uninstall() { - Hook::unregister('load_config', 'addon/gravatar/gravatar.php', 'gravatar_load_config'); - Hook::unregister('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup'); - - Logger::log("unregistered gravatar in avatar_lookup hook"); -} - function gravatar_load_config(App $a, ConfigFileLoader $loader) { $a->getConfigCache()->load($loader->loadAddonConfig('gravatar')); @@ -49,8 +38,8 @@ function gravatar_load_config(App $a, ConfigFileLoader $loader) * @param &$b array */ function gravatar_lookup($a, &$b) { - $default_avatar = Config::get('gravatar', 'default_avatar'); - $rating = Config::get('gravatar', 'rating'); + $default_avatar = DI::config()->get('gravatar', 'default_avatar'); + $rating = DI::config()->get('gravatar', 'rating'); // setting default value if nothing configured if(! $default_avatar) @@ -75,8 +64,8 @@ function gravatar_lookup($a, &$b) { function gravatar_addon_admin (&$a, &$o) { $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/gravatar/" ); - $default_avatar = Config::get('gravatar', 'default_avatar'); - $rating = Config::get('gravatar', 'rating'); + $default_avatar = DI::config()->get('gravatar', 'default_avatar'); + $rating = DI::config()->get('gravatar', 'rating'); // set default values for first configuration if(! $default_avatar) @@ -86,11 +75,11 @@ function gravatar_addon_admin (&$a, &$o) { // Available options for the select boxes $default_avatars = [ - 'mm' => L10n::t('generic profile image'), - 'identicon' => L10n::t('random geometric pattern'), - 'monsterid' => L10n::t('monster face'), - 'wavatar' => L10n::t('computer generated face'), - 'retro' => L10n::t('retro arcade style face'), + 'mm' => DI::l10n()->t('generic profile image'), + 'identicon' => DI::l10n()->t('random geometric pattern'), + 'monsterid' => DI::l10n()->t('monster face'), + 'wavatar' => DI::l10n()->t('computer generated face'), + 'retro' => DI::l10n()->t('retro arcade style face'), ]; $ratings = [ 'g' => 'g', @@ -104,15 +93,15 @@ function gravatar_addon_admin (&$a, &$o) { DBA::escape('libravatar') ); if (count($r)) { - $o = '
' .L10n::t('Libravatar addon is installed, too. Please disable Libravatar addon or this Gravatar addon.
The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar.') .'
' .DI::l10n()->t('Libravatar addon is installed, too. Please disable Libravatar addon or this Gravatar addon.
The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar.') .'