mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 11:27:00 +00:00
moved getTemplateClass() to Twig_Environment
git-svn-id: http://svn.twig-project.org/trunk@132 93ef8e89-cb99-4229-a87c-7fa0fa45744b
This commit is contained in:
@@ -246,6 +246,6 @@ class Twig_Compiler implements Twig_CompilerInterface
|
||||
|
||||
public function getTemplateClass($name)
|
||||
{
|
||||
return $this->getEnvironment()->getLoader()->getTemplateClass($name);
|
||||
return $this->getEnvironment()->getTemplateClass($name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,18 @@ class Twig_Environment
|
||||
$this->trimBlocks = (bool) $bool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the template class associated with the given string.
|
||||
*
|
||||
* @param string $name The name for which to calculate the template class name
|
||||
*
|
||||
* @return string The template class name
|
||||
*/
|
||||
public function getTemplateClass($name)
|
||||
{
|
||||
return '__TwigTemplate_'.md5($name);
|
||||
}
|
||||
|
||||
public function loadTemplate($name)
|
||||
{
|
||||
if (!$this->runtimeInitialized)
|
||||
|
||||
+1
-13
@@ -59,7 +59,7 @@ abstract class Twig_Loader implements Twig_LoaderInterface
|
||||
*/
|
||||
public function load($name)
|
||||
{
|
||||
$cls = $this->getTemplateClass($name);
|
||||
$cls = $this->env->getTemplateClass($name);
|
||||
|
||||
if (class_exists($cls, false))
|
||||
{
|
||||
@@ -127,18 +127,6 @@ abstract class Twig_Loader implements Twig_LoaderInterface
|
||||
$this->env = $env;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the template class associated with the given string.
|
||||
*
|
||||
* @param string $name The name for which to calculate the template class name
|
||||
*
|
||||
* @return string The template class name
|
||||
*/
|
||||
public function getTemplateClass($name)
|
||||
{
|
||||
return '__TwigTemplate_'.md5($name);
|
||||
}
|
||||
|
||||
public function getCacheFilename($name)
|
||||
{
|
||||
return $this->cache.'/twig_'.md5($name).'.php';
|
||||
|
||||
@@ -33,13 +33,4 @@ interface Twig_LoaderInterface
|
||||
* @param Twig_Environment $env A Twig_Environment instance
|
||||
*/
|
||||
public function setEnvironment(Twig_Environment $env);
|
||||
|
||||
/**
|
||||
* Gets the template class associated with the given string.
|
||||
*
|
||||
* @param string $name The name for which to calculate the template class name
|
||||
*
|
||||
* @return string The template class name
|
||||
*/
|
||||
public function getTemplateClass($name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user