Plugin Directory

Changeset 3111915

Timestamp:
07/03/2024 07:37:16 PM (6 weeks ago)
Author:
kbrownkd
Message:

Remove the stats section from the config page if the site has been revoked.

Location:
akismet/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • akismet/trunk/akismet.php

    r3086117 r3111915  
    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.3.3a5
     9Version: 5.3.3a
    1010Requires at least: 5.8
    1111Requires PHP: 5.6.20
     
    4040}
    4141
    42 define( 'AKISMET_VERSION', '5.3.3a5' );
     42define( 'AKISMET_VERSION', '5.3.3a' );
    4343define( 'AKISMET__MINIMUM_WP_VERSION', '5.8' );
    4444define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
  • akismet/trunk/class.akismet-admin.php

    r3036615 r3111915  
    898898
    899899            if ( ! empty( $response[1] ) ) {
    900                 $stat_totals[$interval] = json_decode( $response[1] );
     900                $data = json_decode( $response[1] );
     901                /*
     902                 * The json decoded response should be an object. If it's not an object, something's wrong, and the data
     903                 * shouldn't be added to the stats_totals array.
     904                 */
     905                if ( is_object( $data ) ) {
     906                    $stat_totals[ $interval ] = $data;
     907                }
    901908            }
    902909        }
  • akismet/trunk/readme.txt

    r3095776 r3111915  
    3636
    3737* Make setup step clearer for new users.
     38
    3839
    3940= 5.3.2 =
  • akismet/trunk/views/config.php

    r3032937 r3111915  
    2525        <?php } ?>
    2626
    27         <div class="akismet-card">
    28             <div class="akismet-section-header">
    29                 <h2 class="akismet-section-header__label">
    30                     <span><?php esc_html_e( 'Statistics', 'akismet' ); ?></span>
    31                 </h2>
    32 
    33                 <div class="akismet-section-header__actions">
    34                     <a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>">
    35                         <?php esc_html_e( 'Detailed stats', 'akismet' ); ?>
    36                     </a>
    37                 </div>
    38             </div> <!-- close akismet-section-header -->
    39 
    40             <div class="akismet-new-snapshot">
    41                 <?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 */ ?>
    42                 <div class="akismet-new-snapshot__chart">
    43                     <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', rawurlencode( get_option( 'home' ) ), rawurlencode( Akismet::get_access_token() ), get_locale() ) ); ?>" name="<?php echo esc_attr( 'snapshot-' . filemtime( __FILE__ ) ); ?>" title="<?php echo esc_attr__( 'Akismet stats' ); ?>"></iframe>
    44                 </div>
    45                 <ul class="akismet-new-snapshot__list">
    46                     <li class="akismet-new-snapshot__item">
    47                         <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Past six months', 'akismet' ); ?></h3>
    48                         <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['6-months']->spam ); ?></span>
    49                         <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?></span>
    50                     </li>
    51                     <li class="akismet-new-snapshot__item">
    52                         <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'All time', 'akismet' ); ?></h3>
    53                         <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['all']->spam ); ?></span>
    54                         <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?></span>
    55                     </li>
    56                     <li class="akismet-new-snapshot__item">
    57                         <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Accuracy', 'akismet' ); ?></h3>
    58                         <span class="akismet-new-snapshot__number"><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span>
    59                         <span class="akismet-new-snapshot__text">
    60                         <?php
    61                         /* translators: %s: number of spam missed by Akismet */
    62                         echo esc_html( sprintf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ) ) . ', ';
    63                         /* translators: %s: number of false positive spam flagged by Akismet */
    64                         echo esc_html( sprintf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ) );
    65                         ?>
    66                         </span>
    67                     </li>
    68                 </ul>
    69             </div> <!-- close akismet-new-snapshot -->
    70 
    71         </div> <!-- close akismet-card -->
     27        <?php if ( isset( $stat_totals['all'] ) && isset( $stat_totals['6-months'] ) ) : ?>
     28            <div class="akismet-card">
     29                <div class="akismet-section-header">
     30                    <h2 class="akismet-section-header__label">
     31                        <span><?php esc_html_e( 'Statistics', 'akismet' ); ?></span>
     32                    </h2>
     33
     34                    <div class="akismet-section-header__actions">
     35                        <a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>">
     36                            <?php esc_html_e( 'Detailed stats', 'akismet' ); ?>
     37                        </a>
     38                    </div>
     39                </div> <!-- close akismet-section-header -->
     40
     41                <div class="akismet-new-snapshot">
     42                    <?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 */ ?>
     43                    <div class="akismet-new-snapshot__chart">
     44                        <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', rawurlencode( get_option( 'home' ) ), rawurlencode( Akismet::get_access_token() ), get_locale() ) ); ?>" name="<?php echo esc_attr( 'snapshot-' . filemtime( __FILE__ ) ); ?>" title="<?php echo esc_attr__( 'Akismet stats' ); ?>"></iframe>
     45                    </div>
     46
     47                    <ul class="akismet-new-snapshot__list">
     48                        <li class="akismet-new-snapshot__item">
     49                            <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Past six months', 'akismet' ); ?></h3>
     50                            <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['6-months']->spam ); ?></span>
     51                            <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?></span>
     52                        </li>
     53                        <li class="akismet-new-snapshot__item">
     54                            <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'All time', 'akismet' ); ?></h3>
     55                            <span class="akismet-new-snapshot__number"><?php echo number_format( $stat_totals['all']->spam ); ?></span>
     56                            <span class="akismet-new-snapshot__text"><?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?></span>
     57                        </li>
     58                        <li class="akismet-new-snapshot__item">
     59                            <h3 class="akismet-new-snapshot__header"><?php esc_html_e( 'Accuracy', 'akismet' ); ?></h3>
     60                            <span class="akismet-new-snapshot__number"><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span>
     61                            <span class="akismet-new-snapshot__text">
     62                            <?php
     63                            /* translators: %s: number of spam missed by Akismet */
     64                            echo esc_html( sprintf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ) ) . ', ';
     65                            /* translators: %s: number of false positive spam flagged by Akismet */
     66                            echo esc_html( sprintf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ) );
     67                            ?>
     68                            </span>
     69                        </li>
     70                    </ul>
     71                </div> <!-- close akismet-new-snapshot -->
     72            </div> <!-- close akismet-card -->
     73        <?php endif; ?>
    7274
    7375        <?php if ( $akismet_user ) : ?>
Note: See TracChangeset for help on using the changeset viewer.