function display_weather($output) { global $WI; if (in_array('show_current_weather_at_post', $WI->settings['display_options'])) { $values = get_post_custom_values('_metar'); $raw_metar = $values[0]; $values = get_post_custom_values('_location'); $location = $WI->settings['locations'][$values[0]]; if (!empty($raw_metar) && !empty($location)) { $metar = new WeatherIconMetar($raw_metar, $location['latitude'], $location['longitude'], $location['gmt_offset'], $location['dst'], '<li>', '</li>'); $output .= '<div class="weather-meta"><p>Weather at post time:</p><ul>'; $output .= $metar->get_temp(); $output .= $metar->get_wind(); $output .= $metar->get_visibility(); $output .= $metar->get_conditions(); $output .= "</ul></div>"; } } return $output; }
function WeatherIconBanner($arguments = '') { global $WI, $wp_version, $l10n; // Check to see if display_errors are on, if so, disable them $WI->disableDisplayErrors(); // We're using the 'var1=foo&var2=bar' input format now, so let's take care of it -Viper // Removed support for old style WeatherIcon call // Really doesn't work anymore // $WI->bool is required to translate from 'false' to FALSE and 'true' to TRUE. // -Garett parse_str($arguments, $new_args); // This function f'ing owns if (isset($new_args['location'])) { if (in_array($new_args['location'], array_keys($WI->settings['locations']))) { $location = $WI->settings['locations'][$new_args['location']]; $location_name = $new_args['location']; } } if (empty($location)) { $location = $WI->settings['locations'][$WI->settings['default_location']]; $location_name = $WI->settings['default_location']; } $station = $new_args['station'] ? $new_args['station'] : $location['station']; $latitude = isset($new_args['latitude']) && $new_args['latitude'] != '' ? $new_args['latitude'] : $location['latitude']; $longitude = isset($new_args['longitude']) && $new_args['longitude'] != '' ? $new_args['longitude'] : $location['longitude']; $gmt_offset = isset($new_args['gmt_offset']) && $new_args['gmt_offset'] != '' ? $new_args['gmt_offset'] : $location['gmt_offset']; $dst = isset($new_args['dst']) && $new_args['dst'] != '' ? $WI->bool($new_args['dst']) : $location['dst']; // Fetch the Metar Data for this Station $raw = $WI->fetch_metar($station); // default output $output = get_bloginfo('template_directory') . '/banners/random.php'; // If no metar ... if ($raw) { $metar = new WeatherIconMetar($raw, $latitude, $longitude, $gmt_offset, $dst, $before, $after); if ($metar->icon_name_translation()) { $output = WIicondirWeb . $metar->decoded_metar['icon']; } } // restore the error displaying $WI->restoreDisplayErrors(); echo $output; }
case '2': $metar = "KTTN 051853Z 04011KT 1/2SM VCTS SN FZFG BKN003 OVC010 M02/M02 A3006 RMK AO2 TSB40 SLP176 P0002 T10171017="; break; case '3': $metar = "KRIC 070754Z 20009KT 10SM OVC100 09/04 A3003 RMK AO2 SLP174 T00890044"; break; default: $metar = "ETHN 132020Z 07006KT 9999 M06/M08 Q1027 BLU+BLU+"; } } else { $metar = !empty($_GET['metar']) ? $_GET['metar'] : "ETHN 132020Z 07006KT 9999 M06/M08 Q1027 BLU+BLU+"; } $gmt = !empty($_GET['gmt_offset']) ? $_GET['gmt_offset'] : "1"; $lat = !empty($_GET['latitude']) ? $_GET['latitude'] : "49.7833"; $long = !empty($_GET['longitude']) ? $_GET['longitude'] : "9.8819"; $metar = new WeatherIconMetar($metar, $lat, $long, $gmt, '', '<br/>'); $output .= $metar->get_icon(); $output .= $metar->get_temp(); $output .= $metar->get_windchill(); $output .= $metar->get_humidex(); $output .= $metar->get_dewpoint(); $output .= $metar->get_wind(); $output .= $metar->get_humidity(); $output .= $metar->get_altimeter(); $output .= $metar->get_conditions(); $output .= $metar->get_simple_clouds(); $output .= $metar->get_detailed_clouds(); $output .= $metar->get_visibility(); $output .= $metar->get_sunrise(); $output .= $metar->get_sunset(); $output .= $metar->get_updatetime();