//As part of validating the desired representation, this variable will be set, this will tell us //what mime type to shape the response if (isset($app->requestedMimeType)) { $mimeType = $app->requestedMimeType; } $details = $app->localizer->getText("E_PHP_EXCEPTION_DETAILS", $err->getMessage(), $err->getFile(), $err->getLine()); $app->response->header("Content-Type", $mimeType); $app->response->setBody(MgUtils::FormatException($app, "UnhandledError", $title, $details, $err->getTraceAsString(), 500, $mimeType)); }); $app->localizer = new Localizer($strings); //Set server version $ver = explode(".", SITE_ADMINISTRATOR_VERSION, 4); $app->MG_VERSION = array(intval($ver[0]), intval($ver[1]), intval($ver[2]), intval($ver[3])); $app->config("SelfUrl", $app->request->getUrl() . $app->request->getRootUri()); $un = new URL\Normalizer($app->config("SelfUrl") . "/" . $app->config("MapGuide.MapAgentUrl")); $app->config("MapGuide.MapAgentUrl", $un->normalize()); /* var_dump($app->localizer->getText("E_METHOD_NOT_SUPPORTED")); var_dump($app->localizer->getText("E_METHOD_NOT_SUPPORTED", "test")); var_dump($app->localizer->getText("E_METHOD_NOT_SUPPORTED", 123)); var_dump($app->localizer->getText("I_DONT_EXIST")); var_dump($app->localizer->getText("I_DONT_EXIST", "test")); var_dump($app->localizer->getText("I_DONT_EXIST", 123)); var_dump($app->localizer->getText("E_CANNOT_DELETE_MULTIPLE_ID_PROPS")); var_dump($app->localizer->getText("E_CANNOT_DELETE_MULTIPLE_ID_PROPS", "foo")); var_dump($app->localizer->getText("E_CANNOT_DELETE_MULTIPLE_ID_PROPS", 123)); var_dump($app->localizer->getText("E_CANNOT_DELETE_MULTIPLE_ID_PROPS", "foo", "bar")); var_dump($app->localizer->getText("E_CANNOT_DELETE_MULTIPLE_ID_PROPS", 123, "bar")); var_dump($app->localizer->getText("E_INVALID_COORDINATE_PAIR", "bar", 2)); var_dump($app->localizer->getText("E_INVALID_COORDINATE_PAIR", "bar", "sdf")); var_dump($app->localizer->getText("E_INVALID_COORDINATE_PAIR", "bar", "234"));
/** * Normalize URLs so they are all saved the same way. * * If passed an IP address, just saves the IP address, doesn't normalize. * * @api * * @since 1.0 * * @param string $url * * @return string */ function itelic_normalize_url($url) { if (filter_var($url, FILTER_VALIDATE_IP) !== false) { return $url; } $normalizer = new URL\Normalizer($url); return trailingslashit(esc_url_raw($normalizer->normalize())); }