From: Marcel Werk Date: Wed, 6 Feb 2013 00:47:28 +0000 (+0100) Subject: Added generic method for generating anchor tags X-Git-Tag: 2.0.0_Beta_1~502 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=593c4fad1db35cbcb13c62a3146f3b7ae71ad203;p=GitHub%2FWoltLab%2FWCF.git Added generic method for generating anchor tags --- diff --git a/wcfsetup/install/files/lib/util/StringUtil.class.php b/wcfsetup/install/files/lib/util/StringUtil.class.php index 090610894f..3b4c0611cc 100644 --- a/wcfsetup/install/files/lib/util/StringUtil.class.php +++ b/wcfsetup/install/files/lib/util/StringUtil.class.php @@ -1,5 +1,6 @@ isInternalURL($url)) { + $external = false; + } + + // cut visible url + if (empty($title)) { + // use URL and remove protocol and www subdomain + $title = preg_replace('~^(?:https?|ftps?)://(?:www\.)?~i', '', $url); + + if (self::length($title) > 60) { + $title = self::substring($title, 0, 30) . self::HELLIP . self::substring($title, -25); + } + } + + return ''.self::encodeHTML($title).''; + } + /** * Splits given string into smaller chunks. *