This file is part of phpCF. phpCF is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. phpCF is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with phpCF; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *****************************************************************************/ /** * NAMING CONVENTIONS: * Content check functions are prefixed with "c_" * Email check functions are prefixed with "ec_" * Failing to obey these simple naming conventions, will result * in the check never being run. */ require_once 'class.CFBase.php'; class CF extends CFBase { // Scanning methods function c_num_urls($text) { global $NUM_URLS; // The hardcore regex for url matching: preg_match_all("/((f|ht)tps?\:\/\/)([a-z0-9@:%_.~#\-\?&-]+)((\=|[a-z0-9]|\?|&|%|\/|\.|-|:|æ|ø|å)+){0,}/msi", $text, $matches); // And the light, but efficient: // preg_match_all("/(ht|f)tp(s?)\:\/\//msi", $text, $matches); $urls = count($matches[0]); $this->log[] = "num_urls: $urls URL(s) found"; return ($NUM_URLS * $urls); } function c_poker_ref($text) { global $POKER_REF; preg_match_all("/\b(poker|texas(\s|-)hold(\s?)em|blackjack|gambling)\b/msi", $text, $matches); $ref = count($matches[0]); $this->log[] = "poker_ref: $ref poker reference(s) found."; return ($POKER_REF * $ref); } function c_html_percentage($text) { global $HTML_PERCENTAGE; $percent = round(((strlen($text)-strlen(strip_tags($text))) / strlen($text)) * 100); $this->log[] = "html_percentage: $percent"; return ($HTML_PERCENTAGE * $percent); } // Email checking methods: function ec_alpha_num($email) { global $ALPHA_NUM; if (preg_match("/^[a-z\_\-]+[0-9]+@/i", $email)) { $this->log[] = "alpha_num: Email username ending in numeric characters."; return $ALPHA_NUM; } else { return 0; } } } ?>