Last active
March 10, 2019 18:06
-
-
Save FluxCoder/1fd49a0f5f403cdb95da63e6e1d3857e to your computer and use it in GitHub Desktop.
App Class for simple PHP hooks script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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