本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::writeFileToTypo3tempDir方法的具体用法?PHP GeneralUtility::writeFileToTypo3tempDir怎么用?PHP GeneralUtility::writeFileToTypo3tempDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::writeFileToTypo3tempDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getParsedDataHandlesLocallangXMLOverride
/**
* @test
*/
public function getParsedDataHandlesLocallangXMLOverride()
{
/** @var $subject LocalizationFactory */
$subject = new LocalizationFactory();
$unique = 'locallangXMLOverrideTest' . substr($this->getUniqueId(), 0, 10);
$xml = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<data type="array">
<languageKey index="default" type="array">
<label index="buttons.logout">EXIT</label>
</languageKey>
</data>
</T3locallang>';
$file = PATH_site . 'typo3temp/' . $unique . '.xml';
GeneralUtility::writeFileToTypo3tempDir($file, $xml);
// Make sure there is no cached version of the label
GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('l10n')->flush();
// Get default value
$defaultLL = $subject->getParsedData('EXT:lang/locallang_core.xlf', 'default', 'utf-8', 0);
// Clear language cache again
GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('l10n')->flush();
// Set override file
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:lang/locallang_core.xlf'][$unique] = $file;
/** @var $store \TYPO3\CMS\Core\Localization\LanguageStore */
$store = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\LanguageStore');
$store->flushData('EXT:lang/locallang_core.xlf');
// Get override value
$overrideLL = $subject->getParsedData('EXT:lang/locallang_core.xlf', 'default', 'utf-8', 0);
// Clean up again
unlink($file);
$this->assertNotEquals($overrideLL['default']['buttons.logout'][0]['target'], '');
$this->assertNotEquals($defaultLL['default']['buttons.logout'][0]['target'], $overrideLL['default']['buttons.logout'][0]['target']);
$this->assertEquals($overrideLL['default']['buttons.logout'][0]['target'], 'EXIT');
}
示例2: buildJavascriptConfiguration
/**
* Return JS configuration of the htmlArea plugins registered by the extension
*
* @return string JS configuration for registered plugins
*/
public function buildJavascriptConfiguration()
{
$registerRTEinJavascriptString = '';
if (!file_exists(PATH_site . $this->jsonFileName)) {
$schema = array('types' => array(), 'properties' => array());
$fileName = 'EXT:rte_schema/Resources/Public/RDF/schema.rdfa';
$fileName = GeneralUtility::getFileAbsFileName($fileName);
$rdf = GeneralUtility::getUrl($fileName);
if ($rdf) {
$this->parseSchema($rdf, $schema);
}
uasort($schema['types'], array($this, 'compareLabels'));
uasort($schema['properties'], array($this, 'compareLabels'));
// Insert no type and no property entries
if ($this->isFrontend()) {
$noSchema = $GLOBALS['TSFE']->getLLL('No type', $this->LOCAL_LANG);
$noProperty = $GLOBALS['TSFE']->getLLL('No property', $this->LOCAL_LANG);
} else {
$noSchema = $GLOBALS['LANG']->getLL('No type');
$noProperty = $GLOBALS['LANG']->getLL('No property');
}
array_unshift($schema['types'], array('name' => 'none', 'domain' => $noSchema, 'comment' => ''));
array_unshift($schema['properties'], array('name' => 'none', 'domain' => $noProperty, 'comment' => ''));
GeneralUtility::writeFileToTypo3tempDir(PATH_site . $this->jsonFileName, json_encode($schema));
}
$output = ($this->isFrontend() && $GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '../') . $this->jsonFileName;
$registerRTEinJavascriptString = 'RTEarea[editornumber].schemaUrl = "' . ($this->isFrontend() && $GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '') . $output . '";';
return $registerRTEinJavascriptString;
}
示例3: render
/**
* @param array|NULL $backendUser
* @param int $size
* @param bool $showIcon
* @return string
*/
public function render(array $backendUser = NULL, $size = 32, $showIcon = FALSE)
{
$size = (int) $size;
if (!is_array($backendUser)) {
$backendUser = $this->getBackendUser()->user;
}
$image = parent::render($backendUser, $size, $showIcon);
if (!StringUtility::beginsWith($image, '<span class="avatar"><span class="avatar-image"></span>') || empty($backendUser['email'])) {
return $image;
}
$cachedFilePath = PATH_site . 'typo3temp/t3gravatar/';
$cachedFileName = sha1($backendUser['email'] . $size) . '.jpg';
if (!file_exists($cachedFilePath . $cachedFileName)) {
$gravatar = 'https://www.gravatar.com/avatar/' . md5(strtolower($backendUser['email'])) . '?s=' . $size . '&d=404';
$gravatarImage = GeneralUtility::getUrl($gravatar);
if (empty($gravatarImage)) {
return $image;
}
GeneralUtility::writeFileToTypo3tempDir($cachedFileName, $gravatarImage);
}
// Icon
$icon = '';
if ($showIcon) {
$icon = '<span class="avatar-icon">' . IconUtility::getSpriteIconForRecord('be_users', $backendUser) . '</span>';
}
$relativeFilePath = PathUtility::getRelativePath(PATH_typo3, $cachedFilePath);
return '<span class="avatar"><span class="avatar-image">' . '<img src="' . $relativeFilePath . $cachedFileName . '" width="' . $size . '" height="' . $size . '" /></span>' . $icon . '</span>';
}
示例4: initToASCII
/**
* This function initializes the to-ASCII conversion table for a charset other than UTF-8.
* This function is automatically called by the ASCII transliteration functions.
*
* @param string $charset Charset for which to initialize conversion.
* @return int Returns FALSE on error, a TRUE value on success: 1 table already loaded, 2, cached version, 3 table parsed (and cached).
* @access private
*/
public function initToASCII($charset)
{
// Only process if the case table is not yet loaded:
if (is_array($this->toASCII[$charset])) {
return 1;
}
// Use cached version if possible
$cacheFile = GeneralUtility::getFileAbsFileName('typo3temp/cs/csascii_' . $charset . '.tbl');
if ($cacheFile && @is_file($cacheFile)) {
$this->toASCII[$charset] = unserialize(GeneralUtility::getUrl($cacheFile));
return 2;
}
// Init UTF-8 conversion for this charset
if (!$this->initCharset($charset)) {
return FALSE;
}
// UTF-8/ASCII transliteration is used as the base conversion table
if (!$this->initUnicodeData('ascii')) {
return FALSE;
}
foreach ($this->parsedCharsets[$charset]['local'] as $ci => $utf8) {
// Reconvert to charset (don't use chr() of numeric value, might be muli-byte)
$c = $this->utf8_decode($utf8, $charset);
if (isset($this->toASCII['utf-8'][$utf8])) {
$this->toASCII[$charset][$c] = $this->toASCII['utf-8'][$utf8];
}
}
if ($cacheFile) {
GeneralUtility::writeFileToTypo3tempDir($cacheFile, serialize($this->toASCII[$charset]));
}
return 3;
}
示例5: templateWithErrorReturnsFormWithErrorReporter
/**
* @test
*/
public function templateWithErrorReturnsFormWithErrorReporter()
{
$badSource = '<f:layout invalid="TRUE" />';
$temp = GeneralUtility::tempnam('badtemplate') . '.html';
GeneralUtility::writeFileToTypo3tempDir($temp, $badSource);
$form = $this->createFluxServiceInstance()->getFormFromTemplateFile($temp);
$this->assertInstanceOf('FluidTYPO3\\Flux\\Form', $form);
$this->assertInstanceOf('FluidTYPO3\\Flux\\Form\\Field\\UserFunction', reset($form->getFields()));
$this->assertEquals('FluidTYPO3\\Flux\\UserFunction\\ErrorReporter->renderField', reset($form->getFields())->getFunction());
}
示例6: generateCacheFile
/**
* Generates the cache file.
*
* @param string $sourcePath
* @param string $languageKey
* @return array
* @throws \RuntimeException
*/
protected function generateCacheFile($sourcePath, $languageKey)
{
$LOCAL_LANG = array();
// Get PHP data
include $sourcePath;
if (!is_array($LOCAL_LANG)) {
$fileName = substr($sourcePath, strlen(PATH_site));
throw new \RuntimeException('TYPO3 Fatal Error: "' . $fileName . '" is no TYPO3 language file!', 1308898491);
}
// Converting the default language (English)
// This needs to be done for a few accented loan words and extension names
if (is_array($LOCAL_LANG['default']) && $this->targetCharset !== 'utf-8') {
foreach ($LOCAL_LANG['default'] as &$labelValue) {
$labelValue = $this->csConvObj->conv($labelValue, 'utf-8', $this->targetCharset);
}
unset($labelValue);
}
if ($languageKey !== 'default' && is_array($LOCAL_LANG[$languageKey]) && $this->sourceCharset != $this->targetCharset) {
foreach ($LOCAL_LANG[$languageKey] as &$labelValue) {
$labelValue = $this->csConvObj->conv($labelValue, $this->sourceCharset, $this->targetCharset);
}
unset($labelValue);
}
// Cache the content now:
if (isset($LOCAL_LANG[$languageKey])) {
$serContent = array('origFile' => $this->hashSource, 'LOCAL_LANG' => array('default' => $LOCAL_LANG['default'], $languageKey => $LOCAL_LANG[$languageKey]));
} else {
$serContent = array('origFile' => $this->hashSource, 'LOCAL_LANG' => array('default' => $LOCAL_LANG['default']));
}
$res = \TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($this->cacheFileName, serialize($serContent));
if ($res) {
throw new \RuntimeException('TYPO3 Fatal Error: "' . $res, 1308898501);
}
return $LOCAL_LANG;
}
示例7: getLocalLangFileName
/**
* Returns the file name to the LLL JavaScript, containing the localized labels,
* which can be used in JavaScript code.
*
* @return string File name of the JS file, relative to TYPO3_mainDir
* @throws \RuntimeException
*/
protected function getLocalLangFileName()
{
$code = $this->generateLocalLang();
$filePath = 'typo3temp/Language/Backend-' . sha1($code) . '.js';
if (!file_exists(PATH_site . $filePath)) {
// writeFileToTypo3tempDir() returns NULL on success (please double-read!)
$error = GeneralUtility::writeFileToTypo3tempDir(PATH_site . $filePath, $code);
if ($error !== null) {
throw new \RuntimeException('Locallang JS file could not be written to ' . $filePath . '. Reason: ' . $error, 1295193026);
}
}
return '../' . $filePath;
}
示例8: downloadExtensionDataAction
/**
* Download data of an extension as sql statements
*
* @param string $extension
* @throws \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException
*/
protected function downloadExtensionDataAction($extension)
{
$error = NULL;
$sqlData = $this->installUtility->getExtensionSqlDataDump($extension);
$dump = $sqlData['extTables'] . $sqlData['staticSql'];
$fileName = $extension . '_sqlDump.sql';
$filePath = PATH_site . 'typo3temp/' . $fileName;
$error = \TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($filePath, $dump);
if (is_string($error)) {
throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException($error, 1343048718);
}
$this->fileHandlingUtility->sendSqlDumpFileToBrowserAndDelete($filePath, $fileName);
}
示例9: determineUpdateClassName
/**
* Determine the real class name to use
*
* @param string $extensionKey
* @return string Returns the final class name if an update script is present, otherwise empty string
* @throws ExtensionManagerException If an update script is present but no ext_update class can be loaded
*/
protected function determineUpdateClassName($extensionKey)
{
$updateScript = GeneralUtility::getFileAbsFileName('EXT:' . $extensionKey . '/class.ext_update.php', false);
if (!file_exists($updateScript)) {
return '';
}
// get script contents
$scriptSourceCode = GeneralUtility::getUrl($updateScript);
// check if it has a namespace
if (!preg_match('/<\\?php.*namespace\\s+([^;]+);.*class/is', $scriptSourceCode, $matches)) {
// if no, rename the class with a unique name
$className = 'ext_update' . md5($extensionKey . $scriptSourceCode);
$temporaryFileName = PATH_site . 'typo3temp/ExtensionManager/UpdateScripts/' . $className . '.php';
if (!file_exists(GeneralUtility::getFileAbsFileName($temporaryFileName))) {
$scriptSourceCode = preg_replace('/^\\s*class\\s+ext_update\\s+/m', 'class ' . $className . ' ', $scriptSourceCode);
GeneralUtility::writeFileToTypo3tempDir($temporaryFileName, $scriptSourceCode);
}
$updateScript = $temporaryFileName;
} else {
$className = $matches[1] . '\\ext_update';
}
@(include_once $updateScript);
if (!class_exists($className, false)) {
throw new ExtensionManagerException(sprintf('class.ext_update.php of extension "%s" did not declare ext_update class', $extensionKey), 1428176468);
}
return $className;
}
示例10: loadClass
/**
* Loads php files containing classes or interfaces found in the classes directory of
* a package and specifically registered classes.
*
* @param string $className: Name of the class/interface to load
* @return void
* @author Jochen Rau <jochen.rau@typoplanet.de>
*/
private function loadClass($className)
{
$classNameParts = explode('_', $className, 3);
if ($classNameParts[0] === self::PACKAGE_PREFIX) {
// Caches the $classFiles
if (!is_array($this->classFiles[$classNameParts[1]]) || empty($this->classFiles[$classNameParts[1]])) {
$this->classFiles[$classNameParts[1]] = $this->buildArrayOfClassFiles($classNameParts[1]);
if (is_array($this->additionalIncludePaths)) {
foreach ($this->additionalIncludePaths as $idx => $dir) {
$temp = $this->buildArrayOfClassFiles($dir);
$this->classFiles[$classNameParts[1]] = array_merge($temp, $this->classFiles[$classNameParts[1]]);
}
}
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($this->cacheFilePath, serialize($this->classFiles));
//If the package exists in the cache, but the class does not, look in the additionalIncludePaths again.
} elseif (!array_key_exists($className, $this->classFiles[$classNameParts[1]])) {
if (is_array($this->additionalIncludePaths)) {
foreach ($this->additionalIncludePaths as $idx => $dir) {
$temp = array();
$temp = $this->buildArrayOfClassFiles($dir);
$this->classFiles[$classNameParts[1]] = array_merge($temp, $this->classFiles[$classNameParts[1]]);
}
}
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($this->cacheFilePath, serialize($this->classFiles));
}
$classFilePathAndName = NULL;
if (isset($this->classFiles[$classNameParts[1]][$className])) {
$classFilePathAndName = PATH_site . $this->classFiles[$classNameParts[1]][$className];
}
if (isset($classFilePathAndName) && file_exists($classFilePathAndName)) {
require_once $classFilePathAndName;
}
}
}
示例11: createNewFile
/**
* Create new OnlineMedia item container file.
* This is created inside typo3temp/ and then moved from FAL to the proper storage.
*
* @param Folder $targetFolder
* @param string $fileName
* @param string $onlineMediaId
* @return File
*/
protected function createNewFile(Folder $targetFolder, $fileName, $onlineMediaId)
{
$temporaryFile = PATH_site . 'typo3temp/assets/transient/' . GeneralUtility::tempnam('online_media');
GeneralUtility::writeFileToTypo3tempDir($temporaryFile, $onlineMediaId);
return $targetFolder->addFile($temporaryFile, $fileName, 'changeName');
}
示例12: render
/**
* @param string $src
* @param string $type
* @param boolean $compress
* @param boolean $forceOnTop
* @param string $allWrap
* @param boolean $excludeFromConcatenation
* @param string $section
* @param boolean $preventMarkupUpdateOnAjaxLoad
* @param boolean $moveToExternalFile
* @param boolean $noCache
* @param string $name
*
* @return string
*/
public function render($src = "", $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE, $section = 'footer', $preventMarkupUpdateOnAjaxLoad = false, $moveToExternalFile = false, $noCache = false, $name = '')
{
$content = $this->renderChildren();
if ($this->ajaxDispatcher->getIsActive()) {
if ($preventMarkupUpdateOnAjaxLoad) {
$this->ajaxDispatcher->setPreventMarkupUpdateOnAjaxLoad(true);
}
// need to just echo the code in ajax call
if (!$src) {
if ($compress) {
$content = $this->compressScript($content);
}
return \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content);
} else {
return '<script type="' . htmlspecialchars($type) . '" src="' . htmlspecialchars($src) . '"></script>';
}
} else {
if ($this->isCached()) {
if ($noCache) {
if ($src) {
$content = '<script type="' . htmlspecialchars($type) . '" src="' . htmlspecialchars($src) . '"></script>';
} else {
if ($compress) {
$content = $this->compressScript($content);
}
$content = \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content);
}
$tslibFE = GeneralUtility::makeInstance('EssentialDots\\ExtbaseHijax\\Tslib\\FE\\Hook');
/* @var $tslibFE \EssentialDots\ExtbaseHijax\Tslib\FE\Hook */
if ($section == 'footer') {
$tslibFE->addNonCacheableFooterCode($name ? $name : md5($content), $content);
} else {
$tslibFE->addNonCacheableHeaderCode($name ? $name : md5($content), $content);
}
return '';
} else {
if (!$src && $moveToExternalFile) {
$src = 'typo3temp' . DIRECTORY_SEPARATOR . 'extbase_hijax' . DIRECTORY_SEPARATOR . md5($content) . '.js';
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir(PATH_site . $src, $content);
if ($GLOBALS['TSFE']) {
if ($GLOBALS['TSFE']->baseUrl) {
$src = $GLOBALS['TSFE']->baseUrl . $src;
} elseif ($GLOBALS['TSFE']->absRefPrefix) {
$src = $GLOBALS['TSFE']->absRefPrefix . $src;
}
}
}
if (!$src) {
if ($section == 'footer') {
$this->pageRenderer->addJsFooterInlineCode($name ? $name : md5($content), $content, $compress, $forceOnTop);
} else {
$this->pageRenderer->addJsInlineCode($name ? $name : md5($content), $content, $compress, $forceOnTop);
}
} else {
if ($section == 'footer') {
$this->pageRenderer->addJsFooterFile($src, $type, $compress, $forceOnTop, $allWrap, $excludeFromConcatenation);
} else {
$this->pageRenderer->addJsFile($src, $type, $compress, $forceOnTop, $allWrap, $excludeFromConcatenation);
}
}
}
} else {
// additionalFooterData not possible in USER_INT
if (!$src) {
$GLOBALS['TSFE']->additionalHeaderData[$name ? $name : md5($content)] = \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content);
} else {
$GLOBALS['TSFE']->additionalHeaderData[$name ? $name : md5($content)] = '<script type="' . htmlspecialchars($type) . '" src="' . htmlspecialchars($src) . '"></script>';
}
}
}
return '';
}
示例13: safeRSSData
private function safeRSSData($fileName, $rssArray)
{
if (file_exists($fileName)) {
unlink($fileName);
}
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($fileName, serialize($rssArray));
}
示例14: retrieveFileOrFolderObjectReturnsFileIfPathIsGiven
/**
* @test
*/
public function retrieveFileOrFolderObjectReturnsFileIfPathIsGiven()
{
$this->subject = $this->getAccessibleMock(\TYPO3\CMS\Core\Resource\ResourceFactory::class, array('getFileObjectFromCombinedIdentifier'), array(), '', false);
$filename = 'typo3temp/4711.txt';
$this->subject->expects($this->once())->method('getFileObjectFromCombinedIdentifier')->with($filename);
// Create and prepare test file
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir(PATH_site . $filename, '42');
$this->filesCreated[] = PATH_site . $filename;
$this->subject->retrieveFileOrFolderObject($filename);
}
示例15: init
/**
* Initialize the normal module operation
*
* @return void
*/
public function init()
{
$beUser = $this->getBackendUser();
// Setting more GPvars:
$this->popViewId = GeneralUtility::_GP('popViewId');
$this->popViewId_addParams = GeneralUtility::_GP('popViewId_addParams');
$this->viewUrl = GeneralUtility::_GP('viewUrl');
$this->editRegularContentFromId = GeneralUtility::_GP('editRegularContentFromId');
$this->recTitle = GeneralUtility::_GP('recTitle');
$this->noView = GeneralUtility::_GP('noView');
$this->perms_clause = $beUser->getPagePermsClause(1);
// Set other internal variables:
$this->R_URL_getvars['returnUrl'] = $this->retUrl;
$this->R_URI = $this->R_URL_parts['path'] . '?' . ltrim(GeneralUtility::implodeArrayForUrl('', $this->R_URL_getvars), '&');
// Setting virtual document name
$this->MCONF['name'] = 'xMOD_alt_doc.php';
// Create an instance of the document template object
$this->doc = $GLOBALS['TBE_TEMPLATE'];
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->addInlineLanguageLabelFile('EXT:lang/locallang_alt_doc.xlf');
// override the default jumpToUrl
$this->moduleTemplate->addJavaScriptCode('jumpToUrl', '
function jumpToUrl(URL,formEl) {
if (!TBE_EDITOR.isFormChanged()) {
window.location.href = URL;
} else if (formEl && formEl.type=="checkbox") {
formEl.checked = formEl.checked ? 0 : 1;
}
}
');
// define the window size of the element browser
$popupWindowWidth = 700;
$popupWindowHeight = 750;
$popupWindowSize = trim($beUser->getTSConfigVal('options.popupWindowSize'));
if (!empty($popupWindowSize)) {
list($popupWindowWidth, $popupWindowHeight) = GeneralUtility::intExplode('x', $popupWindowSize);
}
$t3Configuration = array('PopupWindow' => array('width' => $popupWindowWidth, 'height' => $popupWindowHeight));
if (ExtensionManagementUtility::isLoaded('feedit') && (int) GeneralUtility::_GP('feEdit') === 1) {
// We have to load some locallang strings and push them into TYPO3.LLL if this request was
// triggered by feedit. Originally, this object is fed by BackendController which is not
// called here. This block of code is intended to be removed at a later point again.
$lang = $this->getLanguageService();
$coreLabels = array('csh_tooltip_loading' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:csh_tooltip_loading'));
$generatedLabels = array();
$generatedLabels['core'] = $coreLabels;
$code = 'TYPO3.LLL = ' . json_encode($generatedLabels) . ';';
$filePath = 'typo3temp/Language/Backend-' . sha1($code) . '.js';
if (!file_exists(PATH_site . $filePath)) {
// writeFileToTypo3tempDir() returns NULL on success (please double-read!)
$error = GeneralUtility::writeFileToTypo3tempDir(PATH_site . $filePath, $code);
if ($error !== null) {
throw new \RuntimeException('Locallang JS file could not be written to ' . $filePath . '. Reason: ' . $error, 1446118286);
}
}
$pageRenderer->addJsFile('../' . $filePath);
// define the window size of the popups within the RTE
$rtePopupWindowSize = trim($beUser->getTSConfigVal('options.rte.popupWindowSize'));
if (!empty($rtePopupWindowSize)) {
list($rtePopupWindowWidth, $rtePopupWindowHeight) = GeneralUtility::trimExplode('x', $rtePopupWindowSize);
}
$rtePopupWindowWidth = !empty($rtePopupWindowWidth) ? (int) $rtePopupWindowWidth : $popupWindowWidth - 200;
$rtePopupWindowHeight = !empty($rtePopupWindowHeight) ? (int) $rtePopupWindowHeight : $popupWindowHeight - 250;
$t3Configuration['RTEPopupWindow'] = ['width' => $rtePopupWindowWidth, 'height' => $rtePopupWindowHeight];
}
$javascript = '
TYPO3.configuration = ' . json_encode($t3Configuration) . ';
// Object: TS:
// passwordDummy and decimalSign are used by tbe_editor.js and have to be declared here as
// TS object overwrites the object declared in tbe_editor.js
function typoSetup() { //
this.uniqueID = "";
this.passwordDummy = "********";
this.PATH_typo3 = "";
this.decimalSign = ".";
}
var TS = new typoSetup();
// Info view:
function launchView(table,uid,bP) { //
var backPath= bP ? bP : "";
var thePreviewWindow = window.open(
backPath+' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('show_item') . '&table=') . ' + encodeURIComponent(table) + "&uid=" + encodeURIComponent(uid),
"ShowItem" + TS.uniqueID,
"height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0"
);
if (thePreviewWindow && thePreviewWindow.focus) {
thePreviewWindow.focus();
}
}
function deleteRecord(table,id,url) { //
window.location.href = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_db') . '&cmd[') . '+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $beUser->veriCode() . '&prErr=1&uPT=1";
}
';
$previewCode = isset($_POST['_savedokview']) && $this->popViewId ? $this->generatePreviewCode() : '';
//.........这里部分代码省略.........