Why isn't this a bb-code? That would fix a lot of issues, and I would install it if it was.
Check out /includes/class_bbcode.php (particularly the end) for some ideas. You would make this a function and add it to the bbcode_create hook (trust me, don't use the bbcode_fetch_tags hook -- it would conflict with many mods). Then use the 'external_callback' field to connect the function to your bbcode. Oh, and you will need to disable post caching (even in your current code).
Add to your bbcode function: $parser->options['cachable'] = false;
|