]> git.mxchange.org Git - friendica.git/blobdiff - include/template_processor.php
Mostly some checks in order to avoid Notices; 1 real bugfix in /mod/network.php
[friendica.git] / include / template_processor.php
index 7f270fb4b39504b9d601e12d2cc6603a8d6ffde0..7a4cba64e93b4e5aab9f5d817d315cb4e410faed 100755 (executable)
                 */
                private function _replcb_for($args){
                        $m = array_map('trim', explode(" as ", $args[2]));
-                       list($keyname, $varname) = explode("=>",$m[1]);
-                       if (is_null($varname)) { $varname=$keyname; $keyname=""; }
+                       $x = explode("=>",$m[1]);
+                       if (count($x) == 1) {
+                               $varname = $x[0];
+                               $keyname = "";
+                       } else {
+                               list($keyname, $varname) = $x;
+                       }
                        if ($m[0]=="" || $varname=="" || is_null($varname)) die("template error: 'for ".$m[0]." as ".$varname."'") ;
                        //$vals = $this->r[$m[0]];
                        $vals = $this->_get_var($m[0]);
                        krsort($this->nodes);
                        return $s;
                }
-
+               
+        /*
                private function _str_replace($str){
                        #$this->search,$this->replace,
                        $searchs = $this->search;
                                
                        }
                        return str_replace($this->search,$this->replace, $str);
-               }
+               }*/
 
        
                public function replace($s, $r) {
                        $os = ""; $count=0;
                        while($os!=$s && $count<10){
                                $os=$s; $count++;
-                               $s = $this->_str_replace($s);
+                               //$s = $this->_str_replace($s);
+                               $s = str_replace($this->search, $this->replace, $s);
                        }
                        return template_unescape($s);
                }