Skip to content

Commit

Permalink
Update contact-form.php
Browse files Browse the repository at this point in the history
  • Loading branch information
takayukister committed Sep 10, 2021
1 parent d3cb8d8 commit cd5d36e
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion includes/contact-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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' =>
Expand Down Expand Up @@ -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] : '';
Expand All @@ -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 );
Expand Down

0 comments on commit cd5d36e

Please sign in to comment.