post("_method", $input->get("_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(); return $input->get( "_format", $input->post( "_format", request::preferred_accept( array("html", "xml", "json")))); } /** * 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); } }