setupLocale(); if (!isset($auth)) { $this->disabled = $this->lang['noauth']; } else if (!$auth->canDo('getUsers')) { $this->disabled = $this->lang['nosupport']; } else { // we're good to go $this->_auth = & $auth; } } /** * return some info */ function getInfo() { return confToHash(dirname(__FILE__).'/plugin.info.txt'); } /** * return sort order for position in admin menu */ function getMenuSort() { return 999; } /** * handle user request */ function handle() { if (isset($_REQUEST['delete'])) { $old=DOKU_PLUGIN.'autolink/data/links.php'; @unlink($old); global $ID; header("Location: ".wl($ID,array('do'=>'admin','page'=>'autolink2'),true,'&')); exit(); } } /** * output appropriate html */ function html() { global $conf; global $ID; if(is_null($this->_auth)) { print $this->lang['badauth']; return false; } require_once (DOKU_INC.'inc/search.php'); $sopts=array(); $sopts['query']="autolink"; search($replace, $conf['datadir'], array($this, 'search'), $sopts); if (!isset($replace)) { if (@file_exists(DOKU_PLUGIN.'autolink/data/links.php')) { $oldplugin=DOKU_PLUGIN.'autolink/syntax/add.php'; if (@file_exists($oldplugin)) { ptln($this->lang["removeold"]); } else { ptln($this->lang["noneed"]); } } else { ptln($this->lang["noautolinks"]); ptln('
'); ptln(''); ptln(''); ptln("

".$this->lang['deleteold']."
"); ptln("lang['delete']."\" />

"); ptln("
"); } } else { ptln(""); ptln(" "); ptln(" "); ptln(" "); foreach ($replace as $value){ $page=substr($value,3,-2); $lnk="[[:" . $value['id'] . "|" . $value['id'] . "]]"; ptln(""); } ptln("
".$this->lang["autolink2_oldpages"]."
"); $x=p_render('xhtml',p_get_instructions($lnk),$info); $x=substr($x,4,-5); ptln($x); ptln("
"); } } function search(&$data,$base,$file,$type,$lvl,$opts){ if(!preg_match('#\.txt$#',$file)) return true;; require_once (DOKU_INC.'inc/search.php'); $words[]=$opts['query']; $reg="autolink "; return search_regex(&$data,$base,$file,$reg,$words); } }