|| ( isset( $_GET['action'
] ) &&
in_array( $_GET['action'
], array
( 'spam', 'unspam', 'spamcomment', 'unspamcomment',
) ) ) // action=editedcomment: Editing a comment via wp-admin (and possibly changing its status).
|| ( isset( $_POST['action'
] ) &&
in_array( $_POST['action'
], array
( 'editedcomment'
) ) ) // for=jetpack: Moderation via the WordPress app, Calypso, anything powered by the Jetpack connection.
|| ( isset( $_GET['for'
] ) && ( 'jetpack' ==
$_GET['for'
] ) && ( !
defined( 'IS_WPCOM'
) || ! IS_WPCOM
) ) // Certain WordPress.com API requests
|| ( defined( 'REST_API_REQUEST'
) && REST_API_REQUEST
) // WordPress.org REST API requests
|| ( defined( 'REST_REQUEST'
) && REST_REQUEST
) ) { if ( $new_status == 'spam'
&& ( $old_status == 'approved' ||
$old_status == 'unapproved' || !
$old_status ) ) { return self::
submit_spam_comment( $comment->comment_ID
);
} elseif ( $old_status == 'spam'
&& ( $new_status == 'approved' ||
$new_status == 'unapproved'
) ) { return self::
submit_nonspam_comment( $comment->comment_ID
);
} } self::
update_comment_history( $comment->comment_ID, '', 'status-' .
$new_status );
} public static function submit_spam_comment( $comment_id ) { global $wpdb,
$current_user,
$current_site;