2 rcs_id('$Id: BackLinks.php,v 1.19 2003-01-18 21:19:25 carstenklapp Exp $');
4 Copyright 1999, 2000, 2001, 2002 $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
25 require_once('lib/PageList.php');
27 class WikiPlugin_BackLinks
31 return _("BackLinks");
34 function getDescription() {
35 return sprintf(_("List all pages which link to %s."), '[pagename]');
38 function getVersion() {
39 return preg_replace("/[Revision: $]/", '',
40 "\$Revision: 1.19 $");
43 function getDefaultArguments() {
44 return array('exclude' => '',
47 'page' => '[pagename]',
51 // info arg allows multiple columns
52 // info=mtime,hits,summary,version,author,locked,minor
53 // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges
55 function run($dbi, $argstr, $request) {
56 $this->_args = $this->getArgs($argstr, $request);
57 extract($this->_args);
61 $exclude = $exclude ? explode(",", $exclude) : array();
65 $pagelist = new PageList($info, $exclude);
67 $p = $dbi->getPage($page);
68 $pagelist->addPages($p->getLinks());
71 $pagelink = WikiLink($page, 'auto');
73 if ($pagelist->isEmpty())
74 return HTML::p(fmt("No pages link to %s.", $pagelink));
76 if ($pagelist->getTotal() == 1)
77 $pagelist->setCaption(fmt("One page links to %s:",
80 $pagelist->setCaption(fmt("%s pages link to %s:",
81 $pagelist->getTotal(), $pagelink));
89 // $Log: not supported by cvs2svn $
96 // c-hanging-comment-ender-p: nil
97 // indent-tabs-mode: nil