Plugin Directory

Changeset 2928208


Ignore:
Timestamp:
06/19/2023 07:17:32 PM (3 years ago)
Author:
stephdau
Message:

Akismet: preparing the 5.2 release:

  • Visual refresh of Akismet stats.
  • Improve PHP 8.1 compatibility.
  • Improve appearance of plugin to match updated stats.
  • Change minimum supported PHP version to 5.6 to match WordPress.
  • Drop IE11 support and update minimum WordPress version to 5.8 (where IE11 support was removed from WP Core).
Location:
akismet/trunk
Files:
8 added
12 edited

Legend:

Unmodified
Added
Removed
  • akismet/trunk/.htaccess

    r2761923 r2928208  
    1313
    1414# Akismet CSS and JS
    15 <FilesMatch "^(form\.js|akismet\.js|akismet-frontend\.js|akismet\.css)$">
     15<FilesMatch "^(form\.js|akismet(-frontend|-admin)?\.js|akismet(-admin)?(-rtl)?\.css|inter\.css)$">
    1616    <IfModule !mod_authz_core.c>
    1717        Allow from all
     
    2424
    2525# Akismet images
    26 <FilesMatch "^logo-(a|full)-2x\.png$">
     26<FilesMatch "^(logo-(a|full)-2x\.png|akismet-refresh-logo\.svg|akismet-refresh-logo@2x\.png|arrow-left\.svg)$">
    2727    <IfModule !mod_authz_core.c>
    2828        Allow from all
  • akismet/trunk/_inc/akismet.css

    r2592940 r2928208  
    111111}
    112112
    113 .akismet-alert.akismet-critical {
    114     background-color: #993300;
    115 }
    116 
    117 .akismet-alert.akismet-active {
    118     background-color: #649316;
    119 }
    120 
    121113.akismet-alert p.akismet-key-status {
    122114    font-size: 24px;
     
    139131.akismet-new-snapshot {
    140132    margin-top: 1em;
    141     padding: 1em;
    142133    text-align: center;
    143134    background: #fff;
     
    149140    font-size: 11px;
    150141    margin: 0;
    151     padding: 3px;
    152142}
    153143
     
    159149.akismet-new-snapshot ul li {
    160150    color: #999;
    161     float: left;
    162151    font-size: 11px;
    163     padding: 0 20px;
    164152    text-transform: uppercase;
    165     width: 33%;
    166153    box-sizing: border-box;
    167154    -moz-box-sizing: border-box;
     
    170157}
    171158
    172 .akismet-new-snapshot ul li:first-child,
    173 .akismet-new-snapshot ul li:nth-child(2) {
    174     border-right:1px dotted #ccc;
    175 }
    176 
    177 .akismet-new-snapshot ul li span {
    178     color: #52accc;
     159.akismet-new-snapshot__number {
    179160    display: block;
    180161    font-size: 32px;
     
    191172    vertical-align: middle;
    192173    padding-top: 0;
    193 }
    194 
    195 .akismet-settings input[type=text] {
    196     width: 75%;
    197174}
    198175
     
    360337    padding:.3125rem 0 0
    361338}
    362 .akismet-masthead__logo {
    363     width:10.375rem;
    364     height:1.8125rem;
    365 }
    366339.akismet-masthead__logo-link {
    367340    display:inline-block;
     
    449422    margin-bottom: 0;
    450423    position: relative;
    451     margin: 0 auto 0.625rem auto;
    452424    box-sizing: border-box;
    453425    background: white;
    454     box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
    455426}
    456427
  • akismet/trunk/akismet.php

    r2894240 r2928208  
    77Plugin URI: https://akismet.com/
    88Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. Akismet anti spam keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key.
    9 Version: 5.1
    10 Requires at least: 5.0
    11 Requires PHP: 5.2
     9Version: 5.2b
     10Requires at least: 5.8
     11Requires PHP: 5.6.20
    1212Author: Automattic - Anti Spam Team
    1313Author URI: https://automattic.com/wordpress-plugins/
     
    4040}
    4141
    42 define( 'AKISMET_VERSION', '5.1' );
    43 define( 'AKISMET__MINIMUM_WP_VERSION', '5.0' );
     42define( 'AKISMET_VERSION', '5.2b' );
     43define( 'AKISMET__MINIMUM_WP_VERSION', '5.8' );
    4444define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    4545define( 'AKISMET_DELETE_LIMIT', 10000 );
  • akismet/trunk/class.akismet-admin.php

    r2851437 r2928208  
    135135            'plugins.php',
    136136        ) ) ) ) {
    137             wp_register_style( 'akismet.css', plugin_dir_url( __FILE__ ) . '_inc/akismet.css', array(), AKISMET_VERSION );
    138             wp_enqueue_style( 'akismet.css');
    139 
    140             wp_register_script( 'akismet.js', plugin_dir_url( __FILE__ ) . '_inc/akismet.js', array('jquery'), AKISMET_VERSION );
     137            wp_register_style( 'akismet', plugin_dir_url( __FILE__ ) . '_inc/akismet.css', array(), filemtime( dirname( __FILE__ ) . '/_inc/akismet.css' ) );
     138            wp_enqueue_style( 'akismet' );
     139
     140            wp_register_style( 'akismet-font-inter', plugin_dir_url( __FILE__ ) . '_inc/fonts/inter.css', array(), filemtime( dirname( __FILE__ ) . '/_inc/fonts/inter.css' ) );
     141            wp_enqueue_style( 'akismet-font-inter' );
     142
     143            wp_register_style( 'akismet-admin', plugin_dir_url( __FILE__ ) . '_inc/akismet-admin.css', array(), filemtime( dirname( __FILE__ ) . '/_inc/akismet-admin.css' ) );
     144            wp_enqueue_style( 'akismet-admin' );
     145
     146            wp_register_script( 'akismet.js', plugin_dir_url( __FILE__ ) . '_inc/akismet.js', array( 'jquery' ), AKISMET_VERSION );
    141147            wp_enqueue_script( 'akismet.js' );
     148
     149            wp_register_script( 'akismet-admin.js', plugin_dir_url( __FILE__ ) . '_inc/akismet-admin.js', array( 'jquery' ), filemtime( dirname( __FILE__ ) . '/_inc/akismet-admin.js' ) );
     150            wp_enqueue_script( 'akismet-admin.js' );
    142151       
    143152            $inline_js = array(
     
    472481
    473482        $result_counts = array(
    474             'processed' => count( $moderation ),
     483            'processed' => is_countable( $moderation ) ? count( $moderation ) : 0,
    475484            'spam' => 0,
    476485            'ham' => 0,
     
    965974            return;
    966975        }
    967        
     976
    968977        //the user can choose to auto connect their API key by clicking a button on the akismet done page
    969978        //if jetpack, get verified api key by using connected wpcom user id
    970979        //if no jetpack, get verified api key by using an akismet token
    971        
     980
    972981        $akismet_user = false;
    973        
     982
    974983        if ( isset( $_GET['token'] ) && preg_match('/^(\d+)-[0-9a-f]{20}$/', $_GET['token'] ) )
    975984            $akismet_user = self::verify_wpcom_key( '', '', array( 'token' => $_GET['token'] ) );
    976985        elseif ( $jetpack_user = self::get_jetpack_user() )
    977986            $akismet_user = self::verify_wpcom_key( $jetpack_user['api_key'], $jetpack_user['user_id'] );
    978            
     987
    979988        if ( isset( $_GET['action'] ) ) {
    980989            if ( $_GET['action'] == 'save-key' ) {
     
    11941203        if ( !$xml->isError() ) {
    11951204            $responses = $xml->getResponse();
    1196             if ( count( $responses ) > 1 ) {
     1205            if ( ( is_countable( $responses ) ? count( $responses ) : 0 ) > 1 ) {
    11971206                // Due to a quirk in how Jetpack does multi-calls, the response order
    11981207                // can't be trusted to match the call order. It's a good thing our
     
    13031312
    13041313        // Tell core if we have more comments to work on still
    1305         $done = count( $comments ) < $number;
     1314        $done = ( is_countable( $comments ) ? count( $comments ) : 0 ) < $number;
    13061315       
    13071316        return array(
  • akismet/trunk/class.akismet-widget.php

    r2606384 r2928208  
    8080
    8181    function update( $new_instance, $old_instance ) {
     82        $instance = array();
    8283        $instance['title'] = strip_tags( $new_instance['title'] );
    8384        return $instance;
  • akismet/trunk/class.akismet.php

    r2876110 r2928208  
    469469
    470470            // Prepared as strings since comment_id is an unsigned BIGINT, and using %d will constrain the value to the maximum signed BIGINT.
    471             $format_string = implode( ", ", array_fill( 0, count( $comment_ids ), '%s' ) );
     471            $format_string = implode( ', ', array_fill( 0, is_countable( $comment_ids ) ? count( $comment_ids ) : 0, '%s' ) );
    472472
    473473            $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->comments} WHERE comment_id IN ( " . $format_string . " )", $comment_ids ) );
     
    480480
    481481            clean_comment_cache( $comment_ids );
    482             do_action( 'akismet_delete_comment_batch', count( $comment_ids ) );
     482            do_action( 'akismet_delete_comment_batch', is_countable( $comment_ids ) ? count( $comment_ids ) : 0 );
    483483        }
    484484
     
    510510            }
    511511
    512             do_action( 'akismet_delete_commentmeta_batch', count( $comment_ids ) );
     512            do_action( 'akismet_delete_commentmeta_batch', is_countable( $comment_ids ) ? count( $comment_ids ) : 0 );
    513513        }
    514514
     
    11521152    // return a comma-separated list of role names for the given user
    11531153    public static function get_user_roles( $user_id ) {
     1154        $comment_user = null;
    11541155        $roles = false;
    11551156
     
    11601161            $comment_user = new WP_User( $user_id );
    11611162            if ( isset( $comment_user->roles ) )
    1162                 $roles = join( ',', $comment_user->roles );
     1163                $roles = implode( ',', $comment_user->roles );
    11631164        }
    11641165
     
    11681169            } else {
    11691170                $comment_user->roles[] = 'super_admin';
    1170                 $roles = join( ',', $comment_user->roles );
     1171                $roles = implode( ',', $comment_user->roles );
    11711172            }
    11721173        }
     
    15931594
    15941595    public static function pre_check_pingback( $method ) {
     1596        $pingback_args = array();
    15951597        if ( $method !== 'pingback.ping' )
    15961598            return;
     
    16171619            if ( 0 === $call_count ) {
    16181620                // Only pass along the number of entries in the multicall the first time we see it.
    1619                 $multicall_count = count( $wp_xmlrpc_server->message->params );
     1621                $multicall_count = is_countable( $wp_xmlrpc_server->message->params ) ? count( $wp_xmlrpc_server->message->params ) : 0;
    16201622            }
    16211623
  • akismet/trunk/readme.txt

    r2894240 r2928208  
    11=== Akismet Anti-Spam: Spam Protection ===
    2 Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer, stephdau, kbrownkd, akismetantispam
     2Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer, stephdau, kbrownkd, bluefuton, akismetantispam
    33Tags: comments, spam, antispam, anti-spam, contact form, anti spam, comment moderation, comment spam, contact form spam, spam comments
    4 Requires at least: 5.0
     4Requires at least: 5.8
    55Tested up to: 6.2
    6 Stable tag: 5.1
     6Stable tag: 5.2
    77License: GPLv2 or later
    88
     
    3333== Changelog ==
    3434
     35= 5.2 =
     36*Release Date - TBD*
     37
     38* Visual refresh of Akismet stats.
     39* Improve PHP 8.1 compatibility.
     40* Improve appearance of plugin to match updated stats.
     41* Change minimum supported PHP version to 5.6 to match WordPress.
     42* Drop IE11 support and update minimum WordPress version to 5.8 (where IE11 support was removed from WP Core).
     43
    3544= 5.1 =
    3645*Release Date - 20 March 2023*
     
    3847* Removed unnecessary limit notices from admin page.
    3948* Improved spam detection by including post taxonomies in the comment-check call.
    40 * Removed API keys from stats iframes to avoid possible inadvertant exposure.
     49* Removed API keys from stats iframes to avoid possible inadvertent exposure.
    4150
    4251= 5.0.2 =
  • akismet/trunk/views/config.php

    r2876110 r2928208  
    88    <div class="akismet-masthead">
    99        <div class="akismet-masthead__inside-container">
    10             <div class="akismet-masthead__logo-container">
    11                 <img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/logo-full-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
    12             </div>
     10            <?php Akismet::view( 'logo' ); ?>
    1311        </div>
    1412    </div>
     
    2523        <div class="akismet-card">
    2624            <div class="akismet-section-header">
    27                 <div class="akismet-section-header__label">
     25                <h2 class="akismet-section-header__label">
    2826                    <span><?php esc_html_e( 'Statistics', 'akismet' ); ?></span>
    29                 </div>
     27                </h2>
    3028
    3129            <?php if ( $stat_totals && isset( $stat_totals['all'] ) && (int) $stat_totals['all']->spam > 0 ) : ?>
    3230                <div class="akismet-section-header__actions">
    3331                    <a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>">
    34                         <?php esc_html_e( 'Detailed Stats', 'akismet' ); ?>
     32                        <?php esc_html_e( 'Detailed stats', 'akismet' ); ?>
    3533                    </a>
    3634                </div>
     
    3836
    3937                <div class="akismet-new-snapshot">
    40                     <iframe allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 220px; overflow: hidden;" src="<?php echo esc_url( sprintf( 'https://tools.akismet.com/1.0/snapshot.php?blog=%s&token=%s&height=200&locale=%s', urlencode( get_option( 'home' ) ), urlencode( Akismet::get_access_token() ), get_locale() ) ); ?>"></iframe>
    41                     <ul>
    42                         <li>
    43                             <h3><?php esc_html_e( 'Past six months' , 'akismet');?></h3>
    44                             <span><?php echo number_format( $stat_totals['6-months']->spam );?></span>
    45                             <?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?>
     38                    <?php /* name attribute on iframe is used as a cache-buster here to force Firefox to load the new style charts: https://bugzilla.mozilla.org/show_bug.cgi?id=356558 */ ?>
     39                    <div class="akismet-new-snapshot__chart">
     40                        <iframe id="stats-iframe" allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 220px; overflow: hidden;" src="<?php echo esc_url( sprintf( 'https://tools.akismet.com/1.0/snapshot.php?blog=%s&token=%s&height=200&locale=%s&is_redecorated=1', urlencode( get_option( 'home' ) ), urlencode( Akismet::get_access_token() ), get_locale() ) ); ?>" name="<?php echo esc_attr( 'snapshot-' . filemtime( __FILE__ ) ); ?>" title="<?php echo esc_attr__( 'Akismet stats' ); ?>"></iframe>
     41                    </div>
     42                    <ul class="akismet-new-snapshot__list">
     43                        <li class="akismet-new-snapshot__item">
     44                            <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Past six months', 'akismet' ); ?></h3>
     45                            <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['6-months']->spam ); ?></span>
     46                            <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?></span>
    4647                        </li>
    47                         <li>
    48                             <h3><?php esc_html_e( 'All time' , 'akismet');?></h3>
    49                             <span><?php echo number_format( $stat_totals['all']->spam );?></span>
    50                             <?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?>
     48                        <li class="akismet-new-snapshot__item">
     49                            <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'All time', 'akismet' ); ?></h3>
     50                            <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['all']->spam ); ?></span>
     51                            <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?></span>
    5152                        </li>
    52                         <li>
    53                             <h3><?php esc_html_e( 'Accuracy' , 'akismet');?></h3>
    54                             <span><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span>
    55                             <?php printf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ); ?>
    56                             |
    57                             <?php printf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ); ?>
     53                        <li class="akismet-new-snapshot__item">
     54                            <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Accuracy', 'akismet' ); ?></h3>
     55                            <span class="akismet-new-snapshot__number"><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span>
     56                            <span class="akismet-new-snapshot__text">
     57                            <?php
     58                            /* translators: %s: number of spam missed by Akismet */
     59                            echo esc_html( sprintf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ) ) . ', ';
     60                            /* translators: %s: number of false positive spam flagged by Akismet */
     61                            echo esc_html( sprintf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ) );
     62                            ?>
     63                            </span>
    5864                        </li>
    5965                    </ul>
     
    6369            </div> <!-- close akismet-section-header -->
    6470            <div class="inside">
    65                 <p><?php esc_html_e( 'Akismet is active and ready to stop spam. Your site&#8217;s spam statistics will be displayed here.', 'akismet' ); ?></p>
     71                <p class="akismet-awaiting-stats"><?php esc_html_e( 'Akismet is active and ready to stop spam. Your site&#8217;s spam statistics will be displayed here.', 'akismet' ); ?></p>
    6672            </div>
    6773            <?php endif; ?>
     
    7278            <div class="akismet-card">
    7379                <div class="akismet-section-header">
    74                     <div class="akismet-section-header__label">
     80                    <h2 class="akismet-section-header__label">
    7581                        <span><?php esc_html_e( 'Settings' , 'akismet'); ?></span>
    76                     </div>
     82                    </h2>
    7783                </div>
    7884
    7985                <div class="inside">
    80                     <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
    81                         <table cellspacing="0" class="akismet-settings">
    82                             <tbody>
    83                                 <?php if ( ! Akismet::predefined_api_key() ) { ?>
    84                                 <tr>
    85                                     <th class="akismet-api-key" width="10%" align="left" scope="row">
    86                                         <label for="key"><?php esc_html_e( 'API Key', 'akismet' ); ?></label>
    87                                     </th>
    88                                     <td width="5%"/>
    89                                     <td align="left">
     86                    <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" autocomplete="off" method="POST" id="akismet-settings-form">
     87                       
     88                        <div class="akismet-settings">
     89                            <?php if ( ! Akismet::predefined_api_key() ) : ?>
     90                                <div class="akismet-settings__row">
     91                                    <h3 class="akismet-settings__row-title">
     92                                        <label class="akismet-settings__row-label" for="key"><?php esc_html_e( 'API key', 'akismet' ); ?></label>
     93                                    </h3>
     94                                    <div class="akismet-settings__row-input">
    9095                                        <span class="api-key"><input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="<?php echo esc_attr( 'regular-text code ' . $akismet_user->status ); ?>"></span>
    91                                     </td>
    92                                 </tr>
    93                                 <?php } ?>
    94                                 <?php if ( isset( $_GET['ssl_status'] ) ) { ?>
    95                                     <tr>
    96                                         <th align="left" scope="row"><?php esc_html_e( 'SSL Status', 'akismet' ); ?></th>
    97                                         <td></td>
    98                                         <td align="left">
    99                                             <p>
    100                                                 <?php
    101 
    102                                                 if ( ! wp_http_supports( array( 'ssl' ) ) ) {
    103                                                     ?><b><?php esc_html_e( 'Disabled.', 'akismet' ); ?></b> <?php esc_html_e( 'Your Web server cannot make SSL requests; contact your Web host and ask them to add support for SSL requests.', 'akismet' ); ?><?php
    104                                                 }
    105                                                 else {
    106                                                     $ssl_disabled = get_option( 'akismet_ssl_disabled' );
    107 
    108                                                     if ( $ssl_disabled ) {
    109                                                         ?><b><?php esc_html_e( 'Temporarily disabled.', 'akismet' ); ?></b> <?php esc_html_e( 'Akismet encountered a problem with a previous SSL request and disabled it temporarily. It will begin using SSL for requests again shortly.', 'akismet' ); ?><?php
    110                                                     }
    111                                                     else {
    112                                                         ?><b><?php esc_html_e( 'Enabled.', 'akismet' ); ?></b> <?php esc_html_e( 'All systems functional.', 'akismet' ); ?><?php
    113                                                     }
    114                                                 }
    115 
    116                                                 ?>
    117                                             </p>
    118                                         </td>
    119                                     </tr>
    120                                 <?php } ?>
    121                                 <tr>
    122                                     <th align="left" scope="row"><?php esc_html_e('Comments', 'akismet');?></th>
    123                                     <td></td>
    124                                     <td align="left">
    125                                         <p>
    126                                             <label for="akismet_show_user_comments_approved" title="<?php esc_attr_e( 'Show approved comments' , 'akismet'); ?>">
    127                                                 <input
    128                                                     name="akismet_show_user_comments_approved"
    129                                                     id="akismet_show_user_comments_approved"
    130                                                     value="1"
    131                                                     type="checkbox"
    132                                                     <?php
    133                                                    
    134                                                     // If the option isn't set, or if it's enabled ('1'), or if it was enabled a long time ago ('true'), check the checkbox.
    135                                                     checked( true, ( in_array( get_option( 'akismet_show_user_comments_approved' ), array( false, '1', 'true' ), true ) ) );
    136                                                    
    137                                                     ?>
    138                                                     />
    139                                                 <?php esc_html_e( 'Show the number of approved comments beside each comment author', 'akismet' ); ?>
     96                                    </div>
     97                                </div>
     98                            <?php endif; ?>
     99                           
     100                            <?php if ( isset( $_GET['ssl_status'] ) ) : ?>
     101                                <div class="akismet-settings__row">
     102                                    <div class="akismet-settings__row-text">
     103                                        <h3 class="akismet-settings__row-title"><?php esc_html_e( 'SSL status', 'akismet' ); ?></h3>
     104                                        <div class="akismet-settings__row-description">
     105                                            <?php if ( ! wp_http_supports( array( 'ssl' ) ) ) : ?>
     106                                                <strong><?php esc_html_e( 'Disabled.', 'akismet' ); ?></strong>
     107                                                <?php esc_html_e( 'Your Web server cannot make SSL requests; contact your Web host and ask them to add support for SSL requests.', 'akismet' ); ?>
     108                                            <?php else : ?>
     109                                                <?php $ssl_disabled = get_option( 'akismet_ssl_disabled' ); ?>
     110
     111                                                <?php if ( $ssl_disabled ) : ?>
     112                                                    <strong><?php esc_html_e( 'Temporarily disabled.', 'akismet' ); ?></strong>
     113                                                    <?php esc_html_e( 'Akismet encountered a problem with a previous SSL request and disabled it temporarily. It will begin using SSL for requests again shortly.', 'akismet' ); ?>
     114                                                <?php else : ?>
     115                                                    <strong><?php esc_html_e( 'Enabled.', 'akismet' ); ?></strong>
     116                                                    <?php esc_html_e( 'All systems functional.', 'akismet' ); ?>
     117                                                <?php endif; ?>
     118                                            <?php endif; ?>
     119                                        </div>
     120                                    </div>
     121                                </div>
     122                            <?php endif; ?>
     123                           
     124                            <div class="akismet-settings__row">
     125                                <div class="akismet-settings__row-text">
     126                                    <h3 class="akismet-settings__row-title"><?php esc_html_e( 'Comments', 'akismet' ); ?></h3>
     127                                </div>
     128                                <div class="akismet-settings__row-input">
     129                                    <label class="akismet-settings__row-input-label" for="akismet_show_user_comments_approved">
     130                                        <input
     131                                        name="akismet_show_user_comments_approved"
     132                                        id="akismet_show_user_comments_approved"
     133                                        value="1"
     134                                        type="checkbox"
     135                                        <?php
     136                                        // If the option isn't set, or if it's enabled ('1'), or if it was enabled a long time ago ('true'), check the checkbox.
     137                                        checked( true, ( in_array( get_option( 'akismet_show_user_comments_approved' ), array( false, '1', 'true' ), true ) ) );
     138                                        ?>
     139                                        />
     140                                        <span class="akismet-settings__row-label-text">
     141                                            <?php esc_html_e( 'Show the number of approved comments beside each comment author.', 'akismet' ); ?>
     142                                        </span>
     143                                    </label>
     144                                </div>
     145                            </div>
     146                           
     147                            <div class="akismet-settings__row is-radio">
     148                                <div class="akismet-settings__row-text">
     149                                    <h3 class="akismet-settings__row-title"><?php esc_html_e( 'Spam filtering', 'akismet' ); ?></h3>
     150                                </div>
     151                                <div class="akismet-settings__row-input">
     152                                    <fieldset>
     153                                        <legend class="screen-reader-text">
     154                                            <span><?php esc_html_e( 'Akismet anti-spam strictness', 'akismet' ); ?></span>
     155                                        </legend>
     156                                        <div>
     157                                            <label class="akismet-settings__row-input-label" for="akismet_strictness_1">
     158                                                <input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked( '1', get_option( 'akismet_strictness' ) ); ?> />
     159                                                <span class="akismet-settings__row-label-text">
     160                                                    <?php esc_html_e( 'Silently discard the worst and most pervasive spam so I never see it.', 'akismet' ); ?>
     161                                                </span>
    140162                                            </label>
    141                                         </p>
    142                                     </td>
    143                                 </tr>
    144                                 <tr>
    145                                     <th class="strictness" align="left" scope="row"><?php esc_html_e('Strictness', 'akismet'); ?></th>
    146                                     <td></td>
    147                                     <td align="left">
    148                                         <fieldset><legend class="screen-reader-text"><span><?php esc_html_e('Akismet anti-spam strictness', 'akismet'); ?></span></legend>
    149                                         <p><label for="akismet_strictness_1"><input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked('1', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Silently discard the worst and most pervasive spam so I never see it.', 'akismet'); ?></label></p>
    150                                         <p><label for="akismet_strictness_0"><input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked('0', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Always put spam in the Spam folder for review.', 'akismet'); ?></label></p>
    151                                         </fieldset>
    152                                         <span class="akismet-note"><strong><?php esc_html_e('Note:', 'akismet');?></strong>
     163                                        </div>
     164                                        <div>
     165                                            <label class="akismet-settings__row-input-label" for="akismet_strictness_0">
     166                                                <input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked( '0', get_option( 'akismet_strictness' ) ); ?> />
     167                                                <span class="akismet-settings__row-label-text">
     168                                                    <?php esc_html_e( 'Always put spam in the Spam folder for review.', 'akismet' ); ?>
     169                                                </span>
     170                                            </label>
     171                                        </div>
     172                                    </fieldset>
     173                                   
     174                                    <div class="akismet-settings__row-note">
     175                                        <strong><?php esc_html_e( 'Note:', 'akismet' ); ?></strong>
    153176                                        <?php
    154                                    
    155177                                        $delete_interval = max( 1, intval( apply_filters( 'akismet_delete_comment_interval', 15 ) ) );
    156                                    
     178
    157179                                        printf(
    158180                                            _n(
     
    165187                                            $delete_interval
    166188                                        );
     189                                        ?>
     190                                    </div>
     191                                </div>
     192                            </div>
     193                               
     194                            <div class="akismet-settings__row is-radio">
     195                                <div class="akismet-settings__row-text">
     196                                    <h3 class="akismet-settings__row-title"><?php esc_html_e( 'Privacy', 'akismet' ); ?></h3>
     197                                </div>
     198                                <div class="akismet-settings__row-input">
     199                                    <fieldset>
     200                                        <legend class="screen-reader-text">
     201                                            <span><?php esc_html_e( 'Akismet privacy notice', 'akismet' ); ?></span>
     202                                        </legend>
     203                                        <div>
     204                                            <label class="akismet-settings__row-input-label" for="akismet_comment_form_privacy_notice_display">
     205                                                <input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_display" value="display" <?php checked( 'display', get_option( 'akismet_comment_form_privacy_notice' ) ); ?> />
     206                                                <span class="akismet-settings__row-label-text">
     207                                                    <?php esc_html_e( 'Display a privacy notice under your comment forms.', 'akismet' ); ?>
     208                                                </span>
     209                                            </label>
     210                                        </div>
     211                                        <div>
     212                                            <label class="akismet-settings__row-input-label" for="akismet_comment_form_privacy_notice_hide">
     213                                                <input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_hide" value="hide" <?php echo in_array( get_option( 'akismet_comment_form_privacy_notice' ), array( 'display', 'hide' ) ) ? checked( 'hide', get_option( 'akismet_comment_form_privacy_notice' ), false ) : 'checked="checked"'; ?> />
     214                                                <span class="akismet-settings__row-label-text">
     215                                                    <?php esc_html_e( 'Do not display privacy notice.', 'akismet' ); ?>
     216                                                </span>
     217                                            </label>
     218                                        </div>
     219                                    </fieldset>
    167220                                   
    168                                         ?>
    169                                     </td>
    170                                 </tr>
    171                                 <tr>
    172                                     <th class="comment-form-privacy-notice" align="left" scope="row"><?php esc_html_e('Privacy', 'akismet'); ?></th>
    173                                     <td></td>
    174                                     <td align="left">
    175                                         <fieldset><legend class="screen-reader-text"><span><?php esc_html_e('Akismet privacy notice', 'akismet'); ?></span></legend>
    176                                         <p><label for="akismet_comment_form_privacy_notice_display"><input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_display" value="display" <?php checked('display', get_option('akismet_comment_form_privacy_notice')); ?> /> <?php esc_html_e('Display a privacy notice under your comment forms.', 'akismet'); ?></label></p>
    177                                         <p><label for="akismet_comment_form_privacy_notice_hide"><input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_hide" value="hide" <?php echo in_array( get_option('akismet_comment_form_privacy_notice'), array('display', 'hide') ) ? checked('hide', get_option('akismet_comment_form_privacy_notice'), false) : 'checked="checked"'; ?> /> <?php esc_html_e('Do not display privacy notice.', 'akismet'); ?></label></p>
    178                                         </fieldset>
    179                                         <span class="akismet-note"><?php esc_html_e( 'To help your site with transparency under privacy laws like the GDPR, Akismet can display a notice to your users under your comment forms. This feature is disabled by default, however, you can turn it on above.', 'akismet' );?></span>
    180                                     </td>
    181                                 </tr>
    182                             </tbody>
    183                         </table>
     221                                    <div class="akismet-settings__row-note">
     222                                        <?php esc_html_e( 'To help your site with transparency under privacy laws like the GDPR, Akismet can display a notice to your users under your comment forms.', 'akismet' ); ?>
     223                                    </div>
     224                                </div>
     225                            </div>
     226                        </div>
     227                       
    184228                        <div class="akismet-card-actions">
    185                             <?php if ( ! Akismet::predefined_api_key() ) { ?>
    186                             <div id="delete-action">
    187                                 <a class="submitdelete deletion" href="<?php echo esc_url( Akismet_Admin::get_page_url( 'delete_key' ) ); ?>"><?php esc_html_e('Disconnect this account', 'akismet'); ?></a>
    188                             </div>
    189                             <?php } ?>
    190                             <?php wp_nonce_field(Akismet_Admin::NONCE) ?>
     229                            <?php if ( ! Akismet::predefined_api_key() ) : ?>
     230                                <div id="delete-action">
     231                                    <a class="submitdelete deletion" href="<?php echo esc_url( Akismet_Admin::get_page_url( 'delete_key' ) ); ?>"><?php esc_html_e( 'Disconnect this account', 'akismet' ); ?></a>
     232                                </div>
     233                            <?php endif; ?>
     234                           
     235                            <?php wp_nonce_field( Akismet_Admin::NONCE ); ?>
     236                           
    191237                            <div id="publishing-action">
    192238                                <input type="hidden" name="action" value="enter-key">
    193                                 <input type="submit" name="submit" id="submit" class="akismet-button akismet-could-be-primary" value="<?php esc_attr_e('Save Changes', 'akismet');?>">
     239                                <input type="submit" name="submit" id="submit" class="akismet-button akismet-could-be-primary" value="<?php esc_attr_e( 'Save changes', 'akismet' ); ?>">
    194240                            </div>
    195241                            <div class="clear"></div>
     
    198244                </div>
    199245            </div>
    200            
    201             <?php if ( ! Akismet::predefined_api_key() ) { ?>
     246
     247            <?php if ( ! Akismet::predefined_api_key() ) : ?>
    202248                <div class="akismet-card">
    203249                    <div class="akismet-section-header">
    204                         <div class="akismet-section-header__label">
     250                        <h2 class="akismet-section-header__label">
    205251                            <span><?php esc_html_e( 'Account' , 'akismet'); ?></span>
    206                         </div>
     252                        </h2>
    207253                    </div>
    208                
     254
    209255                    <div class="inside">
    210                         <table cellspacing="0" border="0" class="akismet-settings">
     256                        <table class="akismet-account">
    211257                            <tbody>
    212258                                <tr>
    213                                     <th scope="row" align="left"><?php esc_html_e( 'Subscription Type' , 'akismet');?></th>
    214                                     <td width="5%"/>
    215                                     <td align="left">
    216                                         <p><?php echo esc_html( $akismet_user->account_name ); ?></p>
     259                                    <th scope="row"><?php esc_html_e( 'Subscription type', 'akismet' ); ?></th>
     260                                    <td>
     261                                        <?php echo esc_html( $akismet_user->account_name ); ?>
    217262                                    </td>
    218263                                </tr>
    219264                                <tr>
    220                                     <th scope="row" align="left"><?php esc_html_e( 'Status' , 'akismet');?></th>
    221                                     <td width="5%"/>
    222                                     <td align="left">
    223                                         <p><?php
    224                                             if ( 'cancelled' == $akismet_user->status ) :
    225                                                 esc_html_e( 'Cancelled', 'akismet' );
    226                                             elseif ( 'suspended' == $akismet_user->status ) :
    227                                                 esc_html_e( 'Suspended', 'akismet' );
    228                                             elseif ( 'missing' == $akismet_user->status ) :
    229                                                 esc_html_e( 'Missing', 'akismet' );
    230                                             elseif ( 'no-sub' == $akismet_user->status ) :
    231                                                 esc_html_e( 'No Subscription Found', 'akismet' );
    232                                             else :
    233                                                 esc_html_e( 'Active', 'akismet' ); 
    234                                             endif; ?></p>
     265                                    <th scope="row"><?php esc_html_e( 'Status', 'akismet' ); ?></th>
     266                                    <td>
     267                                        <?php
     268                                        if ( 'cancelled' == $akismet_user->status ) :
     269                                            esc_html_e( 'Cancelled', 'akismet' );
     270                                        elseif ( 'suspended' == $akismet_user->status ) :
     271                                            esc_html_e( 'Suspended', 'akismet' );
     272                                        elseif ( 'missing' == $akismet_user->status ) :
     273                                            esc_html_e( 'Missing', 'akismet' );
     274                                        elseif ( 'no-sub' == $akismet_user->status ) :
     275                                            esc_html_e( 'No subscription found', 'akismet' );
     276                                        else :
     277                                            esc_html_e( 'Active', 'akismet' );
     278                                        endif;
     279                                        ?>
    235280                                    </td>
    236281                                </tr>
    237282                                <?php if ( $akismet_user->next_billing_date ) : ?>
    238283                                <tr>
    239                                     <th scope="row" align="left"><?php esc_html_e( 'Next Billing Date' , 'akismet');?></th>
    240                                     <td width="5%"/>
    241                                     <td align="left">
    242                                         <p><?php echo date( 'F j, Y', $akismet_user->next_billing_date ); ?></p>
     284                                    <th scope="row"><?php esc_html_e( 'Next billing date', 'akismet' ); ?></th>
     285                                    <td>
     286                                        <?php echo esc_html( gmdate( 'F j, Y', $akismet_user->next_billing_date ) ); ?>
    243287                                    </td>
    244288                                </tr>
     
    254298                    </div>
    255299                </div>
    256             <?php } ?>
     300            <?php endif; ?>
    257301        <?php endif;?>
    258302    </div>
  • akismet/trunk/views/get.php

    r2709917 r2928208  
    33//phpcs:disable VariableAnalysis
    44// There are "undefined" variables here because they're defined in the code that includes this file as a template.
     5
     6$submit_classes_attr = 'akismet-button';
     7
     8if ( isset( $classes ) && ( is_countable( $classes ) ? count( $classes ) : 0 ) > 0 ) {
     9    $submit_classes_attr = implode( ' ', $classes );
     10}
    511?>
    612
     
    915    <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
    1016    <input type="hidden" name="redirect" value="<?php echo isset( $redirect ) ? $redirect : 'plugin-signup'; ?>"/>
    11     <button type="submit" class="<?php echo isset( $classes ) && count( $classes ) > 0 ? esc_attr( implode( ' ', $classes ) ) : 'akismet-button'; ?>" value="<?php echo esc_attr( $text ); ?>"><?php echo esc_attr( $text ) . '<span class="screen-reader-text">' . esc_html__( '(opens in a new tab)', 'akismet' ) . '</span>'; ?></button>
     17    <button type="submit" class="<?php echo esc_attr( $submit_classes_attr ); ?>" value="<?php echo esc_attr( $text ); ?>"><?php echo esc_attr( $text ) . '<span class="screen-reader-text">' . esc_html__( '(opens in a new tab)', 'akismet' ) . '</span>'; ?></button>
    1218</form>
  • akismet/trunk/views/notice.php

    r2851437 r2928208  
    33//phpcs:disable VariableAnalysis
    44// There are "undefined" variables here because they're defined in the code that includes this file as a template.
    5 
    65?>
    76<?php if ( $type == 'plugin' ) : ?>
     
    3433<?php elseif ( $type == 'alert' ) : ?>
    3534<div class='error'>
    36     <p><strong><?php printf( esc_html__( 'Akismet Error Code: %s', 'akismet' ), $code ); ?></strong></p>
     35    <?php /* translators: The placeholder is an error code returned by Akismet. */ ?>
     36    <p><strong><?php printf( esc_html__( 'Akismet error code: %s', 'akismet' ), esc_html( $code ) ); ?></strong></p>
    3737    <p><?php echo esc_html( $msg ); ?></p>
    3838    <p><?php
     
    105105        $check_pending_link = 'edit-comments.php?akismet_recheck=' . wp_create_nonce( 'akismet_recheck' );
    106106    }
    107    
    108107    ?>
    109108<div class="akismet-alert akismet-active">
     
    166165<div class="error akismet-usage-limit-alert">
    167166    <div class="akismet-usage-limit-logo">
    168         <img src="<?php echo esc_url( plugins_url( '../_inc/img/logo-a-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
     167        <img src="<?php echo esc_url( plugins_url( '../_inc/img/logo-a-2x.png', __FILE__ ) ); ?>" alt="Akismet logo" />
    169168    </div>
    170169    <div class="akismet-usage-limit-text">
     
    200199                    )
    201200                );
    202 
     201                echo '&nbsp;';
    203202                echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
    204203                echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
     
    208207            case 'SECOND_MONTH_OVER_LIMIT':
    209208                echo esc_html( __( 'Your Akismet usage has been over your plan&#8217;s limit for two consecutive months. Next month, we will restrict your account after you reach the limit. Please consider upgrading your plan.', 'akismet' ) );
    210 
     209                echo '&nbsp;';
    211210                echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
    212211                echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
     
    216215            case 'THIRD_MONTH_APPROACHING_LIMIT':
    217216                echo esc_html( __( 'Your Akismet usage is nearing your plan&#8217;s limit for the third consecutive month. We will restrict your account after you reach the limit. Upgrade your plan so Akismet can continue blocking spam.', 'akismet' ) );
    218 
     217                echo '&nbsp;';
    219218                echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
    220219                echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
     
    225224            case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
    226225                echo esc_html( __( 'Your Akismet usage has been over your plan&#8217;s limit for three consecutive months. We have restricted your account for the rest of the month. Upgrade your plan so Akismet can continue blocking spam.', 'akismet' ) );
    227 
    228                 echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
    229                 echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
    230                 echo '</a>';
    231 
    232                 break;
     226                echo '&nbsp;';
     227                echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
     228                echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
     229                echo '</a>';
     230
     231                break;
     232
    233233            default:
    234234        }
     
    241241            // If only a qty upgrade is required, show a more generic message.
    242242            if ( ! empty( $upgrade_type ) && 'qty' === $upgrade_type ) {
    243                 esc_html_e( 'Upgrade your Subscription Level', 'akismet' );
     243                esc_html_e( 'Upgrade your subscription level', 'akismet' );
    244244            } else {
    245245                echo esc_html(
  • akismet/trunk/views/start.php

    r2183961 r2928208  
    88    <div class="akismet-masthead">
    99        <div class="akismet-masthead__inside-container">
    10             <div class="akismet-masthead__logo-container">
    11                 <img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/logo-full-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
    12             </div>
     10            <?php Akismet::view( 'logo' ); ?>
    1311        </div>
    1412    </div>
  • akismet/trunk/views/stats.php

    r2876110 r2928208  
    22    <div class="akismet-masthead">
    33        <div class="akismet-masthead__inside-container">
    4             <a href="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" class="akismet-right"><?php esc_html_e( 'Anti-Spam Settings', 'akismet' ); ?></a>
    5             <div class="akismet-masthead__logo-container">
    6                 <img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/logo-full-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
     4            <?php Akismet::view( 'logo', array( 'include_logo_link' => true ) ); ?>
     5            <div class="akismet-masthead__back-link-container">
     6                <a class="akismet-masthead__back-link" href="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"><?php esc_html_e( 'Back to settings', 'akismet' ); ?></a>
    77            </div>
    88        </div>
    99    </div>
    10     <iframe src="<?php echo esc_url( sprintf( 'https://tools.akismet.com/1.0/user-stats.php?blog=%s&token=%s&locale=%s', urlencode( get_option( 'home' ) ), urlencode( Akismet::get_access_token() ), esc_attr( get_locale() ) ) ); ?>" width="100%" height="2500px" frameborder="0"></iframe>
     10    <?php /* name attribute on iframe is used as a cache-buster here to force Firefox to load the new style charts: https://bugzilla.mozilla.org/show_bug.cgi?id=356558 */ ?>
     11    <iframe id="stats-iframe" src="<?php echo esc_url( sprintf( 'https://tools.akismet.com/1.0/user-stats.php?blog=%s&token=%s&locale=%s&is_redecorated=1', urlencode( get_option( 'home' ) ), urlencode( Akismet::get_access_token() ), esc_attr( get_locale() ) ) ); ?>" name="<?php echo esc_attr( 'user-stats- ' . filemtime( __FILE__ ) ); ?>" width="100%" height="2500px" frameborder="0" title="<?php echo esc_attr__( 'Akismet detailed stats' ); ?>"></iframe>
    1112</div>
Note: See TracChangeset for help on using the changeset viewer.