BbCodes & Buttons Manager

Unmaintained BbCodes & Buttons Manager 3.3.5

No permission to download
Version 2.8.2 released
  • Add a Xon tweak that speeds up the tags map creation (used for tag permissions) from 200ms to 2ms according his own tests (when Bb Codes are cached) - A big thank to him. This tweak has been submitted 1 month ago, but since it is related to one sensitive code section I just wanted to test it longer
  • Add an option to strip not only tags but also their content in the fast thread preview; to allow this feature the "eradicator" formatter has been extended - Thanks to CNK
  • Add Redactor solo buttons to the selection area when the addon has just been installed and the config is still blank (it was a bug) - Thanks to Hoffi
  • Add a method to access protected methods of the Base class from the Bb Code callback (reason)
  • Add a way to load globally the parentclass in the Bb Code callback (using a class constructor)
  • Add float Bb Codes as demo in the bulk xml
  • Like
Reactions: Gonanda
Version 2.8.1 released
  • Performance tweaks by Xon (listener hints, xen tags viewing perms caching, class checker caching, etc.) ; a big thank to him
  • Parser perms blank return slightly modified
  • JavaScript conditional slightly modified
Version 2.8.0 released

This update is a major one. It is focusing on XenForo official Bb Codes permissions and Bb Codes content protection. Like for any major version, I recommend first to test it on your dev board.

  • New permissions for the XenForo official Bb Codes
    • Parsing permissions (apply to the poster - experimental):
      • new permission for the url Bb Code
      • can be apply only to some forums if needed
      • description rewritten to differentiate them with the viewing permissions
    • Viewing permissions (apply to the visitor)
      • Permissions to make the Bb Codes look like unparse to some visitors (not that useful but can be needed sometimes) - these permissions can be configured by forums
      • Permissions to hide the content to some visitors - compatible with the protection method
  • Content protection method improved
    One section of the Content protection method (which must be activated) has been totally changed.
    The improvement is not about the protection but to prevent some problems that might occur if only one opening tag of a protected Bb Code is found on the page without its closing tag.

    To make it simple, if you have activated the protection method, once the page is ready to be send to your browser, the html is a last time check to detect any visible protected Bb Codes.
    I was using before the XenForo parser but it doesn't suite this task: if there's no closing tag, all the remaining text was "eaten" and the display of the page was broken.

    To prevent this, I'm using a modified version of the mini parser addon which now has become quite... advanced for a "mini" thing. I've made many tests and it looks the workarounds are effective. I didn't notice any speed difference (would have to be confirmed by frequented website).
  • Pre-parser function rewritten
    The pre-parser function (introduced in the last update) was working on my dev board, but it was more luck than anything else. So I've rewritten it (keeping the same developement structure) using the view.

    It's still compatible with the base and wysiwg formatters. It's still optional. But now, in order to prevent to waste resource, it must be also be enabled by Bbm Bb Codes or XenForo official Bb Codes.
    This function is compatible with the forums, conversations and resource manager.
  • Strike button and toolbar
    The strike button can now be positioned directly in the toolbar. I thought it couldn't, but I was wrong (ref).
  • New parser option: allow Bb Code in signature
    I've just used the XenForo existed function for this. I think it should be compatible from XenForo 1.2, but I haven't tested it.

A manual for developers has also been released. I still need to write an article on how to extend the protection method with other addons.

Attachments

  • bbm_28_bbcode_new_opts.webp
    bbm_28_bbcode_new_opts.webp
    63.1 KB · Views: 84
  • bbm_28_preparser_01.webp
    bbm_28_preparser_01.webp
    28.8 KB · Views: 79
  • bbm_28_strike.webp
    bbm_28_strike.webp
    30.1 KB · Views: 79
  • bbm_28_xentags_parserperms_01.webp
    bbm_28_xentags_parserperms_01.webp
    49.6 KB · Views: 79
  • bbm_28_xentags_parserperms_02.webp
    bbm_28_xentags_parserperms_02.webp
    45.6 KB · Views: 80
  • bbm_28_xentags_parserperms_03.webp
    bbm_28_xentags_parserperms_03.webp
    27.9 KB · Views: 81
  • bbm_28_xentags_viewperms.webp
    bbm_28_xentags_viewperms.webp
    37.2 KB · Views: 80
