BbCodes & Buttons Manager - Advanced Bb Codes Pack

BbCodes & Buttons Manager - Advanced Bb Codes Pack 3.7.2

No permission to download
cclaerhout updated BbCodes & Buttons Manager - Advanced Bb Codes Pack with a new update entry:

Version 3.5.1 released

Version 3.5.1 released
  • Addon updated to be compatible with the new version of TinyMCE Quattro. This version will be published in a few minutes, but you must first update the Quote Me addon and the Bbm Advanced Bb Codes addon if you use them
  • Add an option if you want to disable the new TinyMCE menu integration (if you have enabled it in the TinyMCE Quattro addon)

Read the rest of this update entry...
 
Hello @cclaerhout When I use the [bimg=fleft][/bimg] tags around an image that is uploaded to the post, it doesn't work. Here's the link that the bbcode makes:

<img src="http://attachments.trailpeople.org/2014/02/568_050470d17952be027522c60eff4a7801.jpg" class="attachFull bbCodeImage" alt="attachFull452">

That image url is correct but it looks like that .452 is messing things up. I am using [BD] Attachment store + Amazon S3 as well as [Tinhte] Image optimization. Visitors have access to my attachments.

If I use the url to the image in the tags like this it works good:
Code:
[bimg=fleft]http://attachments.trailpeople.org/2014/02/568_050470d17952be027522c60eff4a7801.jpg[/bimg]
 
@russoroni
So the problem occurs if you use the direct id of the image between tags, that's it ? May be it's because the attachment is stored on a CDN. I can't help you with that, I don't know anything about it.
 
@russoroni
So the problem occurs if you use the direct id of the image between tags, that's it ? May be it's because the attachment is stored on a CDN. I can't help you with that, I don't know anything about it.
Darn... Thanks anyway. It still works. It's just not as user friendly as I would like.
 
I also had a problem using [bimg] tags from this addon along with Sonnb's Trigger Lightbox. So I thought I'd share the solution to this for anyone that wants to use them together. Problem was that if you clicked on the image that is inside the [bimg] tags it would popup in the lightbox like normal but if you then clicked on a different image, let's say a thumbnail embedded in the post somewhere, the lightbox would popup with nothing in it. So Sonnb got back to me with a solution. Here's what he said:

"I have modified the template: sedo_adv_bimg

Which belong to your bbcode addon. Because it has data-src attribute for IMG tags while my addon does not have it, it will break down the lightbox because it will look for data-src attribute."

Here's the updated/edited contents of my sedo_adv_bimg template:

Code:
<xen:require css="sedo_adv_bimg.css" />

<div class="adv_bimg_block {xen:if '{$options.responsiveMode}', 'responsive'}">
    <div class="adv_bimg {$options.blockAlign} {xen:if '!{$options.hasCaption}', 'text_center'}" style="width:{$options.width}{$options.widthType};">
        <xen:if is="{$options.hasCaption} AND {$options.caption.position} == 'top'">
            <xen:if is="{$options.caption.type} == 'inside'">
                <div class="adv_caption caption_inside" style="width:{$options.width}{$options.widthType};">
                    <div class="caption_txt caption_txt_inside" style="text-align:{$options.caption.align};">{xen:raw $options.caption.text}</div>
                </div>
            <xen:else />
                <div class="caption_txt" style="text-align:{$options.caption.align};">{xen:raw $options.caption.text}</div>
            </xen:if>
        </xen:if>
        <a href="{xen:raw $content}" class="LbTrigger" data-href="misc/lightbox"><img class="bbCodeImage LbImage" src="{xen:raw $content}" style="width:{$options.widthImg}" /></a>
        <br />
        <xen:if is="{$options.hasCaption} AND {$options.caption.position} == 'bottom'">
            <xen:if is="{$options.caption.type} == 'inside'">
                <div class="adv_caption caption_inside" style="width:{$options.width}{$options.widthType}; bottom:{xen:if '{$options.isBadIE}', '0', '5px'}">
                    <div class="caption_txt caption_txt_inside" style="text-align:{$options.caption.align};">{xen:raw $options.caption.text}</div>
                </div>
            <xen:else />
                <div class="caption_txt" style="text-align:{$options.caption.align};">{xen:raw $options.caption.text}</div>
            </xen:if>
        </xen:if>
        <xen:if is="!{$options.hasCaption}">
            <span><a
                href="{xen:raw $content}"
                class="LbTrigger"
                data-href="misc/lightbox"><img
                    style="width:{$options.widthImg};display:none;"
                    class="bbCodeImage LbImage"
                    src="{xen:raw $content}"
                />{xen:if
                    '!{$visitor.permissions.forum.viewAttachment} AND !{$xenAddOns.Tinhte_AIO}',
                    '{xen:phrase Sedo_AdvBBcodeBar_text_notmember}',
                    '{xen:phrase Sedo_AdvBBcodeBar_text_clicktoexpand}'}</a></span>
        </xen:if>
    </div>
</div>
 
cclaerhout updated BbCodes & Buttons Manager - Advanced Bb Codes Pack with a new update entry:

Version 3.5.2 released

Version 3.5.2 released

Important:
  • Requires the last update of the Bbm (min: 2.6.2)
  • All Bb Codes must be updated, so import them (xml files in the extra directory) with the Bbm Import function

What's new:
  • Fix Slides Bb Codes when they had inside them a Bb Code that was using the html noscript tag (important to do)
  • Compatible with the Bbm new functions...

Read the rest of this update entry...
 
Is it posssible to have 2 accordions who working together with the close/open? So if I open a tab from the other accordion then the tab in the first accordion get closed.
 
Is it posssible to have 2 accordions who working together with the close/open? So if I open a tab from the other accordion then the tab in the first accordion get closed.
Nope, all accordions are managed independently. Cross elements behaviours like you would like are not really made to work with Bb Codes.
 
Looks like the deferred loading of images wrapped in the spoilerBB tag doesn't work if you automatically wrap all images in said spoilerBB tag using BBM.
Also, some users have been wrapping the url-BBCode around images, resulting in it being put on the spoiler when using BBM to wrap spoilerBBs around the img-tag. Result: whenever you open one of these spoilers, the user is directed to the image in a new tab.
 
Looks like the deferred loading of images wrapped in the spoilerBB tag doesn't work if you automatically wrap all images in said spoilerBB tag using BBM.
Also, some users have been wrapping the url-BBCode around images, resulting in it being put on the spoiler when using BBM to wrap spoilerBBs around the img-tag. Result: whenever you open one of these spoilers, the user is directed to the image in a new tab.
  • I can't reproduce the problem with the spoilerbb Bb Code ; check if you have any JS error inside the console (when you open the spoiler).
  • I'm not sure to understand your second point:
    1. the url Bb Code is not meant to "wrap" any other Bb Codes ; the wrapper Bb Code must be a block that displays a content.
    2. If you mean this kind of code below, then I don't have any problem
      Code:
      [URL]http://www.xenforo.com[/URL][IMG]http://www.{{{{{{}}}}}}/myimage.jpg[/IMG][URL]http://www.xenforo.com[/URL]
 
  • I can't reproduce the problem with the spoilerbb Bb Code ; check if you have any JS error inside the console (when you open the spoiler).
  • I'm not sure to understand your second point:
    1. the url Bb Code is not meant to "wrap" any other Bb Codes ; the wrapper Bb Code must be a block that displays a content.
    2. If you mean this kind of code below, then I don't have any problem
      Code:
      [URL]http://www.xenforo.com[/URL][IMG]http://www.{{{{{{}}}}}}/myimage.jpg[/IMG][URL]http://www.xenforo.com[/URL]
Oops, looks like my limited knowledge of English and my severe headaches screwed things up again.
Please allow me to explain the situation properly this time:

In Admin Control Panel -> Home -> Bb Codes options (Xen) there is an option called XenForo Img wrapper. If you have the Advanced BBCodes Pack installed, this will allow you to select the spoilerbb BBCode. This will result in any occurrence of the img-BBCode being placed inside a spoilerBB-BBCode.

