Changeset 3431943
- Timestamp:
- 01/04/2026 04:50:34 AM (2 weeks ago)
- File:
-
- 1 edited
-
pinnys-simple-smtp/trunk/pinnys-simple-smtp.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pinnys-simple-smtp/trunk/pinnys-simple-smtp.php
r3430827 r3431943 63 63 add_action('admin_init', [$this, 'handle_test_email']); 64 64 add_action('phpmailer_init', [$this, 'configure_smtp']); 65 add_filter('pre_update_option_pinnys_smtp_password', [$this, 'pre_update_password'], 10, 2); 65 66 } 66 67 … … 84 85 register_setting(PINNYS_SMTP_GROUP, 'pinnys_smtp_from_email', 'sanitize_email'); 85 86 register_setting(PINNYS_SMTP_GROUP, 'pinnys_smtp_from_name', 'sanitize_text_field'); 86 87 register_setting(PINNYS_SMTP_GROUP, 'pinnys_smtp_password', [ 88 'sanitize_callback' => [$this, 'process_password_save'] 89 ]); 90 } 91 92 public function process_password_save($input) { 93 if (empty($input)) { 94 return get_option('pinnys_smtp_password'); 95 } 96 return pinnys_smtp_encrypt($input); 87 register_setting(PINNYS_SMTP_GROUP, 'pinnys_smtp_password'); 88 } 89 90 public function pre_update_password($new_value, $old_value) { 91 $new = trim((string) $new_value); 92 93 if ($new === '') { 94 return $old_value; 95 } 96 97 $encrypted = pinnys_smtp_encrypt($new); 98 return ($encrypted !== false && $encrypted !== '') ? $encrypted : $old_value; 97 99 } 98 100 99 101 public function handle_test_email() { 100 // Strict Page Check101 102 if (!isset($_GET['page']) || $_GET['page'] !== PINNYS_SMTP_SLUG) { 102 103 return;
Note: See TracChangeset
for help on using the changeset viewer.