diff --git a/assets/img/thumbnail/table-horizontal.png b/assets/img/thumbnail/table-horizontal.png new file mode 100644 index 0000000..5509dca Binary files /dev/null and b/assets/img/thumbnail/table-horizontal.png differ diff --git a/inc/class-template.php b/inc/class-template.php index 8b40db4..fdbf975 100644 --- a/inc/class-template.php +++ b/inc/class-template.php @@ -106,7 +106,11 @@ function render( $template = NULL, $data = array() ) { */ $data = apply_filters( 'wunderground_template_data', apply_filters( 'wunderground_template_data_'.$template, $data ) ); - echo $this->twig->render("{$template}.html", $data); + $output = $this->twig->render("{$template}.html", $data); + + $output = apply_filters( 'wp_wunderground_forecast', $output, $template, $data ); + + echo $output; } diff --git a/inc/functions.php b/inc/functions.php index 44e59fc..aeae696 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -320,10 +320,10 @@ function wunderground_get_subdomain( $language_key = NULL ) { // Convert "French Canadian" to "frenchcanadian" for subdomain $languages = wunderground_get_languages(); - if( isset( $languages[$language_key] ) ) { + if( isset( $languages[$language_key] ) && isset( $languages[$language_key]['value'] ) ) { // Get the name of the language - $subdomain = $languages[$language_key]; + $subdomain = $languages[$language_key]['value']; // Replace "-" and " " with nothing $subdomain = str_replace(array(' ', '-'), '', $subdomain); diff --git a/readme.html b/readme.html index 9f21348..709fee7 100644 --- a/readme.html +++ b/readme.html @@ -78,6 +78,21 @@
If you’re using the shortcode, and your location can’t be found:
+ +http://www.wunderground.com/q/zmw:00000.4.17340
/q/
. In this example, it would be zmw:00000.4.17340
[wunderground location="zmw:00000.4.17340" /]
wunderground_enable_forecast_shortcode
(boolean) Disable the old [forecast]
shortcode and only use [wunderground]
. Default: true
wunderground_widget_text_do_shortcode
(boolean) Prevent the plugin from enabling do_shortcode
filter on widget output. This is to provide backward compatibility for Version 1.x. Added in 2.0.8. Default: true
wp_wunderground_forecast_icon
(string) URL path to icon. Passes two arguments: $output
(default path), $icon
Name of icon to be fetchedwunderground_autocomplete_country_code
(string) Set the locale of the Wunderground autocomplete results. If you only want US locations, for example, return US
. Default: NULL
wunderground_date_format
(string) Filter the date format sitewide. Return a PHP date format string. Learn more about formatting dates. Default: m/d
wunderground_template_paths
(array) Paths to check for template files. Default: /wunderground/
sub-directory of the current stylesheet directorywunderground_twig_debug
(boolean) Enable Twig template debugging. Default: if user is logged in and ?debug
is set in the URL.wunderground_template_data
(array) Data passed to the template, available in Twig template rendering enginewp_wunderground_forecast
(string) Filter the output of the forecast HTMLfunctions.php
file. See a [list of icons you should have available](http://www.wunderground.com/weather/api/d/docs?d=resources/icon). Here's sample code:
@@ -74,7 +85,7 @@ Please see the "Using your own template" section on the [Plugin Github page](htt
This plugin is released under a GPL license. *Weather Underground is a registered trademark of The Weather Channel, LLC. both in the United States and internationally. The Weather Underground Logo is a trademark of Weather Underground, LLC.*
= Do I need a Wunderground account? =
-Wunderground has been very gracious and has provided the plugin with free data - you don't need your own account. If you want to use Wunderground data in your own application, [register for a Wunderground API account](http://www.wunderground.com/?apiref=5f97d1e033236c26).
+Weather Underground has been very gracious and has provided the plugin with free data - you don't need your own account. If you want to use Wunderground data in your own application, [register for a Weather Underground API account](http://www.wunderground.com/?apiref=5f97d1e033236c26).
== Changelog ==
@@ -82,6 +93,12 @@ Wunderground has been very gracious and has provided the plugin with free data -
If you are upgrading the plugin, your forecast will look different. Version 2.x made lots of changes as to how the forecast is displayed. If you want to go back after upgrading, you can [download the previous version here](https://downloads.wordpress.org/plugin/wunderground.1.2.5.1.zip).
+= 2.0.8 on October 7 =
+* Fixed: PHP warning [reported here](https://wordpress.org/support/topic/error-with-new-version-1)
+* Fixed: Date wasn't respecting current timezone
+* Added: Support for `[forecast]` and `[wunderground]` shortcodes in Text widgets by adding a `do_shortcode` filter on widgets. This had been enabled in Version 1.x.
+* Added: `wp_wunderground_forecast` filter to be backward-compatible with Version 1.x
+
= 2.0.7 on October 3 =
* Fixed: `hidedata` shortcode parameter wasn't working properly
* Modified: Removed support for `%%day%%` `%%month%%` and `%%year%%` placeholder tags
@@ -180,6 +197,11 @@ If you are upgrading the plugin, your forecast will look different. Version 2.x
== Upgrade Notice ==
+= 2.0.8 on October 7 =
+* Fixed: PHP warning [reported here](https://wordpress.org/support/topic/error-with-new-version-1)
+* Fixed: Date wasn't respecting current timezone
+* Added: Support for `[forecast]` and `[wunderground]` shortcodes in Text widgets by adding a `do_shortcode` filter on widgets. This had been enabled in Version 1.x.
+
= 2.0.7 on October 3 =
* Fixed: `hidedata` shortcode parameter wasn't working properly
* Modified: Removed support for `%%day%%` `%%month%%` and `%%year%%` placeholder tags
diff --git a/templates/snippets/date.html b/templates/snippets/date.html
index 516569e..98bdeb8 100644
--- a/templates/snippets/date.html
+++ b/templates/snippets/date.html
@@ -1,4 +1,4 @@
{% if showdata.date is not empty and day.summary.date.epoch is not empty %}
{# To modify the date format, check out the `strings` method in template.php #}
- <{{tag}} class="wu-date">{{ day.summary.date.epoch|date(datelabel) }}{{tag}}>
+ <{{tag}} class="wu-date">{{ day.summary.date.epoch|date(datelabel, day.summary.date.tz_long) }}{{tag}}>
{% endif %}
diff --git a/wunderground.php b/wunderground.php
index 17b2aec..00e1739 100644
--- a/wunderground.php
+++ b/wunderground.php
@@ -46,12 +46,21 @@ function init() {
// Add the shortcode
add_shortcode( 'wunderground', 'wunderground_shortcode' );
- // You can disable the forecast shortcode if you want to. It's definitely
- // not namespaced!
+ /**
+ * Enable or disable the forecast shortcode if you want to, since it's not namespaced
+ */
if( apply_filters('wunderground_enable_forecast_shortcode', true ) ) {
add_shortcode( 'forecast', 'wunderground_shortcode' );
}
+ /**
+ * Process shortcodes in widgets previous shortcodes in widgets
+ * @since 2.0.8
+ */
+ if( apply_filters('wunderground_widget_text_do_shortcode', true ) ) {
+ add_filter( 'widget_text', 'do_shortcode' );
+ }
+
}
function require_files() {