• 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_configuration_page() –

You appear to be a bot. Output may be restricted

Description

Usage

Akismet_Admin::display_configuration_page();

Parameters

Returns

void

Source

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

1 to 88 of 88
  public static function display_configuration_page() {
    $api_key      = Akismet::get_api_key();
    $akismet_user = self::get_akismet_user( $api_key );
    
    if ( ! $akismet_user ) {
      // This could happen if the user's key became invalid after it was previously valid and successfully set up.
      self::$notices['status'] = 'existing-key-invalid';
      self::display_start_page();
      return;
    }

    $stat_totals  = self::get_stats( $api_key );

    // If unset, create the new strictness option using the old discard option to determine its default.
    // If the old option wasn't set, default to discarding the blatant spam.
    if ( get_option( 'akismet_strictness' ) === false ) {
      add_option( 'akismet_strictness', ( get_option( 'akismet_discard_month' ) === 'false' ? '0' : '1' ) );
    }
    
    // Sync the local "Total spam blocked" count with the authoritative count from the server.
    if ( isset( $stat_totals['all'], $stat_totals['all']->spam ) ) {
      update_option( 'akismet_spam_count', $stat_totals['all']->spam );
    }

    $notices = array();

    if ( empty( self::$notices ) ) {
      if ( ! empty( $stat_totals['all'] ) && isset( $stat_totals['all']->time_saved ) && $akismet_user->status == 'active' && $akismet_user->account_type == 'free-api-key' ) {

        $time_saved = false;

        if ( $stat_totals['all']->time_saved > 1800 ) {
          $total_in_minutes = round( $stat_totals['all']->time_saved / 60 );
          $total_in_hours   = round( $total_in_minutes / 60 );
          $total_in_days    = round( $total_in_hours / 8 );
          $cleaning_up      = __( 'Cleaning up spam takes time.' , 'akismet');

          if ( $total_in_days > 1 )
            $time_saved = $cleaning_up . ' ' . sprintf( _n( 'Akismet has saved you %s day!', 'Akismet has saved you %s days!', $total_in_days, 'akismet' ), number_format_i18n( $total_in_days ) );
          elseif ( $total_in_hours > 1 )
            $time_saved = $cleaning_up . ' ' . sprintf( _n( 'Akismet has saved you %d hour!', 'Akismet has saved you %d hours!', $total_in_hours, 'akismet' ), $total_in_hours );
          elseif ( $total_in_minutes >= 30 )
            $time_saved = $cleaning_up . ' ' . sprintf( _n( 'Akismet has saved you %d minute!', 'Akismet has saved you %d minutes!', $total_in_minutes, 'akismet' ), $total_in_minutes );
        }
        
        $notices[] =  array( 'type' => 'active-notice', 'time_saved' => $time_saved );
      }
      
      if ( !empty( $akismet_user->limit_reached ) && in_array( $akismet_user->limit_reached, array( 'yellow', 'red' ) ) ) {
        $notices[] = array( 'type' => 'limit-reached', 'level' => $akismet_user->limit_reached );
      }
    }
    
    if ( !isset( self::$notices['status'] ) && in_array( $akismet_user->status, array( 'cancelled', 'suspended', 'missing', 'no-sub' ) ) ) {
      $notices[] = array( 'type' => $akismet_user->status );
    }

    $alert_code = get_option( 'akismet_alert_code' );
    if ( isset( Akismet::$limit_notices[ $alert_code ] ) ) {
      $notices[] = self::get_usage_limit_alert_data();
    }

    /*
		// To see all variants when testing.
		$notices[] = array( 'type' => 'active-notice', 'time_saved' => 'Cleaning up spam takes time. Akismet has saved you 1 minute!' );
		$notices[] = array( 'type' => 'plugin' );
		$notices[] = array( 'type' => 'spam-check', 'link_text' => 'Link text.' );
		$notices[] = array( 'type' => 'notice', 'notice_header' => 'This is the notice header.', 'notice_text' => 'This is the notice text.' );
		$notices[] = array( 'type' => 'missing-functions' );
		$notices[] = array( 'type' => 'servers-be-down' );
		$notices[] = array( 'type' => 'active-dunning' );
		$notices[] = array( 'type' => 'cancelled' );
		$notices[] = array( 'type' => 'suspended' );
		$notices[] = array( 'type' => 'missing' );
		$notices[] = array( 'type' => 'no-sub' );
		$notices[] = array( 'type' => 'new-key-valid' );
		$notices[] = array( 'type' => 'new-key-invalid' );
		$notices[] = array( 'type' => 'existing-key-invalid' );
		$notices[] = array( 'type' => 'new-key-failed' );
		$notices[] = array( 'type' => 'limit-reached', 'level' => 'yellow' );
		$notices[] = array( 'type' => 'limit-reached', 'level' => 'red' );
		$notices[] = array( 'type' => 'usage-limit', 'api_calls' => '15000', 'usage_limit' => '10000', 'upgrade_plan' => 'Enterprise', 'upgrade_url' => 'https://akismet.com/account/' );
		$notices[] = array( 'type' => 'spam-check-cron-disabled' );
		*/
    
    Akismet::log( compact( 'stat_totals', 'akismet_user' ) );
    Akismet::view( 'config', compact( 'api_key', 'akismet_user', 'stat_totals', 'notices' ) );
  }
 

 View on GitHub View on Trac

Published: 19th December 2019 | Last updated: 27th July 2022

Primary Sidebar

Information

Function name: Akismet_Admin::display_configuration_page
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,C,D,P

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 6.1.1. PHP: 8.0.28
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