+ // "middleware": inject variables into templates
+ $arr = array(
+ "template"=> basename($s->filename),
+ "vars" => $r
+ );
+ call_hooks("template_vars", $arr);
+ $r = $arr['vars'];
+
+ foreach($r as $key=>$value) {
+ if($key[0] === '$') {
+ $key = substr($key, 1);
+ }
+ $s->assign($key, $value);
+ }
+ return $s->parsed($template);
+ }
+
+ public function get_template_file($file, $root=''){
+ $a = get_app();
+ $template_file = get_template_file($a, SMARTY3_TEMPLATE_FOLDER.'/'.$file, $root);
+ $template = new FriendicaSmarty();
+ $template->filename = $template_file;
+ return $template;
+ }
+}