Update of /cvsroot/php-blog/additional_plugins/serendipity_plugin_weather
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8751/serendipity_plugin_weather
Modified Files:
serendipity_plugin_weather.php
Log Message:
Plugin no longer causes catastrophic failure when PEAR Services/Weather is not installed. Now offers a warning in sidebar.
Index: serendipity_plugin_weather.php
===================================================================
RCS file: /cvsroot/php-blog/additional_plugins/serendipity_plugin_weather/serendipity_plugin_weather.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- serendipity_plugin_weather.php 2 Jan 2005 20:16:34 -0000 1.11
+++ serendipity_plugin_weather.php 3 Jan 2005 02:59:42 -0000 1.12
@@ -162,310 +162,314 @@
$timezone = $this->get_config('timezone',0);
$unitString = $this->get_config('units','metric');
- require_once('Services/Weather.php');
+ if(include_once('Services/Weather.php')){
- $metar = &Services_Weather::service('METAR', array('debug' => 0));
- if (Services_Weather::isError($metar)) {
- die('Error: ' . $metar->getMessage());
- }
+ $metar = &Services_Weather::service('METAR', array('debug' => 0));
+ if (Services_Weather::isError($metar)) {
+ die('Error: ' . $metar->getMessage());
+ }
- // Set the unit format for the data
- $metar->setUnitsFormat($unitString);
+ // Set the unit format for the data
+ $metar->setUnitsFormat($unitString);
- // Set the time/date format
- // Do we have the date/time format set somewhere in s9y? then we should take this here
- // $metar->setDateTimeFormat('d.m.Y', 'H:i');
- // $metar_data->setDateTimeFormat('j M Y', 'H:i');
+ // Set the time/date format
+ // Do we have the date/time format set somewhere in s9y? then we should take this here
+ // $metar->setDateTimeFormat('d.m.Y', 'H:i');
+ // $metar_data->setDateTimeFormat('j M Y', 'H:i');
- $status = $metar->setCache('file', array('cache_dir' => $serendipity['serendipityPath'].'/templates_c'));
- if (Services_Weather::isError($status)) {
- echo 'Error: ' . $status->getMessage();
- }
+ $status = $metar->setCache('file', array('cache_dir' => $serendipity['serendipityPath'].'/templates_c'));
+ if (Services_Weather::isError($status)) {
+ echo 'Error: ' . $status->getMessage();
+ }
- switch($unitString)
- {
- case "metric":
- $units = array('wind' => 'km/h',
+ switch($unitString)
+ {
+ case "metric":
+ $units = array('wind' => 'km/h',
'vis' => 'km',
'height' => 'km',
'temp' => '°C',
'pres' => 'mb',
'rain' => 'mm');
- break;
- case "standard":
- $units = array('wind' => 'mph',
+ break;
+ case "standard":
+ $units = array('wind' => 'mph',
'vis' => 'mi',
'height' => 'mi',
'temp' => '°F',
'pres' => 'in',
'rain' => 'in');
- break;
- }
+ break;
+ }
- $weather_data = $metar->getWeather($metar_site);
- if (Services_Weather::isError($weather_data)) {
- echo 'Error: ' . $weather_data->getMessage();
- }
-
- $location_data = $metar->getLocation($metar_site);
- if (Services_Weather::isError($location_data)) {
- echo 'Error: ' . $location_data->getMessage();
- }
+ $weather_data = $metar->getWeather($metar_site);
+ if (Services_Weather::isError($weather_data)) {
+ echo 'Error: ' . $weather_data->getMessage();
+ }
- $forecast_data = $metar->getForecast($metar_site);
- if (Services_Weather::isError($forecast_data)) {
- echo 'Error: ' . $forecast_data->getMessage();
- }
+ $location_data = $metar->getLocation($metar_site);
+ if (Services_Weather::isError($location_data)) {
+ echo 'Error: ' . $location_data->getMessage();
+ }
- // Do all that icon-stuff
- // FIXXME: URL-Prefix
- $windDir = $weather_data["windDirection"];
- switch ($windDir) {
- case 'S':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/sss.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_S;
- break;
- case 'SSW':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/ssw.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_SSW;
- break;
- case 'SSE':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/sse.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_SSE;
- break;
- case 'SW':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/sw.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_SW;
- break;
- case 'WSW':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/sww.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_WSW;
- break;
- case 'E':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/eee.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_E;
- break;
- case 'ESE':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/see.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_ESE;
- break;
- case 'ENE':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/nee.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_ENE;
- break;
- case 'N':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/nnn.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_N;
- break;
- case 'NNW':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/nnw.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_NNW;
- break;
- case 'NNE':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/nne.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_NNE;
- break;
- case 'NW':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/nw.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_NW;
- break;
- case 'NE':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/ne.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_NE;
- break;
- case 'SE':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/se.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_SE;
- break;
- case 'W':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/www.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_W;
- break;
- case 'WNW':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/nww.png';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_WNW;
- break;
- case 'Variable':
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/vrb.gif';
- $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_V;
- break;
- default :
- $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/wind_nodata.png';
- $windDir = "No recorded data.";
- }
+ $forecast_data = $metar->getForecast($metar_site);
+ if (Services_Weather::isError($forecast_data)) {
+ echo 'Error: ' . $forecast_data->getMessage();
+ }
- // Turn the GMT time from the update into a local time
- $localTime = date('j M Y H:i', strtotime($weather_data['updateRaw']) + (3600*$timezone));
+ // Do all that icon-stuff
+ // FIXXME: URL-Prefix
+ $windDir = $weather_data["windDirection"];
+ switch ($windDir) {
+ case 'S':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/sss.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_S;
+ break;
+ case 'SSW':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/ssw.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_SSW;
+ break;
+ case 'SSE':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/sse.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_SSE;
+ break;
+ case 'SW':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/sw.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_SW;
+ break;
+ case 'WSW':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/sww.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_WSW;
+ break;
+ case 'E':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/eee.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_E;
+ break;
+ case 'ESE':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/see.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_ESE;
+ break;
+ case 'ENE':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/nee.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_ENE;
+ break;
+ case 'N':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/nnn.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_N;
+ break;
+ case 'NNW':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/nnw.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_NNW;
+ break;
+ case 'NNE':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/nne.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_NNE;
+ break;
+ case 'NW':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/nw.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_NW;
+ break;
+ case 'NE':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/ne.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_NE;
+ break;
+ case 'SE':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/se.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_SE;
+ break;
+ case 'W':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/www.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_W;
+ break;
+ case 'WNW':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/nww.png';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_WNW;
+ break;
+ case 'Variable':
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/vrb.gif';
+ $windDir = PLUGIN_SIDEBAR_WEATHER_DATA_V;
+ break;
+ default :
+ $windDirIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/wind_nodata.png';
+ $windDir = "No recorded data.";
+ }
- // Get local hour to determing if it is night
- $hour = date('H' , strtotime($weather_data['updateRaw']) + (3600*$tz));
- if ($hour > 18 || $hour < 6) {
- $night = 'n_';
- } else {
- $night = '';
- }
+ // Turn the GMT time from the update into a local time
+ $localTime = date('j M Y H:i', strtotime($weather_data['updateRaw']) + (3600*$timezone));
- // Handle cloud data
- // We could be dealing with cloud at several levels, so find the heaviest
- // cover and go with that.
- $cloudData = $weather_data['clouds'];
- // See if we are dealing with an array of arrays or some information
- $cloudKeys = array_keys($cloudData);
- $testKey = $cloudKeys[0];
- if (!is_array($cloudData["$testKey"])) {
- // we have information
- $amount = $cloudData['amount'];
- } else {
- // we have information on several levels - get highest
- $key = count($cloudKeys)-1;
- $useArray = $cloudData[$key];
- $amount = $useArray['amount'];
- }
+ // Get local hour to determing if it is night
+ $hour = date('H' , strtotime($weather_data['updateRaw']) + (3600*$tz));
+ if ($hour > 18 || $hour < 6) {
+ $night = 'n_';
+ } else {
+ $night = '';
+ }
+
+ // Handle cloud data
+ // We could be dealing with cloud at several levels, so find the heaviest
+ // cover and go with that.
+ $cloudData = $weather_data['clouds'];
+ // See if we are dealing with an array of arrays or some information
+ $cloudKeys = array_keys($cloudData);
+ $testKey = $cloudKeys[0];
+ if (!is_array($cloudData["$testKey"])) {
+ // we have information
+ $amount = $cloudData['amount'];
+ } else {
+ // we have information on several levels - get highest
+ $key = count($cloudKeys)-1;
+ $useArray = $cloudData[$key];
+ $amount = $useArray['amount'];
+ }
- switch ($amount) {
- case "Clear Below":
- case "clear sky":
- case "no significant cloud":
- case "clear below 12,000 ft":
- case "vertical visibility":
- $cloudLevel = "0cloud";
- break;
- case "few":
- case "scattered":
- $cloudLevel = "1cloud";
- break;
- case "Cumulonimbus":
- $cloudLevel = "2cloud";
- break;
- case "Towering Cumulus":
- case "broken":
- $cloudLevel = "3cloud";
- break;
- case "overcast":
- $cloudLevel = "4cloud";
- $night = "";
- break;
- default:
- $cloudLevel = "0cloud";
- }
+ switch ($amount) {
+ case "Clear Below":
+ case "clear sky":
+ case "no significant cloud":
+ case "clear below 12,000 ft":
+ case "vertical visibility":
+ $cloudLevel = "0cloud";
+ break;
+ case "few":
+ case "scattered":
+ $cloudLevel = "1cloud";
+ break;
+ case "Cumulonimbus":
+ $cloudLevel = "2cloud";
+ break;
+ case "Towering Cumulus":
+ case "broken":
+ $cloudLevel = "3cloud";
+ break;
+ case "overcast":
+ $cloudLevel = "4cloud";
+ $night = "";
+ break;
+ default:
+ $cloudLevel = "0cloud";
+ }
- // Determine weather conditions (rain, snow etc);
- // We need some way to translate this
- $conditions = $weather_data["condition"];
+ // Determine weather conditions (rain, snow etc);
+ // We need some way to translate this
+ $conditions = $weather_data["condition"];
- switch ($cloudLevel) {
- case "0cloud":
- if (strstr($conditions, "fog") !== FALSE) {
- $condUse = "_fog";
- } else {
- $condUse = "";
- }
- break;
- case "1cloud":
- if (strstr($conditions, "fog") !== FALSE) {
- $condUse = "_fog";
- } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "light") !== FALSE) {
- $condUse = "_lightrain";
- } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "heavy") !== FALSE) {
- $condUse = "_heavyrain";
- } elseif (strstr($conditions, "rain") !== FALSE) {
- $condUse = "_modrain";
- } else {
- $condUse = "_norain";
- }
- break;
- case "2cloud":
- if (strstr($conditions, "fog") !== FALSE) {
- $condUse = "_fog";
- } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "light") !== FALSE) {
- $condUse = "_lightrain";
- } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "heavy") !== FALSE) {
- $condUse = "_heavyrain";
- } elseif (strstr($conditions, "rain") !== FALSE) {
- $condUse = "_modrain";
- } elseif (strstr($conditions, "snow") !== FALSE) {
- $condUse = "_snow";
- } elseif (strstr($conditions, "thunderstorm") !== FALSE) {
- $condUse = "_thunders";
- } else {
- $condUse = "_norain";
- }
- break;
- case "3cloud":
- if (strstr($conditions, "fog") !== FALSE) {
- $condUse = "_fog";
- } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "light") !== FALSE) {
- $condUse = "_lightrain";
- } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "heavy") !== FALSE) {
- $condUse = "_heavyrain";
- } elseif (strstr($conditions, "rain") !== FALSE) {
- $condUse = "_modrain";
- } elseif (strstr($conditions, "snow") !== FALSE) {
- $condUse = "_snow";
- } elseif (strstr($conditions, "thunderstorm") !== FALSE) {
- $condUse = "_thunders";
- } elseif (strstr($conditions, "hail") !== FALSE) {
- $condUse = "_hail";
- } else {
- $condUse = "_norain";
- }
- break;
- case "4cloud":
- if (strstr($conditions, "fog") !== FALSE) {
- $condUse = "_fog";
- } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "light") !== FALSE) {
- $condUse = "_lightrain";
- } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "heavy") !== FALSE) {
- $condUse = "_heavyrain";
- } elseif (strstr($conditions, "rain") !== FALSE) {
- $condUse = "_modrain";
- } elseif (strstr($conditions, "snow") !== FALSE && strstr($conditions, "light") !== FALSE) {
- $condUse = "_lightsnow";
- } elseif (strstr($conditions, "snow") !== FALSE && strstr($conditions, "heavy") !== FALSE) {
- $condUse = "_heavysnow";
- } elseif (strstr($conditions, "snow") !== FALSE) {
- $condUse = "_snow";
- } elseif (strstr($conditions, "thunderstorm") !== FALSE) {
- $condUse = "_thunders";
- } elseif (strstr($conditions, "hail") !== FALSE && strstr($conditions, "light") !== FALSE) {
- $condUse = "_lighthail";
- } elseif (strstr($conditions, "hail") !== FALSE && strstr($conditions, "heavy") !== FALSE) {
- $condUse = "_heavyhail";
- } elseif (strstr($conditions, "hail") !== FALSE) {
- $condUse = "_hail";
- } else {
- $condUse = "_norain";
- }
- break;
- default:
- $condUse = "_norain";
- }
+ switch ($cloudLevel) {
+ case "0cloud":
+ if (strstr($conditions, "fog") !== FALSE) {
+ $condUse = "_fog";
+ } else {
+ $condUse = "";
+ }
+ break;
+ case "1cloud":
+ if (strstr($conditions, "fog") !== FALSE) {
+ $condUse = "_fog";
+ } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "light") !== FALSE) {
+ $condUse = "_lightrain";
+ } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "heavy") !== FALSE) {
+ $condUse = "_heavyrain";
+ } elseif (strstr($conditions, "rain") !== FALSE) {
+ $condUse = "_modrain";
+ } else {
+ $condUse = "_norain";
+ }
+ break;
+ case "2cloud":
+ if (strstr($conditions, "fog") !== FALSE) {
+ $condUse = "_fog";
+ } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "light") !== FALSE) {
+ $condUse = "_lightrain";
+ } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "heavy") !== FALSE) {
+ $condUse = "_heavyrain";
+ } elseif (strstr($conditions, "rain") !== FALSE) {
+ $condUse = "_modrain";
+ } elseif (strstr($conditions, "snow") !== FALSE) {
+ $condUse = "_snow";
+ } elseif (strstr($conditions, "thunderstorm") !== FALSE) {
+ $condUse = "_thunders";
+ } else {
+ $condUse = "_norain";
+ }
+ break;
+ case "3cloud":
+ if (strstr($conditions, "fog") !== FALSE) {
+ $condUse = "_fog";
+ } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "light") !== FALSE) {
+ $condUse = "_lightrain";
+ } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "heavy") !== FALSE) {
+ $condUse = "_heavyrain";
+ } elseif (strstr($conditions, "rain") !== FALSE) {
+ $condUse = "_modrain";
+ } elseif (strstr($conditions, "snow") !== FALSE) {
+ $condUse = "_snow";
+ } elseif (strstr($conditions, "thunderstorm") !== FALSE) {
+ $condUse = "_thunders";
+ } elseif (strstr($conditions, "hail") !== FALSE) {
+ $condUse = "_hail";
+ } else {
+ $condUse = "_norain";
+ }
+ break;
+ case "4cloud":
+ if (strstr($conditions, "fog") !== FALSE) {
+ $condUse = "_fog";
+ } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "light") !== FALSE) {
+ $condUse = "_lightrain";
+ } elseif (strstr($conditions, "rain") !== FALSE && strstr($conditions, "heavy") !== FALSE) {
+ $condUse = "_heavyrain";
+ } elseif (strstr($conditions, "rain") !== FALSE) {
+ $condUse = "_modrain";
+ } elseif (strstr($conditions, "snow") !== FALSE && strstr($conditions, "light") !== FALSE) {
+ $condUse = "_lightsnow";
+ } elseif (strstr($conditions, "snow") !== FALSE && strstr($conditions, "heavy") !== FALSE) {
+ $condUse = "_heavysnow";
+ } elseif (strstr($conditions, "snow") !== FALSE) {
+ $condUse = "_snow";
+ } elseif (strstr($conditions, "thunderstorm") !== FALSE) {
+ $condUse = "_thunders";
+ } elseif (strstr($conditions, "hail") !== FALSE && strstr($conditions, "light") !== FALSE) {
+ $condUse = "_lighthail";
+ } elseif (strstr($conditions, "hail") !== FALSE && strstr($conditions, "heavy") !== FALSE) {
+ $condUse = "_heavyhail";
+ } elseif (strstr($conditions, "hail") !== FALSE) {
+ $condUse = "_hail";
+ } else {
+ $condUse = "_norain";
+ }
+ break;
+ default:
+ $condUse = "_norain";
+ }
- // Construct icon name
- $conditionIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/' . $night . $cloudLevel . $condUse . '.png';
+ // Construct icon name
+ $conditionIcon = $serendipity['serendipityHTTPPath'] . 'pixel/icons/serendipity_weather_plugin/' . $night . $cloudLevel . $condUse . '.png';
- $content = '';
+ $content = '';
- $content .= '<img src="' . $conditionIcon . '" alt="" /><br />'. $conditions . '<br />';
- // FIXXME: Translate the Winddirection
- $content .= '<dl><dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_WINDDIRECTION.'</dt><dd><img src="' .
- $windDirIcon . '" alt="" /><dt>' .
- $windDir . ' at <dd>' . $weather_data["wind"] . ' ' .$units['wind'] . '</dd></dt>';
+ $content .= '<img src="' . $conditionIcon . '" alt="" /><br />'. $conditions . '<br />';
+ // FIXXME: Translate the Winddirection
+ $content .= '<dl><dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_WINDDIRECTION.'</dt><dd><img src="' .
+ $windDirIcon . '" alt="" /><dt>' .
+ $windDir . ' at <dd>' . $weather_data["wind"] . ' ' .$units['wind'] . '</dd></dt>';
- $content .= '<dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_TEMPERATURE.'</dt><dd>'.
- $weather_data["temperature"].' '. $units['temp'].'</dd>';
- $content .= '<dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_FELT_TEMPERATURE.'</dt><dd>'.
- $weather_data["feltTemperature"].' '. $units['temp'] .'</dd>';
- $content .= '<dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_HUMIDITY.'</dt><dd>' .
+ $content .= '<dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_TEMPERATURE.'</dt><dd>'.
+ $weather_data["temperature"].' '. $units['temp'].'</dd>';
+ $content .= '<dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_FELT_TEMPERATURE.'</dt><dd>'.
+ $weather_data["feltTemperature"].' '. $units['temp'] .'</dd>';
+ $content .= '<dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_HUMIDITY.'</dt><dd>' .
$weather_data["humidity"] .' '. '%</dd>';
- $content .= '<dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_PRESSURE.'</dt><dd>' .
- $weather_data['pressure'] .' '. $units['pres'].'</dd>';
- $content .= '<dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_VISIBILITY.'</dt><dd>' .
- $weather_data["visibility"] .' '. $units['vis'] . '</dd>';
- $content .= '<dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_UPDATE.'</dt><dd>' .
- $localTime . '</dd></dl>';
+ $content .= '<dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_PRESSURE.'</dt><dd>' .
+ $weather_data['pressure'] .' '. $units['pres'].'</dd>';
+ $content .= '<dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_VISIBILITY.'</dt><dd>' .
+ $weather_data["visibility"] .' '. $units['vis'] . '</dd>';
+ $content .= '<dt>'.PLUGIN_SIDEBAR_WEATHER_DATA_UPDATE.'</dt><dd>' .
+ $localTime . '</dd></dl>';
+
+ } else {
+ $content = 'Loading the <a href=http://pear.php.net/package/Services_Weather/>PEAR Services/Weather module</a> failed. Please insure that the module is installed.';
+ }
echo $content;
} // function
|