initial commit

This commit is contained in:
2010-01-12 19:36:01 +02:00
commit 43a7bae14a
7 changed files with 268 additions and 0 deletions

29
app/format.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
class Format {
function __construct (&$app) {
$this->app =& $app;
}
function call (&$env) {
// available formats
$formats = array("txt" => "text/plain", "xml" => "application/xml");
// call the next middleware in the stack
list($status, $headers, $body) = $this->app->call($env);
// do something with response headers
foreach( $formats as $key => $value ) {
if ( !empty($env["request.vars"]["format"]) && $env["request.get"]["format"] == $key ) {
$headers["Content-Type"] = $value;
}
}
return array($status, $headers, $body);
}
}
?>