Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update contact-form.php #549

Merged
merged 1 commit into from
Sep 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion includes/contact-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,13 @@ public function filter_message( $message, $status = '' ) {
return $message;
}

/* Additional settings */

/**
* Returns the additional setting value searched by name.
*
* @param string $name Name of setting.
* @return string Additional setting value.
*/
public function pref( $name ) {
$settings = $this->additional_setting( $name );

Expand All @@ -1042,6 +1047,14 @@ public function pref( $name ) {
}
}


/**
* Returns additional setting values searched by name.
*
* @param string $name Name of setting.
* @param int $max Maximum result item count.
* @return array Additional setting values.
*/
public function additional_setting( $name, $max = 1 ) {
$settings = (array) explode( "\n", $this->prop( 'additional_settings' ) );

Expand All @@ -1065,6 +1078,13 @@ public function additional_setting( $name, $max = 1 ) {
return $values;
}


/**
* Returns true if the specified setting has a truthy string value.
*
* @param string $name Name of setting.
* @return bool True if the setting value is 'on', 'true', or '1'.
*/
public function is_true( $name ) {
return in_array(
$this->pref( $name ),
Expand All @@ -1073,10 +1093,18 @@ public function is_true( $name ) {
);
}


/**
* Returns true if this contact form is in the demo mode.
*/
public function in_demo_mode() {
return $this->is_true( 'demo_mode' );
}


/**
* Returns true if nonce is active for this contact form.
*/
public function nonce_is_active() {
$is_active = WPCF7_VERIFY_NONCE;

Expand Down