Extensions and phpBB 3.2: you should probably read this topic

Discussion forum for Extension Writers regarding Extension Development.
User avatar
JoshyPHP
Code Contributor
Posts: 1012
Joined: Mon Jul 11, 2011 12:28 am

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by JoshyPHP » Mon Sep 26, 2016 9:47 pm

Yes for both.

I'm thinking about using the parser directly because I assume that quotes are already disabled in chat and the message length is custom.
I wrote the thing that does BBCodes in 3.2.

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3793
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by kasimi » Mon Sep 26, 2016 10:11 pm

JoshyPHP wrote:Yes for both.
That's great news, although I'm probably the last to know. :)
JoshyPHP wrote:quotes are already disabled in chat and the message length is custom.
Quotes and pretty much all BBCodes are allowed with the possibility for the admin to disable the ones that shouldn't be used in the chat. I'll have to take a closer look at the message_parser class to find out exactly which checks I'd have to do myself and if it's worth the effort, considering the code needs to work for both 3.1 and 3.2.

Thanks for all the valuable information.

rxu
Extensions Development Team
Posts: 2955
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by rxu » Fri Sep 30, 2016 4:55 pm

In addition to the docs http://s9etextformatter.readthedocs.io/ ... dd_custom/ how does it work when you add custom site manually in regard of saving the data?
While default sites are loaded from the library's preset, it looks like for custom sites there's no place their data is saved to.

rxu
Extensions Development Team
Posts: 2955
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by rxu » Fri Sep 30, 2016 4:58 pm

May this topic be made sticky again, please? Thanks :)

User avatar
JoshyPHP
Code Contributor
Posts: 1012
Joined: Mon Jul 11, 2011 12:28 am

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by JoshyPHP » Fri Sep 30, 2016 5:29 pm

The data you pass to s9e\TextFormatter\Plugins\MediaEmbed\Configurator::add() isn't saved anywhere. It's only used to create the necessary tag and configure the plugin then it's discarded.
I wrote the thing that does BBCodes in 3.2.

rxu
Extensions Development Team
Posts: 2955
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by rxu » Fri Sep 30, 2016 5:33 pm

I just wonder if I need to do ::add in runtime, or after it was used once I can use the tag without adding it every time again in the code.

User avatar
JoshyPHP
Code Contributor
Posts: 1012
Joined: Mon Jul 11, 2011 12:28 am

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by JoshyPHP » Fri Sep 30, 2016 5:36 pm

There's nothing persistent in the library. You'll call add() every time you create a new parser or renderer.
I wrote the thing that does BBCodes in 3.2.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17052
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by DavidIQ » Fri Sep 30, 2016 6:41 pm

rxu wrote:May this topic be made sticky again, please? Thanks :)
Done.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.

rxu
Extensions Development Team
Posts: 2955
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by rxu » Fri Sep 30, 2016 6:54 pm

So, if I want custom site(s) to stay persistent along with default supported sites, I have to save the data in some separate place. Got it.
DavidIQ wrote:Done.
Thanks, as it took some time to find the topic 8-)

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17052
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by DavidIQ » Sat Oct 01, 2016 11:30 am

Looks like this is linked to from this other general topic:
viewtopic.php?f=461&t=2349131
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.

rxu
Extensions Development Team
Posts: 2955
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by rxu » Sat Oct 01, 2016 6:14 pm

Just for the record, custom sites can be added using core.text_formatter_s9e_configure_after event with $configurator->MediaEmbed->add(). This way new site definitions will be also cached.

User avatar
JoshyPHP
Code Contributor
Posts: 1012
Joined: Mon Jul 11, 2011 12:28 am

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by JoshyPHP » Sat Oct 01, 2016 6:42 pm

I assume we're talking about different things. You can configure the MediaEmbed plugin for any number of sites and they'll remain enabled forever for that specific instance, but the definition itself is never saved. It's like custom BBCodes; You can create them using the custom syntax supported in the ACP, but the original definition (e.g. [x]{TEXT}[/x]) is never saved by the library.

Both the custom BBCode syntax and the site definitions used by the MediaEmbed plugin (or for that matter, any plugin) feed into the same system. They are translated into tags, attributes, templates and filters. Those are saved/cached in the parser and renderer instances.

IOW, the site definition is the blueprint, e.g. 3 + 4, and what's saved is the result, 7.
I wrote the thing that does BBCodes in 3.2.

rxu
Extensions Development Team
Posts: 2955
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by rxu » Sat Oct 01, 2016 6:58 pm

Custom BBCode definitions are saved in BBCODES_TABLE and can be retrieved from there anytime to operate, unlike custom sites thing which is not saved anywhere to get/regenerate anytime you need, while default sites are saved/permanently cached right in the library. This is what I'm talking about.

rxu
Extensions Development Team
Posts: 2955
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by rxu » Sun Nov 06, 2016 4:30 am

Just out of curiosity, why duplicating tags to save formatted text in the database? F.e. the message like

Code: Select all

[quote]test textformatter[/quote]
being saved as

Code: Select all

<r><QUOTE><s>[quote]</s>test textformatter<e>[/quote]</e></QUOTE></r>

User avatar
JoshyPHP
Code Contributor
Posts: 1012
Joined: Mon Jul 11, 2011 12:28 am

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by JoshyPHP » Sun Nov 06, 2016 5:02 am

There's really only one set of quote tags in that XML: <QUOTE></QUOTE>. The thing you see in s and e tags is the markup that generated it. Sometimes it would be from a BBCode, sometimes from Markdown, etc... One of the most important features of this storage format is that every single character from the original text is preserved. (except a few control characters like NUL bytes) You can always get the original text back, with the same original markup.

So you need <QUOTE> because that's the language the renderer speaks and you need [quote] (or > in Markdown) so that you can get the original text back. It's relatively efficient when you consider that the alternative would be to store both the original text and the parsed text.
I wrote the thing that does BBCodes in 3.2.

Post Reply

Return to “Extension Writers Discussion”