4 * Copyright 2004 $ThePhpWikiProgrammingTeam
6 * This file is part of PhpWiki.
8 * PhpWiki is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * PhpWiki is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * IncludePages: Include a list of multiple pages, based on IncludePage.
25 * usage: <<IncludePages pages=<!plugin-list BackLinks !> >>
29 include_once 'lib/plugin/IncludePage.php';
31 class WikiPlugin_IncludePages
32 extends WikiPlugin_IncludePage
36 return _("IncludePages");
39 function getDescription()
41 return _("Include multiple pages.");
44 function getDefaultArguments()
46 return array_merge(array('pages' => false, // the pages to include
47 'exclude' => false), // the pages to exclude
48 WikiPlugin_IncludePage::getDefaultArguments()
52 function run($dbi, $argstr, &$request, $basepage)
54 $args = $this->getArgs($argstr, $request);
56 if (empty($args['pages'])) {
59 $include = new WikiPlugin_IncludePage();
61 if (is_string($args['exclude']) and !empty($args['exclude'])) {
62 $args['exclude'] = explodePageList($args['exclude']);
63 $argstr = preg_replace("/exclude=\S*\s/", "", $argstr);
64 } elseif (is_array($args['exclude'])) {
65 $argstr = preg_replace("/exclude=<\?plugin-list.*?\>/", "", $argstr);
67 if (is_string($args['pages']) and !empty($args['pages'])) {
68 $args['pages'] = explodePageList($args['pages']);
69 $argstr = preg_replace("/pages=\S*\s/", "", $argstr);
70 } elseif (is_array($args['pages'])) {
71 $argstr = preg_replace("/pages=<\?plugin-list.*?\>/", "", $argstr);
74 // IncludePage plugin has no "pages" argument.
75 // Remove it to avoid warning.
76 $argstr = preg_replace('/pages=".*?"/', "", $argstr);
77 $argstr = preg_replace('/pages=\S*\s/', "", $argstr);
78 $argstr = preg_replace('/pages=\S*/', "", $argstr);
80 foreach ($args['pages'] as $page) {
81 if (empty($args['exclude']) or !in_array($page, $args['exclude'])) {
82 $html = HTML($html, $include->run($dbi, "page='$page' " . $argstr, $request, $basepage));
93 // c-hanging-comment-ender-p: nil
94 // indent-tabs-mode: nil