Weather Underground - Version 1.2.4

Version Description

  • Removed error generation when XML file cannot be read (Error on line 427, as reported). Now, it just outputs an HTML comment error message.
Download this release

Release Info

Developer katzwebdesign
Plugin Icon 128x128 Weather Underground
Version 1.2.4
Comparing to
See all releases

Code changes from version 1.2.2 to 1.2.4

Files changed (2) hide show
  1. readme.txt +20 -1
  2. wunderground.php +13 -11
readme.txt CHANGED
@@ -1,7 +1,7 @@
1
  === Weather Forecast - WP Wunderground ===
2
  Tags: weather, weather.com, wunderground, weatherbug, forecast, widget, shortcode, Yahoo weather, Yahoo! Weather, wp-weather, wp weather, local weather, weather man, weather widget, cool weather, accuweather, get weather, wordpress weather
3
  Requires at least: 2.8
4
- Tested up to: 3.0.2
5
  Stable tag: trunk
6
  Contributors: katzwebdesign
7
  Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zackkatz%40gmail%2ecom&item_name=WP%20Wunderground%20for%20WordPress&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
@@ -10,6 +10,8 @@ Get accurate and beautiful weather forecasts powered by Wunderground.com for you
10
 
11
  == Description ==
12
 
 
 
13
  <h3>Wunderground is the best WordPress weather site.</h3>
14
 
15
  Wunderground.com has the most accurate and in-depth weather information. They're also not evil corporate giants, and are weather geeks, which is nice.
