]> git.mxchange.org Git - friendica-addons.git/blobdiff - curweather/curweather.php
Diaspora - set host to empty if it doesn't exist.
[friendica-addons.git] / curweather / curweather.php
index 85fd4a6033ebbfcb440e87fba7ec3ccb854b0de0..6d7edc06b3dea3d1d1944ab79bf1751c95aa2555 100644 (file)
@@ -9,12 +9,10 @@
  *
  */
 
-require_once 'include/text.php';
-
 use Friendica\App;
-use Friendica\Core\Addon;
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
+use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
@@ -23,16 +21,16 @@ use Friendica\Util\Proxy as ProxyUtils;
 
 function curweather_install()
 {
-       Addon::registerHook('network_mod_init'   , 'addon/curweather/curweather.php', 'curweather_network_mod_init');
-       Addon::registerHook('addon_settings'     , 'addon/curweather/curweather.php', 'curweather_addon_settings');
-       Addon::registerHook('addon_settings_post', 'addon/curweather/curweather.php', 'curweather_addon_settings_post');
+       Hook::register('network_mod_init'   , 'addon/curweather/curweather.php', 'curweather_network_mod_init');
+       Hook::register('addon_settings'     , 'addon/curweather/curweather.php', 'curweather_addon_settings');
+       Hook::register('addon_settings_post', 'addon/curweather/curweather.php', 'curweather_addon_settings_post');
 }
 
 function curweather_uninstall()
 {
-       Addon::unregisterHook('network_mod_init'   , 'addon/curweather/curweather.php', 'curweather_network_mod_init');
-       Addon::unregisterHook('addon_settings'     , 'addon/curweather/curweather.php', 'curweather_addon_settings');
-       Addon::unregisterHook('addon_settings_post', 'addon/curweather/curweather.php', 'curweather_addon_settings_post');
+       Hook::unregister('network_mod_init'   , 'addon/curweather/curweather.php', 'curweather_network_mod_init');
+       Hook::unregister('addon_settings'     , 'addon/curweather/curweather.php', 'curweather_addon_settings');
+       Hook::unregister('addon_settings_post', 'addon/curweather/curweather.php', 'curweather_addon_settings_post');
 }
 
 //  get the weather data from OpenWeatherMap
@@ -118,7 +116,7 @@ function curweather_network_mod_init(App $a, &$b)
        $rpt = PConfig::get(local_user(), 'curweather', 'curweather_loc');
 
        // Set the language to the browsers language or default and use metric units
-       $lang = (!empty($_SESSION['language']) ? $_SESSION['language'] : Config::get('system', 'language'));
+       $lang = defaults($_SESSION, 'language', Config::get('system', 'language'));
        $units = PConfig::get( local_user(), 'curweather', 'curweather_units');
        $appid = Config::get('curweather', 'appid');
        $cachetime = intval(Config::get('curweather', 'cachetime'));