From 4c7016fb3e2dd55de4389872ba5c6c65bbf5a582 Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Tue, 27 Nov 2012 15:32:04 +0000 Subject: [PATCH] Poprawka parsowania strony z programem telewizyjnym. --- modules/30_pogoda/api_yrno.php | 30 +++++++++++++++--------------- 1 files changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/30_pogoda/api_yrno.php b/modules/30_pogoda/api_yrno.php index 56b95b2..d10944e 100644 --- a/modules/30_pogoda/api_yrno.php +++ b/modules/30_pogoda/api_yrno.php @@ -3,7 +3,7 @@ protected $xml; protected $dane; - var $symbols = array( + static $symbols = array( 1 => 'Słonecznie', 2 => 'Lekkie zachmurzenie', 3 => 'Częściowe zachmurzenie', @@ -29,7 +29,7 @@ 23 => 'Deszcz ze śniegiem, burze' ); - var $wind = array( + static $wind = array( 'N' => 'północny', 'NW' => 'północno-zachodni', 'W' => 'zachodni', @@ -39,6 +39,16 @@ 'E' => 'wschodni', 'NE' => 'północno-wschodni', ); + + static function wind($dir) { + if(isset(self::$wind[$dir])) { + return self::$wind[$dir]; + } + else + { + return ''; + } + } function __construct($xml) { libxml_use_internal_errors(); @@ -52,16 +62,6 @@ function mktime($time) { return strtotime(substr($time, 0, -1)); - } - - function wind($dir) { - if(isset($this->wind[$dir])) { - return $this->wind[$dir]; - } - else - { - return ''; - } } function parseForecast() { @@ -96,8 +96,8 @@ } $icon = (int)$time->symbol->attributes()->number; - if(is_int($this->symbols[$icon])) { - $icon = $this->symbols[$icon]; + if(is_int(self::$symbols[$icon])) { + $icon = self::$symbols[$icon]; } $this->dane[$put][$to] = array( @@ -181,7 +181,7 @@ unset($wind['day']); } - return array($temp, $wind); + return array('temp' => $temp, 'wind' => $wind); } function getDaypartIcon($timestamp) { -- Gitblit v1.9.1