mirror of
https://gh.wpcy.net/https://github.com/webguyio/dam-spam.git
synced 2026-05-26 03:13:58 +08:00
33 lines
876 B
PHP
33 lines
876 B
PHP
<?php
|
|
|
|
if ( !defined( 'ABSPATH' ) ) {
|
|
status_header( 404 );
|
|
exit;
|
|
}
|
|
|
|
class dam_spam_check_short {
|
|
public $searchname = 'Email/Username Too Short';
|
|
public function process( $ip, &$stats = array(), &$options = array(), &$post = array() ) {
|
|
if ( array_key_exists( 'email', $post ) ) {
|
|
$email = $post['email'];
|
|
if ( !empty( $email ) ) {
|
|
if ( strlen( $email ) < 5 ) {
|
|
// translators: %s is the email address that's too short
|
|
return sprintf( esc_html__( 'Email Too Short: %s', 'dam-spam' ), $email );
|
|
}
|
|
}
|
|
}
|
|
if ( array_key_exists( 'author', $post ) ) {
|
|
if ( !empty( $post['author'] ) ) {
|
|
$author = $post['author'];
|
|
if ( strlen( $post['author'] ) < 3 ) {
|
|
// translators: %s is the username that's too short
|
|
return sprintf( esc_html__( 'Username Too Short: %s', 'dam-spam' ), $author );
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
?>
|