Awesome Weather Widget - Version 1.5.6

Version Description

Two new filters available to remove to the Google font Open Sans. Added new missing background preset 'atmosphere'

Download this release

Release Info

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

Code changes from version 1.5.5 to 1.5.6

awesome-weather.css CHANGED
@@ -4,7 +4,6 @@
4
 
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
  }
4
 
5
  .awesome-weather-wrap {
6
  background: #333; transition: background 0.5s ease-in;
 
7
  text-shadow: 0 1px 2px rgba(0,0,0,0.5); color: #fff;
8
  clear: both;
9
  }
awesome-weather.php CHANGED
@@ -5,7 +5,7 @@ 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.5
9
  Text Domain: awesome-weather
10
  Domain Path: /languages
11
 
@@ -19,7 +19,8 @@ awesome_weather_appid = OpenWeatherMap APPID, improves support (now availab
19
  awesome_weather_units_display = Change the F or C to ° or something
20
  awesome_weather_background_classes = Add or change the background classes before they display
21
  awesome_weather_wind_speed = Convert the wind speed to whatever you want before it gets displayed
22
-
 
23
 
24
  // CLEAR OUT THE TRANSIENT CACHE
25
  add to your URL 'clear_awesome_widget'
@@ -46,7 +47,15 @@ add_action('plugins_loaded', 'awesome_weather_setup', 99999);
46
  function awesome_weather_wp_head( $posts )
47
  {
48
  wp_enqueue_style( 'awesome-weather', plugins_url( '/awesome-weather.css', __FILE__ ) );
49
- wp_enqueue_style( 'opensans-googlefont', 'https://fonts.googleapis.com/css?family=Open+Sans:400,300' );
 
 
 
 
 
 
 
 
50
  }
51
  add_action('wp_enqueue_scripts', 'awesome_weather_wp_head');
52
 
@@ -284,7 +293,6 @@ function awesome_weather_logic( $atts )
284
  $background_classes[] = "awe-desc-" . $weather_description_slug;
285
  }
286
 
287
-
288
  // CHECK FOR BACKGROUND BY WEATHER
289
  if( $background_by_weather AND ( $weather_code OR $weather_description_slug ) )
290
  {
@@ -729,18 +737,19 @@ function awe_ping_owm_for_id( )
729
  // PRESET WEATHER BACKGROUND NAMES
730
  function awesome_weather_preset_condition_names_openweathermaps( $weather_code )
731
  {
732
- if( substr($weather_code,0,1) == "2" ) return "thunderstorm";
733
- else if( substr($weather_code,0,1) == "3" ) return "drizzle";
734
- else if( substr($weather_code,0,1) == "5" ) return "rain";
735
- else if( $weather_code == 611 ) return "sleet";
736
- else if( substr($weather_code,0,1) == "6" ) return "snow";
737
- else if( $weather_code == 781 OR $weather_code == 900 ) return "tornado";
738
- else if( $weather_code == 800 ) return "sunny";
739
- else if( substr($weather_code,0,1) == "8" ) return "cloudy";
740
- else if( $weather_code == 901 ) return "tropical-storm";
741
- else if( $weather_code == 902 ) return "hurricane";
742
- else if( $weather_code == 905 ) return "windy";
743
- else if( $weather_code == 906 ) return "hail";
744
- else if( $weather_code == 951 ) return "calm";
745
- else if( $weather_code > 951 AND $weather_code < 958 ) return "breeze";
 
746
  }
5
  Description: A weather widget that actually looks cool
6
  Author: Hal Gatewood
7
  Author URI: https://www.halgatewood.com
8
+ Version: 1.5.6
9
  Text Domain: awesome-weather
10
  Domain Path: /languages
11
 
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
  awesome_weather_wind_speed = Convert the wind speed to whatever you want before it gets displayed
22
+ awesome_weather_use_google_font = Allows you to turn off Open Sans and use your websites main font (less page load)
23
+ awesome_weather_google_font_queue_name = Allows you to change the queue name if your theme is already using the Open Sans font (make this the same as your other font)
24
 
25
  // CLEAR OUT THE TRANSIENT CACHE
26
  add to your URL 'clear_awesome_widget'
47
  function awesome_weather_wp_head( $posts )
48
  {
49
  wp_enqueue_style( 'awesome-weather', plugins_url( '/awesome-weather.css', __FILE__ ) );
50
+
51
+ $use_google_font = apply_filters('awesome_weather_use_google_font', true);
52
+ $google_font_queuename = apply_filters('awesome_weather_google_font_queue_name', 'opensans-googlefont');
53
+
54
+ if( $use_google_font )
55
+ {
56
+ wp_enqueue_style( $google_font_queuename, 'https://fonts.googleapis.com/css?family=Open+Sans:400,300' );
57
+ wp_add_inline_style( 'awesome-weather', ".awesome-weather-wrap { font-family: 'Open Sans', sans-serif; font-weight: 400; font-size: 14px; line-height: 14px; } " );
58
+ }
59
  }
60
  add_action('wp_enqueue_scripts', 'awesome_weather_wp_head');
61
 
293
  $background_classes[] = "awe-desc-" . $weather_description_slug;
294
  }
295
 
 
296
  // CHECK FOR BACKGROUND BY WEATHER
297
  if( $background_by_weather AND ( $weather_code OR $weather_description_slug ) )
298
  {
737
  // PRESET WEATHER BACKGROUND NAMES
738
  function awesome_weather_preset_condition_names_openweathermaps( $weather_code )
739
  {
740
+ if( substr($weather_code,0,1) == "2" ) return "thunderstorm";
741
+ else if( substr($weather_code,0,1) == "3" ) return "drizzle";
742
+ else if( substr($weather_code,0,1) == "5" ) return "rain";
743
+ else if( $weather_code == 611 ) return "sleet";
744
+ else if( substr($weather_code,0,1) == "6" OR $weather_code == 903 ) return "snow";
745
+ else if( $weather_code == 781 OR $weather_code == 900 ) return "tornado";
746
+ else if( $weather_code == 800 OR $weather_code == 904 ) return "sunny";
747
+ else if( substr($weather_code,0,1) == "7" ) return "atmosphere";
748
+ else if( substr($weather_code,0,1) == "8" ) return "cloudy";
749
+ else if( $weather_code == 901 ) return "tropical-storm";
750
+ else if( $weather_code == 902 OR $weather_code == 962 ) return "hurricane";
751
+ else if( $weather_code == 905 ) return "windy";
752
+ else if( $weather_code == 906 ) return "hail";
753
+ else if( $weather_code == 951 ) return "calm";
754
+ else if( $weather_code > 951 AND $weather_code < 962 ) return "breeze";
755
  }
img/awe-backgrounds/atmosphere.jpg ADDED
Binary file
img/awe-backgrounds/snow.jpg CHANGED
Binary file
readme.txt CHANGED
@@ -24,11 +24,11 @@ Once you have the API Key you can simply add it in 'Settings' -> 'Awesome Weathe
24
 
25
  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)
26
 
27
- `[awesome-weather location="Montreal" units="F" owm_city_id="6077243" 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" text_color="#000" locale="fr"]`
28
 
29
  = Settings =
30
 
31
- * Location: Enter a string like Montreal, CA or just Montreal’. You can even get the City ID from OpenWeatherMap and use that.
32
  * Units: F (default) or C
33
  * Size: wide (default) or tall
34
  * Override Title: Change the title in the header bar to whatever, sometimes it pulls weather from a close city
@@ -50,7 +50,7 @@ Use the built in widget with all of its marvelous settings or add it to a page o
50
  * French - Gilles D.
51
  * Italian - Cesare C.
52
  * Russian - Alex
53
- * Spanish - Joaquín B.
54
  * Greek - John T.
55
  * Finnish - Mikko A.
56
  * Hungarian - Istvan H.
@@ -81,6 +81,9 @@ Use the built in widget with all of its marvelous settings or add it to a page o
81
 
82
  == Upgrade Notice ==
83
 
 
 
 
84
  = 1.5.5 =
85
  Some new shortcode attributes, and a constant can be set for the OpenWeatherMap AppID. This helps multisite installations.
86
 
@@ -183,10 +186,14 @@ Changed API endpoints. Might not find weather without update.
183
 
184
  == Changelog ==
185
 
 
 
 
 
186
  = 1.5.5 =
187
- * New constant for the AppID: AWESOME_WEATHER_APPID. Set in wp-config.php for multisite installations
188
- * Shortcode attribute for locale: locale="fr"
189
- * Shortcode attribute for the units display symbol: units_display_symbol="&deg;F"
190
 
191
  = 1.5.4 =
192
  * Preset background images added for the 'Use Different Background Images Based on Weather' option
24
 
25
  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)
26
 
27
+ `[awesome-weather location="Montreal" units="F" owm_city_id="6077243" size="tall" override_title="MTL" forecast_days="3" hide_stats="1" background="http://urltoanimage.jpg" custom_bg_color="#cccccc" inline_style="width: 200px; margin: 20px; float: left;" background_by_weather="1" text_color="#000" locale="fr"]`
28
 
29
  = Settings =
30
 
31
+ * Location: Enter a string like "Montreal, CA" or just "Montreal". You can even get the City ID from OpenWeatherMap and use that.
32
  * Units: F (default) or C
33
  * Size: wide (default) or tall
34
  * Override Title: Change the title in the header bar to whatever, sometimes it pulls weather from a close city
50
  * French - Gilles D.
51
  * Italian - Cesare C.
52
  * Russian - Alex
53
+ * Spanish - Joaquín B.
54
  * Greek - John T.
55
  * Finnish - Mikko A.
56
  * Hungarian - Istvan H.
81
 
82
  == Upgrade Notice ==
83
 
84
+ = 1.5.6 =
85
+ Two new filters available to remove to the Google font Open Sans. Added new missing background preset 'atmosphere'
86
+
87
  = 1.5.5 =
88
  Some new shortcode attributes, and a constant can be set for the OpenWeatherMap AppID. This helps multisite installations.
89
 
186
 
187
  == Changelog ==
188
 
189
+ = 1.5.6 =
190
+ * Two new filters available to remove to the Google font Open Sans. (`awesome_weather_use_google_font` AND `awesome_weather_google_font_queue_name`)
191
+ * Added new missing background preset `atmosphere.jpg`
192
+
193
  = 1.5.5 =
194
+ * New constant for the AppID: AWESOME_WEATHER_APPID. Set in `wp-config.php` for multisite installations
195
+ * Shortcode attribute for locale: `locale="fr"`
196
+ * Shortcode attribute for the units display symbol: `units_display_symbol="&deg;F"`
197
 
198
  = 1.5.4 =
199
  * Preset background images added for the 'Use Different Background Images Based on Weather' option