1. 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 ?

Discussion in 'XenForo Questions and Support' started by Weppa333, Jan 2, 2014.

  1. Weppa333

    Weppa333 Active Member

    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: Jan 2, 2014
  2. Weppa333

    Weppa333 Active Member

    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);
                                    }
                            }
     
  3. Weppa333

    Weppa333 Active Member

    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.
     
    Dryline and DroidOne like this.
  4. DroidOne

    DroidOne Well-Known Member

    Last edited: Nov 13, 2014

Share This Page