Awesome Weather Widget - Version 1.5

Version Description

  • You can now speed up your weather and provide better accuracy by using the new Search box in the widget to find the OpenWeatherMap City ID.
  • We also added the ability to use different background images by weather. Also new CSS properties using the weather condition code and text are added so you can target based on weather type.
  • Added several new filters to modify aspects of the weather widget like changing the C and F to a Degree symbol.
  • Fixed an issue where changing the forecast days would not clear the cache.
  • Default cache is now 30 minutes
Download this release

Release Info

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

Code changes from version 1.4.3.3 to 1.5

awesome-weather-widget.js ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ // SEARCH FOR LOCATION ID
4
+ jQuery(document).ready(function()
5
+ {
6
+
7
+ jQuery(document.body).on('keyup', '.awe-location-search-field-openweathermaps', _.debounce( function()
8
+ {
9
+ if( jQuery(this).val() != "")
10
+ {
11
+ var units_val = jQuery('#c-' + jQuery(this).data('unitsfield')).prop('checked') ? "f" : "c";
12
+ var location_id = jQuery(this).attr('id');
13
+ var owm_city_id_selector = "#" + jQuery(this).data('cityidfield');
14
+
15
+ jQuery('#awe-owm-spinner-' + location_id).removeClass("hidden");
16
+
17
+ // PING
18
+ var data = { action: 'awe_ping_owm_for_id', location: jQuery(this).val(), units: units_val };
19
+ jQuery.getJSON(ajaxurl, data, function(response)
20
+ {
21
+ var place_count = response.count;
22
+ var places = response.list;
23
+
24
+ jQuery( owm_city_id_selector ).val( '' );
25
+
26
+ // IF NO PLACES DISPLAY AN ERROR
27
+ if( !places )
28
+ {
29
+ jQuery('#owmid-selector-' + location_id).html( "<span style='color:red;'>" + awe_script.no_owm_city + "</span>");
30
+ }
31
+ else
32
+ {
33
+ if(place_count == 1)
34
+ {
35
+ jQuery( owm_city_id_selector ).val( places[0].id );
36
+ jQuery( '#owmid-selector-' + location_id ).html( "<span style='color:red;'>" + awe_script.one_city_found + "</span>" );
37
+ }
38
+ else
39
+ {
40
+ var rtn = awe_script.confirm_city;
41
+
42
+ for( p = 0; p < places.length; p++)
43
+ {
44
+ if( places[p].id && places[p].id != 0 )
45
+ {
46
+ // SET TO FIRST
47
+ if(p == 0)
48
+ {
49
+ jQuery( owm_city_id_selector ).val( places[p].id );
50
+ }
51
+
52
+ rtn = rtn + "<div style='padding: 5px 5px 0 10px;'> - <a href='javascript:;' onclick=\"jQuery('" + owm_city_id_selector + "').val(" + places[p].id + ");\" style='text-decoration:none;'>" + places[p].name + ", " + places[p].sys.country + " ( " + places[p].id + " )</a></div>";
53
+ }
54
+ }
55
+ jQuery('#owmid-selector-' + location_id).html( rtn );
56
+ }
57
+ }
58
+ jQuery('#awe-owm-spinner-' + location_id).addClass("hidden");
59
+ });
60
+ }
61
+ }, 350));
62
+ });
awesome-weather.css CHANGED
@@ -5,7 +5,7 @@
5
  .awesome-weather-wrap {
6
  background: #333; transition: background 0.5s ease-in;
7
  font-family: 'Open Sans', sans-serif; font-weight: 400; font-size: 14px; line-height: 14px;
8
- text-shadow: 0 1px 1px rgba(0,0,0,0.3); color: #fff;
9
  clear: both;
10
  }
11
 
@@ -15,7 +15,7 @@
15
  box-sizing: border-box;
16
  }
17
 
18
- .awesome-weather-wrap.darken { text-shadow: 0 1px 1px rgba(0,0,0,0.9); }
19
 
