<?php
class MinifyPlugin extends Yaf_Plugin_Abstract
{
public function preResponse(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response)
{
/* meant to minify the body right before it is sent; note
* that, as of this version, this hook is never actually
* called */
$response->setBody(
preg_replace("/>\s+</", "><", $response->getBody())
);
}
}
/* plugins are registered in the bootstrap */
class Bootstrap extends Yaf_Bootstrap_Abstract
{
public function _initPlugin(Yaf_Dispatcher $dispatcher)
{
$dispatcher->registerPlugin(new MinifyPlugin());
}
}
?>