
proc eval_plugins {hook {verbose 0} {callback ""} {dir /mod/webif/plugin}} {
	foreach plugin [lsort [glob -nocomplain "$dir/*"]] {
		if {![file isdirectory $plugin]} continue
		if {[file exists "$plugin/.disabled"]} continue
		if {[file isfile "$plugin/$hook.hook"]} {
			if {$callback ne ""} {
				uplevel $callback $plugin $hook.hook
				continue
			}
			if {[catch \
			    {uplevel source "$plugin/$hook.hook"} msg]} {
				if {$verbose} {
					puts "$plugin/$hook - $msg"
				}
			}
		} 
	}
}

