• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Akismet_Admin::display_notice() –

You appear to be a bot. Output may be restricted

Description

Usage

Akismet_Admin::display_notice();

Parameters

Returns

void

Source

File name: akismet/class.akismet-admin.php
Lines:

1 to 51 of 51
  public static function display_notice() {
    global $hook_suffix;

    if ( in_array( $hook_suffix, array( 'jetpack_page_akismet-key-config', 'settings_page_akismet-key-config' ) ) ) {
      // This page manages the notices and puts them inline where they make sense.
      return;
    }

    if ( in_array( $hook_suffix, array( 'edit-comments.php' ) ) && (int) get_option( 'akismet_alert_code' ) > 0 ) {
      Akismet::verify_key( Akismet::get_api_key() ); //verify that the key is still in alert state

      $alert_code = get_option( 'akismet_alert_code' );
      if ( isset( Akismet::$limit_notices[ $alert_code ] ) ) {
        self::display_usage_limit_alert();
      } elseif ( $alert_code > 0 ) {
        self::display_alert();
      }
    }
    elseif ( ( 'plugins.php' === $hook_suffix || 'edit-comments.php' === $hook_suffix ) && ! Akismet::get_api_key() ) {
      // Show the "Set Up Akismet" banner on the comments and plugin pages if no API key has been set.
      self::display_api_key_warning();
    }
    elseif ( $hook_suffix == 'edit-comments.php' && wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) {
      self::display_spam_check_warning();
    }
    
    if ( isset( $_GET['akismet_recheck_complete'] ) ) {
      $recheck_count = (int) $_GET['recheck_count'];
      $spam_count = (int) $_GET['spam_count'];
      
      if ( $recheck_count === 0 ) {
        $message = __( 'There were no comments to check. Akismet will only check comments awaiting moderation.', 'akismet' );
      }
      else {
        $message = sprintf( _n( 'Akismet checked %s comment.', 'Akismet checked %s comments.', $recheck_count, 'akismet' ), number_format( $recheck_count ) );
        $message .= ' ';
      
        if ( $spam_count === 0 ) {
          $message .= __( 'No comments were caught as spam.', 'akismet' );
        }
        else {
          $message .= sprintf( _n( '%s comment was caught as spam.', '%s comments were caught as spam.', $spam_count, 'akismet' ), number_format( $spam_count ) );
        }
      }
      
      echo '<div class="notice notice-success"><p>' . esc_html( $message ) . '</p></div>';
    }
    else if ( isset( $_GET['akismet_recheck_error'] ) ) {
      echo '<div class="notice notice-error"><p>' . esc_html( __( 'Akismet could not recheck your comments for spam.', 'akismet' ) ) . '</p></div>';
    }
  }
 

 View on GitHub View on Trac

Published: 19th December 2019 | Last updated: 14th November 2021

Primary Sidebar

Information

Function name: Akismet_Admin::display_notice
Class ref: Akismet_Admin
Plugin ref: Akismet
Version: 5.0.1
Sourcefile: class.akismet-admin.php
File ref: class.akismet-admin.php
Deprecated?: No
API Letters: A,D,N

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 6.1.1. PHP: 8.0.27
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites