Changeset 2374331
- Timestamp:
- 09/03/2020 07:57:09 AM (6 years ago)
- Location:
- weatherzone
- Files:
-
- 6 added
- 4 edited
- 1 copied
-
tags/1.2.8 (copied) (copied from weatherzone/trunk)
-
tags/1.2.8/.github (added)
-
tags/1.2.8/.github/workflows (added)
-
tags/1.2.8/.github/workflows/deploy.yml (added)
-
tags/1.2.8/readme.txt (modified) (5 diffs)
-
tags/1.2.8/weatherzone.php (modified) (12 diffs)
-
trunk/.github (added)
-
trunk/.github/workflows (added)
-
trunk/.github/workflows/deploy.yml (added)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/weatherzone.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
weatherzone/tags/1.2.8/readme.txt
r1682377 r2374331 1 1 === WeatherZone Embed === 2 2 Contributors: jamescollins, glenn-om4 3 Donate link: https://om4.com.au/wordpress-plugins/#donate4 3 Tags: weatherzone, weather, australia, shortcode, wp, multisite, wpmu 5 4 Requires at least: 3.5 6 Tested up to: 4.87 Stable tag: 1.2. 75 Tested up to: 5.5 6 Stable tag: 1.2.8 8 7 License: GPLv2 or later 9 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 15 14 Allows you to easily embed Australian weather forecast and observation data on your website. 16 15 17 Data is provided in the form of a [WeatherZone.com.au button](http://www.weatherzone.com.au/about/freeweatherbutton.jsp). 16 Data is provided in the form of a [WeatherZone.com.au button](http://www.weatherzone.com.au/about/freeweatherbutton.jsp). 18 17 19 18 Supports both weather forecast and current weather observations buttons. … … 77 76 78 77 Yes. As of v1.0.1, you can use the [weatherzone] shortcode in a text widget. 79 78 80 79 81 80 == Screenshots == … … 83 82 84 83 == Changelog == 84 85 = 1.2.8= 86 * WordPress 5.5 compatibility. 85 87 86 88 = 1.2.7= … … 123 125 * Initial release. 124 126 125 == Upgrade Notice == 127 == Upgrade Notice == 126 128 127 129 = 1.2.2 = -
weatherzone/tags/1.2.8/weatherzone.php
r1682377 r2374331 2 2 /* 3 3 Plugin Name: WeatherZone Embed 4 Plugin URI: https://om4. com.au/plugins/weatherzone/4 Plugin URI: https://om4.io/plugins/weatherzone/ 5 5 Description: Allows you to embed WeatherZone.com.au weather buttons on your site. Supports both weather forecast and current weather observations buttons. 6 Version: 1.2. 76 Version: 1.2.8 7 7 Author: OM4 8 Author URI: https://om4. com.au/plugins/8 Author URI: https://om4.io/ 9 9 Text Domain: om4-weatherzone 10 10 License: GPLv2 or later … … 31 31 32 32 class OM4_WeatherZone { 33 34 var $version = '1.2. 6';35 33 34 var $version = '1.2.8'; 35 36 36 var $dbVersion = 1; 37 37 38 38 var $installedVersion; 39 39 40 40 var $dirname; 41 41 42 42 var $url; 43 43 44 44 var $optionName = 'om4_weatherzone_db_version'; 45 45 46 46 static $number = 1; 47 47 48 48 /** 49 49 * Constructor … … 51 51 */ 52 52 public function __construct() { 53 53 54 54 // Store the name of the directory that this plugin is installed in 55 55 $this->dirname = str_replace('/weatherzone.php', '', plugin_basename(__FILE__)); 56 56 57 57 $this->url = plugins_url('weatherzone/'); 58 58 59 59 register_activation_hook(__FILE__, array($this, 'Activate')); 60 60 61 61 add_action('init', array($this, 'LoadDomain')); 62 62 63 63 add_action('init', array($this, 'CheckVersion')); 64 64 65 65 add_action('init', array($this, 'RegisterShortcode')); 66 66 67 67 $this->installedVersion = intval(get_option($this->optionName)); 68 68 } 69 70 /** 71 * In tialise I18n69 70 /** 71 * Initialise I18n 72 72 * 73 73 */ 74 74 public function LoadDomain() { 75 load_plugin_textdomain('om4-weatherzone', false, WP_PLUGIN_DIR.'/'.dirname(plugin_basename(__FILE__)));76 } 77 75 load_plugin_textdomain('om4-weatherzone', false, dirname(plugin_basename(__FILE__))); 76 } 77 78 78 /** 79 79 * Plugin Activation Tasks … … 87 87 } 88 88 } 89 89 90 90 /** 91 91 * Performs any upgrade tasks if required … … 101 101 } 102 102 } 103 103 104 104 /** 105 105 * Register the [weatherzone] shortcode … … 107 107 public function RegisterShortcode() { 108 108 add_shortcode('weatherzone', array($this, 'ShortcodeHandler')); 109 109 110 110 // Parse shortcodes in text widgets 111 111 // Required until http://core.trac.wordpress.org/ticket/10457 is committed 112 112 add_filter('widget_text', 'do_shortcode'); 113 113 } 114 115 114 115 116 116 /** 117 117 * [weatherzone] shortcode handler 118 118 */ 119 119 public function ShortcodeHandler($atts, $content = null) { 120 120 121 121 // List of supported shortcode attributes and their default values 122 122 $defaults = array( … … 126 126 'showradar' => 'true' 127 127 ); 128 128 129 129 // Combine the specified attributes with the default values 130 130 $atts = shortcode_atts( $defaults, $atts); 131 131 132 132 // Valid values for each parameter 133 133 $validValues['mode'] = array('currentweather', 'forecast'); 134 134 $validValues['showradar'] = array('true', 'false'); 135 135 136 136 // Validate each of the parameters 137 137 foreach ($atts as $key => $value) { … … 144 144 } 145 145 } 146 146 147 147 // Ensure the required parameters have been specified 148 148 if (!strlen($atts['mode'])) return; 149 149 if (!strlen($atts['postcode'])) return; 150 150 if (!strlen($atts['showradar'])) return; 151 151 152 152 $html = '<div id="weatherzone_' . self::$number . '" class="weatherzone ' . $atts['mode'] . '">'; 153 153 … … 158 158 $params .= '&locality=' . urlencode($atts['locality']); 159 159 } 160 160 161 161 $html .= <<<EOD 162 162 <!--Weatherzone current weather button--> … … 172 172 EOD; 173 173 break; 174 174 175 175 case 'forecast': 176 176 $params = urlencode($atts['postcode']); … … 178 178 $params .= '&locality=' . urlencode($atts['locality']); 179 179 } 180 180 181 181 $html .= <<<EOD 182 182 <!--Weatherzone forecast button--> … … 193 193 break; 194 194 } 195 195 196 196 $html .= '</div>'; 197 197 198 198 self::$number++; 199 199 200 200 return $html; 201 201 } 202 202 203 203 204 204 private function SaveInstalledVersion() { -
weatherzone/trunk/readme.txt
r1682377 r2374331 1 1 === WeatherZone Embed === 2 2 Contributors: jamescollins, glenn-om4 3 Donate link: https://om4.com.au/wordpress-plugins/#donate4 3 Tags: weatherzone, weather, australia, shortcode, wp, multisite, wpmu 5 4 Requires at least: 3.5 6 Tested up to: 4.87 Stable tag: 1.2. 75 Tested up to: 5.5 6 Stable tag: 1.2.8 8 7 License: GPLv2 or later 9 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 15 14 Allows you to easily embed Australian weather forecast and observation data on your website. 16 15 17 Data is provided in the form of a [WeatherZone.com.au button](http://www.weatherzone.com.au/about/freeweatherbutton.jsp). 16 Data is provided in the form of a [WeatherZone.com.au button](http://www.weatherzone.com.au/about/freeweatherbutton.jsp). 18 17 19 18 Supports both weather forecast and current weather observations buttons. … … 77 76 78 77 Yes. As of v1.0.1, you can use the [weatherzone] shortcode in a text widget. 79 78 80 79 81 80 == Screenshots == … … 83 82 84 83 == Changelog == 84 85 = 1.2.8= 86 * WordPress 5.5 compatibility. 85 87 86 88 = 1.2.7= … … 123 125 * Initial release. 124 126 125 == Upgrade Notice == 127 == Upgrade Notice == 126 128 127 129 = 1.2.2 = -
weatherzone/trunk/weatherzone.php
r1682377 r2374331 2 2 /* 3 3 Plugin Name: WeatherZone Embed 4 Plugin URI: https://om4. com.au/plugins/weatherzone/4 Plugin URI: https://om4.io/plugins/weatherzone/ 5 5 Description: Allows you to embed WeatherZone.com.au weather buttons on your site. Supports both weather forecast and current weather observations buttons. 6 Version: 1.2. 76 Version: 1.2.8 7 7 Author: OM4 8 Author URI: https://om4. com.au/plugins/8 Author URI: https://om4.io/ 9 9 Text Domain: om4-weatherzone 10 10 License: GPLv2 or later … … 31 31 32 32 class OM4_WeatherZone { 33 34 var $version = '1.2. 6';35 33 34 var $version = '1.2.8'; 35 36 36 var $dbVersion = 1; 37 37 38 38 var $installedVersion; 39 39 40 40 var $dirname; 41 41 42 42 var $url; 43 43 44 44 var $optionName = 'om4_weatherzone_db_version'; 45 45 46 46 static $number = 1; 47 47 48 48 /** 49 49 * Constructor … … 51 51 */ 52 52 public function __construct() { 53 53 54 54 // Store the name of the directory that this plugin is installed in 55 55 $this->dirname = str_replace('/weatherzone.php', '', plugin_basename(__FILE__)); 56 56 57 57 $this->url = plugins_url('weatherzone/'); 58 58 59 59 register_activation_hook(__FILE__, array($this, 'Activate')); 60 60 61 61 add_action('init', array($this, 'LoadDomain')); 62 62 63 63 add_action('init', array($this, 'CheckVersion')); 64 64 65 65 add_action('init', array($this, 'RegisterShortcode')); 66 66 67 67 $this->installedVersion = intval(get_option($this->optionName)); 68 68 } 69 70 /** 71 * In tialise I18n69 70 /** 71 * Initialise I18n 72 72 * 73 73 */ 74 74 public function LoadDomain() { 75 load_plugin_textdomain('om4-weatherzone', false, WP_PLUGIN_DIR.'/'.dirname(plugin_basename(__FILE__)));76 } 77 75 load_plugin_textdomain('om4-weatherzone', false, dirname(plugin_basename(__FILE__))); 76 } 77 78 78 /** 79 79 * Plugin Activation Tasks … … 87 87 } 88 88 } 89 89 90 90 /** 91 91 * Performs any upgrade tasks if required … … 101 101 } 102 102 } 103 103 104 104 /** 105 105 * Register the [weatherzone] shortcode … … 107 107 public function RegisterShortcode() { 108 108 add_shortcode('weatherzone', array($this, 'ShortcodeHandler')); 109 109 110 110 // Parse shortcodes in text widgets 111 111 // Required until http://core.trac.wordpress.org/ticket/10457 is committed 112 112 add_filter('widget_text', 'do_shortcode'); 113 113 } 114 115 114 115 116 116 /** 117 117 * [weatherzone] shortcode handler 118 118 */ 119 119 public function ShortcodeHandler($atts, $content = null) { 120 120 121 121 // List of supported shortcode attributes and their default values 122 122 $defaults = array( … … 126 126 'showradar' => 'true' 127 127 ); 128 128 129 129 // Combine the specified attributes with the default values 130 130 $atts = shortcode_atts( $defaults, $atts); 131 131 132 132 // Valid values for each parameter 133 133 $validValues['mode'] = array('currentweather', 'forecast'); 134 134 $validValues['showradar'] = array('true', 'false'); 135 135 136 136 // Validate each of the parameters 137 137 foreach ($atts as $key => $value) { … … 144 144 } 145 145 } 146 146 147 147 // Ensure the required parameters have been specified 148 148 if (!strlen($atts['mode'])) return; 149 149 if (!strlen($atts['postcode'])) return; 150 150 if (!strlen($atts['showradar'])) return; 151 151 152 152 $html = '<div id="weatherzone_' . self::$number . '" class="weatherzone ' . $atts['mode'] . '">'; 153 153 … … 158 158 $params .= '&locality=' . urlencode($atts['locality']); 159 159 } 160 160 161 161 $html .= <<<EOD 162 162 <!--Weatherzone current weather button--> … … 172 172 EOD; 173 173 break; 174 174 175 175 case 'forecast': 176 176 $params = urlencode($atts['postcode']); … … 178 178 $params .= '&locality=' . urlencode($atts['locality']); 179 179 } 180 180 181 181 $html .= <<<EOD 182 182 <!--Weatherzone forecast button--> … … 193 193 break; 194 194 } 195 195 196 196 $html .= '</div>'; 197 197 198 198 self::$number++; 199 199 200 200 return $html; 201 201 } 202 202 203 203 204 204 private function SaveInstalledVersion() {
Note: See TracChangeset
for help on using the changeset viewer.