Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace SMS\Importer\Command;
- use TYPO3\CMS\Core\TimeTracker\TimeTracker;
- use TYPO3\CMS\Core\Utility\GeneralUtility;
- use TYPO3\CMS\Extbase\Mvc\Controller\CommandController;
- use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
- use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
- require_once(PATH_tslib . 'class.tslib_fe.php');
- require_once(PATH_t3lib . 'class.t3lib_userauth.php');
- require_once(PATH_tslib . 'class.tslib_feuserauth.php');
- require_once(PATH_t3lib . 'class.t3lib_cs.php');
- require_once(PATH_tslib . 'class.tslib_content.php');
- require_once(PATH_t3lib . 'class.t3lib_tstemplate.php');
- require_once(PATH_t3lib . 'class.t3lib_page.php');
- /**
- * Class FrontendEnabledCommandController
- *
- * @package SMS\Importer\Command
- * @@author Thorsten Kohpeiß <kohpeiss@sitegeist.de>
- */
- class FrontendEnabledCommandController extends CommandController {
- public function __construct() {
- $this->buildTSFE();
- }
- public function buildTSFE($pid = 1) {
- if (!is_object($GLOBALS['TT'])) {
- $GLOBALS['TT'] = new TimeTracker();
- $GLOBALS['TT']->start();
- }
- $GLOBALS['TSFE'] = new TypoScriptFrontendController($GLOBALS['TYPO3_CONF_VARS'], $pid, '0', 1, '', '', '', '');
- $GLOBALS['TSFE']->connectToDB();
- $GLOBALS['TSFE']->initFEuser();
- $GLOBALS['TSFE']->fetch_the_id();
- $GLOBALS['TSFE']->getPageAndRootline();
- $GLOBALS['TSFE']->initTemplate();
- $GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
- $GLOBALS['TSFE']->forceTemplateParsing = 1;
- $GLOBALS['TSFE']->getConfigArray();
- $GLOBALS['TSFE']->cObj = new ContentObjectRenderer();
- }
- public function getLinkToPage($uid) {
- $uid = intval($uid);
- if ($uid > 0) {
- $typolinkConf = array(
- 'parameter' => $uid
- );
- $url = $GLOBALS['TSFE']->cObj->typoLink_URL($typolinkConf);
- if ($url == '') {
- $url = '/';
- }
- } else {
- throw new \InvalidArgumentException('$uid must be an integer > 0', 123);
- }
- return $url;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement