Skip to content

Commit

Permalink
Merge pull request #893 from takayukister/dev/5.6
Browse files Browse the repository at this point in the history
Update config-validator.php
  • Loading branch information
takayukister authored Jul 18, 2022
2 parents 5a11003 + 820e34e commit 88e9c14
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions includes/config-validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,12 @@ public function validate_mail( $template = 'mail' ) {
}
}


/**
* Detects errors of invalid mailbox syntax.
*
* @link https://contactform7.com/configuration-errors/invalid-mailbox-syntax/
*/
public function detect_invalid_mailbox_syntax( $section, $content, $args = '' ) {
$args = wp_parse_args( $args, array(
'link' => self::get_doc_link( 'invalid_mailbox_syntax' ),
Expand All @@ -793,6 +799,12 @@ public function detect_invalid_mailbox_syntax( $section, $content, $args = '' )
return false;
}


/**
* Detects errors of empty message fields.
*
* @link https://contactform7.com/configuration-errors/maybe-empty/
*/
public function detect_maybe_empty( $section, $content ) {
if ( '' === $content ) {
return $this->add_error( $section,
Expand All @@ -805,6 +817,12 @@ public function detect_maybe_empty( $section, $content ) {
return false;
}


/**
* Detects errors of nonexistent attachment files.
*
* @link https://contactform7.com/configuration-errors/file-not-found/
*/
public function detect_file_not_found( $section, $content ) {
$path = path_join( WP_CONTENT_DIR, $content );

Expand All @@ -823,6 +841,12 @@ public function detect_file_not_found( $section, $content ) {
return false;
}


/**
* Detects errors of attachment files out of the content directory.
*
* @link https://contactform7.com/configuration-errors/file-not-in-content-dir/
*/
public function detect_file_not_in_content_dir( $section, $content ) {
$path = path_join( WP_CONTENT_DIR, $content );

Expand All @@ -840,6 +864,10 @@ public function detect_file_not_in_content_dir( $section, $content ) {
return false;
}


/**
* Runs error detection for the messages section.
*/
public function validate_messages() {
$messages = (array) $this->contact_form->prop( 'messages' );

Expand All @@ -858,6 +886,12 @@ public function validate_messages() {
}
}


/**
* Detects errors of HTML uses in a message.
*
* @link https://contactform7.com/configuration-errors/html-in-message/
*/
public function detect_html_in_message( $section, $content ) {
$stripped = wp_strip_all_tags( $content );

Expand All @@ -873,6 +907,10 @@ public function detect_html_in_message( $section, $content ) {
return false;
}


/**
* Runs error detection for the additional settings section.
*/
public function validate_additional_settings() {
$deprecated_settings_used =
$this->contact_form->additional_setting( 'on_sent_ok' ) ||
Expand Down

0 comments on commit 88e9c14

Please sign in to comment.