20
  .awesome-weather-wrap.temp1 { background: #43adff; }
21
  .awesome-weather-wrap.temp2 { background: #629BE0; }
@@ -96,3 +96,5 @@
96
  .awesome-weather-more-weather-link { padding: 10px; text-align: center; border-top: solid 1px rgba(255,255,255,0.5); }
97
  .awesome-weather-more-weather-link a { color: #fff !important; text-decoration: none !important; font-size: 0.8em; }
98
 
 
 
5
  .awesome-weather-wrap {
6
  background: #333; transition: background 0.5s ease-in;
7
  font-family: 'Open Sans', sans-serif; font-weight: 400; font-size: 14px; line-height: 14px;
8
+ text-shadow: 0 1px 2px rgba(0,0,0,0.5); color: #fff;
9
  clear: both;
10
  }
11
 
15
  box-sizing: border-box;
16
  }
17
 
18
+ .awesome-weather-wrap.darken { text-shadow: 0 1px 2px rgba(0,0,0,0.9); }
19
 
20
  .awesome-weather-wrap.temp1 { background: #43adff; }
21
  .awesome-weather-wrap.temp2 { background: #629BE0; }
96
  .awesome-weather-more-weather-link { padding: 10px; text-align: center; border-top: solid 1px rgba(255,255,255,0.5); }
97
  .awesome-weather-more-weather-link a { color: #fff !important; text-decoration: none !important; font-size: 0.8em; }
98
 
99
+ /* ERROR */
100
+ div.awesome-weather-error { color: #ed7469; font-weight: bold; display: block; padding: 10px; text-align: center; border: solid 1px #ed7469; text-transform: uppercase; }
awesome-weather.php CHANGED
@@ -5,16 +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.4.3.3
9
  Text Domain: awesome-weather
10
  Domain Path: /languages
11
 
12
 
13
  FILTERS AVAILABLE:
14
- awesome_weather_cache = How many seconds to cache weather: default 3600 (one hour).
15
  awesome_weather_error = Error message if weather is not found.
16
  awesome_weather_sizes = array of sizes for widget
17
  awesome_weather_extended_forecast_text = Change text of footer link
 
 
 
18
 
19
 
20
  // CLEAR OUT THE TRANSIENT CACHE
@@ -46,6 +49,13 @@ function awesome_weather_wp_head( $posts )
46
  }
47
  add_action('wp_enqueue_scripts', 'awesome_weather_wp_head');
48
 
 
 
 
 
 
 
 
49
 
50
  //THE SHORTCODE
51
  add_shortcode( 'awesome-weather', 'awesome_weather_shortcode' );
@@ -60,20 +70,22 @@ function awesome_weather_logic( $atts )
60
  {
61
  global $awesome_weather_sizes;
62
 
63
- $rtn = "";
64
- $weather_data = array();
65
- $location = isset($atts['location']) ? $atts['location'] : false;
66
- $size = (isset($atts['size']) AND $atts['size'] == "tall") ? 'tall' : 'wide';
67
- $units = (isset($atts['units']) AND strtoupper($atts['units']) == "C") ? "metric" : "imperial";
68
- $units_display = $units == "metric" ? __('C', 'awesome-weather') : __('F', 'awesome-weather');
69
- $override_title = isset($atts['override_title']) ? $atts['override_title'] : false;
70
- $days_to_show = isset($atts['forecast_days']) ? $atts['forecast_days'] : 5;
71
- $show_stats = (isset($atts['hide_stats']) AND $atts['hide_stats'] == 1) ? 0 : 1;
72
- $show_link = (isset($atts['show_link']) AND $atts['show_link'] == 1) ? 1 : 0;
73
- $background = isset($atts['background']) ? $atts['background'] : false;
74
- $custom_bg_color = isset($atts['custom_bg_color']) ? $atts['custom_bg_color'] : false;
75
- $inline_style = isset($atts['inline_style']) ? $atts['inline_style'] : '';
76
- $locale = 'en';
 
 
77
 
78
  $sytem_locale = get_locale();
79
  $available_locales = array( 'en', 'es', 'sp', 'fr', 'it', 'de', 'pt', 'ro', 'pl', 'ru', 'uk', 'ua', 'fi', 'nl', 'bg', 'sv', 'se', 'ca', 'tr', 'hr', 'zh', 'zh_tw', 'zh_cn' );
@@ -97,9 +109,14 @@ function awesome_weather_logic( $atts )
97
 
98
 
99
  //FIND AND CACHE CITY ID
100
- if( is_numeric($location) )
 
 
 
 
 
101
  {
102
- $city_name_slug = $location;
103
  $api_query = "id=" . $location;
104
  }
105
  else
@@ -110,7 +127,7 @@ function awesome_weather_logic( $atts )
110
 
111
 
112
  // TRANSIENT NAME
113
- $weather_transient_name = 'awe_' . $city_name_slug . "_" . strtolower($units) . '_' . $locale;
114
 
115
 
116
  // TWO APIS USED (VERSION 2.5)
@@ -124,6 +141,14 @@ function awesome_weather_logic( $atts )
124
  delete_transient( $weather_transient_name );
125
  }
126
 
 
 
 
 
 
 
 
 
127
 
128
  // GET WEATHER DATA
129
  if( get_transient( $weather_transient_name ) )
@@ -136,7 +161,8 @@ function awesome_weather_logic( $atts )
136
  $weather_data['forecast'] = array();
137
 
138
  // NOW
139
- $now_ping = "http://api.openweathermap.org/data/2.5/weather?" . $api_query . "&lang=" . $locale . "&units=" . $units;
 
140
  $now_ping_get = wp_remote_get( $now_ping );
141
 
142
  if( is_wp_error( $now_ping_get ) )
@@ -159,7 +185,7 @@ function awesome_weather_logic( $atts )
159
  // FORECAST
160
  if( $days_to_show != "hide" )
161
  {
162
- $forecast_ping = "http://api.openweathermap.org/data/2.5/forecast/daily?" . $api_query . "&lang=" . $locale . "&units=" . $units ."&cnt=7";
163
  $forecast_ping_get = wp_remote_get( $forecast_ping );
164
 
165
  if( is_wp_error( $forecast_ping_get ) )
@@ -182,7 +208,7 @@ function awesome_weather_logic( $atts )
182
  if($weather_data['now'] OR $weather_data['forecast'])
183
  {
184
  // SET THE TRANSIENT, CACHE FOR A LITTLE OVER THREE HOURS
185
- set_transient( $weather_transient_name, $weather_data, apply_filters( 'awesome_weather_cache', 11000 ) );
186
  }
187
  }
188
 
@@ -198,33 +224,42 @@ function awesome_weather_logic( $atts )
198
  $today_high = round($today->main->temp_max);
199
  $today_low = round($today->main->temp_min);
200
 
 
 
 
 
 
 
 
201
  if( $custom_bg_color )
202
  {
203
  if( substr(trim($custom_bg_color), 0, 1) != "#" AND substr(trim(strtolower($custom_bg_color)), 0, 3) != "rgb" ) { $custom_bg_color = "#" . $custom_bg_color; }
204
  $inline_style .= "background-color: {$custom_bg_color};";
205
- $bg_color = "custom";
206
  }
207
  else
208
  {
209
  // COLOR OF WIDGET
210
- $bg_color = "temp1";
211
- if($units_display == "F")
212
  {
213
- if($today_temp > 31 AND $today_temp < 40) $bg_color = "temp2";
214
- if($today_temp >= 40 AND $today_temp < 50) $bg_color = "temp3";
215
- if($today_temp >= 50 AND $today_temp < 60) $bg_color = "temp4";
216
- if($today_temp >= 60 AND $today_temp < 80) $bg_color = "temp5";
217
- if($today_temp >= 80 AND $today_temp < 90) $bg_color = "temp6";
218
- if($today_temp >= 90) $bg_color = "temp7";
 
219
  }
220
  else
221
  {
222
- if($today_temp > 1 AND $today_temp < 4) $bg_color = "temp2";
223
- if($today_temp >= 4 AND $today_temp < 10) $bg_color = "temp3";
224
- if($today_temp >= 10 AND $today_temp < 15) $bg_color = "temp4";
225
- if($today_temp >= 15 AND $today_temp < 26) $bg_color = "temp5";
226
- if($today_temp >= 26 AND $today_temp < 32) $bg_color = "temp6";
227
- if($today_temp >= 32) $bg_color = "temp7";
 
228
  }
229
  }
230
 
@@ -255,33 +290,93 @@ function awesome_weather_logic( $atts )
255
 
256
  $wind_direction = $wind_label[ fmod((($today->wind->deg + 11) / 22.5),16) ];
257
 
258
- $show_stats_class = ($show_stats) ? "awe_with_stats" : "awe_without_stats";
 
 
 
 
 
 
 
 
 
 
 
259
 
260
- if($background) $bg_color = "darken";
261
 
262
- if($inline_style != "")
 
263
  {
264
- $inline_style = " style=\"{$inline_style}\"";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  }
266
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  // DISPLAY WIDGET
268
  $rtn .= "
269
 
270
- <div id=\"awesome-weather-{$city_name_slug}\" class=\"awesome-weather-wrap awecf {$bg_color} {$show_stats_class} awe_{$size}\"{$inline_style}>
271
  ";
272
 
273
 
274
  if($background)
275
  {
276
  $rtn .= "<div class=\"awesome-weather-cover\" style='background-image: url($background);'>";
277
- $rtn .= "<div class=\"awesome-weather-darken\">";
278
  }
279
 
280
  $rtn .= "
281
  <div class=\"awesome-weather-header\">{$header_title}</div>
282
 
283
  <div class=\"awesome-weather-current-temp\">
284
- $today_temp<sup>{$units_display}</sup>
285
  </div> <!-- /.awesome-weather-current-temp -->
286
  ";
287
 
@@ -289,7 +384,6 @@ function awesome_weather_logic( $atts )
289
  {
290
  $speed_text = ($units == "metric") ? __('km/h', 'awesome-weather') : __('mph', 'awesome-weather');
291
 
292
-
293
  $rtn .= "
294
 
295
  <div class=\"awesome-weather-todays-stats\">
@@ -318,7 +412,7 @@ function awesome_weather_logic( $atts )
318
  $day_of_week = $days_of_week[ date('w', $forecast->dt) ];
319
  $rtn .= "
320
  <div class=\"awesome-weather-forecast-day\">
321
- <div class=\"awesome-weather-forecast-day-temp\">{$forecast->temp}<sup>{$units_display}</sup></div>
322
  <div class=\"awesome-weather-forecast-day-abbr\">$day_of_week</div>
323
  </div>
324
  ";
@@ -339,8 +433,8 @@ function awesome_weather_logic( $atts )
339
 
340
  if($background)
341
  {
 
342
  $rtn .= "</div> <!-- /.awesome-weather-cover -->";
343
- $rtn .= "</div> <!-- /.awesome-weather-darken -->";
344
  }
345
 
346
  $rtn .= "</div> <!-- /.awesome-weather-wrap -->";
@@ -352,10 +446,34 @@ function awesome_weather_logic( $atts )
352
  function awesome_weather_error( $msg = false )
353
  {
354
  if(!$msg) $msg = __('No weather information available', 'awesome-weather');
355
- return apply_filters( 'awesome_weather_error', "<!-- AWESOME WEATHER ERROR: " . $msg . " -->" );
 
 
 
 
 
 
 
 
 
356
  }
357
 
358
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
 
360
  // AWESOME WEATHER WIDGET, WIDGET CLASS, SO MANY WIDGETS
361
  class AwesomeWeatherWidget extends WP_Widget
@@ -366,36 +484,52 @@ class AwesomeWeatherWidget extends WP_Widget
366
  {
367
  extract( $args );
368
 
369
- $location = isset($instance['location']) ? $instance['location'] : false;
370
- $override_title = isset($instance['override_title']) ? $instance['override_title'] : false;
371
- $widget_title = isset($instance['widget_title']) ? $instance['widget_title'] : false;
372
- $units = isset($instance['units']) ? $instance['units'] : false;
373
- $size = isset($instance['size']) ? $instance['size'] : false;
374
- $forecast_days = isset($instance['forecast_days']) ? $instance['forecast_days'] : false;
375
- $hide_stats = (isset($instance['hide_stats']) AND $instance['hide_stats'] == 1) ? 1 : 0;
376
- $show_link = (isset($instance['show_link']) AND $instance['show_link'] == 1) ? 1 : 0;
377
- $background = isset($instance['background']) ? $instance['background'] : false;
378
- $custom_bg_color = isset($instance['custom_bg_color']) ? $instance['custom_bg_color'] : false;
 
 
379
 
380
  echo $before_widget;
381
  if($widget_title != "") echo $before_title . $widget_title . $after_title;
382
- echo awesome_weather_logic( array( 'location' => $location, 'override_title' => $override_title, 'size' => $size, 'units' => $units, 'forecast_days' => $forecast_days, 'hide_stats' => $hide_stats, 'show_link' => $show_link, 'background' => $background, 'custom_bg_color' => $custom_bg_color ));
 
 
 
 
 
 
 
 
 
 
 
 
383
  echo $after_widget;
384
  }
385
 
386
  function update($new_instance, $old_instance)
387
  {
388
  $instance = $old_instance;
389
- $instance['location'] = strip_tags($new_instance['location']);
390
- $instance['override_title'] = strip_tags($new_instance['override_title']);
391
- $instance['widget_title'] = strip_tags($new_instance['widget_title']);
392
- $instance['units'] = strip_tags($new_instance['units']);
393
- $instance['size'] = strip_tags($new_instance['size']);
394
- $instance['forecast_days'] = strip_tags($new_instance['forecast_days']);
395
- $instance['background'] = strip_tags($new_instance['background']);
396
- $instance['custom_bg_color'] = strip_tags($new_instance['custom_bg_color']);
397
- $instance['hide_stats'] = (isset($new_instance['hide_stats']) AND $new_instance['hide_stats'] == 1) ? 1 : 0;
398
- $instance['show_link'] = (isset($new_instance['show_link']) AND $new_instance['show_link'] == 1) ? 1 : 0;
 
 
399
  return $instance;
400
  }
401
 
@@ -403,25 +537,42 @@ class AwesomeWeatherWidget extends WP_Widget
403
  {
404
  global $awesome_weather_sizes;
405
 
406
- $location = isset($instance['location']) ? esc_attr($instance['location']) : "";
407
- $override_title = isset($instance['override_title']) ? esc_attr($instance['override_title']) : "";
408
- $widget_title = isset($instance['widget_title']) ? esc_attr($instance['widget_title']) : "";
409
- $selected_size = isset($instance['size']) ? esc_attr($instance['size']) : "wide";
410
- $units = (isset($instance['units']) AND strtoupper($instance['units']) == "C") ? "C" : "F";
411
- $forecast_days = isset($instance['forecast_days']) ? esc_attr($instance['forecast_days']) : 5;
412
- $hide_stats = (isset($instance['hide_stats']) AND $instance['hide_stats'] == 1) ? 1 : 0;
413
- $show_link = (isset($instance['show_link']) AND $instance['show_link'] == 1) ? 1 : 0;
414
- $background = isset($instance['background']) ? esc_attr($instance['background']) : "";
415
- $custom_bg_color = isset($instance['custom_bg_color']) ? esc_attr($instance['custom_bg_color']) : "";
 
 
416
  ?>
417
  <p>
418
  <label for="<?php echo $this->get_field_id('location'); ?>">
419
- <?php _e('Location:', 'awesome-weather'); ?><br />
420
  <small><?php _e('(i.e: London,UK or New York City,NY)', 'awesome-weather'); ?></small>
421
  </label>
422
- <input class="widefat" style="margin-top: 4px;" id="<?php echo $this->get_field_id('location'); ?>" name="<?php echo $this->get_field_name('location'); ?>" type="text" value="<?php echo $location; ?>" />
423
  </p>
424
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
425
  <p>
426
  <label for="<?php echo $this->get_field_id('override_title'); ?>"><?php _e('Override Title:', 'awesome-weather'); ?></label>
427
  <input class="widefat" id="<?php echo $this->get_field_id('override_title'); ?>" name="<?php echo $this->get_field_name('override_title'); ?>" type="text" value="<?php echo $override_title; ?>" />
@@ -459,6 +610,11 @@ class AwesomeWeatherWidget extends WP_Widget
459
  <input class="widefat" id="<?php echo $this->get_field_id('background'); ?>" name="<?php echo $this->get_field_name('background'); ?>" type="text" value="<?php echo $background; ?>" />
460
  </p>
461
 
 
 
 
 
 
462
  <p>
463
  <label for="<?php echo $this->get_field_id('custom_bg_color'); ?>"><?php _e('Custom Background Color:', 'awesome-weather'); ?></label><br />
464
  <small><?php _e('overrides color changing', 'awesome-weather'); ?>: #7fb761 or rgba(0,0,0,0.5)</small>
@@ -466,13 +622,14 @@ class AwesomeWeatherWidget extends WP_Widget
466
  </p>
467
 
468
  <p>
469
- <label for="<?php echo $this->get_field_id('hide_stats'); ?>"><?php _e('Hide Stats:', 'awesome-weather'); ?></label> &nbsp;
470
  <input id="<?php echo $this->get_field_id('hide_stats'); ?>" name="<?php echo $this->get_field_name('hide_stats'); ?>" type="checkbox" value="1" <?php if($hide_stats) echo ' checked="checked"'; ?> />
 
 
471
  </p>
472
 
473
  <p>
474
- <label for="<?php echo $this->get_field_id('show_link'); ?>"><?php _e('Link to OpenWeatherMap:', 'awesome-weather'); ?></label> &nbsp;
475
  <input id="<?php echo $this->get_field_id('show_link'); ?>" name="<?php echo $this->get_field_name('show_link'); ?>" type="checkbox" value="1" <?php if($show_link) echo ' checked="checked"'; ?> />
 
476
  </p>
477
 
478
  <p>
@@ -483,4 +640,22 @@ class AwesomeWeatherWidget extends WP_Widget
483
  }
484
  }
485
 
486
- add_action( 'widgets_init', create_function('', 'return register_widget("AwesomeWeatherWidget");') );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  Description: A weather widget that actually looks cool
6
  Author: Hal Gatewood
7
  Author URI: https://www.halgatewood.com
8
+ Version: 1.5
9
  Text Domain: awesome-weather
10
  Domain Path: /languages
11
 
12
 
13
  FILTERS AVAILABLE:
14
+ awesome_weather_cache = How many seconds to cache weather: default 1800 (30 minutes).
15
  awesome_weather_error = Error message if weather is not found.
16
  awesome_weather_sizes = array of sizes for widget
17
  awesome_weather_extended_forecast_text = Change text of footer link
18
+ awesome_weather_appid = OpenWeatherMap APPID, improves support
19
+ awesome_weather_units_display = Change the F or C to &deg; or something
20
+ awesome_weather_background_classes = Add or change the background classes before they display
21
 
22
 
23
  // CLEAR OUT THE TRANSIENT CACHE
49
  }
50
  add_action('wp_enqueue_scripts', 'awesome_weather_wp_head');
51
 
52
+ function awesome_weather_wp_admin_head( )
53
+ {
54
+ wp_enqueue_script('jquery');
55
+ wp_enqueue_script('underscore');
56
+ }
57
+ add_action( 'admin_enqueue_scripts', 'awesome_weather_wp_admin_head' );
58
+
59
 
60
  //THE SHORTCODE
61
  add_shortcode( 'awesome-weather', 'awesome_weather_shortcode' );
70
  {
71
  global $awesome_weather_sizes;
72
 
73
+ $rtn = "";
74
+ $weather_data = array();
75
+ $location = isset($atts['location']) ? $atts['location'] : false;
76
+ $owm_city_id = isset($atts['owm_city_id']) ? $atts['owm_city_id'] : false;
77
+ $size = (isset($atts['size']) AND $atts['size'] == "tall") ? 'tall' : 'wide';
78
+ $units = (isset($atts['units']) AND strtoupper($atts['units']) == "C") ? "metric" : "imperial";
79
+ $units_display = $units == "metric" ? __('C', 'awesome-weather') : __('F', 'awesome-weather');
80
+ $override_title = isset($atts['override_title']) ? $atts['override_title'] : false;
81
+ $days_to_show = isset($atts['forecast_days']) ? $atts['forecast_days'] : 5;
82
+ $show_stats = (isset($atts['hide_stats']) AND $atts['hide_stats'] == 1) ? 0 : 1;
83
+ $background_by_weather = (isset($atts['background_by_weather']) AND $atts['background_by_weather'] == 1) ? 1 : 0;
84
+ $show_link = (isset($atts['show_link']) AND $atts['show_link'] == 1) ? 1 : 0;
85
+ $background = isset($atts['background']) ? $atts['background'] : false;
86
+ $custom_bg_color = isset($atts['custom_bg_color']) ? $atts['custom_bg_color'] : false;
87
+ $inline_style = isset($atts['inline_style']) ? $atts['inline_style'] : '';
88
+ $locale = 'en';
89
 
90
  $sytem_locale = get_locale();
91
  $available_locales = array( 'en', 'es', 'sp', 'fr', 'it', 'de', 'pt', 'ro', 'pl', 'ru', 'uk', 'ua', 'fi', 'nl', 'bg', 'sv', 'se', 'ca', 'tr', 'hr', 'zh', 'zh_tw', 'zh_cn' );
109
 
110
 
111
  //FIND AND CACHE CITY ID
112
+ if( $owm_city_id )
113
+ {
114
+ $city_name_slug = sanitize_title( $location );;
115
+ $api_query = "id=" . $owm_city_id;
116
+ }
117
+ else if( is_numeric($location) )
118
  {
119
+ $city_name_slug = sanitize_title( $location );;
120
  $api_query = "id=" . $location;
121
  }
122
  else
127
 
128
 
129
  // TRANSIENT NAME
130
+ $weather_transient_name = 'awe_' . $city_name_slug . "_" . $days_to_show . "_" . strtolower($units) . '_' . $locale;
131
 
132
 
133
  // TWO APIS USED (VERSION 2.5)
141
  delete_transient( $weather_transient_name );
142
  }
143
 
144
+ // IF APPID, WE USE IT
145
+ $appid_string = '';
146
+ $appid = apply_filters( 'awesome_weather_appid', false );
147
+ if($appid)
148
+ {
149
+ $appid_string = '&APPID=' . $appid;
150
+ }
151
+
152
 
153
  // GET WEATHER DATA
154
  if( get_transient( $weather_transient_name ) )
161
  $weather_data['forecast'] = array();
162
 
163
  // NOW
164
+ $now_ping = "http://api.openweathermap.org/data/2.5/weather?" . $api_query . "&lang=" . $locale . "&units=" . $units . $appid_string;
165
+
166
  $now_ping_get = wp_remote_get( $now_ping );
167
 
168
  if( is_wp_error( $now_ping_get ) )
185
  // FORECAST
186
  if( $days_to_show != "hide" )
187
  {
188
+ $forecast_ping = "http://api.openweathermap.org/data/2.5/forecast/daily?" . $api_query . "&lang=" . $locale . "&units=" . $units ."&cnt=7" . $appid_string;
189
  $forecast_ping_get = wp_remote_get( $forecast_ping );
190
 
191
  if( is_wp_error( $forecast_ping_get ) )
208
  if($weather_data['now'] OR $weather_data['forecast'])
209
  {
210
  // SET THE TRANSIENT, CACHE FOR A LITTLE OVER THREE HOURS
211
+ set_transient( $weather_transient_name, $weather_data, apply_filters( 'awesome_weather_cache', 1800 ) );
212
  }
213
  }
214
 
224
  $today_high = round($today->main->temp_max);
225
  $today_low = round($today->main->temp_min);
226
 
227
+
228
+ // BACKGROUND DATA, CLASSES AND OR IMAGES
229
+ $background_classes = array();
230
+ $background_classes[] = "awesome-weather-wrap";
231
+ $background_classes[] = "awecf";
232
+ $background_classes[] = "awe_" . $size;
233
+
234
  if( $custom_bg_color )
235
  {
236
  if( substr(trim($custom_bg_color), 0, 1) != "#" AND substr(trim(strtolower($custom_bg_color)), 0, 3) != "rgb" ) { $custom_bg_color = "#" . $custom_bg_color; }
237
  $inline_style .= "background-color: {$custom_bg_color};";
238
+ $background_classes[] = "custom";
239
  }
240
  else
241
  {
242
  // COLOR OF WIDGET
243
+
244
+ if($units == "imperial")
245
  {
246
+ if($today_temp > 31 AND $today_temp < 40) $background_classes[] = "temp2";
247
+ else if($today_temp >= 40 AND $today_temp < 50) $background_classes[] = "temp3";
248
+ else if($today_temp >= 50 AND $today_temp < 60) $background_classes[] = "temp4";
249
+ else if($today_temp >= 60 AND $today_temp < 80) $background_classes[] = "temp5";
250
+ else if($today_temp >= 80 AND $today_temp < 90) $background_classes[] = "temp6";
251
+ else if($today_temp >= 90) $background_classes[] = "temp7";
252
+ else $background_classes[] = "temp1";
253
  }
254
  else
255
  {
256
+ if($today_temp > 1 AND $today_temp < 4) $background_classes[] = "temp2";
257
+ else if($today_temp >= 4 AND $today_temp < 10) $background_classes[] = "temp3";
258
+ else if($today_temp >= 10 AND $today_temp < 15) $background_classes[] = "temp4";
259
+ else if($today_temp >= 15 AND $today_temp < 26) $background_classes[] = "temp5";
260
+ else if($today_temp >= 26 AND $today_temp < 32) $background_classes[] = "temp6";
261
+ else if($today_temp >= 32) $background_classes[] = "temp7";
262
+ else $background_classes[] = "temp1";
263
  }
264
  }
265
 
290
 
291
  $wind_direction = $wind_label[ fmod((($today->wind->deg + 11) / 22.5),16) ];
292
 
293
+ $background_classes[] = ($show_stats) ? "awe_with_stats" : "awe_without_stats";
294
+
295
+
296
+ // ADD WEATHER CONDITIONS CLASSES TO WRAP
297
+ if( isset($today->weather[0]) )
298
+ {
299
+ $weather_code = $today->weather[0]->id;
300
+ $weather_description_slug = sanitize_title( $today->weather[0]->description );
301
+
302
+ $background_classes[] = "awe-code-" . $weather_code;
303
+ $background_classes[] = "awe-desc-" . $weather_description_slug;
304
+ }
305
 
 
306
 
307
+ // CHECK FOR BACKGROUND BY WEATHER
308
+ if( $background_by_weather AND ( $weather_code OR $weather_description_slug ) )
309
  {
310
+ if( file_exists( get_stylesheet_directory() . "/awe-backgrounds" ) )
311
+ {
312
+ $bg_ext = apply_filters('awesome_weather_bg_ext', 'jpg' );
313
+
314
+ // CHECK FOR CODE
315
+ if( $weather_code AND file_exists( get_stylesheet_directory() . "/awe-backgrounds/" . $weather_code . "." . $bg_ext))
316
+ {
317
+ $background = get_stylesheet_directory_uri() . "/awe-backgrounds/" . $weather_code . "." . $bg_ext;
318
+ }
319
+ else if( $weather_description_slug AND file_exists( get_stylesheet_directory() . "/awe-backgrounds/" . $weather_description_slug . "." . $bg_ext))
320
+ {
321
+ $background = get_stylesheet_directory_uri() . "/awe-backgrounds/" . $weather_description_slug . "." . $bg_ext;
322
+ }
323
+ else
324
+ {
325
+ // PRESET WEATHER NAMES
326
+ $preset_background_img_name = "";
327
+ if( substr($weather_code,0,1) == "2" ) $preset_background_img_name = "thunderstorm";
328
+ else if( substr($weather_code,0,1) == "3" ) $preset_background_img_name = "drizzle";
329
+ else if( substr($weather_code,0,1) == "5" ) $preset_background_img_name = "rain";
330
+ else if( $weather_code == 611 ) $preset_background_img_name = "sleet";
331
+ else if( substr($weather_code,0,1) == "6" ) $preset_background_img_name = "snow";
332
+ else if( $weather_code == 781 OR $weather_code == 900 ) $preset_background_img_name = "tornado";
333
+ else if( substr($weather_code,0,1) == "8" ) $preset_background_img_name = "cloudy";
334
+ else if( $weather_code == 901 ) $preset_background_img_name = "tropical-storm";
335
+ else if( $weather_code == 902 ) $preset_background_img_name = "hurricane";
336
+ else if( $weather_code == 905 ) $preset_background_img_name = "windy";
337
+ else if( $weather_code == 906 ) $preset_background_img_name = "hail";
338
+ else if( $weather_code == 951 ) $preset_background_img_name = "calm";
339
+ else if( $weather_code > 951 AND $weather_code < 958 ) $preset_background_img_name = "breeze";
340
+
341
+ if( $preset_background_img_name )
342
+ {
343
+ $background_classes[] = "awe-preset-" . $preset_background_img_name;
344
+ if( file_exists( get_stylesheet_directory() . "/awe-backgrounds/" . $preset_background_img_name . "." . $bg_ext) ) $background = get_stylesheet_directory_uri() . "/awe-backgrounds/" . $preset_background_img_name . "." . $bg_ext;
345
+ }
346
+ }
347
+ }
348
  }
349
 
350
+
351
+ // DISPLAY SYMBOL
352
+ $units_display_symbol = apply_filters('awesome_weather_units_display', $units_display );
353
+
354
+
355
+ // EXTRA STYLES
356
+ if($background) $background_classes[] = "darken";
357
+ if($inline_style != "") $inline_style = " style=\"{$inline_style}\"";
358
+
359
+
360
+ $background_class_string = @implode( " ", apply_filters( 'awesome_weather_background_classes', $background_classes ));
361
+
362
  // DISPLAY WIDGET
363
  $rtn .= "
364
 
365
+ <div id=\"awesome-weather-{$city_name_slug}\" class=\"{$background_class_string}\"{$inline_style}>
366
  ";
367
 
368
 
369
  if($background)
370
  {
371
  $rtn .= "<div class=\"awesome-weather-cover\" style='background-image: url($background);'>";
372
+ if( !$background_by_weather) $rtn .= "<div class=\"awesome-weather-darken\">";
373
  }
374
 
375
  $rtn .= "
376
  <div class=\"awesome-weather-header\">{$header_title}</div>
377
 
378
  <div class=\"awesome-weather-current-temp\">
379
+ $today_temp<sup>{$units_display_symbol}</sup>
380
  </div> <!-- /.awesome-weather-current-temp -->
381
  ";
382
 
384
  {
385
  $speed_text = ($units == "metric") ? __('km/h', 'awesome-weather') : __('mph', 'awesome-weather');
386
 
 
387
  $rtn .= "
388
 
389
  <div class=\"awesome-weather-todays-stats\">
412
  $day_of_week = $days_of_week[ date('w', $forecast->dt) ];
413
  $rtn .= "
414
  <div class=\"awesome-weather-forecast-day\">
415
+ <div class=\"awesome-weather-forecast-day-temp\">{$forecast->temp}<sup>{$units_display_symbol}</sup></div>
416
  <div class=\"awesome-weather-forecast-day-abbr\">$day_of_week</div>
417
  </div>
418
  ";
433
 
434
  if($background)
435
  {
436
+ if( !$background_by_weather) $rtn .= "</div> <!-- /.awesome-weather-darken -->";
437
  $rtn .= "</div> <!-- /.awesome-weather-cover -->";
 
438
  }
439
 
440
  $rtn .= "</div> <!-- /.awesome-weather-wrap -->";
446
  function awesome_weather_error( $msg = false )
447
  {
448
  if(!$msg) $msg = __('No weather information available', 'awesome-weather');
449
+
450
+ // DISPLAY ADMIN
451
+ if ( current_user_can( 'manage_options' ) )
452
+ {
453
+ return "<div class='awesome-weather-error'>" . $msg . "</div>";
454
+ }
455
+ else
456
+ {
457
+ return apply_filters( 'awesome_weather_error', "<!-- AWESOME WEATHER ERROR: " . $msg . " -->" );
458
+ }
459
  }
460
 
461
 
462
+ // ENQUEUE ADMIN SCRIPTS
463
+ function awesome_weather_admin_scripts( $hook )
464
+ {
465
+ if( 'widgets.php' != $hook ) return;
466
+ wp_enqueue_script( 'awesome_weather_admin_script', plugin_dir_url( __FILE__ ) . '/awesome-weather-widget.js' );
467
+
468
+ wp_localize_script( 'awesome_weather_admin_script', 'awe_script', array(
469
+ 'no_owm_city' => esc_attr(__("No city found in OpenWeatherMap.", 'awesome-weather')),
470
+ 'one_city_found' => esc_attr(__('Only one location found. The ID has been set automatically above.', 'awesome-weather')),
471
+ 'confirm_city' => esc_attr(__('Please confirm your city: &nbsp;', 'awesome-weather')),
472
+ )
473
+ );
474
+ }
475
+ add_action( 'admin_enqueue_scripts', 'awesome_weather_admin_scripts' );
476
+
477
 
478
  // AWESOME WEATHER WIDGET, WIDGET CLASS, SO MANY WIDGETS
479
  class AwesomeWeatherWidget extends WP_Widget
484
  {
485
  extract( $args );
486
 
487
+ $location = isset($instance['location']) ? $instance['location'] : false;
488
+ $owm_city_id = isset($instance['owm_city_id']) ? $instance['owm_city_id'] : false;
489
+ $override_title = isset($instance['override_title']) ? $instance['override_title'] : false;
490
+ $widget_title = isset($instance['widget_title']) ? $instance['widget_title'] : false;
491
+ $units = isset($instance['units']) ? $instance['units'] : false;
492
+ $size = isset($instance['size']) ? $instance['size'] : false;
493
+ $forecast_days = isset($instance['forecast_days']) ? $instance['forecast_days'] : false;
494
+ $hide_stats = (isset($instance['hide_stats']) AND $instance['hide_stats'] == 1) ? 1 : 0;
495
+ $show_link = (isset($instance['show_link']) AND $instance['show_link'] == 1) ? 1 : 0;
496
+ $background_by_weather = (isset($instance['background_by_weather']) AND $instance['background_by_weather'] == 1) ? 1 : 0;
497
+ $background = isset($instance['background']) ? $instance['background'] : false;
498
+ $custom_bg_color = isset($instance['custom_bg_color']) ? $instance['custom_bg_color'] : false;
499
 
500
  echo $before_widget;
501
  if($widget_title != "") echo $before_title . $widget_title . $after_title;
502
+ echo awesome_weather_logic( array(
503
+ 'location' => $location,
504
+ 'owm_city_id' => $owm_city_id,
505
+ 'override_title' => $override_title,
506
+ 'size' => $size,
507
+ 'units' => $units,
508
+ 'forecast_days' => $forecast_days,
509
+ 'hide_stats' => $hide_stats,
510
+ 'show_link' => $show_link,
511
+ 'background' => $background,
512
+ 'custom_bg_color' => $custom_bg_color,
513
+ 'background_by_weather' => $background_by_weather
514
+ ));
515
  echo $after_widget;
516
  }
517
 
518
  function update($new_instance, $old_instance)
519
  {
520
  $instance = $old_instance;
521
+ $instance['location'] = strip_tags($new_instance['location']);
522
+ $instance['owm_city_id'] = strip_tags($new_instance['owm_city_id']);
523
+ $instance['override_title'] = strip_tags($new_instance['override_title']);
524
+ $instance['widget_title'] = strip_tags($new_instance['widget_title']);
525
+ $instance['units'] = strip_tags($new_instance['units']);
526
+ $instance['size'] = strip_tags($new_instance['size']);
527
+ $instance['forecast_days'] = strip_tags($new_instance['forecast_days']);
528
+ $instance['background'] = strip_tags($new_instance['background']);
529
+ $instance['custom_bg_color'] = strip_tags($new_instance['custom_bg_color']);
530
+ $instance['background_by_weather'] = (isset($new_instance['background_by_weather']) AND $new_instance['background_by_weather'] == 1) ? 1 : 0;
531
+ $instance['hide_stats'] = (isset($new_instance['hide_stats']) AND $new_instance['hide_stats'] == 1) ? 1 : 0;
532
+ $instance['show_link'] = (isset($new_instance['show_link']) AND $new_instance['show_link'] == 1) ? 1 : 0;
533
  return $instance;
534
  }
535
 
537
  {
538
  global $awesome_weather_sizes;
539
 
540
+ $location = isset($instance['location']) ? esc_attr($instance['location']) : "";
541
+ $owm_city_id = isset($instance['owm_city_id']) ? esc_attr($instance['owm_city_id']) : "";
542
+ $override_title = isset($instance['override_title']) ? esc_attr($instance['override_title']) : "";
543
+ $widget_title = isset($instance['widget_title']) ? esc_attr($instance['widget_title']) : "";
544
+ $selected_size = isset($instance['size']) ? esc_attr($instance['size']) : "wide";
545
+ $units = (isset($instance['units']) AND strtoupper($instance['units']) == "C") ? "C" : "F";
546
+ $forecast_days = isset($instance['forecast_days']) ? esc_attr($instance['forecast_days']) : 5;
547
+ $hide_stats = (isset($instance['hide_stats']) AND $instance['hide_stats'] == 1) ? 1 : 0;
548
+ $background_by_weather = (isset($instance['background_by_weather']) AND $instance['background_by_weather'] == 1) ? 1 : 0;
549
+ $show_link = (isset($instance['show_link']) AND $instance['show_link'] == 1) ? 1 : 0;
550
+ $background = isset($instance['background']) ? esc_attr($instance['background']) : "";
551
+ $custom_bg_color = isset($instance['custom_bg_color']) ? esc_attr($instance['custom_bg_color']) : "";
552
  ?>
553
  <p>
554
  <label for="<?php echo $this->get_field_id('location'); ?>">
555
+ <?php _e('Search for Your Location:', 'awesome-weather'); ?><br />
556
  <small><?php _e('(i.e: London,UK or New York City,NY)', 'awesome-weather'); ?></small>
557
  </label>
558
+ <input data-cityidfield="<?php echo $this->get_field_id('owm_city_id'); ?>" data-unitsfield="<?php echo $this->get_field_id('units'); ?>" class="widefat awe-location-search-field-openweathermaps" style="margin-top: 4px;" id="<?php echo $this->get_field_id('location'); ?>" name="<?php echo $this->get_field_name('location'); ?>" type="text" value="<?php echo $location; ?>" />
559
  </p>
560
+
561
+ <p>
562
+ <label for="<?php echo $this->get_field_id('owm_city_id'); ?>">
563
+ <?php _e('OpenWeatherMap City ID:', 'awesome-weather-pro'); ?><br>
564
+ <small><?php _e('(use the field above to find the ID for your city)', 'awesome-weather'); ?></small>
565
+ </label>
566
+ <input class="widefat" style="margin-top: 4px; line-height: 1.5em;" id="<?php echo $this->get_field_id('owm_city_id'); ?>" name="<?php echo $this->get_field_name('owm_city_id'); ?>" type="text" value="<?php echo $owm_city_id; ?>" />
567
+ </p>
568
+
569
+ <span id="awe-owm-spinner-<?php echo $this->get_field_id('location'); ?>" class="hidden"><img src="/wp-admin/images/spinner.gif"></span>
570
+ <div id="owmid-selector-<?php echo $this->get_field_id('location'); ?>"></div>
571
+
572
+ <?php if( !$owm_city_id ) { ?>
573
+ <script>jQuery('#<?php echo $this->get_field_id('location'); ?>').trigger('keyup');</script>
574
+ <?php } ?>
575
+
576
  <p>
577
  <label for="<?php echo $this->get_field_id('override_title'); ?>"><?php _e('Override Title:', 'awesome-weather'); ?></label>
578
  <input class="widefat" id="<?php echo $this->get_field_id('override_title'); ?>" name="<?php echo $this->get_field_name('override_title'); ?>" type="text" value="<?php echo $override_title; ?>" />
610
  <input class="widefat" id="<?php echo $this->get_field_id('background'); ?>" name="<?php echo $this->get_field_name('background'); ?>" type="text" value="<?php echo $background; ?>" />
611
  </p>
612
 
613
+ <p>
614
+ <input id="<?php echo $this->get_field_id('background_by_weather'); ?>" name="<?php echo $this->get_field_name('background_by_weather'); ?>" type="checkbox" value="1" <?php if($background_by_weather) echo ' checked="checked"'; ?> />
615
+ <label for="<?php echo $this->get_field_id('background_by_weather'); ?>"><?php _e('Use Different Background Images Based on Weather', 'awesome-weather'); ?></label> <a href="https://halgatewood.com/docs/plugins/awesome-weather-widget/creating-different-backgrounds-for-different-weather" target="_blank">(?)</a> &nbsp;
616
+ </p>
617
+
618
  <p>
619
  <label for="<?php echo $this->get_field_id('custom_bg_color'); ?>"><?php _e('Custom Background Color:', 'awesome-weather'); ?></label><br />
620
  <small><?php _e('overrides color changing', 'awesome-weather'); ?>: #7fb761 or rgba(0,0,0,0.5)</small>
622
  </p>
623
 
624
  <p>
 
625
  <input id="<?php echo $this->get_field_id('hide_stats'); ?>" name="<?php echo $this->get_field_name('hide_stats'); ?>" type="checkbox" value="1" <?php if($hide_stats) echo ' checked="checked"'; ?> />
626
+ <label for="<?php echo $this->get_field_id('hide_stats'); ?>"><?php _e('Hide Stats', 'awesome-weather'); ?></label>
627
+
628
  </p>
629
 
630
  <p>
 
631
  <input id="<?php echo $this->get_field_id('show_link'); ?>" name="<?php echo $this->get_field_name('show_link'); ?>" type="checkbox" value="1" <?php if($show_link) echo ' checked="checked"'; ?> />
632
+ <label for="<?php echo $this->get_field_id('show_link'); ?>"><?php _e('Link to OpenWeatherMap', 'awesome-weather'); ?></label> &nbsp;
633
  </p>
634
 
635
  <p>
640
  }
641
  }
642
 
643
+ add_action( 'widgets_init', create_function('', 'return register_widget("AwesomeWeatherWidget");') );
644
+
645
+
646
+
647
+
648
+
649
+ // PING OPENWEATHER FOR OWMID
650
+ add_action( 'wp_ajax_awe_ping_owm_for_id', 'awe_ping_owm_for_id');
651
+ function awe_ping_owm_for_id( )
652
+ {
653
+ $location = urlencode($_GET['location']);
654
+ $units = $_GET['location'] == "C" ? "metric" : "imperial";
655
+ $owm_ping = "http://api.openweathermap.org/data/2.5/find?q=" . $location ."&units=" . $units . "&mode=json";
656
+ $owm_ping_get = wp_remote_get( $owm_ping );
657
+ echo $owm_ping_get['body'];
658
+ die;
659
+ }
660
+
661
+
languages/awesome-weather.pot CHANGED
@@ -1,194 +1,218 @@
1
- # Copyright (C) 2014 Awesome Weather Widget
2
  # This file is distributed under the same license as the Awesome Weather Widget package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Awesome Weather Widget 1.4\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/awesome-weather\n"
7
- "POT-Creation-Date: 2014-02-05 22:17:31+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: awesome-weather.php:66
16
  msgid "C"
17
  msgstr ""
18
 
19
- #: awesome-weather.php:66
20
  msgid "F"
21
  msgstr ""
22
 
23
- #: awesome-weather.php:236
24
  msgid "N"
25
  msgstr ""
26
 
27
- #: awesome-weather.php:237
28
  msgid "NNE"
29
  msgstr ""
30
 
31
- #: awesome-weather.php:238
32
  msgid "NE"
33
  msgstr ""
34
 
35
- #: awesome-weather.php:239
36
  msgid "ENE"
37
  msgstr ""
38
 
39
- #: awesome-weather.php:240
40
  msgid "E"
41
  msgstr ""
42
 
43
- #: awesome-weather.php:241
44
  msgid "ESE"
45
  msgstr ""
46
 
47
- #: awesome-weather.php:242
48
  msgid "SE"
49
  msgstr ""
50
 
51
- #: awesome-weather.php:243
52
  msgid "SSE"
53
  msgstr ""
54
 
55
- #: awesome-weather.php:244
56
  msgid "S"
57
  msgstr ""
58
 
59
- #: awesome-weather.php:245
60
  msgid "SSW"
61
  msgstr ""
62
 
63
- #: awesome-weather.php:246
64
  msgid "SW"
65
  msgstr ""
66
 
67
- #: awesome-weather.php:247
68
  msgid "WSW"
69
  msgstr ""
70
 
71
- #: awesome-weather.php:248
72
  msgid "W"
73
  msgstr ""
74
 
75
- #: awesome-weather.php:249
76
  msgid "WNW"
77
  msgstr ""
78
 
79
- #: awesome-weather.php:250
80
  msgid "NW"
81
  msgstr ""
82
 
83
- #: awesome-weather.php:251
84
  msgid "NNW"
85
  msgstr ""
86
 
87
- #: awesome-weather.php:288
88
  msgid "km/h"
89
  msgstr ""
90
 
91
- #: awesome-weather.php:288
92
  msgid "mph"
93
  msgstr ""
94
 
95
- #: awesome-weather.php:295
96
  msgid "humidity:"
97
  msgstr ""
98
 
99
- #: awesome-weather.php:296
100
  msgid "wind:"
101
  msgstr ""
102
 
103
- #: awesome-weather.php:297
104
  msgid "H"
105
  msgstr ""
106
 
107
- #: awesome-weather.php:297
108
  msgid "L"
109
  msgstr ""
110
 
111
- #: awesome-weather.php:313
112
  msgid "Sun"
113
  msgstr ""
114
 
115
- #: awesome-weather.php:313
116
  msgid "Mon"
117
  msgstr ""
118
 
119
- #: awesome-weather.php:313
120
  msgid "Tue"
121
  msgstr ""
122
 
123
- #: awesome-weather.php:313
124
  msgid "Wed"
125
  msgstr ""
126
 
127
- #: awesome-weather.php:313
128
  msgid "Thu"
129
  msgstr ""
130
 
131
- #: awesome-weather.php:313
132
  msgid "Fri"
133
  msgstr ""
134
 
135
- #: awesome-weather.php:313
136
  msgid "Sat"
137
  msgstr ""
138
 
139
- #: awesome-weather.php:331
140
  msgid "extended forecast"
141
  msgstr ""
142
 
143
- #: awesome-weather.php:352
144
  msgid "No weather information available"
145
  msgstr ""
146
 
147
- #: awesome-weather.php:415
148
- msgid "Location:"
 
 
 
 
149
  msgstr ""
150
 
151
- #: awesome-weather.php:416
 
 
 
 
 
 
 
 
152
  msgid "(i.e: London,UK or New York City,NY)"
153
  msgstr ""
154
 
155
- #: awesome-weather.php:422
 
 
 
 
 
 
 
 
156
  msgid "Override Title:"
157
  msgstr ""
158
 
159
- #: awesome-weather.php:427
160
  msgid "Units:"
161
  msgstr ""
162
 
163
- #: awesome-weather.php:433
164
  msgid "Size:"
165
  msgstr ""
166
 
167
- #: awesome-weather.php:442
168
  msgid "Forecast:"
169
  msgstr ""
170
 
171
- #: awesome-weather.php:454
172
  msgid "Background Image:"
173
  msgstr ""
174
 
175
- #: awesome-weather.php:459
 
 
 
 
176
  msgid "Custom Background Color:"
177
  msgstr ""
178
 
179
- #: awesome-weather.php:460
180
  msgid "overrides color changing"
181
  msgstr ""
182
 
183
- #: awesome-weather.php:465
184
- msgid "Hide Stats:"
185
  msgstr ""
186
 
187
- #: awesome-weather.php:470
188
- msgid "Link to OpenWeatherMap:"
189
  msgstr ""
190
 
191
- #: awesome-weather.php:475
192
  msgid "Widget Title: (optional)"
193
  msgstr ""
194
  #. Plugin Name of the plugin/theme
@@ -196,7 +220,7 @@ msgid "Awesome Weather Widget"
196
  msgstr ""
197
 
198
  #. Plugin URI of the plugin/theme
199
- msgid "http://halgatewood.com/awesome-weather"
200
  msgstr ""
201
 
202
  #. Description of the plugin/theme
@@ -208,5 +232,5 @@ msgid "Hal Gatewood"
208
  msgstr ""
209
 
210
  #. Author URI of the plugin/theme
211
- msgid "http://www.halgatewood.com"
212
  msgstr ""
1
+ # Copyright (C) 2015 Awesome Weather Widget
2
  # This file is distributed under the same license as the Awesome Weather Widget package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Awesome Weather Widget 1.5\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/awesome-weather\n"
7
+ "POT-Creation-Date: 2015-05-21 19:42:51+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #: awesome-weather.php:79
16
  msgid "C"
17
  msgstr ""
18
 
19
+ #: awesome-weather.php:79
20
  msgid "F"
21
  msgstr ""
22
 
23
+ #: awesome-weather.php:273
24
  msgid "N"
25
  msgstr ""
26
 
27
+ #: awesome-weather.php:274
28
  msgid "NNE"
29
  msgstr ""
30
 
31
+ #: awesome-weather.php:275
32
  msgid "NE"
33
  msgstr ""
34
 
35
+ #: awesome-weather.php:276
36
  msgid "ENE"
37
  msgstr ""
38
 
39
+ #: awesome-weather.php:277
40
  msgid "E"
41
  msgstr ""
42
 
43
+ #: awesome-weather.php:278
44
  msgid "ESE"
45
  msgstr ""
46
 
47
+ #: awesome-weather.php:279
48
  msgid "SE"
49
  msgstr ""
50
 
51
+ #: awesome-weather.php:280
52
  msgid "SSE"
53
  msgstr ""
54
 
55
+ #: awesome-weather.php:281
56
  msgid "S"
57
  msgstr ""
58
 
59
+ #: awesome-weather.php:282
60
  msgid "SSW"
61
  msgstr ""
62
 
63
+ #: awesome-weather.php:283
64
  msgid "SW"
65
  msgstr ""
66
 
67
+ #: awesome-weather.php:284
68
  msgid "WSW"
69
  msgstr ""
70
 
71
+ #: awesome-weather.php:285
72
  msgid "W"
73
  msgstr ""
74
 
75
+ #: awesome-weather.php:286
76
  msgid "WNW"
77
  msgstr ""
78
 
79
+ #: awesome-weather.php:287
80
  msgid "NW"
81
  msgstr ""
82
 
83
+ #: awesome-weather.php:288
84
  msgid "NNW"
85
  msgstr ""
86
 
87
+ #: awesome-weather.php:385
88
  msgid "km/h"
89
  msgstr ""
90
 
91
+ #: awesome-weather.php:385
92
  msgid "mph"
93
  msgstr ""
94
 
95
+ #: awesome-weather.php:391
96
  msgid "humidity:"
97
  msgstr ""
98
 
99
+ #: awesome-weather.php:392
100
  msgid "wind:"
101
  msgstr ""
102
 
103
+ #: awesome-weather.php:393
104
  msgid "H"
105
  msgstr ""
106
 
107
+ #: awesome-weather.php:393
108
  msgid "L"
109
  msgstr ""
110
 
111
+ #: awesome-weather.php:409
112
  msgid "Sun"
113
  msgstr ""
114
 
115
+ #: awesome-weather.php:409
116
  msgid "Mon"
117
  msgstr ""
118
 
119
+ #: awesome-weather.php:409
120
  msgid "Tue"
121
  msgstr ""
122
 
123
+ #: awesome-weather.php:409
124
  msgid "Wed"
125
  msgstr ""
126
 
127
+ #: awesome-weather.php:409
128
  msgid "Thu"
129
  msgstr ""
130
 
131
+ #: awesome-weather.php:409
132
  msgid "Fri"
133
  msgstr ""
134
 
135
+ #: awesome-weather.php:409
136
  msgid "Sat"
137
  msgstr ""
138
 
139
+ #: awesome-weather.php:427
140
  msgid "extended forecast"
141
  msgstr ""
142
 
143
+ #: awesome-weather.php:448
144
  msgid "No weather information available"
145
  msgstr ""
146
 
147
+ #: awesome-weather.php:469
148
+ msgid "No city found in OpenWeatherMap."
149
+ msgstr ""
150
+
151
+ #: awesome-weather.php:470
152
+ msgid "Only one location found. The ID has been set automatically above."
153
  msgstr ""
154
 
155
+ #: awesome-weather.php:471
156
+ msgid "Please confirm your city: &nbsp;"
157
+ msgstr ""
158
+
159
+ #: awesome-weather.php:555
160
+ msgid "Search for Your Location:"
161
+ msgstr ""
162
+
163
+ #: awesome-weather.php:556
164
  msgid "(i.e: London,UK or New York City,NY)"
165
  msgstr ""
166
 
167
+ #: awesome-weather.php:563
168
+ msgid "OpenWeatherMap City ID:"
169
+ msgstr ""
170
+
171
+ #: awesome-weather.php:564
172
+ msgid "(use the field above to find the ID for your city)"
173
+ msgstr ""
174
+
175
+ #: awesome-weather.php:577
176
  msgid "Override Title:"
177
  msgstr ""
178
 
179
+ #: awesome-weather.php:582
180
  msgid "Units:"
181
  msgstr ""
182
 
183
+ #: awesome-weather.php:588
184
  msgid "Size:"
185
  msgstr ""
186
 
187
+ #: awesome-weather.php:597
188
  msgid "Forecast:"
189
  msgstr ""
190
 
191
+ #: awesome-weather.php:609
192
  msgid "Background Image:"
193
  msgstr ""
194
 
195
+ #: awesome-weather.php:615
196
+ msgid "Use Different Background Images Based on Weather"
197
+ msgstr ""
198
+
199
+ #: awesome-weather.php:619
200
  msgid "Custom Background Color:"
201
  msgstr ""
202
 
203
+ #: awesome-weather.php:620
204
  msgid "overrides color changing"
205
  msgstr ""
206
 
207
+ #: awesome-weather.php:626
208
+ msgid "Hide Stats"
209
  msgstr ""
210
 
211
+ #: awesome-weather.php:632
212
+ msgid "Link to OpenWeatherMap"
213
  msgstr ""
214
 
215
+ #: awesome-weather.php:636
216
  msgid "Widget Title: (optional)"
217
  msgstr ""
218
  #. Plugin Name of the plugin/theme
220
  msgstr ""
221
 
222
  #. Plugin URI of the plugin/theme
223
+ msgid "https://halgatewood.com/awesome-weather"
224
  msgstr ""
225
 
226
  #. Description of the plugin/theme
232
  msgstr ""
233
 
234
  #. Author URI of the plugin/theme
235
+ msgid "https://www.halgatewood.com"
236
  msgstr ""
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Plugin Name ===
2
  Contributors: halgatewood
3
  Donate link: http://halgatewood.com/donate/
4
- Tags: widgets, sidebar, shortcode, openweathermap, weather, weather widget, forecast, global, temp
5
  Requires at least: 3.5
6
- Tested up to: 4.2
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -12,17 +12,17 @@ Finally beautiful weather widgets for your site.
12
 
13
  == Description ==
14
 
15
- [Pro Version](http://halgatewood.com/downloads/awesome-weather-widget-pro/) available. Icons, 3 New Layouts, Weather by Yahoo!, User Detection and more!
16
 
17
  This plugin allows you to easily add super clean (and awesome) weather widgets to your site. The weather data is provided for free by http://openweathermap.org
18
 
19
  Use the built in widget with all of its marvelous settings or add it to a page or theme with the shortcode: (all settings shown)
20
 
21
- `[awesome-weather location="Montreal" units="F" size="tall" override_title="MTL" forecast_days="2" hide_stats=1 background="http://urltoanimage.jpg" custom_bg_color="#cccccc" inline_style="width: 200px; margin: 20px; float: left;"]`
22
 
23
  = Settings =
24
 
25
- * Location: Enter like Montreal, CA or just Montreal. You may need to try different variations to get the right city
26
  * Units: F (default) or C
27
  * Size: wide (default) or tall
28
  * Override Title: Change the title in the header bar to whatever, sometimes it pulls weather from a close city
@@ -31,6 +31,7 @@ Use the built in widget with all of its marvelous settings or add it to a page o
31
  * Background: URL to an image that will be used as the background of the entire widget
32
  * Custom Background Color: Add a hex color to override the default colors
33
  * Inline Styles: Add inline CSS styles to your widget to float around text and whatever else
 
34
 
35
  = Translations =
36
  * Portuguese - alvarogois
@@ -60,10 +61,19 @@ Use the built in widget with all of its marvelous settings or add it to a page o
60
  3. Micro, using the checkbox 'Hide Stats'
61
  4. Widget Settings
62
  5. Background Image Option (1.2)
63
- 5. Add inline styles to your widget and set custom background colors (1.3.1)
 
 
64
 
65
  == Upgrade Notice ==
66
 
 
 
 
 
 
 
 
67
  = 1.4.2 =
68
  Slightly modified the CSS to include box-sizing. This may slightly modify the look of your widget, hopefully in a cleaner way.
69
 
@@ -136,6 +146,13 @@ Changed API endpoints. Might not find weather without update.
136
 
137
  == Changelog ==
138
 
 
 
 
 
 
 
 
139
  = 1.4.3.3 =
140
  * Hungarian language added (thanks Istvan Hidegkuti
141
 
1
  === Plugin Name ===
2
  Contributors: halgatewood
3
  Donate link: http://halgatewood.com/donate/
4
+ Tags: widgets, sidebar, shortcode, openweathermap, weather, weather widget, forecast, global, temp, local weather,local forecast
5
  Requires at least: 3.5
6
+ Tested up to: 4.3
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
13
  == Description ==
14
 
15
+ [Pro Version](https://halgatewood.com/downloads/awesome-weather-widget-pro/) available. Icons, 3 New Layouts, Weather by Yahoo!, User Detection and more!
16
 
17
  This plugin allows you to easily add super clean (and awesome) weather widgets to your site. The weather data is provided for free by http://openweathermap.org
18
 
19
  Use the built in widget with all of its marvelous settings or add it to a page or theme with the shortcode: (all settings shown)
20
 
21
+ `[awesome-weather location="Montreal" units="F" size="tall" override_title="MTL" forecast_days="2" hide_stats="1" background="http://urltoanimage.jpg" custom_bg_color="#cccccc" inline_style="width: 200px; margin: 20px; float: left;" background_by_weather="1"]`
22
 
23
  = Settings =
24
 
25
+ * Location: Enter a string like Montreal, CA or just Montreal’. You can even get the City ID from OpenWeatherMap and use that.
26
  * Units: F (default) or C
27
  * Size: wide (default) or tall
28
  * Override Title: Change the title in the header bar to whatever, sometimes it pulls weather from a close city
31
  * Background: URL to an image that will be used as the background of the entire widget
32
  * Custom Background Color: Add a hex color to override the default colors
33
  * Inline Styles: Add inline CSS styles to your widget to float around text and whatever else
34
+ * Background Image Based on Weather (v1.5+): Set this to 1 if you want to use different images for different weather types, How to: https://halgatewood.com/awesome-weather-bgs
35
 
36
  = Translations =
37
  * Portuguese - alvarogois
61
  3. Micro, using the checkbox 'Hide Stats'
62
  4. Widget Settings
63
  5. Background Image Option (1.2)
64
+ 6. Add inline styles to your widget and set custom background colors (1.3.1)
65
+ 7. Use different background images based on weather (1.5)
66
+ 8. Search for the City ID directly in the widget settings (1.5)
67
 
68
  == Upgrade Notice ==
69
 
70
+ = 1.5 =
71
+ * You can now speed up your weather and provide better accuracy by using the new Search box in the widget to find the OpenWeatherMap City ID.
72
+ * We also added the ability to use different background images by weather. Also new CSS properties using the weather condition code and text are added so you can target based on weather type.
73
+ * Added several new filters to modify aspects of the weather widget like changing the C and F to a Degree symbol.
74
+ * Fixed an issue where changing the forecast days would not clear the cache.
75
+ * Default cache is now 30 minutes
76
+
77
  = 1.4.2 =
78
  Slightly modified the CSS to include box-sizing. This may slightly modify the look of your widget, hopefully in a cleaner way.
79
 
146
 
147
  == Changelog ==
148
 
149
+ = 1.5 =
150
+ * You can now speed up your weather and provide better accuracy by using the new Search box in the widget to find the OpenWeatherMap City ID.
151
+ * We also added the ability to use different background images by weather. Also new CSS properties using the weather condition code and text are added so you can target based on weather type.
152
+ * Added several new filters to modify aspects of the weather widget like changing the C and F to a Degree symbol.
153
+ * Fixed an issue where changing the forecast days would not clear the cache.
154
+ * Default cache is now 30 minutes
155
+
156
  = 1.4.3.3 =
157
  * Hungarian language added (thanks Istvan Hidegkuti
158