]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/PageInfo.php
Remove Width and Height preferences modification in Edit Toolbar
[SourceForge/phpwiki.git] / lib / plugin / PageInfo.php
1 <?php
2
3 /**
4  * Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam
5  *
6  * This file is part of PhpWiki.
7  *
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.
12  *
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.
17  *
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.
21  */
22
23 /**
24  * An ActionPage plugin which returns extra information about a page.
25  * This plugin just passes a page revision handle to the Template
26  * 'info.tmpl', which does all the real work.
27  */
28 class WikiPlugin_PageInfo
29     extends WikiPlugin
30 {
31     function getDescription()
32     {
33         return sprintf(_("Show extra page Info and statistics for %s."),
34             '[pagename]');
35     }
36
37     function getDefaultArguments()
38     {
39         return array('page' => '[pagename]',
40             'version' => '[version]');
41     }
42
43     /**
44      * @param WikiDB $dbi
45      * @param string $argstr
46      * @param WikiRequest $request
47      * @param string $basepage
48      * @return mixed
49      */
50     function run($dbi, $argstr, &$request, $basepage)
51     {
52         $args = $this->getArgs($argstr, $request);
53         extract($args);
54
55         $pagename = $page;
56         $page = $request->getPage();
57         $current = $page->getCurrentRevision();
58
59         if ($current->getVersion() < 1)
60             return fmt("Page ā€œ%sā€ does not exist.", WikiLink($pagename, 'unknown'));
61
62         if (!empty($version)) {
63             if (!($revision = $page->getRevision($version)))
64                 NoSuchRevision($request, $page, $version);
65         } else {
66             $revision = $current;
67         }
68
69         $template = new Template('info', $request,
70             array('revision' => $revision));
71         return $template;
72     }
73 }
74
75 // Local Variables:
76 // mode: php
77 // tab-width: 8
78 // c-basic-offset: 4
79 // c-hanging-comment-ender-p: nil
80 // indent-tabs-mode: nil
81 // End: