1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum is for release discussion only. Discussions that do not relate specifically to the resource release should be discussed in another, more appropriate forum.
    Dismiss Notice
  3. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Adding more supported protocols to URL tag (e.g. http, ftp)

Discussion in 'Code Modifications [Archive]' started by Jake Bunce, May 31, 2011.

  1. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    (per this post)

    There is no configurable option to change that behavior. You can do it with a code modification:

    library/XenForo/BbCode/Formatter/Base.php

    Find this code:

    Code:
    		if (preg_match('#^(https?|ftp)://#i', $url))
    		{
    			return $url;
    		}
    
    Change to this:

    Code:
    		if (preg_match('#^(https?|ftp|mms)://#i', $url))
    		{
    			return $url;
    		}
    
    Ideally you will want to make this into an addon rather than modify the files directly.

    Or you can probably do it with HTML:

    http://xenforo.com/community/threads/parsehtml-permission-enabled-html-bbcode.8262/
     
    EQnoble and Ryan Kent like this.
  2. digitalpoint

    digitalpoint Well-Known Member

    You could probably just simplify it down to:

    PHP:
    if (substr_count($url'://'))
    {
        return 
    $url;
    }
    Since "://" can only be in the portion of a URL that specifies the protocol... then it would also work for all protocols.
     
    smartpixels and (deleted member) like this.

Share This Page