Awesome Weather Widget - Version 1.5.9

Version Description

Checkbox to hide the attribution in the widget settings or use shortcode attribute hide_attribution="1"

Download this release

Release Info

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

Code changes from version 1.5.8 to 1.5.9

Files changed (4) hide show
  1. awesome-weather.css +1 -1
  2. awesome-weather.php +17 -4
  3. readme.txt +8 -1
  4. widget.php +12 -3
awesome-weather.css CHANGED
@@ -95,4 +95,4 @@
95
 
96
  /* ERROR */
97
  div.awesome-weather-error { color: #ed7469; font-weight: bold; display: block; padding: 10px; text-align: center; border: solid 1px #ed7469; text-transform: uppercase; }
98
- .awesome-weather-attribution { text-align: center; font-size: 8px; font-weight: bold; font-family: sans-serif; padding: 5px; }
95
 
96
  /* ERROR */
97
  div.awesome-weather-error { color: #ed7469; font-weight: bold; display: block; padding: 10px; text-align: center; border: solid 1px #ed7469; text-transform: uppercase; }
98
+ .awesome-weather-attribution { text-align: center; font-size: 9px; font-weight: bold; font-family: sans-serif; padding: 5px; }
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.8
9
  Text Domain: awesome-weather
10
  Domain Path: /languages
11
 
@@ -28,7 +28,18 @@ $awesome_weather_sizes = apply_filters( 'awesome_weather_sizes' , array( 'tall',
28
  // SETUP
29
  function awesome_weather_setup()
30
  {
31
- load_plugin_textdomain( 'awesome-weather', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
 
 
 
 
 
 
 
 
 
 
 
32
  add_action( 'admin_menu', 'awesome_weather_setting_page_menu' );
33
  }
34
  add_action('plugins_loaded', 'awesome_weather_setup', 99999);
@@ -78,6 +89,7 @@ function awesome_weather_logic( $atts )
78
  $override_title = isset($atts['override_title']) ? $atts['override_title'] : false;
79
  $days_to_show = isset($atts['forecast_days']) ? $atts['forecast_days'] : 5;
80
  $show_stats = (isset($atts['hide_stats']) AND $atts['hide_stats'] == 1) ? 0 : 1;
 
81
  $background_by_weather = (isset($atts['background_by_weather']) AND $atts['background_by_weather'] == 1) ? 1 : 0;
82
  $show_link = (isset($atts['show_link']) AND $atts['show_link'] == 1) ? 1 : 0;
83
  $background = isset($atts['background']) ? $atts['background'] : false;
@@ -413,14 +425,15 @@ function awesome_weather_logic( $atts )
413
  $rtn .= "</div> <!-- /.awesome-weather-more-weather-link -->";
414
  }
415
 
 
 
416
  if($background)
417
  {
418
  if( !$background_by_weather) $rtn .= "</div><!-- /.awesome-weather-darken -->";
419
  $rtn .= "</div><!-- /.awesome-weather-cover -->";
420
  }
421
-
422
  $rtn .= "</div> <!-- /.awesome-weather-wrap -->";
423
- $rtn .= "<div class=\"awesome-weather-attribution\">" . __('Weather from', 'awesome-weather') . " OpenWeatherMap</div>";
424
  return $rtn;
425
  }
426
 
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
9
  Text Domain: awesome-weather
10
  Domain Path: /languages
11
 
28
  // SETUP
29
  function awesome_weather_setup()
30
  {
31
+ $locale = apply_filters('plugin_locale', get_locale(), 'awesome-weather');
32
+ $mofile = WP_LANG_DIR . "/awesome-weather/awesome-weather-" . $locale . '.mo';
33
+
34
+ if( file_exists( $mofile ) )
35
+ {
36
+ load_textdomain( 'awesome-weather', $mofile );
37
+ }
38
+ else
39
+ {
40
+ load_plugin_textdomain( 'awesome-weather', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
41
+ }
42
+
43
  add_action( 'admin_menu', 'awesome_weather_setting_page_menu' );
44
  }
45
  add_action('plugins_loaded', 'awesome_weather_setup', 99999);
89
  $override_title = isset($atts['override_title']) ? $atts['override_title'] : false;
90
  $days_to_show = isset($atts['forecast_days']) ? $atts['forecast_days'] : 5;
91
  $show_stats = (isset($atts['hide_stats']) AND $atts['hide_stats'] == 1) ? 0 : 1;
92
+ $show_attribution = (isset($atts['hide_attribution']) AND $atts['hide_attribution'] == 1) ? 0 : 1;
93
  $background_by_weather = (isset($atts['background_by_weather']) AND $atts['background_by_weather'] == 1) ? 1 : 0;
94
  $show_link = (isset($atts['show_link']) AND $atts['show_link'] == 1) ? 1 : 0;
95
  $background = isset($atts['background']) ? $atts['background'] : false;
425
  $rtn .= "</div> <!-- /.awesome-weather-more-weather-link -->";
426
  }
427
 
428
+ if( $show_attribution ) $rtn .= "<div class=\"awesome-weather-attribution\">" . __('Weather from', 'awesome-weather') . " OpenWeatherMap</div>";
429
+
430
  if($background)
431
  {
432
  if( !$background_by_weather) $rtn .= "</div><!-- /.awesome-weather-darken -->";
433
  $rtn .= "</div><!-- /.awesome-weather-cover -->";
434
  }
435
+
436
  $rtn .= "</div> <!-- /.awesome-weather-wrap -->";
 
437
  return $rtn;
438
  }
439
 
readme.txt CHANGED
@@ -12,7 +12,7 @@ Finally beautiful weather widgets for your beautiful site.
12
 
13
  == Description ==
14
 
15
- >[Pro Version](https://halgatewood.com/downloads/awesome-weather-widget-pro/) available. Weather icons, New Layouts and Custom Templates, Weather by Yahoo! (no API key required), User Location Detection and more!
16
 
17
  This plugin allows you to easily add super clean (and awesome) weather widgets to your site.
18
 
@@ -87,6 +87,9 @@ The easiest shortcode setting is just: `[awesome-weather location="Oklahoma City
87
 
88
  == Upgrade Notice ==
89
 
 
 
 
90
  = 1.5.7 =
91
  Updated the language .pot file. A few new text items have been added and some modified. Fixed location searches that contain commas
92
 
@@ -185,6 +188,10 @@ Changed API endpoints. Might not find weather without update.
185
 
186
  == Changelog ==
187
 
 
 
 
 
188
  = 1.5.8 =
189
  * Language fixes and improvements
190
  * OpenWeatherMap attribution added as per licensing requirements
12
 
13
  == Description ==
14
 
15
+ >[Pro Version](https://halgatewood.com/downloads/awesome-weather-widget-pro/) available. Weather icons, 5 New Layouts and Custom Templates, Weather by Yahoo!, User Location Detection and more!
16
 
17
  This plugin allows you to easily add super clean (and awesome) weather widgets to your site.
18
 
87
 
88
  == Upgrade Notice ==
89
 
90
+ = 1.5.9 =
91
+ Checkbox to hide the attribution in the widget settings or use shortcode attribute hide_attribution="1"
92
+
93
  = 1.5.7 =
94
  Updated the language .pot file. A few new text items have been added and some modified. Fixed location searches that contain commas
95
 
188
 
189
  == Changelog ==
190
 
191
+ = 1.5.9 =
192
+ * Updated language to allow for custom translations located at: wp-content/languages/awesome-weather/awesome-weather-{locale}.mo
193
+ * Checkbox to hide the attribution in the widget settings or use shortcode attribute hide_attribution="1"
194
+
195
  = 1.5.8 =
196
  * Language fixes and improvements
197
  * OpenWeatherMap attribution added as per licensing requirements
widget.php CHANGED
@@ -22,6 +22,7 @@ class AwesomeWeatherWidget extends WP_Widget
22
  $background = isset($instance['background']) ? $instance['background'] : false;
23
  $custom_bg_color = isset($instance['custom_bg_color']) ? $instance['custom_bg_color'] : false;
24
  $text_color = isset($instance['text_color']) ? $instance['text_color'] : "#ffffff";
 
25
 
26
  echo $before_widget;
27
  if($widget_title != "") echo $before_title . $widget_title . $after_title;
@@ -37,7 +38,8 @@ class AwesomeWeatherWidget extends WP_Widget
37
  'background' => $background,
38
  'custom_bg_color' => $custom_bg_color,
39
  'background_by_weather' => $background_by_weather,
40
- 'text_color' => $text_color
 
41
  ));
42
  echo $after_widget;
43
  }
@@ -57,6 +59,7 @@ class AwesomeWeatherWidget extends WP_Widget
57
  $instance['text_color'] = strip_tags($new_instance['text_color']);
58
  $instance['background_by_weather'] = (isset($new_instance['background_by_weather']) AND $new_instance['background_by_weather'] == 1) ? 1 : 0;
59
  $instance['hide_stats'] = (isset($new_instance['hide_stats']) AND $new_instance['hide_stats'] == 1) ? 1 : 0;
 
60
  $instance['show_link'] = (isset($new_instance['show_link']) AND $new_instance['show_link'] == 1) ? 1 : 0;
61
  return $instance;
62
  }
@@ -73,7 +76,8 @@ class AwesomeWeatherWidget extends WP_Widget
73
  $units = (isset($instance['units']) AND strtoupper($instance['units']) == "C") ? "C" : "F";
74
  $forecast_days = isset($instance['forecast_days']) ? esc_attr($instance['forecast_days']) : 5;
75
  $hide_stats = (isset($instance['hide_stats']) AND $instance['hide_stats'] == 1) ? 1 : 0;
76
- $background_by_weather = (isset($instance['background_by_weather']) AND $instance['background_by_weather'] == 1) ? 1 : 0;
 
77
  $show_link = (isset($instance['show_link']) AND $instance['show_link'] == 1) ? 1 : 0;
78
  $background = isset($instance['background']) ? esc_attr($instance['background']) : "";
79
  $custom_bg_color = isset($instance['custom_bg_color']) ? esc_attr($instance['custom_bg_color']) : "";
@@ -208,9 +212,14 @@ class AwesomeWeatherWidget extends WP_Widget
208
 
209
  </p>
210
 
 
 
 
 
 
211
  <p>
212
  <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"'; ?> />
213
- <label for="<?php echo $this->get_field_id('show_link'); ?>"><?php _e('Link to OpenWeatherMap', 'awesome-weather'); ?></label> &nbsp;
214
  </p>
215
 
216
  <p>
22
  $background = isset($instance['background']) ? $instance['background'] : false;
23
  $custom_bg_color = isset($instance['custom_bg_color']) ? $instance['custom_bg_color'] : false;
24
  $text_color = isset($instance['text_color']) ? $instance['text_color'] : "#ffffff";
25
+ $hide_attribution = (isset($instance['hide_attribution']) AND $instance['hide_attribution'] == 1) ? 1 : 0;
26
 
27
  echo $before_widget;
28
  if($widget_title != "") echo $before_title . $widget_title . $after_title;
38
  'background' => $background,
39
  'custom_bg_color' => $custom_bg_color,
40
  'background_by_weather' => $background_by_weather,
41
+ 'text_color' => $text_color,
42
+ 'hide_attribution' => $hide_attribution
43
  ));
44
  echo $after_widget;
45
  }
59
  $instance['text_color'] = strip_tags($new_instance['text_color']);
60
  $instance['background_by_weather'] = (isset($new_instance['background_by_weather']) AND $new_instance['background_by_weather'] == 1) ? 1 : 0;
61
  $instance['hide_stats'] = (isset($new_instance['hide_stats']) AND $new_instance['hide_stats'] == 1) ? 1 : 0;
62
+ $instance['hide_attribution'] = (isset($new_instance['hide_attribution']) AND $new_instance['hide_attribution'] == 1) ? 1 : 0;
63
  $instance['show_link'] = (isset($new_instance['show_link']) AND $new_instance['show_link'] == 1) ? 1 : 0;
64
  return $instance;
65
  }
76
  $units = (isset($instance['units']) AND strtoupper($instance['units']) == "C") ? "C" : "F";
77
  $forecast_days = isset($instance['forecast_days']) ? esc_attr($instance['forecast_days']) : 5;
78
  $hide_stats = (isset($instance['hide_stats']) AND $instance['hide_stats'] == 1) ? 1 : 0;
79
+ $hide_attribution = (isset($instance['hide_attribution']) AND $instance['hide_attribution'] == 1) ? 1 : 0;
80
+ $background_by_weather = (isset($instance['background_by_weather']) AND $instance['background_by_weather'] == 1) ? 1 : 0;
81
  $show_link = (isset($instance['show_link']) AND $instance['show_link'] == 1) ? 1 : 0;
82
  $background = isset($instance['background']) ? esc_attr($instance['background']) : "";
83
  $custom_bg_color = isset($instance['custom_bg_color']) ? esc_attr($instance['custom_bg_color']) : "";
212
 
213
  </p>
214
 
215
+ <p>
216
+ <input id="<?php echo $this->get_field_id('hide_attribution'); ?>" name="<?php echo $this->get_field_name('hide_attribution'); ?>" type="checkbox" value="1" <?php if($hide_attribution) echo ' checked="checked"'; ?> />
217
+ <label for="<?php echo $this->get_field_id('hide_attribution'); ?>"><?php _e('Hide Weather Attribution', 'awesome-weather-pro'); ?></label>
218
+ </p>
219
+
220
  <p>
221
  <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"'; ?> />
222
+ <label for="<?php echo $this->get_field_id('show_link'); ?>"><?php _e('Link to Extended Forecast', 'awesome-weather'); ?></label> &nbsp;
223
  </p>
224
 
225
  <p>