public function rewrite_include($match, $pos, $state, $plugin, helper_plugin_move_handler $handler) { $syntax = substr($match, 2, -2); // strip markup $replacers = explode('|', $syntax); $syntax = array_shift($replacers); list($syntax, $flags) = explode('&', $syntax, 2); // break the pattern up into its parts list($mode, $page, $sect) = preg_split('/>|#/u', $syntax, 3); $newpage = $handler->adaptRelativeId($page); if ($newpage == $page) { return $match; } else { $result = '{{' . $mode . '>' . $newpage; if ($sect) { $result .= '#' . $sect; } if ($flags) { $result .= '&' . $flags; } if ($replacers) { $result .= '|' . $replacers; } $result .= '}}'; return $result; } }