2 rcs_id('$Id: BackLinks.php,v 1.9 2002-01-21 19:18:16 carstenklapp 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 // FIXME: how to exclude multiple pages?
21 return array('exclude' => '',
28 function run($dbi, $argstr, $request) {
29 $this->_args = $this->getArgs($argstr, $request);
30 extract($this->_args);
34 $p = $dbi->getPage($page);
35 $backlinks = $p->getLinks();
37 $pagelist = new PageList();
39 // Currently only info="Last Modified" or info=hits works (I don't think
40 // anything else would be useful anyway).
43 $pagelist->insertColumn(_($info));
46 while ($backlink = $backlinks->next()) {
47 $name = $backlink->getName();
48 if ($exclude && $name == $exclude)
50 if (!$include_self && $name == $page)
52 $pagelist->addPage($backlink);
58 return $pagelist->getContent();
61 // $pagelink = $Theme->linkExistingWikiWord($page);
62 $pagelink = LinkExistingWikiWord($page);
65 //FIXME: use __sprintf
66 //$head = sprintf("These %s pages link to %s:", '%d', $pagelink);
67 $head = sprintf("These pages link to %s:", $pagelink);
69 $head = sprintf("No pages link to %s.", $pagelink);
71 // $head = new RawXML($pagelist->setCaption($head));
72 // $head = HTML::p(new RawXML($pagelist->setCaption($head)));
73 // $head = HTML::p($pagelist->setCaption($head));
74 return array($head, $pagelist->getContent());
85 // c-hanging-comment-ender-p: nil
86 // indent-tabs-mode: nil