Version Description
- Added spot for API key in 'Settings' -> 'Awesome Weather'
- Added new setting to decide how to show error messages.
Download this release
Release Info
Developer | halgatewood |
Plugin | Awesome Weather Widget |
Version | 1.5.3 |
Comparing to | |
See all releases |
Code changes from version 1.5.2 to 1.5.3
- awesome-weather-settings.php +125 -0
- awesome-weather.php +45 -50
- languages/awesome-weather-ar.mo +0 -0
- languages/awesome-weather-ar.po +0 -0
- languages/awesome-weather-el.mo +0 -0
- languages/awesome-weather-el.po +0 -0
- languages/awesome-weather-hu_HU.mo +0 -0
- languages/awesome-weather-hu_HU.po +0 -0
- languages/awesome-weather-it_IT.mo +0 -0
- languages/awesome-weather-it_IT.po +0 -0
- languages/awesome-weather.pot +113 -57
- readme.txt +14 -2
awesome-weather-settings.php
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// CREATE THE SETTINGS PAGE
|
4 |
+
function awesome_weather_setting_page_menu()
|
5 |
+
{
|
6 |
+
add_options_page( 'Awesome Weather ', 'Awesome Weather', 'manage_options', 'awesome-weather', 'awesome_weather_page' );
|
7 |
+
}
|
8 |
+
|
9 |
+
function awesome_weather_page()
|
10 |
+
{
|
11 |
+
?>
|
12 |
+
<div class="wrap">
|
13 |
+
<h2><?php _e('Awesome Weather Widget', 'awesome-weather'); ?></h2>
|
14 |
+
|
15 |
+
<?php if( isset($_GET['awesome-weather-cached-cleared']) ) { ?>
|
16 |
+
<div id="setting-error-settings_updated" class="updated settings-error">
|
17 |
+
<p><strong><?php _e('Weather Widget Cache Cleared', 'awesome-weather'); ?></strong></p>
|
18 |
+
</div>
|
19 |
+
<?php } ?>
|
20 |
+
|
21 |
+
<form action="options.php" method="POST">
|
22 |
+
<?php settings_fields( 'awe-basic-settings-group' ); ?>
|
23 |
+
<?php do_settings_sections( 'awesome-weather' ); ?>
|
24 |
+
<?php submit_button(); ?>
|
25 |
+
</form>
|
26 |
+
<hr>
|
27 |
+
<p>
|
28 |
+
<a href="options-general.php?page=awesome-weather&action=awesome-weather-clear-transients" class="button"><?php _e('Clear all Awesome Weather Widget Cache', 'awesome-weather'); ?></a>
|
29 |
+
</p>
|
30 |
+
</div>
|
31 |
+
<?php
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
// SET SETTINGS LINK ON PLUGIN PAGE
|
36 |
+
function awesome_weather_plugin_action_links( $links, $file )
|
37 |
+
{
|
38 |
+
$appid = apply_filters('awesome_weather_appid', get_option( 'open-weather-key' ));
|
39 |
+
|
40 |
+
if( $appid )
|
41 |
+
{
|
42 |
+
$settings_link = '<a href="' . admin_url( 'options-general.php?page=awesome-weather' ) . '">' . esc_html__( 'Settings', 'awesome-weather' ) . '</a>';
|
43 |
+
}
|
44 |
+
else
|
45 |
+
{
|
46 |
+
$settings_link = '<a href="' . admin_url( 'options-general.php?page=awesome-weather' ) . '">' . esc_html__( 'API Key Required', 'awesome-weather' ) . '</a>';
|
47 |
+
}
|
48 |
+
if( $file == 'awesome-weather/awesome-weather.php' ) array_unshift( $links, $settings_link );
|
49 |
+
|
50 |
+
$donate_link = '<a href="https://halgatewood.com/donate" target="_blank">' . esc_html__( 'Donate', 'awesome-weather' ) . '</a>';
|
51 |
+
if( $file == 'awesome-weather/awesome-weather.php' ) array_unshift( $links, $donate_link );
|
52 |
+
|
53 |
+
$upgrade_link = '<a href="https://halgatewood.com/downloads/awesome-weather-widget-pro" target="_blank">' . esc_html__( 'Upgrade', 'awesome-weather' ) . '</a>';
|
54 |
+
if( $file == 'awesome-weather/awesome-weather.php' ) array_unshift( $links, $upgrade_link );
|
55 |
+
|
56 |
+
return $links;
|
57 |
+
}
|
58 |
+
add_filter( 'plugin_action_links', 'awesome_weather_plugin_action_links', 10, 2 );
|
59 |
+
|
60 |
+
|
61 |
+
add_action( 'admin_init', 'awesome_weather_setting_init' );
|
62 |
+
function awesome_weather_setting_init()
|
63 |
+
{
|
64 |
+
register_setting( 'awe-basic-settings-group', 'open-weather-key' );
|
65 |
+
register_setting( 'awe-basic-settings-group', 'aw-error-handling' );
|
66 |
+
|
67 |
+
add_settings_section( 'awe-basic-settings', '', 'awesome_weather_api_keys_description', 'awesome-weather' );
|
68 |
+
add_settings_field( 'open-weather-key', __('OpenWeatherMaps APPID', 'awesome-weather'), 'awesome_weather_openweather_key', 'awesome-weather', 'awe-basic-settings' );
|
69 |
+
add_settings_field( 'aw-error-handling', __('Error Handling', 'awesome-weather'), 'awesome_weather_error_handling_setting', 'awesome-weather', 'awe-basic-settings' );
|
70 |
+
|
71 |
+
if( isset($_GET['action']) AND $_GET['action'] == "awesome-weather-clear-transients")
|
72 |
+
{
|
73 |
+
awesome_weather_delete_all_transients();
|
74 |
+
wp_redirect( "options-general.php?page=awesome-weather&awesome-weather-cached-cleared=true" );
|
75 |
+
die;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
// DELETE ALL AWESOME WEATHER WIDGET TRANSIENTS
|
83 |
+
function awesome_weather_delete_all_transients_save( $value )
|
84 |
+
{
|
85 |
+
awesome_weather_delete_all_transients();
|
86 |
+
return $value;
|
87 |
+
}
|
88 |
+
|
89 |
+
function awesome_weather_delete_all_transients()
|
90 |
+
{
|
91 |
+
global $wpdb;
|
92 |
+
|
93 |
+
// DELETE TRANSIENTS
|
94 |
+
$sql = "DELETE FROM $wpdb->options WHERE option_name LIKE '%_transient_awe_%'";
|
95 |
+
$clean = $wpdb->query( $sql );
|
96 |
+
return true;
|
97 |
+
}
|
98 |
+
|
99 |
+
function awesome_weather_api_keys_description() { }
|
100 |
+
|
101 |
+
function awesome_weather_openweather_key()
|
102 |
+
{
|
103 |
+
$setting = esc_attr( apply_filters('awesome_weather_appid', get_option( 'open-weather-key' )) );
|
104 |
+
echo "<input type='text' name='open-weather-key' value='$setting' style='width:70%;' />";
|
105 |
+
echo "<p>";
|
106 |
+
echo __("As of October 2015, OpenWeatherMaps requires this key to access their weather data.", 'awesome-weather');
|
107 |
+
echo " <a href='http://openweathermap.org/appid' target='_blank'>";
|
108 |
+
echo __('Get your APPID', 'awesome-weather');
|
109 |
+
echo "</a>";
|
110 |
+
echo "</p>";
|
111 |
+
}
|
112 |
+
|
113 |
+
function awesome_weather_error_handling_setting()
|
114 |
+
{
|
115 |
+
$setting = esc_attr( get_option( 'aw-error-handling' ) );
|
116 |
+
if(!$setting) $setting = "source";
|
117 |
+
|
118 |
+
echo "<input type='radio' name='aw-error-handling' value='source' " . checked( $setting, 'source', false ) . " /> " . __('Hidden in Source', 'awesome-weather') . " ";
|
119 |
+
echo "<input type='radio' name='aw-error-handling' value='display-admin' " . checked( $setting, 'display-admin', false ) . " /> " . __('Display if Admin', 'awesome-weather') . " ";
|
120 |
+
echo "<input type='radio' name='aw-error-handling' value='display-all' " . checked( $setting, 'display-all', false ) . " /> " . __('Display for Anyone', 'awesome-weather') . " ";
|
121 |
+
|
122 |
+
echo "<p>";
|
123 |
+
echo __("What should the plugin do when there is an error?", 'awesome-weather');
|
124 |
+
echo "</p>";
|
125 |
+
}
|
awesome-weather.php
CHANGED
@@ -5,19 +5,21 @@ 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: 1.5.
|
9 |
Text Domain: awesome-weather
|
10 |
Domain Path: /languages
|
11 |
|
12 |
|
|
|
13 |
FILTERS AVAILABLE:
|
14 |
awesome_weather_cache = How many seconds to cache weather: default 1800 (30 minutes).
|
15 |
awesome_weather_error = Error message if weather is not found.
|
16 |
awesome_weather_sizes = array of sizes for widget
|
17 |
awesome_weather_extended_forecast_text = Change text of footer link
|
18 |
-
awesome_weather_appid = OpenWeatherMap APPID, improves support
|
19 |
awesome_weather_units_display = Change the F or C to ° or something
|
20 |
awesome_weather_background_classes = Add or change the background classes before they display
|
|
|
21 |
|
22 |
|
23 |
// CLEAR OUT THE TRANSIENT CACHE
|
@@ -29,13 +31,13 @@ For example: http://url.com/?clear_awesome_widget
|
|
29 |
|
30 |
// SETTINGS
|
31 |
$awesome_weather_sizes = apply_filters( 'awesome_weather_sizes' , array( 'tall', 'wide' ) );
|
32 |
-
|
33 |
|
34 |
|
35 |
// SETUP
|
36 |
function awesome_weather_setup()
|
37 |
{
|
38 |
load_plugin_textdomain( 'awesome-weather', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
|
|
39 |
}
|
40 |
add_action('plugins_loaded', 'awesome_weather_setup', 99999);
|
41 |
|
@@ -136,18 +138,13 @@ function awesome_weather_logic( $atts )
|
|
136 |
|
137 |
|
138 |
// CLEAR THE TRANSIENT
|
139 |
-
if( isset($_GET['clear_awesome_widget']) )
|
140 |
-
|
141 |
-
delete_transient( $weather_transient_name );
|
142 |
-
}
|
143 |
|
144 |
// IF APPID, WE USE IT
|
145 |
$appid_string = '';
|
146 |
-
$appid = apply_filters( 'awesome_weather_appid',
|
147 |
-
if($appid)
|
148 |
-
{
|
149 |
-
$appid_string = '&APPID=' . $appid;
|
150 |
-
}
|
151 |
|
152 |
|
153 |
// GET WEATHER DATA
|
@@ -162,14 +159,14 @@ function awesome_weather_logic( $atts )
|
|
162 |
|
163 |
// NOW
|
164 |
$now_ping = "http://api.openweathermap.org/data/2.5/weather?" . $api_query . "&lang=" . $locale . "&units=" . $units . $appid_string;
|
165 |
-
|
166 |
$now_ping_get = wp_remote_get( $now_ping );
|
167 |
|
168 |
-
if( is_wp_error( $now_ping_get ) )
|
169 |
-
{
|
170 |
-
return awesome_weather_error( $now_ping_get->get_error_message() );
|
171 |
-
}
|
172 |
|
|
|
|
|
|
|
|
|
|
|
173 |
$city_data = json_decode( $now_ping_get['body'] );
|
174 |
|
175 |
if( isset($city_data->cod) AND $city_data->cod == 404 )
|
@@ -240,7 +237,6 @@ function awesome_weather_logic( $atts )
|
|
240 |
else
|
241 |
{
|
242 |
// COLOR OF WIDGET
|
243 |
-
|
244 |
if($units == "imperial")
|
245 |
{
|
246 |
if($today_temp > 31 AND $today_temp < 40) $background_classes[] = "temp2";
|
@@ -269,24 +265,7 @@ function awesome_weather_logic( $atts )
|
|
269 |
$today->main->humidity = round($today->main->humidity);
|
270 |
$today->wind->speed = round($today->wind->speed);
|
271 |
|
272 |
-
$wind_label = array (
|
273 |
-
__('N', 'awesome-weather'),
|
274 |
-
__('NNE', 'awesome-weather'),
|
275 |
-
__('NE', 'awesome-weather'),
|
276 |
-
__('ENE', 'awesome-weather'),
|
277 |
-
__('E', 'awesome-weather'),
|
278 |
-
__('ESE', 'awesome-weather'),
|
279 |
-
__('SE', 'awesome-weather'),
|
280 |
-
__('SSE', 'awesome-weather'),
|
281 |
-
__('S', 'awesome-weather'),
|
282 |
-
__('SSW', 'awesome-weather'),
|
283 |
-
__('SW', 'awesome-weather'),
|
284 |
-
__('WSW', 'awesome-weather'),
|
285 |
-
__('W', 'awesome-weather'),
|
286 |
-
__('WNW', 'awesome-weather'),
|
287 |
-
__('NW', 'awesome-weather'),
|
288 |
-
__('NNW', 'awesome-weather')
|
289 |
-
);
|
290 |
|
291 |
$wind_direction = $wind_label[ fmod((($today->wind->deg + 11) / 22.5),16) ];
|
292 |
|
@@ -349,7 +328,7 @@ function awesome_weather_logic( $atts )
|
|
349 |
|
350 |
|
351 |
// DISPLAY SYMBOL
|
352 |
-
$units_display_symbol = apply_filters('awesome_weather_units_display',
|
353 |
|
354 |
|
355 |
// EXTRA STYLES
|
@@ -376,22 +355,21 @@ function awesome_weather_logic( $atts )
|
|
376 |
<div class=\"awesome-weather-header\">{$header_title}</div>
|
377 |
|
378 |
<div class=\"awesome-weather-current-temp\">
|
379 |
-
|
380 |
</div> <!-- /.awesome-weather-current-temp -->
|
381 |
";
|
382 |
|
383 |
if($show_stats)
|
384 |
{
|
385 |
-
$
|
386 |
|
387 |
$rtn .= "
|
388 |
-
|
389 |
-
<div class=\"
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
</div> <!-- /.awesome-weather-todays-stats -->
|
395 |
";
|
396 |
}
|
397 |
|
@@ -445,12 +423,22 @@ function awesome_weather_logic( $atts )
|
|
445 |
// RETURN ERROR
|
446 |
function awesome_weather_error( $msg = false )
|
447 |
{
|
|
|
|
|
448 |
if(!$msg) $msg = __('No weather information available', 'awesome-weather');
|
449 |
|
450 |
-
|
451 |
-
if ( current_user_can( 'manage_options' ) )
|
452 |
{
|
453 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
}
|
455 |
else
|
456 |
{
|
@@ -644,15 +632,22 @@ add_action( 'widgets_init', create_function('', 'return register_widget("Awesome
|
|
644 |
|
645 |
|
646 |
|
|
|
|
|
|
|
647 |
|
648 |
|
649 |
// PING OPENWEATHER FOR OWMID
|
650 |
add_action( 'wp_ajax_awe_ping_owm_for_id', 'awe_ping_owm_for_id');
|
651 |
function awe_ping_owm_for_id( )
|
652 |
{
|
|
|
|
|
|
|
|
|
653 |
$location = urlencode($_GET['location']);
|
654 |
$units = $_GET['location'] == "C" ? "metric" : "imperial";
|
655 |
-
$owm_ping = "http://api.openweathermap.org/data/2.5/find?q=" . $location ."&units=" . $units . "&mode=json";
|
656 |
$owm_ping_get = wp_remote_get( $owm_ping );
|
657 |
echo $owm_ping_get['body'];
|
658 |
die;
|
5 |
Description: A weather widget that actually looks cool
|
6 |
Author: Hal Gatewood
|
7 |
Author URI: https://www.halgatewood.com
|
8 |
+
Version: 1.5.3
|
9 |
Text Domain: awesome-weather
|
10 |
Domain Path: /languages
|
11 |
|
12 |
|
13 |
+
|
14 |
FILTERS AVAILABLE:
|
15 |
awesome_weather_cache = How many seconds to cache weather: default 1800 (30 minutes).
|
16 |
awesome_weather_error = Error message if weather is not found.
|
17 |
awesome_weather_sizes = array of sizes for widget
|
18 |
awesome_weather_extended_forecast_text = Change text of footer link
|
19 |
+
awesome_weather_appid = OpenWeatherMap APPID, improves support (now available in Settings -> Awesome Weather
|
20 |
awesome_weather_units_display = Change the F or C to ° or something
|
21 |
awesome_weather_background_classes = Add or change the background classes before they display
|
22 |
+
awesome_weather_wind_speed = Convert the wind speed to whatever you want before it gets displayed
|
23 |
|
24 |
|
25 |
// CLEAR OUT THE TRANSIENT CACHE
|
31 |
|
32 |
// SETTINGS
|
33 |
$awesome_weather_sizes = apply_filters( 'awesome_weather_sizes' , array( 'tall', 'wide' ) );
|
|
|
34 |
|
35 |
|
36 |
// SETUP
|
37 |
function awesome_weather_setup()
|
38 |
{
|
39 |
load_plugin_textdomain( 'awesome-weather', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
40 |
+
add_action( 'admin_menu', 'awesome_weather_setting_page_menu' );
|
41 |
}
|
42 |
add_action('plugins_loaded', 'awesome_weather_setup', 99999);
|
43 |
|
138 |
|
139 |
|
140 |
// CLEAR THE TRANSIENT
|
141 |
+
if( isset($_GET['clear_awesome_widget']) ) delete_transient( $weather_transient_name );
|
142 |
+
|
|
|
|
|
143 |
|
144 |
// IF APPID, WE USE IT
|
145 |
$appid_string = '';
|
146 |
+
$appid = apply_filters( 'awesome_weather_appid', get_option( 'open-weather-key' ) );
|
147 |
+
if($appid) $appid_string = '&APPID=' . $appid;
|
|
|
|
|
|
|
148 |
|
149 |
|
150 |
// GET WEATHER DATA
|
159 |
|
160 |
// NOW
|
161 |
$now_ping = "http://api.openweathermap.org/data/2.5/weather?" . $api_query . "&lang=" . $locale . "&units=" . $units . $appid_string;
|
|
|
162 |
$now_ping_get = wp_remote_get( $now_ping );
|
163 |
|
|
|
|
|
|
|
|
|
164 |
|
165 |
+
// PING URL ERROR
|
166 |
+
if( is_wp_error( $now_ping_get ) ) return awesome_weather_error( $now_ping_get->get_error_message() );
|
167 |
+
|
168 |
+
|
169 |
+
// GET BODY OF REQUEST
|
170 |
$city_data = json_decode( $now_ping_get['body'] );
|
171 |
|
172 |
if( isset($city_data->cod) AND $city_data->cod == 404 )
|
237 |
else
|
238 |
{
|
239 |
// COLOR OF WIDGET
|
|
|
240 |
if($units == "imperial")
|
241 |
{
|
242 |
if($today_temp > 31 AND $today_temp < 40) $background_classes[] = "temp2";
|
265 |
$today->main->humidity = round($today->main->humidity);
|
266 |
$today->wind->speed = round($today->wind->speed);
|
267 |
|
268 |
+
$wind_label = array ( __('N', 'awesome-weather'), __('NNE', 'awesome-weather'), __('NE', 'awesome-weather'), __('ENE', 'awesome-weather'), __('E', 'awesome-weather'), __('ESE', 'awesome-weather'), __('SE', 'awesome-weather'), __('SSE', 'awesome-weather'), __('S', 'awesome-weather'), __('SSW', 'awesome-weather'), __('SW', 'awesome-weather'), __('WSW', 'awesome-weather'), __('W', 'awesome-weather'), __('WNW', 'awesome-weather'), __('NW', 'awesome-weather'), __('NNW', 'awesome-weather') );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
|
270 |
$wind_direction = $wind_label[ fmod((($today->wind->deg + 11) / 22.5),16) ];
|
271 |
|
328 |
|
329 |
|
330 |
// DISPLAY SYMBOL
|
331 |
+
$units_display_symbol = apply_filters('awesome_weather_units_display', "°" );
|
332 |
|
333 |
|
334 |
// EXTRA STYLES
|
355 |
<div class=\"awesome-weather-header\">{$header_title}</div>
|
356 |
|
357 |
<div class=\"awesome-weather-current-temp\">
|
358 |
+
<strong>$today_temp<sup>{$units_display_symbol}</sup></strong>
|
359 |
</div> <!-- /.awesome-weather-current-temp -->
|
360 |
";
|
361 |
|
362 |
if($show_stats)
|
363 |
{
|
364 |
+
$wind_speed_obj = apply_filters('awesome_weather_wind_speed', array( 'text' => __('m/s', 'awesome-weather'),'speed'=> $today->wind->speed, 'direction' => $wind_direction ), $today->wind->speed, $wind_direction );
|
365 |
|
366 |
$rtn .= "
|
367 |
+
<div class=\"awesome-weather-todays-stats\">
|
368 |
+
<div class=\"awe_desc\">{$today->weather[0]->description}</div>
|
369 |
+
<div class=\"awe_humidty\">" . __('humidity:', 'awesome-weather') . " {$today->main->humidity}% </div>
|
370 |
+
<div class=\"awe_wind\">" . __('wind:', 'awesome-weather') . " {$wind_speed_obj['speed']}{$wind_speed_obj['text']} {$wind_speed_obj['direction']}</div>
|
371 |
+
<div class=\"awe_highlow\"> " .__('H', 'awesome-weather') . " {$today_high} • " . __('L', 'awesome-weather') . " {$today_low} </div>
|
372 |
+
</div> <!-- /.awesome-weather-todays-stats -->
|
|
|
373 |
";
|
374 |
}
|
375 |
|
423 |
// RETURN ERROR
|
424 |
function awesome_weather_error( $msg = false )
|
425 |
{
|
426 |
+
$error_handling = get_option( 'aw-error-handling' );
|
427 |
+
if(!$error_handling) $error_handling = "source";
|
428 |
if(!$msg) $msg = __('No weather information available', 'awesome-weather');
|
429 |
|
430 |
+
if( $error_handling == "display-admin")
|
|
|
431 |
{
|
432 |
+
// DISPLAY ADMIN
|
433 |
+
if ( current_user_can( 'manage_options' ) )
|
434 |
+
{
|
435 |
+
echo "<div class='awesome-weather-error'>" . $msg . "</div>";
|
436 |
+
}
|
437 |
+
}
|
438 |
+
else if( $error_handling == "display-all")
|
439 |
+
{
|
440 |
+
// DISPLAY ALL
|
441 |
+
echo "<div class='awesome-weather-error'>" . $msg . "</div>";
|
442 |
}
|
443 |
else
|
444 |
{
|
632 |
|
633 |
|
634 |
|
635 |
+
// SETTINGS
|
636 |
+
require_once( dirname(__FILE__) . "/awesome-weather-settings.php");
|
637 |
+
|
638 |
|
639 |
|
640 |
// PING OPENWEATHER FOR OWMID
|
641 |
add_action( 'wp_ajax_awe_ping_owm_for_id', 'awe_ping_owm_for_id');
|
642 |
function awe_ping_owm_for_id( )
|
643 |
{
|
644 |
+
$appid_string = '';
|
645 |
+
$appid = apply_filters('awesome_weather_appid', get_option( 'open-weather-key' ));
|
646 |
+
if($appid) $appid_string = '&APPID=' . $appid;
|
647 |
+
|
648 |
$location = urlencode($_GET['location']);
|
649 |
$units = $_GET['location'] == "C" ? "metric" : "imperial";
|
650 |
+
$owm_ping = "http://api.openweathermap.org/data/2.5/find?q=" . $location ."&units=" . $units . "&mode=json" . $appid_string;
|
651 |
$owm_ping_get = wp_remote_get( $owm_ping );
|
652 |
echo $owm_ping_get['body'];
|
653 |
die;
|
languages/awesome-weather-ar.mo
CHANGED
File without changes
|
languages/awesome-weather-ar.po
CHANGED
File without changes
|
languages/awesome-weather-el.mo
CHANGED
File without changes
|
languages/awesome-weather-el.po
CHANGED
File without changes
|
languages/awesome-weather-hu_HU.mo
CHANGED
File without changes
|
languages/awesome-weather-hu_HU.po
CHANGED
File without changes
|
languages/awesome-weather-it_IT.mo
CHANGED
File without changes
|
languages/awesome-weather-it_IT.po
CHANGED
File without changes
|
languages/awesome-weather.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the Awesome Weather Widget package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Awesome Weather Widget 1.5\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/awesome-weather\n"
|
7 |
-
"POT-Creation-Date: 2015-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -12,207 +12,263 @@ msgstr ""
|
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
-
#: awesome-weather.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
msgid "C"
|
17 |
msgstr ""
|
18 |
|
19 |
-
#: awesome-weather.php:
|
20 |
msgid "F"
|
21 |
msgstr ""
|
22 |
|
23 |
-
#: awesome-weather.php:
|
24 |
msgid "N"
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: awesome-weather.php:
|
28 |
msgid "NNE"
|
29 |
msgstr ""
|
30 |
|
31 |
-
#: awesome-weather.php:
|
32 |
msgid "NE"
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: awesome-weather.php:
|
36 |
msgid "ENE"
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: awesome-weather.php:
|
40 |
msgid "E"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: awesome-weather.php:
|
44 |
msgid "ESE"
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: awesome-weather.php:
|
48 |
msgid "SE"
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: awesome-weather.php:
|
52 |
msgid "SSE"
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: awesome-weather.php:
|
56 |
msgid "S"
|
57 |
msgstr ""
|
58 |
|
59 |
-
#: awesome-weather.php:
|
60 |
msgid "SSW"
|
61 |
msgstr ""
|
62 |
|
63 |
-
#: awesome-weather.php:
|
64 |
msgid "SW"
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: awesome-weather.php:
|
68 |
msgid "WSW"
|
69 |
msgstr ""
|
70 |
|
71 |
-
#: awesome-weather.php:
|
72 |
msgid "W"
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: awesome-weather.php:
|
76 |
msgid "WNW"
|
77 |
msgstr ""
|
78 |
|
79 |
-
#: awesome-weather.php:
|
80 |
msgid "NW"
|
81 |
msgstr ""
|
82 |
|
83 |
-
#: awesome-weather.php:
|
84 |
msgid "NNW"
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: awesome-weather.php:
|
88 |
-
msgid "
|
89 |
-
msgstr ""
|
90 |
-
|
91 |
-
#: awesome-weather.php:385
|
92 |
-
msgid "mph"
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: awesome-weather.php:
|
96 |
msgid "humidity:"
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: awesome-weather.php:
|
100 |
msgid "wind:"
|
101 |
msgstr ""
|
102 |
|
103 |
-
#: awesome-weather.php:
|
104 |
msgid "H"
|
105 |
msgstr ""
|
106 |
|
107 |
-
#: awesome-weather.php:
|
108 |
msgid "L"
|
109 |
msgstr ""
|
110 |
|
111 |
-
#: awesome-weather.php:
|
112 |
msgid "Sun"
|
113 |
msgstr ""
|
114 |
|
115 |
-
#: awesome-weather.php:
|
116 |
msgid "Mon"
|
117 |
msgstr ""
|
118 |
|
119 |
-
#: awesome-weather.php:
|
120 |
msgid "Tue"
|
121 |
msgstr ""
|
122 |
|
123 |
-
#: awesome-weather.php:
|
124 |
msgid "Wed"
|
125 |
msgstr ""
|
126 |
|
127 |
-
#: awesome-weather.php:
|
128 |
msgid "Thu"
|
129 |
msgstr ""
|
130 |
|
131 |
-
#: awesome-weather.php:
|
132 |
msgid "Fri"
|
133 |
msgstr ""
|
134 |
|
135 |
-
#: awesome-weather.php:
|
136 |
msgid "Sat"
|
137 |
msgstr ""
|
138 |
|
139 |
-
#: awesome-weather.php:
|
140 |
msgid "extended forecast"
|
141 |
msgstr ""
|
142 |
|
143 |
-
#: awesome-weather.php:
|
144 |
msgid "No weather information available"
|
145 |
msgstr ""
|
146 |
|
147 |
-
#: awesome-weather.php:
|
148 |
msgid "No city found in OpenWeatherMap."
|
149 |
msgstr ""
|
150 |
|
151 |
-
#: awesome-weather.php:
|
152 |
msgid "Only one location found. The ID has been set automatically above."
|
153 |
msgstr ""
|
154 |
|
155 |
-
#: awesome-weather.php:
|
156 |
msgid "Please confirm your city: "
|
157 |
msgstr ""
|
158 |
|
159 |
-
#: awesome-weather.php:
|
160 |
msgid "Search for Your Location:"
|
161 |
msgstr ""
|
162 |
|
163 |
-
#: awesome-weather.php:
|
164 |
msgid "(i.e: London,UK or New York City,NY)"
|
165 |
msgstr ""
|
166 |
|
167 |
-
#: awesome-weather.php:
|
168 |
msgid "OpenWeatherMap City ID:"
|
169 |
msgstr ""
|
170 |
|
171 |
-
#: awesome-weather.php:
|
172 |
msgid "(use the field above to find the ID for your city)"
|
173 |
msgstr ""
|
174 |
|
175 |
-
#: awesome-weather.php:
|
176 |
msgid "Override Title:"
|
177 |
msgstr ""
|
178 |
|
179 |
-
#: awesome-weather.php:
|
180 |
msgid "Units:"
|
181 |
msgstr ""
|
182 |
|
183 |
-
#: awesome-weather.php:
|
184 |
msgid "Size:"
|
185 |
msgstr ""
|
186 |
|
187 |
-
#: awesome-weather.php:
|
188 |
msgid "Forecast:"
|
189 |
msgstr ""
|
190 |
|
191 |
-
#: awesome-weather.php:
|
192 |
msgid "Background Image:"
|
193 |
msgstr ""
|
194 |
|
195 |
-
#: awesome-weather.php:
|
196 |
msgid "Use Different Background Images Based on Weather"
|
197 |
msgstr ""
|
198 |
|
199 |
-
#: awesome-weather.php:
|
200 |
msgid "Custom Background Color:"
|
201 |
msgstr ""
|
202 |
|
203 |
-
#: awesome-weather.php:
|
204 |
msgid "overrides color changing"
|
205 |
msgstr ""
|
206 |
|
207 |
-
#: awesome-weather.php:
|
208 |
msgid "Hide Stats"
|
209 |
msgstr ""
|
210 |
|
211 |
-
#: awesome-weather.php:
|
212 |
msgid "Link to OpenWeatherMap"
|
213 |
msgstr ""
|
214 |
|
215 |
-
#: awesome-weather.php:
|
216 |
msgid "Widget Title: (optional)"
|
217 |
msgstr ""
|
218 |
#. Plugin Name of the plugin/theme
|
2 |
# This file is distributed under the same license as the Awesome Weather Widget package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Awesome Weather Widget 1.5.3\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/awesome-weather\n"
|
7 |
+
"POT-Creation-Date: 2015-10-12 15:00:57+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
+
#: awesome-weather-settings.php:13
|
16 |
+
msgid "Awesome Weather Widget"
|
17 |
+
msgstr ""
|
18 |
+
|
19 |
+
#: awesome-weather-settings.php:17
|
20 |
+
msgid "Weather Widget Cache Cleared"
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#: awesome-weather-settings.php:28
|
24 |
+
msgid "Clear all Awesome Weather Widget Cache"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: awesome-weather-settings.php:42
|
28 |
+
msgid "Settings"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: awesome-weather-settings.php:46
|
32 |
+
msgid "API Key Required"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: awesome-weather-settings.php:50
|
36 |
+
msgid "Donate"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: awesome-weather-settings.php:53
|
40 |
+
msgid "Upgrade"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: awesome-weather-settings.php:68
|
44 |
+
msgid "OpenWeatherMaps APPID"
|
45 |
+
msgstr ""
|
46 |
+
|
47 |
+
#: awesome-weather-settings.php:69
|
48 |
+
msgid "Error Handling"
|
49 |
+
msgstr ""
|
50 |
+
|
51 |
+
#: awesome-weather-settings.php:106
|
52 |
+
msgid "As of October 2015, OpenWeatherMaps requires this key to access their weather data."
|
53 |
+
msgstr ""
|
54 |
+
|
55 |
+
#: awesome-weather-settings.php:108
|
56 |
+
msgid "Get your APPID"
|
57 |
+
msgstr ""
|
58 |
+
|
59 |
+
#: awesome-weather-settings.php:118
|
60 |
+
msgid "Hidden in Source"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#: awesome-weather-settings.php:119
|
64 |
+
msgid "Display if Admin"
|
65 |
+
msgstr ""
|
66 |
+
|
67 |
+
#: awesome-weather-settings.php:120
|
68 |
+
msgid "Display for Anyone"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: awesome-weather-settings.php:123
|
72 |
+
msgid "What should the plugin do when there is an error?"
|
73 |
+
msgstr ""
|
74 |
+
|
75 |
+
#: awesome-weather.php:81
|
76 |
msgid "C"
|
77 |
msgstr ""
|
78 |
|
79 |
+
#: awesome-weather.php:81
|
80 |
msgid "F"
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: awesome-weather.php:268
|
84 |
msgid "N"
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: awesome-weather.php:268
|
88 |
msgid "NNE"
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: awesome-weather.php:268
|
92 |
msgid "NE"
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: awesome-weather.php:268
|
96 |
msgid "ENE"
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: awesome-weather.php:268
|
100 |
msgid "E"
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: awesome-weather.php:268
|
104 |
msgid "ESE"
|
105 |
msgstr ""
|
106 |
|
107 |
+
#: awesome-weather.php:268
|
108 |
msgid "SE"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: awesome-weather.php:268
|
112 |
msgid "SSE"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: awesome-weather.php:268
|
116 |
msgid "S"
|
117 |
msgstr ""
|
118 |
|
119 |
+
#: awesome-weather.php:268
|
120 |
msgid "SSW"
|
121 |
msgstr ""
|
122 |
|
123 |
+
#: awesome-weather.php:268
|
124 |
msgid "SW"
|
125 |
msgstr ""
|
126 |
|
127 |
+
#: awesome-weather.php:268
|
128 |
msgid "WSW"
|
129 |
msgstr ""
|
130 |
|
131 |
+
#: awesome-weather.php:268
|
132 |
msgid "W"
|
133 |
msgstr ""
|
134 |
|
135 |
+
#: awesome-weather.php:268
|
136 |
msgid "WNW"
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: awesome-weather.php:268
|
140 |
msgid "NW"
|
141 |
msgstr ""
|
142 |
|
143 |
+
#: awesome-weather.php:268
|
144 |
msgid "NNW"
|
145 |
msgstr ""
|
146 |
|
147 |
+
#: awesome-weather.php:364
|
148 |
+
msgid "m/s"
|
|
|
|
|
|
|
|
|
149 |
msgstr ""
|
150 |
|
151 |
+
#: awesome-weather.php:369
|
152 |
msgid "humidity:"
|
153 |
msgstr ""
|
154 |
|
155 |
+
#: awesome-weather.php:370
|
156 |
msgid "wind:"
|
157 |
msgstr ""
|
158 |
|
159 |
+
#: awesome-weather.php:371
|
160 |
msgid "H"
|
161 |
msgstr ""
|
162 |
|
163 |
+
#: awesome-weather.php:371
|
164 |
msgid "L"
|
165 |
msgstr ""
|
166 |
|
167 |
+
#: awesome-weather.php:387
|
168 |
msgid "Sun"
|
169 |
msgstr ""
|
170 |
|
171 |
+
#: awesome-weather.php:387
|
172 |
msgid "Mon"
|
173 |
msgstr ""
|
174 |
|
175 |
+
#: awesome-weather.php:387
|
176 |
msgid "Tue"
|
177 |
msgstr ""
|
178 |
|
179 |
+
#: awesome-weather.php:387
|
180 |
msgid "Wed"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: awesome-weather.php:387
|
184 |
msgid "Thu"
|
185 |
msgstr ""
|
186 |
|
187 |
+
#: awesome-weather.php:387
|
188 |
msgid "Fri"
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: awesome-weather.php:387
|
192 |
msgid "Sat"
|
193 |
msgstr ""
|
194 |
|
195 |
+
#: awesome-weather.php:405
|
196 |
msgid "extended forecast"
|
197 |
msgstr ""
|
198 |
|
199 |
+
#: awesome-weather.php:428
|
200 |
msgid "No weather information available"
|
201 |
msgstr ""
|
202 |
|
203 |
+
#: awesome-weather.php:457
|
204 |
msgid "No city found in OpenWeatherMap."
|
205 |
msgstr ""
|
206 |
|
207 |
+
#: awesome-weather.php:458
|
208 |
msgid "Only one location found. The ID has been set automatically above."
|
209 |
msgstr ""
|
210 |
|
211 |
+
#: awesome-weather.php:459
|
212 |
msgid "Please confirm your city: "
|
213 |
msgstr ""
|
214 |
|
215 |
+
#: awesome-weather.php:543
|
216 |
msgid "Search for Your Location:"
|
217 |
msgstr ""
|
218 |
|
219 |
+
#: awesome-weather.php:544
|
220 |
msgid "(i.e: London,UK or New York City,NY)"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: awesome-weather.php:551
|
224 |
msgid "OpenWeatherMap City ID:"
|
225 |
msgstr ""
|
226 |
|
227 |
+
#: awesome-weather.php:552
|
228 |
msgid "(use the field above to find the ID for your city)"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: awesome-weather.php:565
|
232 |
msgid "Override Title:"
|
233 |
msgstr ""
|
234 |
|
235 |
+
#: awesome-weather.php:570
|
236 |
msgid "Units:"
|
237 |
msgstr ""
|
238 |
|
239 |
+
#: awesome-weather.php:576
|
240 |
msgid "Size:"
|
241 |
msgstr ""
|
242 |
|
243 |
+
#: awesome-weather.php:585
|
244 |
msgid "Forecast:"
|
245 |
msgstr ""
|
246 |
|
247 |
+
#: awesome-weather.php:597
|
248 |
msgid "Background Image:"
|
249 |
msgstr ""
|
250 |
|
251 |
+
#: awesome-weather.php:603
|
252 |
msgid "Use Different Background Images Based on Weather"
|
253 |
msgstr ""
|
254 |
|
255 |
+
#: awesome-weather.php:607
|
256 |
msgid "Custom Background Color:"
|
257 |
msgstr ""
|
258 |
|
259 |
+
#: awesome-weather.php:608
|
260 |
msgid "overrides color changing"
|
261 |
msgstr ""
|
262 |
|
263 |
+
#: awesome-weather.php:614
|
264 |
msgid "Hide Stats"
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: awesome-weather.php:620
|
268 |
msgid "Link to OpenWeatherMap"
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: awesome-weather.php:624
|
272 |
msgid "Widget Title: (optional)"
|
273 |
msgstr ""
|
274 |
#. Plugin Name of the plugin/theme
|
readme.txt
CHANGED
@@ -12,9 +12,11 @@ Finally beautiful weather widgets for your beautiful site.
|
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
>[Pro Version](https://halgatewood.com/downloads/awesome-weather-widget-pro/) available. Weather icons, New Layouts and Custom Templates, Weather by Yahoo
|
16 |
|
17 |
-
This plugin allows you to easily add super clean (and awesome) weather widgets to your site.
|
|
|
|
|
18 |
|
19 |
Use the built in widget with all of its marvelous settings or add it to a page or theme with the shortcode: (all settings shown)
|
20 |
|
@@ -55,6 +57,8 @@ Use the built in widget with all of its marvelous settings or add it to a page o
|
|
55 |
|
56 |
1. Add plugin to the `/wp-content/plugins/` directory
|
57 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
|
|
|
|
58 |
1. Use shortcode or widget to display awesome weather on your awesome site
|
59 |
|
60 |
|
@@ -71,6 +75,10 @@ Use the built in widget with all of its marvelous settings or add it to a page o
|
|
71 |
|
72 |
== Upgrade Notice ==
|
73 |
|
|
|
|
|
|
|
|
|
74 |
= 1.5.1 =
|
75 |
* Changed .custom class to .awe_custom
|
76 |
|
@@ -153,6 +161,10 @@ Changed API endpoints. Might not find weather without update.
|
|
153 |
|
154 |
== Changelog ==
|
155 |
|
|
|
|
|
|
|
|
|
156 |
= 1.5.2 =
|
157 |
* Updated WP_Widget construct to prevent future breaking.
|
158 |
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
>[Pro Version](https://halgatewood.com/downloads/awesome-weather-widget-pro/) available. Weather icons, New Layouts and Custom Templates, Weather by Yahoo! (no API key required), User Location Detection and more!
|
16 |
|
17 |
+
This plugin allows you to easily add super clean (and awesome) weather widgets to your site.
|
18 |
+
The weather data is provided for free by http://openweathermap.org and as of October 2015, they require an [API Key](http://openweathermap.org/appid#get) to access their weather.
|
19 |
+
Once you have the API Key you can simply add it in 'Settings' -> 'Awesome Weather' and you're ready to go.
|
20 |
|
21 |
Use the built in widget with all of its marvelous settings or add it to a page or theme with the shortcode: (all settings shown)
|
22 |
|
57 |
|
58 |
1. Add plugin to the `/wp-content/plugins/` directory
|
59 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
60 |
+
1. Register for an OpenWeatherMap [API Key](http://openweathermap.org/appid#get)
|
61 |
+
1. Add your API Key to the settings field in 'Settings' -> 'Awesome Weather' (added in version 1.5.3)
|
62 |
1. Use shortcode or widget to display awesome weather on your awesome site
|
63 |
|
64 |
|
75 |
|
76 |
== Upgrade Notice ==
|
77 |
|
78 |
+
= 1.5.3 =
|
79 |
+
* Added spot for API key in 'Settings' -> 'Awesome Weather'
|
80 |
+
* Added new setting to decide how to show error messages.
|
81 |
+
|
82 |
= 1.5.1 =
|
83 |
* Changed .custom class to .awe_custom
|
84 |
|
161 |
|
162 |
== Changelog ==
|
163 |
|
164 |
+
= 1.5.3 =
|
165 |
+
* Added spot for API key in 'Settings' -> 'Awesome Weather'
|
166 |
+
* Added new setting to decide how to show error messages.
|
167 |
+
|
168 |
= 1.5.2 =
|
169 |
* Updated WP_Widget construct to prevent future breaking.
|
170 |
|