From: Brion Vibber Date: Fri, 30 Apr 2010 20:15:53 +0000 (-0700) Subject: Merge branch '0.9.x' into 1.0.x X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cae1329f3bca1f5f1fbfdb1d96b38cbb790fbe00;p=quix0rs-gnu-social.git Merge branch '0.9.x' into 1.0.x Conflicts: lib/util.php --- cae1329f3bca1f5f1fbfdb1d96b38cbb790fbe00 diff --cc lib/util.php index 1f3aaf711a,e0669a1d56..e7ea9df613 --- a/lib/util.php +++ b/lib/util.php @@@ -826,23 -855,11 +855,23 @@@ function common_linkify($url) return XMLStringer::estring('a', $attrs, $url); } - function common_shorten_links($text) + function common_shorten_links($text, $always = false) { - $maxLength = Notice::maxContent(); - if (!$always && ($maxLength == 0 || mb_strlen($text) <= $maxLength)) return $text; - return common_replace_urls_callback($text, array('File_redirection', 'makeShort')); + common_debug("common_shorten_links() called"); + + $user = common_current_user(); + + $maxLength = User_urlshortener_prefs::maxNoticeLength($user); + + common_debug("maxLength = $maxLength"); + - if (mb_strlen($text) > $maxLength) { ++ if ($always || mb_strlen($text) > $maxLength) { + common_debug("Forcing shortening"); + return common_replace_urls_callback($text, array('File_redirection', 'forceShort')); + } else { + common_debug("Not forcing shortening"); + return common_replace_urls_callback($text, array('File_redirection', 'makeShort')); + } } function common_xml_safe_str($str)