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

You appear to be a bot. Output may be restricted

Description

Usage

Akismet_Admin::check_for_spam_button( $comment_status );

Parameters

$comment_status
( mixed ) required –

Returns

void

Source

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


Lines:

1 to 44 of 44
  public static function check_for_spam_button( $comment_status ) {
    // The "Check for Spam" button should only appear when the page might be showing
    // a comment with comment_approved=0, which means an un-trashed, un-spammed,
    // not-yet-moderated comment.
    if ( 'all' != $comment_status && 'moderated' != $comment_status ) {
      return;
    }

    $link = '';

    $comments_count = wp_count_comments();
    
    echo '</div>';
    echo '<div class="alignleft actions">';

    $classes = array(
      'button-secondary',
      'checkforspam',
      'button-disabled'  // Disable button until the page is loaded
    );

    if ( $comments_count->moderated > 0 ) {
      $classes[] = 'enable-on-load';

      if ( ! Akismet::get_api_key() ) {
        $link = self::get_page_url();
        $classes[] = 'ajax-disabled';
      }
    }

    echo '<a
				class="' . esc_attr( implode( ' ', $classes ) ) . '"' .
        ( ! empty( $link ) ? ' href="' . esc_url( $link ) . '"' : '' ) .
        /* translators: The placeholder is for showing how much of the process has completed, as a percent. e.g., "Checking for Spam (40%)" */
        ' data-progress-label="' . esc_attr( __( 'Checking for Spam (%1$s%)', 'akismet' ) ) . '"
				data-success-url="' . esc_attr( remove_query_arg( array( 'akismet_recheck', 'akismet_recheck_error' ), add_query_arg( array( 'akismet_recheck_complete' => 1, 'recheck_count' => urlencode( '__recheck_count__' ), 'spam_count' => urlencode( '__spam_count__' ) ) ) ) ) . '"
				data-failure-url="' . esc_attr( remove_query_arg( array( 'akismet_recheck', 'akismet_recheck_complete' ), add_query_arg( array( 'akismet_recheck_error' => 1 ) ) ) ) . '"
				data-pending-comment-count="' . esc_attr( $comments_count->moderated ) . '"
				data-nonce="' . esc_attr( wp_create_nonce( 'akismet_check_for_spam' ) ) . '"
				' . ( ! in_array( 'ajax-disabled', $classes ) ? 'onclick="return false;"' : '' ) . '
				>' . esc_html__('Check for Spam', 'akismet') . '</a>';
    echo '<span class="checkforspam-spinner"></span>';
  }
 

 View on GitHub View on Trac

Published: 19th December 2019 | Last updated: 2nd November 2022

Primary Sidebar

Information

Function name: Akismet_Admin::check_for_spam_button
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,F,S

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