Esempio n. 1
0
/**
 * Hook multiple callback functions to multiple events.
 * @param array Event name/callback pairs
 * @param string Plugin basename
 * @access public
 */
function event_hook_many( $p_hooks, $p_plugin = 0 ) {
	if( !is_array( $p_hooks ) ) {
		return;
	}

	foreach( $p_hooks as $t_name => $t_callbacks ) {
		if( !is_array( $t_callbacks ) ) {
			event_hook( $t_name, $t_callbacks, $p_plugin );
			continue;
		}

		foreach( $t_callbacks as $t_callback ) {
			event_hook( $t_name, $t_callback, $p_plugin );
		}
	}
}
Esempio n. 2
0
/**
 * Hook multiple plugin callbacks at once.
 * @param array Array of event name/callback key/value pairs
 */
function plugin_event_hook_many($p_hooks)
{
    if (!is_array($p_hooks)) {
        return;
    }
    $t_basename = plugin_get_current();
    foreach ($p_hooks as $t_event => $t_callbacks) {
        if (!is_array($t_callbacks)) {
            event_hook($t_event, $t_callbacks, $t_basename);
            continue;
        }
        foreach ($t_callbacks as $t_callback) {
            event_hook($t_event, $t_callback, $t_basename);
        }
    }
}