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)