[TASK] Replace usage of $GLOBALS['TSFE']

Change-Id: Ib5fa6375ec9ff8731a4957cc7f02274bca617154
[TASK] Replace usage of $GLOBALS['TT']

Change-Id: I3f8fa2b6203c14da5384c62e3475e908e3a60a07
[TASK] Fix several bugs mentioned by scrutinizer

Releases: 2.0.0
Change-Id: I045170a1368bfac6b0c291af896c904e66236163