Optimized code according to TYPO3 6.2 performance tuning

intval() => (int)
trimExplode + foreach => explode + foreach + trim
array_key_exists => isset
in_array => array_flip + isset

Change-Id: I693a0173aced21590029cd7452c0af1732543478
Reviewed-on: https://review.typo3.org/26958
Reviewed-by: Jo Hasenau
Tested-by: Jo Hasenau