From: Carsten K. <car...@us...> - 2002-01-31 01:34:05
|
Update of /cvsroot/phpwiki/phpwiki/lib/plugin In directory usw-pr-cvs1:/tmp/cvs-serv20024 Modified Files: RandomPage.php Log Message: Added some default excluded pagenames. Restored showname arg as hidename :-). Index: RandomPage.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/RandomPage.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** RandomPage.php 2002/01/31 01:14:14 1.6 --- RandomPage.php 2002/01/31 01:34:02 1.7 *************** *** 20,24 **** return array('pages' => 1, 'redirect' => false, ! 'exclude' => '', 'info' => ''); } --- 20,25 ---- return array('pages' => 1, 'redirect' => false, ! 'hidename' => false, // only for pages=1 ! 'exclude' => $this->default_exclude(), 'info' => ''); } *************** *** 38,44 **** better_srand(); // Start with a good seed. ! if ($pages == 1 && $redirect && $pagearray) { $page = $pagearray[array_rand($pagearray)]; ! $request->redirect(WikiURL($page, false, 'absurl')); } --- 39,50 ---- better_srand(); // Start with a good seed. ! if ($pages == 1 && $pagearray) { $page = $pagearray[array_rand($pagearray)]; ! if ($redirect) ! $request->redirect(WikiURL($page, false, 'absurl')); // noreturn ! if ($hidename) ! return WikiLink($page, false, _("RandomPage")); ! else ! return WikiLink($page); } *************** *** 49,52 **** --- 55,67 ---- $pagelist->addPage($pagearray[$i]); return $pagelist; + } + + function default_exclude() { + // Some useful default pages to exclude. + $default_exclude = 'RandomPage,HomePage,AllPages,RecentChanges,RecentEdits,FullRecentChanges'; + foreach (explode(",", $default_exclude) as $e) { + $_exclude[] = gettext($e); + } + return implode(",", $_exclude); } }; |