Final JSHint fix for hooks.js

Changing a variable name to get around jshint/jshint#1443
PHPCS: Fix iniline control structure style, and more general cleanup

See #5