Awesome Weather Widget - Version 1.2.3

Version Description

Removed file_get_contents and replaced with wp_remote_get

Download this release

Release Info

Developer halgatewood
Plugin Icon 128x128 Awesome Weather Widget
Version 1.2.3
Comparing to
See all releases

Code changes from version 1.2.2 to 1.2.3

Files changed (2) hide show
  1. awesome-weather.php +7 -4
  2. readme.txt +3 -0
awesome-weather.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://halgatewood.com/awesome-weather
5
  Description: A weather widget that actually looks cool
6
  Author: Hal Gatewood
7
  Author URI: http://www.halgatewood.com
8
- Version: 1.2.2
9
 
10
 
11
  FILTERS AVAILABLE:
@@ -78,7 +78,8 @@ function awesome_weather_logic( $atts )
78
  if(!$city_id)
79
  {
80
  $city_ping = "http://api.openweathermap.org/data/2.1/find/name?q=" . $city_name_slug;
81
- $data = json_decode( file_get_contents( $city_ping ) );
 
82
 
83
  if( isset($data->message) AND $data->message == "not found" )
84
  {
@@ -109,13 +110,15 @@ function awesome_weather_logic( $atts )
109
 
110
  if(!isset($weather_data['today']))
111
  {
112
- $weather_data['today'] = json_decode(file_get_contents("http://api.openweathermap.org/data/2.1/weather/city/" . $city_id . "?units=" . $units) );
 
113
  set_transient( $weather_transient_name, $weather_data, apply_filters( 'awesome_weather_cache', 3600 ) ); // CACHE FOR AN HOUR
114
  }
115
 
116
  if(!isset($weather_data['forecast']) AND $days_to_show != "hide")
117
  {
118
- $weather_data['forecast'] = json_decode(file_get_contents("http://api.openweathermap.org/data/2.1/forecast/city/" . $city_id . "?mode=daily_compact&units=" . $units) );
 
119
  set_transient( $weather_transient_name, $weather_data, apply_filters( 'awesome_weather_cache', 3600 ) ); // CACHE FOR AN HOUR
120
  }
121
 
5
  Description: A weather widget that actually looks cool
6
  Author: Hal Gatewood
7
  Author URI: http://www.halgatewood.com
8
+ Version: 1.2.3
9
 
10
 
11
  FILTERS AVAILABLE:
78
  if(!$city_id)
79
  {
80
  $city_ping = "http://api.openweathermap.org/data/2.1/find/name?q=" . $city_name_slug;
81
+ $city_ping_get = wp_remote_get( $city_ping );
82
+ $data = json_decode( $city_ping_get['body'] );
83
 
84
  if( isset($data->message) AND $data->message == "not found" )
85
  {
110
 
111
  if(!isset($weather_data['today']))
112
  {
113
+ $today_get = wp_remote_get("http://api.openweathermap.org/data/2.1/weather/city/" . $city_id . "?units=" . $units);
114
+ $weather_data['today'] = json_decode( $today_get['body'] );
115
  set_transient( $weather_transient_name, $weather_data, apply_filters( 'awesome_weather_cache', 3600 ) ); // CACHE FOR AN HOUR
116
  }
117
 
118
  if(!isset($weather_data['forecast']) AND $days_to_show != "hide")
119
  {
120
+ $forecast_get = wp_remote_get("http://api.openweathermap.org/data/2.1/forecast/city/" . $city_id . "?mode=daily_compact&units=" . $units);
121
+ $weather_data['forecast'] = json_decode( $forecast_get['body'] );
122
  set_transient( $weather_transient_name, $weather_data, apply_filters( 'awesome_weather_cache', 3600 ) ); // CACHE FOR AN HOUR
123
  }
124
 
readme.txt CHANGED
@@ -48,6 +48,9 @@ All weather data is provided by http://openweathermap.org and is cached for one
48
 
49
  == Upgrade Notice ==
50
 
 
 
 
51
  = 1.2 =
52
  Background Image Option
53
 
48
 
49
  == Upgrade Notice ==
50
 
51
+ = 1.2.3 =
52
+ Removed file_get_contents and replaced with wp_remote_get
53
+
54
  = 1.2 =
55
  Background Image Option
56