commit 6d3ec3e7f722be41be2582a5eedba16a40c0b7c7 Author: Сергей Варламов Date: Fri Jun 10 22:49:51 2016 +0300 Добавлен модуль Погода diff --git a/README.md b/README.md new file mode 100644 index 0000000..7e295aa --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +## weather + +# Модуль Погода + + +## Модуль Погода использует Openweathermap.org илиYahoo Weather API для получения данных о погоде на текущий день и прогноза на ближайшие дни для любой точки мира. Используя самый надежный источник информации о погоде Вы можете обогатить веб-сайт собственным каналом погоды, который можете оформить по своему усмотрению." + + * Перевод отображения погодных явлений корректируется по собственному "вкусу" в файле ru.php + + +## Перед копированием модуля в папку modules, удалите файл README.md, копируйте только корневую папку sitemap со всем ее содержимым внутри! + +## Changelog: + +07.05.2016 - версии 1.01 \ No newline at end of file diff --git a/class.weather.php b/class.weather.php new file mode 100644 index 0000000..4c77fcd --- /dev/null +++ b/class.weather.php @@ -0,0 +1,527 @@ + 1, + 'location' => 'Varna', //city, region + 'country' => 'Bulgaria', //country + 'WOEID' => '', + 'lat' => '', + 'lon' => '', + 'displayCityNameOnly' => false, + 'api' => 'openweathermap', //yahoo, openweathermap + 'apikey' => "", //api key for openweathermar, cliend ID for yahoo + 'secret_key' => "", //secret key for yahoo YQL + 'forecast' => '5', //number of days to forecast, max 5 + 'view' => "full", //options: simple, today, partial, forecast, full + 'render' => true, //render: false if you to make your own markup, true plugin generates markup + 'lang' => 'bg', + 'cacheTime' => 5, + 'units' => 'metric', // "imperial" default: "auto" + 'useCSS' => 1 + ); + + var $content = array(); + + var $_use_filelock = true; + + var $apiurls = array( + "openweathermap" => array( "http://api.openweathermap.org/data/2.5/weather", "http://api.openweathermap.org/data/2.5/forecast/daily" ), + "yahoo" => array( "http://query.yahooapis.com/v1/public/yql" ) + ); + + + /** + * Read cache file + * + * @return boolean + */ + function _weatherCacheRead( $cache_filename ) + { + if (!empty($cache_filename) + && is_file($cache_filename) + && filesize($cache_filename) > 0 + && ((filemtime($cache_filename) + $this->config['cacheTime'] * 60) > time())) + { + $fp = @fopen($cache_filename, "rb"); + if ($this->_use_filelock) @flock($fp, LOCK_SH); + if ($fp) + { + $cache_file_data = @fread($fp, filesize($cache_filename)); + if ($this->_use_filelock) @flock($fp, LOCK_UN); + @fclose($fp); + + return $cache_file_data; + } + } + + return ""; + } + + /** + * Write cache file + * + * @return boolean + */ + function _weatherCacheWrite( $cache_filename, $file_data ) + { + if (! empty($cache_filename)) + { + $fp = @fopen($cache_filename, "wb"); + if ($fp) + { + if ($this->_use_filelock) @flock($fp, LOCK_EX); + @fwrite($fp, $file_data); + if ($this->_use_filelock) @flock($fp, LOCK_UN); + @fclose($fp); + + return true; + } + } + return false; + } + + + //Takes wind speed, direction in degrees and units + //and returns a string ex. (8.5, 270, "metric") returns "W 8.5 km/h" + function formatWind($speed, $degrees, $units) + { + $wd = $degrees; + if (($wd >= 0 && $wd <= 11.25) || ($wd > 348.75 && $wd <= 360)) { $wd = "N"; } + else if ($wd > 11.25 && $wd <= 33.75){ $wd = "NNE"; } + else if ($wd > 33.75 && $wd <= 56.25){ $wd = "NE"; } + else if ($wd > 56.25 && $wd <= 78.75){ $wd = "ENE"; } + else if ($wd > 78.75 && $wd <= 101.25){ $wd = "E"; } + else if ($wd > 101.25 && $wd <= 123.75){ $wd = "ESE";} + else if ($wd > 123.75 && $wd <= 146.25){ $wd = "SE"; } + else if ($wd > 146.25 && $wd <= 168.75){ $wd = "SSE"; } + else if ($wd > 168.75 && $wd <= 191.25){ $wd = "S"; } + else if ($wd > 191.25 && $wd <= 213.75){ $wd = "SSW"; } + else if ($wd > 213.75 && $wd <= 236.25){ $wd = "SW"; } + else if ($wd > 236.25 && $wd <= 258.75){ $wd = "WSW"; } + else if ($wd > 258.75 && $wd <= 281.25){ $wd = "W"; } + else if ($wd > 281.25 && $wd <= 303.75){ $wd = "WNW"; } + else if ($wd > 303.75 && $wd <= 326.25){ $wd = "NW"; } + else if ($wd > 326.25 && $wd <= 348.75){ $wd = "NNW"; } + + $speedUnits = ($units == "metric")?"km/h":"mph"; + return $wd + " " + $speed + " " + $speedUnits; + } + + + /** + * Init class + * + */ + function weatherInit() + { + global $AVE_DB; + + //Load settings + $row = $AVE_DB->Query(" + SELECT * + FROM " . PREFIX . "_module_weather + WHERE Id = '1' + LIMIT 1 + ")->FetchRow(); + + $this->config['location' ] = $row->location; + $this->config['country' ] = $row->country; + $this->config['WOEID' ] = $row->WOEID; + $this->config['lat' ] = $row->lat; + $this->config['lon' ] = $row->lon; + $this->config['displayCityNameOnly' ] = $row->displayCityNameOnly; + $this->config['api' ] = $row->api; + $this->config['apikey' ] = $row->apikey; + $this->config['secret_key' ] = $row->secret_key; + $this->config['forecast' ] = $row->forecast; + $this->config['view' ] = $row->view; + $this->config['render' ] = $row->render; + $this->config['lang' ] = $row->lang; + $this->config['cacheTime' ] = $row->cacheTime; + $this->config['units' ] = $row->units; + $this->config['useCSS' ] = $row->useCSS; + + } // init() + + function ShowWeather($tpl_dir, $lang_file) { + global $AVE_DB, $AVE_Template; + + $AVE_Template->config_load($lang_file); + //Load settings + $this->weatherInit(); + $this->weatherDataGet(); + + if ($this->error === '') + { + + $weather = $this->datamapper($this->content); + $degrees = $this->config['units'] == "metric"?"°C":"°F"; + $format_wind = $this->formatWind( $weather['today']['wind']['speed'], $weather['today']['wind']['deg'], $this->config['units']); + + $AVE_Template->assign('config', $this->config); + $AVE_Template->assign('weather', $weather ); + $AVE_Template->assign('degrees', $degrees); + $AVE_Template->assign('format_wind', $format_wind); + + $AVE_Template->display($tpl_dir . 'weather.tpl'); + } else { + // открити грешки + //reportlog('открити грешки'); + } + + } + + + /** + * Get weather data JSON + * + */ + + function weatherDataGet( ) + { + + if ($this->config['cacheTime'] > 0) + { + // using cache + + if ($this->config['api'] == 'openweathermap' ) + { + $cache_weather = $this->_weatherCacheRead(BASE_DIR . '/cache/module_weather_' . md5($this->config['city'] . $this->config['language']) . '.json'); + $cache_forecast = $this->_weatherCacheRead(BASE_DIR . '/cache/module_forecast_' . md5($this->config['city'] . $this->config['language']) . '.json'); + if ( ($cache_weather !="") and ($cache_forecast !="") ) { + $this->content = array(); + $this->content[] = json_decode( $cache_weather, true ); + $this->content[] = json_decode( $cache_forecast, true ); + return; + } + } else if ($this->config['api'] == 'yahoo') { + $cache_weather = $this->_weatherCacheRead(BASE_DIR . '/cache/module_weather_yahoo' . md5($this->config['city'] . $this->config['language']) . '.json'); + if ($cache_weather !="") { + $this->content = array(); + $this->content[] = json_decode( $cache_weather, true ); + return; + } + } + } + + if(function_exists('curl_init')) + { + + if ($this->config['api'] == 'openweathermap' ) + { + $this->content = array(); + $curl = curl_init(); // initializing connection + curl_setopt($curl, CURLOPT_HEADER, 0); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // saves us before putting directly results of request + // check the source of request + curl_setopt($curl, CURLOPT_URL, $this->apiurls["openweathermap"][0]."?id=".$this->config['WOEID']."&units=".$this->config['units']."&lang=".$this->config['lang']."&APPID=".$this->config['apikey']); // url to get + curl_setopt($curl, CURLOPT_TIMEOUT, 20); // timeout in seconds + curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // useragent + + $temp_data = curl_exec($curl); + if ($this->config['cacheTime'] > 0) $this->_weatherCacheWrite( BASE_DIR . '/cache/module_weather_' . md5($this->config['city'] . $this->config['language']) . '.json',$temp_data); + + $this->content[] = json_decode( $temp_data, true ); // reading content + curl_close($curl); // closing connection + + $curl = curl_init(); // initializing connection + curl_setopt($curl, CURLOPT_HEADER, 0); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // saves us before putting directly results of request + curl_setopt($curl, CURLOPT_URL, $this->apiurls["openweathermap"][1]."?id=".$this->config['WOEID']."&units=".$this->config['units']."&lang=".$this->config['lang']."&APPID=".$this->config['apikey']); // url to get + curl_setopt($curl, CURLOPT_TIMEOUT, 20); // timeout in seconds + curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // useragent + + $temp_data = curl_exec($curl); + if ($this->config['cacheTime'] > 0) $this->_weatherCacheWrite( BASE_DIR . '/cache/module_forecast_' . md5($this->config['city'] . $this->config['language']) . '.json',$temp_data); + + $this->content[] = json_decode( $temp_data, true ); // reading content + curl_close($curl); // closing connection + + } else if ($this->config['api'] == 'yahoo') { + // Yahoo YQL + $this->content = array(); + $curl = curl_init(); // initializing connection + curl_setopt($curl, CURLOPT_HEADER, 0); + + curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); // saves us before putting directly results of request + + $yunit = ($this->config['units'] == "metric")?"c":"f"; + $yql_query = 'select * from weather.forecast where woeid="'.$this->config['WOEID'].'" AND u="'. $yunit .'"'; + + curl_setopt( $curl, CURLOPT_URL, $this->apiurls["yahoo"][0]."?q=" . urlencode($yql_query).'&format=json&env="store://datatables.org/alltableswithkeys"' ) ; // url to get + + curl_setopt($curl, CURLOPT_TIMEOUT, 20); // timeout in seconds + curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // useragent + + + $temp_data = curl_exec($curl); + + // if(($temp_data = curl_exec($curl)) === false){reportlog('Curl error: ' . curl_error($curl));} + if ($this->config['cacheTime'] > 0) $this->_weatherCacheWrite( BASE_DIR . '/cache/module_weather_yahoo' . md5($this->config['city'] . $this->config['language']) . '.json',$temp_data); + + $this->content[] = json_decode( $temp_data, true ); // reading content + curl_close($curl); // closing connection + + } + + } + // check file_get_contents function enable and allow external url's' + else if( file_get_contents(__FILE__) && ini_get('allow_url_fopen') && !function_exists('curl_init')) + { + if ($this->config['api'] == 'openweathermap' ) + { + $this->content = array(); + $temp_data = json_decode( file_get_contents( $apiurls["openweathermap"][0]."?id=".$this->config['WOEID']."&units=".$this->config['units']."&lang=".$this->config['lang']."&APPID=".$this->config['apikey']), true ); + if ($this->config['cacheTime'] > 0) $this->_weatherCacheWrite( BASE_DIR . '/cache/module_forecast_' . md5($this->config['city'] . $this->config['language']) . '.json',$temp_data); + $this->content[] = $temp_data; + + $temp_data = json_decode( file_get_contents( $apiurls["openweathermap"][1]."?id=".$this->config['WOEID']."&units=".$this->config['units']."&lang=".$this->config['lang']."&APPID=".$this->config['apikey']), true ); + if ($this->config['cacheTime'] > 0) $this->_weatherCacheWrite( BASE_DIR . '/cache/module_forecast_' . md5($this->config['city'] . $this->config['language']) . '.json',$temp_data); + $this->content[] = $temp_data; + + } else if ($this->config['api'] == 'yahoo') { + // Yahoo YQL + $this->content = array(); + $yunit = ($this->config['units'] == "metric")?"c":"f"; + $yql_query = 'select * from weather.forecast where woeid="'.$this->config['WOEID'].'" AND u="'. $yunit .'"'; + $temp_data = json_decode( file_get_contents( $this->apiurls["yahoo"][0]."?q=".urlencode($yql_query).'&format=json&env="store://datatables.org/alltableswithkeys"'), true ); + if ($this->config['cacheTime'] > 0) $this->_weatherCacheWrite( BASE_DIR . '/cache/module_weather_yahoo' . md5($this->config['city'] . $this->config['language']) . '.json',$temp_data); + $this->content[] = $temp_data; + } + + } else { + $this->error = 'cURL extension and file_get_content method is not available on your server'; + return; + }; + + } + + //note: input data is in an array of the returned api result request(s) in the same order as setup in the apiurls + //All data manipulation and cleaning up happens below + //making this was tedious. + + function datamapper($input) { + + + if ($this->config['api'] == 'openweathermap' ) + { + //data[0] is current weather, data[1] is forecast + + $out['location'] = $this->config['location'] + ", " + $this->config['country']; + $out['city'] = $this->config['location']; + + $out['today'] = array(); + $out['today']['temp'] = array(); + $out['today']['temp']['now'] = round($input[0]['main']['temp']); + + $out['today']['temp']['min'] = round($input[1]['list'][0]['temp']['min']); + $out['today']['temp']['max'] = round($input[1]['list'][0]['temp']['max']); + + $out['today']['desc'] = $input[0]['weather'][0]['description'] ; + $out['today']['code'] = $input[0]['weather'][0]['id']; + + //no weather id code remapping needed, we will use this as our default weather code system + //and convert all other codes to the openweathermap weather code format + + $out['today']['wind'] = $input[0]['wind']; + $out['today']['humidity'] = $input[0]['main']['humidity']; + $out['today']['pressure'] = $input[0]['main']['pressure']; + $out['today']['sunrise'] = Date( 'H:i', $input[0]['sys']['sunrise']); + $out['today']['sunset'] = Date( 'H:i', $input[0]['sys']['sunset']); + + $out['today']['day'] = $this->getDayString( Date('w') ) ; + + $out['forecast'] = array(); + for ($i = 0; $i < $this->config['forecast']; $i++) { + $forecast = array(); + + $forecast['day'] = $this->getDayString( Date( 'w' , $input[1]['list'][$i]['dt'] ) ); //api time is in unix epoch + $forecast['code'] = $input[1]['list'][$i]['weather'][0]['id']; + $forecast['desc'] = $input[1]['list'][$i]['weather'][0]['description']; + $forecast['temp'] = array( 'max' => round($input[1]['list'][$i]['temp']['max']), 'min' => round($input[1]['list'][$i]['temp']['min']) ); + $out['forecast'][] = $forecast; + } + + return $out; + + } else if ($this->config['api'] == 'yahoo') { + //key = yahoo code, value = standard code (based on openweathermap codes) + $codes = array( + 0 => "900", //tornado + 1 => "901", //tropical storm + 2 => "902", //hurricane + 3 => "212", //severe thunderstorms + 4 => "200", //thunderstorms + 5 => "616", //mixed rain and snow + 6 => "612", //mixed rain and sleet + 7 => "611", //mixed snow and sleet + 8 => "511", //freezing drizzle + 9 => "301", //drizzle + 10 => "511", //freezing rain + 11 => "521", //showers + 12 => "521", //showers + 13 => "600", //snow flurries + 14 => "615", //light snow showers + 15 => "601", //blowing snow + 16 => "601", //snow + 17 => "906", //hail + 18 => "611", //sleet + 19 => "761", //dust + 20 => "741", //foggy + 21 => "721", //haze + 22 => "711", //smoky + 23 => "956", //blustery + 24 => "954", //windy + 25 => "903", //cold + 26 => "802", //cloudy + 27 => "802", //mostly cloudy (night) + 28 => "802", //mostly cloudy (day) + 29 => "802", //partly cloudy (night) + 30 => "802", //partly cloudy (day) + 31 => "800", //clear (night) + 32 => "800", //sunny + 33 => "951", //fair (night) + 34 => "951", //fair (day) + 35 => "906", //mixed rain and hail + 36 => "904", //hot + 37 => "210", //isolated thunderstorms + 38 => "210", //scattered thunderstorms + 39 => "210", //scattered thunderstorms + 40 => "521", //scattered showers + 41 => "602", //heavy snow + 42 => "621", //scattered snow showers + 43 => "602", //heavy snow + 44 => "802", //partly cloudy + 45 => "201", //thundershowers + 46 => "621", //snow showers + 47 => "210", //isolated thundershowers + 3200 => "951", //not available... alright... lets make that sunny. + ); + + include(BASE_DIR . "/modules/weather/lang/" . $_SESSION['user_language'] . ".php"); + + $input = $input[0]['query']['results']['channel']; + //reportlog(print_r($input)); + $out['location'] = $this->config['location'] + ", " + $this->config['country']; + $out['city'] = $this->config['location']; + + $out['today'] = array(); + $out['today']['temp'] = array(); + $out['today']['temp']['now'] = round($input['item']['condition']['temp']); + + $out['today']['temp']['min'] = round($input['item']['forecast'][0]['low']); + $out['today']['temp']['max'] = round($input['item']['forecast'][0]['high']); + + $out['today']['desc'] = $conditions[$input['item']['condition']['code']]; + $out['today']['code'] = $codes[$input['item']['condition']['code']]; //map weather code + + $out['today']['wind'] = array(); + $out['today']['wind']['speed'] = $input['wind']['speed']; + $out['today']['wind']['deg'] = $input['wind']['deg']; + + $out['today']['humidity'] = $input['atmosphere']['humidity']; + $out['today']['pressure'] = $input['atmosphere']['pressure']; + $out['today']['sunrise'] = $input['astronomy']['sunrise']; + $out['today']['sunset'] = $input['astronomy']['sunset']; + + $out['today']['day'] = $this->getDayString( Date('w') ) ; + + + $out['forecast'] = array(); + for ($i = 0; $i < $this->config['forecast']; $i++) { + $forecast = array(); + // day + if(isset($tdays[ (string)$input['item']['forecast'][$i]['day'] ] )){ + $forecast['day'] = $tdays[ (string)$input['item']['forecast'][$i]['day'] ] ; + } else { + $forecast['day'] = (string)$input['item']['forecast'][$i]['day'] ; + } + // condition code + $forecast['code'] = $codes[$input['item']['forecast'][$i]['code']]; //map weather code + // condition text + if(isset($conditions[ $input['item']['condition']['code'] ] )){ + $forecast['desc'] = $conditions[ $input['item']['condition']['code'] ]; + } else { + $forecast['desc'] = $input['item']['forecast'][$i]['text']; + } + + $forecast['temp'] = array( 'max' => round($input['item']['forecast'][$i]['high']), 'min' => round($input['item']['forecast'][$i]['low']) ); + $out['forecast'][] = $forecast; + + } + + return $out; + + } + + } + + + + function getDayString($day) { + $days = array("Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък" , "Събота"); + include(BASE_DIR . "/modules/weather/lang/" . $_SESSION['user_language'] . ".php"); + return $days[$day]; + } + + /** + * Config module + * @param string $tpl_dir + * @param string $lang_file + */ + + function weatherSettingsEdit($tpl_dir, $lang_file) + { + global $AVE_DB, $AVE_Template; + + if ( isset($_REQUEST['sub']) && $_REQUEST['sub'] == 'save' ) + { + $AVE_DB->Query(" + UPDATE " . PREFIX . "_module_weather + SET + location = '" . $_REQUEST['location'] . "', + country = '" . $_REQUEST['country'] . "', + WOEID = '" . $_REQUEST['WOEID'] . "', + lat = '" . $_REQUEST['lat'] . "', + lon = '" . $_REQUEST['lon'] . "', + displayCityNameOnly = '" . $_REQUEST['displayCityNameOnly'] . "', + api = '" . $_REQUEST['api'] . "', + apikey = '" . $_REQUEST['apikey'] . "', + secret_key = '" . $_REQUEST['secret_key'] . "', + forecast = '" . $_REQUEST['forecast'] . "', + view = '" . $_REQUEST['view'] . "', + render = '" . $_REQUEST['render'] . "', + lang = '" . $_REQUEST['lang'] . "', + cacheTime = '" . $_REQUEST['cacheTime'] . "', + units = '" . $_REQUEST['units'] . "', + useCSS = '" . $_REQUEST['useCSS'] . "' + WHERE id = '1' + "); + + header('Location:index.php?do=modules&action=modedit&mod=weather&moduleaction=1&cp=' . SESSION); + exit; + }; + + $row = $AVE_DB->Query("SELECT * FROM " . PREFIX . "_module_weather WHERE id = 1")->FetchAssocArray(); + + $AVE_Template->assign('row', $row); + $AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_weather.tpl')); + } + + +} // class : end + +?> \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..a508c6f --- /dev/null +++ b/index.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/lang/bg.php b/lang/bg.php new file mode 100644 index 0000000..b8d0ad3 --- /dev/null +++ b/lang/bg.php @@ -0,0 +1,66 @@ + "Торнадо", //tornado + 1 => "Тропическа буря", //tropical storm + 2 => "Ураган", //hurricane + 3 => "Силна гръмотевична буря", //severe thunderstorms + 4 => "Гръмотевична буря", //thunderstorms + 5 => "Дъжд със сняг", //mixed rain and snow + 6 => "Дъжд с лапавица", //mixed rain and sleet + 7 => "Сняг с киша", //mixed snow and sleet + 8 => "Леден ръмеж", //freezing drizzle + 9 => "Ръмеж", //drizzle + 10 => "Студен дъжд", //freezing rain + 11 => "Дъжд", //showers + 12 => "Дъжд", //showers + 13 => "Снежни вихрушки", //snow flurries + 14 => "Лек сняг", //light snow showers + 15 => "Мокър сняг", //blowing snow + 16 => "Сняг", //snow + 17 => "Градушка", //hail + 18 => "Суграшица", //sleet + 19 => "Прах", //dust + 20 => "Мъгливо", //foggy + 21 => "Мараня", //haze + 22 => "Смог", //smoky + 23 => "Виелица", //blustery + 24 => "Ветровито", //windy + 25 => "Студено", //cold + 26 => "Облачно", //cloudy + 27 => "Предимно облачно", //mostly cloudy (night) + 28 => "Предимно облачно", //mostly cloudy (day) + 29 => "Частнична облачност", //partly cloudy (night) + 30 => "Частнична облачност", //partly cloudy (day) + 31 => "Ясно", //clear (night) + 32 => "Слънчево", //sunny + 33 => "Ясно", //fair (night) + 34 => "Ясно", //fair (day) + 35 => "Смесено дъжд и градушка", //mixed rain and hail + 36 => "Горещо", //hot + 37 => "Изолирани гръмотевични бури", //isolated thunderstorms + 38 => "Разпокъсани гръмотевични бури", //scattered thunderstorms + 39 => "Разпокъсани гръмотевични бури", //scattered thunderstorms + 40 => "Разпокъсани превалявания", //scattered showers + 41 => "Силен снеговалеж", //heavy snow + 42 => "Превалявания от сняг", //scattered snow showers + 43 => "Силен снеговалеж", //heavy snow + 44 => "Частична облачност", //partly cloudy + 45 => "Дъжд с гръмотевици", //thundershowers + 46 => "Снеговалеж", //snow showers + 47 => "Разпокъсани превалявания", //isolated thundershowers + 3200 => "Слънчево", //not available... alright... lets make that sunny. + ); + +$tdays = array( + 'Mon' => 'Понеделник', + 'Tue' => 'Вторник', + 'Wed' => 'Сряда', + 'Thu' => 'Четвъртък', + 'Fri' => 'Петък', + 'Sat' => 'Събота', + 'Sun' => 'Неделя' + ); + + $days = array( "Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък" , "Събота"); + +?> \ No newline at end of file diff --git a/lang/bg.txt b/lang/bg.txt new file mode 100644 index 0000000..64dc465 --- /dev/null +++ b/lang/bg.txt @@ -0,0 +1,33 @@ +WEATHER_NAME = 'Времето' +[admin] +WEATHER_MODULE_NAME = "Модул Прогноза" +WEATHER_MODULE_INFO = "Извежда прогноза за времето от Openweathermap.org или Yahoo Weather API . При смяна на източника, моля изтрийте кеша на шаблоните." +WEATHER_MODULE_EDIT = "Редактиране" +WEATHER_FCOUNTRY ="Държава" +WEATHER_FCITY="Локация(име населено място)" +WEATHER_FCITY_DESC="Моля въведете името на града, което да се показва в сайта" +WEATHER_LANG="Език (Openweathermap)" +WEATHER_LANG_DESC="Моля въведете езика на който искате да бъде показана прогнозата - 'bg' за български" +WEATHER_LONGITUDE="Географска дължина" +WEATHER_LONGITUDE_DESC="" +WEATHER_LATITUDE="Географска ширина" +WEATHER_LATITUDE_DESC="" +WEATHER_SHOWCITY="Покажи само името на града" +WEATHER_SHOWCITY_DESC="Разрешете тази опция, ако желаете да се показва името на града" +WEATHER_AMOUNT_DAYS="Брой дни" +WEATHER_AMOUNT_DAYS_DESC="Брой дни за които да се показва прогнозата" +WEATHER_UNIT="Мерна система" +WEATHER_UNIT_DESC="Моля да изберете мерната единица - Metric (C) or Imperial (F)" +WEATHER_USECSS="Модула зарежда CSS" +WEATHER_USECSS_DESC="Изключете опцията, ако използвате шаблон, съдържащ стиловете, нообходими за работата на модула" +WEATHER_CACHETIME="Време за кеширане в мин." +WEATHER_CACHETIME_DESC="Определете времето за кеширане в минути" +WEATHER_ENABLE = "Да" +WEATHER_DISABLE = "Не" +WEATHER_BUTTON_SAVE = "Запиши" +WEATHER_TEMPLATE = "Начин на показване" +WEATHER_TEMPLATE_DESC = "full, forecast, today, partial, simple" +WEATHER_SOURCE = "Източник на прогнозата" +WEATHER_WOEID = "Openweathermap/Yahoo code (WOEID)" +WEATHER_WOEID_DESC = "Например за Варна, България - 840430" + diff --git a/lang/en.php b/lang/en.php new file mode 100644 index 0000000..c904146 --- /dev/null +++ b/lang/en.php @@ -0,0 +1,65 @@ + "Tornado", //tornado + 1 => "Tropical Storm", //tropical storm + 2 => "Hurricane", //hurricane + 3 => "Severe Thunderstorms", //severe thunderstorms + 4 => "Thunderstorms", //thunderstorms + 5 => "Mixed Rain and Snow", //mixed rain and snow + 6 => "Mixed Rain and Sleet", //mixed rain and sleet + 7 => "Mixed Snow and Sleet", //mixed snow and sleet + 8 => "Freezing Drizzle", //freezing drizzle + 9 => "Drizzle", //drizzle + 10 => "Freezing Rain",, //freezing rain + 11 => "Showers", //showers + 12 => "Showers", //showers + 13 => "Snow Flurries", //snow flurries + 14 => "Light Snow Showers", //light snow showers + 15 => "Blowing Snow", //blowing snow + 16 => "Snow", //snow + 17 => "Hail", //hail + 18 => "Sleet", //sleet + 19 => "Dust", //dust + 20 => "Foggy", //foggy + 21 => "Haze", //haze + 22 => "Smoky", //smoky + 23 => "Blustery", //blustery + 24 => "Windy", //windy + 25 => "Cold", //cold + 26 => "Cloudy", //cloudy + 27 => "Mostly Cloudy", //mostly cloudy (night) + 28 => "Mostly Cloudy", //mostly cloudy (day) + 29 => "Partly Cloudy", //partly cloudy (night) + 30 => "Partly Cloudy", //partly cloudy (day) + 31 => "Clear", //clear (night) + 32 => "Sunny", //sunny + 33 => "Fair", //fair (night) + 34 => "Fair", //fair (day) + 35 => "Mixed Rain and Hail", //mixed rain and hail + 36 => "Hot", //hot + 37 => "Isolated Thunderstormsи", //isolated thunderstorms + 38 => "Scattered Thunderstorms", //scattered thunderstorms + 39 => "Scattered Thunderstorms", //scattered thunderstorms + 40 => "Scattered Showers", //scattered showers + 41 => "Heavy Snow", //heavy snow + 42 => "Scattered Snow Showersг", //scattered snow showers + 43 => "Heavy Snow", //heavy snow + 44 => "Partly Cloudy", //partly cloudy + 45 => "Thundershowers", //thundershowers + 46 => "Snow Showers", //snow showers + 47 => "Isolated Thundershowers", //isolated thundershowers + 3200 => "Sunny", //not available... alright... lets make that sunny. + ); + +$tdays = array( + 'Mon' => 'Monday', + 'Tue' => 'Tuesday', + 'Wed' => 'Wednesday', + 'Thu' => 'Thursday', + 'Fri' => 'Friday', + 'Sat' => 'Saturday', + 'Sun' => 'Sunday' + ); +$days = array( "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" , "Saturday"); + +?> \ No newline at end of file diff --git a/lang/en.txt b/lang/en.txt new file mode 100644 index 0000000..6016df9 --- /dev/null +++ b/lang/en.txt @@ -0,0 +1,32 @@ +WEATHER_NAME = 'WEATHER' +[admin] +WEATHER_MODULE_NAME = "Module WEATHER" +WEATHER_MODULE_INFO = "Module info" +WEATHER_MODULE_EDIT = "Edit" +WEATHER_FCOUNTRY ="Country" +WEATHER_FCITY="Location" +WEATHER_FCITY_DESC="Please specify full name of city which will be visible in the module" +WEATHER_LANG="Language (Openweathermap)" +WEATHER_LANG_DESC="Please specify language for forecast - i.e. 'en' for english, 'bg' for bulgarian" +WEATHER_LATITUDE="Latitude" +WEATHER_LATITUDE_DESC="" +WEATHER_LONGITUDE="Longitude" +WEATHER_LONGITUDE_DESC="" +WEATHER_SHOWCITY="Show only city name" +WEATHER_SHOWCITY_DESC="Enable this option if you want to show only city name" +WEATHER_AMOUNT_DAYS="Amount of days" +WEATHER_AMOUNT_DAYS_DESC="Amount of days in forecast.
0 - display only current day." +WEATHER_UNIT="Units" +WEATHER_UNIT_DESC="Select units used in your weather - Metric (C) or Imperial (F)" +WEATHER_USECSS="Use module CSS" +WEATHER_USECSS_DESC="Disable this option when you are using template with built-in styles for this module" +WEATHER_CACHETIME="Cache time" +WEATHER_CACHETIME_DESC="Set time for cache in minutes.
0 - disable cache" +WEATHER_ENABLE = "Yes" +WEATHER_DISABLE = "No" +WEATHER_BUTTON_SAVE = "Save" +WEATHER_TEMPLATE = "Template" +WEATHER_TEMPLATE_DESC = "" +WEATHER_SOURCE = "Weather API" +WEATHER_WOEID = "Openweathermap/Yahoo code (WOEID)" +WEATHER_WOEID_DESC = "" \ No newline at end of file diff --git a/lang/ru.php b/lang/ru.php new file mode 100644 index 0000000..c904146 --- /dev/null +++ b/lang/ru.php @@ -0,0 +1,65 @@ + "Tornado", //tornado + 1 => "Tropical Storm", //tropical storm + 2 => "Hurricane", //hurricane + 3 => "Severe Thunderstorms", //severe thunderstorms + 4 => "Thunderstorms", //thunderstorms + 5 => "Mixed Rain and Snow", //mixed rain and snow + 6 => "Mixed Rain and Sleet", //mixed rain and sleet + 7 => "Mixed Snow and Sleet", //mixed snow and sleet + 8 => "Freezing Drizzle", //freezing drizzle + 9 => "Drizzle", //drizzle + 10 => "Freezing Rain",, //freezing rain + 11 => "Showers", //showers + 12 => "Showers", //showers + 13 => "Snow Flurries", //snow flurries + 14 => "Light Snow Showers", //light snow showers + 15 => "Blowing Snow", //blowing snow + 16 => "Snow", //snow + 17 => "Hail", //hail + 18 => "Sleet", //sleet + 19 => "Dust", //dust + 20 => "Foggy", //foggy + 21 => "Haze", //haze + 22 => "Smoky", //smoky + 23 => "Blustery", //blustery + 24 => "Windy", //windy + 25 => "Cold", //cold + 26 => "Cloudy", //cloudy + 27 => "Mostly Cloudy", //mostly cloudy (night) + 28 => "Mostly Cloudy", //mostly cloudy (day) + 29 => "Partly Cloudy", //partly cloudy (night) + 30 => "Partly Cloudy", //partly cloudy (day) + 31 => "Clear", //clear (night) + 32 => "Sunny", //sunny + 33 => "Fair", //fair (night) + 34 => "Fair", //fair (day) + 35 => "Mixed Rain and Hail", //mixed rain and hail + 36 => "Hot", //hot + 37 => "Isolated Thunderstormsи", //isolated thunderstorms + 38 => "Scattered Thunderstorms", //scattered thunderstorms + 39 => "Scattered Thunderstorms", //scattered thunderstorms + 40 => "Scattered Showers", //scattered showers + 41 => "Heavy Snow", //heavy snow + 42 => "Scattered Snow Showersг", //scattered snow showers + 43 => "Heavy Snow", //heavy snow + 44 => "Partly Cloudy", //partly cloudy + 45 => "Thundershowers", //thundershowers + 46 => "Snow Showers", //snow showers + 47 => "Isolated Thundershowers", //isolated thundershowers + 3200 => "Sunny", //not available... alright... lets make that sunny. + ); + +$tdays = array( + 'Mon' => 'Monday', + 'Tue' => 'Tuesday', + 'Wed' => 'Wednesday', + 'Thu' => 'Thursday', + 'Fri' => 'Friday', + 'Sat' => 'Saturday', + 'Sun' => 'Sunday' + ); +$days = array( "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" , "Saturday"); + +?> \ No newline at end of file diff --git a/lang/ru.txt b/lang/ru.txt new file mode 100644 index 0000000..8710630 --- /dev/null +++ b/lang/ru.txt @@ -0,0 +1,31 @@ +WEATHER_NAME = 'Погода' +[admin] +WEATHER_MODULE_NAME = "Модуль Погода > Настройки" +WEATHER_MODULE_INFO = "Модуль Погода использует Openweathermap.org илиYahoo Weather API для получения данных о погоде на текущий день и прогноза на ближайшие дни для любой точки мира. Используя самый надежный источник информации о погоде Вы можете обогатить веб-сайт собственным каналом погоды, который можете оформить по своему усмотрению." +WEATHER_MODULE_EDIT = "Редактировать" +WEATHER_CITY = "Местоположение" +WEATHER_FCOUNTRY ="Страна" +WEATHER_FCITY = "Полное наименование города" +WEATHER_FCITY_DESC = "Пожалуйста, укажите полное наименование города, для которого будет выводится информация о погоде" +WEATHER_LANG = "Язык" +WEATHER_LANG_DESC = "Пожалуйста, укажите язык вывода информации о погоде. Например, en - английский, bg - болгарский" +WEATHER_LATITUDE = "Широта" +WEATHER_LATITUDE_DESC = "" +WEATHER_LONGITUDE = "Долгота" +WEATHER_LONGITUDE_DESC = "" +WEATHER_SHOWCITY = "Отображать название города" +WEATHER_SHOWCITY_DESC = "Включите этот параметр, если хотите отображать название города" +WEATHER_AMOUNT_DAYS = "Количество дней в прогнозе" +WEATHER_AMOUNT_DAYS_DESC = "На сколько дней выводить прогноз погоды.
0 - выводить информацию о погоде только на текущий день" +WEATHER_UNIT = "Единица измерения температуры" +WEATHER_UNIT_DESC = "Выберите единицу измерения температуры: Metric (C) or Imperial (F)" +WEATHER_USECSS = "CSS стили" +WEATHER_USECSS_DESC = "Отключите эту опцию если используете шаблон со встроенными стилями" +WEATHER_CACHETIME = "Время жизни кэша" +WEATHER_CACHETIME_DESC = "Использование кэширования. Укажите время жизни кэша в минутах.
0 - кэш отключен" +WEATHER_ENABLE = "Вкл" +WEATHER_DISABLE = "Выкл" +WEATHER_BUTTON_SAVE = "Сохранить" +WEATHER_SOURCE = "Weather API" +WEATHER_WOEID = "Openweathermap/Yahoo code (WOEID)" +WEATHER_WOEID_DESC = "" diff --git a/module.php b/module.php new file mode 100644 index 0000000..456e01c --- /dev/null +++ b/module.php @@ -0,0 +1,67 @@ +You can enrich your website with your own weather channel, were all weather conditions from any place of the world will look as you want to be, using the most reliable weather forecast source and combining with the most professional style.
System tag [mod_weather].'; + $modul['ModuleAutor'] = "N. Popova, npop@abv.bg"; // Автор + $modul['ModuleCopyright'] = '© 2016 npop@abv.bg'; // + $modul['ModuleIsFunction'] = 1; + $modul['ModuleAdminEdit'] = 1; + $modul['ModuleFunction'] = 'mod_weather'; + $modul['ModuleTag'] = '[mod_weather]'; + $modul['ModuleTagLink'] = null; + $modul['ModuleAveTag'] = "#\\\[mod_weather]#"; + $modul['ModulePHPTag'] = ""; + +} + +function mod_weather() +{ + + require_once(BASE_DIR . "/modules/weather/class.weather.php"); + + $weather = new Weather(); + + $tpl_dir = BASE_DIR . '/modules/weather/templates/'; + $lang_file = BASE_DIR . "/modules/weather/lang/" . $_SESSION['user_language'] . ".txt"; + + if (! is_file(BASE_DIR . '/cache/')) {@mkdir(BASE_DIR . '/cache/', 0777);} + + $weather->ShowWeather($tpl_dir, $lang_file); +} + + +if (defined('ACP') && ! empty($_REQUEST['moduleaction'])) +{ + + require_once(BASE_DIR . "/modules/weather/class.weather.php"); + + $tpl_dir = BASE_DIR . '/modules/weather/templates/'; + $lang_file = BASE_DIR . "/modules/weather/lang/" . $_SESSION['user_language'] . ".txt"; + + $weather = new Weather(); + $AVE_Template->config_load($lang_file, "admin"); + + switch($_REQUEST['moduleaction']) + { + case '1': + $weather->weatherSettingsEdit($tpl_dir, $lang_file); + break; + } +} + +?> \ No newline at end of file diff --git a/sql.php b/sql.php new file mode 100644 index 0000000..766a20e --- /dev/null +++ b/sql.php @@ -0,0 +1,64 @@ + \ No newline at end of file diff --git a/templates/admin_weather.tpl b/templates/admin_weather.tpl new file mode 100644 index 0000000..4d9fe5c --- /dev/null +++ b/templates/admin_weather.tpl @@ -0,0 +1,163 @@ +
{#WEATHER_MODULE_NAME#}
+ +
+
+ {#WEATHER_MODULE_INFO#} +
+
+ + + + +
+
+
+
{#WEATHER_MODULE_EDIT#}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {* + + + + + + *} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{#WEATHER_SOURCE#} + +
API key (Openweathermap)
{#WEATHER_WOEID#}
{#WEATHER_TEMPLATE#} + +
{#WEATHER_AMOUNT_DAYS#} + +
{#WEATHER_FCITY#}
{#WEATHER_FCOUNTRY#}
{#WEATHER_SHOWCITY#} + +
Secret key (Yahoo YQL)
{#WEATHER_LANG#}
{#WEATHER_LATITUDE#}
{#WEATHER_LONGITUDE#}
{#WEATHER_UNIT#} + +
{#WEATHER_CACHETIME#}
{#WEATHER_USECSS#} + +
+
+ +
+
+
+
+ + + \ No newline at end of file diff --git a/templates/css/weatherplugin.css b/templates/css/weatherplugin.css new file mode 100644 index 0000000..0cee941 --- /dev/null +++ b/templates/css/weatherplugin.css @@ -0,0 +1,644 @@ +/*************************************************************************************************/ +/* Global - Base */ +/*************************************************************************************************/ +@font-face { + font-family: 'weathericons'; + src: url('../fonts/weathericons-regular-webfont.eot'); + src: url('../fonts/weathericons-regular-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/weathericons-regular-webfont.woff') format('woff'), url('../fonts/weathericons-regular-webfont.ttf') format('truetype'), url('../fonts/weathericons-regular-webfont.svg#weathericons-regular-webfontRg') format('svg'); + font-weight: normal; + font-style: normal; +} + +.wi:before, .wi:after { + display: inline-block; + font-family: 'weathericons'; + font-style: normal; + font-weight: normal; + line-height: 1; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + + +.WeatherPlugin { + font-size: inherit; + width: 100%; +} + +.WeatherPlugin p, .WeatherPlugin h2, .WeatherPlugin h3, .WeatherPlugin ul, .WeatherPlugin li { + padding: 0; + margin: 0; + color: inherit; +} + +#flatWeatherLoading.loading { + font-size: 90px; + text-align: center; + padding: 10px; + overflow: hidden; + -webkit-animation:spin 2s linear infinite; + -moz-animation:spin 2s linear infinite; + animation:spin 2s linear infinite; + opacity: 0.2; +} +@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } } +@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } } +@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } } + +.WeatherPlugin h2 { + margin: 0 0 5px 0; +} + +.WeatherPlugin .wiToday { + width: 100%; + overflow: hidden; +} + +.WeatherPlugin .wiToday > .wiIconGroup { + float: right; + width: 50%; + text-align: center; +} + +.WeatherPlugin .wiToday > .wiIconGroup p { + width: 100%; + color: inherit; + line-height: 1em; + padding: 6px 0 0 0; +} + + +.WeatherPlugin .wiToday .wiIconGroup div.wi { + font-size: 400%; + line-height: 1.45em; + width: 100%; +} + +.WeatherPlugin .wiToday .wiIconGroup div.wi:before { + vertical-align: text-bottom; +} + +.WeatherPlugin .clearfix:after { + content: " "; + display: table; + clear: both; +} + +.WeatherPlugin div.wiToday > p.wiTemperature { + font-size: 400%; + line-height: 1.45em; + float: left; + width: 50%; + text-align: center; + color: inherit; +} + +.WeatherPlugin sup { + opacity: 0.7; + font-size: 65%; + vertical-align: baseline; + top: -0.5em; + position: relative; +} + +.WeatherPlugin .wiDetail { + overflow: hidden; + width: 100%; + padding-bottom: 5px; +} + +.WeatherPlugin.today .wiDetail { + padding-top: 10px; +} + +.WeatherPlugin .wiDetail p.wiDay { + font-weight: bold; + margin: 5px 0 2px 0; + text-align: left; + color: inherit; +} + +.WeatherPlugin.partial .wiToday p.wiDay { + text-align: center; + font-weight: bold; + padding: 0 0 10px 0; + clear: both; + width: 100%; + color: inherit; +} + + +.WeatherPlugin .wiDetail ul { + width: 33%; + float: left; + list-style: none; + font-size: 90%; +} + +.WeatherPlugin .wiDetail ul + ul { + width: 27%; +} + +.WeatherPlugin .wiDetail ul + ul + ul { + width: 40%; +} + +.WeatherPlugin .wiDetail ul li:before { + width:30px; + +} + +.WeatherPlugin ul.wiForecasts{ + width: 100%; + overflow: hidden; +} + +.WeatherPlugin ul.wiForecasts li > span { + width: 25%; + display: inline-block; +} + +.WeatherPlugin ul.wiForecasts li { + float: left; + width: 100%; + overflow: hidden; + display: inline; +} + +.WeatherPlugin ul.wiForecasts ul.wiForecast { + font-weight: normal; + list-style: none; + float: right; + width: 75%; +} + +.WeatherPlugin.forecast ul.wiForecasts ul.wiForecast li { + text-align: center; +} + +.WeatherPlugin ul.wiForecasts ul.wiForecast li { + width: 33%; + float: left; + text-align: center; +} + +.WeatherPlugin ul.wiForecasts ul.wiForecast li.wi:before { + vertical-align: bottom; +} + +.WeatherPlugin ul.wiForecasts li.wiDay { + font-weight: bold; + border-color: inherit; + border-top: 1px solid RGBA(255,255,255,0.2); + padding: 5px 0; +} + +.WeatherPlugin.forecast ul.wiForecasts li.wiDay { + border-bottom: 1px solid RGBA(255,255,255,0.2); + border-top: none; +} + +.WeatherPlugin ul.wiForecasts li.wiDay:last-child { + border-bottom: none; +} + + +/*************************************************************************************************/ +/* Font mappings */ +/*************************************************************************************************/ + +/*************************** +General +****************************/ +.wi.sunrise:before { + content: "\f051"; +} + +.wi.sunset:before { + content: "\f052"; +} + +.wi.wind:before { + content: "\f050"; +} + +.wi.humidity:before { + content: "\f04e"; +} + +.wi.pressure:before { + content: "\f040"; +} + +.wi.cloudiness:before { + content: "\f041"; +} + +.wi.temperature.metric:after { + content: "\f03c"; +} + +.wi.temperature.imperial:after { + content: "\f045"; +} + +.wi.loading:after { + content: "\f04c"; +} + +/*************************** +Thunderstorm +****************************/ + +/* thunderstorm with light rain */ +.wi.wi200:before { + content: "\f01d"; +} + +/* thunderstorm with rain */ +.wi.wi201:before { + content: "\f01d"; +} + +/* thunderstorm with heavy rain */ +.wi.wi202:before { + content: "\f01e"; +} + +/* light thunderstorm */ +.wi.wi210:before { + content: "\f010"; +} + +/* thunderstorm */ +.wi.wi211:before { + content: "\f01e"; +} + +/* heavy thunderstorm */ +.wi.wi212:before { + content: "\f01e"; +} + +/* ragged thunderstorm */ +.wi.wi221:before { + content: "\f016"; +} + +/* thunderstorm with light drizzle */ +.wi.wi230:before { + content: "\f01d"; +} + +/* thunderstorm with drizzle */ +.wi.wi231:before { + content: "\f01d"; +} + +/* thunderstorm with heavy drizzle */ +.wi.wi232:before { + content: "\f01d"; +} + +/*************************** +Drizzle +****************************/ + +/* light intensity drizzle */ +.wi.wi300:before { + content: "\f01c"; +} + +/* drizzle */ +.wi.wi301:before { + content: "\f01c"; +} + +/* heavy intensity drizzle */ +.wi.wi302:before { + content: "\f01c"; +} + +/* light intensity drizzle rain */ +.wi.wi310:before { + content: "\f01c"; +} + +/* drizzle rain */ +.wi.wi311:before { + content: "\f017"; +} + +/* heavy intensity drizzle rain */ +.wi.wi312:before { + content: "\f017"; +} + +/* shower rain and drizzle */ +.wi.wi313:before { + content: "\f01a"; +} + +/* heavy shower rain and drizzle */ +.wi.wi314:before { + content: "\f01a"; +} + +/* shower drizzle */ +.wi.wi321:before { + content: "\f01a"; +} + +/*************************** +Rain +****************************/ + +/* light rain */ +.wi.wi500:before { + content: "\f01a"; +} + +/* moderate rain */ +.wi.wi501:before { + content: "\f017"; +} + +/* heavy intensity rain */ +.wi.wi502:before { + content: "\f019"; +} + +/* very heavy rain */ +.wi.wi503:before { + content: "\f019"; +} + +/* extreme rain */ +.wi.wi504:before { + content: "\f018"; +} + +/* freezing rain */ +.wi.wi511:before { + content: "\f015"; +} + +/* light intensity shower rain */ +.wi.wi520:before { + content: "\f01a"; +} + +/* shower rain */ +.wi.wi521:before { + content: "\f01a"; +} + +/* heavy intensity shower rain */ +.wi.wi522:before { + content: "\f01a"; +} + +/* ragged shower rain */ +.wi.wi531:before { + content: "\f01a"; +} + +/*************************** +Snow +****************************/ + +/* light snow */ +.wi.wi600:before { + content: "\f01b"; +} + +/* snow */ +.wi.wi601:before { + content: "\f01b"; +} + +/* heavy snow */ +.wi.wi602:before { + content: "\f01b"; +} + +/* sleet */ +.wi.wi611:before { + content: "\f015"; +} + +/* shower sleet */ +.wi.wi612:before { + content: "\f015"; +} + +/* light rain and snow */ +.wi.wi615:before { + content: "\f017"; +} + +/* rain and snow */ +.wi.wi616:before { + content: "\f017"; +} + +/* light shower snow */ +.wi.wi620:before { + content: "\f017"; +} + +/* shower snow */ +.wi.wi621:before { + content: "\f017"; +} + +/* heavy shower snow */ +.wi.wi622:before { + content: "\f017"; +} + +/*************************** +Atmosphere +****************************/ + +/* mist */ +.wi.wi701:before { + content: "\f014"; +} + +/* smoke */ +.wi.wi711:before { + content: "\f062"; +} + +/* haze */ +.wi.wi721:before { + content: "\f014"; +} + +/* sand, dust whirls */ +.wi.wi731:before { + content: "\f063"; +} + +/* fog */ +.wi.wi741:before { + content: "\f014"; +} + +/* sand */ +.wi.wi751:before { + content: "\f063"; +} + +/* dust */ +.wi.wi761:before { + content: "\f063"; +} + +/* volcanic ash */ +.wi.wi762:before { + content: "\f063"; +} + +/* squalls */ +.wi.wi771:before { + content: "\f050"; +} + +/* tornado */ +.wi.wi781:before { + content: "\f056"; +} + +/*************************** +Clouds +****************************/ + +/* clear sky */ +.wi.wi800:before { + content: "\f00d"; +} + +/* few clouds */ +.wi.wi801:before { + content: "\f002"; +} + +/* scattered clouds */ +.wi.wi802:before { + content: "\f002"; +} + +/* broken clouds */ +.wi.wi803:before { + content: "\f002"; +} + +/* overcast clouds */ +.wi.wi804:before { + content: "\f00c"; +} + +/*************************** +Extreme +****************************/ + +/* tornado */ +.wi.wi900:before { + content: "\f056"; +} + +/* tropical storm */ +.wi.wi901:before { + content: "\f073"; +} + +/* hurricane */ +.wi.wi902:before { + content: "\f073"; +} + +/* cold */ +.wi.wi903:before { + content: "\f076"; +} + +/* hot */ +.wi.wi904:before { + content: "\f072"; +} + +/* windy */ +.wi.wi905:before { + content: "\f050"; +} + +/* hail */ +.wi.wi906:before { + content: "\f015"; +} + +/*************************** +Additional +****************************/ + +/* calm */ +.wi.wi951:before { + content: "\f00d"; +} + +/* light breeze */ +.wi.wi952:before { + content: "\f021"; +} + +/* gentle breeze */ +.wi.wi953:before { + content: "\f021"; +} + +/* moderate breeze */ +.wi.wi954:before { + content: "\f021"; +} + +/* fresh breeze */ +.wi.wi955:before { + content: "\f021"; +} + +/* strong breeze */ +.wi.wi956:before { + content: "\f050"; +} + +/* high wind, near gale */ +.wi.wi957:before { + content: "\f050"; +} + +/* gale */ +.wi.wi958:before { + content: "\f050"; +} + +/* severe gale */ +.wi.wi959:before { + content: "\f073"; +} + +/* storm */ +.wi.wi960:before { + content: "\f073"; +} + +/* violent storm */ +.wi.wi961:before { + content: "\f073"; +} + +/* hurricane */ +.wi.wi962:before { + content: "\f073"; +} \ No newline at end of file diff --git a/templates/fonts/WeatherIcons-Regular.otf b/templates/fonts/WeatherIcons-Regular.otf new file mode 100644 index 0000000..ed3d7dd Binary files /dev/null and b/templates/fonts/WeatherIcons-Regular.otf differ diff --git a/templates/fonts/weathericons-regular-webfont.eot b/templates/fonts/weathericons-regular-webfont.eot new file mode 100644 index 0000000..3ae46ac Binary files /dev/null and b/templates/fonts/weathericons-regular-webfont.eot differ diff --git a/templates/fonts/weathericons-regular-webfont.svg b/templates/fonts/weathericons-regular-webfont.svg new file mode 100644 index 0000000..224188d --- /dev/null +++ b/templates/fonts/weathericons-regular-webfont.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/fonts/weathericons-regular-webfont.ttf b/templates/fonts/weathericons-regular-webfont.ttf new file mode 100644 index 0000000..8d8a1c4 Binary files /dev/null and b/templates/fonts/weathericons-regular-webfont.ttf differ diff --git a/templates/fonts/weathericons-regular-webfont.woff b/templates/fonts/weathericons-regular-webfont.woff new file mode 100644 index 0000000..87f3070 Binary files /dev/null and b/templates/fonts/weathericons-regular-webfont.woff differ diff --git a/templates/weather.tpl b/templates/weather.tpl new file mode 100644 index 0000000..477096d --- /dev/null +++ b/templates/weather.tpl @@ -0,0 +1,55 @@ +{if $config.useCSS == 1 }{/if} +
+
+

{$weather.city}

+ {if $config.view != "forecast" } +
+
+
+

{$weather.today.desc}

+
+

{$weather.today.temp.now}{$degrees}

+ {if $config.view != "simple" } +
+ {if $config.view == "partial" } +

{$weather.today.day}

+ {/if} + {if $config.view != "partial" } + {if $config.view != "today"}

{$weather.today.day}

{/if} +
    +
  • {$weather.today.sunrise}
  • +
  • {$weather.today.sunset}
  • +
+
    +
  • Max: {$weather.today.temp.max}{$degrees}
  • +
  • Min: {$weather.today.temp.min}{$degrees}
  • +
+
    +
  • {$weather.today.humidity}
  • +
  • {$weather.today.pressure}
  • +
  • {$format_wind}
  • +
+ {/if} +
+ {/if} +
+ {/if} + {if $config.view != "simple" } + {if ($config.view != "today" ) ||($config.view == "forecast") } +
    + + {if $config.view == "forecast" }{assign var=startingIndex value=0}{else}{assign var=startingIndex value=1}{/if} + {section name=i start=$startingIndex loop=$weather.forecast step=1} +
  • {$weather.forecast[i].day} +
      +
    • +
    • {$weather.forecast[i].temp.max}{$degrees}
    • +
    • {$weather.forecast[i].temp.min}{$degrees}
    • +
    +
  • + {/section} +
+ {/if} + {/if} +
+