芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/public_html/avenida/views/Weather.tar
OpenWeatherMapProvider.php 0000644 00000046332 14716414562 0011671 0 ustar 00 . */ namespace Xibo\Weather; use GuzzleHttp\Exception\RequestException; use Illuminate\Support\Str; use Jenssegers\Date\Date; use Xibo\Exception\GeneralException; class OpenWeatherMapProvider implements WeatherProvider { use WeatherProviderTrait; private $apiUrl = 'https://api.openweathermap.org/data/2.5/'; private $forecastCurrent = 'weather'; private $forecast3Hourly = 'forecast'; private $forecastDaily = 'forecast/daily'; private $forecastCombined = 'onecall'; private $forecastUv = 'uvi'; /** * @inheritDoc */ public function getAttribution() { return 'Powered by OpenWeather'; } /** @inheritDoc */ public function getCurrentDay() { if ($this->currentDay === null) { $this->get(); } return $this->currentDay; } /** @inheritDoc */ public function getForecast() { if ($this->forecast === null) { $this->get(); } return $this->forecast; } /** * Get a combined forecast * @throws \Xibo\Exception\GeneralException */ private function get() { // Convert units to an acceptable format $units = in_array($this->units, ['auto', 'us', 'uk2']) ? 'imperial' : 'metric'; // Temperature and Wind Speed Unit Mappings $unit = $this->getUnit($this->units); // Build the URL $url = '?lat=' . $this->lat . '&lon=' . $this->long . '&units=' . $units . '&lang=' . $this->lang . '&appid=[API_KEY]'; // Cache expiry date $cacheExpire = Date::now()->addSeconds($this->cachePeriod); if ($this->options['isPaidPlan'] ?? 0 == 1) { // We build our data from multiple API calls // Current data first. $data = $this->queryApi($this->apiUrl . $this->forecastCurrent . $url, $cacheExpire); $data['current'] = $this->parseCurrentIntoFormat($data); $timezoneOffset = (int)$data['timezone'] / 3600; $this->timezone = (new \DateTimeZone(($timezoneOffset < 0 ? '-' : '+') . abs($timezoneOffset)))->getName(); // Pick out the country $country = $data['sys']['country'] ?? null; $this->logger->debug('Trying to determine units for Country: ' . $country); // If we don't have a unit, then can we base it on the timezone we got back? if ($this->units === 'auto' && $country !== null) { // Pick out some countries to set the units if ($country === 'GB') { $unit = $this->getUnit('uk2'); } else if ($country === 'US') { $unit = $this->getUnit('us'); } else if ($country === 'CA') { $unit = $this->getUnit('ca'); } else { $unit = $this->getUnit('si'); } } // Then the 16 day forecast API, which we will cache a day $data['daily'] = $this->queryApi($this->apiUrl . $this->forecastDaily . $url, $cacheExpire->copy()->addDay()->startOfDay())['list']; } else { // We use onecall $data = $this->queryApi($this->apiUrl . $this->forecastCombined . $url, $cacheExpire); $this->timezone = $data['timezone']; // Country based on timezone (this is harder than using the real country) if ($this->units === 'auto') { if (Str::startsWith($this->timezone, 'America')) { $unit = $this->getUnit('us'); } else if ($this->timezone === 'Europe/London') { $unit = $this->getUnit('uk2'); } else { $unit = $this->getUnit('si'); } } } // Using units: $this->logger->debug('Using units: ' . json_encode($unit)); // Parse into our forecast. // Load this data into our objects $this->currentDay = new Forecast(); $this->currentDay->temperatureUnit = $unit['tempUnit'] ?: 'C'; $this->currentDay->windSpeedUnit = $unit['windUnit'] ?: 'KPH'; $this->currentDay->visibilityDistanceUnit = $unit['visibilityUnit'] ?: 'km'; $this->processItemIntoDay($this->currentDay, $data['current'], $units, true); // Process each day into a forecast foreach ($data['daily'] as $dayItem) { $day = new Forecast(); $day->temperatureUnit = $this->currentDay->temperatureUnit; $day->windSpeedUnit = $this->currentDay->windSpeedUnit; $day->visibilityDistanceUnit = $this->currentDay->visibilityDistanceUnit; $this->processItemIntoDay($day, $dayItem, $units); $this->forecast[] = $day; } // Enhance the currently with the high/low from the first daily forecast $this->currentDay->temperatureHigh = $this->forecast[0]->temperatureHigh; $this->currentDay->temperatureMaxRound = $this->forecast[0]->temperatureMaxRound; $this->currentDay->temperatureLow = $this->forecast[0]->temperatureLow; $this->currentDay->temperatureMinRound = $this->forecast[0]->temperatureMinRound; $this->currentDay->temperatureMorning = $this->forecast[0]->temperatureMorning; $this->currentDay->temperatureMorningRound = $this->forecast[0]->temperatureMorningRound; $this->currentDay->temperatureNight = $this->forecast[0]->temperatureNight; $this->currentDay->temperatureNightRound = $this->forecast[0]->temperatureNightRound; $this->currentDay->temperatureEvening = $this->forecast[0]->temperatureEvening; $this->currentDay->temperatureEveningRound = $this->forecast[0]->temperatureEveningRound; $this->currentDay->temperatureMean = $this->forecast[0]->temperatureMean; $this->currentDay->temperatureMeanRound = $this->forecast[0]->temperatureMeanRound; } /** * Parse the response from the current API into the format provided by the onecall API * this means easier processing down the line * @param array $source * @return array */ private function parseCurrentIntoFormat(array $source): array { return [ 'timezone' => $source['timezone'], 'dt' => $source['dt'], 'sunrise' => $source['sys']['sunrise'], 'sunset' => $source['sys']['sunset'], 'temp' => $source['main']['temp'], 'feels_like' => $source['main']['feels_like'], 'pressure' => $source['main']['pressure'], 'humidity' => $source['main']['humidity'], 'dew_point' => null, 'uvi' => null, 'clouds' => $source['clouds']['all'], 'visibility' => $source['visibility'] ?? 0, 'wind_speed' => $source['wind']['speed'], 'wind_deg' => $source['wind']['deg'] ?? 0, 'weather' => $source['weather'], ]; } /** * @param \Xibo\Weather\Forecast $day * @param array $item * @param $requestUnit * @param bool $isCurrent */ private function processItemIntoDay($day, $item, $requestUnit, $isCurrent = false) { $day->time = $item['dt']; $day->sunRise = $item['sunrise']; $day->sunSet = $item['sunset']; $day->summary = ucfirst($item['weather'][0]['description']); // Temperature // imperial = F // metric = C if ($isCurrent) { $day->temperature = $item['temp']; $day->apparentTemperature = $item['feels_like']; $day->temperatureHigh = $day->temperature; $day->temperatureLow = $day->temperature; $day->temperatureNight = $day->temperature; $day->temperatureEvening = $day->temperature; $day->temperatureMorning = $day->temperature; } else { $day->temperature = $item['temp']['day']; $day->apparentTemperature = $item['feels_like']['day']; $day->temperatureHigh = $item['temp']['max'] ?? $day->temperature; $day->temperatureLow = $item['temp']['min'] ?? $day->temperature; $day->temperatureNight = $item['temp']['night']; $day->temperatureEvening = $item['temp']['eve']; $day->temperatureMorning = $item['temp']['morn']; } if ($requestUnit === 'metric' && $day->temperatureUnit === 'F') { // Convert C to F $day->temperature = ($day->temperature) * 9 / 5 + 32; $day->apparentTemperature = ($day->apparentTemperature) * 9 / 5 + 32; $day->temperatureHigh = ($day->temperatureHigh) * 9 / 5 + 32; $day->temperatureLow = ($day->temperatureLow) * 9 / 5 + 32; $day->temperatureNight = ($day->temperatureNight) * 9 / 5 + 32; $day->temperatureEvening = ($day->temperatureEvening) * 9 / 5 + 32; $day->temperatureMorning = ($day->temperatureMorning) * 9 / 5 + 32; } else if ($requestUnit === 'imperial' && $day->temperatureUnit === 'C') { // Convert F to C $day->temperature = ($day->temperature - 32) * 5 / 9; $day->apparentTemperature = ($day->apparentTemperature - 32) * 5 / 9; $day->temperatureHigh = ($day->temperatureHigh - 32) * 5 / 9; $day->temperatureLow = ($day->temperatureLow - 32) * 5 / 9; $day->temperatureNight = ($day->temperatureNight - 32) * 5 / 9; $day->temperatureEvening = ($day->temperatureEvening - 32) * 5 / 9; $day->temperatureMorning = ($day->temperatureMorning - 32) * 5 / 9; } // Work out the mean $day->temperatureMean = ($day->temperatureHigh + $day->temperatureLow) / 2; // Round those off $day->temperatureRound = round($day->temperature, 0); $day->temperatureNightRound = round($day->temperatureNight, 0); $day->temperatureMorningRound = round($day->temperatureMorning, 0); $day->temperatureEveningRound = round($day->temperatureEvening, 0); $day->apparentTemperatureRound = round($day->apparentTemperature, 0); $day->temperatureMaxRound = round($day->temperatureHigh, 0); $day->temperatureMinRound = round($day->temperatureLow, 0); $day->temperatureMeanRound = round($day->temperatureMean, 0); // Humidity $day->humidityPercent = $item['humidity']; $day->humidity = $day->humidityPercent / 100; // Pressure // received in hPa, display in mB $day->pressure = $item['pressure'] / 100; // Wind // metric = meters per second // imperial = miles per hour $day->windSpeed = $item['wind_speed'] ?? $item['speed'] ?? null; $day->windBearing = $item['wind_deg'] ?? $item['deg'] ?? null; if ($requestUnit === 'metric' && $day->windSpeedUnit !== 'MPS') { // We have MPS and need to go to something else if ($day->windSpeedUnit === 'MPH') { // Convert MPS to MPH $day->windSpeed = round($day->windSpeed * 2.237, 2); } else if ($day->windSpeedUnit === 'KPH') { // Convert MPS to KPH $day->windSpeed = round($day->windSpeed * 3.6, 2); } } else if ($requestUnit === 'imperial' && $day->windSpeedUnit !== 'MPH') { if ($day->windSpeedUnit === 'MPS') { // Convert MPH to MPS $day->windSpeed = round($day->windSpeed / 2.237, 2); } else if ($day->windSpeedUnit === 'KPH') { // Convert MPH to KPH $day->windSpeed = round($day->windSpeed * 1.609344, 2); } } // Wind direction if ($day->windBearing !== null && $day->windBearing !== 0) { foreach (self::cardinalDirections() as $dir => $angles) { if ($day->windBearing >= $angles[0] && $day->windBearing < $angles[1]) { $day->windDirection = $dir; break; } } } else { $day->windDirection = '--'; } // Clouds $day->cloudCover = $item['clouds']; // Visibility // metric = meters // imperial = meters? $day->visibility = $item['visibility'] ?? '--'; if ($day->visibility !== '--') { // Always in meters if ($day->visibilityDistanceUnit === 'mi') { // Convert meters to miles $day->visibility = $day->visibility / 1609; } else { if ($day->visibilityDistanceUnit === 'km') { // Convert meters to KM $day->visibility = $day->visibility / 1000; } } } // not available $day->dewPoint = $item['dew_point'] ?? '--'; $day->uvIndex = $item['uvi'] ?? '--'; $day->ozone = '--'; // Map icon $icons = self::iconMap(); $icon = $item['weather'][0]['icon']; $day->icon = $icons['backgrounds'][$icon] ?? 'wi-na'; $day->wicon = $icons['weather-icons'][$icon] ?? 'wi-na'; } /** * @inheritDoc */ public static function supportedLanguages() { return [ ['id' => 'af', 'value' => __('Afrikaans')], ['id' => 'ar', 'value' => __('Arabic')], ['id' => 'az', 'value' => __('Azerbaijani')], ['id' => 'bg', 'value' => __('Bulgarian')], ['id' => 'ca', 'value' => __('Catalan')], ['id' => 'zh_cn', 'value' => __('Chinese Simplified')], ['id' => 'zh_tw', 'value' => __('Chinese Traditional')], ['id' => 'cz', 'value' => __('Czech')], ['id' => 'da', 'value' => __('Danish')], ['id' => 'de', 'value' => __('German')], ['id' => 'el', 'value' => __('Greek')], ['id' => 'en', 'value' => __('English')], ['id' => 'eu', 'value' => __('Basque')], ['id' => 'fa', 'value' => __('Persian (Farsi)')], ['id' => 'fi', 'value' => __('Finnish')], ['id' => 'fr', 'value' => __('French')], ['id' => 'gl', 'value' => __('Galician')], ['id' => 'he', 'value' => __('Hebrew')], ['id' => 'hi', 'value' => __('Hindi')], ['id' => 'hr', 'value' => __('Croatian')], ['id' => 'hu', 'value' => __('Hungarian')], ['id' => 'id', 'value' => __('Indonesian')], ['id' => 'it', 'value' => __('Italian')], ['id' => 'ja', 'value' => __('Japanese')], ['id' => 'kr', 'value' => __('Korean')], ['id' => 'la', 'value' => __('Latvian')], ['id' => 'lt', 'value' => __('Lithuanian')], ['id' => 'mk', 'value' => __('Macedonian')], ['id' => 'no', 'value' => __('Norwegian')], ['id' => 'nl', 'value' => __('Dutch')], ['id' => 'pl', 'value' => __('Polish')], ['id' => 'pt', 'value' => __('Portuguese')], ['id' => 'pt_br', 'value' => __('Português Brasil')], ['id' => 'ro', 'value' => __('Romanian')], ['id' => 'ru', 'value' => __('Russian')], ['id' => 'se', 'value' => __('Swedish')], ['id' => 'sk', 'value' => __('Slovak')], ['id' => 'sl', 'value' => __('Slovenian')], ['id' => 'es', 'value' => __('Spanish')], ['id' => 'sr', 'value' => __('Serbian')], ['id' => 'th', 'value' => __('Thai')], ['id' => 'tr', 'value' => __('Turkish')], ['id' => 'uk', 'value' => __('Ukrainian')], ['id' => 'vi', 'value' => __('Vietnamese')], ['id' => 'zu', 'value' => __('Zulu')] ]; } /** * @return array */ private function iconMap() { return [ 'weather-icons' => [ '01d' => 'wi-day-sunny', '01n' => 'wi-night-clear', '02d' => 'wi-day-cloudy', '02n' => 'wi-night-partly-cloudy', '03d' => 'wi-cloudy', '03n' => 'wi-night-cloudy', '04d' => 'wi-day-cloudy', '04n' => 'wi-night-partly-cloudy', '09d' => 'wi-rain', '09n' => 'wi-night-rain', '10d' => 'wi-rain', '10n' => 'wi-night-rain', '11d' => 'wi-day-thunderstorm', '11n' => 'wi-night-thunderstorm', '13d' => 'wi-day-snow', '13n' => 'wi-night-snow', '50d' => 'wi-day-fog', '50n' => 'wi-night-fog' ], 'backgrounds' => [ '01d' => 'clear-day', '01n' => 'clear-night', '02d' => 'partly-cloudy-day', '02n' => 'partly-cloudy-night', '03d' => 'cloudy', '03n' => 'cloudy', '04d' => 'partly-cloudy-day', '04n' => 'partly-cloudy-night', '09d' => 'rain', '09n' => 'rain', '10d' => 'rain', '10n' => 'rain', '11d' => 'wind', '11n' => 'wind', '13d' => 'snow', '13n' => 'snow', '50d' => 'fog', '50n' => 'fog' ] ]; } /** * @param string $url * @param \Jenssegers\Date\Date $cacheExpiresAt * @return array * @throws \Xibo\Exception\GeneralException */ private function queryApi(string $url, Date $cacheExpiresAt): array { $cache = $this->pool->getItem('/weather/owm/' . md5($url)); $data = $cache->get(); if ($cache->isMiss()) { $cache->lock(); $url = str_replace('[API_KEY]', $this->apiKey, $url); try { $response = $this->client->get($url); // Success? if ($response->getStatusCode() != 200) { throw new GeneralException('Non-200 response from Open Weather Map'); } // Parse out header and body $data = json_decode($response->getBody(), true); // Cache $cache->set($data); $cache->expiresAt($cacheExpiresAt); $this->pool->saveDeferred($cache); } catch (RequestException $e) { $this->logger->error('Unable to reach Open Weather Map API: ' . $e->getMessage()); throw new GeneralException('API responded with an error.'); } } else { $this->logger->debug('Getting Forecast from cache'); } return $data; } } error_log; 0000644 00000061673 14716414562 0006603 0 ustar 00 [16-Sep-2023 11:01:06 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [22-Sep-2023 20:46:25 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [25-Sep-2023 16:09:07 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [25-Sep-2023 16:09:09 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [26-Sep-2023 01:55:08 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [26-Sep-2023 01:55:12 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [27-Sep-2023 00:56:36 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [27-Sep-2023 00:56:39 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [27-Sep-2023 01:09:56 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [27-Sep-2023 01:09:57 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [28-Oct-2023 07:56:30 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [12-Nov-2023 15:56:26 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [12-Nov-2023 15:56:39 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [14-Nov-2023 10:09:49 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [14-Nov-2023 10:09:50 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [14-Nov-2023 13:29:18 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [14-Nov-2023 13:29:33 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [16-Nov-2023 04:45:06 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [16-Nov-2023 04:45:16 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [26-Nov-2023 16:39:04 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [03-Dec-2023 01:21:07 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [03-Jan-2024 21:51:53 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [14-Jan-2024 14:50:36 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [08-Feb-2024 20:50:35 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [11-Feb-2024 03:06:33 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [11-Feb-2024 09:23:59 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [12-Feb-2024 13:56:29 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [19-Feb-2024 23:36:58 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [20-Feb-2024 00:40:57 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [21-Feb-2024 11:24:39 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [21-Feb-2024 11:24:40 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [24-Feb-2024 07:59:27 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [10-Mar-2024 03:08:48 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [03-Apr-2024 00:13:38 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [03-Apr-2024 00:13:39 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [03-Apr-2024 06:09:34 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [03-Apr-2024 17:10:38 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [05-Apr-2024 06:52:52 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [09-Apr-2024 10:01:22 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [15-Apr-2024 19:32:24 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [09-May-2024 14:52:33 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [10-May-2024 10:41:22 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [11-May-2024 05:13:38 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [14-May-2024 07:07:43 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [17-May-2024 11:46:23 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [19-May-2024 00:59:07 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [19-May-2024 00:59:11 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [20-May-2024 03:25:02 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [21-May-2024 10:14:35 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [21-May-2024 10:14:39 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [21-May-2024 11:26:35 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [21-May-2024 11:26:39 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [21-May-2024 12:37:03 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [21-May-2024 12:37:08 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [21-May-2024 14:23:54 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [27-May-2024 07:27:00 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [03-Jun-2024 03:15:07 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [03-Jun-2024 08:59:37 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [08-Jun-2024 17:46:45 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [13-Jun-2024 07:38:30 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [14-Jun-2024 03:13:12 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [20-Jun-2024 06:39:51 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [21-Jun-2024 16:37:12 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [23-Jun-2024 16:37:03 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [23-Jun-2024 18:07:16 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [24-Jun-2024 01:33:55 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [25-Jun-2024 00:33:11 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [26-Jun-2024 05:35:24 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [27-Jun-2024 01:48:01 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [27-Jun-2024 09:03:38 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [28-Jun-2024 22:58:13 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [01-Jul-2024 13:09:13 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [03-Jul-2024 00:01:44 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [03-Jul-2024 00:02:11 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [05-Jul-2024 02:00:10 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [05-Jul-2024 03:11:13 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [05-Jul-2024 08:14:35 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [05-Jul-2024 08:14:38 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [11-Jul-2024 02:07:12 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [11-Jul-2024 03:29:36 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [17-Jul-2024 05:55:53 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [17-Jul-2024 06:30:05 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [17-Jul-2024 10:42:14 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [22-Jul-2024 23:33:26 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [24-Jul-2024 11:12:14 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [24-Jul-2024 11:12:18 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [24-Jul-2024 16:56:54 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [27-Jul-2024 15:14:52 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [27-Jul-2024 18:15:42 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [01-Aug-2024 23:51:37 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [07-Aug-2024 01:57:10 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [07-Aug-2024 06:58:38 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [12-Aug-2024 22:59:54 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [18-Aug-2024 02:59:28 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [18-Aug-2024 08:18:53 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [24-Aug-2024 00:06:49 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [28-Aug-2024 14:40:53 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [03-Sep-2024 04:35:53 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [04-Sep-2024 07:27:14 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [05-Sep-2024 20:43:51 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [12-Sep-2024 15:04:59 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [16-Sep-2024 12:40:57 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [16-Sep-2024 12:40:58 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [16-Sep-2024 13:30:02 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [16-Sep-2024 13:30:06 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [16-Sep-2024 14:22:48 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [16-Sep-2024 14:22:52 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [16-Sep-2024 14:46:35 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [16-Sep-2024 14:46:40 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [18-Sep-2024 19:58:28 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [18-Sep-2024 22:58:18 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [18-Sep-2024 23:13:19 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [19-Sep-2024 05:41:27 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [19-Sep-2024 18:12:00 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [25-Sep-2024 04:59:59 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [30-Sep-2024 12:23:16 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [01-Oct-2024 07:09:23 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [06-Oct-2024 10:07:39 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [08-Oct-2024 16:43:54 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [10-Oct-2024 17:00:07 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [16-Oct-2024 20:42:25 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [17-Oct-2024 01:34:34 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [22-Oct-2024 02:21:17 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [22-Oct-2024 08:50:20 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [02-Nov-2024 18:55:27 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [02-Nov-2024 18:55:31 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [03-Nov-2024 09:11:41 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 [09-Nov-2024 09:37:47 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [11-Nov-2024 17:47:43 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/DarkSkyProvider.php on line 32 [11-Nov-2024 17:47:47 America/Fortaleza] PHP Fatal error: Trait 'Xibo\Weather\WeatherProviderTrait' not found in /home/mgatv524/public_html/edurocha/lib/Weather/OpenWeatherMapProvider.php on line 33 WeatherProviderTrait.php 0000644 00000011210 14716414562 0011400 0 ustar 00 . */ namespace Xibo\Weather; use Psr\Log\NullLogger; use Xibo\Service\LogServiceInterface; trait WeatherProviderTrait { /** @var \Stash\Interfaces\PoolInterface */ protected $pool; /** @var \GuzzleHttp\Client */ protected $client; /** @var \Psr\Log\NullLogger|LogServiceInterface */ protected $logger; /** @var array $options */ protected $options; /** @var string The API Key */ protected $apiKey; protected $cachePeriod = 14400; protected $lat; protected $long; protected $units; protected $lang; /** @var string */ protected $timezone; /** @var \Xibo\Weather\Forecast */ protected $currentDay; /** @var \Xibo\Weather\Forecast[] */ protected $forecast; //
/** * Constructor. * @param \Stash\Interfaces\PoolInterface $pool */ public function __construct($pool) { $this->pool = $pool; $this->logger = new NullLogger(); } /** @inheritDoc */ public function enableLogging($logger) { $this->logger = $logger; return $this; } /** @inheritDoc */ public function setHttpClient($client) { $this->client = $client; return $this; } /** @inheritDoc */ public function setOptions(array $options) { if (isset($options['url'])) { $this->apiUrl = $options['url']; } $this->options = $options; return $this; } /** @inheritDoc */ public function setKey(string $key) { $this->apiKey = $key; return $this; } /** @inheritDoc */ public function setCachePeriod(int $cachePeriod) { $this->cachePeriod = $cachePeriod; return $this; } /** @inheritDoc */ public function setLocation($lat, $long) { $this->logger->debug('setLocation: Lat = ' . $lat . ', Long = ' . $long); $this->lat = $lat; $this->long = $long; return $this; } /** @inheritDoc */ public function setLang($lang) { $this->logger->debug('setLang: Lang = ' . $lang); $this->lang = $lang; return $this; } /** @inheritDoc */ public function setUnits($units) { $this->logger->debug('setUnits: Units = ' . $units); $this->units = $units; return $this; } //
/** * @inheritDoc */ public function getTimezone() { return $this->timezone; } /** @inheritDoc */ public static function unitsAvailable() { return [ ['id' => 'auto', 'value' => 'Automatically select based on geographic location', 'tempUnit' => '', 'windUnit' => '', 'visibilityUnit' => ''], ['id' => 'ca', 'value' => 'Canada', 'tempUnit' => 'C', 'windUnit' => 'KPH', 'visibilityUnit' => 'km'], ['id' => 'si', 'value' => 'Standard International Units', 'tempUnit' => 'C', 'windUnit' => 'MPS', 'visibilityUnit' => 'km'], ['id' => 'uk2', 'value' => 'United Kingdom', 'tempUnit' => 'C', 'windUnit' => 'MPH', 'visibilityUnit' => 'mi'], ['id' => 'us', 'value' => 'United States', 'tempUnit' => 'F', 'windUnit' => 'MPH', 'visibilityUnit' => 'mi'], ]; } /** * @param $code * @return mixed|null */ public function getUnit($code) { foreach (self::unitsAvailable() as $unit) { if ($unit['id'] == $code) { return $unit; } } return null; } /** * @return array */ private static function cardinalDirections() { return [ 'N' => [337.5, 22.5], 'NE' => [22.5, 67.5], 'E' => [67.5, 112.5], 'SE' => [112.5, 157.5], 'S' => [157.5, 202.5], 'SW' => [202.5, 247.5], 'W' => [247.5, 292.5], 'NW' => [292.5, 337.5] ]; } } WeatherProvider.php 0000644 00000005043 14716414562 0010403 0 ustar 00 . */ namespace Xibo\Weather; use Xibo\Service\LogServiceInterface; interface WeatherProvider { /** * @param \Psr\Log\NullLogger|LogServiceInterface $logger * @return $this */ public function enableLogging($logger); /** * @param \GuzzleHttp\ClientInterface $client * @return $this */ public function setHttpClient($client); /** * @param array $options * @return $this */ public function setOptions(array $options); /** * @param string $key * @return $this */ public function setKey(string $key); /** * @param int $cachePeriod * @return $this */ public function setCachePeriod(int $cachePeriod); /** * @param $lat * @param $long * @return $this */ public function setLocation($lat, $long); /** * @param $lang * @return $this */ public function setLang($lang); /** * @param $units * @return $this */ public function setUnits($units); /** * @return string */ public function getAttribution(); /** * @return \Xibo\Weather\Forecast * @throws \Xibo\Exception\GeneralException */ public function getCurrentDay(); /** * @return \Xibo\Weather\Forecast[] * @throws \Xibo\Exception\GeneralException */ public function getForecast(); /** * Get TimeZone * @return string */ public function getTimezone(); /** * Units supported by Forecast.IO API * @return array The Units Available (temperature, wind speed and visible distance) */ public static function unitsAvailable(); /** * Languages supported by Forecast.IO API * @return array The Supported Language */ public static function supportedLanguages(); } DarkSkyProvider.php 0000644 00000024041 14716414562 0010353 0 ustar 00 . */ namespace Xibo\Weather; use GuzzleHttp\Exception\RequestException; use Xibo\Exception\GeneralException; class DarkSkyProvider implements WeatherProvider { // Use a trait to provide the basic provider functions use WeatherProviderTrait; protected $apiUrl = 'https://api.darksky.net/forecast/'; /** @inheritDoc */ public function getAttribution() { return 'Powered by DarkSky'; } /** @inheritDoc */ public function getCurrentDay() { if ($this->currentDay === null) { $this->get(); } return $this->currentDay; } /** @inheritDoc */ public function getForecast() { if ($this->forecast === null) { $this->get(); } return $this->forecast; } /** * Get the body for our API response. * @throws \Xibo\Exception\GeneralException */ private function get() { $url = $this->apiUrl . '[API_KEY]' . '/' . $this->lat . ',' . $this->long . '?exclude=minutely,hourly' . '&units=' . $this->units . '&lang=' . $this->lang ; $cache = $this->pool->getItem('/weather/darksky/' . md5($url)); $data = $cache->get(); if ($cache->isMiss()) { $cache->lock(); $this->logger->debug('Calling API with: ' . $url); $url = str_replace('[API_KEY]', $this->apiKey, $url); try { $response = $this->client->get($url); // Success? if ($response->getStatusCode() != 200) { $this->logger->error('DarkSky API returned ' . $response->getStatusCode() . ' status. Unable to proceed. Headers' . var_export($response->getHeaders(), true)); // See if we can parse the error. $body = json_decode($response->getBody()); $error = ((isset($body->errors[0])) ? $body->errors[0]->message : 'Unknown Error'); $this->logger->error('DarkSky Error: ' . $error); throw new GeneralException($error); } // Parse out header and body $data = json_decode($response->getBody(), true); // Cache $cache->set($data); $cache->expiresAfter($this->cachePeriod); $this->pool->saveDeferred($cache); } catch (RequestException $e) { $this->logger->error('Unable to reach DarkSky API: ' . $e->getMessage()); throw new GeneralException($e->getMessage()); } } else { $this->logger->debug('Getting Forecast from cache'); } // Set the Timezone $this->timezone = $data['timezone']; // Temperature and Wind Speed Unit Mappings $unit = $this->getUnit($this->units); $temperatureUnit = $unit['tempUnit'] ?? 'C'; $windSpeedUnit = $unit['windUnit'] ?? 'KPH'; $visibilityDistanceUnit = $unit['visibilityUnit'] ?? 'km'; // Load this data into our objects $this->currentDay = new Forecast(); $this->currentDay->temperatureUnit = $temperatureUnit; $this->currentDay->windSpeedUnit = $windSpeedUnit; $this->currentDay->visibilityDistanceUnit = $visibilityDistanceUnit; $this->processItemIntoDay($this->currentDay, $data['currently']); // Process each day into a forecast foreach ($data['daily']['data'] as $dayItem) { $day = new Forecast(); $day->temperatureUnit = $temperatureUnit; $day->windSpeedUnit = $windSpeedUnit; $day->visibilityDistanceUnit = $visibilityDistanceUnit; $this->processItemIntoDay($day, $dayItem); $this->forecast[] = $day; } // Enhance the currently with the high/low from the first daily forecast $this->currentDay->temperatureHigh = $this->forecast[0]->temperatureHigh; $this->currentDay->temperatureMaxRound = $this->forecast[0]->temperatureMaxRound; $this->currentDay->temperatureLow = $this->forecast[0]->temperatureLow; $this->currentDay->temperatureMinRound = $this->forecast[0]->temperatureMinRound; } /** * Process an item into a Day * @param \Xibo\Weather\Forecast $day * @param array $item */ private function processItemIntoDay($day, $item) { $day->time = $item['time']; $day->summary = $item['summary']; $day->icon = $item['icon']; $day->temperature = $item['temperature'] ?? ($item['temperatureHigh'] + $item['temperatureLow']) / 2; $day->temperatureRound = round($day->temperature, 0); $day->apparentTemperature = $item['apparentTemperature'] ?? ($item['apparentTemperatureHigh'] + $item['apparentTemperatureLow']) / 2; $day->apparentTemperatureRound = round($day->apparentTemperature, 0); $day->temperatureHigh = $item['temperatureHigh'] ?? $day->temperature; $day->temperatureMaxRound = round($day->temperatureHigh, 0); $day->temperatureLow = $item['temperatureLow'] ?? $day->temperature; $day->temperatureMinRound = round($day->temperatureLow, 0); $day->temperatureMean = ($day->temperatureHigh + $day->temperatureLow) / 2; $day->temperatureMeanRound = round($day->temperatureMean, 2); $day->dewPoint = $item['dewPoint']; $day->humidity = $item['humidity']; $day->humidityPercent = $day->humidity * 100; $day->pressure = $item['pressure']; $day->windSpeed = $item['windSpeed']; $day->windBearing = $item['windBearing']; $day->cloudCover = $item['cloudCover']; $day->uvIndex = $item['uvIndex']; $day->visibility = $item['visibility']; $day->ozone = $item['ozone']; // Items we dont have $day->temperatureNight = $day->temperature; $day->temperatureNightRound = $day->temperatureRound; $day->temperatureMorning = $day->temperature; $day->temperatureMorningRound = $day->temperatureRound; $day->temperatureEvening = $day->temperature; $day->temperatureEveningRound = $day->temperatureRound; // Wind direction foreach (self::cardinalDirections() as $dir => $angles) { if ($day->windBearing >= $angles[0] && $day->windBearing < $angles[1]) { $day->windDirection = $dir; break; } } // Map icon $icons = $this->iconMap(); $day->wicon = $icons[$item['icon']] ?? $icons['unmapped']; } /** @inheritDoc */ public static function supportedLanguages() { return [ ['id' => 'ar', 'value' => __('Arabic')], ['id' => 'az', 'value' => __('Azerbaijani')], ['id' => 'be', 'value' => __('Belarusian')], ['id' => 'bs', 'value' => __('Bosnian')], ['id' => 'bg', 'value' => __('Bulgarian')], ['id' => 'ca', 'value' => __('Catalan')], ['id' => 'kw', 'value' => __('Cornish')], ['id' => 'zh', 'value' => __('Simplified Chinese')], ['id' => 'zh-tw', 'value' => __('Traditional Chinese')], ['id' => 'hr', 'value' => __('Croatian')], ['id' => 'cs', 'value' => __('Czech')], ['id' => 'da', 'value' => __('Danish')], ['id' => 'nl', 'value' => __('Dutch')], ['id' => 'ka', 'value' => __('Georgian')], ['id' => 'de', 'value' => __('German')], ['id' => 'el', 'value' => __('Greek')], ['id' => 'en', 'value' => __('English')], ['id' => 'et', 'value' => __('Estonian')], ['id' => 'fi', 'value' => __('Finnish')], ['id' => 'fr', 'value' => __('French')], ['id' => 'hu', 'value' => __('Hungarian')], ['id' => 'is', 'value' => __('Icelandic')], ['id' => 'id', 'value' => __('Indonesian')], ['id' => 'it', 'value' => __('Italian')], ['id' => 'ja', 'value' => __('Japanese')], ['id' => 'nb', 'value' => __('Norwegian Bokmål')], ['id' => 'pl', 'value' => __('Polish')], ['id' => 'pt', 'value' => __('Portuguese')], ['id' => 'ru', 'value' => __('Russian')], ['id' => 'sr', 'value' => __('Serbian')], ['id' => 'sk', 'value' => __('Slovak')], ['id' => 'sl', 'value' => __('Slovenian')], ['id' => 'es', 'value' => __('Spanish')], ['id' => 'sv', 'value' => __('Swedish')], ['id' => 'tet', 'value' => __('Tetum')], ['id' => 'tr', 'value' => __('Turkish')], ['id' => 'uk', 'value' => __('Ukrainian')], ['id' => 'x-pig-latin', 'value' => __('lgpay Atinlay')] ]; } /** * @return array */ private function iconMap() { return [ 'unmapped' => 'wi-alien', 'clear-day' => 'wi-day-sunny', 'clear-night' => 'wi-night-clear', 'rain' => 'wi-rain', 'snow' => 'wi-snow', 'sleet' => 'wi-hail', 'wind' => 'wi-windy', 'fog' => 'wi-fog', 'cloudy' => 'wi-cloudy', 'partly-cloudy-day' => 'wi-day-cloudy', 'partly-cloudy-night' => 'wi-night-partly-cloudy', ]; } } Forecast.php 0000644 00000003600 14716414562 0007034 0 ustar 00 . */ namespace Xibo\Weather; /** * Class Forecast * this class represents a weather forecast, either current or future. * @package Xibo\Weather */ class Forecast { public $time; public $sunSet; public $sunRise; public $summary; public $icon; public $wicon; public $temperature; public $temperatureRound; public $temperatureNight; public $temperatureNightRound; public $temperatureMorning; public $temperatureMorningRound; public $temperatureEvening; public $temperatureEveningRound; public $temperatureHigh; public $temperatureMaxRound; public $temperatureLow; public $temperatureMinRound; public $temperatureMean; public $temperatureMeanRound; public $apparentTemperature; public $apparentTemperatureRound; public $dewPoint; public $humidity; public $humidityPercent; public $pressure; public $windSpeed; public $windBearing; public $windDirection; public $cloudCover; public $uvIndex; public $visibility; public $ozone; public $temperatureUnit; public $windSpeedUnit; public $visibilityDistanceUnit; }