From: Carsten K. <car...@us...> - 2002-01-30 22:45:36
|
Update of /cvsroot/phpwiki/phpwiki/lib/plugin In directory usw-pr-cvs1:/tmp/cvs-serv15599 Modified Files: RandomPage.php Log Message: added exclude pages and include_self args Index: RandomPage.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/RandomPage.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** RandomPage.php 2002/01/29 20:08:29 1.3 --- RandomPage.php 2002/01/30 22:45:33 1.4 *************** *** 18,24 **** function getDefaultArguments() { ! return array('pages' => 1, ! 'showname' => false, ! 'info' => ''); } --- 18,27 ---- function getDefaultArguments() { ! return array('pages' => 1, ! 'showname' => false, ! 'pagename' => '[pagename]', // hackish ! 'exclude' => '', ! 'include_self' => 0, // hackish ! 'info' => ''); } *************** *** 44,56 **** $pages = 20; $PageList = new PageList(); ! if ($info) ! foreach (explode(",", $info) as $col) ! $PageList->insertColumn($col); while ($PageList->getTotal() < $pages) { $PageList->addPage($pagearray[array_rand($pagearray)]); } } - return $PageList->getContent(); } }; --- 47,71 ---- $pages = 20; $PageList = new PageList(); ! $this->_init($pagename, &$PageList, $info, $exclude, $include_self); ! while ($PageList->getTotal() < $pages) { $PageList->addPage($pagearray[array_rand($pagearray)]); } + return $PageList->getContent(); } } + + function _init(&$page, &$pagelist, $info = '', $exclude = '', $include_self = '') { + if ($info) + foreach (explode(",", $info) as $col) + $pagelist->insertColumn($col); + + if ($exclude) + foreach (explode(",", $exclude) as $excludepage) + $pagelist->excludePageName($excludepage); + if (!$include_self) + $pagelist->excludePageName($page); + } + }; |