本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::createVersionNumberedFilename方法的具体用法?PHP GeneralUtility::createVersionNumberedFilename怎么用?PHP GeneralUtility::createVersionNumberedFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::createVersionNumberedFilename方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Render the captcha image html
*
* @param string suffix to be appended to the extenstion key when forming css class names
* @return string The html used to render the captcha image
*/
public function render($suffix = '')
{
$value = '';
// Include the required JavaScript
$GLOBALS['TSFE']->additionalHeaderData[$this->extensionKey . '_freeCap'] = '<script type="text/javascript" src="' . GeneralUtility::createVersionNumberedFilename(ExtensionManagementUtility::siteRelPath($this->extensionKey) . 'Resources/Public/JavaScript/freeCap.js') . '"></script>';
// Disable caching
$GLOBALS['TSFE']->no_cache = 1;
// Get the plugin configuration
$settings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, $this->extensionName);
// Get the translation view helper
$objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$translator = $objectManager->get('SJBR\\SrFreecap\\ViewHelpers\\TranslateViewHelper');
$translator->injectConfigurationManager($this->configurationManager);
// Generate the image url
$fakeId = GeneralUtility::shortMD5(uniqid(rand()), 5);
$siteURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
$L = GeneralUtility::_GP('L');
$urlParams = array('eID' => 'sr_freecap_EidDispatcher', 'id' => $GLOBALS['TSFE']->id, 'vendorName' => 'SJBR', 'extensionName' => 'SrFreecap', 'pluginName' => 'ImageGenerator', 'controllerName' => 'ImageGenerator', 'actionName' => 'show', 'formatName' => 'png', 'L' => $GLOBALS['TSFE']->sys_language_uid);
if ($GLOBALS['TSFE']->MP) {
$urlParams['MP'] = $GLOBALS['TSFE']->MP;
}
$urlParams['set'] = $fakeId;
$imageUrl = $siteURL . 'index.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $urlParams), '&');
// Generate the html text
$value = '<img' . $this->getClassAttribute('image', $suffix) . ' id="tx_srfreecap_captcha_image_' . $fakeId . '"' . ' src="' . htmlspecialchars($imageUrl) . '"' . ' alt="' . $translator->render('altText') . ' "/>' . '<span' . $this->getClassAttribute('cant-read', $suffix) . '>' . $translator->render('cant_read1') . ' <a href="#" onclick="this.blur();' . $this->extensionName . '.newImage(\'' . $fakeId . '\', \'' . $translator->render('noImageMessage') . '\');return false;">' . $translator->render('click_here') . '</a>' . $translator->render('cant_read2') . '</span>';
return $value;
}
示例2: renderStatic
/**
* @param array $arguments
* @param callable $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
*
* @return int
* @throws Exception
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
$filename = $arguments['filename'];
if (!$filename) {
$filename = $renderChildrenClosure();
}
$versionedFilename = \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($filename);
return $versionedFilename;
}
示例3: processJsFile
/**
* Processes a Javascript file dependent on the current context
*
* Adds the version number for Frontend, compresses the file for Backend
*
* @param string $filename Filename
* @return string New filename
*/
protected function processJsFile($filename)
{
switch (TYPO3_MODE) {
case 'FE':
if ($this->compressJavascript) {
$filename = $this->getCompressor()->compressJsFile($filename);
} else {
$filename = GeneralUtility::createVersionNumberedFilename($filename);
}
break;
case 'BE':
if ($this->compressJavascript) {
$filename = $this->getCompressor()->compressJsFile($filename);
}
break;
}
return $filename;
}
示例4: preRender
/**
* Implementation of preRender() method. Used to include CSS files.
*
* @see Tx_Solr_pluginbase_PluginBase#preRender()
*/
protected function preRender()
{
if ($this->conf['cssFiles.']['results']) {
$cssFile = \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($GLOBALS['TSFE']->tmpl->getFileName($this->conf['cssFiles.']['results']));
$GLOBALS['TSFE']->additionalHeaderData['tx_solr-resultsCss'] = '<link href="' . $cssFile . '" rel="stylesheet" type="text/css" />';
}
if ($this->conf['cssFiles.']['pagebrowser']) {
$cssFile = \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($GLOBALS['TSFE']->tmpl->getFileName($this->conf['cssFiles.']['pagebrowser']));
$GLOBALS['TSFE']->additionalHeaderData['tx_solr-pageBrowserCss'] = '<link href="' . $cssFile . '" rel="stylesheet" type="text/css" />';
}
}
示例5: outputWrapper
/**
* This wraps and returns the main content of the page into proper html-code.
*
* @param string $content The page content
* @return string The full HTML page
* @todo Define visibility
*/
public function outputWrapper($content)
{
// Get the template file
if (!$this->passwordOK) {
$this->template = @file_get_contents(PATH_site . $this->templateFilePath . 'Install_login.html');
} elseif ($this->mode == '123') {
$this->template = @file_get_contents(PATH_site . $this->templateFilePath . 'Install_123.html');
} else {
$this->template = @file_get_contents(PATH_site . $this->templateFilePath . 'Install.html');
}
// Add prototype to javascript array for output
$this->javascript[] = '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename('../contrib/prototype/prototype.js') . '"></script>';
// Add JS functions for output
$this->javascript[] = '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename('../sysext/install/Resources/Public/Javascript/install.js') . '"></script>';
// Include the default stylesheets
$this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/reset.css') . '" />';
$this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/general.css') . '" />';
// Get the browser info
$browserInfo = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
// Add the stylesheet for Internet Explorer
if ($browserInfo['browser'] === 'msie') {
// IE7
if (intval($browserInfo['version']) === 7) {
$this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/ie7.css') . '" />';
}
}
// Include the stylesheets based on screen
if ($this->mode == '123') {
$this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/install_123.css') . '" />';
} elseif ($this->passwordOK) {
$this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/install.css') . '" />';
} else {
$this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/install.css') . '" />';
$this->stylesheets[] = '<link rel="stylesheet" type="text/css" href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($this->backPath . 'sysext/install/Resources/Public/Stylesheets/install_login.css') . '" />';
}
// Define the markers content
if ($this->mode == '123') {
$this->markers['headTitle'] = 'Installing TYPO3 ' . TYPO3_branch;
} else {
$this->markers['headTitle'] = '
TYPO3 ' . TYPO3_version . '
Install Tool on site: ' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '
';
}
$this->markers['title'] = 'TYPO3 ' . TYPO3_version;
$this->markers['javascript'] = implode(LF, $this->javascript);
$this->markers['stylesheets'] = implode(LF, $this->stylesheets);
$this->markers['llErrors'] = 'The following errors occured';
$this->markers['copyright'] = $this->copyright();
$this->markers['charset'] = 'utf-8';
$this->markers['backendUrl'] = '../index.php';
$this->markers['backend'] = 'Backend admin';
$this->markers['frontendUrl'] = '../../index.php';
$this->markers['frontend'] = 'Frontend website';
$this->markers['metaCharset'] = 'Content-Type" content="text/html; charset=';
$this->markers['metaCharset'] .= 'utf-8';
// Add the error messages
if (!empty($this->errorMessages)) {
// Get the subpart for all error messages
$errorMessagesSubPart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->template, '###ERRORMESSAGES###');
// Get the subpart for a single error message
$errorMessageSubPart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($errorMessagesSubPart, '###MESSAGES###');
$errors = array();
foreach ($this->errorMessages as $errorMessage) {
// Define the markers content
$errorMessageMarkers = array('message' => $errorMessage);
// Fill the markers in the subpart
$errors[] = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($errorMessageSubPart, $errorMessageMarkers, '###|###', TRUE, FALSE);
}
// Substitute the subpart for a single message
$errorMessagesSubPart = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($errorMessagesSubPart, '###MESSAGES###', implode(LF, $errors));
}
// Version subpart is only allowed when password is ok
if ($this->passwordOK) {
// Get the subpart for the version
$versionSubPart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->template, '###VERSIONSUBPART###');
// Define the markers content
$versionSubPartMarkers['version'] = 'Version: ' . TYPO3_version;
// Fill the markers in the subpart
$versionSubPart = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($versionSubPart, $versionSubPartMarkers, '###|###', TRUE, FALSE);
}
// Substitute the version subpart
$this->template = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($this->template, '###VERSIONSUBPART###', $versionSubPart);
// Substitute the menu subpart
$this->template = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($this->template, '###MENU###', $this->menu());
// Substitute the error messages subpart
$this->template = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($this->template, '###ERRORMESSAGES###', $errorMessagesSubPart);
// Substitute the content subpart
$this->template = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($this->template, '###CONTENT###', $content);
// Fill the markers
$this->template = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($this->template, $this->markers, '###|###', TRUE, FALSE);
return $this->template;
}
示例6: getUpdateJS
/**
* Returns a JavaScript <script> section with some function calls to JavaScript functions from "typo3/js/jsfunc.updateform.js" (which is also included by setting a reference in $GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate'])
* The JavaScript codes simply transfers content into form fields of a form which is probably used for editing information by frontend users. Used by fe_adminLib.inc.
*
* @param array $dataArray Data array which values to load into the form fields from $formName (only field names found in $fieldList)
* @param string $formName The form name
* @param string $arrPrefix A prefix for the data array
* @param string $fieldList The list of fields which are loaded
* @return string
* @access private
* @see user_feAdmin::displayCreateScreen()
* @todo Define visibility
*/
public function getUpdateJS($dataArray, $formName, $arrPrefix, $fieldList)
{
$JSPart = '';
$updateValues = GeneralUtility::trimExplode(',', $fieldList);
foreach ($updateValues as $fKey) {
$value = $dataArray[$fKey];
if (is_array($value)) {
foreach ($value as $Nvalue) {
$JSPart .= '
updateForm(\'' . $formName . '\',\'' . $arrPrefix . '[' . $fKey . '][]\',' . GeneralUtility::quoteJSvalue($Nvalue, TRUE) . ');';
}
} else {
$JSPart .= '
updateForm(\'' . $formName . '\',\'' . $arrPrefix . '[' . $fKey . ']\',' . GeneralUtility::quoteJSvalue($value, TRUE) . ');';
}
}
$JSPart = '<script type="text/javascript">
/*<![CDATA[*/ ' . $JSPart . '
/*]]>*/
</script>
';
$GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate'] = '<script type="text/javascript" src="' . GeneralUtility::createVersionNumberedFilename($GLOBALS['TSFE']->absRefPrefix . 'typo3/js/jsfunc.updateform.js') . '"></script>';
return $JSPart;
}
示例7: processJsFile
/**
* Processes a Javascript file dependent on the current context
*
* Adds the version number for Frontend, compresses the file for Backend
*
* @param string $filename Filename
* @return string New filename
*/
protected function processJsFile($filename)
{
if ($this->compressJavascript) {
return $this->getCompressor()->compressJsFile($filename);
} elseif (TYPO3_MODE === 'FE') {
return GeneralUtility::createVersionNumberedFilename($filename);
} else {
return $filename;
}
}
示例8: main
/**
* Main function.
* Creates some general objects and calls other functions for the main rendering of module content.
*
* @return void
* @todo Define visibility
*/
public function main()
{
// Access check...
// The page will show only if there is a valid page and if this page may be viewed by the user
$access = is_array($this->pageinfo) ? 1 : 0;
if ($this->id && $access) {
// Initialize permission settings:
$this->CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($this->pageinfo);
$this->EDIT_CONTENT = $this->CALC_PERMS & 16 ? 1 : 0;
// Start document template object:
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->setModuleTemplate('templates/db_layout.html');
// JavaScript:
$this->doc->JScode = '<script type="text/javascript" ' . 'src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($GLOBALS['BACK_PATH'] . '../t3lib/jsfunc.updateform.js') . '">' . '</script>';
$this->doc->JScode .= $this->doc->wrapScriptTags('
if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages' . intval($this->id) . '_"+top.fsMod.currentBank; ' . intval($this->id) . ';
function jumpToUrl(URL,formEl) { //
if (document.editform && TBE_EDITOR.isFormChanged) { // Check if the function exists... (works in all browsers?)
if (!TBE_EDITOR.isFormChanged()) { //
window.location.href = URL;
} else if (formEl) {
if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
}
} else window.location.href = URL;
}
' . ($this->popView ? \TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($this->id, $GLOBALS['BACK_PATH'], \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($this->id)) : '') . '
function deleteRecord(table,id,url) { //
if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('deleteWarning')) . ')) {
window.location.href = "' . $GLOBALS['BACK_PATH'] . 'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $GLOBALS['BE_USER']->veriCode() . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1";
}
return false;
}
');
$this->doc->JScode .= $this->doc->wrapScriptTags('
var DTM_array = new Array();
var DTM_origClass = new String();
// if tabs are used in a popup window the array might not exists
if(!top.DTM_currentTabs) {
top.DTM_currentTabs = new Array();
}
function DTM_activate(idBase,index,doToogle) { //
// Hiding all:
if (DTM_array[idBase]) {
for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) {
if (DTM_array[idBase][cnt] != idBase+"-"+index) {
document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none";
document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
}
}
}
// Showing one:
if (document.getElementById(idBase+"-"+index+"-DIV")) {
if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
if(DTM_origClass=="") {
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
} else {
DTM_origClass = "tab";
}
top.DTM_currentTabs[idBase] = -1;
} else {
document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
if(DTM_origClass=="") {
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
} else {
DTM_origClass = "tabact";
}
top.DTM_currentTabs[idBase] = index;
}
}
}
function DTM_toggle(idBase,index,isInit) { //
// Showing one:
if (document.getElementById(idBase+"-"+index+"-DIV")) {
if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
if(isInit) {
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
} else {
DTM_origClass = "tab";
}
top.DTM_currentTabs[idBase+"-"+index] = 0;
} else {
document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
if(isInit) {
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tabact";
} else {
//.........这里部分代码省略.........
示例9: loadStylesheets
/**
* Adds the stylesheets necessary for the slider
*
*/
protected function loadStylesheets()
{
$rangeFile = $this->solrConfiguration->getCssFileByFileKey('ui');
if ($rangeFile !== '' && !$GLOBALS['TSFE']->additionalHeaderData['tx_solr-uiCss']) {
$cssFile = GeneralUtility::createVersionNumberedFilename($GLOBALS['TSFE']->tmpl->getFileName($rangeFile));
$GLOBALS['TSFE']->additionalHeaderData['tx_solr-uiCss'] = $rangeFile;
'<link href="' . $cssFile . '" rel="stylesheet" type="text/css" media="all" />';
}
}
示例10: registerRTEinJS
//.........这里部分代码省略.........
RTEarea[editornumber].disableEnterParagraphs = ' . (trim($this->thisConfig['disableEnterParagraphs']) ? 'true' : 'false') . ';
RTEarea[editornumber].disableObjectResizing = ' . (trim($this->thisConfig['disableObjectResizing']) ? 'true' : 'false') . ';
RTEarea[editornumber].removeTrailingBR = ' . (trim($this->thisConfig['removeTrailingBR']) ? 'true' : 'false') . ';
RTEarea[editornumber].useCSS = ' . (trim($this->thisConfig['useCSS']) ? 'true' : 'false') . ';
RTEarea[editornumber].keepButtonGroupTogether = ' . (trim($this->thisConfig['keepButtonGroupTogether']) ? 'true' : 'false') . ';
RTEarea[editornumber].disablePCexamples = ' . (trim($this->thisConfig['disablePCexamples']) ? 'true' : 'false') . ';
RTEarea[editornumber].showTagFreeClasses = ' . (trim($this->thisConfig['showTagFreeClasses']) ? 'true' : 'false') . ';
RTEarea[editornumber].useHTTPS = ' . (trim(stristr($this->siteURL, 'https')) || $this->thisConfig['forceHTTPS'] ? 'true' : 'false') . ';
RTEarea[editornumber].tceformsNested = ' . (is_object($this->TCEform) && method_exists($this->TCEform, 'getDynNestedStack') ? $this->TCEform->getDynNestedStack(TRUE) : '[]') . ';
RTEarea[editornumber].dialogueWindows = new Object();';
if (isset($this->thisConfig['dialogueWindows.']['defaultPositionFromTop'])) {
$configureRTEInJavascriptString .= '
RTEarea[editornumber].dialogueWindows.positionFromTop = ' . (int) $this->thisConfig['dialogueWindows.']['defaultPositionFromTop'] . ';';
}
if (isset($this->thisConfig['dialogueWindows.']['defaultPositionFromLeft'])) {
$configureRTEInJavascriptString .= '
RTEarea[editornumber].dialogueWindows.positionFromLeft = ' . (int) $this->thisConfig['dialogueWindows.']['defaultPositionFromLeft'] . ';';
}
// The following properties apply only to the backend
if (!$this->is_FE()) {
$configureRTEInJavascriptString .= '
RTEarea[editornumber].sys_language_content = "' . $this->contentLanguageUid . '";
RTEarea[editornumber].typo3ContentLanguage = "' . $this->contentTypo3Language . '";
RTEarea[editornumber].typo3ContentCharset = "' . $this->contentCharset . '";
RTEarea[editornumber].userUid = "' . $this->userUid . '";';
}
// Setting the plugin flags
$configureRTEInJavascriptString .= '
RTEarea[editornumber].plugin = new Object();
RTEarea[editornumber].pathToPluginDirectory = new Object();';
foreach ($this->pluginEnabledArray as $pluginId) {
$configureRTEInJavascriptString .= '
RTEarea[editornumber].plugin.' . $pluginId . ' = true;';
if (is_object($this->registeredPlugins[$pluginId])) {
$pathToPluginDirectory = $this->registeredPlugins[$pluginId]->getPathToPluginDirectory();
if ($pathToPluginDirectory) {
$configureRTEInJavascriptString .= '
RTEarea[editornumber].pathToPluginDirectory.' . $pluginId . ' = "' . $pathToPluginDirectory . '";';
}
}
}
// Setting the buttons configuration
$configureRTEInJavascriptString .= '
RTEarea[editornumber].buttons = new Object();';
if (is_array($this->thisConfig['buttons.'])) {
foreach ($this->thisConfig['buttons.'] as $buttonIndex => $conf) {
$button = substr($buttonIndex, 0, -1);
if (is_array($conf)) {
$configureRTEInJavascriptString .= '
RTEarea[editornumber].buttons.' . $button . ' = ' . $this->buildNestedJSArray($conf) . ';';
}
}
}
// Setting the list of tags to be removed if specified in the RTE config
if (trim($this->thisConfig['removeTags'])) {
$configureRTEInJavascriptString .= '
RTEarea[editornumber].htmlRemoveTags = /^(' . implode('|', GeneralUtility::trimExplode(',', $this->thisConfig['removeTags'], TRUE)) . ')$/i;';
}
// Setting the list of tags to be removed with their contents if specified in the RTE config
if (trim($this->thisConfig['removeTagsAndContents'])) {
$configureRTEInJavascriptString .= '
RTEarea[editornumber].htmlRemoveTagsAndContents = /^(' . implode('|', GeneralUtility::trimExplode(',', $this->thisConfig['removeTagsAndContents'], TRUE)) . ')$/i;';
}
// Setting array of custom tags if specified in the RTE config
if (!empty($this->thisConfig['customTags'])) {
$customTags = GeneralUtility::trimExplode(',', $this->thisConfig['customTags'], TRUE);
if (!empty($customTags)) {
$configureRTEInJavascriptString .= '
RTEarea[editornumber].customTags= ' . json_encode($customTags) . ';';
}
}
// Setting the pageStyle
$configureRTEInJavascriptString .= '
RTEarea[editornumber].pageStyle = "' . GeneralUtility::createVersionNumberedFilename($this->getContentCssFileName()) . '";';
// Process classes configuration
$classesConfigurationRequired = FALSE;
foreach ($this->registeredPlugins as $pluginId => $plugin) {
if ($this->isPluginEnabled($pluginId)) {
$classesConfigurationRequired = $classesConfigurationRequired || $plugin->requiresClassesConfiguration();
}
}
if ($classesConfigurationRequired) {
$configureRTEInJavascriptString .= $this->buildJSClassesConfig($RTEcounter);
}
// Add Javascript configuration for registered plugins
foreach ($this->registeredPlugins as $pluginId => $plugin) {
if ($this->isPluginEnabled($pluginId)) {
$configureRTEInJavascriptString .= $plugin->buildJavascriptConfiguration('editornumber');
}
}
// Avoid premature reference to HTMLArea when being initially loaded by IRRE Ajax call
$configureRTEInJavascriptString .= '
RTEarea[editornumber].toolbar = ' . $this->getJSToolbarArray() . ';
RTEarea[editornumber].convertButtonId = ' . json_encode(array_flip($this->convertToolbarForHtmlAreaArray)) . ';
RTEarea.initEditor(editornumber);
}
};
configureEditorInstance["' . $textAreaId . '"]();';
return $configureRTEInJavascriptString;
}
示例11: getTag
/**
* Generate the tag
*
* @param string $file
* @return string
*/
protected function getTag($file)
{
$file = \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($file);
$tag = '<script src="' . htmlspecialchars($file) . '" type="text/javascript"></script>';
return $tag;
}
示例12: renderPreProcess
/**
* Insert javascript-tags for google-analytics
*
* @param array $params
* @param \TYPO3\CMS\Core\Page\PageRenderer $pObj
* @return void
*/
public function renderPreProcess($params, $pObj)
{
if (TYPO3_MODE === 'FE') {
// Get plugin-configuration
$conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_libjsanalytics.']['settings.'];
// Exclude the analytics-snippet on some pages
$pageExclude = GeneralUtility::trimExplode(',', $conf['pageExclude'], true);
// Generate script-tag for google-analytics if enabled
if ((int) $conf['enable'] && !in_array($GLOBALS['TSFE']->id, $pageExclude)) {
$analyticsPreScript = '';
$analyticsPostScript = '';
// Instruct analytics.js to use the name defined in typoscript
if (!empty($conf['gaObjectName']) && $conf['gaObjectName'] !== 'ga') {
$gaObjectName = $conf['gaObjectName'];
} else {
$gaObjectName = 'ga';
}
// Get filePath to analytics.js
$analyticsJavascriptFile = Tools::getConfParam('localFile');
if ($conf['forceCdn'] || !file_exists(PATH_site . $analyticsJavascriptFile)) {
$analyticsJavascriptFile = Tools::getConfParam('sourceFile');
} else {
// If local file is not available, fall back to CDN
if (empty($analyticsJavascriptFile)) {
$analyticsJavascriptFile = Tools::getConfParam('sourceFile');
} else {
// Prefix file with absRefPrefix if path is relative
if (!GeneralUtility::isAbsPath($analyticsJavascriptFile)) {
$analyticsJavascriptFile = $GLOBALS['TSFE']->absRefPrefix . $analyticsJavascriptFile;
}
// Append filename with version numbers
$analyticsJavascriptFile = GeneralUtility::createVersionNumberedFilename($analyticsJavascriptFile);
}
}
// Insert different codeblocks for different integration (old/new)
if ((int) $conf['alternative']) {
if ($conf['gaObjectName'] !== 'ga') {
$scriptTag .= LF . 'window.GoogleAnalyticsObject = \'' . $gaObjectName . '\';';
}
// Create an initial analytics() function
// The queued commands will be executed once analytics.js loads
$scriptTag .= LF . 'window.' . $gaObjectName . ' = window.' . $gaObjectName . ' || function() {' . '(' . $gaObjectName . '.q = ' . $gaObjectName . '.q || []).push(arguments)};';
// Set the time (as an integer) this tag was executed (Used for timing hits)
$scriptTag .= LF . $gaObjectName . '.l =+ new Date;';
// Compile final script-tag for analytics.js
$analyticsPostScript = LF . '<script src="' . $analyticsJavascriptFile . '" type="text/javascript" async="async"></script>';
} else {
// Compile final script-tag for analytics.js
$analyticsPreScript = LF . '(function(i,s,o,g,r,a,m){i[\'GoogleAnalyticsObject\']=r;i[r]=i[r]||function(){' . LF . '(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),' . LF . 'm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)' . LF . '})(window,document,\'script\',\'' . $analyticsJavascriptFile . '\',\'' . $gaObjectName . '\');';
}
// Create the tracker
foreach ($conf['gaObject.'] as $gaName => $gaTracker) {
// Set the name of the tracker if defined in typoscript
$trackerName = '';
if ($gaName !== 'default.') {
$trackerName = $gaName;
}
// Check if analytics objects are defined
if (is_array($gaTracker)) {
$scriptTag .= $this->iterateTrackerMethods($gaObjectName, $trackerName, $gaTracker);
}
}
// TEST/TODO
// Add additional javascript to a single page if defined in PageTSConfig
//debug($GLOBALS['TSFE']->page['TSconfig']);
/*
$pageTS = BackendUtility::getPagesTSconfig($GLOBALS['TSFE']->id, [$GLOBALS['TSFE']->id]);
if (isset($pageTS['tx_libjsanalytics.'])) {
$analyticsPageTS = $pageTS['tx_libjsanalytics.'];
if (is_array($analyticsPageTS['additionalScript.'])) {
$scriptTag .= LF . $this->getCobject($analyticsPageTS['additionalScript'], $analyticsPageTS['additionalScript.']);
}
}
*/
// Compile final codeblock
$scriptTag = '<script type="text/javascript">' . LF . '/*<![CDATA[*/' . $analyticsPreScript . $scriptTag . LF . '/*]]>*/' . LF . '</script>' . $analyticsPostScript;
// Add final code to HTML
$pObj->addHeaderData($scriptTag);
}
}
}
示例13: preRender
/**
* Implementation of preRender() method. Used to include CSS files.
*
*/
protected function preRender()
{
$resultsCss = $this->typoScriptConfiguration->getCssFileByFileKey('results');
if ($resultsCss !== '') {
$cssFile = GeneralUtility::createVersionNumberedFilename($GLOBALS['TSFE']->tmpl->getFileName($resultsCss));
$GLOBALS['TSFE']->additionalHeaderData['tx_solr-resultsCss'] = '<link href="' . $cssFile . '" rel="stylesheet" type="text/css" />';
}
}
示例14: wrapJavascriptFile
/**
* Wrap js files inside <script> tag
*
* @param string $file Path to file
* @return string <script.. string ready for <head> part
*/
public function wrapJavascriptFile($file)
{
if (substr($file, 0, 4) == 'EXT:') {
list($extKey, $local) = explode('/', substr($file, 4), 2);
if (strcmp($extKey, '') && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey) && strcmp($local, '')) {
$file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey) . $local;
}
}
$file = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath($file);
$file = \TYPO3\CMS\Core\Utility\GeneralUtility::createVersionNumberedFilename($file);
return '<script src="' . htmlspecialchars($file) . '" type="text/javascript"></script>';
}
示例15: wrapCssFile
/**
* wrapCssFile
*
* @param string $cssFile
* @return string
*/
private function wrapCssFile($cssFile)
{
$cssFile = GeneralUtility::resolveBackPath($cssFile);
$cssFile = GeneralUtility::createVersionNumberedFilename($cssFile);
return '<link rel="stylesheet" type="text/css" href="' . htmlspecialchars($cssFile) . '" media="screen" />';
}