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

DIsable AutoLinking

Discussion in 'XenForo Development Discussions' started by Jeremy, Nov 30, 2010.

  1. Jeremy

    Jeremy XenForo Moderator Staff Member

    I'm working to figure out how to disable auto-linking (or add an option for it at least). I have tried quite literally EVERYTHING I can think of. I've extended the class, attempted to add to the array (via $this->_disableAutoLink[] = 'aTag'), modified the core class to add my tag... None of it worked. Adding my
    tag to the core class and posting the following:
    gave me:
    with dontlinkme.com being linked. and the end spoiler code being added, because the look is correct.

    I've also tried stringifying the children tree, setting a rendererState of 'stopAutoLink' to true before parsing the children string... I'm honestly at a loss. Thoughts?
  2. Kier

    Kier XenForo Developer Staff Member

    Testing... http://www.example.com testing
  3. Kier

    Kier XenForo Developer Staff Member

    The [plain] BB Code is your friend :)
  4. Kier

    Kier XenForo Developer Staff Member

    Though doing it in code... hmm...
  5. Michael Dance

    Michael Dance Active Member

    that looks confusing
  6. Jeremy

    Jeremy XenForo Moderator Staff Member

    Yeah, I'm attempting to allow certain BBCodes to disallow auto-linking. Hence the attempt to extend and add, but that didn't work. Core modification seemed to output weird results, and adding something as simple as 'i' in the array didn't even work. I am banging my head off the desk... lol.
  7. Jaxel

    Jaxel Well-Known Member

    Can't you just create your own callback function? Then it wont autolink...
  8. Indigo

    Indigo Active Member

    The autolinking is done before the *real* bb code parsing, from what I've seen. When creating a post, it runs through a special autolink formatter that wraps URLs with url tags before saving it to the database.
  9. Jeremy

    Jeremy XenForo Moderator Staff Member

    The spoiler is callback.
  10. Jaxel

    Jaxel Well-Known Member

    Then how come URLs are not parsed in CODE?
  11. Indigo

    Indigo Active Member

    Because the code tag is listed in the _disableAutoLink property of XenForo_BbCode_Formatter_BbCode_AutoLink.
  12. Jeremy

    Jeremy XenForo Moderator Staff Member

    I added tags to that, and the output was incorrect. ;) I am still at a loss.
  13. Jeremy

    Jeremy XenForo Moderator Staff Member

    I haven't had the time to sit down and try working on this again (I have a major program due tuesday, 4 papers due tomorrow, and I'm heading out of town tomorrow), but plan to ASAP. Anybody think they may know why adding a code to the _disableAutoLink array would force out put to mess up, in the mean time?
  14. Wootalyzer

    Wootalyzer Active Member

    This thread is really old, but still deserves this little bump. The auto-linker is pretty greedy when it comes to its regex matching, and thus it tends to eat into other things - such as the [/spoiler] tag in this thread's example. My solution was to change library/XenForo/BbCode/Formatter/BbCode/AutoLink.php line 70 from

    This halts any autolinking the moment it hits an open square bracket, which prevents it from ever eating a tag. This has the unintended side-effect of not properly autolinking links with [ in them, but that's a risk I'm willing to take ;)
    Jeremy and Darkimmortal like this.
  15. BJSchee

    BJSchee New Member

    Are there new ideas for the AutoLink problem?
  16. EQnoble

    EQnoble Well-Known Member

    I managed to get the url not to auto parse in a bbcode the problem is I can only make it remove one instance of it per post. wtf. seriously...I may lose my mind tonight.

    I have to ask this just because I do not even know how I would go about searching for it. Is there any mention of having a global on off switch in the acp for autoLink disabling?
  17. CRDeveloper

    CRDeveloper Member

    I just added the media tag to this line at: XenForo_BbCode_Formatter_BbCode_AutoLink

    This is working, no more autolinks inside media bbcode :)

    protected $_disableAutoLink = array('url''email''img''code''php''html''plain''media');
    Brandon Sheley and EQnoble like this.
  18. Sim

    Sim Well-Known Member

    But that requires modification of the core code right?

    Is there a way to add tags to this list from an addon?
  19. Jeremy

    Jeremy XenForo Moderator Staff Member

    Yes, his way is modification to the core. My add-on attempts were failing. 1.1 may have fixed the errors I was having, and will look into it soon.
  20. cclaerhout

    cclaerhout Well-Known Member

    Any news of this tricky stopAutoLink option ? I've tried during hours, but I've failed to do anything with it :( Even with hardcoding.

Share This Page