@@ -98,6 +98,9 @@ discard block |
||
| 98 | 98 | return (bool) preg_match( '/\[url[=\]].*\[\/url\]/is', $body ); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | + /** |
|
| 102 | + * @param string $client_ip |
|
| 103 | + */ |
|
| 101 | 104 | private static function _is_fake_ip( $client_ip, $client_host = false ) { |
| 102 | 105 | /* Remote Host */ |
| 103 | 106 | $host_by_ip = gethostbyaddr( $client_ip ); |
@@ -159,6 +162,9 @@ discard block |
||
| 159 | 162 | } |
| 160 | 163 | } |
| 161 | 164 | |
| 165 | + /** |
|
| 166 | + * @param string $ip |
|
| 167 | + */ |
|
| 162 | 168 | private static function _cut_ip( $ip, $cut_end = true ) { |
| 163 | 169 | $separator = ( self::_is_ipv4( $ip ) ? '.' : ':' ); |
| 164 | 170 | $part = ( $cut_end ? strrchr( $ip, $separator ) : strstr( $ip, $separator ) ); |
@@ -252,6 +258,9 @@ discard block |
||
| 252 | 258 | return false; |
| 253 | 259 | } |
| 254 | 260 | |
| 261 | + /** |
|
| 262 | + * @param string $ip |
|
| 263 | + */ |
|
| 255 | 264 | private static function _is_dnsbl_spam( $ip ) { |
| 256 | 265 | |
| 257 | 266 | $response = wp_safe_remote_request( |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | |
| 140 | 140 | private static function _is_ipv6( $ip ) { |
| 141 | - if ( function_exists('filter_var') ) { |
|
| 141 | + if ( function_exists( 'filter_var' ) ) { |
|
| 142 | 142 | return filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) !== false; |
| 143 | 143 | } else { |
| 144 | 144 | return ! self::_is_ipv4( $ip ); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @return integer TRUE if IPv4 |
| 153 | 153 | */ |
| 154 | 154 | private static function _is_ipv4( $ip ) { |
| 155 | - if ( function_exists('filter_var') ) { |
|
| 155 | + if ( function_exists( 'filter_var' ) ) { |
|
| 156 | 156 | return filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) !== false; |
| 157 | 157 | } else { |
| 158 | 158 | return preg_match( '/^\d{1,3}(\.\d{1,3}){3,3}$/', $ip ); |
@@ -232,15 +232,15 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /* Ignore non utf-8 chars */ |
| 235 | - $comment[ $field ] = ( function_exists('iconv') ? iconv( 'utf-8', 'utf-8//TRANSLIT', $comment[ $field ] ) : $comment[ $field ] ); |
|
| 235 | + $comment[$field] = ( function_exists( 'iconv' ) ? iconv( 'utf-8', 'utf-8//TRANSLIT', $comment[$field] ) : $comment[$field] ); |
|
| 236 | 236 | |
| 237 | - if ( empty( $comment[ $field ] ) ) { |
|
| 237 | + if ( empty( $comment[$field] ) ) { |
|
| 238 | 238 | continue; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /* Perform regex */ |
| 242 | - if ( preg_match( '/' .$regexp. '/isu', $comment[ $field ] ) ) { |
|
| 243 | - $hits[ $field ] = true; |
|
| 242 | + if ( preg_match( '/' . $regexp . '/isu', $comment[$field] ) ) { |
|
| 243 | + $hits[$field] = true; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |