X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Ftemplate_processor.php;h=7a4cba64e93b4e5aab9f5d817d315cb4e410faed;hb=5bb8ed4b8b5310acc8556ef2fba7b3958284b2a6;hp=7f270fb4b39504b9d601e12d2cc6603a8d6ffde0;hpb=89560edde2fe3fb198b558479e9c2300fc4185fd;p=friendica.git diff --git a/include/template_processor.php b/include/template_processor.php index 7f270fb4b3..7a4cba64e9 100755 --- a/include/template_processor.php +++ b/include/template_processor.php @@ -92,8 +92,13 @@ */ 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]); @@ -160,7 +165,8 @@ krsort($this->nodes); return $s; } - + + /* private function _str_replace($str){ #$this->search,$this->replace, $searchs = $this->search; @@ -183,7 +189,7 @@ } return str_replace($this->search,$this->replace, $str); - } + }*/ public function replace($s, $r) { @@ -205,7 +211,8 @@ $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); }