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 ...@@ -221,8 +221,8 @@ class Dwoo_Compiler implements Dwoo_ICompiler
{ {
$this->ld = $left; $this->ld = $left;
$this->rd = $right; $this->rd = $right;
$this->ldr = preg_quote($left); $this->ldr = preg_quote($left, '/');
$this->rdr = preg_quote($right); $this->rdr = preg_quote($right, '/');
} }
/** /**
......
...@@ -31,8 +31,8 @@ class Dwoo_Plugin_extends extends Dwoo_Plugin implements Dwoo_ICompilable ...@@ -31,8 +31,8 @@ class Dwoo_Plugin_extends extends Dwoo_Plugin implements Dwoo_ICompilable
public static function compile(Dwoo_Compiler $compiler, $file) public static function compile(Dwoo_Compiler $compiler, $file)
{ {
list($l, $r) = $compiler->getDelimiters(); list($l, $r) = $compiler->getDelimiters();
self::$l = preg_quote($l); self::$l = preg_quote($l,'/');
self::$r = preg_quote($r); self::$r = preg_quote($r,'/');
if ($compiler->getLooseOpeningHandling()) { if ($compiler->getLooseOpeningHandling()) {
self::$l .= '\s*'; self::$l .= '\s*';
...@@ -120,7 +120,7 @@ class Dwoo_Plugin_extends extends Dwoo_Plugin implements Dwoo_ICompilable ...@@ -120,7 +120,7 @@ class Dwoo_Plugin_extends extends Dwoo_Plugin implements Dwoo_ICompilable
protected static function replaceBlock(array $matches) 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); $l = stripslashes(self::$l);
$r = stripslashes(self::$r); $r = stripslashes(self::$r);
......
...@@ -26,8 +26,8 @@ class Dwoo_Processor_smarty_compat extends Dwoo_Processor ...@@ -26,8 +26,8 @@ class Dwoo_Processor_smarty_compat extends Dwoo_Processor
{ {
list($l, $r) = $this->compiler->getDelimiters(); list($l, $r) = $this->compiler->getDelimiters();
$rl = preg_quote($l); $rl = preg_quote($l,'/');
$rr = preg_quote($r); $rr = preg_quote($r,'/');
$sectionParam = '(?:(name|loop|start|step|max|show)\s*=\s*(\S+))?\s*'; $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 = 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); $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