Awesome Weather Widget - Version 1.5.12

Version Description

  • Fix to API change made by OpenWeatherMap
Download this release

Release Info

Developer halgatewood
Plugin Icon 128x128 Awesome Weather Widget
Version 1.5.12
Comparing to
See all releases

Code changes from version 1.5.11 to 1.5.12

img/awe-backgrounds/awesome-weather-settings.php → awesome-weather-settings.php RENAMED
File without changes
img/awe-backgrounds/awesome-weather-widget-admin.js → awesome-weather-widget-admin.js RENAMED
File without changes
img/awe-backgrounds/awesome-weather.css → awesome-weather.css RENAMED
File without changes
img/awe-backgrounds/awesome-weather.php → awesome-weather.php RENAMED
@@ -5,22 +5,19 @@ Plugin URI: https://halgatewood.com/awesome-weather
5
  Description: A weather widget that actually looks cool
6
  Author: Hal Gatewood
7
  Author URI: https://www.halgatewood.com
8
- Version: 1.5.11
9
  Text Domain: awesome-weather
10
  Domain Path: /languages
11
 
12
 
 
13
  FILTERS AVAILABLE:
14
  https://halgatewood.com/docs/plugins/awesome-weather-widget/available-filters
15
 
16
-
17
- // CLEAR OUT THE TRANSIENT CACHE
18
- add to your URL 'clear_awesome_widget'
19
- For example: http://url.com/?clear_awesome_widget
20
-
21
  */
22
 
23
 
 
24
  // SETTINGS
25
  $awesome_weather_sizes = apply_filters( 'awesome_weather_sizes' , array( 'tall', 'wide' ) );
26
 
@@ -162,7 +159,7 @@ function awesome_weather_logic( $atts )
162
 
163
  // TWO APIS USED (VERSION 2.5)
164
  //http://api.openweathermap.org/data/2.5/weather?q=London,uk&units=metric&cnt=7&lang=fr
165
- //http://api.openweathermap.org/data/2.5/forecast/daily?q=London&units=metric&cnt=7&lang=fr
166
 
167
 
168
  // CLEAR THE TRANSIENT
@@ -208,7 +205,7 @@ function awesome_weather_logic( $atts )
208
 
209
 
210
  // FORECAST
211
- $forecast_ping = "http://api.openweathermap.org/data/2.5/forecast/daily?" . $api_query . "&lang=" . $locale . "&units=" . $units ."&cnt=7" . $appid_string;
212
  $forecast_ping_get = wp_remote_get( $forecast_ping );
213
 
214
  if( is_wp_error( $forecast_ping_get ) )
@@ -216,6 +213,7 @@ function awesome_weather_logic( $atts )
216
  return awesome_weather_error( $forecast_ping_get->get_error_message() );
217
  }
218
 
 
219
  $forecast_data = json_decode( $forecast_ping_get['body'] );
220
 
221
  if( isset($forecast_data->cod) AND $forecast_data->cod == 404 )
@@ -246,11 +244,12 @@ function awesome_weather_logic( $atts )
246
 
247
 
248
  // GET TODAY FROM FORECAST IF AVAILABLE
 
249
  if( isset($weather_data['forecast']) AND isset($weather_data['forecast']->list) AND isset($weather_data['forecast']->list[0]) )
250
- {
251
  $forecast_today = $weather_data['forecast']->list[0];
252
- $today_high = round($forecast_today->temp->max);
253
- $today_low = round($forecast_today->temp->min);
254
  }
255
  else
256
  {
@@ -434,7 +433,7 @@ function awesome_weather_logic( $atts )
434
  foreach( (array) $forecast->list as $forecast )
435
  {
436
  if( $dt_today >= date('Ymd', $forecast->dt)) continue;
437
- $forecast->temp = (int) $forecast->temp->day;
438
  $day_of_week = $days_of_week[ date('w', $forecast->dt) ];
439
  $rtn .= "
440
  <div class=\"awesome-weather-forecast-day\">
5
  Description: A weather widget that actually looks cool
6
  Author: Hal Gatewood
7
  Author URI: https://www.halgatewood.com
8
+ Version: 1.5.12
9
  Text Domain: awesome-weather
10
  Domain Path: /languages
11
 
12
 
13
+ Hi DEVS!
14
  FILTERS AVAILABLE:
15
  https://halgatewood.com/docs/plugins/awesome-weather-widget/available-filters
16
 
 
 
 
 
 
17
  */
18
 
19
 
20
+
21
  // SETTINGS
22
  $awesome_weather_sizes = apply_filters( 'awesome_weather_sizes' , array( 'tall', 'wide' ) );
23
 
159
 
160
  // TWO APIS USED (VERSION 2.5)
161
  //http://api.openweathermap.org/data/2.5/weather?q=London,uk&units=metric&cnt=7&lang=fr
162
+ //http://api.openweathermap.org/data/2.5/forecast?q=London&units=metric&cnt=7&lang=fr
163
 
164
 
165
  // CLEAR THE TRANSIENT
205
 
206
 
207
  // FORECAST
208
+ $forecast_ping = "http://api.openweathermap.org/data/2.5/forecast?" . $api_query . "&lang=" . $locale . "&units=" . $units ."&cnt=7" . $appid_string;
209
  $forecast_ping_get = wp_remote_get( $forecast_ping );
210
 
211
  if( is_wp_error( $forecast_ping_get ) )
213
  return awesome_weather_error( $forecast_ping_get->get_error_message() );
214
  }
215
 
216
+
217
  $forecast_data = json_decode( $forecast_ping_get['body'] );
218
 
219
  if( isset($forecast_data->cod) AND $forecast_data->cod == 404 )
244
 
245
 
246
  // GET TODAY FROM FORECAST IF AVAILABLE
247
+
248
  if( isset($weather_data['forecast']) AND isset($weather_data['forecast']->list) AND isset($weather_data['forecast']->list[0]) )
249
+ {
250
  $forecast_today = $weather_data['forecast']->list[0];
251
+ $today_high = isset($forecast_today->main->temp_max) ? round($forecast_today->main->temp_max) : false;
252
+ $today_low = isset($forecast_today->main->temp_min) ? round($forecast_today->main->temp_min) : false;
253
  }
254
  else
255
  {
433
  foreach( (array) $forecast->list as $forecast )
434
  {
435
  if( $dt_today >= date('Ymd', $forecast->dt)) continue;
436
+ $forecast->temp = (int) $forecast->main->temp;
437
  $day_of_week = $days_of_week[ date('w', $forecast->dt) ];
438
  $rtn .= "
439
  <div class=\"awesome-weather-forecast-day\">
img/awe-backgrounds/readme.txt → readme.txt RENAMED
@@ -91,6 +91,9 @@ The easiest shortcode setting is just: `[awesome-weather location="Oklahoma City
91
 
92
  == Changelog ==
93
 
 
 
 
94
  = 1.5.11 =
95
  * Get just the weather data with function: awesome_weather_data
96
  * trim value of the API key in awe_get_appid
91
 
92
  == Changelog ==
93
 
94
+ = 1.5.12 =
95
+ * Fix to API change made by OpenWeatherMap
96
+
97
  = 1.5.11 =
98
  * Get just the weather data with function: awesome_weather_data
99
  * trim value of the API key in awe_get_appid
img/awe-backgrounds/widget.php → widget.php RENAMED
File without changes