PHP 클래스 Grunion_Contact_Form_Plugin, jetpack

파일 보기 프로젝트 열기: automattic/jetpack 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$current_widget_id The Widget ID of the widget currently being processed. Used to build the unique contact-form ID for forms embedded in widgets.
$using_contact_form_field

공개 메소드들

메소드 설명
__construct ( )
add_shortcode ( ) * Adds our contact-form shortcode The "child" contact-field shortcode is enabled as needed by the contact-form shortcode handler
ajax_request ( )
akismet_submit ( string $as, array $form ) Submit a feedback as either spam or ham
allow_feedback_rest_api_type ( $post_types ) Add to REST API post type whitelist
daily_akismet_meta_cleanup ( ) Runs daily to clean up spam detection metadata after 15 days. Keeps your DB squeaky clean.
download_feedback_as_csv ( ) download as a csv a contact form or all of them in a csv file
esc_csv ( string $field ) : string Escape a string to be used in a CSV context
export_form ( ) Prints the menu
get_export_data_for_posts ( array $post_ids ) : array Prepares feedback post data for CSV export.
get_ip_address ( )
get_parsed_field_contents_of_post ( integer $post_id ) : array Get parsed feedback post fields.
get_post_content_for_csv_export ( integer $post_id ) : string Fetch post content for a post and extract just the comment.
get_post_meta_for_csv_export ( integer $post_id ) : mixed Get _feedback_extra_fields field from post meta data.
init ( )
insert_feedback_filter ( array $data, array $postarr ) : array Ensure the post author is always zero for contact-form feedbacks Attached to wp_insert_post_data
is_spam_akismet ( boolean $is_spam, array $form = [] ) : boolean | WP_Error Submit contact-form data to Akismet to check for spam.
map_parsed_field_contents_of_post_to_field_names ( array $parsed_post_content ) : array Properly maps fields that are missing from the post meta data to names, that are similar to those of the post meta.
parse_fields_from_content ( $post_id )
prepare_for_akismet ( array $form ) : array Populate an array with all values necessary to submit a NEW contact-form feedback to Akismet.
process_form_submission ( ) Handles all contact-form POST submissions
replace_tokens_with_input ( string $subject, array $field_values ) : string Replaces tokens like {city} or {City} (case insensitive) with the value of an input field of that name
sanitize_value ( $value )
strip_tags ( mixed $data_with_tags ) : mixed Strips HTML tags from input. Output is NOT HTML safe.
tokenize_label ( $label )
track_current_widget ( array $widget ) Tracks the widget currently being processed.
unread_count ( object $screen ) Display the count of new feedback entries received. It's reset when user visits the Feedback screen.
widget_atts ( string $text ) : string Adds a "widget" attribute to every contact-form embedded in a text widget.
widget_shortcode_hack ( string $text ) : string For sites where text widgets are not processed for shortcodes, we add this hack to process just our shortcode Attached to widget_text

보호된 메소드들

메소드 설명
get_feedbacks_as_options ( ) : string Returns a string of HTML
get_field_names ( array | integer $posts ) : array Get the names of all the form's fields
make_csv_row_from_feedback ( integer $post_id, array $fields ) : String Creates a valid csv row from a post id

메소드 상세

__construct() 공개 메소드

public __construct ( )

add_shortcode() 공개 메소드

* Adds our contact-form shortcode The "child" contact-field shortcode is enabled as needed by the contact-form shortcode handler
public add_shortcode ( )

ajax_request() 공개 메소드

public ajax_request ( )

akismet_submit() 공개 메소드

Submit a feedback as either spam or ham
public akismet_submit ( string $as, array $form )
$as string Either 'spam' or 'ham'.
$form array the contact-form data

allow_feedback_rest_api_type() 공개 메소드

Add to REST API post type whitelist
public allow_feedback_rest_api_type ( $post_types )

daily_akismet_meta_cleanup() 공개 메소드

Runs daily to clean up spam detection metadata after 15 days. Keeps your DB squeaky clean.

download_feedback_as_csv() 공개 메소드

download as a csv a contact form or all of them in a csv file

esc_csv() 공개 메소드

Malicious input can inject formulas into CSV files, opening up the possibility for phishing attacks and disclosure of sensitive information. Additionally, Excel exposes the ability to launch arbitrary commands through the DDE protocol.
또한 보기: http://www.contextis.com/resources/blog/comma-separated-vulnerabilities/
public esc_csv ( string $field ) : string
$field string
리턴 string

export_form() 공개 메소드

Prints the menu
public export_form ( )

get_export_data_for_posts() 공개 메소드

Prepares feedback post data for CSV export.
public get_export_data_for_posts ( array $post_ids ) : array
$post_ids array Post IDs to fetch the data for. These need to be Feedback posts.
리턴 array

get_feedbacks_as_options() 보호된 메소드

Returns a string of HTML
protected get_feedbacks_as_options ( ) : string
리턴 string a string of HTML

