+
+ $r['$APP'] = get_app();
+
+ // "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] === '$') {