Url Filter Rev

class relativeUrlFilter extends sfFilter 
{
    public function execute($filterChain){
        $context  = $this->getContext();
        $request  = $context->getRequest();
 
        $relative = preg_replace('#/[^/]+.php5?$#', '', $request->getScriptName());
        $webDir = str_replace('\', '/', sfConfig::get('sf_web_dir'));
        $intercept = '/'.implode('/', array_intersect(explode('/',$relative), explode('/',$webDir)));       
        $position = strpos($webDir, $intercept);
        $request->setRelativeUrlRoot(substr($webDir, $position));                
        $filterChain->execute();
    }
}
 

Download this snippet

[Funny Games](http://www.asgames.net)

Twitter Twitter

Tags

relative url

2 Comments to “ Url Filter Rev”

  1. Anonymous  on May 08, 2010

    fP1apm <a href="http://epuiafxllkcd.com/">epuiafxllkcd</a>, [url=http://fpwpeshsscim.com/]fpwpeshsscim[/url], [link=http://kqoprbxemfud.com/]kqoprbxemfud[/link], http://pvoigjvqpokl.com/

  2. Anonymous  on Jun 10, 2010

    Q2ytWJ <a href="http://xbzelnclgjdj.com/">xbzelnclgjdj</a>, [url=http://vwcingslieky.com/]vwcingslieky[/url], [link=http://zmxxtdygeknb.com/]zmxxtdygeknb[/link], http://rncslsfaesxg.com/

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>