<?php
function escapeWikiText( $text ) {
$text = str_replace(
array( '[', '|', '\'', 'ISBN ', 'RFC ', '://', "\n=", '{{' ),
array( '[', '|', ''', 'ISBN ', 'RFC ', '://', "\n=", '{{' ),
htmlspecialchars($text) );
return $text;
}
function recodeWikiText( $text ) {
$text= str_replace('://','://',$text); #break urls - avoid triggering captcha protection
$text= str_replace('</nowiki>','</nowiki>',$text);
return escapeWikiText( $text );
}
$f = "php://stdin";
if (sizeof($argv)>1) $f = $argv[1];
$text = file_get_contents($f);
if ($text===false) die("failed to read $f!\n");
$text = preg_replace('!<nowiki>(.*?)</nowiki>!sie', 'recodeWikiText("\1")', $text);
print $text;
?>stripNowiki.php
application/x-php, 771 bytes (load raw)

