當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EditPage::spamPage方法代碼示例

本文整理匯總了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;
 }
開發者ID:k-hasan-19,項目名稱:wiki,代碼行數:49,代碼來源:SpamBlacklist_body.php

示例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;
 }
開發者ID:BackupTheBerlios,項目名稱:spamfilter-svn,代碼行數:33,代碼來源:SpamBlacklistAlt_body.php


注:本文中的EditPage::spamPage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。