', true, false);
- $forcastTomorrow2 = '
'.ExtractData($forcast, '', '
').'
'.ExtractData($forcast, '
', '
', false, false);
-
- IPSWeatherFAT_SetValue('TodayForecastLong', $forcastToday);
- IPSWeatherFAT_SetValue('TomorrowForecastLong', $forcastTomorrow);
- IPSWeatherFAT_SetValue('Tomorrow1ForecastLong', $forcastTomorrow1);
- IPSWeatherFAT_SetValue('Tomorrow2ForecastLong', $forcastTomorrow2);
-
- } else {
- IPSLogger_Trc(__file__, "No Connection - Refresh of Weather Data NOT possible");
-
- }
-
+ if (IPSWEATHERFAT_YAHOO_WOEID<>'' and !$refreshWunderground) {
+ IPSUtils_Include ("IPSWeatherForcastAT_RefreshYahoo.inc.php", "IPSLibrary::app::modules::Weather::IPSWeatherForcastAT");
+ IPSWeatherFAT_RefreshYahoo();
+ }
- function ExtractData($data, $key1, $key2, $removeKey1=true, $removeKey2=true) {
- $strPos1 = strpos($data, $key1);
- $strPos2 = strpos($data, $key2);
- if ($removeKey1 and $removeKey2) {
- $result =substr($data, $strPos1+strlen($key1), $strPos2-$strPos1-strlen($key1));
- } elseif ($removeKey1) {
- $result =substr($data, $strPos1+strlen($key1), $strPos2-$strPos1-strlen($key1)+strlen($key2));
- } elseif ($removeKey2) {
- $result =substr($data, $strPos1, $strPos2-$strPos1-strlen($key2));
- } else {
- $result =substr($data, $strPos1, $strPos2-$strPos1+strlen($key2));
- }
- return $result;
+ if (IPSWEATHERFAT_ORF_URL<>'') {
+ IPSUtils_Include ("IPSWeatherForcastAT_RefreshORF.inc.php", "IPSLibrary::app::modules::Weather::IPSWeatherForcastAT");
+ IPSWeatherFAT_RefreshORF();
+ }
}
/** @}*/
diff --git a/IPSLibrary/app/modules/Weather/IPSWeatherForcastAT/IPSWeatherForcastAT_RefreshGoogle.inc.php b/IPSLibrary/app/modules/Weather/IPSWeatherForcastAT/IPSWeatherForcastAT_RefreshGoogle.inc.php
new file mode 100644
index 0000000..22eadcd
--- /dev/null
+++ b/IPSLibrary/app/modules/Weather/IPSWeatherForcastAT/IPSWeatherForcastAT_RefreshGoogle.inc.php
@@ -0,0 +1,96 @@
+
+ /*
+ * This file is part of the IPSLibrary.
+ *
+ * The IPSLibrary is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The IPSLibrary is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the IPSLibrary. If not, see http://www.gnu.org/licenses/gpl.txt.
+ */
+
+
+ /**@defgroup ipsweatherforcastat IPSWeatherForcastAT
+ * @ingroup modules_weather
+ * @{
+ *
+ * Dieses Script aktualisiert die Wetterdaten in IPS mit Google
+ *
+ * @file IPSWeatherForcastAT_RefreshGoogle.inc.php
+ * @author Andreas Brauneis
+ * @version
+ * Version 2.50.1, 15.02.2012
+ *
+ */
+
+ function IPSWeatherFAT_RefreshGoogle() {
+ IPSLogger_Trc(__file__, "Refresh Weather Data Google");
+
+ $stationGoogle = IPSWEATHERFAT_GOOGLE_PLACE."-".IPSWEATHERFAT_GOOGLE_COUNTRY;
+ $urlGoogle = "http://www.google.com/ig/api?weather=".$stationGoogle."&hl=".IPSWEATHERFAT_GOOGLE_LANG;
+ $DaySourceArray = array('Mo.','Di.','Mi.','Do.','Fr.','Sa.','So.');
+ $DayDisplayArray = array('Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag');
+
+ echo $urlGoogle.PHP_EOL;
+ $urlContent = @Sys_GetURLContent($urlGoogle);
+ if ($urlContent===false) {
+ echo 'Google Weather API is empty ...'.PHP_EOL;
+ return;
+ }
+ $api = @simplexml_load_string(utf8_encode($urlContent));
+ if ($api===false) {
+ echo 'Error processing Google Weather API ...'.PHP_EOL;
+ return;
+ }
+
+ IPSWeatherFAT_SetValue('LastRefreshDateTime', date("Y-m-j H:i:s"));
+ IPSWeatherFAT_SetValue('LastRefreshTime', date("H:i"));
+
+ IPSWeatherFAT_SetValueXML('TodayForecastShort', $api->xpath('//weather/current_conditions/condition/@data'));
+ IPSWeatherFAT_SetValueXML('TodayTempCurrent', $api->xpath('//weather/current_conditions/temp_c/@data'));
+ IPSWeatherFAT_SetValueXML('AirHumidity', $api->xpath('//weather/current_conditions/humidity/@data'), array("Feuchtigkeit", "rel.Luftfeuchte"));
+ IPSWeatherFAT_SetValueXML('Wind', $api->xpath('//weather/current_conditions/wind_condition/@data'));
+ IPSWeatherFAT_SetValueXML('TodayIcon', $api->xpath('//weather/current_conditions/icon/@data'), array(".gif", ".png", IPSWEATHERFAT_ICONS_GOOGLE1, IPSWEATHERFAT_ICONS_LARGE));
+
+ // Wettervorhersage heute, morgen, in zwei und in drei Tagen ($wetter[1] bis $wetter[4])
+ $names = array('TodayDay', 'TomorrowDay', 'Tomorrow1Day', 'Tomorrow2Day');
+ foreach($api->xpath('//weather/forecast_conditions/day_of_week/@data') as $idx=>$weather) {
+ //print_r($weather);
+ IPSWeatherFAT_SetValueXML($names[$idx],$weather, array($DaySourceArray, $DayDisplayArray));
+ }
+ $names = array('TodayForecastShort', 'TomorrowForecastShort', 'Tomorrow1ForecastShort', 'Tomorrow2ForecastShort');
+ foreach($api->xpath('//weather/forecast_conditions/condition/@data') as $idx=>$weather) {
+ //print_r($weather);
+ IPSWeatherFAT_SetValueXML($names[$idx],$weather);
+ }
+ $names = array('TodayTempMin', 'TomorrowTempMin', 'Tomorrow1TempMin', 'Tomorrow2TempMin');
+ foreach($api->xpath('//weather/forecast_conditions/low/@data') as $idx=>$weather) {
+ //print_r($weather);
+ IPSWeatherFAT_SetValueXML($names[$idx],$weather);
+ }
+ $names = array('TodayTempMax', 'TomorrowTempMax', 'Tomorrow1TempMax', 'Tomorrow2TempMax');
+ foreach($api->xpath('//weather/forecast_conditions/high/@data') as $idx=>$weather) {
+ //print_r($weather);
+ IPSWeatherFAT_SetValueXML($names[$idx],$weather);
+ }
+ $names = array('TodayIcon', 'TomorrowIcon', 'Tomorrow1Icon', 'Tomorrow2Icon');
+ foreach($api->xpath('//weather/forecast_conditions/icon/@data') as $idx=>$weather) {
+ //print_r($weather);
+ if ($idx==0) {
+ IPSWeatherFAT_SetValueXML($names[$idx],$weather, array(".gif", ".png", IPSWEATHERFAT_ICONS_GOOGLE1, IPSWEATHERFAT_ICONS_LARGE));
+ } else {
+ IPSWeatherFAT_SetValueXML($names[$idx],$weather, array(".gif", ".png", IPSWEATHERFAT_ICONS_GOOGLE1, IPSWEATHERFAT_ICONS_SMALL));
+ }
+ }
+ }
+
+
+ /** @}*/
+?>
\ No newline at end of file
diff --git a/IPSLibrary/app/modules/Weather/IPSWeatherForcastAT/IPSWeatherForcastAT_RefreshORF.inc.php b/IPSLibrary/app/modules/Weather/IPSWeatherForcastAT/IPSWeatherForcastAT_RefreshORF.inc.php
new file mode 100644
index 0000000..c7a3937
--- /dev/null
+++ b/IPSLibrary/app/modules/Weather/IPSWeatherForcastAT/IPSWeatherForcastAT_RefreshORF.inc.php
@@ -0,0 +1,94 @@
+
+ /*
+ * This file is part of the IPSLibrary.
+ *
+ * The IPSLibrary is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The IPSLibrary is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the IPSLibrary. If not, see http://www.gnu.org/licenses/gpl.txt.
+ */
+
+
+ /**@defgroup ipsweatherforcastat IPSWeatherForcastAT
+ * @ingroup modules_weather
+ * @{
+ *
+ * Dieses Script aktualisiert die Wetterdaten in IPS mit ORF
+ *
+ * @file IPSWeatherForcastAT_RefreshORF.inc.php
+ * @author Andreas Brauneis
+ * @version
+ * Version 2.50.1, 15.02.2012
+ *
+ */
+
+ function IPSWeatherFAT_RefreshORF() {
+ // Wetter für Niederösterreich von ORF auslesen
+ $lHTML=@file_get_contents(IPSWEATHERFAT_ORF_URL);
+ if ($lHTML===false) {
+ IPSLogger_Dbg(__file__, 'ORF Detail Forcast is empty ...');
+ echo 'ORF Detail Forcast is empty ...';
+ return false;
+ }
+
+ $forcast = ExtractData($lHTML, '
', '