Skip to content

Commit 35f8c57

Browse files
committed
Decodes plugin titles in email subjects and bodies
Props nimeshatxecurify. Closes #606. Fixes #8231. git-svn-id: https://meta.svn.wordpress.org/sites/trunk@14818 74240141-8908-4e6f-9713-ba540dce6ec7
1 parent 870a792 commit 35f8c57

10 files changed

Lines changed: 23 additions & 16 deletions

wordpress.org/public_html/wp-content/plugins/plugin-directory/email/class-base.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ public function get_email_signature() {
162162
https://make.wordpress.org/plugins', 'wporg-plugins' );
163163
}
164164

165+
/**
166+
* Return the plugin's title with HTML entities decoded for plain-text use (e.g., email subjects).
167+
*/
168+
protected function plugin_title() {
169+
return html_entity_decode( $this->plugin->post_title, ENT_QUOTES | ENT_HTML5, 'UTF-8' );
170+
}
171+
165172
/**
166173
* A simple way to convert a WP_User object to a displayable username.
167174
* This shouldn't be needed, but unfortunately often is on WordPress.org.

wordpress.org/public_html/wp-content/plugins/plugin-directory/email/class-committer-added.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function subject() {
2222
return sprintf(
2323
/* translators: 1: Plugin Name */
2424
__( 'New committer added to %s', 'wporg-plugins' ),
25-
$this->plugin->post_title
25+
$this->plugin_title()
2626
);
2727
}
2828

@@ -52,7 +52,7 @@ function body() {
5252
$email_text,
5353
$this->user_text( $this->user ),
5454
$this->user_text( $this->args['committer'] ),
55-
$this->plugin->post_title,
55+
$this->plugin_title(),
5656
$this->user_text( $this->who ),
5757
$committer_list,
5858
$advanced_url,

wordpress.org/public_html/wp-content/plugins/plugin-directory/email/class-generic-to-committers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function body() {
4848

4949
private function replace_placeholders( $text ) {
5050
$items = [
51-
'###PLUGIN###' => $this->plugin->post_title,
51+
'###PLUGIN###' => $this->plugin_title(),
5252
'###URL###' => get_permalink( $this->plugin ),
5353
'###SLUG###' => $this->plugin->post_name,
5454
'###USER###' => $this->user_text( $this->user ),

wordpress.org/public_html/wp-content/plugins/plugin-directory/email/class-plugin-approved.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function subject() {
1010
return sprintf(
1111
/* translators: 1: Plugin Name */
1212
__( '%s has been approved!', 'wporg-plugins' ),
13-
$this->plugin->post_title
13+
$this->plugin_title()
1414
);
1515
}
1616

@@ -66,7 +66,7 @@ function markdown() {
6666

6767
return sprintf(
6868
$email_text,
69-
$this->plugin->post_title,
69+
$this->plugin_title(),
7070
$this->user->user_login,
7171
$this->plugin->post_name,
7272
"https://profiles.wordpress.org/{$this->user->user_nicename}/profile/edit/group/3/?screen=svn-password"

wordpress.org/public_html/wp-content/plugins/plugin-directory/email/class-plugin-rejected.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ function subject() {
1212
return sprintf(
1313
/* translators: 1: Plugin Name */
1414
__( '%s has been rejected', 'wporg-plugins' ),
15-
$this->plugin->post_title
15+
$this->plugin_title()
1616
);
1717
}
1818

1919
function markdown() {
2020
$placeholders = [
2121
// Should be first, to allow placeholders in the rejection reasons too.
2222
'###REASON###' => $this->get_rejection_reason(),
23-
'###NAME###' => $this->plugin->post_title,
23+
'###NAME###' => $this->plugin_title(),
2424
'###SLUG###' => ( $this->args['slug'] ?? '' ) ?: $this->plugin->post_name,
2525
'###SUBMISSION_DATE###' => $this->args['submission_date'],
2626
];

wordpress.org/public_html/wp-content/plugins/plugin-directory/email/class-plugin-submission.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function subject() {
99
return sprintf(
1010
/* translators: 1: Plugin Name */
1111
__( 'Successful Plugin Submission - %s', 'wporg-plugins' ),
12-
$this->plugin->post_title
12+
$this->plugin_title()
1313
);
1414
}
1515

@@ -19,7 +19,7 @@ function subject() {
1919
public function markdown() {
2020

2121
$placeholders = [
22-
'###NAME###' => $this->plugin->post_title,
22+
'###NAME###' => $this->plugin_title(),
2323
'###SLUG###' => $this->plugin->post_name,
2424
];
2525

wordpress.org/public_html/wp-content/plugins/plugin-directory/email/class-plugin-transferred.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function subject() {
1010
return sprintf(
1111
/* translators: 1: Plugin Name */
1212
__( '%s has been transferred', 'wporg-plugins' ),
13-
$this->plugin->post_title
13+
$this->plugin_title()
1414
);
1515
}
1616

@@ -24,7 +24,7 @@ function body() {
2424
$email_text,
2525
$this->user_text( wp_get_current_user() ),
2626
gmdate( 'Y-m-d H:i:s \G\M\T' ),
27-
$this->plugin->post_title,
27+
$this->plugin_title(),
2828
$this->user_text( $this->args['owner'] ) . ' (' . $this->args['owner']->user_login . ')',
2929
PLUGIN_TEAM_EMAIL
3030
);

wordpress.org/public_html/wp-content/plugins/plugin-directory/email/class-release-confirmation-enabled.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function subject() {
1010
return sprintf(
1111
/* translators: 1: Plugin Name */
1212
__( 'Release confirmation now required for %s', 'wporg-plugins' ),
13-
$this->plugin->post_title
13+
$this->plugin_title()
1414
);
1515
}
1616

@@ -31,7 +31,7 @@ function body() {
3131
%6$s', 'wporg-plugins' ),
3232
$this->user_text( $this->user ),
3333
$this->user_text( $this->who ),
34-
$this->plugin->post_title,
34+
$this->plugin_title(),
3535
get_permalink( $this->plugin ),
3636
$this->plugin->post_name,
3737
'https://developer.wordpress.org/plugins/wordpress-org/release-confirmation-emails/'

wordpress.org/public_html/wp-content/plugins/plugin-directory/email/class-release-confirmation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function subject() {
1515
return sprintf(
1616
/* translators: 1: Plugin Name */
1717
__( 'Pending release for %s', 'wporg-plugins' ),
18-
$this->plugin->post_title
18+
$this->plugin_title()
1919
);
2020
}
2121

wordpress.org/public_html/wp-content/plugins/plugin-directory/email/class-support-rep-added.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function subject() {
1010
return sprintf(
1111
/* translators: 1: Plugin Name */
1212
__( 'New support rep added to %s', 'wporg-plugins' ),
13-
$this->plugin->post_title
13+
$this->plugin_title()
1414
);
1515
}
1616

@@ -40,7 +40,7 @@ function body() {
4040
$email_text,
4141
$this->user_text( $this->user ),
4242
$this->user_text( $this->args['rep'] ),
43-
$this->plugin->post_title,
43+
$this->plugin_title(),
4444
$this->user_text( $this->who ),
4545
$rep_list,
4646
$advanced_url,

0 commit comments

Comments
 (0)