function fetchCityXtraDetails($lat, $lon) { $etc = array(); try { if (empty($lat) || empty($lon)) { throw new Exception('lat, lon empty'); } $etc['timezone'] = getdetailsonlatlon($lat, $lon); if (empty($etc['timezone'])) { throw new Exception('empty details'); } if ($etc['timezone']['rawOffset'] != $etc['timezone']['dstOffset']) { $etc['location']['dst'] = 1; } else { $etc['location']['dst'] = 0; } $etc['dd2dms'] = dd2dms($lat, $lon); $etc['location']['lat_h'] = $etc['dd2dms'][2]; $etc['location']['lat_m'] = $etc['dd2dms'][4]; $etc['location']['lat_s'] = $etc['dd2dms'][0] == 'S' ? 1 : 0; $etc['location']['lon_h'] = $etc['dd2dms'][3]; $etc['location']['lon_m'] = $etc['dd2dms'][5]; $etc['location']['lon_e'] = $etc['dd2dms'][1] == 'E' ? 1 : 0; $zones = makeTime(abs($etc['timezone']['rawOffset'])); $etc['location']['zone_h'] = $zones[0]; $etc['location']['zone_m'] = $zones[1]; } catch (Exception $e) { $etc = array(); } return $etc; }
function getXtraDetails($lat, $lon) { $etc = array(); if (empty($lat) || empty($lon)) { return false; } $etc['timezone'] = getdetailsonlatlon($lat, $lon); if (empty($etc['timezone'])) { return false; } if ($etc['timezone']['rawOffset'] != $etc['timezone']['dstOffset']) { $etc['location']['dst'] = 1; } else { $etc['location']['dst'] = 0; } $etc['dd2dms'] = dd2dms($lat, $lon); $etc['location']['lat_h'] = $etc['dd2dms'][2]; $etc['location']['lat_m'] = $etc['dd2dms'][4]; $etc['location']['lat_s'] = $etc['dd2dms'][0] == 'S' ? 1 : 0; $etc['location']['lon_h'] = $etc['dd2dms'][3]; $etc['location']['lon_m'] = $etc['dd2dms'][5]; $etc['location']['lon_e'] = $etc['dd2dms'][1] == 'E' ? 1 : 0; $zones = makeTime(abs($etc['timezone']['rawOffset'])); $etc['location']['zone_h'] = $zones[0]; $etc['location']['zone_m'] = $zones[1]; return $etc; }