esotalk / esoTalk

Fat-free forum software.
GNU General Public License v2.0
1.47k stars 236 forks source link

Rewrite BBCode parser to use the method found on Stackoverflow #270

Open tvb opened 10 years ago

tvb commented 10 years ago

http://stackoverflow.com/questions/1799454/is-there-a-solid-bb-code-parser-for-php-that-doesnt-have-any-dependancies/1799788#1799788

tvb commented 10 years ago

Remove control characters from the post.

//$sender->content = preg_replace('/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F]/', '', $sender->content);
// \[ (i|b|color|url|somethingelse) \=? ([^]]+)? \] (?: ([^]]*) \[\/\1\] )
tvb commented 10 years ago

Wouldn't it be better to incorporate something like https://github.com/milesj/decoda

JoshyPHP commented 10 years ago

If you're considering using a BBCode library I'd like to suggest my own, which you can find at https://github.com/s9e/TextFormatter

It's a text formatting library with a BBCode plugin. It supports any number of custom BBCodes, or if you don't want to create your own BBCodes you can use a premade bundle. If all you want are the 6 basic BBCodes I see in your current BBCode plugin, this may be overkill. You might as well keep your custom solution if it works for you.

tobyzerner commented 10 years ago

Yeah, we should definitely be using a library instead of homebrew code

pwFoo commented 10 years ago

Maybe should be changed to textile / markdown format? Should be much more comfortable typing a post from mobile ;)