'Current Info', 'description' => 'Displays the current weather and time in Calgary, AB, Canada' ]; } public function onRun() { date_default_timezone_set('America/Edmonton'); $fields['time'] = date('g:ia'); $this->page['conditions'] = $fields; $this->addJs('/plugins/jasonwilliams/calgaryconditions/assets/javascript/currentinfo.js'); } public function onUpdateRequested() { $settings = Settings::instance(); $response = Cache::remember('weatherdata', 60, function() { return json_decode(Http::get('http://api.weatherstack.com/current?access_key='.$settings->weatherstack_api_key.'&query=Calgary')); }); date_default_timezone_set('America/Edmonton'); $fields['time'] = date('g:ia'); $fields['temperature'] = $response->current->temperature; $fields['weather'] = strtolower($response->current->weather_descriptions[0]); $this->page['conditions'] = $fields; } }