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:
fabien
2009-11-11 16:57:23 +00:00
parent b721f043cd
commit 475eae5fce
4 changed files with 14 additions and 23 deletions
+1 -1
View File
@@ -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);
}
}
+12
View File
@@ -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
View File
@@ -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';
-9
View File
@@ -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);
}