Changeset 2995586
- Timestamp:
- 11/14/2023 08:08:15 AM (2 years ago)
- Location:
- email-validator-for-contact-form-7/trunk
- Files:
-
- 4 edited
-
email-validator-for-contact-form-7.php (modified) (12 diffs)
-
readme.txt (modified) (2 diffs)
-
vendor/mailboxvalidator/mailboxvalidator-php/README.md (modified) (5 diffs)
-
vendor/mailboxvalidator/mailboxvalidator-php/src/EmailValidation.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
email-validator-for-contact-form-7/trunk/email-validator-for-contact-form-7.php
r2964370 r2995586 9 9 Description: Enables Contact Form 7 users to validate their client’s email address before accepting their messages for sending using MailboxValidator. <strong>Before get started, install and activate the Contact Form 7 plugin first.</strong> 10 10 11 Version: 1. 6.611 Version: 1.7.0 12 12 13 13 Author: MailboxValidator … … 106 106 $options = get_option( 'mbv_wpcf7_email_validator_for_contact_form_7' ); 107 107 108 if ( $options['api_key'] == '' || $options['api_key'] == ' ' ) {108 if ( !(isset($options['api_key'])) || $options['api_key'] == '' || $options['api_key'] == ' ' ) { 109 109 110 110 echo '<div class="notice notice-warning is-dismissible"><p>'; … … 485 485 $invalid_on_off = $options['invalid_on_off'] ?? 'on'; 486 486 487 echo '<input id="invalid_error_message" name="mbv_wpcf7_email_validator_for_contact_form_7[invalid_error_message]" style="width:100%" type="text" value="' . $invalid_error_message . '" ' . ( $invalid_on_off == 'off' ? 'disabled="disabled" ' : '' ) . 'aria-describedby="errormessage-hint" max="255" maxlength="255"/>';487 echo '<input id="invalid_error_message" name="mbv_wpcf7_email_validator_for_contact_form_7[invalid_error_message]" style="width:100%" type="text" value="' . $invalid_error_message . '" aria-describedby="errormessage-hint" max="255" maxlength="255"/>'; 488 488 echo '<p id="errormessage-hint" style="color:#666666;font-style: italic;" >Your error message should be not more than 255 characters.</p>'; 489 489 … … 499 499 $disposable_on_off = $options['disposable_on_off'] ?? 'on'; 500 500 501 echo '<input id="disposable_error_message" name="mbv_wpcf7_email_validator_for_contact_form_7[disposable_error_message]" style="width:100%" type="text" value="' . $disposable_error_message . '" ' . ( $disposable_on_off == 'off' ? 'disabled="disabled" ' : '' ) . 'aria-describedby="errormessage-hint" max="255" maxlength="255"/>';501 echo '<input id="disposable_error_message" name="mbv_wpcf7_email_validator_for_contact_form_7[disposable_error_message]" style="width:100%" type="text" value="' . $disposable_error_message . '" aria-describedby="errormessage-hint" max="255" maxlength="255"/>'; 502 502 echo '<p id="errormessage-hint" style="color:#666666;font-style: italic;" >Your error message should be not more than 255 characters.</p>'; 503 503 … … 513 513 $free_on_off = $options['free_on_off'] ?? 'on'; 514 514 515 echo '<input id="free_error_message" name="mbv_wpcf7_email_validator_for_contact_form_7[free_error_message]" style="width:100%" type="text" value="' . $free_error_message . '" ' . ( $free_on_off == 'off' ? 'disabled="disabled" ' : '' ) . 'aria-describedby="errormessage-hint" max="255" maxlength="255"/>';515 echo '<input id="free_error_message" name="mbv_wpcf7_email_validator_for_contact_form_7[free_error_message]" style="width:100%" type="text" value="' . $free_error_message . '" aria-describedby="errormessage-hint" max="255" maxlength="255"/>'; 516 516 echo '<p id="errormessage-hint" style="color:#666666;font-style: italic;" >Your error message should be not more than 255 characters.</p>'; 517 517 … … 527 527 $role_on_off = $options['role_on_off'] ?? 'on'; 528 528 529 echo '<input id="role_error_message" name="mbv_wpcf7_email_validator_for_contact_form_7[role_error_message]" style="width:100%" type="text" value="' . $role_error_message . '" ' . ( $role_on_off == 'off' ? 'disabled="disabled" ' : '' ) . 'aria-describedby="errormessage-hint" max="255" maxlength="255"/>';529 echo '<input id="role_error_message" name="mbv_wpcf7_email_validator_for_contact_form_7[role_error_message]" style="width:100%" type="text" value="' . $role_error_message . '" aria-describedby="errormessage-hint" max="255" maxlength="255"/>'; 530 530 echo '<p id="errormessage-hint" style="color:#666666;font-style: italic;" >Your error message should be not more than 255 characters.</p>'; 531 531 … … 664 664 665 665 if ( $api_result != '' ) { 666 if ( $api_result['error_message'] === '' ) { 667 if ( $api_result['status'] === 'False' ) { 666 if ( !isset( $api_result['error_code'] ) ) { 667 if ( $api_result['status'] ) { 668 return true; 669 } else { 668 670 return false; 669 } else {670 return true;671 671 } 672 672 } else { … … 683 683 684 684 if ( $api_result != '' ) { 685 if ( $api_result['error_message'] === '' ) { 686 if ( $api_result['is_role'] === 'False' ) { 685 if ( !isset( $api_result['error_code'] ) ) { 686 if ( $api_result['is_role'] ) { 687 return true; 688 } else { 687 689 return false; 688 } else {689 return true;690 690 } 691 691 } else { … … 706 706 // if ( $data['error_message'] == '' ) { 707 707 if ($results != null) { 708 if ( trim( $results->error_code ) === '' ) { 709 710 // if ( $data['is_free'] == 'False' ) { 711 if ( $results->is_free === 'False' ) { 712 708 if ( !isset( $results->error_code ) ) { 709 710 // if ( $data['is_free'] == 'False' ) { 711 if ( $results->is_free ) { 712 713 return true; 714 715 } else { 716 717 return false; 718 719 } 720 721 } else { 713 722 return false; 714 715 } else {716 717 return true;718 719 723 } 720 721 724 } else { 722 725 return false; 723 726 } 724 } else {725 return false;726 }727 727 728 728 } … … 735 735 // if ( $data['error_message'] == '' ) { 736 736 if ($results != null) { 737 if ( trim( $results->error_code ) === '' ) { 738 739 // if ( $data['is_disposable'] == 'False' ) { 740 if ( $results->is_disposable === 'False' ) { 741 737 if ( !isset( $results->error_code ) ) { 738 739 // if ( $data['is_disposable'] == 'False' ) { 740 if ( $results->is_disposable ) { 741 742 return true; 743 744 } else { 745 746 return false; 747 748 } 749 750 } else { 742 751 return false; 743 744 } else {745 746 return true;747 748 752 } 749 750 } else {751 return false;752 }753 753 } else { 754 754 return false; … … 815 815 // $is_free = $options['free_on_off'] == 'on' ? mbv_wpcf7_validate_email_check_free( $_POST[$name] , $options['api_key'] ) : false; 816 816 if ($options['disposable_on_off'] === 'on') { 817 if ($single_result != '' && $single_result['error_message'] == '') {818 $is_disposable = ($single_result['is_disposable'] == 'False') ? false : true;817 if ($single_result != '' && !(array_key_exists('error_message', $single_result))) { 818 $is_disposable = ($single_result['is_disposable']) ? true : false; 819 819 } else { 820 820 $is_disposable = $this->mbv_wpcf7_validate_email_check_disposable( $_POST[$name] , $options['api_key'] ); … … 824 824 } 825 825 if ($options['free_on_off'] === 'on') { 826 if ($single_result != '' && $single_result['error_message'] == '') {827 $is_free = ($single_result['is_free'] == 'False') ? false : true;826 if ($single_result != '' && !(array_key_exists('error_message', $single_result))) { 827 $is_free = ($single_result['is_free']) ? true : false; 828 828 } else { 829 829 $is_free = $this->mbv_wpcf7_validate_email_check_free( $_POST[$name] , $options['api_key'] ); -
email-validator-for-contact-form-7/trunk/readme.txt
r2964370 r2995586 3 3 Donate link: https://mailboxvalidator.com 4 4 Tags: mailboxvalidator, contact form 7, email validation, form validation, email validator, disposable email, free email, role-based email 5 Tested up to: 6. 36 Stable tag: 1. 6.65 Tested up to: 6.4.1 6 Stable tag: 1.7.0 7 7 Requires PHP: 5.2.4 8 8 … … 65 65 66 66 == Changelog == 67 68 = 1.7.0 = 69 * Update to use v2 for MailboxValidator API through MailboxValiator PHP SDK, and tested with WordPress 6.4.1. 67 70 68 71 = 1.6.6 = -
email-validator-for-contact-form-7/trunk/vendor/mailboxvalidator/mailboxvalidator-php/README.md
r2453608 r2995586 21 21 ``` 22 22 "require": { 23 "mailboxvalidator/mailboxvalidator-php": "2. 0.*"23 "mailboxvalidator/mailboxvalidator-php": "2.1.*" 24 24 } 25 25 ``` … … 116 116 echo "Error connecting to API.\n"; 117 117 } 118 else if ( trim($results->error_code) === '') {118 else if (!isset($results->error)) { 119 119 echo 'email_address = ' . $results->email_address . "\n"; 120 120 echo 'domain = ' . $results->domain . "\n"; 121 echo 'is_free = ' . $results->is_free. "\n";122 echo 'is_syntax = ' . $results->is_syntax. "\n";123 echo 'is_domain = ' . $results->is_domain. "\n";124 echo 'is_smtp = ' . $results->is_smtp. "\n";125 echo 'is_verified = ' . $results->is_verified. "\n";126 echo 'is_server_down = ' . $results->is_server_down. "\n";127 echo 'is_greylisted = ' . $results->is_greylisted. "\n";128 echo 'is_disposable = ' . $results->is_disposable. "\n";129 echo 'is_suppressed = ' . $results->is_suppressed. "\n";130 echo 'is_role = ' . $results->is_role. "\n";131 echo 'is_high_risk = ' . $results->is_high_risk. "\n";132 echo 'is_catchall = ' . $results->is_catchall. "\n";121 echo 'is_free = ' . var_export($results->is_free, true) . "\n"; 122 echo 'is_syntax = ' . var_export($results->is_syntax, true) . "\n"; 123 echo 'is_domain = ' . var_export($results->is_domain, true) . "\n"; 124 echo 'is_smtp = ' . var_export($results->is_smtp, true) . "\n"; 125 echo 'is_verified = ' . var_export($results->is_verified, true) . "\n"; 126 echo 'is_server_down = ' . var_export($results->is_server_down, true) . "\n"; 127 echo 'is_greylisted = ' . var_export($results->is_greylisted, true) . "\n"; 128 echo 'is_disposable = ' . var_export($results->is_disposable, true) . "\n"; 129 echo 'is_suppressed = ' . var_export($results->is_suppressed, true) . "\n"; 130 echo 'is_role = ' . var_export($results->is_role, true) . "\n"; 131 echo 'is_high_risk = ' . var_export($results->is_high_risk, true) . "\n"; 132 echo 'is_catchall = ' . var_export($results->is_catchall, true) . "\n"; 133 133 echo 'mailboxvalidator_score = ' . $results->mailboxvalidator_score . "\n"; 134 134 echo 'time_taken = ' . $results->time_taken . "\n"; 135 echo 'status = ' . $results->status. "\n";135 echo 'status = ' . var_export($results->status, true) . "\n"; 136 136 echo 'credits_available = ' . $results->credits_available . "\n"; 137 137 } 138 138 else { 139 echo 'error_code = ' . $results->error _code . "\n";140 echo 'error_message = ' . $results->error _message . "\n";139 echo 'error_code = ' . $results->error->error_code . "\n"; 140 echo 'error_message = ' . $results->error->error_message . "\n"; 141 141 } 142 142 ?> … … 159 159 echo "Error connecting to API.\n"; 160 160 } 161 else if ( trim($results->error_code) === '') {161 else if (!isset($results->error)) { 162 162 echo 'email_address = ' . $results->email_address . "\n"; 163 echo 'is_disposable = ' . $results->is_disposable. "\n";163 echo 'is_disposable = ' . var_export($results->is_disposable, true) . "\n"; 164 164 echo 'credits_available = ' . $results->credits_available . "\n"; 165 165 } 166 166 else { 167 echo 'error_code = ' . $results->error _code . "\n";168 echo 'error_message = ' . $results->error _message . "\n";167 echo 'error_code = ' . $results->error->error_code . "\n"; 168 echo 'error_message = ' . $results->error->error_message . "\n"; 169 169 } 170 170 ?> … … 186 186 echo "Error connecting to API.\n"; 187 187 } 188 else if ( trim($results->error_code) === '') {188 else if (!isset($results->error)) { 189 189 echo 'email_address = ' . $results->email_address . "\n"; 190 echo 'is_free = ' . $results->is_free. "\n";190 echo 'is_free = ' . var_export($results->is_free, true) . "\n"; 191 191 echo 'credits_available = ' . $results->credits_available . "\n"; 192 192 } 193 193 else { 194 echo 'error_code = ' . $results->error _code . "\n";195 echo 'error_message = ' . $results->error _message . "\n";194 echo 'error_code = ' . $results->error->error_code . "\n"; 195 echo 'error_message = ' . $results->error->error_message . "\n"; 196 196 } 197 197 ?> … … 213 213 ========= 214 214 215 Copyright(C) 2018-202 0by MailboxValidator.com.215 Copyright(C) 2018-2023 by MailboxValidator.com. -
email-validator-for-contact-form-7/trunk/vendor/mailboxvalidator/mailboxvalidator-php/src/EmailValidation.php
r2455221 r2995586 5 5 { 6 6 private $apiKey = ''; 7 private $singleValidationApiUrl = 'https://api.mailboxvalidator.com/v 1/validation/single';8 private $disposableEmailApiUrl = 'https://api.mailboxvalidator.com/v 1/email/disposable';9 private $freeEmailApiUrl = 'https://api.mailboxvalidator.com/v 1/email/free';7 private $singleValidationApiUrl = 'https://api.mailboxvalidator.com/v2/validation/single'; 8 private $disposableEmailApiUrl = 'https://api.mailboxvalidator.com/v2/email/disposable'; 9 private $freeEmailApiUrl = 'https://api.mailboxvalidator.com/v2/email/free'; 10 10 11 11 public function __construct($key) … … 18 18 19 19 } 20 21 /* 22 * Custom wrapper function for CURL 23 */ 24 public function curl($url) { 25 // Initialize cURL session 26 $ch = curl_init(); 27 28 // Set cURL options 29 curl_setopt($ch, CURLOPT_URL, $url); 30 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the response as a string instead of outputting it 31 32 // Execute cURL session and store the response in a variable 33 $response = curl_exec($ch); 34 35 // Check for cURL errors 36 if (curl_errno($ch)) { 37 // echo 'cURL Error: ' . curl_error($ch); 38 return null; 39 } 40 41 // Close cURL session 42 curl_close($ch); 43 44 return $response; 45 } 20 46 21 47 /* … … 32 58 $params = implode('&', $params2); 33 59 34 $results = file_get_contents($this->singleValidationApiUrl . '?' . $params);60 $results = $this->curl($this->singleValidationApiUrl . '?' . $params); 35 61 36 62 if ($results !== false) { … … 43 69 return null; 44 70 } 71 // restore_error_handler(); 45 72 } 46 73 … … 58 85 $params = implode('&', $params2); 59 86 60 $results = file_get_contents($this->disposableEmailApiUrl . '?' . $params);87 $results = $this->curl($this->disposableEmailApiUrl . '?' . $params); 61 88 62 89 if ($results !== false) { … … 84 111 $params = implode('&', $params2); 85 112 86 $results = file_get_contents($this->freeEmailApiUrl . '?' . $params);113 $results = $this->curl($this->freeEmailApiUrl . '?' . $params); 87 114 88 115 if ($results !== false) { … … 96 123 } 97 124 } 125 126 /*private function () 127 { 128 set_error_handler( 129 function ($severity, $message, $file, $line) { 130 throw new ErrorException($message, $severity, $severity, $file, $line); 131 } 132 ); 133 }*/ 98 134 }
Note: See TracChangeset
for help on using the changeset viewer.