PHP Class MC4WP_Integration

ファイルを表示 Open project: dannyvankooten/mailchimp-for-wordpress Class Usage Examples

Public Properties

Property Type Description
$description Description
$name Name of this integration.
$options Array of settings
$slug Slug, used as an unique identifier for this integration.

Protected Properties

Property Type Description
$checkbox_name Name attribute for the checkbox element. Will be created from slug if empty.

Public Methods

Method Description
__construct ( string $slug, array $options ) Constructor
checkbox_was_checked ( ) : boolean Was the integration checkbox checked?
get_checkbox_html ( ) : string Get HTML for the checkbox
get_data ( ) : array Get the data for this integration request
get_label_text ( ) : string Get the text for the label element
get_lists ( ) : array Get the selected MailChimp lists
get_object_link ( integer $object_id ) : string Return a string to the admin settings page for this object (if any)
get_ui_elements ( ) : array Which UI elements should we show on the settings page for this integration?
has_ui_element ( $element ) : boolean Does integration have the given UI element?
initialize ( ) Initialize the integration
is_installed ( ) : boolean Are the required dependencies for this integration installed?
output_checkbox ( ) Outputs a checkbox
print_css_reset ( ) Print CSS reset
triggered ( integer $object_id = null ) : boolean Was integration triggered?

Protected Methods

Method Description
add_hooks ( ) Adds the hooks which are specific to this integration
add_required_hooks ( ) Adds the required hooks for core functionality, like adding checkbox reset CSS.
get_api ( ) : MC4WP_API_v3
get_checkbox_attributes ( ) : string Get a string of attributes for the checkbox element.
get_default_options ( ) : array Return array of default options
get_log ( ) : MC4WP_Debug_Log
get_request ( ) : MC4WP_Request
parse_options ( array $options ) : array
subscribe ( array $data, integer $related_object_id ) : boolean Makes a subscription request

Method Details

__construct() public method

Constructor
public __construct ( string $slug, array $options )
$slug string
$options array

add_hooks() abstract protected method

Adds the hooks which are specific to this integration
abstract protected add_hooks ( )

add_required_hooks() protected method

Adds the required hooks for core functionality, like adding checkbox reset CSS.
protected add_required_hooks ( )

checkbox_was_checked() public method

Was the integration checkbox checked?
public checkbox_was_checked ( ) : boolean
return boolean

get_api() protected method

protected get_api ( ) : MC4WP_API_v3
return MC4WP_API_v3

get_checkbox_attributes() protected method

Get a string of attributes for the checkbox element.
protected get_checkbox_attributes ( ) : string
return string

get_checkbox_html() public method

Get HTML for the checkbox
public get_checkbox_html ( ) : string
return string

get_data() public method

By default, this will return a combination of all $_GET and $_POST parameters. Override this method if you need data from somewhere else. This data should contain the value of the checkbox (required) and the lists to which should be subscribed (optional)
See also: MC4WP_Integration::$checkbox_name
See also: MC4WP_Integration::get_lists
See also: MC4WP_Integration::checkbox_was_checked
public get_data ( ) : array
return array

get_default_options() protected method

Return array of default options
protected get_default_options ( ) : array
return array

get_label_text() public method

Get the text for the label element
public get_label_text ( ) : string
return string

get_lists() public method

Get the selected MailChimp lists
public get_lists ( ) : array
return array Array of List ID's

get_log() protected method

protected get_log ( ) : MC4WP_Debug_Log
return MC4WP_Debug_Log

get_request() protected method

protected get_request ( ) : MC4WP_Request
return MC4WP_Request

get_ui_elements() public method

Which UI elements should we show on the settings page for this integration?
public get_ui_elements ( ) : array
return array

has_ui_element() public method

Does integration have the given UI element?
public has_ui_element ( $element ) : boolean
$element
return boolean

initialize() public method

Initialize the integration
public initialize ( )

is_installed() public method

Are the required dependencies for this integration installed?
public is_installed ( ) : boolean
return boolean

output_checkbox() public method

Outputs a checkbox
public output_checkbox ( )

parse_options() protected method

protected parse_options ( array $options ) : array
$options array
return array

print_css_reset() public method

Print CSS reset
public print_css_reset ( )

subscribe() protected method

Makes a subscription request
protected subscribe ( array $data, integer $related_object_id ) : boolean
$data array
$related_object_id integer
return boolean

triggered() public method

Will always return true when integration is implicit. Otherwise, will check value of checkbox.
public triggered ( integer $object_id = null ) : boolean
$object_id integer Useful when overriding method. (optional)
return boolean

Property Details

$checkbox_name protected_oe property

Name attribute for the checkbox element. Will be created from slug if empty.
protected $checkbox_name

$description public_oe property

Description
public $description

$name public_oe property

Name of this integration.
public $name

$options public_oe property

Array of settings
public $options

$slug public_oe property

Slug, used as an unique identifier for this integration.
public $slug