diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-09-13 21:36:49 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-09-13 21:36:49 +0200 |
commit | 21ae8bab2fb4c9e1b78e82988a756ed9347be9c2 (patch) | |
tree | 447e3a1aded0dbd487219df06d7161c6e27e265e /unshorturl/unshorturl.php | |
parent | 241b9e45184d31d96bb040da807df18f6a5ab4d8 (diff) | |
download | volse-hz-addons-21ae8bab2fb4c9e1b78e82988a756ed9347be9c2.tar.gz volse-hz-addons-21ae8bab2fb4c9e1b78e82988a756ed9347be9c2.tar.bz2 volse-hz-addons-21ae8bab2fb4c9e1b78e82988a756ed9347be9c2.zip |
Remove duplicate matches.
Since we do a str_replace, we don't need to look up the same URL more
than once for each post.
Diffstat (limited to 'unshorturl/unshorturl.php')
-rw-r--r-- | unshorturl/unshorturl.php | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/unshorturl/unshorturl.php b/unshorturl/unshorturl.php index cbe3208..cd09e13 100644 --- a/unshorturl/unshorturl.php +++ b/unshorturl/unshorturl.php @@ -49,6 +49,7 @@ function unshorturl_prepare_body(&$body) { $matches = []; $num_matches = preg_match_all('/https?:\/\/(bit\.ly|dlvr\.it|t\.co)\/\w+/', $body['html'], $matches); if ($num_matches > 0) { + $matches = array_unique($matches); foreach ($matches as $links) { foreach($links as $l) { $longurl = unshorturl_get_long_url($l); |