page: move placeholder_include() to widget method
[minimedit.git] / page.php
index a469a9d865cec5b765c99f4d7293aae122c17d6f..d5c78cdecc9005285a2df589197c6cd087c4453a 100644 (file)
--- a/page.php
+++ b/page.php
@@ -8,38 +8,6 @@ function abort($body, $status = NULL) {
        exit;
 }
 
-function placeholder_include($name, $params = [])
-{
-       $path = stream_resolve_include_path("widget/$name.php");
-       if (!file_exists($path)) {
-               return '<strong class="warn"><em>'.$name.'</em> ontbreekt</strong>';
-       }
-
-       ob_start();
-       $Page = clone $GLOBALS['Page'];
-       $Page->handler = $Page->handler . $Page->path; // .= with explicit getter
-       $Page->path = '';
-       $Place = $GLOBALS['Place'];
-       foreach ($params as $param) {
-               if ($set = strpos($param, '=')) {
-                       $Place[ substr($param, 0, $set) ] = substr($param, $set + 1);
-               }
-               elseif (!empty($param)) {
-                       $Page->path .= '/'.$param;
-               }
-       }
-       $Page->link .= $Page->path;
-       try {
-               include "widget/$name.php";
-               return ob_get_clean();
-       }
-       catch (Exception $e) {
-               return sprintf('<strong class="warn">%s</strong>',
-                       "fout in <em>$name</em>: {$e->getMessage()}"
-               );
-       }
-}
-
 function getoutput($blocks = [])
 {
        $doc = ob_get_clean();