1 --- pagemove/admin.php 2008-02-25 19:02:48.062065053 +0200
2 +++ pagemove/admin.php 2008-02-25 19:01:41.271159305 +0200
4 function _pm_updatelinks(&$text, $links)
6 foreach( $links as $old => $new ) {
7 - $text = preg_replace( '#\[\[' . $old . '((\]\])|[\|\#])#i', '[[' . $new . '\1', $text);
8 + $text = preg_replace( '#\[\[' . $old . '(\]\]|[\|\#])#i', '[[' . $new . '\1', $text);
9 + $text = preg_replace( '#~~REDIRECT>' . $old . '(~~|[\|\#])#i', '~~REDIRECT>' . $new . '\1', $text);
15 //FIXME may be incorrect because of code blocks
16 // CamelCase isn't supported, too
17 - preg_match_all('#\[\[(.+?)\]\]#si',$text,$matches,PREG_SET_ORDER);
19 + if (preg_match_all('#\[\[(.+?)\]\]#s',$text,$m,PREG_SET_ORDER)) {
20 + $matches = array_merge($matches, $m);
22 + if (preg_match_all('#~~REDIRECT>(.+?)~~#s',$text,$m,PREG_SET_ORDER)) {
23 + $matches = array_merge($matches, $m);
26 foreach($matches as $match){
27 //get ID from link and discard most non wikilinks
28 list($mid) = split('[\|#]',$match[1],2);
31 function _pm_search_backlinks(&$data,$base,$file,$type,$lvl,$opts){
32 //we do nothing with directories
33 - if($type == 'd') return true;;
34 + if($type == 'd') return true;
35 //only search txt files
36 - if(!preg_match('#\.txt$#',$file)) return true;;
37 + if(!preg_match('#\.txt$#',$file)) return true;
40 $text = io_readfile($base.'/'.$file);
43 //FIXME may be incorrect because of code blocks
44 // CamelCase isn't supported, too
45 - preg_match_all('#\[\[(.+?)\]\]#si',$text,$matches,PREG_SET_ORDER);
47 + if (preg_match_all('#\[\[(.+?)\]\]#s',$text,$m,PREG_SET_ORDER)) {
48 + $matches = array_merge($matches, $m);
50 + if (preg_match_all('#~~REDIRECT>(.+?)~~#s',$text,$m,PREG_SET_ORDER)) {
51 + $matches = array_merge($matches, $m);
53 foreach($matches as $match){
54 //get ID from link and discard most non wikilinks
55 list($mid) = split('[\|#]',$match[1],2);