Skip to content

Commit

Permalink
Escape localized strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
schlessera committed Feb 13, 2017
1 parent 2e08e8a commit 02b87e9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
50 changes: 25 additions & 25 deletions antispam_bee.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,16 +387,16 @@ private static function _init_internal_vars()
'ignore_reasons' => array(),
),
'reasons' => array(
'css' => __( 'CSS Hack', 'antispam-bee' ),
'time' => __( 'Comment time', 'antispam-bee' ),
'empty' => __( 'Empty Data', 'antispam-bee' ),
'server' => __( 'Fake IP', 'antispam-bee' ),

This comment has been minimized.

Copy link
@schlessera

schlessera Feb 13, 2017

Author Contributor

Note for our futures selves: Only use tabs for indentation, not for aligning things.

'localdb' => __( 'Local DB Spam', 'antispam-bee' ),
'country' => __( 'Country Check', 'antispam-bee' ),
'dnsbl' => __( 'Public Antispam DB', 'antispam-bee' ),
'bbcode' => __( 'BBCode', 'antispam-bee' ),
'lang' => __( 'Comment Language', 'antispam-bee' ),
'regexp' => __( 'Regular Expression', 'antispam-bee' ),
'css' => esc_attr__( 'CSS Hack', 'antispam-bee' ),
'time' => esc_attr__( 'Comment time', 'antispam-bee' ),
'empty' => esc_attr__( 'Empty Data', 'antispam-bee' ),
'server' => esc_attr__( 'Fake IP', 'antispam-bee' ),
'localdb' => esc_attr__( 'Local DB Spam', 'antispam-bee' ),
'country' => esc_attr__( 'Country Check', 'antispam-bee' ),
'dnsbl' => esc_attr__( 'Public Antispam DB', 'antispam-bee' ),
'bbcode' => esc_attr__( 'BBCode', 'antispam-bee' ),
'lang' => esc_attr__( 'Comment Language', 'antispam-bee' ),
'regexp' => esc_attr__( 'Regular Expression', 'antispam-bee' ),
)
);
}
Expand Down Expand Up @@ -499,7 +499,7 @@ public static function init_action_links($data)
),
admin_url('options-general.php')
),
__('Settings', 'antispam-bee')
esc_attr__('Settings', 'antispam-bee')
)
)
);
Expand Down Expand Up @@ -2417,70 +2417,70 @@ public static function send_mail_notification($id)
ENT_QUOTES
)
),
__('Comment marked as spam', 'antispam-bee')
esc_html__('Comment marked as spam', 'antispam-bee')
);

// Content
if ( !$content = strip_tags(stripslashes($comment['comment_content'])) ) {
$content = sprintf(
'-- %s --',
__('Content removed by Antispam Bee', 'antispam-bee')
esc_html__('Content removed by Antispam Bee', 'antispam-bee')
);
}

// Body
$body = sprintf(
"%s \"%s\"\r\n\r\n",
__('New spam comment on your post', 'antispam-bee'),
esc_html__('New spam comment on your post', 'antispam-bee'),
strip_tags($post->post_title)
).sprintf(
"%s: %s\r\n",
__('Author', 'antispam-bee'),
esc_html__('Author', 'antispam-bee'),
( empty($comment['comment_author']) ? '' : strip_tags($comment['comment_author']) )
).sprintf(
"URL: %s\r\n",
// empty check exists
esc_url($comment['comment_author_url'])
).sprintf(
"%s: %s\r\n",
__('Type', 'antispam-bee'),
__( ( empty($comment['comment_type']) ? 'Comment' : 'Trackback' ), 'antispam-bee' )
esc_html__('Type', 'antispam-bee'),
esc_html__( ( empty($comment['comment_type']) ? 'Comment' : 'Trackback' ), 'antispam-bee' )
).sprintf(
"Whois: http://whois.arin.net/rest/ip/%s\r\n",
$comment['comment_author_IP']
).sprintf(
"%s: %s\r\n\r\n",
__('Spam Reason', 'antispam-bee'),
__(self::$defaults['reasons'][self::$_reason], 'antispam-bee')
esc_html__('Spam Reason', 'antispam-bee'),
esc_html__(self::$defaults['reasons'][self::$_reason], 'antispam-bee')
).sprintf(
"%s\r\n\r\n\r\n",
$content
).(
EMPTY_TRASH_DAYS ? (
sprintf(
"%s: %s\r\n",
__('Trash it', 'antispam-bee'),
esc_html__('Trash it', 'antispam-bee'),
admin_url('comment.php?action=trash&c=' .$id)
)
) : (
sprintf(
"%s: %s\r\n",
__('Delete it', 'antispam-bee'),
esc_html__('Delete it', 'antispam-bee'),
admin_url('comment.php?action=delete&c=' .$id)
)
)
).sprintf(
"%s: %s\r\n",
__('Approve it', 'antispam-bee'),
esc_html__('Approve it', 'antispam-bee'),
admin_url('comment.php?action=approve&c=' .$id)
).sprintf(
"%s: %s\r\n\r\n",
__('Spam list', 'antispam-bee'),
esc_html__('Spam list', 'antispam-bee'),
admin_url('edit-comments.php?comment_status=spam')
).sprintf(
"%s\r\n%s\r\n",
__('Notify message by Antispam Bee', 'antispam-bee'),
__('http://antispambee.com', 'antispam-bee')
esc_html__('Notify message by Antispam Bee', 'antispam-bee'),
esc_html__('http://antispambee.com', 'antispam-bee')
);

// Send
Expand Down
20 changes: 10 additions & 10 deletions inc/gui.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public static function save_changes()
{
// No POST?
if ( empty($_POST) ) {
wp_die(__('Cheatin’ uh?', 'antispam-bee'));
wp_die(esc_html__('Cheatin’ uh?', 'antispam-bee'));
}

// Capability check
if ( ! current_user_can('manage_options') ) {
wp_die(__('Cheatin’ uh?', 'antispam-bee'));
wp_die(esc_html__('Cheatin’ uh?', 'antispam-bee'));
}

// Check referer
Expand Down Expand Up @@ -226,7 +226,7 @@ public static function options_page() { ?>
);
printf(
/* translators: 1: opening <a> tag with link to documentation. 2: closing </a> tag */
__( 'Check if commenter has a Gravatar image. Please note the %1$ssprivacy notice%2$s for this option.', 'antispam-bee' ),
esc_html__( 'Check if commenter has a Gravatar image. Please note the %1$ssprivacy notice%2$s for this option.', 'antispam-bee' ),
$link1,
'</a>'
); ?></span>
Expand Down Expand Up @@ -284,7 +284,7 @@ public static function options_page() { ?>
);
printf(
/* translators: 1: opening <a> tag with link to documentation. 2: closing </a> tag. 3: opening <a> tag with link to documentation. 4: closing </a> tag. */
__( 'Matching the ip address with %1$sStop Forum Spam%2$s. Please note the %3$sprivacy notice%4$s for this option.', 'antispam-bee' ),
esc_html__( 'Matching the ip address with %1$sStop Forum Spam%2$s. Please note the %3$sprivacy notice%4$s for this option.', 'antispam-bee' ),
'<a href="https://www.stopforumspam.com/" target="_blank" rel="noopener noreferrer">',
'</a>',
$link2,
Expand All @@ -305,7 +305,7 @@ public static function options_page() { ?>
);
printf(
/* translators: 1: opening <a> tag with link to documentation. 2: closing </a> tag. */
__( 'Filtering the requests depending on country. Please note the %1$sprivacy notice%2$s for this option.', 'antispam-bee' ),
esc_html__( 'Filtering the requests depending on country. Please note the %1$sprivacy notice%2$s for this option.', 'antispam-bee' ),
$link1, '</a>'
); ?></span>
</label>
Expand All @@ -322,7 +322,7 @@ public static function options_page() { ?>
<span><?php
printf(
/* translators: 1: opening <a> tag with link to ISO codes reference. 2: closing </a> tag. */
__( 'Blacklist %1$sISO Codes%2$s for this option.', 'antispam-bee' ),
esc_html__( 'Blacklist %1$sISO Codes%2$s for this option.', 'antispam-bee' ),
$iso_codes_link,
'</a>' );
?></span>
Expand All @@ -334,7 +334,7 @@ public static function options_page() { ?>
<span><?php
printf(
/* translators: 1: opening <a> tag with link to ISO codes reference. 2: closing </a> tag. */
__( 'Whitelist %1$sISO Codes%2$s for this option.', 'antispam-bee' ),
esc_html__( 'Whitelist %1$sISO Codes%2$s for this option.', 'antispam-bee' ),
$iso_codes_link,
'</a>' );
?></span>
Expand All @@ -356,7 +356,7 @@ public static function options_page() { ?>

printf(
/* translators: 1: opening <a> tag with link to documentation. 2: closing </a> tag. */
__( 'Detect and approve only the specified language. Please note the %1$sprivacy notice%2$s for this option.', 'antispam-bee' ),
esc_html__( 'Detect and approve only the specified language. Please note the %1$sprivacy notice%2$s for this option.', 'antispam-bee' ),
$link1,
'</a>' );
?></span>
Expand Down Expand Up @@ -431,8 +431,8 @@ public static function options_page() { ?>
self::_build_select(
'ab_ignore_type',
array(
1 => __( 'Comments', 'antispam-bee' ),
2 => __( 'Pings', 'antispam-bee' )
1 => esc_attr__( 'Comments', 'antispam-bee' ),
2 => esc_attr__( 'Pings', 'antispam-bee' )
),
$options['ignore_type']
)
Expand Down

0 comments on commit 02b87e9

Please sign in to comment.