From: Carsten K. <car...@us...> - 2002-01-30 18:29:13
|
Update of /cvsroot/phpwiki/phpwiki/lib/plugin In directory usw-pr-cvs1:/tmp/cvs-serv18980 Modified Files: MostPopular.php Log Message: Added multiple page exclusion and include_self. Index: MostPopular.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/MostPopular.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** MostPopular.php 2002/01/27 04:23:26 1.16 --- MostPopular.php 2002/01/30 18:29:10 1.17 *************** *** 18,39 **** function getDefaultArguments() { ! return array('limit' => 20, ! 'noheader' => 0, ! 'info' => false ); } // info arg allows multiple columns info=mtime,hits,summary,version,author,locked,minor function run($dbi, $argstr, $request) { extract($this->getArgs($argstr, $request)); - $pages = $dbi->mostPopular($limit); - $pagelist = new PageList(); - $pagelist->insertColumn('hits'); if ($info) foreach (explode(",", $info) as $col) $pagelist->insertColumn($col); while ($page = $pages->next()) { --- 18,50 ---- function getDefaultArguments() { ! return array('pagename' => '[pagename]', // hackish ! 'exclude' => '', ! 'include_self' => 1, // hackish ! 'limit' => 20, ! 'noheader' => 0, ! 'info' => false ); } // info arg allows multiple columns info=mtime,hits,summary,version,author,locked,minor + // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges function run($dbi, $argstr, $request) { extract($this->getArgs($argstr, $request)); $pagelist = new PageList(); if ($info) foreach (explode(",", $info) as $col) $pagelist->insertColumn($col); + + if (!$include_self) + $pagelist->excludePageName($pagename); // hackish + if ($exclude) + foreach (explode(",", $exclude) as $excludepage) + $pagelist->excludePageName($excludepage); + + $pagelist->insertColumn('hits'); + + $pages = $dbi->mostPopular($limit); while ($page = $pages->next()) { |