emailvalidate
[ class tree: emailvalidate ] [ index: emailvalidate ] [ all elements ]

Class: EmailValidator

Source Location: /email_validator.php

Class Overview


Email Validation Class


Author(s):

Variables

Methods



Class Details

[line 10]
Email Validation Class

Validates and verifies email addresses.




Tags:

author:  Adam Delves <adam@sccode.com>


[ Top ]


Class Variables

$db =  false

[line 58]

Holds a reference to the Sqllite database



Tags:

static:  
access:  private

Type:   SQLiteDatabase


[ Top ]

$email =  null

[line 28]

The Email address



Tags:

access:  private

Type:   string


[ Top ]

$EMAIL_FILE = 'emails.dat'

[line 52]

The location of the email database.



Tags:

static:  
access:  public

Type:   string


[ Top ]

$id =  null

[line 22]

ID for this email address. Generated when saved to the database.



Tags:

access:  private

Type:   integer


[ Top ]

$newEntry =  false

[line 16]

Set to true if this email has not yet been saved to the database



Tags:

access:  private

Type:   boolean


[ Top ]

$valid =  false

[line 46]

True is the email is valid.



Tags:

access:  private

Type:   boolean


[ Top ]

$verified =  false

[line 40]

True is the email has been verified.



Tags:

access:  private

Type:   boolean


[ Top ]

$v_code =  null

[line 34]

Verification code generated for this email address.



Tags:

access:  private

Type:   string


[ Top ]



Class Methods


constructor __construct [line 88]

EmailValidator __construct( string $emailOrId)

Class constructor

Creates and instance of the EmailValidator using an ID or an email address. If an invalid ID is passed an {link EmailValidatorException} is thrown.




Tags:

access:  public


Parameters:

string   $emailOrId   The email address to validate or an ID of a previously saved email address.

[ Top ]

destructor __destruct [line 120]

void __destruct( )

Class destructor.

If this is not a new entry, changes may have been made, to auto save to the database.




Tags:

access:  public


[ Top ]

method generateVerificationCode [line 247]

string generateVerificationCode( )

Generates a random verification code.



Tags:

return:  5 character verification code containing A-Z and 0-9
access:  private


[ Top ]

method getId [line 286]

integer getId( )

Gets the vlaue of the email EmailValidator::ID property



Tags:

access:  public


[ Top ]

method getValid [line 295]

boolean getValid( )

Gets the value of the EmailValidator::valid property



Tags:

access:  public


[ Top ]

method getVerified [line 304]

boolean getVerified( )

Gets the value of the EmailValidator::verified property



Tags:

access:  public


[ Top ]

method loadEmailDB [line 64]

void loadEmailDB( )

Loads the database containing email addresses.



Tags:

static:  
access:  private


[ Top ]

method remove [line 158]

void remove( )

Removes the email from the database.



Tags:

access:  public


[ Top ]

method save [line 131]

integer save( )

Saves email and verification code to DB



Tags:

return:  ID
access:  public


[ Top ]

method sendVerificationEmail [line 218]

boolean sendVerificationEmail( )

Sends a verification email containing a verification code.

Throws an EmailValidatorException if the email address has not been validated or has not been saved to the database.




Tags:

return:  True if the email was successfully sent, false if not
access:  public


[ Top ]

method setEmail [line 275]

void setEmail( $email $email)

Sets the value of the email property.

Once set, the email must be revalidated.




Tags:

access:  public


Parameters:

$email   $email  

[ Top ]

method validate [line 175]

boolean validate( )

Pattern matches the email and checks the host name.



Tags:

access:  public


[ Top ]

method verify [line 202]

boolean verify( string $verifyCode)

Checks a verification code.

Verification code check is case insensitive. Throws an EmailValidatorException if the email address has not been validated.




Tags:

access:  public


Parameters:

string   $verifyCode   5 character verification code to check

[ Top ]


Documentation generated on Wed, 22 Feb 2006 15:18:39 +0000 by phpDocumentor 1.3.0RC3