$response = null; $parameters = null; $body = null; if (DiscoUtils::route('options', '.*', $parameters)) { header('Content-Type: application/json; charset=utf-8'); exit; } $store = new DiscoStore(); $logostore = new DiscoStoreLogos(); if (DiscoUtils::route('get', '^/$', $parameters, $body)) { header('Content-Type: text/plain; charset=utf-8'); echo "Welcome to DiscoJuice API\n" . "Consult documentation for details about using the API.\n" . "http://discojuice.org"; exit; } else { if (DiscoUtils::route('get', '^/feeds$', $parameters, $body)) { $list = $store->getFeedList(); $response = Feed::toJSONlist($list); // $response = $list; } else { if (DiscoUtils::route('get', '^/geo$', $parameters, $body)) { $geoservice = new GeoService(); $data = array(); $clientIP = $_SERVER['REMOTE_ADDR']; $data['country'] = $geoservice->countryFromIP($clientIP); $data['geo'] = $geoservice->geoFromIP($clientIP); $response = $data; } else { if (DiscoUtils::route('get', '^/pipe/([a-z0-9\\-_]+)$', $parameters, $body)) { $response = $store->getPipe($parameters[1]); unset($response['_id']); } else {