Proposal: Also trim https urls [patch]
-
Hi there!
I find it great that URLs in description and such are being trimmed. But I found that https urls don’t get trimmed, only http.
So my proposal is to extend this feature to https, too.
Here is my patch proposal as unified diff:
--- functions.php.orig 2016-11-23 21:11:38.045831470 +0100 +++ functions.php 2016-11-23 21:10:53.656502325 +0100 @@ -320,8 +320,8 @@ $urlname = substr($link, $begin, $length); - $trimmed = (strlen($urlname) > 50 && preg_match('#^(https://|ftp://|www\.)#is', $urlname)) ? substr_replace($urlname, '.....', 30, -5) : $urlname; - $trimmed = str_replace('https://','',$trimmed); + $trimmed = (strlen($urlname) > 50 && preg_match('#^(https://|https://|ftp://|www\.)#is', $urlname)) ? substr_replace($urlname, '.....', 30, -5) : $urlname; + $trimmed = str_replace(array('https://','https://'),'',$trimmed); $ret = str_replace('>' . $urlname . '<', '>' . $trimmed . '<', $ret); }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Proposal: Also trim https urls [patch]’ is closed to new replies.