As you know, if an image is put inside of the spoilerBB code the normal way, a user typing
Code:
[spoilerbb][img]http://example.com/test.png[/img][/spoilerbb]
the location is put in the data-spoiler-src attribute rather than the src attribute. This allows you to use JavaScript to only load the image when a user opens the spoiler, by putting the value of the data-spoiler-src attribute into the src attribute.
However, when using the aforementioned feature of the BBodes & Buttons Manager, the image's location is put directly into the src attribute and the data-spoiler-src attribute is not set.

My second problem was basically the twice-aforementioned functionality of the BBodes & Buttons Manager turning
Code:
[url=http://example.com][img]http://example.net/image.png[/img][/url]
into
Code:
[url=http://example.com][spoilerbb][img]http://example.net/image.png[/img][/spoilerbb][/url]
which puts the link around the spoiler rather than the image. While it is default behaviour, in this case it's a tad weird and unconvenient.
 
@ZeZeene
Thanks for the detailled explanations and for... the headache ^^

The first problem was because the wrapMe function doesn't send the real content to the parser. It was done on purpose to avoid to use the php "htmlspecialchars_decode" command. Once the content is parsed, its content is protected against html injection. When the WrapMe function sends the real content, it is already protected. So the code to match (in the spoilerbb callback is not exactly the same). To solve this, I've extended the Bbm Template Method with a restrictive way to use htmlspecialchars_decode. The method is clean and should not make any problem.

The second problem is tricky. The XenForo formatter doesn't have any information about the parent tag. In your case, it is needed to tell the wrapMe function not to be enabled (if the parent tag is url, then don't wrap me). I've tried to emulate a getParentTag function, it should work, I mean it's working, but even if I don't manage to imagine any scenario when this function could not work, I can't say I'm 100% sure of it.

Feel free to try the updated code:
https://github.com/cclaerhout/xen_BBM_v2/commit/3aabee67339c3ce6165dcc29e203208bb2955b6a
(only look at the file: upload/library/BBM/BbCode/Formatter/Base.php)
 
@ZeZeene
I find a better way to optimize the function for your first point (it is almost like the former method but with a different implementation)
Ref: https://github.com/cclaerhout/xen_BBM_v2/commit/bf3bc80e7cb7e0439edbb47534c001c16c47df34

Alright, using the Base.php from that commit results in Fatal error: Cannot use string offset as an array in /home/nginx/domains/melonmancy.net/public/library/BBM/BbCode/Formatter/Base.php on line 700.

Looking at line 700, it seems like either $previousTreeElement, $previousTreeElement['children'] or $previousTreeElement['children'][0] is a string instead of an array.
 
Alright, using the Base.php from that commit results in Fatal error: Cannot use string offset as an array in /home/nginx/domains/melonmancy.net/public/library/BBM/BbCode/Formatter/Base.php on line 700.

Looking at line 700, it seems like either $previousTreeElement, $previousTreeElement['children'] or $previousTreeElement['children'][0] is a string instead of an array.
Try to use this conditional instead:
PHP:
    if(!empty($previousTreeElement['children'][0]['tag'])
       && is_string($previousTreeElement['children'][0]['tag'])
       && $previousTreeElement['children'][0]['tag'] == $currentTag
       && !empty($previousTreeElement['tag'])
     )
     {
       return $previousTreeElement['tag'];
     }
If it doesn't work, give me an access to this file on your ftp so I can directly check.
 
Try to use this conditional instead:
PHP:
    if(!empty($previousTreeElement['children'][0]['tag'])
       && is_string($previousTreeElement['children'][0]['tag'])
       && $previousTreeElement['children'][0]['tag'] == $currentTag
       && !empty($previousTreeElement['tag'])
     )
     {
       return $previousTreeElement['tag'];
     }
If it doesn't work, give me an access to this file on your ftp so I can directly check.
Still getting the same error. However, by removing the ['tag'] part in that part of the code the error disappears. While I realize that breaks the intended functionality, it should at least give you a better idea as to where the error is located.

My best guess: the difference between the code in your message and the previous version is that you are now checking if $previousTreeElement['children'][0]['tag'] is a string, however this doesn't actually accomplish anything as $previousTreeElement['children'][0]['tag'] itself is invalid by definition. $previousTreeElement['children'][0] is a string and "string"[0] doesn't make much sense.

Direct copy of the Base.php file on my server: https://dl.dropboxusercontent.com/u/24958634/Base.php
 
@ZeZeene
Then test this, this looks silly. I thought php doesn't need this (on the opposite of JS):
PHP:
    if(!empty($previousTreeElement['children'])
       && !empty($previousTreeElement['children'][0])
       && !empty($previousTreeElement['children'][0]['tag'])
       && is_string($previousTreeElement['children'][0]['tag'])
       && $previousTreeElement['children'][0]['tag'] == $currentTag
       && !empty($previousTreeElement['tag'])
     )
     {
       return $previousTreeElement['tag'];
     }

P.S: what is your version of php?

Edit:

Or try this (more compact code):
PHP:
    if(   isset($previousTreeElement['children'], $previousTreeElement['children'][0], $previousTreeElement['children'][0]['tag'])
       && is_string($previousTreeElement['children'][0]['tag'])
       && $previousTreeElement['children'][0]['tag'] == $currentTag
       && !empty($previousTreeElement['tag'])
     )
     {
       return $previousTreeElement['tag'];
     }
 
Last edited:
@ZeZeene
P.S: what is your version of php?

I'm currently using PHP 5.4 (For some reason MySQLi failed to compile on 5.5 so I'm using 5.4 at the moment until I get that sorted out)

