function configure($args) { if (isset($args['from']) and isset($args['to'])) { $url = file_get_contents(GEOCODE_API_URL . "?format=json&key=" . GEOKEY . "&query=" . urlencode($args['from'])); $arr = json_decode($url, true); echo myForm($arr['geoResponse']); $url = file_get_contents(GEOCODE_API_URL . "?format=json&key=" . GEOKEY . "&query=" . urlencode($args['to'])); $arr = json_decode($url, true); echo myForm($arr['geoResponse'], true); return null; } elseif (isset($args['selectTo']) and isset($args['selectFrom']) and !isset($args['time'])) { $coordinate = $args['selectTo'] . ":" . $args['selectFrom']; $url = file_get_contents(TRAFFIC_API_URL . $coordinate . "/Quickest/json?key=" . MAPKEY . "&includeTraffic=false&includeInstructions=false"); $jsonArr = json_decode($url, true); $currentTime = $jsonArr['route']['summary']['totalTimeSeconds']; $args['time'] = $currentTime; echo myForm($args); return null; } elseif (isset($args['selectTo']) and isset($args['selectFrom']) and isset($args['min']) and isset($args['max']) and isset($args['time'])) { $result = "coordinate=" . $args['selectFrom'] . ":" . $args['selectTo'] . "&min=" . $args['min'] . "&max=" . $args['max'] . "&time=" . $args['time']; echo $result; return $result; } echo myForm(); return null; }
function configure($args) { if (isset($args)) { } else { echo myForm(); } }
function configure($args) { if (isset($args['periodValue']) and isset($args['eachValue'])) { return "periodValue=" . $args['periodValue'] . "&eachValue=" . $args['eachValue'] . "&lastCheck=" . time(); } echo myForm(); return null; }
function configure($args) { if (isset($args['city_select'])) { return "city_select=" . $args['city_select'] . "&forecast=" . $args['forecast']; } echo myForm(); return null; }
function configure($args) { if (isset($args['city'])) { $url = file_get_contents(weather_api_url . $args['city']); $arr = json_decode($url, true); if (strcmp($arr['cod'], "200") == 0) { echo myForm($arr); return null; } else { echo "<H1>Error city not found !</H1>"; return null; } } if (isset($args['city_select'])) { if (!isset($args['forecast'])) { echo myForm($args); return null; } else { return "city_select=" . $args['city_select'] . "&forecast=" . $args['forecast']; } } echo myForm(); return null; }