Skip to content

Commit

Permalink
feat: add scrape regex test for useragent string
Browse files Browse the repository at this point in the history
  • Loading branch information
florianbrinkmann committed Jul 6, 2024
1 parent dc406b3 commit 6817774
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Rules/RegexpSpam.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public static function verify( array $item ): int {
[
'rawurl' => '^http[s]?:\/\/(accounts\.)?binance\.com\/[a-zA-Z-]+\/register(-person)?\?ref=[\w]+',
],
[
'useragent' => 'scrape',
]
];

$quoted_author = preg_quote( $subject['author'], '/' );
Expand Down Expand Up @@ -154,6 +157,10 @@ public static function verify( array $item ): int {
continue;
}

if ( ! isset( $subject[ $field ] ) ) {
continue;
}

$subject[ $field ] = ( function_exists( 'iconv' ) ? iconv( 'utf-8', 'utf-8//TRANSLIT', $subject[ $field ] ) : $subject[ $field ] );

if ( empty( $subject[ $field ] ) ) {
Expand Down

0 comments on commit 6817774

Please sign in to comment.