User:SQLBot/bbsc.php
Appearance
<?php
include("SxWiki.php");
$url = 'http://en.wikisource.org/w/';
$sxLgTA = sxLogin("SQLBot", "<redacted>");
$sxLgID = $sxLgTA[uid];
$sxLgT = $sxLgTA[token];
$maxlag = "5"; //Set maxlag to 5
$epm = setEPM(10); //set 10 edits per min.
function fix_bbsc($artname) {
$find_big = '/\'\'\'\<big\>([A-Z])\<\/big\>([A-Z]+)\'\'\'/';
$atext = sxGetPage($artname);
preg_match($find_big, $atext, $matches);
$replace = '{{bbsc|' . strtoupper($matches[1]) . strtolower($matches[2]) . '}}';
$output = preg_replace($find_big, $replace, $atext);
sxPutPage($artname, "Replacing big tags with bbsc (TEST)", $output, $null);
#print_r($output);
echo ".";
}
$list=sxGetPage("User:SQL/BBSCTest");
preg_match_all('/# \[\[(.*)\]\]/', $list, $matches2);
#print_r($matches2);
$tofix = $matches2[1];
#print_r($tofix);
foreach ($tofix as $fix) {
fix_bbsc($fix);
}
?>