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

You appear to be a bot. Output may be restricted

Description

Usage

Akismet_Admin::comment_status_meta_box( $comment );

Parameters

$comment
( mixed ) required –

Returns

void

Source

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

1 to 100 of 125
  public static function comment_status_meta_box( $comment ) {
    $history = Akismet::get_comment_history( $comment->comment_ID );

    if ( $history ) {
      foreach ( $history as $row ) {
        $message = '';

        if ( ! empty( $row['message'] ) ) {
          // Old versions of Akismet stored the message as a literal string in the commentmeta.
          // New versions don't do that for two reasons:
          // 1) Save space.
          // 2) The message can be translated into the current language of the blog, not stuck 
          //    in the language of the blog when the comment was made.
          $message = esc_html( $row['message'] );
        } else if ( ! empty( $row['event'] ) ) {
          // If possible, use a current translation.
          switch ( $row['event'] ) {
            case 'recheck-spam':
              $message = esc_html( __( 'Akismet re-checked and caught this comment as spam.', 'akismet' ) );
              break;
            case 'check-spam':
              $message = esc_html( __( 'Akismet caught this comment as spam.', 'akismet' ) );
              break;
            case 'recheck-ham':
              $message = esc_html( __( 'Akismet re-checked and cleared this comment.', 'akismet' ) );
              break;
            case 'check-ham':
              $message = esc_html( __( 'Akismet cleared this comment.', 'akismet' ) );
              break;
            case 'wp-blacklisted':
            case 'wp-disallowed':
              $message = sprintf(
                /* translators: The placeholder is a WordPress PHP function name. */
                esc_html( __( 'Comment was caught by %s.', 'akismet' ) ),
                function_exists( 'wp_check_comment_disallowed_list' ) ? '<code>wp_check_comment_disallowed_list</code>' : '<code>wp_blacklist_check</code>'
              );
              break;
            case 'report-spam':
              if ( isset( $row['user'] ) ) {
                /* translators: The placeholder is a username. */
                $message = esc_html( sprintf( __( '%s reported this comment as spam.', 'akismet' ), $row['user'] ) );
              } else if ( ! $message ) {
                $message = esc_html( __( 'This comment was reported as spam.', 'akismet' ) );
              }
              break;
            case 'report-ham':
              if ( isset( $row['user'] ) ) {
                /* translators: The placeholder is a username. */
                $message = esc_html( sprintf( __( '%s reported this comment as not spam.', 'akismet' ), $row['user'] ) );
              } else if ( ! $message ) {
                $message = esc_html( __( 'This comment was reported as not spam.', 'akismet' ) );
              }
              break;
            case 'cron-retry-spam':
              $message = esc_html( __( 'Akismet caught this comment as spam during an automatic retry.', 'akismet' ) );
              break;
            case 'cron-retry-ham':
              $message = esc_html( __( 'Akismet cleared this comment during an automatic retry.', 'akismet' ) );
              break;
            case 'check-error':
              if ( isset( $row['meta'], $row['meta']['response'] ) ) {
                /* translators: The placeholder is an error response returned by the API server. */
                $message = sprintf( esc_html( __( 'Akismet was unable to check this comment (response: %s) but will automatically retry later.', 'akismet' ) ), '<code>' . esc_html( $row['meta']['response'] ) . '</code>' );
              } else {
                $message = esc_html( __( 'Akismet was unable to check this comment but will automatically retry later.', 'akismet' ) );
              }
              break;
            case 'recheck-error':
              if ( isset( $row['meta'], $row['meta']['response'] ) ) {
                /* translators: The placeholder is an error response returned by the API server. */
                $message = sprintf( esc_html( __( 'Akismet was unable to recheck this comment (response: %s).', 'akismet' ) ), '<code>' . esc_html( $row['meta']['response'] ) . '</code>' );
              } else {
                $message = esc_html( __( 'Akismet was unable to recheck this comment.', 'akismet' ) );
              }
              break;
            default:
              if ( preg_match( '/^status-changed/', $row['event'] ) ) {
                // Half of these used to be saved without the dash after 'status-changed'.
                // See https://plugins.trac.wordpress.org/changeset/1150658/akismet/trunk
                $new_status = preg_replace( '/^status-changed-?/', '', $row['event'] );
                /* translators: The placeholder is a short string (like 'spam' or 'approved') denoting the new comment status. */
                $message = sprintf( esc_html( __( 'Comment status was changed to %s', 'akismet' ) ), '<code>' . esc_html( $new_status ) . '</code>' );
              } else if ( preg_match( '/^status-/', $row['event'] ) ) {
                $new_status = preg_replace( '/^status-/', '', $row['event'] );

                if ( isset( $row['user'] ) ) {
                  /* translators: %1$s is a username; %2$s is a short string (like 'spam' or 'approved') denoting the new comment status. */
                  $message = sprintf( esc_html( __( '%1$s changed the comment status to %2$s.', 'akismet' ) ), $row['user'], '<code>' . esc_html( $new_status ) . '</code>' );
                }
              }
              break;
          }
        }

        if ( ! empty( $message ) ) {
          echo '<p>';

          if ( isset( $row['time'] ) ) {
            $time = gmdate( 'D d M Y @ h:i:s a', $row['time'] ) . ' GMT';

 
[1] [2] Next »

 View on GitHub View on Trac

Published: 19th December 2019 | Last updated: 9th June 2022

Primary Sidebar

Information

Function name: Akismet_Admin::comment_status_meta_box
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,M,S

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