News:

Wondering if this will always be free?  See why free is better.

Main Menu

Custom BBCodes Manager

Started by dougiefresh, September 14, 2014, 03:10:14 PM

Previous topic - Next topic

dougiefresh

Link to Mod



CUSTOM BBCODE MANAGER v2.8
By Dougiefresh -> Link to Mod



Introduction
This modification adds the ability to create custom Bulletin Board Code (bbcode) for your forum.

Admin Settings
The settings are found in SMF 2.0.x at:
o Admin -> Forum -> Posts and Topics -> Custom BBcode without SMF 2.1-Style Admin Menu mod installed.
o Admin -> Configuration -> Features and Options -> Custom BBcode with SMF 2.1-Style Admin Menu mod installed.

The settings are found in SMF 2.1 at:
o Admin -> Configuration -> Features and Options -> Custom BBcode

To add a custom tag, click the "Create New Tag".  You submit both the tag and upload a button for your new tag.

Image Restrictions
SMF 2.0: The image should be a 23 x 22 GIF with transparent background and no larger than 10kb.

SMF 2.1: The image should be a 16 x 16 PNG with transparent background and no larger than 10kb.

Compatibility Notes
This mod was tested on SMF 2.0.11, but should work on SMF 2.1 Beta 1, as well as SMF 2.0 and up.  SMF 1.x is not and will not be supported.

Translators
o Spanish Latin: Rock Lee
o Dutch: Fixit @ XPtsp.com

Changelog
The changelog can be viewed at XPtsp.com.

License
Copyright (c) 2015 - 2018, Douglas Orend
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

langel

Me podran vetar de mil foros pero nunca me callaran!!

pgn4web

Hello,

I started using this module: thank you very much!

It works but I believe I found a couple of small bugs:

1) I use a fairly complex "HTML used for the tag" expression and I noticed that every time I try to modify an existing tag, the "HTML used for the tag" is truncated after the "{content}" token (the rest of the code I had entered is gone). The issue probably happens when your module fetches the replacement code for the user to edit, since the full code is actually executed after properly entered (however, if you click modify then save, the truncated code is saved and the bbcode fails)

2) I coded a bbcode that could work as "unparsed content" however if I pick "unparsed content" the bbocde does not work. If I pick "unparsed equals" however the bbcode works (even if I never use the equal expression and use only the [tag] ... [/tag] expression)

3) when I pick "unparsed equals" the BBCode summary list shows my new bbcode with "Tag type" = "unparsed_equals" but with "BBCode Usage" = "[pgn=xyz]parsed content[/pgn]"; probably a typo somewhere?

Thanks for the very useful module!

dougiefresh

Interesting bug reports.... Lemme investigate them....  Please tell me the HTML code and settings used with the attempted bbcode.  Thanks!

pgn4web

Quote from: dougiefresh on September 29, 2014, 10:53:36 AM
Please tell me the HTML code and settings used with the attempted bbcode.
It's not a trivial BBCode :-(

The description how to create the BBCode using your module (I just updated it from a previous version using the old module for smf 1.1.x) is here:
https://code.google.com/p/pgn4web/wiki/User_Notes_simplemachines [nofollow]

Here is the proof that the whole machinery actually works:
http://pgn4web-test.casaschi.net/simplemachines/ [nofollow]

Thanks!

pgn4web

Also another small remark: it seems that when you use the "post preview" button while composing a post, the bbcode does not take effect in the preview.

dougiefresh

#6
Uploaded v1.1 - September 29th, 2014
o Fixed bugs that corrupted BBcode HTML codes upon modifying the BBcode.
o Fixed typo relating to BBCode usage in the Custom BBCodes UI page.
o Added English UTF8 language file.

This version does not cover point # 2 found in this post.  Mod is upgradable to v1.1 from v1.0.



Quote from: pgn4web on September 29, 2014, 10:17:01 AM
1) I use a fairly complex "HTML used for the tag" expression and I noticed that every time I try to modify an existing tag, the "HTML used for the tag" is truncated after the "{content}" token (the rest of the code I had entered is gone). The issue probably happens when your module fetches the replacement code for the user to edit, since the full code is actually executed after properly entered (however, if you click modify then save, the truncated code is saved and the bbcode fails)
Thank you for pointing this bug out.  It has been fixed.  Explanation removed due to security concerns....

Quote from: pgn4web on September 29, 2014, 10:17:01 AM
2) I coded a bbcode that could work as "unparsed content" however if I pick "unparsed content" the bbocde does not work. If I pick "unparsed equals" however the bbcode works (even if I never use the equal expression and use only the [tag] ... [/tag] expression)
I based the bbcode parsing method on the contents of Sources/Subs.php, because the parsing engine has to be able to parse what I send it.  I will try to build a help file explanation so that these are understood better, if possible....

Quote from: pgn4web on September 29, 2014, 10:17:01 AM
3) when I pick "unparsed equals" the BBCode summary list shows my new bbcode with "Tag type" = "unparsed_equals" but with "BBCode Usage" = "[pgn=xyz]parsed content[/pgn]"; probably a typo somewhere?
Typo has been fixed.  Thank you for pointing it out.

Quote from: pgn4web on September 29, 2014, 11:09:44 AM
Also another small remark: it seems that when you use the "post preview" button while composing a post, the bbcode does not take effect in the preview.
Lemme look into this one as well....

pgn4web

Quote from: dougiefresh on September 29, 2014, 11:17:48 AM

Quote from: pgn4web on September 29, 2014, 10:17:01 AM
1) I use a fairly complex "HTML used for the tag" expression and I noticed that every time I try to modify an existing tag, the "HTML used for the tag" is truncated after the "{content}" token (the rest of the code I had entered is gone). The issue probably happens when your module fetches the replacement code for the user to edit, since the full code is actually executed after properly entered (however, if you click modify then save, the truncated code is saved and the bbcode fails)
Thank you for pointing this bug out.  It has been fixed.  Explanation removed due to security concerns....


