Weather Underground - Version 1.2.2

Version Description

  • Added GoDaddy compatibility by switching from simplexml_load_file to wp_remote_fopen and simplexml_load_string (thanks, rjune)
Download this release

Release Info

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

Code changes from version 1.2.1 to 1.2.2

Files changed (2) hide show
  1. readme.txt +3 -0
  2. wunderground.php +5 -4
readme.txt CHANGED
@@ -149,6 +149,9 @@ For previous versions, it is recommended to use a caching plugin (such as WP Sup
149
 
150
  == Changelog ==
151
 
 
 
 
152
  = 1.2.1 =
153
  * Fixed issue with "Give thanks" link
154
 
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
+
155
  = 1.2.1 =
156
  * Fixed issue with "Give thanks" link
157
 
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.1
7
  Author: Katz Web Services, Inc.
8
  Author URI: http://www.seodenver.com/
9
  */
@@ -39,11 +39,11 @@ class wp_wunderground {
39
  }
40
 
41
  // Some hosts don't support it...
42
- if(!function_exists('simplexml_load_file')) {
43
  add_action('admin_notices', 'wpwundergroundsimplexmlerror');
44
  function wpwundergroundsimplexmlerror() {
45
  $out = '<div class="error" id="messages"><p>';
46
- $out .= 'The WP Wunderground plugin requires the PHP function <code>simplexml_load_file()</code>. Your server has this disabled. Please ask your hosting company to enable <code>simplexml</code>.';
47
  $out .= '</p></div>';
48
  echo $out;
49
  }
@@ -422,7 +422,8 @@ EOD;
422
  }
423
 
424
  if(!$table || !$cache || isset($_REQUEST['cache'])) {
425
- if(!$xml=simplexml_load_file($this->url.$location)){
 
426
  trigger_error('Error reading XML file',E_USER_ERROR);
427
  return '<!-- WP Wunderground Error : Error reading XML file at '.$this->url.$this->location.' -->'.$content;
428
  } elseif(empty($xml->simpleforecast->forecastday)) {
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
  */
39
  }
40
 
41
  // Some hosts don't support it...
42
+ if(!function_exists('simplexml_load_string')) {
43
  add_action('admin_notices', 'wpwundergroundsimplexmlerror');
44
  function wpwundergroundsimplexmlerror() {
45
  $out = '<div class="error" id="messages"><p>';
46
+ $out .= 'The WP Wunderground plugin requires the PHP function <code>simplexml_load_string()</code>. Your server has this disabled. Please ask your hosting company to enable <code>simplexml_load_string</code>.';
47
  $out .= '</p></div>';
48
  echo $out;
49
  }
422
  }
423
 
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)) {