getBlacklists(); $whitelists = $this->getWhitelists(); // The email to check $email = $user->getEmail(); if ( !count( $blacklists ) ) { // Nothing to check return true; } // Check for whitelisted email addresses if ( is_array( $whitelists ) ) { wfDebugLog( 'SpamBlacklist', "Excluding whitelisted email addresses from " . count( $whitelists ) . " regexes: " . implode( ', ', $whitelists ) . "\n" ); foreach ( $whitelists as $regex ) { AtEase::suppressWarnings(); $match = preg_match( $regex, $email ); AtEase::restoreWarnings(); if ( $match ) { // Whitelisted email return true; } } } # Do the match wfDebugLog( 'SpamBlacklist', "Checking e-mail address against " . count( $blacklists ) . " regexes: " . implode( ', ', $blacklists ) . "\n" ); foreach ( $blacklists as $regex ) { AtEase::suppressWarnings(); $match = preg_match( $regex, $email ); AtEase::restoreWarnings(); if ( $match ) { return false; } } return true; } }