← All changes
|
includes/emails/class-charitable-email-password-reset.php
+45
-30
1.6.8
→
1.8.13
View file →
| @@ -1,16 +1,19 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Class that models the Password Reset email. |
| 4 | 4 | * |
| 5 | - * @version 1.4.0 | |
| 6 | - * @package Charitable/Classes/Charitable_Email_Password_Reset | |
| 7 | - * @author Eric Daams | |
| 8 | - * @copyright Copyright (c) 2019, Studio 164a | |
| 9 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | |
| 5 | + * @package Charitable/Classes/Charitable_Email_Password_Reset | |
| 6 | + * @author David Bisset | |
| 7 | + * @copyright Copyright (c) 2023, WP Charitable LLC | |
| 8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | |
| 9 | + * @since 1.4.0 | |
| 10 | + * @version 1.6.37 | |
| 10 | 11 | */ |
| 11 | 12 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { exit; } | |
| 13 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | + exit; | |
| 15 | +} | |
| 13 | 16 | |
| 14 | 17 | if ( ! class_exists( 'Charitable_Email_Password_Reset' ) ) : |
| 15 | 18 | |
| 16 | 19 | /** |
| @@ -19,9 +22,9 @@ | ||
| 19 | 22 | * @since 1.4.0 |
| 20 | 23 | */ |
| 21 | 24 | class Charitable_Email_Password_Reset extends Charitable_Email { |
| 22 | 25 | |
| 23 | - /* @var string */ | |
| 26 | + /** Email ID */ | |
| 24 | 27 | const ID = 'password_reset'; |
| 25 | 28 | |
| 26 | 29 | /** |
| 27 | 30 | * Whether the email allows you to define the email recipients. |
| @@ -102,14 +105,14 @@ | ||
| 102 | 105 | return self::ID; |
| 103 | 106 | } |
| 104 | 107 | |
| 105 | 108 | /** |
| 106 | - * Return the recipient for the email. | |
| 107 | - * | |
| 108 | - * @since 1.4.0 | |
| 109 | - * | |
| 110 | - * @return string | |
| 111 | - */ | |
| 109 | + * Return the recipient for the email. | |
| 110 | + * | |
| 111 | + * @since 1.4.0 | |
| 112 | + * | |
| 113 | + * @return string | |
| 114 | + */ | |
| 112 | 115 | public function get_recipient() { |
| 113 | 116 | return $this->has_valid_user() ? $this->user->user_email : ''; |
| 114 | 117 | } |
| 115 | 118 | |
| @@ -128,19 +131,25 @@ | ||
| 128 | 131 | |
| 129 | 132 | $fields = array( |
| 130 | 133 | 'reset_link' => array( |
| 131 | 134 | 'description' => __( 'The link the user needs to click to reset their password', 'charitable' ), |
| 132 | - 'preview' => add_query_arg( array( | |
| 133 | - 'key' => '123123123', | |
| 134 | - 'login' => 'adam123', | |
| 135 | - ), charitable_get_permalink( 'reset_password_page' ) ), | |
| 135 | + 'preview' => add_query_arg( | |
| 136 | + array( | |
| 137 | + 'key' => '123123123', | |
| 138 | + 'login' => 'adam123', | |
| 139 | + ), | |
| 140 | + charitable_get_permalink( 'reset_password_page' ) | |
| 141 | + ), | |
| 136 | 142 | ), |
| 137 | 143 | ); |
| 138 | 144 | |
| 139 | 145 | if ( $this->has_valid_user() ) { |
| 140 | - $fields = array_merge_recursive( $fields, array( | |
| 141 | - 'reset_link' => array( 'callback' => array( $this, 'get_reset_link' ) ), | |
| 142 | - ) ); | |
| 146 | + $fields = array_merge_recursive( | |
| 147 | + $fields, | |
| 148 | + array( | |
| 149 | + 'reset_link' => array( 'callback' => array( $this, 'get_reset_link' ) ), | |
| 150 | + ) | |
| 151 | + ); | |
| 143 | 152 | } |
| 144 | 153 | |
| 145 | 154 | return $fields; |
| 146 | 155 | } |
| @@ -160,12 +169,18 @@ | ||
| 160 | 169 | if ( is_wp_error( $key ) ) { |
| 161 | 170 | return $key; |
| 162 | 171 | } |
| 163 | 172 | |
| 164 | - $this->reset_link = esc_url_raw( add_query_arg( array( | |
| 165 | - 'key' => $key, | |
| 166 | - 'login' => rawurlencode( $this->user->user_login ), | |
| 167 | - ), $base_url ) ); | |
| 173 | + $this->reset_link = esc_url_raw( | |
| 174 | + add_query_arg( | |
| 175 | + array( | |
| 176 | + 'key' => $key, | |
| 177 | + 'login' => rawurlencode( $this->user->user_login ), | |
| 178 | + 'charitable' => true, | |
| 179 | + ), | |
| 180 | + $base_url | |
| 181 | + ) | |
| 182 | + ); | |
| 168 | 183 | } |
| 169 | 184 | |
| 170 | 185 | return $this->reset_link; |
| 171 | 186 | } |
| @@ -208,15 +223,15 @@ | ||
| 208 | 223 | * @return string |
| 209 | 224 | */ |
| 210 | 225 | protected function get_default_body() { |
| 211 | 226 | ob_start(); |
| 212 | -?> | |
| 213 | -<p><?php _e( 'Someone requested that the password be reset for the following account:', 'charitable' ) ?></p> | |
| 214 | -<p><?php _e( 'Username: [charitable_email show=user_login]', 'charitable' ) ?></p> | |
| 215 | -<p><?php _e( 'If this was a mistake, just ignore this email and nothing will happen.', 'charitable' ) ?></p> | |
| 216 | -<p><?php _e( 'To reset your password, visit the following address:', 'charitable' ) ?></p> | |
| 227 | + ?> | |
| 228 | +<p><?php esc_html_e( 'Someone requested that the password be reset for the following account:', 'charitable' ); ?></p> | |
| 229 | +<p><?php esc_html_e( 'Username: [charitable_email show=user_login]', 'charitable' ); ?></p> | |
| 230 | +<p><?php esc_html_e( 'If this was a mistake, just ignore this email and nothing will happen.', 'charitable' ); ?></p> | |
| 231 | +<p><?php esc_html_e( 'To reset your password, visit the following address:', 'charitable' ); ?></p> | |
| 217 | 232 | <p><a href="[charitable_email show=reset_link]">[charitable_email show=reset_link]</a></p> |
| 218 | -<?php | |
| 233 | + <?php | |
| 219 | 234 | /** |
| 220 | 235 | * Filter the default email body. |
| 221 | 236 | * |
| 222 | 237 | * @since 1.4.0 |