mirror of
https://gh.wpcy.net/https://github.com/webguyio/dam-spam.git
synced 2026-05-26 03:13:58 +08:00
34 lines
990 B
PHP
34 lines
990 B
PHP
<?php
|
|
|
|
if ( !defined( 'ABSPATH' ) ) {
|
|
status_header( 404 );
|
|
exit;
|
|
}
|
|
|
|
class dam_spam_check_hyphens extends dam_spam_module {
|
|
public function process( $ip, &$stats=array(), &$options=array(), &$post=array() ) {
|
|
if ( array_key_exists( 'email', $post ) ) {
|
|
$email = $post['email'];
|
|
if ( !empty( $email ) ) {
|
|
$email = substr( $email, 0, strpos( $email, '@' ) );
|
|
if ( substr_count( $email, "-" ) > 1 ) {
|
|
// translators: %s is the email address with too many hyphens
|
|
return sprintf( esc_html__( 'Too Many Hyphens in: %s', 'dam-spam' ), $email );
|
|
}
|
|
}
|
|
}
|
|
if ( array_key_exists( 'user_email', $post ) ) {
|
|
$email = $post['user_email'];
|
|
if ( !empty( $email ) ) {
|
|
$email = substr( $email, 0, strpos( $email, '@' ) );
|
|
if ( substr_count( $email, "-" ) > 1 ) {
|
|
// translators: %s is the email address with too many hyphens
|
|
return sprintf( esc_html__( 'Too Many Hyphens in: %s', 'dam-spam' ), $email );
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
?>
|