]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/PageInfo.php
New: Gracefully handle non-existant pages. Added copyleft;
[SourceForge/phpwiki.git] / lib / plugin / PageInfo.php
1 <?php // -*-php-*-
2 rcs_id('$Id: PageInfo.php,v 1.2 2003-01-04 23:27:39 carstenklapp Exp $');
3
4 /**
5  Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam
6
7  This file is part of PhpWiki.
8
9  PhpWiki is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13
14  PhpWiki is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  GNU General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with PhpWiki; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23
24 /**
25  * An ActionPage plugin which returns extra information about a page.
26  * This plugin just passes a page revision handle to the Template
27  * 'info.tmpl', which does all the real work.
28  */
29 class WikiPlugin_PageInfo
30 extends WikiPlugin
31 {
32     function getName () {
33         return _("PageInfo");
34     }
35
36     function getDescription () {
37         return sprintf(_("Show extra page Info and statistics for %s"),
38                        '[pagename]');
39     }
40
41     function getVersion() {
42         return preg_replace("/[Revision: $]/", '',
43                             "\$Revision: 1.2 $");
44     }
45
46     function getDefaultArguments() {
47         return array('page' => '[pagename]');
48     }
49
50     function run ($dbi, $argstr, $request) {
51         $args = $this->getArgs($argstr, $request);
52         extract($args);
53
54         $pagename = $page;
55         if (! $dbi->isWikiPage($pagename))
56             return fmt("I'm sorry, there is no such page as %s.",
57                        WikiLink($pagename, 'unknown'));
58
59         $page = $request->getPage();
60
61         if (!empty($version)) {
62             if (!($revision = $page->getRevision($version)))
63                 NoSuchRevision($request, $page, $version);
64         }
65         else {
66             $revision = $page->getCurrentRevision();
67         }
68
69         $template = new Template('info', $request,
70                                  array('revision' => $revision));
71         return $template;
72     }
73 };
74
75 // $Log: not supported by cvs2svn $
76
77 // (c-file-style: "gnu")
78 // Local Variables:
79 // mode: php
80 // tab-width: 8
81 // c-basic-offset: 4
82 // c-hanging-comment-ender-p: nil
83 // indent-tabs-mode: nil
84 // End:
85 ?>