本文整理汇总了PHP中TYPO3\CMS\Core\Page\PageRenderer::addJsFile方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRenderer::addJsFile方法的具体用法?PHP PageRenderer::addJsFile怎么用?PHP PageRenderer::addJsFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Page\PageRenderer
的用法示例。
在下文中一共展示了PageRenderer::addJsFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* Main function of the module. Write the content to $this->content
* If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree
*/
function main()
{
global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
$PATH_TYPO3 = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3/';
if ($BE_USER->user["admin"]) {
// Draw the header.
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("template");
$this->doc->backPath = $BACK_PATH;
$this->pageRenderer = $this->doc->getPageRenderer();
// Include Ext JS
$this->pageRenderer->loadExtJS(true, true);
$this->pageRenderer->enableExtJSQuickTips();
$this->pageRenderer->enableExtJsDebug();
$this->pageRenderer->addJsFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/js/tx.caretaker.js', 'text/javascript', FALSE, FALSE);
$this->pageRenderer->addJsFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/js/tx.caretaker.NodeTree.js', 'text/javascript', FALSE, FALSE);
//Add caretaker css
$this->pageRenderer->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/css/tx.caretaker.nodetree.css', 'stylesheet', 'all', '', FALSE);
// storage Pid
$confArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['caretaker']);
$storagePid = (int) $confArray['storagePid'];
$this->pageRenderer->addJsInlineCode('Caretaker_Nodetree', '
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.ns("tx.caretaker");
Ext.onReady(function() {
tx.caretaker.view = new Ext.Viewport({
layout: "fit",
items: {
id: "cartaker-tree",
xtype: "caretaker-nodetree",
autoScroll: true,
dataUrl: TYPO3.settings.ajaxUrls[\'tx_caretaker::treeloader\'],
addUrl: "' . $PATH_TYPO3 . 'alt_doc.php?edit[###NODE_TYPE###][' . $storagePid . ']=new",
editUrl: "' . $PATH_TYPO3 . 'alt_doc.php?edit[tx_caretaker_###NODE_TYPE###][###NODE_UID###]=edit",
hideUrl: "' . $PATH_TYPO3 . 'tce_db.php?&data[tx_caretaker_###NODE_TYPE###][###NODE_UID###][hidden]=1",
unhideUrl: "' . $PATH_TYPO3 . 'tce_db.php?&data[tx_caretaker_###NODE_TYPE###][###NODE_UID###][hidden]=0"
}
});
tx_caretaker_updateTreeById = function( id ){
tx_caretaker_tree = Ext.getCmp("cartaker-tree");
tx_caretaker_tree.reloadTreePartial( id );
}
});
');
$this->content .= $this->doc->startPage($LANG->getLL("title"));
$this->doc->form = '';
} else {
// If no access or if not admin
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\MediumDocumentTemplate');
$this->doc->backPath = $BACK_PATH;
$this->content .= $this->doc->startPage($LANG->getLL("title"));
$this->content .= $this->doc->header($LANG->getLL("title"));
$this->content .= $this->doc->spacer(5);
$this->content .= $this->doc->spacer(10);
}
}
示例2: render
/**
* Load the assets (JavaScript, CSS) for this Vidi module.
*
* @return void
* @api
*/
public function render()
{
/** @var \Fab\Vidi\Module\ModuleLoader $moduleLoader */
$moduleLoader = $this->objectManager->get('Fab\\Vidi\\Module\\ModuleLoader');
foreach ($moduleLoader->getAdditionalStyleSheetFiles() as $addCssFile) {
$fileNameAndPath = $this->resolvePath($addCssFile);
$this->pageRenderer->addCssFile($fileNameAndPath);
}
foreach ($moduleLoader->getAdditionalJavaScriptFiles() as $addJsFile) {
$fileNameAndPath = $this->resolvePath($addJsFile);
$this->pageRenderer->addJsFile($fileNameAndPath);
}
}
示例3: testAddJsFile
/**
* test add JS file
*/
public function testAddJsFile()
{
$expectedRegExp = '#<script src="fileadmin/test\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
$this->fixture->addJsFile('fileadmin/test.js');
$out = $this->fixture->render();
$this->assertRegExp($expectedRegExp, $out);
}
示例4: addJsFileToPageRenderer
/**
* Wrapper for t3lib_PageRenderer->addJsFile. Excludes $jsFile from concatenation on TYPO3 4.6+.
*
* @param string $jsFile
* @return void
*/
protected function addJsFileToPageRenderer($jsFile)
{
if (version_compare(TYPO3_version, '4.6', '>=')) {
$this->pageRenderer->addJsFile($jsFile, 'text/javascript', true, false, '', true);
} else {
$this->pageRenderer->addJsFile($jsFile);
}
}
示例5: addJSFile
/**
* Add a JS File to the header
*
* @param string $file
* @param string $type
* @param boolean $compress
* @param boolean $forceOnTop
* @param string $allWrap
* @param string $position
* @return void
*/
public function addJSFile($file, $position = 'footer', $type = 'text/javascript', $compress = true, $forceOnTop = false, $allWrap = '')
{
$filePath = GeneralUtility::isFirstPartOfStr(strtolower($file), 'http') ? $file : $this->fileSystemDiv->getFileRelFileName($file);
if ($position === 'footer') {
$this->pageRenderer->addJsFooterFile($filePath, $type, $compress, $forceOnTop, $allWrap);
} else {
$this->pageRenderer->addJsFile($filePath, $type, $compress, $forceOnTop, $allWrap);
}
}
示例6: includeJavascriptFromPath
/**
* @param $path
*/
protected function includeJavascriptFromPath($path)
{
$resourcePath = ExtensionManagementUtility::extRelPath('typo3_forum') . $path;
$absResourcePath = ExtensionManagementUtility::extPath('typo3_forum') . $path;
$jsFiles = glob($absResourcePath . '*.js');
foreach ($jsFiles as $jsFile) {
$jsFile = str_replace($absResourcePath, $resourcePath, $jsFile);
$this->pageRenderer->addJsFile($jsFile, 'text/javascript', FALSE);
}
}
示例7: render
/**
* Render the URI to the resource. The filename is used from child content.
*
* @param string $file The relative path of the resource (relative to Public resource directory of the extension).
*/
public function render($file = NULL)
{
if (!$this->arguments['extensionName']) {
$this->arguments['extensionName'] = $this->controllerContext->getRequest()->getControllerExtensionName();
}
$uri = 'EXT:' . GeneralUtility::camelCaseToLowerCaseUnderscored($this->arguments['extensionName']) . $this->getResourcesPathAndFilename($file);
$uri = GeneralUtility::getFileAbsFileName($uri);
$uri = substr($uri, strlen(PATH_site));
switch ($this->arguments['where']) {
case 'footer':
$this->pageRenderer->addJsFooterFile($uri, $this->arguments['type'], $this->arguments['compress'], $this->arguments['forceOnTop'], $this->arguments['allWrap'], $this->arguments['excludeFromConcatenation']);
break;
case 'footerLibs':
$this->pageRenderer->addJsFooterLibrary($this->arguments['key'], $uri, $this->arguments['type'], $this->arguments['compress'], $this->arguments['forceOnTop'], $this->arguments['allWrap'], $this->arguments['excludeFromConcatenation']);
break;
default:
$this->pageRenderer->addJsFile($uri, $this->arguments['type'], $this->arguments['compress'], $this->arguments['forceOnTop'], $this->arguments['allWrap'], $this->arguments['excludeFromConcatenation']);
break;
}
}
示例8: loadJavascript
/**
* Load the necessarry javascript
*
* This will only be done when the referenced record is available
*
* @return void
*/
protected function loadJavascript()
{
$compress = TRUE;
$javascriptFiles = array('Initialize.js', 'Ux/Ext.ux.merge.js', 'Ux/Ext.ux.isemptyobject.js', 'Ux/Ext.ux.spinner.js', 'Ux/Ext.ux.form.spinnerfield.js', 'Ux/Ext.ux.form.textfieldsubmit.js', 'Ux/Ext.ux.grid.CheckColumn.js', 'Ux/Ext.ux.grid.SingleSelectCheckColumn.js', 'Ux/Ext.ux.grid.ItemDeleter.js', 'Helpers/History.js', 'Helpers/Element.js', 'Elements/ButtonGroup.js', 'Elements/Container.js', 'Elements/Elements.js', 'Elements/Dummy.js', 'Elements/Basic/Button.js', 'Elements/Basic/Checkbox.js', 'Elements/Basic/Fieldset.js', 'Elements/Basic/Fileupload.js', 'Elements/Basic/Form.js', 'Elements/Basic/Hidden.js', 'Elements/Basic/Password.js', 'Elements/Basic/Radio.js', 'Elements/Basic/Reset.js', 'Elements/Basic/Select.js', 'Elements/Basic/Submit.js', 'Elements/Basic/Textarea.js', 'Elements/Basic/Textline.js', 'Elements/Predefined/Email.js', 'Elements/Predefined/CheckboxGroup.js', 'Elements/Predefined/Name.js', 'Elements/Predefined/RadioGroup.js', 'Elements/Content/Header.js', 'Elements/Content/Textblock.js', 'Viewport.js', 'Viewport/Left.js', 'Viewport/Right.js', 'Viewport/Left/Elements.js', 'Viewport/Left/Elements/ButtonGroup.js', 'Viewport/Left/Elements/Basic.js', 'Viewport/Left/Elements/Predefined.js', 'Viewport/Left/Elements/Content.js', 'Viewport/Left/Options.js', 'Viewport/Left/Options/Dummy.js', 'Viewport/Left/Options/Panel.js', 'Viewport/Left/Options/Forms/Attributes.js', 'Viewport/Left/Options/Forms/Label.js', 'Viewport/Left/Options/Forms/Legend.js', 'Viewport/Left/Options/Forms/Options.js', 'Viewport/Left/Options/Forms/Various.js', 'Viewport/Left/Options/Forms/Filters.js', 'Viewport/Left/Options/Forms/Filters/Filter.js', 'Viewport/Left/Options/Forms/Filters/Dummy.js', 'Viewport/Left/Options/Forms/Filters/Alphabetic.js', 'Viewport/Left/Options/Forms/Filters/Alphanumeric.js', 'Viewport/Left/Options/Forms/Filters/Currency.js', 'Viewport/Left/Options/Forms/Filters/Digit.js', 'Viewport/Left/Options/Forms/Filters/Integer.js', 'Viewport/Left/Options/Forms/Filters/LowerCase.js', 'Viewport/Left/Options/Forms/Filters/RegExp.js', 'Viewport/Left/Options/Forms/Filters/RemoveXSS.js', 'Viewport/Left/Options/Forms/Filters/StripNewLines.js', 'Viewport/Left/Options/Forms/Filters/TitleCase.js', 'Viewport/Left/Options/Forms/Filters/Trim.js', 'Viewport/Left/Options/Forms/Filters/UpperCase.js', 'Viewport/Left/Options/Forms/Validation.js', 'Viewport/Left/Options/Forms/Validation/Rule.js', 'Viewport/Left/Options/Forms/Validation/Dummy.js', 'Viewport/Left/Options/Forms/Validation/Alphabetic.js', 'Viewport/Left/Options/Forms/Validation/Alphanumeric.js', 'Viewport/Left/Options/Forms/Validation/Between.js', 'Viewport/Left/Options/Forms/Validation/Date.js', 'Viewport/Left/Options/Forms/Validation/Digit.js', 'Viewport/Left/Options/Forms/Validation/Email.js', 'Viewport/Left/Options/Forms/Validation/Equals.js', 'Viewport/Left/Options/Forms/Validation/FileAllowedTypes.js', 'Viewport/Left/Options/Forms/Validation/FileMaximumSize.js', 'Viewport/Left/Options/Forms/Validation/FileMinimumSize.js', 'Viewport/Left/Options/Forms/Validation/Float.js', 'Viewport/Left/Options/Forms/Validation/GreaterThan.js', 'Viewport/Left/Options/Forms/Validation/InArray.js', 'Viewport/Left/Options/Forms/Validation/Integer.js', 'Viewport/Left/Options/Forms/Validation/Ip.js', 'Viewport/Left/Options/Forms/Validation/Length.js', 'Viewport/Left/Options/Forms/Validation/LessThan.js', 'Viewport/Left/Options/Forms/Validation/RegExp.js', 'Viewport/Left/Options/Forms/Validation/Required.js', 'Viewport/Left/Options/Forms/Validation/Uri.js', 'Viewport/Left/Form.js', 'Viewport/Left/Form/Behaviour.js', 'Viewport/Left/Form/Attributes.js', 'Viewport/Left/Form/Prefix.js', 'Viewport/Left/Form/PostProcessor.js', 'Viewport/Left/Form/PostProcessors/PostProcessor.js', 'Viewport/Left/Form/PostProcessors/Dummy.js', 'Viewport/Left/Form/PostProcessors/Mail.js', 'Viewport/Left/Form/PostProcessors/Redirect.js');
// Load ExtJS
$this->pageRenderer->loadExtJS();
// Load the wizards javascript
$baseUrl = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('form') . 'Resources/Public/JavaScript/Wizard/';
foreach ($javascriptFiles as $javascriptFile) {
$this->pageRenderer->addJsFile($baseUrl . $javascriptFile, 'text/javascript', $compress, FALSE);
}
}
示例9: getPageRenderer
/**
* @param PageRenderer $pageRenderer
*/
public function getPageRenderer(PageRenderer $pageRenderer)
{
$loginSecurityLevel = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel']) ?: 'normal';
if ($loginSecurityLevel === 'rsa') {
$javascriptPath = '../' . ExtensionManagementUtility::siteRelPath('rsaauth') . 'Resources/Public/JavaScript/';
$files = array('jsbn/jsbn.js', 'jsbn/prng4.js', 'jsbn/rng.js', 'jsbn/rsa.js', 'jsbn/base64.js');
foreach ($files as $file) {
$pageRenderer->addJsFile($javascriptPath . $file);
}
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Rsaauth/BackendLoginFormRsaEncryption');
}
}
示例10: render
/**
* Render start page with \TYPO3\CMS\Backend\Template\DocumentTemplate and pageTitle
*
* @param string $pageTitle title tag of the module. Not required by default, as BE modules are shown in a frame
* @param bool $loadExtJs specifies whether to load ExtJS library. Defaults to FALSE
* @param bool $loadExtJsTheme whether to load ExtJS "grey" theme. Defaults to FALSE
* @param bool $enableExtJsDebug if TRUE, debug version of ExtJS is loaded. Use this for development only
* @param bool $loadJQuery whether to load jQuery library. Defaults to FALSE
* @param array $includeCssFiles List of custom CSS file to be loaded
* @param array $includeJsFiles List of custom JavaScript file to be loaded
* @param array $addJsInlineLabels Custom labels to add to JavaScript inline labels
* @param array $includeRequireJsModules List of RequireJS modules to be loaded
* @param string $jQueryNamespace Store the jQuery object in a specific namespace
* @return void
*/
public function render($pageTitle = '', $loadExtJs = false, $loadExtJsTheme = true, $enableExtJsDebug = false, $loadJQuery = false, $includeCssFiles = null, $includeJsFiles = null, $addJsInlineLabels = null, $includeRequireJsModules = null, $jQueryNamespace = null)
{
if ($pageTitle) {
$this->pageRenderer->setTitle($pageTitle);
}
if ($loadExtJs) {
$this->pageRenderer->loadExtJS(true, $loadExtJsTheme);
if ($enableExtJsDebug) {
$this->pageRenderer->enableExtJsDebug();
}
}
if ($loadJQuery) {
$jQueryNamespace = $jQueryNamespace ?: PageRenderer::JQUERY_NAMESPACE_DEFAULT;
$this->pageRenderer->loadJquery(null, null, $jQueryNamespace);
}
// Include custom CSS and JS files
if (is_array($includeCssFiles) && count($includeCssFiles) > 0) {
foreach ($includeCssFiles as $addCssFile) {
$this->pageRenderer->addCssFile($addCssFile);
}
}
if (is_array($includeJsFiles) && count($includeJsFiles) > 0) {
foreach ($includeJsFiles as $addJsFile) {
$this->pageRenderer->addJsFile($addJsFile);
}
}
if (is_array($includeRequireJsModules) && count($includeRequireJsModules) > 0) {
foreach ($includeRequireJsModules as $addRequireJsFile) {
$this->pageRenderer->loadRequireJsModule($addRequireJsFile);
}
}
// Add inline language labels
if (is_array($addJsInlineLabels) && count($addJsInlineLabels) > 0) {
$extensionKey = $this->controllerContext->getRequest()->getControllerExtensionKey();
foreach ($addJsInlineLabels as $key) {
$label = LocalizationUtility::translate($key, $extensionKey);
$this->pageRenderer->addInlineLanguageLabel($key, $label);
}
}
}
示例11: showAllVersionsAction
/**
* Shows all versions of a specific extension
*
* @return void
*/
public function showAllVersionsAction()
{
$this->pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/notifications.js');
$extensions = array();
$extensionKey = '';
if ($this->request->hasArgument('allVersions') && $this->request->getArgument('allVersions') == 1 && $this->request->hasArgument('extensionKey') && is_string($this->request->getArgument('extensionKey'))) {
$extensionKey = $this->request->getArgument('extensionKey');
$extensions = $this->extensionRepository->findByExtensionKeyOrderedByVersion($extensionKey);
} else {
$this->redirect('ter');
}
$this->view->assign('extensions', $extensions)->assign('extensionKey', $extensionKey);
}
示例12: loadResourcesForRegisteredNavigationComponents
/**
* Loads the css and javascript files of all registered navigation widgets
*
* @return void
*/
protected function loadResourcesForRegisteredNavigationComponents()
{
if (!is_array($GLOBALS['TBE_MODULES']['_navigationComponents'])) {
return;
}
$loadedComponents = array();
foreach ($GLOBALS['TBE_MODULES']['_navigationComponents'] as $module => $info) {
if (in_array($info['componentId'], $loadedComponents)) {
continue;
}
$loadedComponents[] = $info['componentId'];
$component = strtolower(substr($info['componentId'], strrpos($info['componentId'], '-') + 1));
$componentDirectory = 'components/' . $component . '/';
if ($info['isCoreComponent']) {
$absoluteComponentPath = PATH_site . 'typo3/sysext/backend/Resources/Public/JavaScript/extjs/' . $componentDirectory;
$relativeComponentPath = '../' . str_replace(PATH_site, '', $absoluteComponentPath);
} else {
$absoluteComponentPath = ExtensionManagementUtility::extPath($info['extKey']) . $componentDirectory;
$relativeComponentPath = ExtensionManagementUtility::extRelPath($info['extKey']) . $componentDirectory;
}
$cssFiles = GeneralUtility::getFilesInDir($absoluteComponentPath . 'css/', 'css');
if (file_exists($absoluteComponentPath . 'css/loadorder.txt')) {
// Don't allow inclusion outside directory
$loadOrder = str_replace('../', '', GeneralUtility::getUrl($absoluteComponentPath . 'css/loadorder.txt'));
$cssFilesOrdered = GeneralUtility::trimExplode(LF, $loadOrder, true);
$cssFiles = array_merge($cssFilesOrdered, $cssFiles);
}
foreach ($cssFiles as $cssFile) {
$this->pageRenderer->addCssFile($relativeComponentPath . 'css/' . $cssFile);
}
$jsFiles = GeneralUtility::getFilesInDir($absoluteComponentPath . 'javascript/', 'js');
if (file_exists($absoluteComponentPath . 'javascript/loadorder.txt')) {
// Don't allow inclusion outside directory
$loadOrder = str_replace('../', '', GeneralUtility::getUrl($absoluteComponentPath . 'javascript/loadorder.txt'));
$jsFilesOrdered = GeneralUtility::trimExplode(LF, $loadOrder, true);
$jsFiles = array_merge($jsFilesOrdered, $jsFiles);
}
foreach ($jsFiles as $jsFile) {
$this->pageRenderer->addJsFile($relativeComponentPath . 'javascript/' . $jsFile);
}
$this->pageRenderer->addInlineSetting('RecordHistory', 'moduleUrl', BackendUtility::getModuleUrl('record_history'));
$this->pageRenderer->addInlineSetting('NewRecord', 'moduleUrl', BackendUtility::getModuleUrl('db_new'));
$this->pageRenderer->addInlineSetting('FormEngine', 'moduleUrl', BackendUtility::getModuleUrl('record_edit'));
}
}
示例13: loadHeaderData
/**
* Loads data in the HTML head section (e.g. JavaScript or stylesheet information).
*
* @return void
*/
protected function loadHeaderData()
{
// Load CSS Stylesheets:
$this->pageRenderer->addCssFile($this->relativePath . 'res/css/customExtJs.css');
// Load Ext JS:
$this->pageRenderer->loadExtJS();
$this->pageRenderer->enableExtJSQuickTips();
// Integrate dynamic JavaScript such as configuration or lables:
$this->pageRenderer->addInlineSettingArray('Recycler', $this->getJavaScriptConfiguration());
$this->pageRenderer->addInlineLanguageLabelArray($this->getJavaScriptLabels());
// Load Recycler JavaScript:
// Load Plugins
$uxPath = $this->doc->backpath . 'js/extjs/ux/';
$this->pageRenderer->addJsFile($uxPath . 'Ext.grid.RowExpander.js');
$this->pageRenderer->addJsFile($uxPath . 'Ext.app.SearchField.js');
$this->pageRenderer->addJsFile($uxPath . 'Ext.ux.FitToParent.js');
// Load main script
$this->pageRenderer->addJsFile($this->relativePath . 'res/js/t3_recycler.js');
}
示例14: loadResourcesForRegisteredNavigationComponents
/**
* Loads the css and javascript files of all registered navigation widgets
*
* @return void
*/
protected function loadResourcesForRegisteredNavigationComponents()
{
if (!is_array($GLOBALS['TBE_MODULES']['_navigationComponents'])) {
return;
}
$loadedComponents = array();
foreach ($GLOBALS['TBE_MODULES']['_navigationComponents'] as $module => $info) {
if (in_array($info['componentId'], $loadedComponents)) {
continue;
}
$loadedComponents[] = $info['componentId'];
$component = strtolower(substr($info['componentId'], strrpos($info['componentId'], '-') + 1));
$componentDirectory = 'components/' . $component . '/';
if ($info['isCoreComponent']) {
$absoluteComponentPath = PATH_t3lib . 'js/extjs/' . $componentDirectory;
$relativeComponentPath = '../' . str_replace(PATH_site, '', $absoluteComponentPath);
} else {
$absoluteComponentPath = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($info['extKey']) . $componentDirectory;
$relativeComponentPath = \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($info['extKey']) . $componentDirectory;
}
$cssFiles = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($absoluteComponentPath . 'css/', 'css');
if (file_exists($absoluteComponentPath . 'css/loadorder.txt')) {
// Don't allow inclusion outside directory
$loadOrder = str_replace('../', '', \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($absoluteComponentPath . 'css/loadorder.txt'));
$cssFilesOrdered = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, $loadOrder, TRUE);
$cssFiles = array_merge($cssFilesOrdered, $cssFiles);
}
foreach ($cssFiles as $cssFile) {
$this->pageRenderer->addCssFile($relativeComponentPath . 'css/' . $cssFile);
}
$jsFiles = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($absoluteComponentPath . 'javascript/', 'js');
if (file_exists($absoluteComponentPath . 'javascript/loadorder.txt')) {
// Don't allow inclusion outside directory
$loadOrder = str_replace('../', '', \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($absoluteComponentPath . 'javascript/loadorder.txt'));
$jsFilesOrdered = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, $loadOrder, TRUE);
$jsFiles = array_merge($jsFilesOrdered, $jsFiles);
}
foreach ($jsFiles as $jsFile) {
$this->pageRenderer->addJsFile($relativeComponentPath . 'javascript/' . $jsFile);
}
}
}
示例15: loadJavascriptLib
/**
* Includes a javascript library that exists in the core /typo3/ directory
*
* @param string $lib Library name. Call it with the full path like
* "sysext/core/Resources/Public/JavaScript/QueryGenerator.js" to load it
*
* @return void
* @internal
*/
public function loadJavascriptLib($lib)
{
// @todo: maybe we can remove this one as well
$this->pageRenderer->addJsFile($lib);
}