false, 'noheader' => false, 'page' => '[pagename]', )); } // info arg allows multiple columns // info=mtime,hits,summary,version,author,locked,minor // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges // NEW: info=count : number of links function run($dbi, $argstr, &$request, $basepage) { $this->_args = $this->getArgs($argstr, $request); extract($this->_args); if (empty($page) and $page != '0') return ''; $exclude = is_string($exclude) ? explodePageList($exclude) : (is_array($exclude) ? $exclude : array()); if (!$include_self) $exclude[] = $page; if ($info) { $info = explode(",", $info); if (in_array('count',$info)) $this->_args['types']['count'] = new _PageList_Column_BackLinks_count('count', _("#"), 'center'); } $pagelist = new PageList($info, $exclude, $this->_args); $p = $dbi->getPage($page); $pagelist->addPages($p->getLinks()); // Localization note: In English, the differences between the // various phrases spit out here may seem subtle or negligible // enough to tempt you to combine/normalize some of these // strings together, but the grammar employed most by other // languages does not always end up with so subtle a // distinction as it does with English in this case. :) if (!$noheader) { if ($page == $request->getArg('pagename') && !$dbi->isWikiPage($page)) { // BackLinks plugin is more than likely being called // upon for an empty page on said page, while either // 'browse'ing, 'create'ing or 'edit'ing. // // Don't bother displaying a WikiLink 'unknown', just // the Un~WikiLink~ified (plain) name of the uncreated // page currently being viewed. $pagelink = $page; if ($pagelist->isEmpty()) return HTML::p(fmt("No other page links to %s yet.", $pagelink)); if ($pagelist->getTotal() == 1) $pagelist->setCaption(fmt("One page would link to %s:", $pagelink)); // Some future localizations will actually require // this... (BelieveItOrNot, English-only-speakers!(:) // // else if ($pagelist->getTotal() == 2) // $pagelist->setCaption(fmt("Two pages would link to %s:", // $pagelink)); else $pagelist->setCaption(fmt("%s pages would link to %s:", $pagelist->getTotal(), $pagelink)); } else { // BackLinks plugin is being displayed on a normal page. $pagelink = WikiLink($page, 'auto'); if ($pagelist->isEmpty()) return HTML::p(fmt("No page links to %s.", $pagelink)); //trigger_error("DEBUG: " . $pagelist->getTotal()); if ($pagelist->getTotal() == 1) $pagelist->setCaption(fmt("One page links to %s:", $pagelink)); // Some future localizations will actually require // this... (BelieveItOrNot, English-only-speakers!(:) // // else if ($pagelist->getTotal() == 2) // $pagelist->setCaption(fmt("Two pages link to %s:", // $pagelink)); else $pagelist->setCaption(fmt("%s pages link to %s:", $pagelist->getTotal(), $pagelink)); } } return $pagelist; } }; // how many links from this backLink to other pages class _PageList_Column_BackLinks_count extends _PageList_Column { function _getValue($page, &$revision_handle) { $iter = $page->getPageLinks(); $count = $iter->count(); return $count; } } // $Log: not supported by cvs2svn $ // Revision 1.26 2004/09/14 10:32:32 rurban // support exclude = plugin-list // // Revision 1.25 2004/09/13 15:00:50 rurban // info=count: number of links at this subpage // // Revision 1.24 2004/04/18 05:42:17 rurban // more fixes for page="0" // better WikiForum support // // Revision 1.23 2004/02/22 23:20:33 rurban // fixed DumpHtmlToDir, // enhanced sortby handling in PageList // new button_heading th style (enabled), // added sortby and limit support to the db backends and plugins // for paging support (<> links on long lists) // // Revision 1.22 2004/02/17 12:11:36 rurban // added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...) // // Revision 1.21 2003/12/22 07:31:57 carstenklapp // Bugfix: commented out debugging code that snuck into the release. // // Revision 1.20 2003/12/14 05:36:31 carstenklapp // Internal changes to prepare for an upcoming feature: Added some // conditions and alternate phrases (alternate wording of text srings // when referring to a non-existant page (i.e. WikiLink 'unknown')) when // calling the BackLinks plugin *within* a non-existant page, such as // from within an editpage or browse template while editing a new page. // // Revision 1.19 2003/01/18 21:19:25 carstenklapp // Code cleanup: // Reformatting; added copyleft, getVersion, getDescription // // For emacs users // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: ?>