/**
  * Sets the global variables $GLOBALS['TSFE']->csConvObj and $GLOBALS['TSFE']->renderCharset in Backend mode
  * This somewhat hacky work around is currently needed because the crop() and cropHTML() functions of
  * ContentObjectRenderer rely on those variables to be set
  *
  * @return void
  */
 protected static function simulateFrontendEnvironment()
 {
     self::$tsfeBackup = isset($GLOBALS['TSFE']) ? $GLOBALS['TSFE'] : null;
     $GLOBALS['TSFE'] = new \stdClass();
     // preparing csConvObj
     if (!is_object($GLOBALS['TSFE']->csConvObj)) {
         if (is_object($GLOBALS['LANG'])) {
             $GLOBALS['TSFE']->csConvObj = $GLOBALS['LANG']->csConvObj;
         } else {
             $GLOBALS['TSFE']->csConvObj = GeneralUtility::makeInstance(CharsetConverter::class);
         }
     }
     // preparing renderCharset
     if (!is_object($GLOBALS['TSFE']->renderCharset)) {
         if (is_object($GLOBALS['LANG'])) {
             $GLOBALS['TSFE']->renderCharset = $GLOBALS['LANG']->charSet;
         } else {
             $GLOBALS['TSFE']->renderCharset = 'utf-8';
         }
     }
 }
 /**
  * Sets the global variable $GLOBALS['TSFE']->csConvObj in Backend mode
  * This somewhat hacky work around is currently needed because the crop() and cropHTML() functions of
  * ContentObjectRenderer rely on those variables to be set
  *
  * @return void
  */
 protected static function simulateFrontendEnvironment()
 {
     self::$tsfeBackup = isset($GLOBALS['TSFE']) ? $GLOBALS['TSFE'] : null;
     $GLOBALS['TSFE'] = new \stdClass();
     // preparing csConvObj
     if (!is_object($GLOBALS['TSFE']->csConvObj)) {
         $GLOBALS['TSFE']->csConvObj = GeneralUtility::makeInstance(CharsetConverter::class);
     }
 }