ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Public Member Functions | |
__construct ($address=null, $default_domain=null, $nest_groups=null, $validate=null, $limit=null) | |
Sets up the object. More... | |
parseAddressList ($address=null, $default_domain=null, $nest_groups=null, $validate=null, $limit=null) | |
Starts the whole process. More... | |
validateMailbox (&$mailbox) | |
Function to validate a mailbox, which is: mailbox = addr-spec ; simple address / phrase route-addr ; name and route-addr. More... | |
approximateCount ($data) | |
Returns an approximate count of how many addresses are in the given string. More... | |
isValidInetAddress ($data, $strict=false) | |
This is a email validating function separate to the rest of the class. More... | |
Data Fields | |
$address = '' | |
The address being parsed by the RFC822 object. More... | |
$default_domain = 'localhost' | |
The default domain to use for unqualified addresses. More... | |
$nestGroups = true | |
Should we return a nested array showing groups, or flatten everything? More... | |
$validate = true | |
Whether or not to validate atoms for non-ascii characters. More... | |
$addresses = array() | |
The array of raw addresses built up as we parse. More... | |
$structure = array() | |
The final array of parsed address information that we build up. More... | |
$error = null | |
The current error message, if any. More... | |
$index = null | |
An internal counter/pointer. More... | |
$num_groups = 0 | |
The number of groups that have been found in the address list. More... | |
$mailRFC822 = true | |
A variable so that we can tell whether or not we're inside a Mail_RFC822 object. More... | |
$limit = null | |
A limit after which processing stops. More... | |
Protected Member Functions | |
_splitAddresses ($address) | |
Splits an address into separate addresses. More... | |
_isGroup ($address) | |
Checks for a group at the start of the string. More... | |
_splitCheck ($parts, $char) | |
A common function that will check an exploded string. More... | |
_hasUnclosedQuotes ($string) | |
Checks if a string has unclosed quotes or not. More... | |
_hasUnclosedBrackets ($string, $chars) | |
Checks if a string has an unclosed brackets or not. More... | |
_hasUnclosedBracketsSub ($string, &$num, $char) | |
Sub function that is used only by hasUnclosedBrackets(). More... | |
_validateAddress ($address) | |
Function to begin checking the address. More... | |
_validatePhrase ($phrase) | |
Function to validate a phrase. More... | |
_validateAtom ($atom) | |
Function to validate an atom which from rfc822 is: atom = 1*<any CHAR except specials, SPACE and CTLs> More... | |
_validateQuotedString ($qstring) | |
Function to validate quoted string, which is: quoted-string = <"> *(qtext/quoted-pair) <"> More... | |
_validateRouteAddr ($route_addr) | |
This function validates a route-addr which is: route-addr = "<" [route] addr-spec ">". More... | |
_validateRoute ($route) | |
Function to validate a route, which is: route = 1#("@" domain) ":". More... | |
_validateDomain ($domain) | |
Function to validate a domain, though this is not quite what you expect of a strict internet domain. More... | |
_validateSubdomain ($subdomain) | |
Function to validate a subdomain: subdomain = domain-ref / domain-literal. More... | |
_validateDliteral ($dliteral) | |
Function to validate a domain literal: domain-literal = "[" *(dtext / quoted-pair) "]". More... | |
_validateAddrSpec ($addr_spec) | |
Function to validate an addr-spec. More... | |
_validateLocalPart ($local_part) | |
Function to validate the local part of an address: local-part = word *("." word) More... | |
Definition at line 72 of file RFC822.php.
Mail_RFC822::__construct | ( | $address = null , |
|
$default_domain = null , |
|||
$nest_groups = null , |
|||
$validate = null , |
|||
$limit = null |
|||
) |
Sets up the object.
The address must either be set here or when calling parseAddressList(). One or the other.
string | $address | The address(es) to validate. |
string | $default_domain | Default domain/host etc. If not supplied, will be set to localhost. |
boolean | $nest_groups | Whether to return the structure with groups nested for easier viewing. |
boolean | $validate | Whether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance. |
Definition at line 154 of file RFC822.php.
References $address, $default_domain, $limit, and $validate.
|
protected |
Checks if a string has an unclosed brackets or not.
IMPORTANT: This function handles both angle brackets and square brackets;
string | $string | The string to check. |
string | $chars | The characters to check for. |
Definition at line 417 of file RFC822.php.
References _hasUnclosedBracketsSub().
Referenced by _splitCheck().
|
protected |
Sub function that is used only by hasUnclosedBrackets().
string | $string | The string to check. |
integer | &$num | The number of occurences. |
string | $char | The character to count. |
Definition at line 441 of file RFC822.php.
References $i, and _hasUnclosedQuotes().
Referenced by _hasUnclosedBrackets().
|
protected |
Checks if a string has unclosed quotes or not.
string | $string | The string to check. |
Definition at line 380 of file RFC822.php.
References $i.
Referenced by _hasUnclosedBracketsSub(), and _splitCheck().
|
protected |
Checks for a group at the start of the string.
string | $address | The address to check. |
Definition at line 324 of file RFC822.php.
References $address, and _splitCheck().
Referenced by _splitAddresses().
|
protected |
Splits an address into separate addresses.
string | $address | The addresses to split. |
Definition at line 251 of file RFC822.php.
References $address, _isGroup(), and _splitCheck().
Referenced by parseAddressList().
|
protected |
A common function that will check an exploded string.
array | $parts | The exloded string. |
string | $char | The char that was exploded on. |
Definition at line 348 of file RFC822.php.
References $i, _hasUnclosedBrackets(), and _hasUnclosedQuotes().
Referenced by _isGroup(), _splitAddresses(), _validateAddress(), _validateAddrSpec(), _validateDomain(), _validateLocalPart(), _validatePhrase(), _validateRouteAddr(), and validateMailbox().
|
protected |
Function to begin checking the address.
string | $address | The address to validate. |
Definition at line 462 of file RFC822.php.
References $address, $addresses, $i, $structure, _splitCheck(), _validatePhrase(), and validateMailbox().
Referenced by parseAddressList().
|
protected |
Function to validate an addr-spec.
addr-spec = local-part "@" domain
string | $addr_spec | The string to check. |
Definition at line 867 of file RFC822.php.
References $default_domain, $domain, $validate, _splitCheck(), _validateDomain(), and _validateLocalPart().
Referenced by _validateRouteAddr(), and validateMailbox().
|
protected |
Function to validate an atom which from rfc822 is: atom = 1*<any CHAR except specials, SPACE and CTLs>
If validation ($this->validate) has been turned off, then validateAtom() doesn't actually check anything. This is so that you can split a list of addresses up before encoding personal names (umlauts, etc.), for example.
string | $atom | The string to check. |
Definition at line 589 of file RFC822.php.
Referenced by _validatePhrase(), and _validateSubdomain().
|
protected |
Function to validate a domain literal: domain-literal = "[" *(dtext / quoted-pair) "]".
string | $dliteral | The string to check. |
Definition at line 854 of file RFC822.php.
Referenced by _validateSubdomain().
|
protected |
Function to validate a domain, though this is not quite what you expect of a strict internet domain.
domain = sub-domain *("." sub-domain)
string | $domain | The string to check. |
Definition at line 802 of file RFC822.php.
References $domain, $i, _splitCheck(), and _validateSubdomain().
Referenced by _validateAddrSpec(), and _validateRoute().
|
protected |
Function to validate the local part of an address: local-part = word *("." word)
private
string | $local_part |
Definition at line 916 of file RFC822.php.
References $i, _splitCheck(), and _validatePhrase().
Referenced by _validateAddrSpec().
|
protected |
Function to validate a phrase.
string | $phrase | The phrase to check. |
Definition at line 546 of file RFC822.php.
References $i, _splitCheck(), _validateAtom(), and _validateQuotedString().
Referenced by _validateAddress(), _validateLocalPart(), and validateMailbox().
|
protected |
Function to validate quoted string, which is: quoted-string = <"> *(qtext/quoted-pair) <">
string | $qstring | The string to check |
Definition at line 624 of file RFC822.php.
Referenced by _validatePhrase().
|
protected |
Function to validate a route, which is: route = 1#("@" domain) ":".
string | $route | The string to check. |
Definition at line 778 of file RFC822.php.
References $domain, and _validateDomain().
Referenced by _validateRouteAddr().
|
protected |
This function validates a route-addr which is: route-addr = "<" [route] addr-spec ">".
Angle brackets have already been removed at the point of getting to this function.
string | $route_addr | The string to check. |
Definition at line 729 of file RFC822.php.
References _splitCheck(), _validateAddrSpec(), and _validateRoute().
Referenced by validateMailbox().
|
protected |
Function to validate a subdomain: subdomain = domain-ref / domain-literal.
string | $subdomain | The string to check. |
Definition at line 831 of file RFC822.php.
References _validateAtom(), and _validateDliteral().
Referenced by _validateDomain().
Mail_RFC822::approximateCount | ( | $data | ) |
Returns an approximate count of how many addresses are in the given string.
This is APPROXIMATE as it only splits based on a comma which has no preceding backslash. Could be useful as large amounts of addresses will end up producing large structures when used with parseAddressList().
string | $data | Addresses to count |
Definition at line 965 of file RFC822.php.
References $data.
Mail_RFC822::isValidInetAddress | ( | $data, | |
$strict = false |
|||
) |
This is a email validating function separate to the rest of the class.
It simply validates whether an email is of the common internet form: <user><domain>. This can be sufficient for most people. Optional stricter mode can be utilised which restricts mailbox characters allowed to alphanumeric, full stop, hyphen and underscore.
string | $data | Address to check |
boolean | $strict | Optional stricter mode |
Definition at line 983 of file RFC822.php.
References $data.
Mail_RFC822::parseAddressList | ( | $address = null , |
|
$default_domain = null , |
|||
$nest_groups = null , |
|||
$validate = null , |
|||
$limit = null |
|||
) |
Starts the whole process.
The address must either be set here or when creating the object. One or the other.
string | $address | The address(es) to validate. |
string | $default_domain | Default domain/host etc. |
boolean | $nest_groups | Whether to return the structure with groups nested for easier viewing. |
boolean | $validate | Whether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance. |
Definition at line 184 of file RFC822.php.
References $address, $default_domain, $limit, $structure, $valid, $validate, _splitAddresses(), and _validateAddress().
Mail_RFC822::validateMailbox | ( | & | $mailbox | ) |
Function to validate a mailbox, which is: mailbox = addr-spec ; simple address / phrase route-addr ; name and route-addr.
string | &$mailbox | The string to check. |
Definition at line 641 of file RFC822.php.
References $comment, $name, _splitCheck(), _validateAddrSpec(), _validatePhrase(), and _validateRouteAddr().
Referenced by _validateAddress().
string Mail_RFC822::$address = '' |
The address being parsed by the RFC822 object.
Definition at line 79 of file RFC822.php.
Referenced by __construct(), _isGroup(), _splitAddresses(), _validateAddress(), and parseAddressList().
array Mail_RFC822::$addresses = array() |
The array of raw addresses built up as we parse.
Definition at line 103 of file RFC822.php.
Referenced by _validateAddress().
string Mail_RFC822::$default_domain = 'localhost' |
The default domain to use for unqualified addresses.
Definition at line 85 of file RFC822.php.
Referenced by __construct(), _validateAddrSpec(), and parseAddressList().
string Mail_RFC822::$error = null |
The current error message, if any.
Definition at line 115 of file RFC822.php.
integer Mail_RFC822::$index = null |
An internal counter/pointer.
Definition at line 121 of file RFC822.php.
int Mail_RFC822::$limit = null |
A limit after which processing stops.
Definition at line 141 of file RFC822.php.
Referenced by __construct(), and parseAddressList().
boolean Mail_RFC822::$mailRFC822 = true |
A variable so that we can tell whether or not we're inside a Mail_RFC822 object.
Definition at line 135 of file RFC822.php.
boolean Mail_RFC822::$nestGroups = true |
Should we return a nested array showing groups, or flatten everything?
Definition at line 91 of file RFC822.php.
integer Mail_RFC822::$num_groups = 0 |
The number of groups that have been found in the address list.
public
Definition at line 128 of file RFC822.php.
array Mail_RFC822::$structure = array() |
The final array of parsed address information that we build up.
Definition at line 109 of file RFC822.php.
Referenced by _validateAddress(), and parseAddressList().
boolean Mail_RFC822::$validate = true |
Whether or not to validate atoms for non-ascii characters.
Definition at line 97 of file RFC822.php.
Referenced by __construct(), _validateAddrSpec(), and parseAddressList().