diff options
Diffstat (limited to 'unshorturl')
-rw-r--r-- | unshorturl/unshorturl.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/unshorturl/unshorturl.php b/unshorturl/unshorturl.php index bf79fe3..70d7cf6 100644 --- a/unshorturl/unshorturl.php +++ b/unshorturl/unshorturl.php @@ -27,5 +27,14 @@ function unshorturl_prepare_body(&$body) { return; } - preg_replace('/https?:\/\/bit.ly\/[^\s]+/', '[hidden bitly link]', $body['html']); + $matches = []; + $num_matches = preg_match_all('/https?:\/\/bit\.ly\/\w+/', $body['html'], $links); + if ($num_matches > 0) { + foreach ($matches as $links) { + error_log('unshorturl: Links found: ' . implode(', ', $links)); + foreach($links as $l) { + str_replace($l, '[filtered bit.ly url]', $body['html']); + } + } + } } |