/** * Gets weather data. * * @return array */ public function get($location, $options = []) { $Weather = new WeatherLib(); $defaults = ['cache' => '+1 hour']; $options += $defaults; return $Weather->get($location, $options); }
<?php include_once 'lib/phpweatherlib.php'; include_once 'lib/check_mobile_referrer.php'; include 'lib/mobile_device_detect.php'; include 'lib/emergency_search.php'; //Determine if the browser is from a mobile device $mobile = mobile_device_detect(); //If it's not a mobile device, redirect the user to Meredith's regular homepage if (!$mobile) { echo "<meta http-equiv='refresh' content='0;url=http://www.meredith.edu'>"; } $displayWeather = true; //CREATE OUR WEATHERLIB OBJECT FOR RALEIGH (WEATHER STATION KRDU) $weatherObj = new WeatherLib('KRDU'); if ($weatherObj->has_error()) { $displayWeather = false; } $temperature = $weatherObj->get_temp_f(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="yes" name="apple-mobile-web-app-capable" /> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> <meta http-equiv="Content-Language" content="en-US" /> <meta name="viewport" content="width=device-width,user-scalable=no" /> <link href="css/core.css" rel="stylesheet" media="screen" type="text/css" /> <link rel="apple-touch-icon" href="./images/MeredithCollege/athletics.png" width="120" height="120" />