| @@ -28,8 +28,12 @@ | ||
| 28 | 28 | * @property $heading |
| 29 | 29 | * |
| 30 | 30 | * @since 1.0 |
| 31 | 31 | */ |
| 32 | +// __set() accepts any key, so keys without a declared property become dynamic ones. PHP 8.2 deprecates | |
| 33 | +// those, and the notice is printed mid-request, which breaks any redirect that follows. | |
| 34 | +// PHP 7.4 reads this line as a comment, so it is safe on the minimum supported version. | |
| 35 | +#[AllowDynamicProperties] | |
| 32 | 36 | class Give_Emails { |
| 33 | 37 | |
| 34 | 38 | /** |
| 35 | 39 | * Holds the from address. |
| @@ -154,9 +158,9 @@ | ||
| 154 | 158 | * |
| 155 | 159 | * @since 1.0 |
| 156 | 160 | */ |
| 157 | 161 | public function get_content_type() { |
| 158 | - if ( ! $this->content_type ) { | |
| 162 | + if ( ! $this->content_type ) { | |
| 159 | 163 | $this->content_type = $this->html |
| 160 | 164 | ? apply_filters( 'give_email_default_content_type', 'text/html', $this ) |
| 161 | 165 | : 'text/plain'; |
| 162 | 166 | } |
| @@ -170,9 +174,9 @@ | ||
| 170 | 174 | * @since 1.0 |
| 171 | 175 | */ |
| 172 | 176 | public function get_headers() { |
| 173 | 177 | if ( ! $this->headers ) { |
| 174 | - $this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n"; | |
| 178 | + $this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n"; | |
| 175 | 179 | $this->headers .= "Reply-To: {$this->get_from_address()}\r\n"; |
| 176 | 180 | $this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n"; |
| 177 | 181 | } |
| 178 | 182 | |
| @@ -186,9 +190,9 @@ | ||
| 186 | 190 | */ |
| 187 | 191 | public function get_templates() { |
| 188 | 192 | $templates = array( |
| 189 | 193 | 'default' => esc_html__( 'Default Template', 'give' ), |
| 190 | - 'none' => esc_html__( 'No template, plain text only', 'give' ) | |
| 194 | + 'none' => esc_html__( 'No template, plain text only', 'give' ), | |
| 191 | 195 | ); |
| 192 | 196 | |
| 193 | 197 | return apply_filters( 'give_email_templates', $templates ); |
| 194 | 198 | } |
| @@ -303,9 +307,9 @@ | ||
| 303 | 307 | * @param Give_Emails $this The email object. |
| 304 | 308 | */ |
| 305 | 309 | do_action( 'give_email_footer', $this ); |
| 306 | 310 | |
| 307 | - $body = ob_get_clean(); | |
| 311 | + $body = ob_get_clean(); | |
| 308 | 312 | |
| 309 | 313 | // Email tag. |
| 310 | 314 | $message = str_replace( '{email}', $message, $body ); |
| 311 | 315 | |
| @@ -318,9 +322,9 @@ | ||
| 318 | 322 | get_bloginfo( 'name' ) |
| 319 | 323 | ); |
| 320 | 324 | } |
| 321 | 325 | |
| 322 | - $message = str_replace( '{email_logo}', $header_img, $message ); | |
| 326 | + $message = str_replace( '{email_logo}', $header_img, $message ); | |
| 323 | 327 | |
| 324 | 328 | return apply_filters( 'give_email_message', $message, $this ); |
| 325 | 329 | } |
| 326 | 330 | |
| @@ -336,9 +340,9 @@ | ||
| 336 | 340 | */ |
| 337 | 341 | public function send( $to, $subject, $message, $attachments = '' ) { |
| 338 | 342 | |
| 339 | 343 | if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) { |
| 340 | - give_doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null ); | |
| 344 | + give_doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ) ); | |
| 341 | 345 | |
| 342 | 346 | return false; |
| 343 | 347 | } |
| 344 | 348 | |
| @@ -394,12 +398,12 @@ | ||
| 394 | 398 | remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
| 395 | 399 | remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
| 396 | 400 | |
| 397 | 401 | // Reset email related params. |
| 398 | - $this->heading = ''; | |
| 399 | - $this->from_name = ''; | |
| 402 | + $this->heading = ''; | |
| 403 | + $this->from_name = ''; | |
| 400 | 404 | $this->from_address = ''; |
| 401 | - $this->form_id = 0; | |
| 405 | + $this->form_id = 0; | |
| 402 | 406 | } |
| 403 | 407 | |
| 404 | 408 | /** |
| 405 | 409 | * Converts text to formatted HTML. This is primarily for turning line breaks into <p> and <br/> tags. |