X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftemplate_processor.php;h=25f7703a2192cfe4b41a76c958c35514bb75fe45;hb=64d0616762efcff413a335f2fdde4d8219d44895;hp=11769bbd0791bcbf5dccda75ef15666ce7cd0cab;hpb=5ec4a4e6deb5d28cbfab54093f8b4180912738d4;p=friendica.git diff --git a/include/template_processor.php b/include/template_processor.php old mode 100644 new mode 100755 index 11769bbd07..25f7703a21 --- a/include/template_processor.php +++ b/include/template_processor.php @@ -1,5 +1,6 @@ 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); + + + +}