mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 11:56:50 +00:00
Simple enhancement for easy overloading
This commit is contained in:
committed by
Fabien Potencier
parent
cab9fd9a10
commit
87d4f083bb
@@ -164,13 +164,15 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
|
|||||||
{
|
{
|
||||||
return filemtime($this->findTemplate($name)) <= $time;
|
return filemtime($this->findTemplate($name)) <= $time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function normalize($name)
|
||||||
|
{
|
||||||
|
return preg_replace('#/{2,}#', '/', strtr((string) $name, '\\', '/'));
|
||||||
|
}
|
||||||
|
|
||||||
protected function findTemplate($name)
|
protected function findTemplate($name)
|
||||||
{
|
{
|
||||||
$name = (string) $name;
|
$name = $this->normalize($name);
|
||||||
|
|
||||||
// normalize name
|
|
||||||
$name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/'));
|
|
||||||
|
|
||||||
if (isset($this->cache[$name])) {
|
if (isset($this->cache[$name])) {
|
||||||
return $this->cache[$name];
|
return $this->cache[$name];
|
||||||
|
|||||||
Reference in New Issue
Block a user