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 config-validator.php #893

Merged
merged 1 commit into from
Jul 18, 2022
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
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