PHP 클래스 MC4WP_API

파일 보기 프로젝트 열기: dannyvankooten/mailchimp-for-wordpress

보호된 프로퍼티들

프로퍼티 타입 설명
$api_key The API key to use
$api_url The URL to the MailChimp API
$connected Boolean indicating whether the user is connected with MailChimp
$error_code The error code of the last API request (if any)
$error_message The error message of the latest API request (if any)
$last_response The full response object of the latest API call

공개 메소드들

메소드 설명
__construct ( string $api_key ) Constructor
add_ecommerce_order ( array $order_data ) : boolean
call ( string $method, array $data = [] ) : object Calls the MailChimp API
delete_ecommerce_order ( string $store_id, string $order_id ) : boolean
get_error_code ( ) : integer Gets the most recent error code
get_error_message ( ) : string Gets the most recent error message
get_last_response ( ) : object Get the most recent response object
get_list_groupings ( integer $list_id ) : array | boolean Gets the Groupings for a given List
get_lists ( array $list_ids = [] ) : boolean
get_lists_for_email ( array | string $email ) : array Get the lists an email address is subscribed to
get_lists_with_merge_vars ( array $list_ids ) : array | boolean Get lists with their merge_vars for a given array of list id's
get_subscriber_info ( string $list_id, array $emails ) : array Gets the member info for one or multiple emails on a list
has_error ( ) : boolean Checks if an error occured in the most recent request
is_connected ( ) : boolean Pings the MailChimp API to see if we're connected
list_has_subscriber ( string $list_id, string $email ) : boolean Checks if an email address is on a given list
subscribe ( string $list_id, string $email, array $merge_vars = [], string $email_type = 'html', boolean $double_optin = true, boolean $update_existing = false, boolean $replace_interests = true, boolean $send_welcome = false ) : boolean | string Sends a subscription request to the MailChimp API
unsubscribe ( string $list_id, array | string $struct, boolean $send_goodbye = true, boolean $send_notification = false, boolean $delete_member = false ) : boolean Unsubscribes the given email or luid from the given MailChimp list
update_subscriber ( string $list_id, array | string $email, array $merge_vars = [], string $email_type = 'html', boolean $replace_interests = false ) : boolean

비공개 메소드들

메소드 설명
empty_last_response ( ) Empties all data from previous response
get_headers ( ) : array Get the request headers to send to the MailChimp API
parse_response ( array | WP_Error $response ) : object
show_connection_error ( $message ) : boolean
show_error ( string $message ) : boolean Show an error message to administrators

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( string $api_key )
$api_key string

add_ecommerce_order() 공개 메소드

또한 보기: https://apidocs.mailchimp.com/api/2.0/ecomm/order-add.php
public add_ecommerce_order ( array $order_data ) : boolean
$order_data array
리턴 boolean

call() 공개 메소드

Calls the MailChimp API
public call ( string $method, array $data = [] ) : object
$method string
$data array
리턴 object

delete_ecommerce_order() 공개 메소드

또한 보기: https://apidocs.mailchimp.com/api/2.0/ecomm/order-del.php
public delete_ecommerce_order ( string $store_id, string $order_id ) : boolean
$store_id string
$order_id string
리턴 boolean

get_error_code() 공개 메소드

Gets the most recent error code
public get_error_code ( ) : integer
리턴 integer

get_error_message() 공개 메소드

Gets the most recent error message
public get_error_message ( ) : string
리턴 string

get_last_response() 공개 메소드

Get the most recent response object
public get_last_response ( ) : object
리턴 object

get_list_groupings() 공개 메소드

Gets the Groupings for a given List
public get_list_groupings ( integer $list_id ) : array | boolean
$list_id integer
리턴 array | boolean

get_lists() 공개 메소드

public get_lists ( array $list_ids = [] ) : boolean
$list_ids array Array of ID's of the lists to fetch. (optional)
리턴 boolean

get_lists_for_email() 공개 메소드

Get the lists an email address is subscribed to
public get_lists_for_email ( array | string $email ) : array
$email array | string
리턴 array

get_lists_with_merge_vars() 공개 메소드

Get lists with their merge_vars for a given array of list id's
public get_lists_with_merge_vars ( array $list_ids ) : array | boolean
$list_ids array
리턴 array | boolean

get_subscriber_info() 공개 메소드

Gets the member info for one or multiple emails on a list
public get_subscriber_info ( string $list_id, array $emails ) : array
$list_id string
$emails array
리턴 array

has_error() 공개 메소드

Checks if an error occured in the most recent request
public has_error ( ) : boolean
리턴 boolean

is_connected() 공개 메소드

The result is cached to ensure a maximum of 1 API call per page load
public is_connected ( ) : boolean
리턴 boolean

list_has_subscriber() 공개 메소드

Checks if an email address is on a given list
public list_has_subscriber ( string $list_id, string $email ) : boolean
$list_id string
$email string
리턴 boolean

subscribe() 공개 메소드

Sends a subscription request to the MailChimp API
public subscribe ( string $list_id, string $email, array $merge_vars = [], string $email_type = 'html', boolean $double_optin = true, boolean $update_existing = false, boolean $replace_interests = true, boolean $send_welcome = false ) : boolean | string
$list_id string The list id to subscribe to
$email string The email address to subscribe
$merge_vars array Array of extra merge variables
$email_type string The email type to send to this email address. Possible values are `html` and `text`.
$double_optin boolean Should this email be confirmed via double opt-in?
$update_existing boolean Update information if this email is already on list?
$replace_interests boolean Replace interest groupings, only if update_existing is true.
$send_welcome boolean Send a welcome e-mail, only if double_optin is false.
리턴 boolean | string True if success, 'error' if error

unsubscribe() 공개 메소드

Unsubscribes the given email or luid from the given MailChimp list
public unsubscribe ( string $list_id, array | string $struct, boolean $send_goodbye = true, boolean $send_notification = false, boolean $delete_member = false ) : boolean
$list_id string
$struct array | string
$send_goodbye boolean
$send_notification boolean
$delete_member boolean
리턴 boolean

update_subscriber() 공개 메소드

public update_subscriber ( string $list_id, array | string $email, array $merge_vars = [], string $email_type = 'html', boolean $replace_interests = false ) : boolean
$list_id string
$email array | string
$merge_vars array
$email_type string
$replace_interests boolean
리턴 boolean

프로퍼티 상세

$api_key 보호되어 있는 프로퍼티

The API key to use
protected $api_key

$api_url 보호되어 있는 프로퍼티

The URL to the MailChimp API
protected $api_url

$connected 보호되어 있는 프로퍼티

Boolean indicating whether the user is connected with MailChimp
protected $connected

$error_code 보호되어 있는 프로퍼티

The error code of the last API request (if any)
protected $error_code

$error_message 보호되어 있는 프로퍼티

The error message of the latest API request (if any)
protected $error_message

$last_response 보호되어 있는 프로퍼티

The full response object of the latest API call
protected $last_response