Upped PHPCS standard as far as possible

Also improved output escaping & input validation to comply.