X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=include%2Ftemplate_processor.php;h=25f7703a2192cfe4b41a76c958c35514bb75fe45;hb=0c24784f5e92e0c8269f255e962312574871f2f0;hp=f1d2eae4e3d269f136f2ee708a67705bde859e4b;hpb=bdf42473a0341f291cd256323d122aa80bb0cb0b;p=friendica.git diff --git a/include/template_processor.php b/include/template_processor.php index f1d2eae4e3..25f7703a21 100644 --- a/include/template_processor.php +++ b/include/template_processor.php @@ -1,5 +1,6 @@
"; + debug_print_backtrace(); + die(); } private function _build_replace($r, $prefix){ @@ -153,30 +159,49 @@ krsort($this->nodes); return $s; } - + + public function replace($s, $r) { $this->r = $r; $this->search = array(); $this->replace = array(); - + $this->_build_replace($r, ""); #$s = str_replace(array("\n","\r"),array("§n§","§r§"),$s); $s = $this->_build_nodes($s); + $s = preg_replace_callback('/\|\|([0-9]+)\|\|/', array($this, "_replcb_node"), $s); if ($s==Null) $this->_preg_error(); // remove comments block $s = preg_replace('/{#[^#]*#}/', "" , $s); - // replace strings recursively (limit to 10 loops) $os = ""; $count=0; while($os!=$s && $count<10){ $os=$s; $count++; $s = str_replace($this->search,$this->replace, $s); } - return $s; + return template_unescape($s); } } $t = new Template; + + + + +function template_escape($s) { + + return str_replace(array('$','{{'),array('!_Doll^Ars1Az_!','!_DoubLe^BraceS4Rw_!'),$s); + + +} + +function template_unescape($s) { + + return str_replace(array('!_Doll^Ars1Az_!','!_DoubLe^BraceS4Rw_!'),array('$','{{'),$s); + + + +}