PHP 클래스 MC4WP_Form

파일 보기 프로젝트 열기: dannyvankooten/mailchimp-for-wordpress 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$ID The form ID, matches the underlying post its ID
$config array
$content The form HTML content
$errors Array of error codes
$instances Array of instantiated form objects.
$is_submitted Was this form submitted?
$messages Array of message codes that will show when this form renders
$name The form name
$post The internal post object that represents this form.
$raw_data Array of the raw form data that was submitted.
$settings Array of settings

보호된 프로퍼티들

프로퍼티 타입 설명
$post_meta Raw array or post_meta values.

공개 메소드들

메소드 설명
__construct ( integer $id )
__get ( string $name ) : mixed
__toString ( ) : string Output this form
add_error ( string $error_code ) Add an error to this form
add_message ( $key )
get_action ( ) : string Get the form action
get_data ( ) : array
get_element ( string $element_id = 'mc4wp-form', array $config = [] ) : MC4WP_Form_element
get_email_type ( ) : string Get "email_type" setting for new MailChimp subscribers added by this form.
get_field_types ( ) : array Get an array of field types which are present in this form.
get_html ( string $element_id = 'mc4wp-form', array $config = [] ) : string Get HTML string for this form.
get_instance ( integer | WP_Post $form_id ) : MC4WP_Form Get a shared form instance.
get_lists ( ) : array Get MailChimp lists this form subscribes to
get_message ( string $key ) : MC4WP_Form_Message Get message object
get_message_html ( string $key ) : string Get HTML string for a message, including wrapper element.
get_redirect_url ( ) : string Get "redirect to url after success" setting for this form
get_required_fields ( ) : array Get array of name attributes for the required fields in this form.
get_response_html ( ) : string Gets the form response string
get_stylesheet ( ) : string Gets the filename of the stylesheet to load for this form.
handle_request ( MC4WP_Request $request ) : void Handle an incoming request. Should be called before calling validate() method.
has_errors ( ) : boolean Does this form have errors?
has_field_type ( $type ) : boolean Does this form has a field of the given type?
set_config ( array $config ) : array Update configuration for this form
validate ( ) : boolean Is this form valid?

보호된 메소드들

메소드 설명
load_messages ( ) : array
load_settings ( ) : array
parse_request_data ( MC4WP_Request $request ) : array Parse a request for data which should be binded to $data property.

메소드 상세

__construct() 공개 메소드

public __construct ( integer $id )
$id integer The post ID

__get() 공개 메소드

public __get ( string $name ) : mixed
$name string
리턴 mixed

__toString() 공개 메소드

Output this form
public __toString ( ) : string
리턴 string

add_error() 공개 메소드

Add an error to this form
public add_error ( string $error_code )
$error_code string

add_message() 공개 메소드

public add_message ( $key )
$key

get_action() 공개 메소드

Valid return values are "subscribe" and "unsubscribe"
public get_action ( ) : string
리턴 string

get_data() 공개 메소드

public get_data ( ) : array
리턴 array

get_element() 공개 메소드

public get_element ( string $element_id = 'mc4wp-form', array $config = [] ) : MC4WP_Form_element
$element_id string
$config array
리턴 MC4WP_Form_element

get_email_type() 공개 메소드

Get "email_type" setting for new MailChimp subscribers added by this form.
public get_email_type ( ) : string
리턴 string

get_field_types() 공개 메소드

Get an array of field types which are present in this form.
public get_field_types ( ) : array
리턴 array

get_html() 공개 메소드

If you want to output a form, use mc4wp_show_form instead as it.
public get_html ( string $element_id = 'mc4wp-form', array $config = [] ) : string
$element_id string
$config array
리턴 string

get_instance() 공개 정적인 메소드

Get a shared form instance.
public static get_instance ( integer | WP_Post $form_id ) : MC4WP_Form
$form_id integer | WP_Post
리턴 MC4WP_Form

get_lists() 공개 메소드

Get MailChimp lists this form subscribes to
public get_lists ( ) : array
리턴 array

get_message() 공개 메소드

Get message object
public get_message ( string $key ) : MC4WP_Form_Message
$key string
리턴 MC4WP_Form_Message

get_message_html() 공개 메소드

Get HTML string for a message, including wrapper element.
사용 중단: 3.1
public get_message_html ( string $key ) : string
$key string
리턴 string

get_redirect_url() 공개 메소드

Get "redirect to url after success" setting for this form
public get_redirect_url ( ) : string
리턴 string

get_required_fields() 공개 메소드

Get array of name attributes for the required fields in this form.
public get_required_fields ( ) : array
리턴 array

get_response_html() 공개 메소드

This does not take the submitted form element into account.
또한 보기: MC4WP_Form_Element::get_response_html()
public get_response_html ( ) : string
리턴 string

get_stylesheet() 공개 메소드

Gets the filename of the stylesheet to load for this form.
public get_stylesheet ( ) : string
리턴 string

handle_request() 공개 메소드

Handle an incoming request. Should be called before calling validate() method.
또한 보기: MC4WP_Form::validate
public handle_request ( MC4WP_Request $request ) : void
$request MC4WP_Request
리턴 void

has_errors() 공개 메소드

Should always evaluate to false when form has not been submitted.
public has_errors ( ) : boolean
리턴 boolean

has_field_type() 공개 메소드

Does this form has a field of the given type?
public has_field_type ( $type ) : boolean
$type
리턴 boolean

load_messages() 보호된 메소드

protected load_messages ( ) : array
리턴 array

load_settings() 보호된 메소드

protected load_settings ( ) : array
리턴 array

parse_request_data() 보호된 메소드

This does the following on all post data. - Removes fields starting with an underscore. - Remove fields which are set to be ignored. - Uppercase all field names
protected parse_request_data ( MC4WP_Request $request ) : array
$request MC4WP_Request
리턴 array

set_config() 공개 메소드

Update configuration for this form
public set_config ( array $config ) : array
$config array
리턴 array

validate() 공개 메소드

Will always return true if the form is not yet submitted. Otherwise, it will run validation and store any errors. This method should be called before get_errors()
public validate ( ) : boolean
리턴 boolean

프로퍼티 상세

$ID 공개적으로 프로퍼티

The form ID, matches the underlying post its ID
public $ID

$config 공개적으로 프로퍼티

public array $config
리턴 array

$content 공개적으로 프로퍼티

The form HTML content
public $content

$errors 공개적으로 프로퍼티

Array of error codes
public $errors

$instances 공개적으로 정적으로 프로퍼티

Array of instantiated form objects.
public static $instances

$is_submitted 공개적으로 프로퍼티

Was this form submitted?
public $is_submitted

$messages 공개적으로 프로퍼티

Array of message codes that will show when this form renders
public $messages

$name 공개적으로 프로퍼티

The form name
public $name

$post 공개적으로 프로퍼티

The internal post object that represents this form.
public $post

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

Raw array or post_meta values.
protected $post_meta

$raw_data 공개적으로 프로퍼티

Array of the raw form data that was submitted.
public $raw_data

$settings 공개적으로 프로퍼티

Array of settings
public $settings