<?php
class RewritePlugin extends Yaf_Plugin_Abstract
{
public function routerStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response)
{
/* rewrite "/about" style URIs to "/page/about" before
* routing runs */
$uri = $request->getRequestUri();
if (preg_match("#^/[a-z]+$#", $uri)) {
$request->setRequestUri("/page" . $uri);
}
}
}
/* plugins are registered in the bootstrap */
class Bootstrap extends Yaf_Bootstrap_Abstract
{
public function _initPlugin(Yaf_Dispatcher $dispatcher)
{
$dispatcher->registerPlugin(new RewritePlugin());
}
}
?>