Logo Search packages:      
Sourcecode: d-push version File versions  Download package

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

Parameters:
string$addressThe address(es) to validate.
string$default_domainDefault domain/host etc.
boolean$nest_groupsWhether to return the structure with groups nested for easier viewing.
boolean$validateWhether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance.
Returns:
array A structured array of addresses.

Definition at line 162 of file z_RFC822.php.

References $address, $default_domain, $limit, $validate, _splitAddresses(), _validateAddress(), Mail_RFC822(), and raiseError().

    {
        if (!isset($this) || !isset($this->mailRFC822)) {
            $obj = new Mail_RFC822($address, $default_domain, $nest_groups, $validate, $limit);
            return $obj->parseAddressList();
        }

        if (isset($address))        $this->address        = $address;
        if (isset($default_domain)) $this->default_domain = $default_domain;
        if (isset($nest_groups))    $this->nestGroups     = $nest_groups;
        if (isset($validate))       $this->validate       = $validate;
        if (isset($limit))          $this->limit          = $limit;

        $this->structure  = array();
        $this->addresses  = array();
        $this->error      = null;
        $this->index      = null;

        // Unfold any long lines in $this->address.
        $this->address = preg_replace('/\r?\n/', "\r\n", $this->address);
        $this->address = preg_replace('/\r\n(\t| )+/', ' ', $this->address);

        while ($this->address = $this->_splitAddresses($this->address));
        if ($this->address === false || isset($this->error)) {
            //require_once 'PEAR.php';
            return $this->raiseError($this->error);
        }

        // Validate each address individually.  If we encounter an invalid
        // address, stop iterating and return an error immediately.
        foreach ($this->addresses as $address) {
            $valid = $this->_validateAddress($address);

            if ($valid === false || isset($this->error)) {
                //require_once 'PEAR.php';
                return $this->raiseError($this->error);
            }

            if (!$this->nestGroups) {
                $this->structure = array_merge($this->structure, $valid);
            } else {
                $this->structure[] = $valid;
            }
        }

        return $this->structure;
    }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index