찾기
내용으로 건너뛰기
추적
문서의 이전 판을 선택했습니다!
저장하면 이 자료로 새 판을 만듭니다.
미디어 파일
======랜덤페이지 (Randompage) 플러긴====== 랜덤페이지 플러긴이다. 네임스페이스 지원하도록 약간 수정했다. (원작: https://www.dokuwiki.org/plugin:random_page ) 다른 위키엔진들은 대부분 기본 기능인데;; 아래의 파일을 받아서 ''lib/plugins/randompage'' 안에 ''action.php''라는 이름으로 넣으면 된다. ?do=randompage 혹은 ?do=nsrandompage 하면 된다. * [[?do=randompage|?do=randompage]] 이것은 전체 위키페이지 중 무작위로 가고, * [[?do=nsrandompage|?do=nsrandompage]] 이것은 현재 이름공간의 페이지 중에서 골라 간다. This supports namespaces. <file php action.php> <?php /** * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Pete Prodoehl <pete@2xlnetworks.com> and Jean Marc Massou <massou@gmail.com> */ require_once(DOKU_PLUGIN.'action.php'); class action_plugin_randompage extends Dokuwiki_Action_Plugin { /** * Register its handlers with the dokuwiki's event controller */ function register(&$controller) { $controller->register_hook('ACTION_HEADERS_SEND', 'BEFORE', $this, 'init', 'header'); } function init(&$event, $args) { // Catch the good request if ($_REQUEST['do'] == 'randompage'|| $_REQUEST['do'] == 'nsrandompage' ) { // On efface les headers par defaut if ($args == 'header') { $this->action_randompage($event, $args); } } } function action_randompage(&$event, $args) { global $conf; global $ID; global $INFO; $data = array(); $dir = $conf['savedir']; $data = file ($dir.'/index/page.idx'); //if current page is in function isCurNS($value){ global $INFO; return stripos($value, $INFO['namespace'])===0 ? true : false; } if ($INFO['namespace']!=null && $_REQUEST['do'] == 'nsrandompage' ) { $data=array_filter($data,"isCurNS" ); } //We loops through ten random page... $i = 1; while ($i <= 10 & $i <> "ok"): //echo $i; $i++; $id = rtrim($data[array_rand($data)]); $testACL = auth_aclcheck($id,$_SERVER['REMOTE_USER'],$USERINFO['grps']); if (($testACL > 1) and (file_exists(wikiFN($id)))){ $i="ok"; //echo $id; } endwhile; if ($testACL < 1){ $id = $ID; } header("Location: ".wl(trim($id),'',true)); //echo wl($page,'',true); exit(); } //Function from Php manual to get a random number in a Array function array_rand($array, $lim=1) { mt_srand((double) microtime() * 1000000); for($a=0; $a<=$lim; $a++) { $num[] = mt_srand(0, count($array)-1); } return @$num; } }</file> ^ 누구나 수정하실 수 있다. [[http://vaslor.net/syntax|위키 사용법]] 참고하라. ^ {{tag>randompage 도쿠위키 플러긴 dokuwiki plugin}}
2+1?
이 필드는 비어 있도록 유지하세요:
저장
미리 보기
취소
편집 요약
참고: 이 문서를 편집하면 내용은 다음 라이선스에 따라 배포하는 데 동의하는 것으로 간주합니다:
CC Attribution-Noncommercial-Share Alike 4.0 International
연결문서
랜덤페이지 (Randompage) 플러긴
문서 도구
문서 보기
이전 판
연결문서
맨 위로
다크 모드로 보기
☀️
Toggle Menu
기술
너두 고쳐두 됩니다.
사이트 도구
최근 바뀜
미디어 관리자
사이트맵
사용자 도구
등록
로긴
최근 수정된 문서
misuse_topical5
노박
unique_items
dinner_bell
deputy_beagle
ratslayer
one_for_my_baby
alerio
power_fist
제거됨
fixer
climb_ev_ry_mountain
companion
[장비 분실]
crashed_vertibird
brotherhood_t-51b_power_armor
marco
i_forgot_to_remember_to_forget
cateye