diff options
author | Zach Prezkuta <fermion@gmx.com> | 2013-01-06 19:58:50 -0700 |
---|---|---|
committer | Zach Prezkuta <fermion@gmx.com> | 2013-01-06 19:58:50 -0700 |
commit | c94c500cdcfdc94427d7f7e2509e9af9ee0d78ae (patch) | |
tree | f5664af0c56ab1b46c2afdb05661831d030fcc37 | |
parent | b4a95460e65dbadaf074a414a9e3d9367e109f19 (diff) | |
download | volse-hubzilla-c94c500cdcfdc94427d7f7e2509e9af9ee0d78ae.tar.gz volse-hubzilla-c94c500cdcfdc94427d7f7e2509e9af9ee0d78ae.tar.bz2 volse-hubzilla-c94c500cdcfdc94427d7f7e2509e9af9ee0d78ae.zip |
deal gracefully with non-existent files
-rw-r--r-- | include/text.php | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/include/text.php b/include/text.php index 83d989947..9db22d9ed 100644 --- a/include/text.php +++ b/include/text.php @@ -18,18 +18,21 @@ function replace_macros($s,$r) { $a = get_app(); if($a->get_template_engine() === 'smarty3') { - $template = ''; - if(gettype($s) === 'string') { - $template = $s; - $s = new FriendicaSmarty(); - } - foreach($r as $key=>$value) { - if($key[0] === '$') { - $key = substr($key, 1); + $output = ''; + if(gettype($s) !== 'NULL') { + $template = ''; + if(gettype($s) === 'string') { + $template = $s; + $s = new FriendicaSmarty(); + } + foreach($r as $key=>$value) { + if($key[0] === '$') { + $key = substr($key, 1); + } + $s->assign($key, $value); } - $s->assign($key, $value); + $output = $s->parsed($template); } - $output = $s->parsed($template); } else { $r = $t->replace($s,$r); |