Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Tx_Myext_Eid_MyOwnEidScript implements t3lib_Singleton {
- /**
- * @var tslib_fe
- */
- protected $tslibFe;
- /**
- *
- * @return string
- */
- public function main() {
- $this->setupEnvironment();
- // Own code here
- }
- /**
- * setupEnvironment
- *
- * Interacts with self::exportTslibFe.
- *
- * Workflow:
- * 1 self::setupEnvironment registers self::exportTslibFe as hook for tslib_fe
- * 2 self::setupEnvironment creates tslib_fe
- * 3 tslib_fe calls self::exportTslibFe
- * 4 self::exportTslibFe exports tslib_fe
- * 5 self::setupEnvironment has access to the now exported tslib_fe
- */
- protected function setupEnvironment() {
- $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['initFEuser'][] = '&Tx_Myext_Eid_MyOwnEidScript->exportTslibFe';
- tslib_eidtools::connectDB();
- tslib_eidtools::initFeUser();
- $this->tslibFe->initUserGroups();
- $this->tslibFe->initializeBackendUser();
- }
- /**
- * exportTslibFe
- *
- * Workflow:
- * 1 self::setupEnvironment registers self::exportTslibFe as hook for tslib_fe
- * 2 self::setupEnvironment creates tslib_fe
- * 3 tslib_fe calls self::exportTslibFe
- * 4 self::exportTslibFe exports tslib_fe
- * 5 self::setupEnvironment has access to the now exported tslib_fe
- *
- * So this needs to be public because it gets called from tslib_fe
- * right after fe_user is present.
- *
- * @param array $params
- * @param tslib_fe $tslibFe
- * @return void
- */
- public function exportTslibFe(array $params, tslib_fe $tslibFe) {
- $this->tslibFe = $tslibFe;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement