remove preThelia smarty filter

This commit is contained in:
Manuel Raynaud
2013-09-10 16:57:12 +02:00
parent 5ab3d4fb88
commit 04d517208f

View File

@@ -82,19 +82,10 @@ class SmartyParser extends Smarty implements ParserInterface
// The default HTTP status
$this->status = 200;
$this->registerFilter('pre', array($this, "preThelia"));
$this->registerFilter('output', array($this, "removeBlankLines"));
$this->registerFilter('variable', array(__CLASS__, "theliaEscape"));
}
public function preThelia($tpl_source, \Smarty_Internal_Template $template)
{
$new_source = preg_replace('`{#([a-zA-Z][a-zA-Z0-9_]*)(.*)}`', '{\$$1$2}', $tpl_source);
$new_source = preg_replace('`#([a-zA-Z][a-zA-Z0-9_]*)`', '{\$$1|dieseCanceller:\'#$1\'}', $new_source);
return $new_source;
}
public function removeBlankLines($tpl_source, \Smarty_Internal_Template $template)
{
return preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $tpl_source);