@@ 73-79 (lines=7) @@ | ||
70 | // Find end replace template functions |
|
71 | foreach ($this->func_array as $func) { |
|
72 | // Replace { function(params) } as { echo functon(params); } |
|
73 | if (preg_match_all('/\{\s*(' . $func . ')\s*(\(.*?\))\s*\}/', $tpl_data, $_match) > 0) { |
|
74 | // Function found |
|
75 | $tpl_data = preg_replace('/\{\s*(' . $func . ')\s*(\(.*?\))\s*\}/', '{ echo ' . $this->func_prefix . '$1 $2; }', $tpl_data); |
|
76 | ||
77 | // Include function |
|
78 | $include_functions[$func] = TRUE; |
|
79 | } |
|
80 | ||
81 | // If we want to assign function result to variable |
|
82 | // tpl code { $var = function(params) } |
|
@@ 83-89 (lines=7) @@ | ||
80 | ||
81 | // If we want to assign function result to variable |
|
82 | // tpl code { $var = function(params) } |
|
83 | if (preg_match_all('/\{\s*\$.*?\=\s*(' . $func . ')\s*(\(.*?\))\s*\}/', $tpl_data, $_match) > 0) { |
|
84 | // Function found |
|
85 | $tpl_data = preg_replace('/\{\s*(\$.*?)\=\s*(' . $func . ')\s*(\(.*?\))\s*\}/', '{ $1 = ' . $this->func_prefix . '$2 $3; }', $tpl_data); |
|
86 | ||
87 | // Include function |
|
88 | $include_functions[$func] = TRUE; |
|
89 | } |
|
90 | } |
|
91 | ||
92 | // PHP functions |