ILIAS
Release_4_1_x_branch Revision 61804
|
Public Member Functions | |
Mail_RFC822 ($address=null, $default_domain=null, $nest_groups=null, $validate=null, $limit=null) | |
Sets up the object. | |
parseAddressList ($address=null, $default_domain=null, $nest_groups=null, $validate=null, $limit=null) | |
Starts the whole process. | |
_splitAddresses ($address) | |
Splits an address into separate addresses. | |
_isGroup ($address) | |
Checks for a group at the start of the string. | |
_splitCheck ($parts, $char) | |
A common function that will check an exploded string. | |
_hasUnclosedQuotes ($string) | |
Checks if a string has unclosed quotes or not. | |
_hasUnclosedBrackets ($string, $chars) | |
Checks if a string has an unclosed brackets or not. | |
_hasUnclosedBracketsSub ($string, &$num, $char) | |
Sub function that is used only by hasUnclosedBrackets(). | |
_validateAddress ($address) | |
Function to begin checking the address. | |
_validatePhrase ($phrase) | |
Function to validate a phrase. | |
_validateAtom ($atom) | |
Function to validate an atom which from rfc822 is: atom = 1*<any CHAR except specials, SPACE and CTLs> | |
_validateQuotedString ($qstring) | |
Function to validate quoted string, which is: quoted-string = <"> *(qtext/quoted-pair) <"> | |
validateMailbox (&$mailbox) | |
Function to validate a mailbox, which is: mailbox = addr-spec ; simple address / phrase route-addr ; name and route-addr. | |
_validateRouteAddr ($route_addr) | |
This function validates a route-addr which is: route-addr = "<" [route] addr-spec ">". | |
_validateRoute ($route) | |
Function to validate a route, which is: route = 1#("@" domain) ":". | |
_validateDomain ($domain) | |
Function to validate a domain, though this is not quite what you expect of a strict internet domain. | |
_validateSubdomain ($subdomain) | |
Function to validate a subdomain: subdomain = domain-ref / domain-literal. | |
_validateDliteral ($dliteral) | |
Function to validate a domain literal: domain-literal = "[" *(dtext / quoted-pair) "]". | |
_validateAddrSpec ($addr_spec) | |
Function to validate an addr-spec. | |
_validateLocalPart ($local_part) | |
Function to validate the local part of an address: local-part = word *("." word) | |
approximateCount ($data) | |
Returns an approximate count of how many addresses are in the given string. | |
isValidInetAddress ($data, $strict=false) | |
This is a email validating function separate to the rest of the class. |
Data Fields | |
$address = '' | |
The address being parsed by the RFC822 object. | |
$default_domain = 'localhost' | |
The default domain to use for unqualified addresses. | |
$nestGroups = true | |
Should we return a nested array showing groups, or flatten everything? | |
$validate = true | |
Whether or not to validate atoms for non-ascii characters. | |
$addresses = array() | |
The array of raw addresses built up as we parse. | |
$structure = array() | |
The final array of parsed address information that we build up. | |
$error = null | |
The current error message, if any. | |
$index = null | |
An internal counter/pointer. | |
$num_groups = 0 | |
The number of groups that have been found in the address list. | |
$mailRFC822 = true | |
A variable so that we can tell whether or not we're inside a Mail_RFC822 object. | |
$limit = null | |
A limit after which processing stops. |
Definition at line 70 of file RFC822.php.
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 400 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 425 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 363 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 305 of file RFC822.php.
References $address, and _splitCheck().
Referenced by _splitAddresses().
Mail_RFC822::_splitAddresses | ( | $address | ) |
Splits an address into separate addresses.
private
string | $address | The addresses to split. |
Definition at line 229 of file RFC822.php.
References $address, _isGroup(), and _splitCheck().
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 330 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 445 of file RFC822.php.
References $address, $addresses, $structure, _splitCheck(), _validatePhrase(), 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 854 of file RFC822.php.
References $default_domain, _splitCheck(), _validateDomain(), and _validateLocalPart().
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 579 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 840 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 792 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 885 of file RFC822.php.
References _splitCheck(), and _validatePhrase().
Referenced by _validateAddrSpec().
Mail_RFC822::_validatePhrase | ( | $phrase | ) |
Function to validate a phrase.
private
string | $phrase | The phrase to check. |
Definition at line 538 of file RFC822.php.
References _splitCheck(), _validateAtom(), and _validateQuotedString().
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 612 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 769 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 719 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 820 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 923 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 941 of file RFC822.php.
References $data.
Mail_RFC822::Mail_RFC822 | ( | $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 152 of file RFC822.php.
References $address, $default_domain, $limit, and $validate.
Referenced by parseAddressList().
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 173 of file RFC822.php.
References $address, $default_domain, $limit, $structure, $valid, $validate, _splitAddresses(), _validateAddress(), Mail_RFC822(), and PEAR\raiseError().
Referenced by Mail\parseRecipients().
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 630 of file RFC822.php.
References $comment, _splitCheck(), _validateAddrSpec(), _validatePhrase(), and _validateRouteAddr().
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 _isGroup(), _splitAddresses(), _validateAddress(), Mail_RFC822(), and parseAddressList().
array Mail_RFC822::$addresses = array() |
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 _validateAddrSpec(), Mail_RFC822(), 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 Mail_RFC822(), 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.
array Mail_RFC822::$structure = array() |
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 Mail_RFC822(), and parseAddressList().