@ZeZeene
Or try this (more compact code):
PHP:
    if(   isset($previousTreeElement['children'], $previousTreeElement['children'][0], $previousTreeElement['children'][0]['tag'])
       && is_string($previousTreeElement['children'][0]['tag'])
       && $previousTreeElement['children'][0]['tag'] == $currentTag
       && !empty($previousTreeElement['tag'])
     )
     {
       return $previousTreeElement['tag'];
     }

Alright, that appears to be working :)
Now this has gotten me wondering if it actually respects the BBCode cache... after reverting back to the error-free version of Base.php and before using this new (and also error-free (for now ;)) ) version I had re-enabled it with a TTL of 30 days and the data from the src attribute went into the data-spoiler-src attribute in way less than that. Would you like some more headaches?
Now, let's see what happens when someone types [url=http://web.page][b][img]http://example.com/image.gif[/img][/b][/url]...

EDIT: Seems like it doesn't like spoilers-within-spoilers.
Code:
[spoiler][spoiler][img]http://example.com/image.png[/img][/spoiler][/spoiler]
causes the image not to be loaded when the second spoiler is opened.
 
Last edited:
@ZeZeene
Now, let's see what happens when someone types...
That will not work. The function I wrote to get the parent tag from the formatter is a workaround (is only working to a n-1 level). To get the real parent tag, this would require the XenForo parser to be modified. That's one of the reasons I've coded this mini parser (needed to for the table Bb Code included inside the TinyMCE Quattro addon).

P.S: I don't use the Bb Codes Tree cache (it's only the tree that is cached, no the parsed Bb Codes), so I can't confirm. When I've enabled it, I didn't notice any speed improvements.
 
That will not work. The function I wrote to get the parent tag from the formatter is a workaround. To get the real parent tag, this would require the XenForo parser to be modified. That's one of the reasons I've coded this mini parser (needed to for the table Bb Code included inside the TinyMCE Quattro addon).

Alright, thanks.

Also, instead of styles/default/xenforo/clear.png you could just set the placeholder src attribute to data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs= to avoid making another HTTP request. This is the data:URI'd version of the tiniest .gif possible (no colour table, no graphic control extention, etc. - still works in image editors and browsers though and it's not supposed to be visible anyway)
 
Top Bottom