From 993fc0ad9595dd1d5d46358c07b94578558d00c1 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sat, 13 Feb 2016 00:40:27 +0000
Subject: [PATCH] [mod_lotto] Usunięcie gry Joker i dodanie Ekstra Pensji
---
modules/30_pogoda/api_yrno.php | 44 ++++++++++++++++++++++----------------------
1 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/modules/30_pogoda/api_yrno.php b/modules/30_pogoda/api_yrno.php
index 70e3b5a..5060059 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(
+ public 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(
+ public static $wind = array(
'N' => 'północny',
'NW' => 'północno-zachodni',
'W' => 'zachodni',
@@ -40,7 +40,17 @@
'NE' => 'północno-wschodni',
);
- function __construct($xml) {
+ public static function wind($dir) {
+ if(isset(self::$wind[$dir])) {
+ return self::$wind[$dir];
+ }
+ else
+ {
+ return '';
+ }
+ }
+
+ public function __construct($xml) {
libxml_use_internal_errors();
$this->xml = simplexml_load_string($xml);
libxml_clear_errors();
@@ -50,21 +60,11 @@
}
}
- function mktime($time) {
+ public 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() {
+ public function parseForecast() {
$this->dane = array(
'0h' => array(),
'3h' => array(),
@@ -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(
@@ -109,7 +109,7 @@
}
}
- function getCurrentIcon() {
+ public function getCurrentIcon() {
$now = time();
foreach($this->dane['3h'] as $value) {
if($value['from'] <= $now && $now < $value['to']) {
@@ -120,7 +120,7 @@
return NULL;
}
- function getCurrentWeather() {
+ public function getCurrentWeather() {
$dist = PHP_INT_MAX;
$current = NULL;
foreach($this->dane['0h'] as $time => $value) {
@@ -137,7 +137,7 @@
return $current;
}
- function getDaypartWeather($timestamp) {
+ public function getDaypartWeather($timestamp) {
$start = strtotime('6:00', $timestamp);
$dayend = strtotime('19:30', $timestamp);
$end = $start + 22*3600;
@@ -184,7 +184,7 @@
return array('temp' => $temp, 'wind' => $wind);
}
- function getDaypartIcon($timestamp) {
+ public function getDaypartIcon($timestamp) {
$start = strtotime('6:00', $timestamp);
$end = strtotime('24:00', $timestamp);
@@ -203,7 +203,7 @@
}
function yrno_weather($lat, $lon) {
- $down = new DownloadHelper('http://api.yr.no/weatherapi/locationforecastlts/1.1/?lat='.urlencode($lat).';lon='.urlencode($lon));
+ $down = new DownloadHelper('http://api.yr.no/weatherapi/locationforecastlts/1.2/?lat='.urlencode($lat).';lon='.urlencode($lon));
$down->setopt(CURLOPT_USERAGENT, 'BotGG/'.main::VERSION_NUM.' WeatherModule/1.0 (http://bot.jacekk.net/weather.html)');
try {
$data = $down->exec();
--
Gitblit v1.9.1