From d59f368c27eb4458194aebf3833a3b08b1bd720e Mon Sep 17 00:00:00 2001 From: rurban Date: Sun, 15 Sep 2002 15:05:47 +0000 Subject: [PATCH] fix that expandPI($text,$request); - /* // the return of FrameInclude: - $plugin = TransformText($page_revision); - $args['FRAMESET'] = $plugin->_content[0]; - printXML(new Template('frameset', $request, $args)); - */ + return $loader->expandPI_head($text,$request); } else { printXML(new Template('html', $request, $args)); } diff --git a/lib/WikiPlugin.php b/lib/WikiPlugin.php index eb62b0015..305fd5b5a 100644 --- a/lib/WikiPlugin.php +++ b/lib/WikiPlugin.php @@ -1,5 +1,5 @@ \s*$/s', $pi, $m)) + if (!preg_match('/^\s*<\?(plugin(?:-form|-link)?)\s+(\w+)\s*(.*?)\s*\?>\s*$/s', $pi, $m)) return $this->_error(sprintf("Bad %s", 'PI')); list(, $pi_name, $plugin_name, $plugin_args) = $m; @@ -252,7 +252,6 @@ class WikiPluginLoader { } switch ($pi_name) { case 'plugin': - case 'plugin-head': // FIXME: change API for run() (no $dbi needed). $dbi = $request->getDbh(); return $plugin->run($dbi, $plugin_args, $request); @@ -263,6 +262,21 @@ class WikiPluginLoader { } } + // Special treatment. Only called by Template.php:GeneratePage + function expandPI_head($pi, $request) { + if (!preg_match('/^\s*<\?plugin-head\s+(\w+)\s*(.*?)\s*\?>\s*$/s', $pi, $m)) + return $this->_error(sprintf("Bad %s", 'PI')); + + list(, $plugin_name, $plugin_args) = $m; + $plugin = $this->getPlugin($plugin_name); + if (!is_object($plugin)) { + return new HtmlElement('p', array('class' => 'plugin-error'), + $this->getErrorDetail()); + } + $dbi = $request->getDbh(); + return $plugin->run($dbi, $plugin_args, $request); + } + function getPlugin($plugin_name) { global $ErrorManager; -- 2.45.0