mirror of
https://gh.wpcy.net/https://github.com/webguyio/dam-spam.git
synced 2026-05-26 03:13:58 +08:00
18 lines
No EOL
588 B
PHP
18 lines
No EOL
588 B
PHP
<?php
|
|
|
|
if ( !defined( 'ABSPATH' ) ) {
|
|
status_header( 404 );
|
|
exit;
|
|
}
|
|
|
|
class dam_spam_check_urls {
|
|
public function process( $ip, &$stats = array(), &$options = array(), &$post = array() ) {
|
|
$comment = explode( " ", $post['comment'] );
|
|
for ( $i = 0 ; $i < count( $comment ) ; $i++ ) {
|
|
if ( preg_match( '/^[a-z0-9_]+([\\-\\.]{1}[a-z_0-9]+)*\\.[_a-z]{2,5}+'.'((:[0-9]{1,5})?\\/.*)?$/i', $comment[$i] ) OR strpos( $comment[$i], 'http://' ) !== false OR strpos( $comment[$i], 'https://' ) !== false ) {
|
|
return esc_html__( 'URL Detected', 'dam-spam' );
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
} |