Version 2.7.0 released

  • New PreCache listener (disable by default)
    I've coded this listener for me, so I've disabled it by default (to enable it, just go inside the "[Bb Codes & Buttons Manager] Bb Codes Manager" options) . If one of your Bb Code needs to make a database request (which means it will make one request each time your Bb Code is parsed - not good -), it allows to pre-cache some data (the parser tree is read a first time), then to use the new listener to make only one database request using these pre-cache data and injecting your needed information in the pre-cache to use them when the parser tree will be read for the second time (and then parsed).

    This listener will work with the Base & Wysiwyg formatters.

    One addon available here needs it: it modifies the attach tag and, if you don't have a php cache system, it will make a db request each time the attach tag is used in your post. I've modified it and the test was successful. I will contact directly the author, but here's what looks like the Bb Code renderer:
    PHP:
            {
              //Php cache conditional
            }
            else
            {
              if(!empty($rendererStates['bbmPreCacheInit']))
              {
                $this->pushBbmPreCacheData('tinhteAioAttachementIds', $attachmentId);
              }
              elseif(!empty($rendererStates['bbmPreCacheComplete']))
              {
                  $bbmPreCacheAio = $this->getBbmPreCacheData('tinhteAioAttachementData');
                
                  if(isset($bbmPreCacheAio[$attachmentId]))
                  {
                    $attachment_check = $bbmPreCacheAio[$attachmentId];
                  }
                  else
                  {
                  //Fallback (should not been needed)
                  $attachment_check = $this->_getAttachmentModel()->getAttachmentById($attachmentId);        
                  }
              }
              else
              {
                //Fallback
                $attachment_check = $this->_getAttachmentModel()->getAttachmentById($attachmentId);
              }
            }

    PHP:
        public static function bbmPreCache(array &$preCache, array &$rendererStates)
        {
        if(empty($preCache['tinhteAioAttachementIds']))
        {
          return false;
        }
        
        $attachementsIds = array_unique($preCache['tinhteAioAttachementIds']);
        $attachementsData = XenForo_Model::create('XenForo_Model_Attachment')->aioGetAttachmentByIds($attachementsIds); //The attachment model has been extended with this new method
        
        $preCache['tinhteAioAttachementData'] = $attachementsData;
        }
  • New JavaScript zLoader (will extend the XenForo ExtLoader)
    1. I was fed up of JavaScript Loading order problems when using the ExtLoader (uses by the XenForo template "require js" tag)
      Expanation:
      Some JS must be loaded before other JS, whereas other must be loaded at the end
      Solution:
      detect if the js file has a prefix (bbm_x_) ; 'x' being a number between 0-9 (will be loaded before other JS) or the letter 'z' (will be loaded after other JS) ; the code is tiny : about 490 bytes
    2. This solution allows to get rid of what I've coded before to be sure the Bbm Redactor JS file is loaded before. There's still an option to load globally this JS file if you need to.

  • The WrapME function has been improved (wrap a Bb Code inside another) - Thanks to @ZeZeene
    It will be automatically disable if the parent tag is 'url'. I think this check must be done globally and not only Bb Code by Bb Code. If you think differently, I can still prevent this check and do it manually in the Bb Codes that need it (spoilerbb from the Bbm Advanced Bb Codes Addon)

  • New internal functions available from Bb Code Callback
    Ie: $parentClass->bbmGetParentTag();

  • Many new Bb Codes helpers
  • Like
Reactions: Gonanda
Version 2.6.2.3 released
  • Prevent a JavaScript error when using TinyMCE Quattro (was triggered because of the Bbm Redactor JS)
    Thanks to Yavuz

  • If you don't use anymore Redactor, you can go the "Buttons Manager Options" and set the option "Redactor Js Loader" to "none".
  • Like
Reactions: Gonanda
Version 2.6.2.2 released

This update is recommended
  • Reduce database requests
    • With XenForo 1.1.x, I've also thought that when using the dataregistry, it doesn't take any extra db request (like with the simple cache). It seems I've dreamt it, because it does... And when you use it several times, it does it a lot.
    • These requests have been turn into a session application to avoid an overload of requests to the database
  • For those who are using XenForo 1.3 beta 3, you can now use the "solo buttons" (ref) instead of the "menu buttons"; you can also use both. This feature is only available with a few buttons: the "strike-through" button is not (yet ?) available as a solo button (see suggestion here, at the bottom of the text).
  • Modification of the editor fallbacks to allow TinyMCE Quattro to load when the Bbm Editor Config was empty (on first installation) - Thanks to Kella

Attachments

  • soloButtons.webp
    soloButtons.webp
    51.9 KB · Views: 43
  • Like
Reactions: Gonanda
Version 2.6.2.1 released
  • Fix listener reference of previous version - thanks to kezako
    (If you didn't see the problem, it simply means you kept on your server the former files)
  • Add a Bbm Redactor loader option to be sure to load custom config when the first editor on the page is loaded from a json request
    Thanks to Lil.Tee for his testings and feedbacks
  • Like
Reactions: Lil.Tee and Gonanda
Version 2.6.2 released
  • Addons Attribution Option:
    • Prevent Bb Codes parsing if addon is disabled
    • Bulk Export - Sort by Addons
    • Admin Bb Codes List - View when addon is disabled
  • Loading Bbm Bb Codes by a registered application
    • Prevent extra db requests
    • Helper available to get them
  • Template helper "bbm_strip_noscript" to strip noscript tags from an html string
  • Main Bbm Listeners in 1 file
  • Fix Editor Buttons Config about the Bb Code uniq identifier (Redactor+Quattro)
  • Modified and improved Quattro Editor Config (require an update of TinyMCE Quattro)

Attachments

  • AddonList.webp
    AddonList.webp
    27.3 KB · Views: 38
  • BbCodesAddonDisabled.webp
    BbCodesAddonDisabled.webp
    25.7 KB · Views: 38
  • ExportByAddon.webp
    ExportByAddon.webp
    50.9 KB · Views: 38
  • Like
Reactions: Gonanda
Version 2.6.1 released
  • Add an option to wrap the XenForo media tag inside another Bb Code
    • I have forgotten this tag, with this option you can wrap for example your youtube videos automatically inside a spoiler tag
    • The spoiler tag available in this addon, will load images and most of videos only once you open the spoiler

Attachments

  • mediawrapper.webp
    mediawrapper.webp
    45.2 KB · Views: 143
Version 2.6.0.1 released
  • Typo fix in class file name Thanks to Lil.Tee
  • Like
Reactions: Gonanda
Top Bottom