2 rcs_id('$Id: BackLinks.php,v 1.18 2002-01-31 01:14:14 dairiki Exp $');
6 require_once('lib/PageList.php');
8 class WikiPlugin_BackLinks
12 return _("BackLinks");
15 function getDescription () {
16 return sprintf(_("Get BackLinks for %s"),'[pagename]');
19 function getDefaultArguments() {
20 return array('exclude' => '',
23 'page' => '[pagename]',
27 // info arg allows multiple columns info=mtime,hits,summary,version,author,locked,minor
28 // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges
30 function run($dbi, $argstr, $request) {
31 $this->_args = $this->getArgs($argstr, $request);
32 extract($this->_args);
36 $exclude = $exclude ? explode(",", $exclude) : array();
40 $pagelist = new PageList($info, $exclude);
42 $p = $dbi->getPage($page);
43 $pagelist->addPages($p->getLinks());
46 $pagelink = WikiLink($page, 'auto');
48 if ($pagelist->isEmpty())
49 return HTML::p(fmt("No pages link to %s.", $pagelink));
51 if ($pagelist->getTotal() == 1)
52 $pagelist->setCaption(fmt("One page links to %s:",
55 $pagelist->setCaption(fmt("%s pages link to %s:",
56 $pagelist->getTotal(), $pagelink));
69 // c-hanging-comment-ender-p: nil
70 // indent-tabs-mode: nil