[wp-hackers] Shortcode parser
Michał Środek
michal at srodek.info
Thu Nov 10 12:15:40 UTC 2011
Hey there,
I'm new here and I'd like to fix some core bugs of WP. The first
issues are connected with Shortcode API.
I found some pretty old bugs in trac:
http://core.trac.wordpress.org/ticket/9264
http://core.trac.wordpress.org/ticket/17657
http://core.trac.wordpress.org/ticket/12982
http://core.trac.wordpress.org/ticket/10702
Someone else was writing a shortcodes patch about year ago(you can
read about it here: http://core.trac.wordpress.org/ticket/14481 ) but
his solution wasn't elegant and compatible with already written wp
code.
I've been preparing a fix which will be work great with wp shortcode
interface but I need some unit tests to check my solution.
The first test php file( not so perfect yet ) is available here:
http://srodek.info/online/wp-hackers/2011-11-10.txt
You can also run it online here
http://srodek.info/online/wp-hackers/2011-11-10.php
Let me know what are you thinking about that. Maybe some of my tests
are incorrect.
The main change is the regular expression which I used. It's much more
precisly because of using recursion. Let me know if you see any bugs
in that regexp.
$regexp = '#(.?)(?:\[('.$tagregexp.')((?:\s|=).*[^\/\]]{1})?\] ( (?:
(?(R) [^\[]++ | [^\[]*+) | (?R)) *) \[/\\2\] |
\[('.$this->allowedShortcodes.')((?:\s|=)[^\/\[\]]+?)?\/?\])(.?)#x';
Warm Regards
Michał Środek
More information about the wp-hackers
mailing list