[RFC|Accepted] Updated BBcode engine

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
Post Reply
TerraFrost
Former Team Member
Posts: 90
Joined: Wed Feb 09, 2005 12:21 am

Re: [RFC] Updated BBcode engine

Post by TerraFrost » Fri Jun 18, 2010 3:36 am

naderman wrote:Hey Jim, can you please rename your branch to the proper feature/bbcode (or whatever you want to call the feature). Make sure there is a ticket for this on the tracker and then please use git rebase to edit your commit messages to conform with http://wiki.phpbb.com/display/DEV/Git. Thanks.

It seems you have not backported any of the tests. It's important that our new BBCode parser be well tested, so please add unit tests.
I've renamed the branch:

http://github.com/terrafrost/phpbb3/tree/feature/bbcode

Still need to figure out how to rebase, although I think I may have complicated matters by accidentally committing to the develop branch...
EXreaction wrote:Can't we move most of the bbcodes to custom bbcodes?

There could be an option on the bbcode table to use the output from a bbcode.html file so you can set each style independently, but it's probably rather moot as long as we use classes that allow the standard bbcodes to be modified from the CSS easily enough.
What about the PHP functions? The url BBcode has, as of the latest commit, url_tag(), url_children() and url_check(). Maybe we could do create_function() but should we be running PHP code stored in the database? Should admins be able to enter, via the ACP, data that'll be executed as PHP code?

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Karlsruhe, Germany
Contact:

Re: [RFC] Updated BBcode engine

Post by naderman » Fri Jun 18, 2010 10:27 am

TerraFrost wrote:Maybe we could do create_function() but should we be running PHP code stored in the database? Should admins be able to enter, via the ACP, data that'll be executed as PHP code?
No we definately don't want to do that.

User avatar
bantu
3.0 Release Manager
3.0 Release Manager
Posts: 557
Joined: Thu Sep 07, 2006 11:22 am
Location: Karlsruhe, Germany
Contact:

Re: [RFC] Updated BBcode engine

Post by bantu » Fri Jun 18, 2010 12:19 pm

Looking at http://github.com/terrafrost/phpbb3/com ... 992b910caf ... why do you change

Code: Select all

'replace' => '',
to

Code: Select all

'replace' => ''
?

It should really be the other way around. See viewtopic.php?p=209826#p209826 for the reason.

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Karlsruhe, Germany
Contact:

Re: [RFC] Updated BBcode engine

Post by naderman » Sun Jun 27, 2010 9:11 pm

We should probably create a script which can take a posts table and run the old and new bbcode parsers over all posts and identify differences in the result. This should allow us to spot issues with the new parser before it goes live more easily.

TerraFrost
Former Team Member
Posts: 90
Joined: Wed Feb 09, 2005 12:21 am

Re: [RFC] Updated BBcode engine

Post by TerraFrost » Mon Jul 19, 2010 4:52 am

I've committed some more updates. A tentative idea I have for the ACP interface is this: people can add whatever attributes they see fit (close, replace, replace_func, etc). If they do something like replace_func they'll be presented with a dropdown menu where they can select from the currently defined replace_func's. I don't imagine most custom BBcodes will require a replacement function or would want to reuse an existing one but it does maybe provide a way for us to store the BBcode's that use them in the DB, none-the-less.

One problem with this: the quote BBcode. Right now it has two replacement strings depending on if the username is present or not. I'm looking into integrating the BBcode parser with the template engine so that those two strings can instead be replaced with one replacement string - this:

Code: Select all

<!-- IF USERNAME --><blockquote><div><cite>{USERNAME} {L_WROTE}:</cite><!-- ELSE --><blockquote class="uncited"><div><!-- ENDIF -->
Still working on that atm. This would also resolve an open phpBB 3.1 ticket:

http://www.phpbb.com/bugs/ascraeus/44185

User avatar
igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: [RFC] Updated BBcode engine

Post by igorw » Mon Jul 19, 2010 10:59 am

That would be truly awesome.

Would replace_func's provide a way for MODs to define a preg_replace_callback and then hook into the bbcode engine?

APTX
Registered User
Posts: 680
Joined: Thu Apr 24, 2003 12:07 pm

Re: [RFC|Accepted] Updated BBcode engine

Post by APTX » Thu Jul 22, 2010 1:45 pm

No, all the *_func's are there to provide a way to use logic or outside data while handling a BBCode. You cannot change the BBCode syntax.
Don't give me my freedom out of pity!

User avatar
Ger
Registered User
Posts: 287
Joined: Mon Jul 26, 2010 1:55 pm
Location: 192.168.1.100
Contact:

Re: [RFC|Accepted] Updated BBcode engine

Post by Ger » Tue Jul 27, 2010 3:09 pm

Could you make it possible to use PHP in BBcodes, maybe through hooks?
In the custom BBcode manager of IPB3.0 you can point to a file that handles the custom BBcode. That comes in handy when you have the need of server sided handling. On a forum I contribute to we use it for stuff like LaTeX, sponsored links to books, DVD's, etc, permission based BBcodes and much more. On another forum of which I'm the owner and that runs on phpBB I'd like to use that too. Using phpBB 3.0 I made changes to the core files (bbcode.php and message_parser.php) and I'd rather do this through a hook.
Above message may contain errors in grammar, spelling or wrongly chosen words. This is because I'm not a native speaker. My apologies in advance.

APTX
Registered User
Posts: 680
Joined: Thu Apr 24, 2003 12:07 pm

Re: [RFC|Accepted] Updated BBcode engine

Post by APTX » Fri Jul 30, 2010 5:22 pm

This is already possible with *_func's.
Don't give me my freedom out of pity!

User avatar
igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: [RFC|Accepted] Updated BBcode engine

Post by igorw » Sun Aug 29, 2010 3:06 pm

I created a ticket for this: http://tracker.phpbb.com/browse/PHPBB3-9795

Post Reply