Commit 3e859043 by Seldaek

* Fixed preg_quote() usage

git-svn-id: svn://dwoo.org/dwoo/trunk@88 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent b9a093a2
......@@ -221,8 +221,8 @@ class Dwoo_Compiler implements Dwoo_ICompiler
{
$this->ld = $left;
$this->rd = $right;
$this->ldr = preg_quote($left);
$this->rdr = preg_quote($right);
$this->ldr = preg_quote($left, '/');
$this->rdr = preg_quote($right, '/');
}
/**
......
......@@ -31,8 +31,8 @@ class Dwoo_Plugin_extends extends Dwoo_Plugin implements Dwoo_ICompilable
public static function compile(Dwoo_Compiler $compiler, $file)
{
list($l, $r) = $compiler->getDelimiters();
self::$l = preg_quote($l);
self::$r = preg_quote($r);
self::$l = preg_quote($l,'/');
self::$r = preg_quote($r,'/');
if ($compiler->getLooseOpeningHandling()) {
self::$l .= '\s*';
......@@ -120,7 +120,7 @@ class Dwoo_Plugin_extends extends Dwoo_Plugin implements Dwoo_ICompilable
protected static function replaceBlock(array $matches)
{
if (preg_match('/'.self::$l.'block (["\']?)'.preg_quote($matches[2]).'\1'.self::$r.'(?:\r?\n?)(.*?)(?:\r?\n?)'.self::$l.'\/block'.self::$r.'/is', self::$childSource, $override)) {
if (preg_match('/'.self::$l.'block (["\']?)'.preg_quote($matches[2],'/').'\1'.self::$r.'(?:\r?\n?)(.*?)(?:\r?\n?)'.self::$l.'\/block'.self::$r.'/is', self::$childSource, $override)) {
$l = stripslashes(self::$l);
$r = stripslashes(self::$r);
......
......@@ -26,8 +26,8 @@ class Dwoo_Processor_smarty_compat extends Dwoo_Processor
{
list($l, $r) = $this->compiler->getDelimiters();
$rl = preg_quote($l);
$rr = preg_quote($r);
$rl = preg_quote($l,'/');
$rr = preg_quote($r,'/');
$sectionParam = '(?:(name|loop|start|step|max|show)\s*=\s*(\S+))?\s*';
$input = preg_replace_callback('/'.$rl.'\s*section '.str_repeat($sectionParam, 6).'\s*'.$rr.'(.+?)(?:'.$rl.'\s*sectionelse\s*'.$rr.'(.+?))?'.$rl.'\s*\/section\s*'.$rr.'/is', array($this, 'convertSection'), $input);
$input = str_replace('$smarty.section.', '$smarty.for.', $input);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment