Fix __DIR__ in php 5.2.x
Merge branch 'master' into rewrite