Skip to content
Snippets Groups Projects

Feature change language label tabs

Closed Axel Braunschweiger requested to merge feature_ChangeLanguageLabelTabs into master
35 files
+ 334
1322
Compare changes
  • Side-by-side
  • Inline
Files
35
+ 0
178
<?php
namespace SGalinski\DfTabs\Ajax;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Utility\GeneralUtility;
if (!defined('PATH_typo3conf')) {
die('Could not access this script directly!');
}
/**
* @todo ajax anpassen
* Ajax Postloader
*/
class LoadAjax {
/**
* @var array
*/
protected $content = array();
/**
* Controlling method
*
* @return void
*/
public function main() {
tslib_eidtools::connectDB();
tslib_eidtools::initLanguage();
tslib_eidtools::initTCA();
$parameters = GeneralUtility::_GP('df_tabs');
$this->initTSFE($parameters['id'], $parameters['languageId']);
/** @var $controller \tx_dftabs_plugin1 */
$controller = GeneralUtility::makeInstance('tx_dftabs_plugin1');
$controller->cObj = $GLOBALS['TSFE']->cObj;
$controller->conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_dftabs_plugin1.'];
$controller->conf['ajax'] = FALSE;
$records = GeneralUtility::trimExplode(',', $parameters['records']);
$this->content = $controller->ajax($records, $parameters['mode']);
if (t3lib_extMgm::isLoaded('content_replacer')) {
$extensionPath = t3lib_extMgm::extPath('content_replacer');
require_once($extensionPath . 'Classes/Controller/class.tx_contentreplacer_controller_main.php');
/** @var $contentReplacer tx_contentreplacer_controller_Main */
$contentReplacer = t3lib_div::makeInstance('tx_contentreplacer_controller_Main');
$this->content = $contentReplacer->main($this->content);
}
}
/**
* Converts relative paths in the HTML source to absolute paths for fileadmin/, typo3conf/ext/ and media/ folders.
*
* Note: Copied from the TypoScriptFrontendController and should be removed with a force to 6.2.6.
*
* @return void
* @see pagegen.php, INTincScript()
*/
public function setAbsRefPrefix() {
if (!$GLOBALS['TSFE']->absRefPrefix) {
return;
}
$search = array(
'"typo3temp/',
'"typo3conf/ext/',
'"' . TYPO3_mainDir . 'contrib/',
'"' . TYPO3_mainDir . 'ext/',
'"' . TYPO3_mainDir . 'sysext/',
'"' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'],
'"' . $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir']
);
$replace = array(
'"' . $GLOBALS['TSFE']->absRefPrefix . 'typo3temp/',
'"' . $GLOBALS['TSFE']->absRefPrefix . 'typo3conf/ext/',
'"' . $GLOBALS['TSFE']->absRefPrefix . TYPO3_mainDir . 'contrib/',
'"' . $GLOBALS['TSFE']->absRefPrefix . TYPO3_mainDir . 'ext/',
'"' . $GLOBALS['TSFE']->absRefPrefix . TYPO3_mainDir . 'sysext/',
'"' . $GLOBALS['TSFE']->absRefPrefix . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'],
'"' . $GLOBALS['TSFE']->absRefPrefix . $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir']
);
$this->content = str_replace(
$search,
$replace,
$this->content
);
}
/**
* Prints the content
*
* @return void
*/
public function printContent() {
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');
$this->setAbsRefPrefix();
echo $this->content;
}
/**
* Initializes the TSFE object
*
* @param int $pageId
* @param int $languageId
* @return void
*/
protected function initTSFE($pageId, $languageId) {
if (is_object($GLOBALS['TSFE'])) {
return;
}
$pageId = (int) $pageId;
$language = (int) $languageId;
t3lib_div::_GETset($language, 'L');
t3lib_div::_GETset($pageId, 'pageId');
/** @var $typoScriptController tslib_fe */
$GLOBALS['TSFE'] = $typoScriptController = t3lib_div::makeInstance(
'tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $pageId, 0
);
// if (!is_object($GLOBALS['TT'])) {
// $GLOBALS['TT'] = new NullTimeTracker();
// }
$typoScriptController->initFEuser();
$typoScriptController->initUserGroups();
$typoScriptController->fetch_the_id();
$typoScriptController->getPageAndRootline();
$typoScriptController->initTemplate();
// $typoScriptController->forceTemplateParsing = TRUE;
// $typoScriptController->getCompressedTCarray();
$typoScriptController->no_cache = TRUE;
$typoScriptController->getConfigArray();
$typoScriptController->settingLocale();
$typoScriptController->settingLanguage();
// $typoScriptController->no_cache = TRUE;
// $typoScriptController->tmpl->start($GLOBALS['TSFE']->rootLine);
// $typoScriptController->no_cache = FALSE;
$typoScriptController->newCObj();
$typoScriptController->absRefPrefix = ($typoScriptController->config['config']['absRefPrefix'] ?: '');
}
}
/** @var $object LoadAjax */
$object = GeneralUtility::makeInstance('Tx_DfTabs_Ajax_LoadAjax');
$object->main();
$object->printContent();
?>
Loading