Weather Underground - Version 1.0.1

Version Description

  • Added a check for PHP5, which is required for the plugin.
Download this release

Release Info

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

Code changes from version 1.0 to 1.0.1

Files changed (2) hide show
  1. readme.txt +12 -1
  2. wunderground.php +27 -16
readme.txt CHANGED
@@ -12,7 +12,7 @@ Get accurate and beautiful weather forecasts powered by Wunderground.com for you
12
 
13
  <h3>Wunderground is the best weather site.</h3>
14
 
15
- __All your weather are belong to us!__ 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.
16
 
17
  This plugin uses the Wunderground API to gather its accurate forcasts.
18
 
@@ -81,6 +81,11 @@ If you're a maniac for shortcodes, and you want all control all the time, this i
81
 
82
  == Frequently Asked Questions ==
83
 
 
 
 
 
 
84
  = I want to modify the forecast output. How do I do that? =
85
 
86
  <pre>
@@ -107,10 +112,16 @@ This plugin is a perfect compliment for regional websites (about a city or town)
107
 
108
  == Changelog ==
109
 
 
 
 
110
  = 1.0 =
111
  * Initial launch
112
 
113
  == Upgrade Notice ==
114
 
 
 
 
115
  = 1.0 =
116
  * Blastoff!
12
 
13
  <h3>Wunderground is the best 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.
16
 
17
  This plugin uses the Wunderground API to gather its accurate forcasts.
18
 
81
 
82
  == Frequently Asked Questions ==
83
 
84
+ = I am unable to activate the plugin. =
85
+ This plugin requires PHP5, and Version 1.0 does not check for PHP compatibility. In future versions, it will show a more meaningful error and also support PHP 4.
86
+
87
+ For now, however, options are to upgrade the version of PHP (contact your web host) or to not use the plugin.
88
+
89
  = I want to modify the forecast output. How do I do that? =
90
 
91
  <pre>
112
 
113
  == Changelog ==
114
 
115
+ = 1.0.1 =
116
+ * Added a check for PHP5, which is required for the plugin.
117
+
118
  = 1.0 =
119
  * Initial launch
120
 
121
  == Upgrade Notice ==
122
 
123
+ = 1.0.1 =
124
+ * Added a check for PHP5, which is required for the plugin. Users will no longer get `Parse error: syntax error, unexpected '{' in {your-site}/wunderground.php on line 412` error
125
+
126
  = 1.0 =
127
  * Blastoff!
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.0
7
  Author: Katz Web Services, Inc.
8
  Author URI: http://www.seodenver.com/
9
  */
@@ -23,20 +23,31 @@ class wp_wunderground {
23
  var $showlink = 'yes';
24
 
25
  function wp_wunderground() {
26
-
27
- add_action('admin_menu', array(&$this, 'admin'));
28
- add_filter('plugin_action_links', array(&$this, 'settings_link'), 10, 2 );
29
- add_action('admin_init', array(&$this, 'settings_init') );
30
- $this->options = get_option('wp_wunderground', array());
31
- add_shortcode('forecast', array(&$this, 'build_forecast'));
32
-
33
- // Set each setting...
34
- foreach($this->options as $key=> $value) {
35
- $this->{$key} = $value;
36
- }
37
 
38
- if(!is_admin()) {
39
- add_action('wp_footer', array(&$this,'showlink'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
  }
42
 
@@ -170,7 +181,7 @@ class wp_wunderground {
170
  if($this->showlink == 'yes') {
171
  mt_srand(crc32($_SERVER['REQUEST_URI'])); // Keep links the same on the same page
172
 
173
- $urls = array('http://www.seodenver.com/wunderground/?ref=foot', 'http://wordpress.org/extend/plugins/wunderground/', 'http://www.denversnowremovalservice.com/weather/');
174
  $url = $urls[mt_rand(0, count($urls)-1)];
175
  $names = array('WP Wunderground', 'Wordpress Weather', 'Wunderground for WordPress');
176
  $name = $names[mt_rand(0, count($names)-1)];
@@ -408,7 +419,7 @@ EOD;
408
  if(!$todaylabel) { $todaylabel = $this->todaylabel; }
409
  if(!$datelabel) { $datelabel = $this->datelabel; }
410
  extract($date);
411
-
412
  try {
413
  $dt = new DateTime("$year-$month-$day", new DateTimeZone($tz_long));
414
  $dt->setTime($hour,$min,$sec);
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.0.1
7
  Author: Katz Web Services, Inc.
8
  Author URI: http://www.seodenver.com/
9
  */
23
  var $showlink = 'yes';
24
 
25
  function wp_wunderground() {
 
 
 
 
 
 
 
 
 
 
 
26
 
27
+ // array_combine() is PHP5 only
28
+ if(!function_exists('array_combine')) {
29
+ add_action('admin_notices', 'wpwundergroundphp5error');
30
+ function wpwundergroundphp5error() {
31
+ $out = '<div class="error" id="messages"><p>';
32
+ $out .= 'The WP Wunderground plugin requires PHP5. Your server is running PHP4. Please ask your hosting company to upgrade your server to PHP5. It should be free.';
33
+ $out .= '</p></div>';
34
+ echo $out;
35
+ }
36
+ } else {
37
+ add_action('admin_menu', array(&$this, 'admin'));
38
+ add_filter('plugin_action_links', array(&$this, 'settings_link'), 10, 2 );
39
+ add_action('admin_init', array(&$this, 'settings_init') );
40
+ $this->options = get_option('wp_wunderground', array());
41
+ add_shortcode('forecast', array(&$this, 'build_forecast'));
42
+
43
+ // Set each setting...
44
+ foreach($this->options as $key=> $value) {
45
+ $this->{$key} = $value;
46
+ }
47
+
48
+ if(!is_admin()) {
49
+ add_action('wp_footer', array(&$this,'showlink'));
50
+ }
51
  }
52
  }
53
 
181
  if($this->showlink == 'yes') {
182
  mt_srand(crc32($_SERVER['REQUEST_URI'])); // Keep links the same on the same page
183
 
184
+ $urls = array('http://www.seodenver.com/wunderground/?ref=foot', 'http://wordpress.org/extend/plugins/wunderground/', 'http://www.denversnowremovalservice.com');
185
  $url = $urls[mt_rand(0, count($urls)-1)];
186
  $names = array('WP Wunderground', 'Wordpress Weather', 'Wunderground for WordPress');
187
  $name = $names[mt_rand(0, count($names)-1)];
419
  if(!$todaylabel) { $todaylabel = $this->todaylabel; }
420
  if(!$datelabel) { $datelabel = $this->datelabel; }
421
  extract($date);
422
+
423
  try {
424
  $dt = new DateTime("$year-$month-$day", new DateTimeZone($tz_long));
425
  $dt->setTime($hour,$min,$sec);