diff --git a/lib/util.php b/lib/util.php index c44d54fbff..666a715dd6 100644 --- a/lib/util.php +++ b/lib/util.php @@ -842,8 +842,10 @@ function common_shorten_links($text) { return $cache[$text] = preg_replace('@https?://[^)\]>\s]+@e', "common_shorten_link('\\0')", $text); } -function common_shorten_link($long_url) { - +function common_shorten_link($url, $reverse = false) { + static $url_cache = array(); + if ($reverse) return isset($url_cache[$url]) ? $url_cache[$url] : $url; + $user = common_current_user(); $curlh = curl_init();