Version Description
- Fix: More locale changes.
- Fix: Nasty possible loop cleaned.
- Fix: awe_widget_id issue change array to object
Download this release
Release Info
Developer | halgatewood |
Plugin | Awesome Weather Widget |
Version | 3.0.2 |
Comparing to | |
See all releases |
Code changes from version 3.0 to 3.0.2
- awesome-weather.php +37 -43
- providers/openweathermaps.php +1 -1
- readme.txt +11 -3
awesome-weather.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://halgatewood.com/awesome-weather
|
|
5 |
Description: A weather widget that actually looks cool
|
6 |
Author: Hal Gatewood
|
7 |
Author URI: https://www.halgatewood.com
|
8 |
-
Version: 3.0
|
9 |
Text Domain: awesome-weather
|
10 |
Domain Path: /languages
|
11 |
|
@@ -44,46 +44,30 @@ include_once( dirname(__FILE__) . '/awesome-weather-mediabox.php');
|
|
44 |
|
45 |
// SETUP
|
46 |
function awesome_weather_setup()
|
47 |
-
{
|
48 |
-
|
49 |
-
|
50 |
-
$locale = get_locale();
|
51 |
-
if( $wp_version >= 4.7 ) $locale = get_user_locale();
|
52 |
-
|
53 |
-
if( !$locale ) $locale = get_bloginfo('language');
|
54 |
-
if( !$locale ) $locale = WPLANG;
|
55 |
-
if( !$locale ) $locale = 'en_US';
|
56 |
-
|
57 |
-
$locale = apply_filters('plugin_locale', $locale, 'awesome-weather');
|
58 |
-
$locale = apply_filters('awesome_weather_plugin_locale', $locale);
|
59 |
-
|
60 |
-
$mofile = WP_LANG_DIR . '/awesome-weather/awesome-weather-' . $locale . '.mo';
|
61 |
-
$mo_file_plugin = plugin_dir_path( __FILE__ ) . 'languages/awesome-weather-' . $locale . '.mo';
|
62 |
-
|
63 |
-
if( file_exists( $mofile ) )
|
64 |
-
{
|
65 |
-
load_textdomain( 'awesome-weather', $mofile );
|
66 |
-
load_plugin_textdomain( 'awesome-weather', false, $mofile );
|
67 |
-
}
|
68 |
-
else if ( file_exists( $mo_file_plugin ) )
|
69 |
-
{
|
70 |
-
load_textdomain( 'awesome-weather', $mo_file_plugin );
|
71 |
-
load_plugin_textdomain( 'awesome-weather', false, $mo_file_plugin );
|
72 |
-
}
|
73 |
-
else
|
74 |
-
{
|
75 |
-
load_textdomain( 'awesome-weather', dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
76 |
-
load_plugin_textdomain( 'awesome-weather', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
77 |
-
}
|
78 |
-
|
79 |
-
if( is_admin() )
|
80 |
-
{
|
81 |
-
add_action( 'admin_menu', 'awesome_weather_setting_page_menu' );
|
82 |
-
}
|
83 |
}
|
84 |
add_action('plugins_loaded', 'awesome_weather_setup', 99999, 0);
|
85 |
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
// ENQUEUE CSS
|
89 |
function awesome_weather_wp_head()
|
@@ -205,13 +189,16 @@ function awesome_weather_logic( $atts )
|
|
205 |
{
|
206 |
global $awesome_weather_sizes;
|
207 |
|
|
|
|
|
|
|
208 |
$add_to_transient = '';
|
209 |
$weather = new stdclass;
|
210 |
|
211 |
// DEFAULT SETTINGS
|
212 |
-
$weather->id = isset($atts['id']) ? $atts['id'] :
|
213 |
$weather->error = false;
|
214 |
-
$weather->location = isset($atts['location']) ? awesome_weather_prep_location($atts['location']) : '';
|
215 |
$weather->owm_city_id = isset($atts['owm_city_id']) ? $atts['owm_city_id'] : 0;
|
216 |
|
217 |
$weather->user_location = isset($atts['user_location']) ? $atts['user_location'] : '';
|
@@ -667,6 +654,13 @@ require_once(dirname(__FILE__) . '/widget.php');
|
|
667 |
|
668 |
|
669 |
// CREATE WIDGET ID
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
670 |
function awe_widget_id( &$weather, $rtn = false )
|
671 |
{
|
672 |
// SANITIZE
|
@@ -1223,11 +1217,11 @@ function awesome_weather_get_locales()
|
|
1223 |
}
|
1224 |
|
1225 |
|
1226 |
-
function awesome_weather_prep_location($text)
|
1227 |
{
|
1228 |
-
$text = stripslashes($text);
|
1229 |
-
$text = str_replace(array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"), array("'", "'", '', '', '-', '--', '...'), $text);
|
1230 |
-
$text = str_replace(array(chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(133)), array("'", "'", '', '', '-', '--', '...'), $text);
|
1231 |
return $text;
|
1232 |
}
|
1233 |
|
5 |
Description: A weather widget that actually looks cool
|
6 |
Author: Hal Gatewood
|
7 |
Author URI: https://www.halgatewood.com
|
8 |
+
Version: 3.0.2
|
9 |
Text Domain: awesome-weather
|
10 |
Domain Path: /languages
|
11 |
|
44 |
|
45 |
// SETUP
|
46 |
function awesome_weather_setup()
|
47 |
+
{
|
48 |
+
if( is_admin() ) add_action( 'admin_menu', 'awesome_weather_setting_page_menu' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
add_action('plugins_loaded', 'awesome_weather_setup', 99999, 0);
|
51 |
|
52 |
|
53 |
+
// LANGUAGES
|
54 |
+
function awesome_weather_setup_locale()
|
55 |
+
{
|
56 |
+
$locale = apply_filters('plugin_locale', get_locale(), 'awesome-weather');
|
57 |
+
$mofile = WP_LANG_DIR . '/awesome-weather/awesome-weather-' . $locale . '.mo';
|
58 |
+
|
59 |
+
if( file_exists( $mofile ) )
|
60 |
+
{
|
61 |
+
load_textdomain( 'awesome-weather', $mofile );
|
62 |
+
}
|
63 |
+
else
|
64 |
+
{
|
65 |
+
load_plugin_textdomain( 'awesome-weather', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
66 |
+
}
|
67 |
+
}
|
68 |
+
add_action( 'init', 'awesome_weather_setup_locale' );
|
69 |
+
|
70 |
+
|
71 |
|
72 |
// ENQUEUE CSS
|
73 |
function awesome_weather_wp_head()
|
189 |
{
|
190 |
global $awesome_weather_sizes;
|
191 |
|
192 |
+
if( is_object($atts) ) $atts = (array) $atts;
|
193 |
+
|
194 |
+
|
195 |
$add_to_transient = '';
|
196 |
$weather = new stdclass;
|
197 |
|
198 |
// DEFAULT SETTINGS
|
199 |
+
$weather->id = isset($atts['id']) ? $atts['id'] : awe_widget_id_new( $atts );
|
200 |
$weather->error = false;
|
201 |
+
$weather->location = isset($atts['location']) ? awesome_weather_prep_location( $atts['location'] ) : '';
|
202 |
$weather->owm_city_id = isset($atts['owm_city_id']) ? $atts['owm_city_id'] : 0;
|
203 |
|
204 |
$weather->user_location = isset($atts['user_location']) ? $atts['user_location'] : '';
|
654 |
|
655 |
|
656 |
// CREATE WIDGET ID
|
657 |
+
function awe_widget_id_new( $atts )
|
658 |
+
{
|
659 |
+
$w = $atts;
|
660 |
+
return awe_widget_id( $w, true );
|
661 |
+
}
|
662 |
+
|
663 |
+
|
664 |
function awe_widget_id( &$weather, $rtn = false )
|
665 |
{
|
666 |
// SANITIZE
|
1217 |
}
|
1218 |
|
1219 |
|
1220 |
+
function awesome_weather_prep_location( $text )
|
1221 |
{
|
1222 |
+
$text = stripslashes( $text );
|
1223 |
+
$text = str_replace( array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"), array("'", "'", '', '', '-', '--', '...'), $text);
|
1224 |
+
$text = str_replace( array(chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(133)), array("'", "'", '', '', '-', '--', '...'), $text);
|
1225 |
return $text;
|
1226 |
}
|
1227 |
|
providers/openweathermaps.php
CHANGED
@@ -39,7 +39,7 @@ function awesome_weather_get_weather_data_openweathermaps( &$weather )
|
|
39 |
|
40 |
if( $city_id_from_location )
|
41 |
{
|
42 |
-
$weather->owm_city_id =
|
43 |
}
|
44 |
else
|
45 |
{
|
39 |
|
40 |
if( $city_id_from_location )
|
41 |
{
|
42 |
+
$weather->owm_city_id = $city_id_from_location;
|
43 |
}
|
44 |
else
|
45 |
{
|
readme.txt
CHANGED
@@ -8,7 +8,7 @@ Stable tag: trunk
|
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
-
Finally beautiful weather widgets for your beautiful
|
12 |
|
13 |
== Description ==
|
14 |
|
@@ -17,7 +17,7 @@ This plugin allows you to easily add super clean (and awesome) weather widgets t
|
|
17 |
= Weather by OpenWeatherMap or Dark Sky =
|
18 |
The weather data is available either by [OpenWeatherMap](https://openweathermap.org) or [Dark Sky](https://darksky.net).
|
19 |
|
20 |
-
They require a free to access the data.
|
21 |
|
22 |
* [Open Weather Map API Key](http://openweathermap.org/appid#get)
|
23 |
* [Dark Sky Secret Key](https://darksky.net/dev)
|
@@ -69,10 +69,18 @@ The easiest shortcode setting is just: `[awesome-weather location="Oklahoma City
|
|
69 |
|
70 |
== Upgrade Notice ==
|
71 |
|
72 |
-
I
|
73 |
|
74 |
== Changelog ==
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
= 3.0 =
|
77 |
- New: Pro replaces free plugin. Thanks to everyone who supported me.
|
78 |
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
Finally beautiful weather widgets for your beautiful WordPress website.
|
12 |
|
13 |
== Description ==
|
14 |
|
17 |
= Weather by OpenWeatherMap or Dark Sky =
|
18 |
The weather data is available either by [OpenWeatherMap](https://openweathermap.org) or [Dark Sky](https://darksky.net).
|
19 |
|
20 |
+
They require a free key to access the data.
|
21 |
|
22 |
* [Open Weather Map API Key](http://openweathermap.org/appid#get)
|
23 |
* [Dark Sky Secret Key](https://darksky.net/dev)
|
69 |
|
70 |
== Upgrade Notice ==
|
71 |
|
72 |
+
At version 3.o, I merged my PRO plugin into this FREE plugin. Enjoy all the new features!
|
73 |
|
74 |
== Changelog ==
|
75 |
|
76 |
+
= 3.0.2 =
|
77 |
+
- Fix: More locale changes.
|
78 |
+
- Fix: Nasty possible loop cleaned.
|
79 |
+
- Fix: awe_widget_id issue change array to object
|
80 |
+
|
81 |
+
= 3.0.1 =
|
82 |
+
- Fix: Locale issues simplified.
|
83 |
+
|
84 |
= 3.0 =
|
85 |
- New: Pro replaces free plugin. Thanks to everyone who supported me.
|
86 |
|