$name, "admin" => $admin, "position" => $position, "icon" => $icon, "function" => $function, "label" => $label, "color" => $color ]; } $hook_registered = array(); function register_hook($action, $function){ $hook_registered[] = [ 'action' => $action, 'function' => $function ]; } function run_hook($action){ global $hook_registered; foreach($hook_registered as $hook){ if($hook['action'] == $action){ if(function_exists($hook['function'])){ call_user_func($hook['function']); } } } }