I took this one-page PHP script from a forum with no attribution. I altered the parsing of wiki words so that it would convert more urls into working links.<br /><br />First character is space, this is monospaced.<br />four dashes give you a horizontal rule.<br />first char is dash, then space, the line is a bulleted list.<br />wiki page links are marked with a tilde as the first character. Just make sure you only use characters in the link that are legal for filenames.
<verbatim> <?php function p($c)
- {
$r=preg_replace(array(~ +([\n]+)~m,'~^-\s+(.*)$~m',{4,}\r?\n~,'~(http(?:s)?)://([\S]+)~i','~\n~'),array('<code>$1</code>','</pre> <ul> <li>$1','
--- ','$1://$2][$2','<br />'),$c); preg_match_all('/~\w+/',$r,$x); foreach(array_unique($x[0])as$m){$r=str_replace($m,x($m)? ?$m][$m: $m?e=$m][?,$r); } return$r; } function f($f) { @mkdir('wik'); return @file_get_contents(wik/$f.w); } function b($b) { echo ---+ ?$b][Backlinks $b. <div id='c'>; foreach(glob('wik/*.w')as$f){$f=substr($f,4,-2); if(strpos(f($f),$b)!==false)echo?$f][$f<br />; } echo</div> ; } function x($f) { return file_exists(wik/$f.w); } function e($p) { $p=$p?$p:$_GET['e']; echo ---+ Edit. $p <form action='?$p' method='post'><textarea cols='50' name='c' rows='10'>.f($p).</textarea><br /><input type='submit' value='Save'></input>; } $p=preg_replace('~(e|b)=(.*)~',,$_SERVER[QUERY_STRING]); $c=$_POST[c]; $e=$_GET[e]; $b=$_GET[b]; if(!$p&&!$e)$p='~<a href='https://xenos.quix.us/explorers/jasonnemrow/private/mainpage' rel='nofollow' title='explorers:jasonnemrow:private:mainpage'>MainPage</a>'; if($c){@file_put_contents(wik/$p.w,htmlspecialchars($c)); header(Location: ?$p); } echoWW; if(!$e) { if(!$b) { echo x($p)? ---+ ?b=$p][$p <div id='c'>.p(f($p)).</div> --- ?e=$p][.Edit | <small>Modified: .date('d.m.Y @ H:i:s', @filemtime(wik/$p.w)):e($p); } else b($b); } else e($e);</small></form></li> </ul> </verbatim>