X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=curweather%2Fcurweather.php;h=e416ba67f832bd00b9a4898e54f326f497b2d1ab;hb=4c0914712a8153c3bd6732556bcb87cc300785d5;hp=58daab0b86354e1c7682f5e0d50b1d3063629e48;hpb=ce637c58454e13704c4f8ea8dee4645cb463b8f2;p=friendica-addons.git
diff --git a/curweather/curweather.php b/curweather/curweather.php
index 58daab0b..e416ba67 100644
--- a/curweather/curweather.php
+++ b/curweather/curweather.php
@@ -10,7 +10,8 @@
*/
require_once('include/network.php');
-include_once('include/text.php');
+require_once("mod/proxy.php");
+require_once('include/text.php');
// get the weather data from OpenWeatherMap
function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0) {
@@ -52,10 +53,11 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
'humidity' => (string) $res->humidity['value'].(string)$res->humidity['unit'],
'descripion' => $desc,
'wind' => (string)$res->wind->speed['name'].' ('.(string)$res->wind->speed['value'].$wunit.')',
- 'update' => (string)$res->lastupdate['value']
+ 'update' => (string)$res->lastupdate['value'],
+ 'icon' => (string)$res->weather['icon']
);
set_pconfig(local_user(), 'curweather', 'last', $now->getTimestamp());
- Cache::set('curweather'.md5($url), serialize($r));
+ Cache::set('curweather'.md5($url), serialize($r), CACHE_HOUR);
return $r;
}
@@ -107,6 +109,7 @@ function curweather_network_mod_init(&$fk_app,&$b) {
$t = get_markup_template("widget.tpl", "addon/curweather/" );
$curweather = replace_macros ($t, array(
'$title' => t("Current Weather"),
+ '$icon' => proxy_url('http://openweathermap.org/img/w/'.$res['icon'].'.png'),
'$city' => $res['city'],
'$lon' => $res['lon'],
'$lat' => $res['lat'],
@@ -170,7 +173,7 @@ function curweather_plugin_settings(&$a,&$s) {
'$noappidtext' => $noappidtext,
'$info' => t('Enter either the name of your location or the zip code.'),
'$curweather_loc' => array( 'curweather_loc', t('Your Location'), $curweather_loc, t('Identifier of your location (name or zip code), e.g. Berlin,DE or 14476,DE.') ),
- '$curweather_units' => array( 'curweather_units', t('Units'), $curweather_units, t('select if the temperatur should be displayed in °C or °F'), array('metric'=>'°C', 'imperial'=>'°F')),
+ '$curweather_units' => array( 'curweather_units', t('Units'), $curweather_units, t('select if the temperatur should be displayed in °C or °F'), array('metric'=>'°C', 'imperial'=>'°F')),
'$enabled' => array( 'curweather_enable', t('Show weather data'), $enable, '')
));
return;