2 rcs_id('$Id: IncludePages.php,v 1.4 2008-06-20 18:07:17 vargenau Exp $');
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
19 along with PhpWiki; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * IncludePages: Include a list of multiple pages, based on IncludePage.
25 * usage: <?plugin IncludePages pages=<!plugin-list BackLinks !> ?>
28 * Todo: follow RedirectTo
31 include_once("lib/plugin/IncludePage.php");
33 class WikiPlugin_IncludePages
34 extends WikiPlugin_IncludePage
37 return _("IncludePages");
40 function getDescription() {
41 return _("Include multiple pages.");
44 function getVersion() {
45 return preg_replace("/[Revision: $]/", '',
49 function getDefaultArguments() {
51 array( 'pages' => false, // the pages to include
52 'exclude' => false), // the pages to exclude
53 WikiPlugin_IncludePage::getDefaultArguments()
57 function run($dbi, $argstr, &$request, $basepage) {
58 $args = $this->getArgs($argstr, $request);
60 if (empty($args['pages']))
62 $include = new WikiPlugin_IncludePage();
64 if (is_string($args['exclude']) and !empty($args['exclude'])) {
65 $args['exclude'] = explodePageList($args['exclude']);
66 $argstr = preg_replace("/exclude=\S*\s/", "", $argstr);
67 } elseif (is_array($args['exclude'])) {
68 $argstr = preg_replace("/exclude=<\?plugin-list.*?\>/", "", $argstr);
70 if (is_string($args['pages']) and !empty($args['pages'])) {
71 $args['pages'] = explodePageList($args['pages']);
72 $argstr = preg_replace("/pages=\S*\s/", "", $argstr);
73 } elseif (is_array($args['pages'])) {
74 $argstr = preg_replace("/pages=<\?plugin-list.*?\>/", "", $argstr);
77 foreach ($args['pages'] as $page) {
78 if (empty($args['exclude']) or !in_array($page, $args['exclude'])) {
79 $html = HTML($html, $include->run($dbi, "page='$page' ".$argstr, $request, $basepage));
86 // $Log: not supported by cvs2svn $
87 // Revision 1.3 2007/07/14 12:04:32 rurban
90 // Revision 1.2 2005/09/30 18:41:39 uckelman
91 // Fixed more passes-by-reference.
93 // Revision 1.1 2004/09/06 08:37:31 rurban
94 // plugin-list support for pages and exclude args
102 // c-hanging-comment-ender-p: nil
103 // indent-tabs-mode: nil