• Welcome to Simple Machines Community Forum. Please login or sign up.

Hook to help deal with auto-embed URLs for tags....

Started by dougiefresh, October 03, 2015, 01:22:51 PM

Previous topic - Next topic


I would love to see a hook that would enable auto-embed functions to change the message so that the auto-embedding takes place after bbcode tag definition and before bbcode tag parsing.

In SMF 2.0.x, my suggested placement would be like this:

$message = strtr($message, array("\n" => '<br />'));

At Line 1705:
// Call integration function to auto-embed stuff:
call_integration_hook('integrate_auto_embed', array(&$message));

// The non-breaking-space looks a bit different each time.
$non_breaking_space = $context['utf8'] ? ($context['server']['complex_preg_chars'] ? '\x{A0}' : "\xC2\xA0") : '\xA0';


SMF 2.1 has an "integrate_pre_parsebbc" hook, which is called before the bbcode tags are defined, which should be sufficient for this purpose.

// Allow mods access before entering the main parse_bbc loop
call_integration_hook('integrate_pre_parsebbc', array(&$message, &$smileys, &$cache_id, &$parse_tags));
Michael Eshom
Cincy Space - now open!


Damn, I didn't even see that one....  How embarrassing....  Thanks!


Here's a stupid question (hopefully not!): Can the callback function only have one parameter, even though 4 are sent by the call_integration_hook function?  For example:

function Blah_Blah_Blah(&$message)


No, it will need all the parameters, even if you don't use them all.
Michael Eshom
Cincy Space - now open!