aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--unshorturl/unshorturl.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/unshorturl/unshorturl.php b/unshorturl/unshorturl.php
index 6340e9a..e31268a 100644
--- a/unshorturl/unshorturl.php
+++ b/unshorturl/unshorturl.php
@@ -50,9 +50,11 @@ function unshorturl_prepare_body(&$body) {
$num_matches = preg_match_all('/https?:\/\/bit\.ly\/\w+/', $body['html'], $matches);
if ($num_matches > 0) {
foreach ($matches as $links) {
- error_log('unshorturl: Links found: ' . implode(', ', $links));
foreach($links as $l) {
- $body['html'] = str_replace($l, unshorturl_get_long_url($l), $body['html']);
+ $longurl = unshorturl_get_long_url($l);
+ if ($longurl) {
+ $body['html'] = str_replace($l, $longurl, $body['html']);
+ }
}
}
}