@@ -149,6 +151,13 @@ For previous versions, it is recommended to use a caching plugin (such as WP Sup
149
 
150
  == Changelog ==
151
 
 
 
 
 
 
 
 
152
  = 1.2.2 =
153
  * Added GoDaddy compatibility by switching from `simplexml_load_file` to `wp_remote_fopen` and `simplexml_load_string` (<a href="http://wordpress.org/support/topic/490946">thanks, rjune</a>)
154
 
@@ -179,6 +188,16 @@ For previous versions, it is recommended to use a caching plugin (such as WP Sup
179
 
180
  == Upgrade Notice ==
181
 
 
 
 
 
 
 
 
 
 
 
182
  = 1.2.1 =
183
  * Fixed issue with "Give thanks" link
184
 
1
  === Weather Forecast - WP Wunderground ===
2
  Tags: weather, weather.com, wunderground, weatherbug, forecast, widget, shortcode, Yahoo weather, Yahoo! Weather, wp-weather, wp weather, local weather, weather man, weather widget, cool weather, accuweather, get weather, wordpress weather
3
  Requires at least: 2.8
4
+ Tested up to: 3.0.3
5
  Stable tag: trunk
6
  Contributors: katzwebdesign
7
  Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zackkatz%40gmail%2ecom&item_name=WP%20Wunderground%20for%20WordPress&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
10
 
11
  == Description ==
12
 
13
+ <blockquote><p>"[WP Wunderground] is by far, the best weather plugin i've ever seen on a CMS before. Not even Joomla has something so powerful, good looking and yet easy to implement."<br /><cite>Robson</cite></p></blockquote>
14
+
15
  <h3>Wunderground is the best WordPress weather site.</h3>
16
 
17
  Wunderground.com has the most accurate and in-depth weather information. They're also not evil corporate giants, and are weather geeks, which is nice.
151
 
152
  == Changelog ==
153
 
154
+ = 1.2.4 =
155
+ * Removed error generation when XML file cannot be read (Error on line 427, <a href="http://wordpress.org/support/topic/506565" rel="nofollow">as reported</a>). Now, it just outputs an HTML comment error message.
156
+
157
+ = 1.2.3 =
158
+ * Fixed bug where Degree Measurement select drop-down would not show saved state as Celsius, even though it was working properly. (thanks <a href="http://www.OwlConcept.com">Robson</a>)
159
+ * Added proper HTML escaping for High/Low formatting and temperature output
160
+
161
  = 1.2.2 =
162
  * Added GoDaddy compatibility by switching from `simplexml_load_file` to `wp_remote_fopen` and `simplexml_load_string` (<a href="http://wordpress.org/support/topic/490946">thanks, rjune</a>)
163
 
188
 
189
  == Upgrade Notice ==
190
 
191
+ = 1.2.4 =
192
+ * Removed error generation when XML file cannot be read (Error on line 427, <a href="http://wordpress.org/support/topic/506565" rel="nofollow">as reported</a>). Now, it just outputs an HTML comment error message.
193
+
194
+ = 1.2.3 =
195
+ * Fixed bug where Degree Measurement select drop-down would not show saved state as Celsius, even though it was working properly. (thanks <a href="http://www.OwlConcept.com" rel="nofollow">Robson</a>)
196
+ * Added proper HTML escaping for High/Low formatting and temperature output
197
+
198
+ = 1.2.2 =
199
+ * Added GoDaddy compatibility by switching from `simplexml_load_file` to `wp_remote_fopen` and `simplexml_load_string` (<a href="http://wordpress.org/support/topic/490946">thanks, rjune</a>)
200
+
201
  = 1.2.1 =
202
  * Fixed issue with "Give thanks" link
203
 
wunderground.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Wunderground
4
  Plugin URI: http://www.seodenver.com/wunderground/
5
  Description: Get accurate and beautiful weather forecasts powered by Wunderground.com for your content or your sidebar.
6
- Version: 1.2.2
7
  Author: Katz Web Services, Inc.
8
  Author URI: http://www.seodenver.com/
9
  */
@@ -105,7 +105,7 @@ class wp_wunderground {
105
  $rows[] = array(
106
  'id' => 'wp_wunderground_location',
107
  'label' => __('Location', 'wp_wunderground'),
108
- 'content' => "<input type='text' name='wp_wunderground[location]' id='wp_wunderground_location' value='".esc_attr($this->location)."' size='40' style='width:95%!important;' /><br /><small>The location can be entered as: ZIP code (US or Canadian); city state; city, state; city; state; country; airport code (3-letter or 4-letter); lat, long.</small>",
109
  'desc' => 'The location for the forcast.'
110
  );
111
  $rows[] = array(
@@ -125,21 +125,21 @@ class wp_wunderground {
125
  $rows[] = array(
126
  'id' => 'wp_wunderground_caption',
127
  'label' => __('Forecast Caption', 'wp_wunderground'),
128
- 'content' => "<input type='text' name='wp_wunderground[caption]' id='wp_wunderground_caption' value='".esc_attr($this->caption)."' size='40' style='width:95%!important;' />",
129
  'desc' => 'This will display above the forecast. Think of it like a forecast title.'
130
  );
131
 
132
  $rows[] = array(
133
  'id' => 'wp_wunderground_datelabel',
134
  'label' => __('"All Dates" Label', 'wp_wunderground'),
135
- 'content' => "<input type='text' name='wp_wunderground[datelabel]' id='wp_wunderground_datelabel' value='".esc_attr($this->datelabel)."' size='40' style='width:95%!important;' />",
136
  'desc' => 'How all dates appear by default. See instructions in the "Date Formatting" section of the box on the right &rarr;'
137
  );
138
 
139
  $rows[] = array(
140
  'id' => 'wp_wunderground_todaylabel',
141
  'label' => __('"Today\'s Date" Label', 'wp_wunderground'),
142
- 'content' => "<input type='text' name='wp_wunderground[todaylabel]' id='wp_wunderground_todaylabel' value='".esc_attr($this->todaylabel)."' size='40' style='width:95%!important;' />",
143
  'desc' => 'How today\'s date appears (overrides All Dates format). See instructions in the "Date Formatting" section of the box on the right &rarr;'
144
  );
145
 
@@ -147,7 +147,7 @@ class wp_wunderground {
147
  'id' => 'wp_wunderground_highlow',
148
  'label' => __('"High/Low" Formatting', 'wp_wunderground'),
149
  'desc' => 'See instructions in the "Highs &amp; Lows Formatting" section of the box on the right &rarr;',
150
- 'content' => "<input type='text' name='wp_wunderground[highlow]' id='wp_wunderground_highlow' value='".esc_attr($this->highlow)."' size='40' style='width:95%!important;' />"
151
  );
152
 
153
 
@@ -242,7 +242,7 @@ class wp_wunderground {
242
  $c = ' selected="selected"';
243
  $output = '<select id="wp_wunderground_measurement" name="wp_wunderground[measurement]">';
244
  $output .= ' <option value="fahrenheit"'; if($this->measurement == 'fahrenheit') { $output .= $c; } $output .= '>U.S. (&deg;F)</option>';
245
- $output .= ' <option value="celsius"'; if($this->measurement == 'celcius') { $output .= $c; } $output .= '>Metric (&deg;C)</option>';
246
  $output .= '</select>';
247
  $output .= '<label for="wp_wunderground_measurement" style="padding-left:10px;">Fahrenheit or Celsius:</label>';
248
  return $output;
@@ -413,7 +413,7 @@ EOD;
413
  if($cache) {
414
  // Shorten the settings into an encrypted 40-byte string so that
415
  // it's never longer than the 64-byte database column
416
- foreach($settings as $k => $v) { $settings[$k] = esc_attr($v); }
417
  $transient_title = implode('_', $settings);
418
  $transient_title = 'wund_'.sha1($transient_title);
419
 
@@ -424,7 +424,7 @@ EOD;
424
  if(!$table || !$cache || isset($_REQUEST['cache'])) {
425
  $xmlStr = @wp_remote_fopen(trim($this->url.urlencode($location)));
426
  if(is_wp_error($xmlStr) || !$xml=simplexml_load_string($xmlStr)){
427
- trigger_error('Error reading XML file',E_USER_ERROR);
428
  return '<!-- WP Wunderground Error : Error reading XML file at '.$this->url.$this->location.' -->'.$content;
429
  } elseif(empty($xml->simpleforecast->forecastday)) {
430
  return '<!-- WP Wunderground Error : Weather feed was empty from '.$this->url.$this->location.' -->'.$content;
@@ -446,12 +446,14 @@ EOD;
446
 
447
  $temp = str_replace('%%high%%', $high, $highlow);
448
  $temp = str_replace('%%low%%', $low, $temp);
 
 
449
  $label = $this->format_date($date, $todaylabel, $datelabel);
450
 
451
  $tablehead .= "\n\t\t\t\t\t\t\t".'<th scope="col" width="'.$colwidth.'%" align="'.$align.'">'.$label.'</th>';
452
 
453
  $tablebody .=
454
- "\n\t\t\t\t\t\t\t".'<td align="'.$align.'" class="'.esc_attr($class).'_'.sanitize_title($conditions).'">'.apply_filters('wp_wunderground_forecast_icon',$icon).'<div class="wp_wund_conditions">'.apply_filters('wp_wunderground_forecast_conditions',$conditions).'</div>'.apply_filters('wp_wunderground_forecast_temp',$temp).'</td>';
455
  }
456
  $i++;
457
  }
@@ -459,7 +461,7 @@ EOD;
459
  $caption = "\n\t\t\t\t\t<caption>{$caption}</caption>";
460
  }
461
  $table = '
462
- <table cellpadding="0" cellspacing="0" border="0"'.$width.' class="'.esc_attr($class).'">'.$caption.'
463
  <thead>
464
  <tr>'.$tablehead.'
465
  </tr>
3
  Plugin Name: WP Wunderground
4
  Plugin URI: http://www.seodenver.com/wunderground/
5
  Description: Get accurate and beautiful weather forecasts powered by Wunderground.com for your content or your sidebar.
6
+ Version: 1.2.4
7
  Author: Katz Web Services, Inc.
8
  Author URI: http://www.seodenver.com/
9
  */
105
  $rows[] = array(
106
  'id' => 'wp_wunderground_location',
107
  'label' => __('Location', 'wp_wunderground'),
108
+ 'content' => "<input type='text' name='wp_wunderground[location]' id='wp_wunderground_location' value='".esc_attr__($this->location)."' size='40' style='width:95%!important;' /><br /><small>The location can be entered as: ZIP code (US or Canadian); city state; city, state; city; state; country; airport code (3-letter or 4-letter); lat, long.</small>",
109
  'desc' => 'The location for the forcast.'
110
  );
111
  $rows[] = array(
125
  $rows[] = array(
126
  'id' => 'wp_wunderground_caption',
127
  'label' => __('Forecast Caption', 'wp_wunderground'),
128
+ 'content' => "<input type='text' name='wp_wunderground[caption]' id='wp_wunderground_caption' value='".esc_attr__($this->caption)."' size='40' style='width:95%!important;' />",
129
  'desc' => 'This will display above the forecast. Think of it like a forecast title.'
130
  );
131
 
132
  $rows[] = array(
133
  'id' => 'wp_wunderground_datelabel',
134
  'label' => __('"All Dates" Label', 'wp_wunderground'),
135
+ 'content' => "<input type='text' name='wp_wunderground[datelabel]' id='wp_wunderground_datelabel' value='".esc_attr__($this->datelabel)."' size='40' style='width:95%!important;' />",
136
  'desc' => 'How all dates appear by default. See instructions in the "Date Formatting" section of the box on the right &rarr;'
137
  );
138
 
139
  $rows[] = array(
140
  'id' => 'wp_wunderground_todaylabel',
141
  'label' => __('"Today\'s Date" Label', 'wp_wunderground'),
142
+ 'content' => "<input type='text' name='wp_wunderground[todaylabel]' id='wp_wunderground_todaylabel' value='".esc_attr__($this->todaylabel)."' size='40' style='width:95%!important;' />",
143
  'desc' => 'How today\'s date appears (overrides All Dates format). See instructions in the "Date Formatting" section of the box on the right &rarr;'
144
  );
145
 
147
  'id' => 'wp_wunderground_highlow',
148
  'label' => __('"High/Low" Formatting', 'wp_wunderground'),
149
  'desc' => 'See instructions in the "Highs &amp; Lows Formatting" section of the box on the right &rarr;',
150
+ 'content' => "<input type='text' name='wp_wunderground[highlow]' id='wp_wunderground_highlow' value='".htmlspecialchars($this->highlow)."' size='40' style='width:95%!important;' />"
151
  );
152
 
153
 
242
  $c = ' selected="selected"';
243
  $output = '<select id="wp_wunderground_measurement" name="wp_wunderground[measurement]">';
244
  $output .= ' <option value="fahrenheit"'; if($this->measurement == 'fahrenheit') { $output .= $c; } $output .= '>U.S. (&deg;F)</option>';
245
+ $output .= ' <option value="celsius"'; if($this->measurement == 'celsius') { $output .= $c; } $output .= '>Metric (&deg;C)</option>';
246
  $output .= '</select>';
247
  $output .= '<label for="wp_wunderground_measurement" style="padding-left:10px;">Fahrenheit or Celsius:</label>';
248
  return $output;
413
  if($cache) {
414
  // Shorten the settings into an encrypted 40-byte string so that
415
  // it's never longer than the 64-byte database column
416
+ foreach($settings as $k => $v) { $settings[$k] = esc_attr__($v); }
417
  $transient_title = implode('_', $settings);
418
  $transient_title = 'wund_'.sha1($transient_title);
419
 
424
  if(!$table || !$cache || isset($_REQUEST['cache'])) {
425
  $xmlStr = @wp_remote_fopen(trim($this->url.urlencode($location)));
426
  if(is_wp_error($xmlStr) || !$xml=simplexml_load_string($xmlStr)){
427
+ #trigger_error('Error reading XML file',E_USER_ERROR);
428
  return '<!-- WP Wunderground Error : Error reading XML file at '.$this->url.$this->location.' -->'.$content;
429
  } elseif(empty($xml->simpleforecast->forecastday)) {
430
  return '<!-- WP Wunderground Error : Weather feed was empty from '.$this->url.$this->location.' -->'.$content;
446
 
447
  $temp = str_replace('%%high%%', $high, $highlow);
448
  $temp = str_replace('%%low%%', $low, $temp);
449
+ $temp = htmlspecialchars_decode($temp);
450
+
451
  $label = $this->format_date($date, $todaylabel, $datelabel);
452
 
453
  $tablehead .= "\n\t\t\t\t\t\t\t".'<th scope="col" width="'.$colwidth.'%" align="'.$align.'">'.$label.'</th>';
454
 
455
  $tablebody .=
456
+ "\n\t\t\t\t\t\t\t".'<td align="'.$align.'" class="'.esc_attr__($class).'_'.sanitize_title($conditions).'">'.apply_filters('wp_wunderground_forecast_icon',$icon).'<div class="wp_wund_conditions">'.apply_filters('wp_wunderground_forecast_conditions',$conditions).'</div>'.apply_filters('wp_wunderground_forecast_temp',$temp).'</td>';
457
  }
458
  $i++;
459
  }
461
  $caption = "\n\t\t\t\t\t<caption>{$caption}</caption>";
462
  }
463
  $table = '
464
+ <table cellpadding="0" cellspacing="0" border="0"'.$width.' class="'.esc_attr__($class).'">'.$caption.'
465
  <thead>
466
  <tr>'.$tablehead.'
467
  </tr>