ILIAS
release_5-2 Revision v5.2.25-18-g3f80b828510
|
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... | |
_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... | |
validateMailbox (&$mailbox) | |
Function to validate a mailbox, which is: mailbox = addr-spec ; simple address / phrase route-addr ; name and route-addr. 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... | |
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... | |
Definition at line 70 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.
public
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 153 of file RFC822.php.
References $address, $default_domain, $limit, and $validate.
Mail_RFC822::_hasUnclosedBrackets | ( | $string, | |
$chars | |||
) |
Checks if a string has an unclosed brackets or not.
IMPORTANT: This function handles both angle brackets and square brackets;
private
string | $string | The string to check. |
string | $chars | The characters to check for. |
Definition at line 405 of file RFC822.php.
References _hasUnclosedBracketsSub().
Referenced by _splitCheck().
Mail_RFC822::_hasUnclosedBracketsSub | ( | $string, | |
& | $num, | ||
$char | |||
) |
Sub function that is used only by hasUnclosedBrackets().
private
string | $string | The string to check. |
integer | &$num | The number of occurences. |
string | $char | The character to count. |
Definition at line 430 of file RFC822.php.
References _hasUnclosedQuotes().
Referenced by _hasUnclosedBrackets().
Mail_RFC822::_hasUnclosedQuotes | ( | $string | ) |
Checks if a string has unclosed quotes or not.
private
string | $string | The string to check. |
Definition at line 368 of file RFC822.php.
Referenced by _hasUnclosedBracketsSub(), and _splitCheck().
Mail_RFC822::_isGroup | ( | $address | ) |
Checks for a group at the start of the string.
private
string | $address | The address to check. |
Definition at line 310 of file RFC822.php.
References _splitCheck().
Referenced by _splitAddresses().
Mail_RFC822::_splitAddresses | ( | $address | ) |
Splits an address into separate addresses.
private
string | $address | The addresses to split. |
Definition at line 234 of file RFC822.php.
References $address, _isGroup(), _splitCheck(), and array.
Referenced by parseAddressList().
Mail_RFC822::_splitCheck | ( | $parts, | |
$char | |||
) |
A common function that will check an exploded string.
private
array | $parts | The exloded string. |
string | $char | The char that was exploded on. |
Definition at line 335 of file RFC822.php.
References _hasUnclosedBrackets(), and _hasUnclosedQuotes().
Referenced by _isGroup(), _splitAddresses(), _validateAddress(), _validateAddrSpec(), _validateDomain(), _validateLocalPart(), _validatePhrase(), _validateRouteAddr(), and validateMailbox().
Mail_RFC822::_validateAddress | ( | $address | ) |
Function to begin checking the address.
private
string | $address | The address to validate. |
Definition at line 450 of file RFC822.php.
References $addresses, $structure, _splitCheck(), _validatePhrase(), array, and validateMailbox().
Referenced by parseAddressList().
Mail_RFC822::_validateAddrSpec | ( | $addr_spec | ) |
Function to validate an addr-spec.
addr-spec = local-part "@" domain
private
string | $addr_spec | The string to check. |
Definition at line 862 of file RFC822.php.
References $default_domain, $validate, _splitCheck(), _validateDomain(), _validateLocalPart(), and array.
Referenced by _validateRouteAddr(), and validateMailbox().
Mail_RFC822::_validateAtom | ( | $atom | ) |
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.
private
string | $atom | The string to check. |
Definition at line 584 of file RFC822.php.
Referenced by _validatePhrase(), and _validateSubdomain().
Mail_RFC822::_validateDliteral | ( | $dliteral | ) |
Function to validate a domain literal: domain-literal = "[" *(dtext / quoted-pair) "]".
private
string | $dliteral | The string to check. |
Definition at line 848 of file RFC822.php.
Referenced by _validateSubdomain().
Mail_RFC822::_validateDomain | ( | $domain | ) |
Function to validate a domain, though this is not quite what you expect of a strict internet domain.
domain = sub-domain *("." sub-domain)
private
string | $domain | The string to check. |
Definition at line 800 of file RFC822.php.
References _splitCheck(), and _validateSubdomain().
Referenced by _validateAddrSpec(), and _validateRoute().
Mail_RFC822::_validateLocalPart | ( | $local_part | ) |
Function to validate the local part of an address: local-part = word *("." word)
private
string | $local_part |
Definition at line 907 of file RFC822.php.
References _splitCheck(), _validatePhrase(), and array.
Referenced by _validateAddrSpec().
Mail_RFC822::_validatePhrase | ( | $phrase | ) |
Function to validate a phrase.
private
string | $phrase | The phrase to check. |
Definition at line 543 of file RFC822.php.
References _splitCheck(), _validateAtom(), _validateQuotedString(), and array.
Referenced by _validateAddress(), _validateLocalPart(), and validateMailbox().
Mail_RFC822::_validateQuotedString | ( | $qstring | ) |
Function to validate quoted string, which is: quoted-string = <"> *(qtext/quoted-pair) <">
private
string | $qstring | The string to check |
Definition at line 620 of file RFC822.php.
Referenced by _validatePhrase().
Mail_RFC822::_validateRoute | ( | $route | ) |
Function to validate a route, which is: route = 1#("@" domain) ":".
private
string | $route | The string to check. |
Definition at line 777 of file RFC822.php.
References _validateDomain().
Referenced by _validateRouteAddr().
Mail_RFC822::_validateRouteAddr | ( | $route_addr | ) |
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.
private
string | $route_addr | The string to check. |
Definition at line 727 of file RFC822.php.
References _splitCheck(), _validateAddrSpec(), and _validateRoute().
Referenced by validateMailbox().
Mail_RFC822::_validateSubdomain | ( | $subdomain | ) |
Function to validate a subdomain: subdomain = domain-ref / domain-literal.
private
string | $subdomain | The string to check. |
Definition at line 828 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 949 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 967 of file RFC822.php.
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.
public
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 174 of file RFC822.php.
References $address, $default_domain, $limit, $structure, $valid, $validate, _splitAddresses(), _validateAddress(), and array.
Mail_RFC822::validateMailbox | ( | & | $mailbox | ) |
Function to validate a mailbox, which is: mailbox = addr-spec ; simple address / phrase route-addr ; name and route-addr.
public
string | &$mailbox | The string to check. |
Definition at line 638 of file RFC822.php.
References $comment, _splitCheck(), _validateAddrSpec(), _validatePhrase(), _validateRouteAddr(), and array.
Referenced by _validateAddress().
string Mail_RFC822::$address = '' |
The address being parsed by the RFC822 object.
Definition at line 76 of file RFC822.php.
Referenced by __construct(), _splitAddresses(), and parseAddressList().
The array of raw addresses built up as we parse.
Definition at line 100 of file RFC822.php.
Referenced by _validateAddress().
string Mail_RFC822::$default_domain = 'localhost' |
The default domain to use for unqualified addresses.
Definition at line 82 of file RFC822.php.
Referenced by __construct(), _validateAddrSpec(), and parseAddressList().
string Mail_RFC822::$error = null |
The current error message, if any.
Definition at line 112 of file RFC822.php.
integer Mail_RFC822::$index = null |
An internal counter/pointer.
Definition at line 118 of file RFC822.php.
int Mail_RFC822::$limit = null |
A limit after which processing stops.
Definition at line 138 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 132 of file RFC822.php.
boolean Mail_RFC822::$nestGroups = true |
Should we return a nested array showing groups, or flatten everything?
Definition at line 88 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 125 of file RFC822.php.
The final array of parsed address information that we build up.
Definition at line 106 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 94 of file RFC822.php.
Referenced by __construct(), _validateAddrSpec(), and parseAddressList().