Add oEmbed support
[phorkie.git] / www / www-header.php
index 833fb8a56479a461382dba5983cfe6cfc9495551..859d797a094c45486b3edcb07ab3571bbe7ced78 100644 (file)
@@ -91,7 +91,7 @@ if (!isset($noSecurityCheck) || $noSecurityCheck !== true) {
     require __DIR__ . '/www-security.php';
 }
 
-function render($tplname, $vars = array())
+function render($tplname, $vars = array(), $return = false)
 {
     $vars['baseurl'] = '/';
     if (!empty($GLOBALS['phorkie']['cfg']['baseurl'])) {
@@ -117,8 +117,14 @@ function render($tplname, $vars = array())
     $vars['suggestSetupCheck'] = $GLOBALS['phorkie']['suggestSetupCheck'];
 
     $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm');
-    echo $template->render($vars);
+
+    if ($return) {
+        return $template->render($vars);
+    } else {
+        echo $template->render($vars);
+    }
 }
+
 function redirect($target)
 {
     header('Location: ' . $target);