From cd5d36e7fc97bd55e98efbe5635f45da7d0df6f2 Mon Sep 17 00:00:00 2001 From: Takayuki Miyoshi Date: Fri, 10 Sep 2021 19:50:35 +0900 Subject: [PATCH] Update contact-form.php #525 --- includes/contact-form.php | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/includes/contact-form.php b/includes/contact-form.php index 02073c7a..bf3c9e06 100644 --- a/includes/contact-form.php +++ b/includes/contact-form.php @@ -869,6 +869,13 @@ public function form_elements() { ); } + + /** + * Collects mail-tags available for this contact form. + * + * @param string|array $args Optional. Search options. + * @return array Mail-tag names. + */ public function collect_mail_tags( $args = '' ) { $manager = WPCF7_FormTagsManager::get_instance(); @@ -903,6 +910,12 @@ public function collect_mail_tags( $args = '' ) { return apply_filters( 'wpcf7_collect_mail_tags', $mailtags, $args, $this ); } + + /** + * Prints a mail-tag suggestion list. + * + * @param string $for Optional. Mail template name. Default 'mail'. + */ public function suggest_mail_tags( $for = 'mail' ) { $mail = wp_parse_args( $this->prop( $for ), array( @@ -936,6 +949,13 @@ public function suggest_mail_tags( $for = 'mail' ) { } } + + /** + * Submits this contact form. + * + * @param string|array $args Optional. Submission options. Default empty. + * @return array Result of submission. + */ public function submit( $args = '' ) { $args = wp_parse_args( $args, array( 'skip_mail' => @@ -977,8 +997,14 @@ public function submit( $args = '' ) { return $result; } - /* Message */ + /** + * Returns message used for given status. + * + * @param string $status Status. + * @param bool $filter Optional. Whether filters are applied. Default true. + * @return string Message. + */ public function message( $status, $filter = true ) { $messages = $this->prop( 'messages' ); $message = isset( $messages[$status] ) ? $messages[$status] : ''; @@ -990,6 +1016,14 @@ public function message( $status, $filter = true ) { return $message; } + + /** + * Filters a message. + * + * @param string $message Message to filter. + * @param string $status Optional. Status. Default empty. + * @return string Filtered message. + */ public function filter_message( $message, $status = '' ) { $message = wpcf7_mail_replace_tags( $message ); $message = apply_filters( 'wpcf7_display_message', $message, $status );