function __construct(Wunderground_Request $request)
 {
     $results = $request->get_results();
     if (!empty($results->alerts)) {
         foreach ($results->alerts as $key => $alert) {
             $this->alerts[] = new Wunderground_Alert($alert);
         }
     }
 }
 function __construct(Wunderground_Request $request)
 {
     $results = $request->get_results();
     if (empty($results->response)) {
         Wunderground_Plugin::log_error('Response is empty.');
         return NULL;
     }
     foreach ($results->response as $key => $value) {
         $this->{$key} = $value;
     }
     $this->date = empty($this->date) ? NULL : new Wunderground_Date($this->date);
 }
 function __construct(Wunderground_Request $request)
 {
     $results = $request->get_results();
     if (!empty($results->error)) {
         // TODO: Handle properly
         Wunderground_Plugin::log_error('Error loading results KWS_Wunderground', $results->error);
         return NULL;
     }
     $this->response = new Wunderground_Response($request);
     $this->forecast = new Wunderground_Forecast($request);
     $this->current_observation = new Wunderground_Current_Observation($request);
     $this->alerts = new Wunderground_Alerts($request);
     Wunderground_Plugin::log_debug('Wunderground_Forecast', $this);
 }
 function __construct(Wunderground_Request $request)
 {
     $results = $request->get_results();
     if (empty($results->forecast)) {
         Wunderground_Plugin::log_error('Response is empty.');
         return NULL;
     }
     if (!empty($results->forecast) && !empty($results->forecast->days)) {
         $this->days = array();
         foreach ($results->forecast->days as $key => $day) {
             $this->days[] = new Wunderground_Forecast_Summary($day);
         }
     }
     Wunderground_Plugin::log_debug('Wunderground_Forecast', $this);
 }
예제 #5
0
 function __construct(Wunderground_Request $request)
 {
     $results = $request->get_results();
     #	echo '<pre>';
     #	print_r($results);
     #	echo '</pre>';
     if (!empty($results->error)) {
         die(print_r($results->error));
         return NULL;
     }
     $this->response = new Wunderground_Response($request);
     $this->forecast = new Wunderground_Forecast($request);
     $this->current_observation = new Wunderground_Current_Observation($request);
     $this->alerts = new Wunderground_Alerts($request);
     Wunderground_Plugin::log_debug('Wunderground_Forecast', $this);
 }
 function autocomplete()
 {
     if (!isset($_REQUEST['_wpnonce']) || !wp_verify_nonce($_REQUEST['_wpnonce'], 'wunderground-aq')) {
         exit(0);
     }
     $country = wunderground_get_autocomplete_country_code();
     $url = add_query_arg(array('query' => urlencode(stripslashes_deep($_REQUEST['query'])), 'h' => 0, 'c' => $country, 'type' => 'city'), 'http://autocomplete.wunderground.com/aq');
     $response = Wunderground_Request::request($url);
     exit($response);
 }