[BUGFIX] Fix code inspection warnings

* add accessor methods for global objects
* add some @var annotations for local variables
* fix HTML errors
* always use $GLOBALS['TCA'] instead of $TCA
* lots of smaller fixes

Resolves: #63494

Change-Id: I3f522c48d6268cf3291726fedef4f43f708b7a2a
Reviewed-on: http://review.typo3.org/34898
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: Oliver Klee <typo3-coding@oliverklee.de>