Stop AutoLinking Patch (NO MORE SUPPORTED)

Unmaintained Stop AutoLinking Patch (NO MORE SUPPORTED) 0.91

No permission to download
Compatible XF 1.x versions
  1. 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​
Stop AutoLinking Patch
by Cédric CLAERHOUT
Addon Presentation
This 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
  1. Upload the files on your forum directory
  2. Import xml file
  3. 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)
Configuration

Configure this addon in admin->home->options->Stop AutoLinking Patch
  1. Choose the lazy option
  2. Activate it
That's enough, unless you want to use Extra functions. Don't use any Debug functions, unless someone told you to

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
Search:
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

  1. 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);
  2. 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
                    }
Paypal donation

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.

  1. Uninstall it or disable it from XenForo (seems logical but I prefer to write it...)
  2. 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);
  3. 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

    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.
  • demo.webp
    demo.webp
    44.8 KB · Views: 509
Author
cclaerhout
Downloads
350
Views
1,218
First release
Last update

Ratings

5.00 star(s) 3 ratings

More resources from cclaerhout

Latest updates

  1. Version 0.91 released

    Version 0.91 released Test routine added to check if Custom Bb Code Manager is available To...
  2. Version 0.9 released

    Version 0.9 released Lazy config doesn't use any query now... then select it!:) You MUST use...
  3. Version 0.8.1 released

    Version 0.8.1 released Fix a tool for developers using special tags:{tag} {/tag} If you don't...

Latest reviews

Nice share! Thanks ;)
Great work!
Awesome! Thanks man! just what I was looking for!
I had to use[plain][/plain] to prevent the same thing...
Top Bottom