widget: unnamed options as placeholders instead of path
[minimedit.git] / article.inc.php
index 2104ef9d65025e0b3a0687d0d49dc0a0e9ff34ce..30de51e770ba18bf9b2cb87a9b962a77d8674ff2 100644 (file)
@@ -164,17 +164,20 @@ class ArchiveArticle
 
                ob_start();
                $Page = clone $this;
-               $Page->handler = $Page->handler . $Page->path; // .= with explicit getter
-               $Page->path = '';
-               foreach ($params as $param) {
-                       if ($set = strpos($param, '=')) {
-                               $Page->place[ substr($param, 0, $set) ] = substr($param, $set + 1);
-                       }
-                       elseif (!empty($param)) {
-                               $Page->path .= '/'.$param;
+               if (is_array($params)) {
+                       $Page->place += $params;
+               }
+               else {
+                       foreach (explode(' ', $params) as $param) {
+                               if ($set = strpos($param, '=')) {
+                                       $Page->place[ substr($param, 0, $set) ] = substr($param, $set + 1);
+                               }
+                               elseif (!empty($param)) {
+                                       $Page->place[] = $param;
+                               }
                        }
                }
-               $Page->link .= $Page->path;
+
                try {
                        include "widget/$name.php";
                        return ob_get_clean();
@@ -210,7 +213,7 @@ class ArchiveArticle
                        function ($sub) {
                                list ($placeholder, $name, $params) = $sub;
                                $html = $this->place[$name] ??
-                                       $this->widget($name, explode(' ', $params));
+                                       $this->widget($name, $params);
                                if (empty($html) or $html[0] != '<') {
                                        $html = "<span>$html</span>";
                                }