PHP 클래스 Grunion_Contact_Form, jetpack

Parses shortcode to output the contact form as HTML Sends email and stores the contact form response (a.k.a. "feedback")
상속: extends Crunion_Contact_Form_Shortcode
파일 보기 프로젝트 열기: automattic/jetpack 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$current_form form we are currently looking at. If processed, will become $last
$errors stores form submission errors
$last The most recent (inclusive) contact-form shortcode processed
$shortcode_name
$style Whether to print the grunion.css style when processing the contact-form shortcode

공개 메소드들

메소드 설명
__construct ( $attributes, $content = null )
_style_on ( ) Turn on printing of grunion.css stylesheet
addslashes_deep ( $value )
get_compiled_form ( integer $feedback_id, $form ) : array Returns a compiled form with labels and values in a form of an array of lines.
get_field_ids ( ) : array Loops through $this->fields to generate a (structured) list of field IDs.
parse ( array $attributes, string | null $content ) : string The contact-form shortcode processor
parse_contact_field ( array $attributes, string | null $content ) : HTML The contact-field shortcode processor We use an object method here instead of a static Grunion_Contact_Form_Field class method to parse contact-field shortcodes so that we can tie them to the contact-form object.
process_submission ( ) Process the contact form's POST submission Stores feedback. Sends email.
store_shortcode ( string $content = null, $attributes = null ) Store shortcode content for recall later - used to receate shortcode when user uses do_shortcode
style ( boolean $style ) Toggle for printing the grunion.css stylesheet
success_message ( integer $feedback_id, $form ) : string Returns a success message to be returned if the form is sent via AJAX.

메소드 상세

__construct() 공개 메소드

public __construct ( $attributes, $content = null )

_style_on() 정적인 공개 메소드

Turn on printing of grunion.css stylesheet
또한 보기: ::style()
static public _style_on ( )

addslashes_deep() 공개 메소드

public addslashes_deep ( $value )

get_compiled_form() 정적인 공개 메소드

Returns a compiled form with labels and values in a form of an array of lines.
static public get_compiled_form ( integer $feedback_id, $form ) : array
$feedback_id integer
리턴 array $lines

get_field_ids() 공개 메소드

Important: Currently the whitelisted fields are defined as follows: name, email, url, subject, textarea If you need to add new fields to the Contact Form, please don't add them to the whitelisted fields and leave them as extra fields. The reasoning behind this is that both the admin Feedback view and the CSV export will not include any fields that are added to the list of whitelisted fields without taking proper care to add them to all the other places where they accessed/used/saved. The safest way to add new fields is to add them to the dropdown and the HTML list ( @see Grunion_Contact_Form_Field::render ) and don't add them to the list of whitelisted fields. This way they will become a part of the extra fields which are saved in the post meta and will be properly handled by the admin Feedback view and the CSV Export without any extra work. If there is need to add a field to the whitelisted fields, then please take proper care to add logic to handle the field in the following places: - Below in the switch statement - so the field is recognized as whitelisted. - Grunion_Contact_Form::process_submission - validation and logic. - Grunion_Contact_Form::process_submission - add the field as an additional field in the post_content when saving the feedback content. - Grunion_Contact_Form_Plugin::parse_fields_from_content - add mapping for the field, defined in the above method. - Grunion_Contact_Form_Plugin::map_parsed_field_contents_of_post_to_field_names - add mapping of the field for the CSV Export. Otherwise it will be missing from the exported data. - admin.php / grunion_manage_post_columns - add the field to the render logic. Otherwise it will be missing from the admin Feedback view.
public get_field_ids ( ) : array
리턴 array

parse() 정적인 공개 메소드

The contact-form shortcode processor
static public parse ( array $attributes, string | null $content ) : string
$attributes array Key => Value pairs as parsed by shortcode_parse_atts()
$content string | null The shortcode's inner content: [contact-form]$content[/contact-form]
리턴 string HTML for the concat form.

parse_contact_field() 정적인 공개 메소드

The contact-field shortcode processor We use an object method here instead of a static Grunion_Contact_Form_Field class method to parse contact-field shortcodes so that we can tie them to the contact-form object.
static public parse_contact_field ( array $attributes, string | null $content ) : HTML
$attributes array Key => Value pairs as parsed by shortcode_parse_atts()
$content string | null The shortcode's inner content: [contact-field]$content[/contact-field]
리턴 HTML for the contact form field

process_submission() 공개 메소드

Process the contact form's POST submission Stores feedback. Sends email.
public process_submission ( )

store_shortcode() 정적인 공개 메소드

Store shortcode content for recall later - used to receate shortcode when user uses do_shortcode
static public store_shortcode ( string $content = null, $attributes = null )
$content string

style() 정적인 공개 메소드

Toggle for printing the grunion.css stylesheet
static public style ( boolean $style )
$style boolean

success_message() 정적인 공개 메소드

Returns a success message to be returned if the form is sent via AJAX.
static public success_message ( integer $feedback_id, $form ) : string
$feedback_id integer
리턴 string $message

프로퍼티 상세

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

form we are currently looking at. If processed, will become $last
static public $current_form

$errors 공개적으로 프로퍼티

stores form submission errors
public $errors

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

The most recent (inclusive) contact-form shortcode processed
static public $last

$shortcode_name 공개적으로 프로퍼티

public $shortcode_name

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

Whether to print the grunion.css style when processing the contact-form shortcode
static public $style