[TASK] Optimize invocation of cObj::checkIf

The stdWrap property "if" can be used to allow output only if a
defined criterion is met. However, the checkIf() method gets
called even if the property is not set in TypoScript.

Fix this by adding a quick empty() check to all calls.
Also optimizes the code structure to exit early in case the if
does not evaluate to TRUE.

Resolves: #55173
Releases: 6.3, 6.2
Change-Id: Ie1178a5df2e98fd19b848aa2300c901c1200f555
Reviewed-on: https://review.typo3.org/26943
Reviewed-by: Simon Schaufelberger
Reviewed-by: Stefan Neufeind
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Markus Klein
Tested-by: Markus Klein