get_field_names() 보호된 메소드

Get the names of all the form's fields
사용 중단: As this is no longer necessary as of the CSV export rewrite. - 2015-12-29
protected get_field_names ( array | integer $posts ) : array
$posts array | integer the post we want the fields of
리턴 array the array of fields

get_ip_address() 공개 정적인 메소드

public static get_ip_address ( )

get_parsed_field_contents_of_post() 공개 메소드

Get parsed feedback post fields.
public get_parsed_field_contents_of_post ( integer $post_id ) : array
$post_id integer Id of the post to fetch parsed contents for.
리턴 array

get_post_content_for_csv_export() 공개 메소드

Fetch post content for a post and extract just the comment.
public get_post_content_for_csv_export ( integer $post_id ) : string
$post_id integer The post id to fetch the content for.
리턴 string Trimmed post comment.

get_post_meta_for_csv_export() 공개 메소드

Get _feedback_extra_fields field from post meta data.
public get_post_meta_for_csv_export ( integer $post_id ) : mixed
$post_id integer Id of the post to fetch meta data for.
리턴 mixed

init() 정적인 공개 메소드

static public init ( )

insert_feedback_filter() 공개 메소드

Ensure the post author is always zero for contact-form feedbacks Attached to wp_insert_post_data
또한 보기: Grunion_Contact_Form::process_submission()
public insert_feedback_filter ( array $data, array $postarr ) : array
$data array the data to insert
$postarr array the data sent to wp_insert_post()
리턴 array The filtered $data to insert

is_spam_akismet() 공개 메소드

If you're accepting a new item via $_POST, run it Grunion_Contact_Form_Plugin::prepare_for_akismet() first Attached to jetpack_contact_form_is_spam
public is_spam_akismet ( boolean $is_spam, array $form = [] ) : boolean | WP_Error
$is_spam boolean
$form array
리턴 boolean | WP_Error TRUE => spam, FALSE => not spam, WP_Error => stop processing entirely

make_csv_row_from_feedback() 보호된 정적인 메소드

Creates a valid csv row from a post id
사용 중단: This is no longer needed, as of the CSV export rewrite.
protected static make_csv_row_from_feedback ( integer $post_id, array $fields ) : String
$post_id integer The id of the post
$fields array An array containing the names of all the fields of the csv
리턴 String The csv row

map_parsed_field_contents_of_post_to_field_names() 공개 메소드

Properly maps fields that are missing from the post meta data to names, that are similar to those of the post meta.
또한 보기: parse_fields_from_content for how the input data is generated.
public map_parsed_field_contents_of_post_to_field_names ( array $parsed_post_content ) : array
$parsed_post_content array Parsed post content
리턴 array Mapped fields.

parse_fields_from_content() 공개 정적인 메소드

public static parse_fields_from_content ( $post_id )

prepare_for_akismet() 공개 메소드

Note that this includes the current user_ip etc, so this should only be called when accepting a new item via $_POST
public prepare_for_akismet ( array $form ) : array
$form array Contact form feedback array
리턴 array feedback array with additional data ready for submission to Akismet

process_form_submission() 공개 메소드

Conditionally attached to template_redirect

replace_tokens_with_input() 공개 메소드

Replaces tokens like {city} or {City} (case insensitive) with the value of an input field of that name
public replace_tokens_with_input ( string $subject, array $field_values ) : string
$subject string
$field_values array Array with field label => field value associations
리턴 string The filtered $subject with the tokens replaced

sanitize_value() 정적인 공개 메소드

static public sanitize_value ( $value )

strip_tags() 공개 정적인 메소드

Strips HTML tags from input. Output is NOT HTML safe.
public static strip_tags ( mixed $data_with_tags ) : mixed
$data_with_tags mixed
리턴 mixed

tokenize_label() 정적인 공개 메소드

static public tokenize_label ( $label )

track_current_widget() 공개 메소드

Attached to dynamic_sidebar
public track_current_widget ( array $widget )
$widget array The widget data

unread_count() 공개 메소드

Display the count of new feedback entries received. It's reset when user visits the Feedback screen.
부터: 4.1.0
public unread_count ( object $screen )
$screen object Information about the current screen.

widget_atts() 공개 메소드

Used to tell the difference between post-embedded contact-forms and widget-embedded contact-forms Attached to widget_text
public widget_atts ( string $text ) : string
$text string The widget text
리턴 string The filtered widget text

widget_shortcode_hack() 공개 메소드

For sites where text widgets are not processed for shortcodes, we add this hack to process just our shortcode Attached to widget_text
public widget_shortcode_hack ( string $text ) : string
$text string The widget text
리턴 string The contact-form filtered widget text

프로퍼티 상세

$current_widget_id 공개적으로 프로퍼티

The Widget ID of the widget currently being processed. Used to build the unique contact-form ID for forms embedded in widgets.
public $current_widget_id

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

static public $using_contact_form_field