• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 Automatic shortening of URL bbcode : where's the limit ?

Weppa333

Active member
#1
Hello,

I've noticed that XenForo seems to shorten very long URLs in the UGC, for example
http://www.looooooooooooooooooooooo...ooooooooooooooooooooooooooooooooooooooong.com

Because of layout issues, I'd like to find the number of characters this is limited to. But I can't find a setting, and quickly looking at the bbcode code did not help me.

Any idea where this is located (even if this is in the source php) ?

Thanks for your help,
 
Last edited:

Weppa333

Active member
#2
I found it, in Formatter/Base.php

Seems to be hardwired at 100 chars
PHP:
 if (!empty($rendererStates['shortenUrl']))
                        {
                                $length = utf8_strlen($text);
                                if ($length > 100)
                                {
                                        $text = utf8_substr_replace($text, '.o..', 35, $length - 35 - 45);
                                }
                        }
 

Weppa333

Active member
#3
Just a suggestion, this code could maybe be replaced by a css3 rule (white-space nobreak /ellipsis )
This would be much more efficient as it should limit the link to a single line even if the link is posted at the end of a line

My 2 cents, I'll do that on m own install.
 

DroidOne

Well-known member
#4
Last edited: