本文整理汇总了PHP中EditPage::spamPage方法的典型用法代码示例。如果您正苦于以下问题:PHP EditPage::spamPage方法的具体用法?PHP EditPage::spamPage怎么用?PHP EditPage::spamPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EditPage
的用法示例。
在下文中一共展示了EditPage::spamPage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter
function filter(&$title, $text, $section)
{
global $wgArticle, $wgVersion, $wgOut, $wgParser, $wgUser;
$fname = 'wfSpamBlacklistFilter';
wfProfileIn($fname);
# Call the rest of the hook chain first
if ($this->previousFilter) {
$f = $this->previousFilter;
if ($f($title, $text, $section)) {
wfProfileOut($fname);
return true;
}
}
$this->title = $title;
$this->text = $text;
$this->section = $section;
$regexes = $this->getRegexes();
$whitelists = $this->getWhitelists();
if (is_array($regexes)) {
# Run parser to strip SGML comments and such out of the markup
# This was being used to circumvent the filter (see bug 5185)
$options = new ParserOptions();
$text = $wgParser->preSaveTransform($text, $title, $wgUser, $options);
$out = $wgParser->parse($text, $title, $options);
$links = implode("\n", array_keys($out->getExternalLinks()));
# Strip whitelisted URLs from the match
if (is_array($whitelists)) {
wfDebug("Excluding whitelisted URLs from " . count($whitelists) . " regexes: " . implode(', ', $whitelists) . "\n");
foreach ($whitelists as $regex) {
$links = preg_replace($regex, '', $links);
}
}
# Do the match
wfDebug("Checking text against " . count($regexes) . " regexes: " . implode(', ', $regexes) . "\n");
$retVal = false;
foreach ($regexes as $regex) {
if (preg_match($regex, $links, $matches)) {
wfDebug("Match!\n");
EditPage::spamPage($matches[0]);
$retVal = true;
break;
}
}
} else {
$retVal = false;
}
wfProfileOut($fname);
return $retVal;
}
示例2: filter
function filter(&$title, $text, $section)
{
global $wgArticle, $wgVersion, $wgOut;
$fname = 'wfSpamBlacklistFilter';
wfProfileIn($fname);
# Call the rest of the hook chain first
if ($this->previousFilter) {
$f = $this->previousFilter;
if ($f($title, $text, $section)) {
wfProfileOut($fname);
return true;
}
}
$this->title = $title;
$this->text = $text;
$this->section = $section;
$regex =& $this->getRegex();
if ($regex && $regex[0] == '/') {
# Do the match
wfDebug("Checking text against regex: {$regex}\n");
if (preg_match($regex, $text, $matches)) {
wfDebug("Match!\n");
EditPage::spamPage($matches[0]);
$retVal = true;
} else {
$retVal = false;
}
} else {
$retVal = false;
}
wfProfileOut($fname);
return $retVal;
}