[trac31 added longurl title to anchors when applicable. Also removed * url prefix feature to prevent short urls. millette@controlyourself.ca**20081113182834] { hunk ./actions/othersettings.php 54 - common_dropdown('urlshorteningservice', _('Service'), $services, _('Shortening service to use when notices exceed the 140 character limit. Precede a URL with a * to prevent shortening of that URL.'), FALSE, $user->urlshorteningservice); + common_dropdown('urlshorteningservice', _('Service'), $services, _('Shortening service to use when notices exceed the 140 character limit.'), FALSE, $user->urlshorteningservice); hunk ./lib/util.php 747 - return '' . $uri . '' . $trailer; + if ($longurl = common_longurl($uri)) { + $longurl = htmlentities($longurl, ENT_QUOTES, 'UTF-8'); + $title = " title=$longurl"; + } + else $title = ''; + + return '' . $uri . '' . $trailer; +} + +function common_longurl($uri) { + $uri_e = urlencode($uri); + $longurl = unserialize(file_get_contents("http://api.longurl.org/v1/expand?format=php&url=$uri_e")); + if (empty($longurl['long_url']) || $uri === $longurl['long_url']) return false; + return $longurl['long_url']; hunk ./lib/util.php 766 - $r = preg_replace('@[^*]https?://[^)\]>\s]+@e', "common_shorten_link('\\0')", $r); -// $r = preg_replace('@https?://[^)\]>\s]+@e', "common_shorten_link('\\0')", $r); + // RYM this should prevent * preceded URLs from being processed but it its a char +// $r = preg_replace('@[^*](https?://[^)\]>\s]+)@e', "common_shorten_link('\\1')", $r); + $r = preg_replace('@https?://[^)\]>\s]+@e', "common_shorten_link('\\0')", $r); }