I updated to v1.1 of your module but I still see the "HTML used for the tag" truncated every time I try to modify my bbcode. There might be something more to fix...

pgn4web

One more bug report: if I click the "disable" link for a given tag in the custom bbcode list something weird happen: a "blank bbcode" gets added into the list and the intended bbcode does not get disabled.

dougiefresh

Uploaded v1.2 - September 29th, 2014
o Added code so that "parsed content" tags are recognized properly by BBcode parser.
o Fixed bug so that Custom BBCode UI properly displays HTML that the bbcode will use.

Here's what was happening with the truncated HTML line: The code was outputting the HTML correctly to the browser, but the BROWSER was misinterpreting the block of code as stuff it should execute....  Converting the HTML line to html entities solved the problem.



Quote from: pgn4web on September 29, 2014, 01:00:58 PM
One more bug report: if I click the "disable" link for a given tag in the custom bbcode list something weird happen: a "blank bbcode" gets added into the list and the intended bbcode does not get disabled.
Dangit...  A few more minutes earlier and I wouldn't have uploaded this version  :-[  Oh well....  Confirmed.  Lemme look into it.

pgn4web

Quote from: dougiefresh on September 29, 2014, 01:06:41 PM
Added code so that "parsed content" tags are recognized properly by BBcode parser.
I'm not sure about this one. It might be that I do not understand the difference between parsed content and unparsed content. I thought that the unparsed option would just take the input between the tags as-is without further manipulation while the parsed option might do some manipulation (processing other bbcodes for instance?).
Anyway, with your 1.2 my tag works if defined as "parsed content" and does not work as "unparsed content" (in this case the plain text inbetween tags is show). Not sure, this might actually be the correct behaviour...

Quote from: dougiefresh on September 29, 2014, 01:06:41 PM
Fixed bug so that Custom BBCode UI properly displays HTML that the bbcode will use.
OK, this is fixed now.

dougiefresh

Well, the bbcode parser in Sources/Subs.php interprets an empty bbcode-type field as "parsed_content".  Having "parsed_content" in the bbcode type field does not default it to the proper handling as a "parsed content" type within the parser.  Only by removing the "ctype" field from the array if it contains "parsed_content" does it correctly interpret it as such.  Remember, we are trying to make the parser work for us, but we have to conform to it's expections....  (Plus I'm not rewriting nor altering that mess of a parser....  O:) )

I still need to do some research on how everything behaves (or doesn't :P )  Then maybe I can explain why it does what it does....

Hope this helps....

dougiefresh

#12
Quote from: pgn4web on September 29, 2014, 01:00:58 PM
One more bug report: if I click the "disable" link for a given tag in the custom bbcode list something weird happen: a "blank bbcode" gets added into the list and the intended bbcode does not get disabled.
The v1.3 update resolves this bug report.  Thank you for reporting it.

Quote from: pgn4web on September 29, 2014, 10:17:01 AM
2) I coded a bbcode that could work as "unparsed content" however if I pick "unparsed content" the bbocde does not work. If I pick "unparsed equals" however the bbcode works (even if I never use the equal expression and use only the [tag] ... [/tag] expression)
Version 1.3 does not resolve this "bug" yet.  Thank you for your patience....

pgn4web

Quote from: dougiefresh on September 29, 2014, 01:26:29 PM
Well, the bbcode parser in Sources/Subs.php interprets an empty bbcode-type field as "parsed_content" .... Hope this helps....
I looked at the code but I'm a bit lost.
I could not find anywhere an explanation of what does "parsed content" means and what "unparsed content" means.

On another note, when adding the icon to the post editor, it always adds the equal sign after the tag [mynewtag=] ... [/mynewtag] even when type is "parsed content" then with the equal the bbcode does not work.

dougiefresh

Quote from: pgn4web on September 29, 2014, 02:59:45 PM
I looked at the code but I'm a bit lost.
I could not find anywhere an explanation of what does "parsed content" means and what "unparsed content" means.
On both: You and me both....

Quote from: pgn4web on September 29, 2014, 02:59:45 PM
On another note, when adding the icon to the post editor, it always adds the equal sign after the tag [mynewtag=] ... [/mynewtag] even when type is "parsed content" then with the equal the bbcode does not work.
Wow....  Another bug report....  :-[   Lemme look into it.

dougiefresh

Uploaded v1.3 - September 29th, 2014
o Fixed bug that made empty bbcode entries when attempting to disable/enable bbcodes...
o Removed equal sign from bbcode in editor...

Mod is upgradable from v1.0 thru v1.2 to v1.3.

pgn4web

Quote from: dougiefresh on September 29, 2014, 03:18:22 PM
Fixed bug that made empty bbcode entries when attempting to disable/enable bbcodes...
Removed equal sign from bbcode in editor...
Thanks, both issues are gone.
...and this time no new bugs few seconds after your release!

Thanks.

dougiefresh

LOL!  Thanks for both the feedback and the bug reports, pgn4web!

pgn4web

Quote from: dougiefresh on September 29, 2014, 04:06:46 PM
LOL!  Thanks for both the feedback and the bug reports, pgn4web!
Actually... if I modify a bbcode, it seems the value of "Tag Description for Button" is not saved and shows always as empty :-(

dougiefresh

Uploaded v1.4 - September 30th, 2014
o Fixed several bugs in code involving removing buttons from bbcodes....
o Added code to preserve the bbcode description within the database.
o Added code to remove bbcode button image from server upon deleting bbcode.

Hopefully, this updates solves all reported issues, with exception of #2 in this post....

Advertisement: