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

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

Parameters:
string$atomThe string to check.
Returns:
boolean Success or failure.

Definition at line 549 of file z_RFC822.php.

Referenced by _validatePhrase(), and _validateSubdomain().

    {
        if (!$this->validate) {
            // Validation has been turned off; assume the atom is okay.
            return true;
        }
        // Check for any char from ASCII 0 - ASCII 127
        if (!preg_match('/^[\\x00-\\x7E]+$/i', $atom, $matches)) {
            return false;
        }

        // Check for specials:
        if (preg_match('/[][()<>@,;\\:". ]/', $atom)) {
            return false;
        }

        // Check for control characters (ASCII 0-31):
        if (preg_match('/[\\x00-\\x1F]+/', $atom)) {
            return false;
        }
        return true;
    }

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index