SpamspanInterface.php in SpamSpan filter 8.2
Same filename and directory in other branches
Namespace
Drupal\spamspanFile
src/SpamspanInterface.phpView source
<?php
namespace Drupal\spamspan;
/**
* Spamspan interface.
*/
interface SpamspanInterface {
/**
* Special characters in the local part.
*/
const PATTERN_SPECIAL = '\\-\\.\\~\'\\!\\#$\\%\\&\\+\\/\\*\\=\\?\\^\\_\\`\\{\\|\\}\\+^@';
/**
* Set up a regex constant to split an email into name and domain parts.
*
* The following pattern is not perfect (who is?), but is intended to
* intercept things which look like email addresses. It is not intended to
* determine if an address is valid. It will not intercept addresses with
* quoted local parts.
*/
const PATTERN_MAIN = '([' . self::PATTERN_SPECIAL . '\\w]+)@' . '((?:' . '[-\\w]+\\.' . ')+' . '[A-Z]{2,63})';
const PATTERN_EMAIL_BARE = '!' . self::PATTERN_MAIN . '!ix';
/**
* For cases when spamspan_use_form is checked.
*
* Example: user@example.museum[mycontactform|Contact me using this form].
*/
const PATTERN_EMAIL_WITH_OPTIONS = '!' . self::PATTERN_MAIN . '\\[(.*?)\\]!ix';
/**
* Regex for mailto URLs.
*
* See http://www.faqs.org/rfcs/rfc2368.html.
* This captures the whole mailto URL into the second group,
* the name into the third group and the domain into the fourth.
* Attributes before href go into first group and the ones after into fifth.
* The tag contents go into the sixth.
*/
const PATTERN_MAILTO = '!<a\\s+' . "((?:(?:[\\w|-]+\\s*=\\s*)(?:\\w+|\"[^\"]*\"|'[^']*')\\s*)*?)" . "href\\s*=\\s*(['\"])\\s*(mailto:" . self::PATTERN_MAIN . "(?:\\?[A-Za-z0-9_= %\\.\\-\\~\\_\\&;\\!\\*\\(\\)\\'#&]*)?\\s*)" . '\\2' . "((?:(?:\\s+[\\w|-]+\\s*=\\s*)(?:\\w+|\"[^\"]*\"|'[^']*'))*?)" . '>' . '(.*?)' . '</a>!ixs';
/**
* Obfuscation based on PATTERN_EMAIL_BARE.
*
* @param string $text
* Text obfuscate.
* @param bool $altered
* Sets this to true if any obfuscation occurred.
*
* @return string
* The obfuscated text.
*/
public function replaceBareEmailAddresses($text, &$altered = NULL);
/**
* Obfuscation based on PATTERN_EMAIL_WITH_OPTIONS.
*
* @param string $text
* Text obfuscate.
* @param bool $altered
* Sets this to true if any obfuscation occurred.
*
* @return string
* The obfuscated text.
*/
public function replaceEmailAddressesWithOptions($text, &$altered = NULL);
/**
* Obfuscation based on PATTERN_MAILTO.
*
* @param string $text
* Text obfuscate.
* @param bool $altered
* Sets this to true if any obfuscation occurred.
*
* @return string
* The obfuscated text.
*/
public function replaceMailtoLinks($text, &$altered = NULL);
}
Interfaces
Name![]() |
Description |
---|---|
SpamspanInterface | Spamspan interface. |