PHP Class Global_SMTP_Mailer

Show file Open project: rohmann/global-smtp Class Usage Examples

Protected Properties

Property Type Description
$instance Singleton

Public Methods

Method Description
__construct ( ) Checks settings, and hooks into phpmailer if everything is good.
check_headers ( array $atts ) : array Filter for wp_mail used for introspection
get_from ( $from ) : string Callback for wp_mail_from filter.
get_from_name ( $from_name ) : string Callback for wp_mail_from_name filter Applies the from name constant if a "From" header was not present.
instance ( ) : object Get this plugin's main class instance
launch ( ) Self Instantiate Note: Plugin can be disable internally by setting GLOBAL_SMTP_DISABLE to true.
mailer ( $phpmailer ) Hook PHP Mailer to use our SMTP settings
register_admin_menu ( ) : none Register our admin menu in the correct context.
render_admin_page ( ) : none Display the admin page

Protected Methods

Method Description
prepare_settings ( ) Prepare PHP Mailer settings. Allows for minimum configuration by asumming common defualts.
validate ( ) : boolean | WP_Error Validate Configuration to ensure things are setup correctly

Method Details

__construct() public method

Checks settings, and hooks into phpmailer if everything is good.
public __construct ( )

check_headers() public method

Filter for wp_mail used for introspection
public check_headers ( array $atts ) : array
$atts array Arguments passed into wp_mail
return array Unmodified $atts

get_from() public method

Applies the from address constant if a "From" header was not present.
public get_from ( $from ) : string
return string from email address

get_from_name() public method

Callback for wp_mail_from_name filter Applies the from name constant if a "From" header was not present.
public get_from_name ( $from_name ) : string
return string from email address

instance() public static method

Get this plugin's main class instance
public static instance ( ) : object
return object

launch() public static method

This is useful if you have different needs between staging and production environments.
public static launch ( )

mailer() public method

Hook PHP Mailer to use our SMTP settings
public mailer ( $phpmailer )

prepare_settings() protected method

Prepare PHP Mailer settings. Allows for minimum configuration by asumming common defualts.
protected prepare_settings ( )

register_admin_menu() public method

Register our admin menu in the correct context.
public register_admin_menu ( ) : none
return none

render_admin_page() public method

Display the admin page
public render_admin_page ( ) : none
return none

validate() protected method

Validate Configuration to ensure things are setup correctly
protected validate ( ) : boolean | WP_Error
return boolean | WP_Error Returns true if successful, else WP_Error with message

Property Details

$instance protected static property

Singleton
protected static $instance