post("_method", $input->get("_method", request::method())))) { case "put": return "put"; case "delete": return "delete"; default: return "post"; } } } /** * Choose an output format based on what the client prefers to accept. * @return string "html", "xml" or "json" */ public static function output_format() { // Pick a format, but let it be overridden. $input = Input::instance(); $fmt = $input->get( "_format", $input->post( "_format", request::preferred_accept( array("xhtml", "html", "xml", "json")))); // Some browsers (Chrome!) prefer xhtml over html, but we'll normalize this to html for now. if ($fmt == "xhtml") { $fmt = "html"; } return $fmt; } /** * Set HTTP response code. * @param string Use one of the status code constants defined in this class. */ public static function http_status($status_code) { header("HTTP/1.1 " . $status_code); } /** * Set HTTP Location header. * @param string URL */ public static function http_location($url) { header("Location: " . $url); } /** * Set HTTP Content-Type header. * @param string content type */ public static function http_content_type($type) { header("Content-Type: " . $type); } }