]> git.mxchange.org Git - friendica.git/blobdiff - include/template_processor.php
migrate more notifications
[friendica.git] / include / template_processor.php
index 11769bbd0791bcbf5dccda75ef15666ce7cd0cab..25f7703a2192cfe4b41a76c958c35514bb75fe45 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+
        class Template {
                var $r;
                var $search;
@@ -8,6 +9,8 @@
                var $nodes = array();
                var $done = false;
                var $d = false;
+               var $lang = null;
+               
                
                private function _preg_error(){
                        switch(preg_last_error()){
                        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);
+
+
+
+}