Skip to content

Commit

Permalink
[#884] Transform Special chars in Auction Title included in Email Body (
Browse files Browse the repository at this point in the history
  • Loading branch information
bd-viget authored Apr 8, 2024
1 parent 1796d92 commit 52fc0ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function trigger( mixed $object = null, ?int $user_id = null ): void {
// Woohoo, send the email!
$this->send(
$this->get_recipient(),
goodbids()->utilities->sanitize_email_subject( $this->get_subject() ),
goodbids()->utilities->sanitize_email_special_chars( $this->get_subject() ),
$this->get_content(),
$this->get_headers(),
$this->get_attachments()
Expand Down Expand Up @@ -442,7 +442,7 @@ private function default_placeholders(): void {
$auction_title = $auction?->get_title() ?: '';
$this->add_placeholder( '{auction.url}', $auction?->get_url() );
$this->add_placeholder( '{auction.admin_url}', get_edit_post_link( $auction?->get_id() ) );
$this->add_placeholder( '{auction.title}', htmlspecialchars( $auction_title ) );
$this->add_placeholder( '{auction.title}', goodbids()->utilities->sanitize_email_special_chars( $auction_title ) );
$this->add_placeholder( '{auction.start_date_time}', $auction?->get_start_date_time( $datetime_format ) );
$this->add_placeholder( '{auction.end_date_time}', $auction?->get_end_date_time( $datetime_format ) );

Expand Down
10 changes: 5 additions & 5 deletions client-mu-plugins/goodbids/src/classes/Utilities/Utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,16 @@ public function network_get_current_blog_id(): int {
}

/**
* Sanitize Special Characters from Email Subject
* Sanitize Special Characters in Emails
*
* @since 1.0.1
*
* @param string $subject
* @param string $string
*
* @return string
*/
public function sanitize_email_subject( string $subject ): string {
$subject = htmlspecialchars_decode( $subject );
return html_entity_decode( $subject );
public function sanitize_email_special_chars( string $string ): string {
$string = htmlspecialchars_decode( $string );
return html_entity_decode( $string );
}
}

0 comments on commit 52fc0ef

Please sign in to comment.