Resource icon

Custom BB Code Manager v1.3.4

No permission to download
Version 1.3.5.6 - Change Log:
Link to download
  • Add an argument to template callback signature: &$fallBack
    • Modified the formatter to add a default fallback which is the content of the Bb Code wrapped inside a div tag with a custom CSS class
    • Updated the Html BbCode (Raw Bb Code) with this new fallBack argument
    • When a Fallback is needed? When we are in the admin side and (may be) with email templates See here. @Thanks to Havanaclub
      So as you can guess this fallback is not the most important thing for a normal use of your Forum. And there will be may be a way to fetch the public template and avoid this fallback in a future release.
  • Fix a mistake in the template callback signature ($parentClass is not in reference)
    @lms: you just need to modify this phrase: bbcm_template_callback_arguments_list (nothing more)
To upgrade:use the Chris AutoInstaller addon or upload files/import xml
 
So basically it means we can use the BBcode in email templates?
When we look inside the formatter class, we can see that the XenForo default Bb Codes (php/html/code/quote) use by default a template to display but also have a fallback. This fallback is needed when the "page view" element is not available. This "page view" element is not available in the admin templates and may be in the email templates too (I haven't checked). So it means if you use the template method or use templates to create your Bb Code (inside the classic php callback method), you need to set a fallback for the administration side. For the template method, I've just set a default fallback in the last version which will display the content of the BbCode (if no parser permission has been set) inside a basic <div /> tag.

Now I've been contacted by pm and someone showed me a solution how to fetch public template and cache them even when the "page view" is not available and when the user is on the admin side. I will look at it later. It's not that important because 99,9% of the time Bb Codes are used to be displayed in the pubic side.

So if you want to try to create a Bb Code with templates, do it and have fun. Anyway, even if XenForo develops an official bbcm, it will certainly use templates with an optional callback as they do with templates. So your work won't be lost.
 
If you have previously modified this file: {yourforum}/library/XenForo/ViewPublic/Helper/Editor.php
Open it and search:
PHP:
        /*Hack starts here - To remove it, just delete all code between*/
        if(XenForo_Application::get('options')->get('Bbcm_Bm_Forum_Config'))
        {
            $viewReflected = new ReflectionObject($view);
            if($viewReflected->hasProperty('_params'))
            {
                $_params = $viewReflected->getProperty('_params');
                $_params->setAccessible(true);
                $params = $_params->getValue($view);
                $editorOptions['bbcm_bm_editor'] = (isset($params['forum']['bbcm_bm_editor']))? $params['forum']['bbcm_bm_editor'] : false;
            }
        }
        /*Hack finishes here*/

Then delete this code. That's all.
 
Version 1.3.6 - Change Log:
Important update - Link to download
  • To make it simple, the parser permissions have been fixed (they didn't work well with identical nested tags)
    • the template callback variable "hasUserPerms" has been renamed to "canUseBbCode"... it's easier like this
  • The "Editor Configuration Tool" by forums doesn't require any file edit anymore (see here to reverse the change you could have made)
  • After the Parser permissions (permissions by posters), here comes the View permissions (permissions by viewers)
    • A Bb Code Content Protection System has been included - you must activate it first and carefully read the disclaimer
  • You can choose to display or not the Bb Code inside the XenForo Bb Codes Help Page
  • The layout of the Bb Code add/edit page has been modified. It has now tabs inside the Bb Code Manager.
    • The Button Manager still continue to use the classical view => tabs are not working with the overlay
  • Many phrases have been modified (@lms sorry for this)
  • Many others things I certainly forgot
To upgrade:use the Chris AutoInstaller addon or upload files/import xml

The Bbcm has finally all the functions I wanted to, except may be the wrapping function but this isn't so important. I hope XenForo developers will try to include these functions when they will release an official Bb Codes Custom Manager.
 

Attachments

  • present1.webp
    present1.webp
    35.8 KB · Views: 13
  • present2.webp
    present2.webp
    68.8 KB · Views: 12
Version 1.3.6 - Change Log:
Important update
  • To make it simple, the parser permissions have been fixed (they didn't work well with identical nested tags)
    • the template callback variable "hasUserPerms" has been renamed to "canUseBbCode"... it's easier like this
  • The "Editor Configuration Tool" by forums doesn't require any file edit anymore (see here to reverse the change you could have made)
  • After the Parser permissions (permissions by posters), here comes the View permissions (permissions by viewers)
    • A Bb Code Content Protection System has been included - you must activate it first and carefully read the disclaimer
  • You can choose to display or not the Bb Code inside the XenForo Bb Codes Help Page
  • The layout of the Bb Code add/edit page has been modified. It has now tabs inside the Bb Code Manager.
    • The Button Manager still continue to use the classical view => tabs are not working with the overlay
  • Many phrases have been modified (@lms sorry for this)
  • Many others things I certainly forgot
To upgrade:use the Chris AutoInstaller addon or upload files/import xml

The Bbcm has finally all the functions I wanted to, except may be the wrapping function but this isn't so important. I hope XenForo developers will try to include these functions when they will release an official Bb Codes Custom Manager.

Version 1.3.5.6 - Change Log:
  • Add an argument to template callback signature: &$fallBack
    • Modified the formatter to add a default fallback which is the content of the Bb Code wrapped inside a div tag with a custom CSS class
    • Updated the Html BbCode (Raw Bb Code) with this new fallBack argument
    • When a Fallback is needed? When we are in the admin side and (may be) with email templates See here. @Thanks to Havanaclub
      So as you can guess this fallback is not the most important thing for a normal use of your Forum. And there will be may be a way to fetch the public template and avoid it in a future release.
  • Fix a mistake in the template callback signature ($parentClass is not in reference)
    @lms: you just need to modify this phrase: bbcm_template_callback_arguments_list (nothing more)
To upgrade:use the Chris AutoInstaller addon or upload files/import xml

Version 1.3.5.5 - Change Log:
  • The installer has been modified:
    • On a fresh install, no more Bb Code will be automatically installed.
    • You will need to install the Bb Code xml file from the "extras" directory of this archive.
  • New parsing method from templatesadded
    • It's easy and safe to use (see the demo of the new highlighting Bb Code)
    • This new template parsing method has also its own callback (easier to use than the callback parsing method)
  • New parsing permissions added - only works in posts(doesn't work with XenPorta)
    • Parsing permission based on usergroups
    • When the user is unauthorised, the parser return can be modified
    • See the demo of the new Html Bb Code (again, it will only work in posts. This is just for the demo - no support given)
  • New option to parse or not Bb Codes inside the options of the opening tag
    • Example: [bbcode=[b]Caption[/b]]Content[/bbcode]
    • You can test this with importing again the spoiler Bb Code.
  • The highlighting, Html and spoiler Bb Codes are provided with Buttons
  • The layout of the Bb Code add/edit page has been modified, new phrases, new categories, new explanations, etc.
  • A bug of the Button Manager has been corrected when setting permissions to the button
  • Some code of the Bbcm Datawriter has been modified to give better information when an error occurs
  • Tested on two forums (update) + 1 forum (fresh install)
To upgrade:use the AutoInstaller addon or upload files/import xml

Version 1.3.5.4 - Change Log:
  • Add two new tools for Bb Code developers (who are using callbacks)
  1. A tool to render a template directly from the callback
  2. A tool to cache this template to avoid database queries
  • Here's a short example.
To upgrade:use the AutoInstaller addon or upload files/import xml

Version 1.3.5.3 - Change Log:
  • Installer modified (quick fix, would need to be fully rewritten)
  • Fix a bug when disable/enable buttons (quick fix too)
To upgrade:use the AutoInstaller addon or upload files/import xml


Version 1.3.5.2 - Change Log:
  • The options for the Bbcm (BbCodes Custom Manager) and the Bm (Button Manager) are now separated
  • The Bm can now create different layouts for the Editor
    The configuration of those layouts can be set by:
    1. Mobile Devices with an option for Tablets
    2. XenForo Controller Name, Controller Action, and/or View Name
      It will allow you to have for example a more basic editor for the quickreply (Threads) like on vBulletin 3.x
    3. Forums (you will need to manually edit 1 file)
  • Modification of post #346 has been done since I've just helped a user who had a problem with this and this modification fixed the problem
  • Correct a small bug with the Bm
To upgrade:use the AutoInstaller addon or upload files/import xml
Before asking questions, please read at least what I've written in the options. Thanks.

Special thanks to lms & MOZ who helped me to fix bugs and give me some ideas & feedbacks

Version 1.3.5.1 - Change Log:
  • Fix an extra loop in a "for" command when using the "advanced tag" option that could generate an error about a missing key array (+ add a small piece of code to avoid any problem with this) - Thanks to Peter to have found the problem
  • Fix a problem when:
    1) using a single tag option but without the "advanced tag" option
    2) using a percentage in the tag replacements (width/height/etc.)
    Reason: the percentage needed to be doubled to be conformed to the sprintf command

    The fix is automatic, no need anymore to add an extra percentage sign
To upgrade:use Chris AutoInstaller addon or only upload files (just 1 file has been modified)

Version 1.3.5 - Change Log:
  • New option to disable the autolinking per Bb Code - For developers who don't use BBCM, the solution is here.
  • New option (XenForo Options=> BbCode Custom Manager=>Customized BbCodes Options Separator) to customize the separator to use in the Bb Codes options
  • The BbCode Base Class has been rewritten - @SchmitzIT: I've tested in Xampp (php 5.4) and didn't have any problems (I didn't proceed to the same tests with the 1.3.4 version to check if there was or not a problem before)
  • Some of the tools of the StopAutoLinking Patch have been integrated: one fix for BbCodes alignment that should be included in the next version of XenForo (source: Kier) & one tool for BbCode Creators (I will publish a tutorial with a little framework, the one I've been using with my personal addons for more than a year) - edit: tutorial is here
  • Fix a small bug with the category color of the orphans buttons when they were edited from the Buttons Manager
  • In the 1.3.4 version the sql characters limit had been increased for the replacements fields but I had forgotten to increase this limit in the datawriter as well - @skontakt: your bug should be fixed
  • Fixed a bug to be able to rename the BbCode Tag name
  • The previous js fix for nested spoiler has been included
To upgrade:use Chris AutoInstaller addon or do as usual (upload files + import xml)

After more than a year, I've finally got rid of my StopAutoLinking Patch.
  1. For those who used it, you will need to read that post to uninstall it.
  2. You will have of course to edit all your Bb Codes that are using a URL and select the option to disable the autolinking in the BBCM BbCode Edit Window. Select this option: "Disable autolinking in all the tag content".
  3. For those you are using my Advanced BBcode ToolBar addon or those who want to be able to use tags in the bbcodes options, you will need after all this to edit 1 line of a XenForo php (see the first post of that thread). Don't worry, this will be far more cleaner than the StopAutoLinking Patch.
This version and all the procedure described have been been tested on two websites (one is using XenPortal), have been tested one pages using many bbcodes, but have been tested online only with PHP 5.3. PHP 5.4 has only been tested with Xampp.

P.S: I do not support this addon, I simply use it because I need it.
All the modifications I've made are under the license Creative Commons BY 3.0.
You've been busy!
 
but i am on php 5.3
May be your server configuration show more errors than mine. But what is sure is that I need to learn more about references in function ^^
Tell me if the new version is working (see here). I've also fixed another important thing to avoid problems with json.
P.S: I need to go now, I won't be available for the next hours.
 
May be your server configuration show more errors than mine. But what is sure is that I need to learn more about references in function ^^
Tell me if the new version is working (see here). I've also fixed another important thing to avoid problems with json.
P.S: I need to go now, I won't be available for the next hours.
worked. thanks
 
mmh, i think there is something wrong with the premium bb code.
where can i found it?
now my old premium codes are also not working. cannot see any content inside (protected content)
 
Ok Quick answer from my iPod:
This normal. This is the new content protection system.
You need to create a new bbcode. It just need a content. That's all.
What you can do:
Create a new template
Put inside
{xen:raw $content}

Create a new bbcode, use the template method (just type the name if your template)
Set view permissions
Set which unauthorized return you want to use
It's ok then.


I will show you later a little more advanced code to use inside the template to have two different layouts thanks to the variable canViewBbCode.
 
If you prefere to wait disable the bbcm content protection system to give you some time to create the new bbcodes.
 
I tried upgrading from King Kovifor's Custom BB Code Manager 1.3.4 to your new 1.3.6 and got this error:

Fatal error: Call-time pass-by-reference has been removed in /home/user/public_html/library/KingK/BbCodeManager/Protection/Helper/ContentProtection.php on line 63
 
Your version of Custom BB Code 1.3.6 does not install on my live board and won't even install on my local installation.

Admin Control Panel - XenForo
Server Error

Call-time pass-by-reference has been deprecated
  1. XenForo_Application::handlePhpError() in C:\xampp\htdocs\board\library\XenForo\Autoloader.php at line 119
  2. XenForo_Autoloader::autoload() in C:\xampp\htdocs\board\library\XenForo\Autoloader.php at line 119
  3. XenForo_Autoloader->autoload() in C:\xampp\htdocs\board\library\XenForo\Application.php at line 858
  4. XenForo_Application::autoload() in C:\xampp\htdocs\board\library\XenForo\DataWriter\CodeEventListener.php at line 100
  5. XenForo_DataWriter_CodeEventListener->_preSave() in C:\xampp\htdocs\board\library\XenForo\DataWriter.php at line 1422
  6. XenForo_DataWriter->preSave() in C:\xampp\htdocs\board\library\XenForo\DataWriter.php at line 1361
  7. XenForo_DataWriter->save() in C:\xampp\htdocs\board\library\XenForo\Model\CodeEvent.php at line 401
  8. XenForo_Model_CodeEvent->importEventListenersAddOnXml() in C:\xampp\htdocs\board\library\XenForo\Model\AddOn.php at line 311
  9. XenForo_Model_AddOn->importAddOnExtraDataFromXml() in C:\xampp\htdocs\board\library\TMS\Model\AddOn.php at line 20
  10. TMS_Model_AddOn->importAddOnExtraDataFromXml() in C:\xampp\htdocs\board\library\XenForo\Model\AddOn.php at line 225
  11. XenForo_Model_AddOn->installAddOnXml() in C:\xampp\htdocs\board\library\XenForo\Model\AddOn.php at line 169
  12. XenForo_Model_AddOn->installAddOnXmlFromFile() in C:\xampp\htdocs\board\library\XenForo\ControllerAdmin\AddOn.php at line 178
  13. XenForo_ControllerAdmin_AddOn->actionInstall() in C:\xampp\htdocs\board\library\XenForo\FrontController.php at line 310
  14. XenForo_FrontController->dispatch() in C:\xampp\htdocs\board\library\XenForo\FrontController.php at line 132
  15. XenForo_FrontController->run() in C:\xampp\htdocs\board\admin.php at line 13
 
Embedding an attachment as Full Image no longer shows up to logged in members with your latest version of Custom BB Code Manager.

Fatal error: Cannot use object of type XenForo_FileOutput as array in /home/user/public_html/library/XenForo/BbCode/Parser.php on line 164
 
Top Bottom