DIsable AutoLinking

Jeremy

in memoriam 1991-2020
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:
Code:
[spoiler]http://dontlinkme.com[/spoiler]
gave me:
Code:
http://dontlinkme.com[/URL][/spoiler]
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?
 
Though doing it in code... hmm...
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.
 
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.
 
Because the code tag is listed in the _disableAutoLink property of XenForo_BbCode_Formatter_BbCode_AutoLink.
 
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?
 
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

Code:
'#(?<=[^a-z0-9@-]|^)(https?://|ftp://|www\.)[^\s"]+#i',
to
Code:
'#(?<=[^a-z0-9@-]|^)(https?://|ftp://|www\.)[^\s\["]+#i',

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 ;)
 
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?
 
I just added the media tag to this line at: XenForo_BbCode_Formatter_BbCode_AutoLink

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

PHP:
protected $_disableAutoLink = array('url', 'email', 'img', 'code', 'php', 'html', 'plain', 'media');
 
But that requires modification of the core code right?

Is there a way to add tags to this list from an addon?
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.
 
Any news of this tricky stopAutoLink option ? I've tried during hours, but I've failed to do anything with it :( Even with hardcoding.
 
Top Bottom