Location: bbcode.php, bbcode_cache_init(), likely just after
if (isset($rowset[$bbcode_id]))
Parameters:
$rowset[$bbcode_id]
(or just $bbcode_id
, see explanation)Explanation:
I'm currently busy porting the MathJax phpBB integration mod. This mod/extension adds one or two bbcodes, which require an external javascript library to be loaded. One of the code changes for phpBB 3.0 was in
/includes/bbcode.php
, as follows:
Code: Select all
<find><![CDATA[ if (isset($rowset[$bbcode_id]))
{]]></find>
<action type="replace-with"><![CDATA[ global $config;
if (isset($rowset[$bbcode_id]))
{
if (!empty($config['mathjax_enable']) && !empty($rowset[$bbcode_id]['is_math']))
{
$template->assign_var('S_ENABLE_MATHJAX', true);
}
]]></action>
As for how the event should be included I'm not entirely sure. Assuming the event will be placed in place where the above modification is made (somewhere near line 340), it would be best to pass $rowset[$bbcode_id] with the event, because it provides all required information. Alternatively, one can also pass $bbcode_id only, but then the extension would have to make extra database queries to receive the right information.
Maybe the event can also be generalised from custom bbcodes to all bbcodes, triggering the event just before
foreach ($bbcode_ids as $bbcode_id)
. That would imply however, that $bbcode_id will be passed, and extra database queries would possibly be needed, as argued above. Also, in this case extra care must be taken by extension developers using this event, as if (isset($rowset[$bbcode_id]))
hasn't been yet checked for them.For my port the first option would suffice perfectly, but the second might also be considered.