Skip to content

Instantly share code, notes, and snippets.

@rxu
Created March 19, 2012 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rxu/2113808 to your computer and use it in GitHub Desktop.
Save rxu/2113808 to your computer and use it in GitHub Desktop.
Extract into globals
// Param $event_data array Compacted array of variables
function phpbb_add_event($event_name = '', $event_data = array())
{
global $phpbb_dispatcher;
// Return if no event data is given
if (empty($event_name) || empty($event_data))
{
return;
}
// Globalize compacted variables
foreach ($event_data as $key => $value)
{
global $$key;
}
$event = new phpbb_event_data($event_data);
$phpbb_dispatcher->dispatch($event_name, $event);
extract($event->get_data_filtered($event_data));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment