BBcode issue with 3.2.1

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

BBcode issue with 3.2.1

Post by 3Di »

Hi all,
I just noticed a bbcode out of 2 isn't working any more in my extension (which is a port).
Last time I checked time ago it worked just fine, I am unable to cactch the issue atm.

Here is the repo: https://github.com/3D-I/notebbcode

Here are 2 grabs of the usage, the red one is the faulty one.
.
Screenshot_2.png
Screenshot_2.png (8.1 KiB) Viewed 1154 times
-
Screenshot_1.png
.
I didn't modify the code. Just prettified the Tooltip via CSS, that's all.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di »

BBcodes are installed via migration, here's the excerpt related

Code: Select all

		/**
		 * @var array An array of bbcodes data to install
		 */
		$bbcode_data = array(
			'note' => array(
				'bbcode_match'		=> '[note]{TEXT}[/note]',
				'bbcode_tpl'		=> '<span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span><span class="prime_bbcode_note">{TEXT}</span>',
				'bbcode_helpline'	=> '[note]note text[/note]',
				'display_on_posting'=> 0,
			),
			'note=' => array(
				'bbcode_match'		=> '[note={TEXT1}]{TEXT2}[/note]',
				'bbcode_tpl'		=> '<span class="prime_bbcode_note_text" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);">{TEXT1}</span><span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span><span class="prime_bbcode_note">{TEXT2}</span>',
				'bbcode_helpline'	=> '[note=text-to-note]note text[/note]',
				'display_on_posting'=> 0,
			),
		);
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
JoshyPHP
Code Contributor
Posts: 1288
Joined: Mon Jul 11, 2011 12:28 am

Re: BBcode issue with 3.2.1

Post by JoshyPHP »

It's probably related to this: https://tracker.phpbb.com/browse/PHPBB3-14357

Remove the note= BBCode and modify the other one to use a conditional.
I wrote the library that handles markup in phpBB 3.2+.
User avatar
canonknipser
Registered User
Posts: 2096
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: BBcode issue with 3.2.1

Post by canonknipser »

You can't have two different bbcodes with the same name in 3.2.x, was discussed earlier, eg. : viewtopic.php?f=556&t=2408021&hilit=bbcode+optional





Grfmph - took too long time to find the topic ...
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di »

It doesn't seems to reflect my situation, the first one is not parsed but the second. And I am not using multiple definitions IMO, but..

reading the tracker I see it could be a case-by-case basis
https://tracker.phpbb.com/browse/PHPBB3-14357
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di »

JoshyPHP wrote: Mon Oct 16, 2017 8:12 pm It's probably related to this: https://tracker.phpbb.com/browse/PHPBB3-14357

Remove the note= BBCode and modify the other one to use a conditional.
Thanks Joshy, I will give this a shot. And report..
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di »

Well, no idea and no search results for to where to apply such XSL condition, absolutely no clue atm. :?
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
JoshyPHP
Code Contributor
Posts: 1288
Joined: Mon Jul 11, 2011 12:28 am

Re: BBcode issue with 3.2.1

Post by JoshyPHP »

You should end up with something like that:

Code: Select all

[note text={TEXT1;optional}]{TEXT2}[/note]

Code: Select all

<xsl:choose>
	<xsl:when test="@text">
		<span class="prime_bbcode_note_text" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);">{TEXT1}</span>
		<span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span>
		<span class="prime_bbcode_note">{TEXT2}</span>
	</xsl:when>
	<xsl:otherwise>
		<span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span>
		<span class="prime_bbcode_note">{TEXT2}</span>
	</xsl:otherwise>
</xsl:choose>
Or this, as a simpler template:

Code: Select all

<xsl:if test="@text">
	<span class="prime_bbcode_note_text" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);">
		<xsl:value-of select="@text"/>
	</span>
</xsl:if>
<span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"/>
<span class="prime_bbcode_note"><xsl:apply-templates/></span>
I wrote the library that handles markup in phpBB 3.2+.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di »

Ah I see, the XSL replaces the old HTML replacement, I thought that.

Then I got rid of the note= bbcode and amended the note one to the above code..

There is an issue though, that bbcode doesn't work like

[URL=http...etc...etc]your test here[/URL]

But
[note=]your test here[/note]

notice the ending brace right after the =. So it doesn't work as it should.

Thanks for chiming on this :)

edit: I didn't see your last edit... but nothing changes except for the elegance. :)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di »

Resuming the bbcodes (different spans)

Code: Select all

	'bbcode_match'		=> '[note]{TEXT}[/note]',

	'<span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span><span class="prime_bbcode_note">{TEXT}</span>',


	'bbcode_match'		=> '[note={TEXT1}]{TEXT2}[/note]',

	'<span class="prime_bbcode_note_text" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);">{TEXT1}</span><span class="prime_bbcode_note_spur" onmouseover="show_note(this);" onmouseout="hide_note(this);" onclick="lock_note(this);"></span><span class="prime_bbcode_note">{TEXT2}</span>',
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
JoshyPHP
Code Contributor
Posts: 1288
Joined: Mon Jul 11, 2011 12:28 am

Re: BBcode issue with 3.2.1

Post by JoshyPHP »

That's because an empty string is not a valid URL but it's a valid text. The template above only tests the presence of an attribute, not its content. If you want a test for a non-empty string it would be this:

Code: Select all

<xsl:if test="@text != ''">
I wrote the library that handles markup in phpBB 3.2+.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: BBcode issue with 3.2.1

Post by 3Di »

Yup, thanks for the explaination and help. :)
I sorted out that everything's correct and works as it should.
+100

Above stated issue due to unknown causes but surely my fault. :?

Well, time to adjust the migration to take care of two different versions of phpBB, now.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
Post Reply

Return to “Extension Writers Discussion”