Skip to content

Commit

Permalink
use printf() instead of echo sprintf()
Browse files Browse the repository at this point in the history
... and fix some whitespace/newline warnings.
  • Loading branch information
stklcode committed Mar 6, 2024
1 parent 3db9aeb commit f3cfa37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 3 additions & 5 deletions antispam_bee.php
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ public static function show_spam_chart() {
$items = (array) self::get_option( 'daily_stats' );

if ( empty( $items ) ) {
echo sprintf(
printf(
'<div id="ab_chart"><p>%s</p></div>',
esc_html__( 'No data available.', 'antispam-bee' )
);
Expand Down Expand Up @@ -2736,7 +2736,7 @@ private static function _update_daily_stats() {

// Count up.
if ( array_key_exists( $today, $stats ) ) {
$stats[ $today ] ++;
$stats[ $today ]++;
} else {
$stats[ $today ] = 1;
}
Expand Down Expand Up @@ -2778,7 +2778,6 @@ public static function get_secret_name_for_post( $post_id ) {
(int) $post_id,
(bool) self::get_option( 'always_allowed' )
);

}

/**
Expand Down Expand Up @@ -2915,10 +2914,9 @@ public static function update_database() {
* @return bool
*/
private static function db_version_is_current() {

$current_version = floatval( get_option( 'antispambee_db_version', 0 ) );
return $current_version === self::$db_version;

return $current_version === self::$db_version;
}

/**
Expand Down
7 changes: 4 additions & 3 deletions inc/gui.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ private static function _build_select( $name, $data, $selected ) {
* @since 2.7.0
* @since 2.10.0 Change documentation links, change country option name, and add option to parse complete markup for comment forms
*/
public static function options_page() { ?>
public static function options_page() {
?>
<div class="wrap" id="ab_main">
<h2>
Antispam Bee
Expand Down Expand Up @@ -403,7 +404,7 @@ public static function options_page() { ?>
<input type="checkbox" name="ab_cronjob_enable" id="ab_cronjob_enable" value="1" <?php checked( $options['cronjob_enable'], 1 ); ?> />
<label for="ab_cronjob_enable">
<?php
echo sprintf(
printf(
// translators: $s is an input field containing the number of days.
esc_html__( 'Delete existing spam after %s days', 'antispam-bee' ),
'<input type="number" min="0" name="ab_cronjob_interval" value="' . esc_attr( $options['cronjob_interval'] ) . '" class="ab-mini-field" />'
Expand All @@ -417,7 +418,7 @@ public static function options_page() { ?>
<input type="checkbox" name="ab_ignore_filter" id="ab_ignore_filter" value="1" <?php checked( $options['ignore_filter'], 1 ); ?> />
<label for="ab_ignore_filter">
<?php
echo sprintf(
printf(
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
// Output gets escaped in _build_select()
// translators: %s is the select field.
Expand Down

0 comments on commit f3cfa37

Please sign in to comment.