- Compatible XF 1.x versions
- 1.1
- License
- Creative Commons BY 3.0 license
- Visible branding
- No
THIS ADDON IS NO MORE SUPPORTED
CLICK HERE FOR A CLEAN SOLUTION TO DISABLE THE AUTOLINKING
IF YOU NEED TO UNINSTALL IT, CHECK THE INSTRUCTIONS AT THE BOTTOM OF THIS PAGE
CLICK HERE FOR A CLEAN SOLUTION TO DISABLE THE AUTOLINKING
IF YOU NEED TO UNINSTALL IT, CHECK THE INSTRUCTIONS AT THE BOTTOM OF THIS PAGE
Stop AutoLinking Patch
by Cédric CLAERHOUT
by Cédric CLAERHOUT
Addon PresentationThis addon will avoid the bbcodes url auto-linking (content & options) inside forums and conversations and will prevent errors if tags are used inside the bbcode options.
Function 1:
Code:
[mybbcode]http://www.xenforo.com[/mybbcode]
It won't give you anymore this:
Code:
[mybbcode][URL]http://www.xenforo.com[/mybbcode][/URL]
Don't forget: this is a patch a not a real "disable autolink" function.
Function 2:
If your bbcode supports it this addon will allow you to use tags in bbcodes:
Code:
[mybbcode=[b]This is a title[/b]]This is content[/mybbcode]
This code will be automatically change to:
Code:
[mybbcode={b}This is a title{/b}]This is content[/mybbcode]
It will avoid the bbcode to break and will allow the bbcode creator to use these datas.
Function 3:
Same than function 1, but this time in the bbcode options (it was the most difficult to do).
For normal link:
Code:
[mybbcode=http://www.google.com]This is content[/mybbcode]
For formatted link:
Code:
[mybbcode=[URL=http://www.google.com]Name of link[/URL]]This is content[/mybbcode]
Function 4:
Optional tool to fix xen ALIGN bbcodes behaviour with some bbcodes (see problem here)
Function 5:
Tools for developer to parse options with {tags}{/tags}. See below.
Important
Use at least the 1.3 version of "Custom BB Code Manager"
Installation
- Upload the files on your forum directory
- Import xml file
- Go to the "Custom BB Code Manager", edit one of your Bb Code and save it, even if you do nothing: it will create a cache and prevent to use extra query
(This step has been corrected in the private released of the Custom BB Code Manager. I'm waiting for King to check it and release it)
Configure this addon in admin->home->options->Stop AutoLinking Patch
- Choose the lazy option
- Activate it
How to fix autolinking problems outside XenForo?
If the developer of an external addon didn't use one of the tool available below, you can activate the autolinking fix everywhere in your forum with editing only 1 file:
- Path: {yourforum}/library/XenForo/Helper/String.php
- This fix will only work if the developer didn't forget to use the XenForo censorString inside his addon
PHP:
public static function censorString($string, array $words = null, $censorString = null)
{
Replace with:
PHP:
public static function censorString($string, array $words = null, $censorString = null)
{
$string = Sedo_StopAutoLinkingPatch_Helper_Regex::KillAutoLink($string);
If you do this manual edit, you can "uncheck" the option: "Enable StopAutoLinking addon".
Tools for developers
- TOOL 1: use the Stop AutoLinking Patch inside your addon
If you want to apply the "Stop AutoLinking Patch" regex on a string (any output) it's very easy:
PHP:$string = Sedo_StopAutoLinkingPatch_Helper_Regex::KillAutoLink($string);
- TOOL 2: use special tags in Bb Code opening tag
Example:
Code:[text=This bbcode option from {b}now will be in bold{/b}]This is my bbcode content[/text]
Information:
Here is a function to use inside your bbcode callback in order to detect and parse the special tags {b}{/b}inside a string. This will only use 1 Database request for all the page, not matter how many bbcodes use this function.- The automatic one (since 0.72 version) :
It will check automatically check if your bbcode has {tags} and will parse options then
PHP:if (method_exists($parentClass, 'ParseMyBBcodesOptions')) { $string = $parentClass->ParseMyBBcodesOptions($string); //The string is now parsed }
- The manuel one
If you prefer to only get the parser, do this way:
PHP:if (method_exists($parentClass, 'getParser')) { $parser = $parentClass->getParser(); // get parser $parsedcode = $parser->render($unparsedcode); //parse your code }
- The automatic one (since 0.72 version) :
Translations (Thank you a lot !)
How to uninstall the StopAutolinking Patch
Time has come to get rid of this addon. It has been useful, but like I repeated thousands of times, it's just a patch. So here is how to uninstall it.- Uninstall it or disable it from XenForo (seems logical but I prefer to write it...)
- If you had modified this file {yourforum}/library/XenForo/Helper/String.php
Just search and delete this line:
PHP:$string = Sedo_StopAutoLinkingPatch_Helper_Regex::KillAutoLink($string);
- This addon didn't only fix the URL autolinking before, sometimes it could fix the URL problems after. When I say "after", it's like cleaning the house putting the dust under the carpet. So you will need to search that dust and get rid of it. For 95% of it, it would be really easy. Just do as described:
- Install the Kier "Post Content Find / Replace" addon
- Go to "Tools=>Replace in Posts (on the left column)"
- Use these parameters:
- Regular expression:
Code:#(\[([\w\d]+?)(?:=.+?)\])\[url\](.+?\[/\2\])([^[]+)?\[/url\]#ui
- Replacement string:
Code:$1$3$4
- Do not check yet "Save the changes" => check if the replacements seems ok before to proceed
- Regular expression:
Once done, most of the dust will be gone (probably all of it for most of you). For the other, better to fix the bbcode manually when you see a post with a problem.