Fix PHP notices when hook is viewed in browser (HTTP GET)