Skip to content

Instantly share code, notes, and snippets.

@FluxCoder
Last active March 10, 2019 18:06
Show Gist options
  • Save FluxCoder/1fd49a0f5f403cdb95da63e6e1d3857e to your computer and use it in GitHub Desktop.
Save FluxCoder/1fd49a0f5f403cdb95da63e6e1d3857e to your computer and use it in GitHub Desktop.
App Class for simple PHP hooks script.
<?php
class app {
public function RunHooks($hook, $value = NULL) {
global $x_events;
if (isset($x_events[$hook])) {
foreach($x_events[$hook] as $function) {
if (function_exists($function)) { call_user_func($function, $value); }
}
}
}
public function AddHook($hook, $func, $val = NULL) {
global $x_events;
$x_events[$hook][] = $func;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment