cvs: pear /Services_Weather Weather.php /Services_Weather/Weather Common.php Ejse.php Globalweather.php Metar.php Weatherdotcom.php
| From: | Alexander Wirtz | Date: | Thu, 13 Oct 2005 10:09:48 +0000 |
| Subject: | cvs: pear /Services_Weather Weather.php /Services_Weather/Weather Common.php Ejse.php Globalweather.php Metar.php Weatherdotcom.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-35490@lists.php.net to get a copy of this message | ||
eru Thu Oct 13 06:09:48 2005 EDT
Modified files:
/pear/Services_Weather/Weather Metar.php Common.php
Weatherdotcom.php Ejse.php
Globalweather.php
/pear/Services_Weather Weather.php
Log:
Whitespace
http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Metar.php?r1=1.70&r2=1.71&ty=u Index: pear/Services_Weather/Weather/Metar.php diff -u pear/Services_Weather/Weather/Metar.php:1.70 pear/Services_Weather/Weather/Metar.php:1.71 --- pear/Services_Weather/Weather/Metar.php:1.70 Thu Oct 13 03:56:37 2005 +++ pear/Services_Weather/Weather/Metar.php Thu Oct 13 06:09:44 2005 @@ -16,7 +16,7 @@ // | Authors: Alexander Wirtz <alex@pc4p.net> | // +----------------------------------------------------------------------+ // -// $Id: Metar.php,v 1.70 2005/10/13 07:56:37 eru Exp $ +// $Id: Metar.php,v 1.71 2005/10/13 10:09:44 eru Exp $ /** * @package Services_Weather @@ -75,7 +75,7 @@ * @access private */ var $_db; - + /** * The source METAR uses * @@ -127,8 +127,8 @@ $error = $perror; return; } - - // Set options accordingly + + // Set options accordingly if (isset($options["dsn"])) { if (isset($options["dbOptions"])) { $status = $this->setMetarDB($options["dsn"], $options["dbOptions"]); @@ -140,10 +140,10 @@ $error = $status; return; } - + // Setting the data sources for METAR and TAF - have to watch out for older API usage if (($source = isset($options["source"])) || isset($options["sourceMetar"])) { - $sourceMetar = $source ? $options["source"] : $options["sourceMetar"]; + $sourceMetar = $source ? $options["source"] : $options["sourceMetar"]; if (($sourcePath = isset($options["sourcePath"])) || isset($options["sourcePathMetar"])) { $sourcePathMetar = $sourcePath ? $options["sourcePath"] : $options["sourcePathMetar"]; } else { @@ -188,7 +188,7 @@ if (is_array($dsninfo) && !isset($dsninfo["mode"])) { $dsninfo["mode"]= 0644; } - + // Initialize connection to DB and store in object if successful $db = DB::connect($dsninfo, $dbOptions); if (DB::isError($db)) { @@ -280,7 +280,7 @@ // {{{ _parseWeatherData() /** * Parses the data returned by the provided source and caches it - * + * * METAR KPIT 091955Z COR 22015G25KT 3/4SM R28L/2600FT TSRA OVC010CB * 18/16 A2992 RMK SLP045 T01820159 * @@ -353,7 +353,7 @@ "chino" => "2nd Ceiling Height Indicator offline" ); } - + $metarCode = array( "report" => "METAR|SPECI", "station" => "\w{4}", @@ -371,7 +371,7 @@ "trend" => "NOSIG|TEMPO|BECMG", "remark" => "RMK" ); - + $remarks = array( "nospeci" => "NOSPECI", "autostation" => "AO(1|2)", @@ -389,7 +389,7 @@ "3hpresstend" => "5([0-8])(\d{3})", "sensors" => "RVRNO|PWINO|PNO|FZRANO|TSNO|VISNO|CHINO", "maintain" => "[\$]" - ); + ); $data = @file($source); @@ -414,7 +414,7 @@ // Add a few local variables for data processing $trendCount = 0; // If we have trends, we need this - $pointer =& $weatherData; // Pointer to the array we add the data to + $pointer =& $weatherData; // Pointer to the array we add the data to for ($i = 0; $i < sizeof($metar); $i++) { // Check for whitespace and step loop, if nothing's there $metar[$i] = trim($metar[$i]); @@ -465,7 +465,7 @@ break; } else { // Match. Hand over result and advance METAR - if (SERVICES_WEATHER_DEBUG) { + if (SERVICES_WEATHER_DEBUG) { echo $key."\n"; echo "\"".$result[1]." ".$metar[$i + 1]."\"".str_repeat("\t", 2 - floor((strlen($result[1]." ".$metar[$i + 1]) + 2) / 8))."-> "; } @@ -590,7 +590,7 @@ $pointer["type"] = $result[0]; while (isset($metar[$i + 1]) && preg_match("/^(FM|TL|AT)(\d{2})(\d{2})$/i", $metar[$i + 1], $lresult)) { if ($lresult[1] == "FM") { - $pointer["from"] = $lresult[2].":".$lresult[3]; + $pointer["from"] = $lresult[2].":".$lresult[3]; } elseif ($lresult[1] == "TL") { $pointer["to"] = $lresult[2].":".$lresult[3]; } else { @@ -682,7 +682,7 @@ $result[2] *= -1; } $weatherData["remark"]["1htemp"] = $this->convertTemperature($result[2] / 10, "c", "f"); - + if (sizeof($result) > 3) { // same for dewpoint if ($result[4] == "1") { @@ -777,7 +777,7 @@ // {{{ _parseForecastData() /** * Parses the data returned by the provided source and caches it - * + * * TAF KLGA 271734Z 271818 11007KT P6SM -RA SCT020 BKN200 * FM2300 14007KT P6SM SCT030 BKN150 * FM0400 VRB03KT P6SM SCT035 OVC080 PROB30 0509 P6SM -RA BKN035 @@ -888,7 +888,7 @@ // Add a few local variables for data processing $fromTime = ""; // The timeperiod the data gets added to $fmcCount = 0; // If we have FMCs (Forecast Meteorological Conditions), we need this - $pointer =& $forecastData; // Pointer to the array we add the data to + $pointer =& $forecastData; // Pointer to the array we add the data to for ($i = 0; $i < sizeof($taf); $i++) { // Check for whitespace and step loop, if nothing's there $taf[$i] = trim($taf[$i]); @@ -962,7 +962,7 @@ break; } else { // Match. Hand over result and advance TAF - if (SERVICES_WEATHER_DEBUG) { + if (SERVICES_WEATHER_DEBUG) { echo $key."\n"; echo "\"".$result[1]." ".$taf[$i + 1]."\"".str_repeat("\t", 2 - floor((strlen($result[1]." ".$taf[$i + 1]) + 2) / 8))."-> "; } @@ -1085,7 +1085,7 @@ $pointer =& $forecastData["time"][$fromTime]; break; case "fmc"; - // Test, if this is a probability for the next FMC + // Test, if this is a probability for the next FMC if (preg_match("/^BECMG|TEMPO$/i", $taf[$i + 1], $lresult)) { // Set type to BECMG or TEMPO $type = $lresult[0]; @@ -1109,7 +1109,7 @@ $from = $lresult[1].":00"; $to = $lresult[2].":00"; $to = ($to == "24:00") ? "00:00" : $to; - // Same as above, we have a time for this FMC from our TAF, + // Same as above, we have a time for this FMC from our TAF, // increase field-counter $i += 1; } else { @@ -1173,7 +1173,7 @@ // {{{ _convertReturn() /** * Converts the data in the return array to the desired units and/or - * output format. + * output format. * * @param array $target * @param string $units @@ -1267,7 +1267,7 @@ if (!isset($this->_db) || !DB::isConnection($this->_db)) { return Services_Weather::raiseError(SERVICES_WEATHER_ERROR_DB_NOT_CONNECTED, __FILE__, __LINE__); } - + if (is_string($location)) { // Try to part search string in name, state and country part // and build where clause from it for the select @@ -1281,7 +1281,7 @@ $where .= " AND LOWER(state) LIKE '%".strtolower(trim($location[1]))."%'"; $where .= " AND LOWER(country) LIKE '%".strtolower(trim($location[2]))."%'"; } - + // Create select, locations with ICAO first $select = "SELECT icao, name, state, country, latitude, longitude ". "FROM metarLocations ". @@ -1294,7 +1294,7 @@ } elseif (strtolower(get_class($result)) != "db_result" || $result->numRows() == 0) { return Services_Weather::raiseError(SERVICES_WEATHER_ERROR_UNKNOWN_LOCATION, __FILE__, __LINE__); } - + // Result is valid, start preparing the return $icao = array(); while (($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) != null) { @@ -1334,7 +1334,7 @@ // {{{ searchLocationByCountry() /** * Returns IDs with location-name for a given country or all available - * countries, if no value was given + * countries, if no value was given * * @param string $country * @return PEAR_Error|array @@ -1412,8 +1412,8 @@ } if (!is_numeric($latitude) || !is_numeric($longitude)) { return Services_Weather::raiseError(SERVICES_WEATHER_ERROR_INVALID_LOCATION, __FILE__, __LINE__); - } - + } + // Get all airports $select = "SELECT icao, x, y, z FROM metarAirports"; $result = $this->_db->query($select); @@ -1602,7 +1602,7 @@ return $weatherReturn; } // }}} - + // {{{ getForecast() /** * METAR provides no forecast per se, we use the TAF reports to generate http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Common.php?r1=1.39&r2=1.40&ty=u Index: pear/Services_Weather/Weather/Common.php diff -u pear/Services_Weather/Weather/Common.php:1.39 pear/Services_Weather/Weather/Common.php:1.40 --- pear/Services_Weather/Weather/Common.php:1.39 Fri Oct 1 09:01:34 2004 +++ pear/Services_Weather/Weather/Common.php Thu Oct 13 06:09:44 2005 @@ -16,7 +16,7 @@ // | Authors: Alexander Wirtz <alex@pc4p.net> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.39 2004/10/01 13:01:34 eru Exp $ +// $Id: Common.php,v 1.40 2005/10/13 10:09:44 eru Exp $ /** * @package Services_Weather @@ -39,7 +39,7 @@ * * Parent class for weather-services. Defines common functions for unit * conversions, checks for cache enabling and does other miscellaneous -* things. +* things. * * @author Alexander Wirtz <alex@pc4p.net> * @package Services_Weather @@ -72,13 +72,13 @@ "rain" => "in" ); - /** - * Timeout for HTTP requests - * - * @var int $_httpTimeout - * @access private - */ - var $_httpTimeout = 60; + /** + * Timeout for HTTP requests + * + * @var int $_httpTimeout + * @access private + */ + var $_httpTimeout = 60; /** * Format of the used dates @@ -149,7 +149,7 @@ */ function Services_Weather_Common($options, &$error) { - // Set options accordingly + // Set options accordingly if (isset($options["cacheType"])) { if (isset($options["cacheOptions"])) { $status = $this->setCache($options["cacheType"], $options["cacheOptions"]); @@ -170,10 +170,10 @@ } } - if (isset($options["httpTimeout"])) { - $this->setHttpTimeout($options["httpTimeout"]); - } - + if (isset($options["httpTimeout"])) { + $this->setHttpTimeout($options["httpTimeout"]); + } + if (isset($options["dateFormat"])) { $this->setDateTimeFormat($options["dateFormat"], ""); } @@ -235,7 +235,7 @@ "rain" => array("in", "mm") ); } - + if (strlen($unitsFormat) && in_array(strtolower($unitsFormat{0}), array("c", "m", "s"))) { $this->_unitsFormat = strtolower($unitsFormat{0}); if ($this->_unitsFormat == "c" && is_array($customUnitsFormat)) { @@ -251,20 +251,20 @@ } // }}} - // {{{ setHttpTimeout() + // {{{ setHttpTimeout() /** * Sets the timeout in seconds for HTTP requests * - * @param int $httpTimeout + * @param int $httpTimeout * @access public */ - function setHttpTimeout($httpTimeout) - { - if (is_int($httpTimeout)) { - $this->_httpTimeout = $httpTimeout; - } - } - // }}} + function setHttpTimeout($httpTimeout) + { + if (is_int($httpTimeout)) { + $this->_httpTimeout = $httpTimeout; + } + } + // }}} // {{{ getUnitsFormat() /** @@ -394,16 +394,16 @@ // Beaufort scale, measurements are in knots $beaufort = array( - 1, 3, 6, 10, + 1, 3, 6, 10, 16, 21, 27, 33, - 40, 47, 55, 63 + 40, 47, 55, 63 ); } - + if ($from == "bft") { return false; } elseif ($to == "bft") { - $speed = round($speed * $factor[$from]["kt"], 0); + $speed = round($speed * $factor[$from]["kt"], 0); for ($i = 0; $i < sizeof($beaufort); $i++) { if ($speed <= $beaufort[$i]) { return $i; @@ -503,7 +503,7 @@ * @param float $speed * @return float * @access public - * @link http://www.nws.noaa.gov/om/windchill/ + * @link http://www.nws.noaa.gov/om/windchill/ */ function calculateWindChill($temperature, $speed) { @@ -526,7 +526,7 @@ * @link http://www.faqs.org/faqs/meteorology/temp-dewpoint/ */ function calculateHumidity($temperature, $dewPoint) - { + { // First calculate saturation steam pressure for both temperatures if ($temperature >= 0) { $a = 7.5; @@ -545,7 +545,7 @@ $b = 240.7; } $dewSSP = 6.1078 * pow(10, ($a * $dewPoint) / ($b + $dewPoint)); - + return round(100 * $dewSSP / $tempSSP, 1); } // }}} @@ -565,7 +565,7 @@ * @link http://www.faqs.org/faqs/meteorology/temp-dewpoint/ */ function calculateDewPoint($temperature, $humidity) - { + { if ($temperature >= 0) { $a = 7.5; $b = 237.3; http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Weatherdotcom.php?r1=1.45&r2=1.46&ty=u Index: pear/Services_Weather/Weather/Weatherdotcom.php diff -u pear/Services_Weather/Weather/Weatherdotcom.php:1.45 pear/Services_Weather/Weather/Weatherdotcom.php:1.46 --- pear/Services_Weather/Weather/Weatherdotcom.php:1.45 Wed Oct 12 12:11:51 2005 +++ pear/Services_Weather/Weather/Weatherdotcom.php Thu Oct 13 06:09:44 2005 @@ -16,7 +16,7 @@ // | Authors: Alexander Wirtz <alex@pc4p.net> | // +----------------------------------------------------------------------+ // -// $Id: Weatherdotcom.php,v 1.45 2005/10/12 16:11:51 eru Exp $ +// $Id: Weatherdotcom.php,v 1.46 2005/10/13 10:09:44 eru Exp $ /** * @package Services_Weather @@ -121,7 +121,7 @@ if (isset($options["licenseKey"])) { $this->setAccountData("", $options["licenseKey"]); } - + include_once "XML/Unserializer.php"; $unserializer = &new XML_Unserializer(array("complexType" => "object", "keyAttribute" => "type")); if (Services_Weather::isError($unserializer)) { @@ -130,9 +130,9 @@ } else { $this->_unserializer = $unserializer; } - - // Can't acquire an object here, has to be clean on every request - include_once "HTTP/Request.php"; + + // Can't acquire an object here, has to be clean on every request + include_once "HTTP/Request.php"; } // }}} @@ -192,13 +192,13 @@ */ function _parseWeatherData($id, $url) { - // Get data from URL... - $request = &new HTTP_Request($url, array("timeout" => $this->_httpTimeout)); - $status = $request->sendRequest(); + // Get data from URL... + $request = &new HTTP_Request($url, array("timeout" => $this->_httpTimeout)); + $status = $request->sendRequest(); if (Services_Weather::isError($status)) { return Services_Weather::raiseError(SERVICES_WEATHER_ERROR_WRONG_SERVER_DATA, __FILE__, __LINE__); } - $data = $request->getResponseBody(); + $data = $request->getResponseBody(); // ...and unserialize $status = $this->_unserializer->unserialize($data); @@ -300,8 +300,8 @@ // {{{ searchLocationByCountry() /** - * Returns only false, as weather.com offers no country listing via - * its XML services + * Returns only false, as weather.com offers no country listing via + * its XML services * * @param string $country * @return bool @@ -355,7 +355,7 @@ // B0rked response (returned is &par=xoap, should be &prod=xoap), fix it $linksReturn["promo"][$i]["link"] = str_replace("par=", "prod=", $this->_links->link[$i]->l); $linksReturn["promo"][$i]["link"] .= "&par=".$this->_partnerID; - } + } return $linksReturn; } @@ -444,7 +444,7 @@ } $weatherReturn["cache"] = "MISS"; } - + // Some explanation for the next two lines: // weather.com isn't always supplying the timezone in the update string, but // uses "Local Time" as reference, which is imho utterly stupid, because it's @@ -464,7 +464,7 @@ $weatherReturn["pressure"] = $this->convertPressure($this->_weather->bar->r, "in", $units["pres"]); $weatherReturn["pressureTrend"] = $this->_weather->bar->d; $weatherReturn["wind"] = $this->convertSpeed($this->_weather->wind->s, "mph", $units["wind"]); - $weatherReturn["windGust"] = $this->convertSpeed($this->_weather->wind->gust, "mph", $units["wind"]); + $weatherReturn["windGust"] = $this->convertSpeed($this->_weather->wind->gust, "mph", $units["wind"]); $weatherReturn["windDegrees"] = $this->_weather->wind->d; $weatherReturn["windDirection"] = $this->_weather->wind->t; $weatherReturn["humidity"] = $this->_weather->hmid; @@ -502,7 +502,7 @@ if (!in_array($days, range(1, 10))) { $days = 2; } - + // Get other data $units = $this->getUnitsFormat($unitsFormat); http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Ejse.php?r1=1.16&r2=1.17&ty=u Index: pear/Services_Weather/Weather/Ejse.php diff -u pear/Services_Weather/Weather/Ejse.php:1.16 pear/Services_Weather/Weather/Ejse.php:1.17 --- pear/Services_Weather/Weather/Ejse.php:1.16 Thu Jul 21 03:49:37 2005 +++ pear/Services_Weather/Weather/Ejse.php Thu Oct 13 06:09:45 2005 @@ -16,7 +16,7 @@ // | Authors: Alexander Wirtz <alex@pc4p.net> | // +----------------------------------------------------------------------+ // -// $Id: Ejse.php,v 1.16 2005/07/21 07:49:37 eru Exp $ +// $Id: Ejse.php,v 1.17 2005/10/13 10:09:45 eru Exp $ /** * @package Services_Weather @@ -130,7 +130,7 @@ // {{{ searchLocation() /** * EJSE offers no search function to date, so this function is disabled. - * Maybe this is the place to interface to some online postcode service... + * Maybe this is the place to interface to some online postcode service... * * @param string $location * @param bool $useFirst @@ -147,7 +147,7 @@ // {{{ searchLocationByCountry() /** * EJSE offers no search function to date, so this function is disabled. - * Maybe this is the place to interface to some online postcode service... + * Maybe this is the place to interface to some online postcode service... * * @param string $country * @return bool @@ -283,23 +283,23 @@ } else { $weatherReturn["update"] = ""; } - $weatherReturn["updateRaw"] = $this->_weather->LastUpdated; + $weatherReturn["updateRaw"] = $this->_weather->LastUpdated; $weatherReturn["station"] = $this->_weather->ReportedAt; $weatherReturn["conditionIcon"] = $this->_weather->IconIndex; - preg_match("/(-?\d+)\D+/", $this->_weather->Temprature, $temperature); + preg_match("/(-?\d+)\D+/", $this->_weather->Temprature, $temperature); $weatherReturn["temperature"] = $this->convertTemperature($temperature[1], "f", $units["temp"]); - preg_match("/(-?\d+)\D+/", $this->_weather->FeelsLike, $feltTemperature); + preg_match("/(-?\d+)\D+/", $this->_weather->FeelsLike, $feltTemperature); $weatherReturn["feltTemperature"] = $this->convertTemperature($feltTemperature[1], "f", $units["temp"]); $weatherReturn["condition"] = $this->_weather->Forecast; - if (preg_match("/([\d\.]+)\D+/", $this->_weather->Visibility, $visibility)) { + if (preg_match("/([\d\.]+)\D+/", $this->_weather->Visibility, $visibility)) { $weatherReturn["visibility"] = $this->convertDistance($visibility[1], "sm", $units["vis"]); } else { $weatherReturn["visibility"] = trim($this->_weather->Visibility); - } + } preg_match("/([\d\.]+) inches and (\w+)/", $this->_weather->Pressure, $pressure); - $weatherReturn["pressure"] = $this->convertPressure($pressure[1], "in", $units["pres"]); + $weatherReturn["pressure"] = $this->convertPressure($pressure[1], "in", $units["pres"]); $weatherReturn["pressureTrend"] = $pressure[2]; - preg_match("/(-?\d+)\D+/", $this->_weather->DewPoint, $dewPoint); + preg_match("/(-?\d+)\D+/", $this->_weather->DewPoint, $dewPoint); $weatherReturn["dewPoint"] = $this->convertTemperature($dewPoint[1], "f", $units["temp"]); preg_match("/(\d+) (\w+)/", $this->_weather->UVIndex, $uvIndex); $weatherReturn["uvIndex"] = $uvIndex[1]; @@ -373,8 +373,8 @@ $forecastReturn["days"] = array(); for ($i = 1; $i <= $days; $i++) { - preg_match("/(-?\d+)\D+/", $this->_forecast->{"Day".$i}->High, $temperatureHigh); - preg_match("/(-?\d+)\D+/", $this->_forecast->{"Day".$i}->Low, $temperatureLow); + preg_match("/(-?\d+)\D+/", $this->_forecast->{"Day".$i}->High, $temperatureHigh); + preg_match("/(-?\d+)\D+/", $this->_forecast->{"Day".$i}->Low, $temperatureLow); $day = array( "tempertureHigh" => $this->convertTemperature($temperatureHigh[1], "f", $units["temp"]), "temperatureLow" => $this->convertTemperature($temperatureLow[1], "f", $units["temp"]), @@ -388,7 +388,7 @@ $forecastReturn["days"][] = $day; } - return $forecastReturn; + return $forecastReturn; } // }}} } http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Globalweather.php?r1=1.27&r2=1.28&ty=u Index: pear/Services_Weather/Weather/Globalweather.php diff -u pear/Services_Weather/Weather/Globalweather.php:1.27 pear/Services_Weather/Weather/Globalweather.php:1.28 --- pear/Services_Weather/Weather/Globalweather.php:1.27 Tue May 4 09:57:34 2004 +++ pear/Services_Weather/Weather/Globalweather.php Thu Oct 13 06:09:45 2005 @@ -16,7 +16,7 @@ // | Authors: Alexander Wirtz <alex@pc4p.net> | // +----------------------------------------------------------------------+ // -// $Id: Globalweather.php,v 1.27 2004/05/04 13:57:34 eru Exp $ +// $Id: Globalweather.php,v 1.28 2005/10/13 10:09:45 eru Exp $ /** * @package Services_Weather @@ -183,7 +183,7 @@ // {{{ searchLocationByCountry() /** * Returns IDs with location-name for a given country or all available - * countries, if no value was given + * countries, if no value was given * * @param string $country * @return PEAR_Error|array @@ -299,7 +299,7 @@ "overcast", ); } - + $status = $this->_checkLocationID($id); if (Services_Weather::isError($status)) { @@ -366,22 +366,22 @@ } $weatherReturn["condition"] = implode(", ", $condition); - if (is_array($this->_weather->sky->layers)) { - $layers = array(); - for ($i = 0; $i < sizeof($this->_weather->sky->layers); $i++) { - if (strtoupper($this->_weather->sky->layers[$i]->type) != "CLEAR") { - $layers[$i] = array(); - $layers[$i]["amount"] = $clouds[$this->_weather->sky->layers[$i]->extent]; - $layers[$i]["height"] = $this->convertDistance($this->_weather->sky->layers[$i]->altitude, "m", $units["height"]); - if (strtoupper($this->_weather->sky->layers[$i]->type) != "CLOUD") { - $layers[$i]["type"] = ucwords(str_replace("_", "", $this->_weather->sky->layers[$i]->type)); - } - } - } - if (sizeof($layers)) { + if (is_array($this->_weather->sky->layers)) { + $layers = array(); + for ($i = 0; $i < sizeof($this->_weather->sky->layers); $i++) { + if (strtoupper($this->_weather->sky->layers[$i]->type) != "CLEAR") { + $layers[$i] = array(); + $layers[$i]["amount"] = $clouds[$this->_weather->sky->layers[$i]->extent]; + $layers[$i]["height"] = $this->convertDistance($this->_weather->sky->layers[$i]->altitude, "m", $units["height"]); + if (strtoupper($this->_weather->sky->layers[$i]->type) != "CLOUD") { + $layers[$i]["type"] = ucwords(str_replace("_", "", $this->_weather->sky->layers[$i]->type)); + } + } + } + if (sizeof($layers)) { $weatherReturn["clouds"] = $layers; - } - } + } + } $weatherReturn["temperature"] = $this->convertTemperature($this->_weather->temperature->ambient, "c", $units["temp"]); $feltTemperature = $this->calculateWindChill($this->convertTemperature($weatherReturn["temperature"], $units["temp"], "f"), $this->convertSpeed($weatherReturn["wind"], $units["wind"], "mph")); http://cvs.php.net/diff.php/pear/Services_Weather/Weather.php?r1=1.34&r2=1.35&ty=u Index: pear/Services_Weather/Weather.php diff -u pear/Services_Weather/Weather.php:1.34 pear/Services_Weather/Weather.php:1.35 --- pear/Services_Weather/Weather.php:1.34 Thu Oct 13 04:04:55 2005 +++ pear/Services_Weather/Weather.php Thu Oct 13 06:09:47 2005 @@ -23,7 +23,7 @@ * @author Alexander Wirtz <alex@pc4p.net> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Weather.php,v 1.34 2005/10/13 08:04:55 eru Exp $ + * @version CVS: $Id: Weather.php,v 1.35 2005/10/13 10:09:47 eru Exp $ * @link http://pear.php.net/package/Services_Weather * @filesource */ @@ -149,7 +149,7 @@ * @return string * @access public */ - function apiVersion() + function apiVersion() { return "1.3"; }
http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Metar.php?r1=1.70&r2=1.71&ty=u Index: pear/Services_Weather/Weather/Metar.php diff -u pear/Services_Weather/Weather/Metar.php:1.70 pear/Services_Weather/Weather/Metar.php:1.71 --- pear/Services_Weather/Weather/Metar.php:1.70 Thu Oct 13 03:56:37 2005 +++ pear/Services_Weather/Weather/Metar.php Thu Oct 13 06:09:44 2005 @@ -16,7 +16,7 @@ // | Authors: Alexander Wirtz <alex@pc4p.net> | // +----------------------------------------------------------------------+ // -// $Id: Metar.php,v 1.70 2005/10/13 07:56:37 eru Exp $ +// $Id: Metar.php,v 1.71 2005/10/13 10:09:44 eru Exp $ /** * @package Services_Weather @@ -75,7 +75,7 @@ * @access private */ var $_db; - + /** * The source METAR uses * @@ -127,8 +127,8 @@ $error = $perror; return; } - - // Set options accordingly + + // Set options accordingly if (isset($options["dsn"])) { if (isset($options["dbOptions"])) { $status = $this->setMetarDB($options["dsn"], $options["dbOptions"]); @@ -140,10 +140,10 @@ $error = $status; return; } - + // Setting the data sources for METAR and TAF - have to watch out for older API usage if (($source = isset($options["source"])) || isset($options["sourceMetar"])) { - $sourceMetar = $source ? $options["source"] : $options["sourceMetar"]; + $sourceMetar = $source ? $options["source"] : $options["sourceMetar"]; if (($sourcePath = isset($options["sourcePath"])) || isset($options["sourcePathMetar"])) { $sourcePathMetar = $sourcePath ? $options["sourcePath"] : $options["sourcePathMetar"]; } else { @@ -188,7 +188,7 @@ if (is_array($dsninfo) && !isset($dsninfo["mode"])) { $dsninfo["mode"]= 0644; } - + // Initialize connection to DB and store in object if successful $db = DB::connect($dsninfo, $dbOptions); if (DB::isError($db)) { @@ -280,7 +280,7 @@ // {{{ _parseWeatherData() /** * Parses the data returned by the provided source and caches it - * + * * METAR KPIT 091955Z COR 22015G25KT 3/4SM R28L/2600FT TSRA OVC010CB * 18/16 A2992 RMK SLP045 T01820159 * @@ -353,7 +353,7 @@ "chino" => "2nd Ceiling Height Indicator offline" ); } - + $metarCode = array( "report" => "METAR|SPECI", "station" => "\w{4}", @@ -371,7 +371,7 @@ "trend" => "NOSIG|TEMPO|BECMG", "remark" => "RMK" ); - + $remarks = array( "nospeci" => "NOSPECI", "autostation" => "AO(1|2)", @@ -389,7 +389,7 @@ "3hpresstend" => "5([0-8])(\d{3})", "sensors" => "RVRNO|PWINO|PNO|FZRANO|TSNO|VISNO|CHINO", "maintain" => "[\$]" - ); + ); $data = @file($source); @@ -414,7 +414,7 @@ // Add a few local variables for data processing $trendCount = 0; // If we have trends, we need this - $pointer =& $weatherData; // Pointer to the array we add the data to + $pointer =& $weatherData; // Pointer to the array we add the data to for ($i = 0; $i < sizeof($metar); $i++) { // Check for whitespace and step loop, if nothing's there $metar[$i] = trim($metar[$i]); @@ -465,7 +465,7 @@ break; } else { // Match. Hand over result and advance METAR - if (SERVICES_WEATHER_DEBUG) { + if (SERVICES_WEATHER_DEBUG) { echo $key."\n"; echo "\"".$result[1]." ".$metar[$i + 1]."\"".str_repeat("\t", 2 - floor((strlen($result[1]." ".$metar[$i + 1]) + 2) / 8))."-> "; } @@ -590,7 +590,7 @@ $pointer["type"] = $result[0]; while (isset($metar[$i + 1]) && preg_match("/^(FM|TL|AT)(\d{2})(\d{2})$/i", $metar[$i + 1], $lresult)) { if ($lresult[1] == "FM") { - $pointer["from"] = $lresult[2].":".$lresult[3]; + $pointer["from"] = $lresult[2].":".$lresult[3]; } elseif ($lresult[1] == "TL") { $pointer["to"] = $lresult[2].":".$lresult[3]; } else { @@ -682,7 +682,7 @@ $result[2] *= -1; } $weatherData["remark"]["1htemp"] = $this->convertTemperature($result[2] / 10, "c", "f"); - + if (sizeof($result) > 3) { // same for dewpoint if ($result[4] == "1") { @@ -777,7 +777,7 @@ // {{{ _parseForecastData() /** * Parses the data returned by the provided source and caches it - * + * * TAF KLGA 271734Z 271818 11007KT P6SM -RA SCT020 BKN200 * FM2300 14007KT P6SM SCT030 BKN150 * FM0400 VRB03KT P6SM SCT035 OVC080 PROB30 0509 P6SM -RA BKN035 @@ -888,7 +888,7 @@ // Add a few local variables for data processing $fromTime = ""; // The timeperiod the data gets added to $fmcCount = 0; // If we have FMCs (Forecast Meteorological Conditions), we need this - $pointer =& $forecastData; // Pointer to the array we add the data to + $pointer =& $forecastData; // Pointer to the array we add the data to for ($i = 0; $i < sizeof($taf); $i++) { // Check for whitespace and step loop, if nothing's there $taf[$i] = trim($taf[$i]); @@ -962,7 +962,7 @@ break; } else { // Match. Hand over result and advance TAF - if (SERVICES_WEATHER_DEBUG) { + if (SERVICES_WEATHER_DEBUG) { echo $key."\n"; echo "\"".$result[1]." ".$taf[$i + 1]."\"".str_repeat("\t", 2 - floor((strlen($result[1]." ".$taf[$i + 1]) + 2) / 8))."-> "; } @@ -1085,7 +1085,7 @@ $pointer =& $forecastData["time"][$fromTime]; break; case "fmc"; - // Test, if this is a probability for the next FMC + // Test, if this is a probability for the next FMC if (preg_match("/^BECMG|TEMPO$/i", $taf[$i + 1], $lresult)) { // Set type to BECMG or TEMPO $type = $lresult[0]; @@ -1109,7 +1109,7 @@ $from = $lresult[1].":00"; $to = $lresult[2].":00"; $to = ($to == "24:00") ? "00:00" : $to; - // Same as above, we have a time for this FMC from our TAF, + // Same as above, we have a time for this FMC from our TAF, // increase field-counter $i += 1; } else { @@ -1173,7 +1173,7 @@ // {{{ _convertReturn() /** * Converts the data in the return array to the desired units and/or - * output format. + * output format. * * @param array $target * @param string $units @@ -1267,7 +1267,7 @@ if (!isset($this->_db) || !DB::isConnection($this->_db)) { return Services_Weather::raiseError(SERVICES_WEATHER_ERROR_DB_NOT_CONNECTED, __FILE__, __LINE__); } - + if (is_string($location)) { // Try to part search string in name, state and country part // and build where clause from it for the select @@ -1281,7 +1281,7 @@ $where .= " AND LOWER(state) LIKE '%".strtolower(trim($location[1]))."%'"; $where .= " AND LOWER(country) LIKE '%".strtolower(trim($location[2]))."%'"; } - + // Create select, locations with ICAO first $select = "SELECT icao, name, state, country, latitude, longitude ". "FROM metarLocations ". @@ -1294,7 +1294,7 @@ } elseif (strtolower(get_class($result)) != "db_result" || $result->numRows() == 0) { return Services_Weather::raiseError(SERVICES_WEATHER_ERROR_UNKNOWN_LOCATION, __FILE__, __LINE__); } - + // Result is valid, start preparing the return $icao = array(); while (($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) != null) { @@ -1334,7 +1334,7 @@ // {{{ searchLocationByCountry() /** * Returns IDs with location-name for a given country or all available - * countries, if no value was given + * countries, if no value was given * * @param string $country * @return PEAR_Error|array @@ -1412,8 +1412,8 @@ } if (!is_numeric($latitude) || !is_numeric($longitude)) { return Services_Weather::raiseError(SERVICES_WEATHER_ERROR_INVALID_LOCATION, __FILE__, __LINE__); - } - + } + // Get all airports $select = "SELECT icao, x, y, z FROM metarAirports"; $result = $this->_db->query($select); @@ -1602,7 +1602,7 @@ return $weatherReturn; } // }}} - + // {{{ getForecast() /** * METAR provides no forecast per se, we use the TAF reports to generate http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Common.php?r1=1.39&r2=1.40&ty=u Index: pear/Services_Weather/Weather/Common.php diff -u pear/Services_Weather/Weather/Common.php:1.39 pear/Services_Weather/Weather/Common.php:1.40 --- pear/Services_Weather/Weather/Common.php:1.39 Fri Oct 1 09:01:34 2004 +++ pear/Services_Weather/Weather/Common.php Thu Oct 13 06:09:44 2005 @@ -16,7 +16,7 @@ // | Authors: Alexander Wirtz <alex@pc4p.net> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.39 2004/10/01 13:01:34 eru Exp $ +// $Id: Common.php,v 1.40 2005/10/13 10:09:44 eru Exp $ /** * @package Services_Weather @@ -39,7 +39,7 @@ * * Parent class for weather-services. Defines common functions for unit * conversions, checks for cache enabling and does other miscellaneous -* things. +* things. * * @author Alexander Wirtz <alex@pc4p.net> * @package Services_Weather @@ -72,13 +72,13 @@ "rain" => "in" ); - /** - * Timeout for HTTP requests - * - * @var int $_httpTimeout - * @access private - */ - var $_httpTimeout = 60; + /** + * Timeout for HTTP requests + * + * @var int $_httpTimeout + * @access private + */ + var $_httpTimeout = 60; /** * Format of the used dates @@ -149,7 +149,7 @@ */ function Services_Weather_Common($options, &$error) { - // Set options accordingly + // Set options accordingly if (isset($options["cacheType"])) { if (isset($options["cacheOptions"])) { $status = $this->setCache($options["cacheType"], $options["cacheOptions"]); @@ -170,10 +170,10 @@ } } - if (isset($options["httpTimeout"])) { - $this->setHttpTimeout($options["httpTimeout"]); - } - + if (isset($options["httpTimeout"])) { + $this->setHttpTimeout($options["httpTimeout"]); + } + if (isset($options["dateFormat"])) { $this->setDateTimeFormat($options["dateFormat"], ""); } @@ -235,7 +235,7 @@ "rain" => array("in", "mm") ); } - + if (strlen($unitsFormat) && in_array(strtolower($unitsFormat{0}), array("c", "m", "s"))) { $this->_unitsFormat = strtolower($unitsFormat{0}); if ($this->_unitsFormat == "c" && is_array($customUnitsFormat)) { @@ -251,20 +251,20 @@ } // }}} - // {{{ setHttpTimeout() + // {{{ setHttpTimeout() /** * Sets the timeout in seconds for HTTP requests * - * @param int $httpTimeout + * @param int $httpTimeout * @access public */ - function setHttpTimeout($httpTimeout) - { - if (is_int($httpTimeout)) { - $this->_httpTimeout = $httpTimeout; - } - } - // }}} + function setHttpTimeout($httpTimeout) + { + if (is_int($httpTimeout)) { + $this->_httpTimeout = $httpTimeout; + } + } + // }}} // {{{ getUnitsFormat() /** @@ -394,16 +394,16 @@ // Beaufort scale, measurements are in knots $beaufort = array( - 1, 3, 6, 10, + 1, 3, 6, 10, 16, 21, 27, 33, - 40, 47, 55, 63 + 40, 47, 55, 63 ); } - + if ($from == "bft") { return false; } elseif ($to == "bft") { - $speed = round($speed * $factor[$from]["kt"], 0); + $speed = round($speed * $factor[$from]["kt"], 0); for ($i = 0; $i < sizeof($beaufort); $i++) { if ($speed <= $beaufort[$i]) { return $i; @@ -503,7 +503,7 @@ * @param float $speed * @return float * @access public - * @link http://www.nws.noaa.gov/om/windchill/ + * @link http://www.nws.noaa.gov/om/windchill/ */ function calculateWindChill($temperature, $speed) { @@ -526,7 +526,7 @@ * @link http://www.faqs.org/faqs/meteorology/temp-dewpoint/ */ function calculateHumidity($temperature, $dewPoint) - { + { // First calculate saturation steam pressure for both temperatures if ($temperature >= 0) { $a = 7.5; @@ -545,7 +545,7 @@ $b = 240.7; } $dewSSP = 6.1078 * pow(10, ($a * $dewPoint) / ($b + $dewPoint)); - + return round(100 * $dewSSP / $tempSSP, 1); } // }}} @@ -565,7 +565,7 @@ * @link http://www.faqs.org/faqs/meteorology/temp-dewpoint/ */ function calculateDewPoint($temperature, $humidity) - { + { if ($temperature >= 0) { $a = 7.5; $b = 237.3; http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Weatherdotcom.php?r1=1.45&r2=1.46&ty=u Index: pear/Services_Weather/Weather/Weatherdotcom.php diff -u pear/Services_Weather/Weather/Weatherdotcom.php:1.45 pear/Services_Weather/Weather/Weatherdotcom.php:1.46 --- pear/Services_Weather/Weather/Weatherdotcom.php:1.45 Wed Oct 12 12:11:51 2005 +++ pear/Services_Weather/Weather/Weatherdotcom.php Thu Oct 13 06:09:44 2005 @@ -16,7 +16,7 @@ // | Authors: Alexander Wirtz <alex@pc4p.net> | // +----------------------------------------------------------------------+ // -// $Id: Weatherdotcom.php,v 1.45 2005/10/12 16:11:51 eru Exp $ +// $Id: Weatherdotcom.php,v 1.46 2005/10/13 10:09:44 eru Exp $ /** * @package Services_Weather @@ -121,7 +121,7 @@ if (isset($options["licenseKey"])) { $this->setAccountData("", $options["licenseKey"]); } - + include_once "XML/Unserializer.php"; $unserializer = &new XML_Unserializer(array("complexType" => "object", "keyAttribute" => "type")); if (Services_Weather::isError($unserializer)) { @@ -130,9 +130,9 @@ } else { $this->_unserializer = $unserializer; } - - // Can't acquire an object here, has to be clean on every request - include_once "HTTP/Request.php"; + + // Can't acquire an object here, has to be clean on every request + include_once "HTTP/Request.php"; } // }}} @@ -192,13 +192,13 @@ */ function _parseWeatherData($id, $url) { - // Get data from URL... - $request = &new HTTP_Request($url, array("timeout" => $this->_httpTimeout)); - $status = $request->sendRequest(); + // Get data from URL... + $request = &new HTTP_Request($url, array("timeout" => $this->_httpTimeout)); + $status = $request->sendRequest(); if (Services_Weather::isError($status)) { return Services_Weather::raiseError(SERVICES_WEATHER_ERROR_WRONG_SERVER_DATA, __FILE__, __LINE__); } - $data = $request->getResponseBody(); + $data = $request->getResponseBody(); // ...and unserialize $status = $this->_unserializer->unserialize($data); @@ -300,8 +300,8 @@ // {{{ searchLocationByCountry() /** - * Returns only false, as weather.com offers no country listing via - * its XML services + * Returns only false, as weather.com offers no country listing via + * its XML services * * @param string $country * @return bool @@ -355,7 +355,7 @@ // B0rked response (returned is &par=xoap, should be &prod=xoap), fix it $linksReturn["promo"][$i]["link"] = str_replace("par=", "prod=", $this->_links->link[$i]->l); $linksReturn["promo"][$i]["link"] .= "&par=".$this->_partnerID; - } + } return $linksReturn; } @@ -444,7 +444,7 @@ } $weatherReturn["cache"] = "MISS"; } - + // Some explanation for the next two lines: // weather.com isn't always supplying the timezone in the update string, but // uses "Local Time" as reference, which is imho utterly stupid, because it's @@ -464,7 +464,7 @@ $weatherReturn["pressure"] = $this->convertPressure($this->_weather->bar->r, "in", $units["pres"]); $weatherReturn["pressureTrend"] = $this->_weather->bar->d; $weatherReturn["wind"] = $this->convertSpeed($this->_weather->wind->s, "mph", $units["wind"]); - $weatherReturn["windGust"] = $this->convertSpeed($this->_weather->wind->gust, "mph", $units["wind"]); + $weatherReturn["windGust"] = $this->convertSpeed($this->_weather->wind->gust, "mph", $units["wind"]); $weatherReturn["windDegrees"] = $this->_weather->wind->d; $weatherReturn["windDirection"] = $this->_weather->wind->t; $weatherReturn["humidity"] = $this->_weather->hmid; @@ -502,7 +502,7 @@ if (!in_array($days, range(1, 10))) { $days = 2; } - + // Get other data $units = $this->getUnitsFormat($unitsFormat); http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Ejse.php?r1=1.16&r2=1.17&ty=u Index: pear/Services_Weather/Weather/Ejse.php diff -u pear/Services_Weather/Weather/Ejse.php:1.16 pear/Services_Weather/Weather/Ejse.php:1.17 --- pear/Services_Weather/Weather/Ejse.php:1.16 Thu Jul 21 03:49:37 2005 +++ pear/Services_Weather/Weather/Ejse.php Thu Oct 13 06:09:45 2005 @@ -16,7 +16,7 @@ // | Authors: Alexander Wirtz <alex@pc4p.net> | // +----------------------------------------------------------------------+ // -// $Id: Ejse.php,v 1.16 2005/07/21 07:49:37 eru Exp $ +// $Id: Ejse.php,v 1.17 2005/10/13 10:09:45 eru Exp $ /** * @package Services_Weather @@ -130,7 +130,7 @@ // {{{ searchLocation() /** * EJSE offers no search function to date, so this function is disabled. - * Maybe this is the place to interface to some online postcode service... + * Maybe this is the place to interface to some online postcode service... * * @param string $location * @param bool $useFirst @@ -147,7 +147,7 @@ // {{{ searchLocationByCountry() /** * EJSE offers no search function to date, so this function is disabled. - * Maybe this is the place to interface to some online postcode service... + * Maybe this is the place to interface to some online postcode service... * * @param string $country * @return bool @@ -283,23 +283,23 @@ } else { $weatherReturn["update"] = ""; } - $weatherReturn["updateRaw"] = $this->_weather->LastUpdated; + $weatherReturn["updateRaw"] = $this->_weather->LastUpdated; $weatherReturn["station"] = $this->_weather->ReportedAt; $weatherReturn["conditionIcon"] = $this->_weather->IconIndex; - preg_match("/(-?\d+)\D+/", $this->_weather->Temprature, $temperature); + preg_match("/(-?\d+)\D+/", $this->_weather->Temprature, $temperature); $weatherReturn["temperature"] = $this->convertTemperature($temperature[1], "f", $units["temp"]); - preg_match("/(-?\d+)\D+/", $this->_weather->FeelsLike, $feltTemperature); + preg_match("/(-?\d+)\D+/", $this->_weather->FeelsLike, $feltTemperature); $weatherReturn["feltTemperature"] = $this->convertTemperature($feltTemperature[1], "f", $units["temp"]); $weatherReturn["condition"] = $this->_weather->Forecast; - if (preg_match("/([\d\.]+)\D+/", $this->_weather->Visibility, $visibility)) { + if (preg_match("/([\d\.]+)\D+/", $this->_weather->Visibility, $visibility)) { $weatherReturn["visibility"] = $this->convertDistance($visibility[1], "sm", $units["vis"]); } else { $weatherReturn["visibility"] = trim($this->_weather->Visibility); - } + } preg_match("/([\d\.]+) inches and (\w+)/", $this->_weather->Pressure, $pressure); - $weatherReturn["pressure"] = $this->convertPressure($pressure[1], "in", $units["pres"]); + $weatherReturn["pressure"] = $this->convertPressure($pressure[1], "in", $units["pres"]); $weatherReturn["pressureTrend"] = $pressure[2]; - preg_match("/(-?\d+)\D+/", $this->_weather->DewPoint, $dewPoint); + preg_match("/(-?\d+)\D+/", $this->_weather->DewPoint, $dewPoint); $weatherReturn["dewPoint"] = $this->convertTemperature($dewPoint[1], "f", $units["temp"]); preg_match("/(\d+) (\w+)/", $this->_weather->UVIndex, $uvIndex); $weatherReturn["uvIndex"] = $uvIndex[1]; @@ -373,8 +373,8 @@ $forecastReturn["days"] = array(); for ($i = 1; $i <= $days; $i++) { - preg_match("/(-?\d+)\D+/", $this->_forecast->{"Day".$i}->High, $temperatureHigh); - preg_match("/(-?\d+)\D+/", $this->_forecast->{"Day".$i}->Low, $temperatureLow); + preg_match("/(-?\d+)\D+/", $this->_forecast->{"Day".$i}->High, $temperatureHigh); + preg_match("/(-?\d+)\D+/", $this->_forecast->{"Day".$i}->Low, $temperatureLow); $day = array( "tempertureHigh" => $this->convertTemperature($temperatureHigh[1], "f", $units["temp"]), "temperatureLow" => $this->convertTemperature($temperatureLow[1], "f", $units["temp"]), @@ -388,7 +388,7 @@ $forecastReturn["days"][] = $day; } - return $forecastReturn; + return $forecastReturn; } // }}} } http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Globalweather.php?r1=1.27&r2=1.28&ty=u Index: pear/Services_Weather/Weather/Globalweather.php diff -u pear/Services_Weather/Weather/Globalweather.php:1.27 pear/Services_Weather/Weather/Globalweather.php:1.28 --- pear/Services_Weather/Weather/Globalweather.php:1.27 Tue May 4 09:57:34 2004 +++ pear/Services_Weather/Weather/Globalweather.php Thu Oct 13 06:09:45 2005 @@ -16,7 +16,7 @@ // | Authors: Alexander Wirtz <alex@pc4p.net> | // +----------------------------------------------------------------------+ // -// $Id: Globalweather.php,v 1.27 2004/05/04 13:57:34 eru Exp $ +// $Id: Globalweather.php,v 1.28 2005/10/13 10:09:45 eru Exp $ /** * @package Services_Weather @@ -183,7 +183,7 @@ // {{{ searchLocationByCountry() /** * Returns IDs with location-name for a given country or all available - * countries, if no value was given + * countries, if no value was given * * @param string $country * @return PEAR_Error|array @@ -299,7 +299,7 @@ "overcast", ); } - + $status = $this->_checkLocationID($id); if (Services_Weather::isError($status)) { @@ -366,22 +366,22 @@ } $weatherReturn["condition"] = implode(", ", $condition); - if (is_array($this->_weather->sky->layers)) { - $layers = array(); - for ($i = 0; $i < sizeof($this->_weather->sky->layers); $i++) { - if (strtoupper($this->_weather->sky->layers[$i]->type) != "CLEAR") { - $layers[$i] = array(); - $layers[$i]["amount"] = $clouds[$this->_weather->sky->layers[$i]->extent]; - $layers[$i]["height"] = $this->convertDistance($this->_weather->sky->layers[$i]->altitude, "m", $units["height"]); - if (strtoupper($this->_weather->sky->layers[$i]->type) != "CLOUD") { - $layers[$i]["type"] = ucwords(str_replace("_", "", $this->_weather->sky->layers[$i]->type)); - } - } - } - if (sizeof($layers)) { + if (is_array($this->_weather->sky->layers)) { + $layers = array(); + for ($i = 0; $i < sizeof($this->_weather->sky->layers); $i++) { + if (strtoupper($this->_weather->sky->layers[$i]->type) != "CLEAR") { + $layers[$i] = array(); + $layers[$i]["amount"] = $clouds[$this->_weather->sky->layers[$i]->extent]; + $layers[$i]["height"] = $this->convertDistance($this->_weather->sky->layers[$i]->altitude, "m", $units["height"]); + if (strtoupper($this->_weather->sky->layers[$i]->type) != "CLOUD") { + $layers[$i]["type"] = ucwords(str_replace("_", "", $this->_weather->sky->layers[$i]->type)); + } + } + } + if (sizeof($layers)) { $weatherReturn["clouds"] = $layers; - } - } + } + } $weatherReturn["temperature"] = $this->convertTemperature($this->_weather->temperature->ambient, "c", $units["temp"]); $feltTemperature = $this->calculateWindChill($this->convertTemperature($weatherReturn["temperature"], $units["temp"], "f"), $this->convertSpeed($weatherReturn["wind"], $units["wind"], "mph")); http://cvs.php.net/diff.php/pear/Services_Weather/Weather.php?r1=1.34&r2=1.35&ty=u Index: pear/Services_Weather/Weather.php diff -u pear/Services_Weather/Weather.php:1.34 pear/Services_Weather/Weather.php:1.35 --- pear/Services_Weather/Weather.php:1.34 Thu Oct 13 04:04:55 2005 +++ pear/Services_Weather/Weather.php Thu Oct 13 06:09:47 2005 @@ -23,7 +23,7 @@ * @author Alexander Wirtz <alex@pc4p.net> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Weather.php,v 1.34 2005/10/13 08:04:55 eru Exp $ + * @version CVS: $Id: Weather.php,v 1.35 2005/10/13 10:09:47 eru Exp $ * @link http://pear.php.net/package/Services_Weather * @filesource */ @@ -149,7 +149,7 @@ * @return string * @access public */ - function apiVersion() + function apiVersion() { return "1.3"; }