Beispiel #1
0
    if ($build !== false) {
        $regexes[] = $regexStart . str_replace('/', '\\/', preg_replace('|\\\\*/|', '/', $build)) . $regexEnd;
    }
    return $regexes;
}
if (!empty($wikia)) {
    echo "Checking {$wikia}  ...\n";
    $oTitle = Title::makeTitle(NS_MEDIAWIKI, $title);
    if (is_object($oTitle)) {
        $oArticle = new Article($oTitle);
        $content = $oArticle->getContent();
        if (is_object($oArticle) && !empty($content)) {
            echo "content = " . $oArticle->getContent() . " \n";
            $lines = explode("\n", $content);
            $lines = stripLines($lines);
            $regexes = buildRegexes($lines);
            echo "Found " . count($regexes) . " regexes \n";
            $loop = 0;
            foreach ($regexes as $id => $regex) {
                $m = array();
                if (preg_match($regex, strtolower($oTitle->getText()), $m)) {
                    echo "wikia: " . $wgDBName . " - ok ( {$loop} )\n";
                }
                $loop++;
            }
        } else {
            echo "No text found \n";
        }
    } else {
        echo "Page not found \n";
    }
function buildSafeRegexes($lines)
{
    $lines = stripLines($lines);
    $regexes = buildRegexes($lines);
    if (validateRegexes($regexes)) {
        return $regexes;
    } else {
        // _Something_ broke... rebuild line-by-line; it'll be
        // slower if there's a lot of blacklist lines, but one
        // broken line won't take out hundreds of its brothers.
        return buildRegexes($lines, 0);
    }
}