1 --- dokuwiki-plugin-pagemove-20110811/admin.php~ 2012-06-12 23:38:07.000000000 +0300
2 +++ dokuwiki-plugin-pagemove-20110811/admin.php 2012-06-12 23:47:42.513225196 +0300
5 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 // TODO 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 // ignore local headings [[#some_heading]]
28 if ( preg_match('/^#/', $match[1])) continue;
31 // FIXME may be incorrect because of code blocks
32 // TODO CamelCase isn't supported, too
33 - preg_match_all('#{{(.[^>]+?)}}#si', $text, $matches, PREG_SET_ORDER);
35 + if (preg_match_all('#{{(.[^>]+?)}}#si', $text, $m, PREG_SET_ORDER)) {
36 + $matches = array_merge($matches, $m);
38 + if (preg_match_all('#~~REDIRECT>(.+?)~~#s', $text, $m, PREG_SET_ORDER)) {
39 + $matches = array_merge($matches, $m);
41 foreach($matches as $match) {
42 // get ID from link and discard most non wikilinks
43 list($mid) = split('(\?|\|)', $match[1], 2);
46 // FIXME may be incorrect because of code blocks
47 // FIXME CamelCase isn't supported, too
48 - preg_match_all('#\[\[(.+?)\]\]#si', $text, $matches, PREG_SET_ORDER);
50 + if (preg_match_all('#\[\[(.+?)\]\]#s', $text, $m, PREG_SET_ORDER)) {
51 + $matches = array_merge($matches, $m);
53 + if (preg_match_all('#~~REDIRECT>(.+?)~~#s', $text, $m, PREG_SET_ORDER)) {
54 + $matches = array_merge($matches, $m);
56 foreach($matches as $match) {
57 // get ID from link and discard most non wikilinks
58 list($matchLink) = split('[\|#]', $match[1], 2);