作者:dk
项目:theme
/**
* wrapper function called by hook (\TYPO3\CMS\Core\Page\PageRenderer->render-preProcess)
*
* @param array $parameters : An array of available parameters
* @param \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer : The parent object that triggered this hook
*
* @return void
*/
public function addJSCSS($parameters, &$pageRenderer)
{
// Add javascript
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Themes/ThemesBackendTca');
// Add css
$filename = $pageRenderer->backPath . ExtensionManagementUtility::extRelPath('themes') . 'Resources/Public/Stylesheet/ThemesBackendTca.css';
$pageRenderer->addCssFile($filename, 'stylesheet', 'screen');
}
作者:rickymathe
项目:TYPO3.CM
/**
* Construct
*/
public function __construct()
{
$this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$this->pageRenderer->loadJquery();
$this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Recordlist/ElementBrowser');
$this->initialize();
}
作者:rickymathe
项目:TYPO3.CM
/**
* @param StandaloneView $view
* @param PageRenderer $pageRenderer
* @param LoginController $loginController
* @throws \UnexpectedValueException
*/
public function render(StandaloneView $view, PageRenderer $pageRenderer, LoginController $loginController)
{
GeneralUtility::makeInstance(ObjectManager::class)->get(Dispatcher::class)->dispatch(__CLASS__, self::SIGNAL_getPageRenderer, array($pageRenderer));
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/UserPassLogin');
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/UserPassLoginForm.html'));
if (GeneralUtility::getIndpEnv('TYPO3_SSL')) {
$view->assign('presetUsername', GeneralUtility::_GP('u'));
$view->assign('presetPassword', GeneralUtility::_GP('p'));
}
}
作者:plan2ne
项目:TYPO3.CM
/**
* @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');
}
}
作者:Mr-Robot
项目:TYPO3.CM
/**
* Gets instance of PageRenderer
*
* @return PageRenderer
*/
public function getPageRenderer()
{
if (!isset($this->pageRenderer)) {
$this->pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
$this->pageRenderer->setBackPath(TYPO3_mainDir);
}
return $this->pageRenderer;
}
作者:AOEpeopl
项目:scheduler_timelin
/**
* 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);
}
}
作者:sfsmf
项目:caretake
/**
* 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);
}
}
作者:sonorit
项目:lib_jquer
/**
* Insert javascript-tags for jQuery
*
* @param array $params
* @param \TYPO3\CMS\Core\Page\PageRenderer $pObj
* @return void
*/
public function renderPreProcess($params, $pObj)
{
// Get plugin-configuration
$conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_libjquery.']['settings.'];
// Generate script-tag for jquery if CDN is set
if (!empty($conf['cdn']) && array_key_exists($conf['cdn'], $this->jQueryCdnUrls)) {
// Set version-number for CDN
if (!(int) $conf['version'] || $conf['version'] === 'latest') {
$versionCdn = end($this->availableLocalJqueryVersions);
} else {
$versionCdn = VersionNumberUtility::convertVersionNumberToInteger($conf['version']);
}
// Set correct version-number for local version
if (!in_array($versionCdn, $this->availableLocalJqueryVersions)) {
$versionLocal = $this->getNearestVersion($versionCdn);
} else {
$versionLocal = $versionCdn;
}
$fallbackTag = '';
// Choose minified version if debug is disabled
$minPart = (int) $conf['debug'] ? '' : '.min';
// Deliver gzipped-version if compression is activated and client supports gzip (compression done with "gzip --best -k -S .gzip")
$gzipPart = (int) $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['compressionLevel'] ? '.gzip' : '';
// Set path and placeholders for local file
$this->jQueryCdnUrls['local'] = $conf['localPath'] . 'jquery-%1$s%2$s.js';
// Generate tags for local or CDN (and fallback)
if ($conf['cdn'] === 'local') {
// Get local version and replace placeholders
$file = sprintf($this->jQueryCdnUrls['local'], VersionNumberUtility::convertIntegerToVersionNumber($versionLocal), $minPart) . $gzipPart;
$file = str_replace(PATH_site, '', GeneralUtility::getFileAbsFileName($file));
} else {
// Get CDN and replace placeholders
$file = sprintf($this->jQueryCdnUrls[$conf['cdn']], VersionNumberUtility::convertIntegerToVersionNumber($versionCdn), $minPart);
// Generate fallback if required
if ((int) $conf['localFallback']) {
// Get local fallback version and replace placeholders
$fileFallback = sprintf($this->jQueryCdnUrls['local'], VersionNumberUtility::convertIntegerToVersionNumber($versionLocal), $minPart) . $gzipPart;
// Get absolute path to the fallback-file
$fileFallback = str_replace(PATH_site, '', GeneralUtility::getFileAbsFileName($fileFallback));
// Wrap it in some javascript code which will enable the fallback
$fallbackTag = '<script>window.jQuery || document.write(\'<script src="' . htmlspecialchars($fileFallback) . '" type="text/javascript"><\\/script>\')</script>' . LF;
}
}
$pObj->addJsLibrary('lib_jquery', $file, 'text/javascript', FALSE, TRUE, '|' . LF . $fallbackTag . '', TRUE);
}
}
作者:moodle
项目:site_bas
/**
* Render
*
* @param string $file
*/
public function render($file = NULL)
{
if ($this->isCached()) {
$this->pageRenderer->addCssFile($file, $this->arguments['rel'], $this->arguments['media'], $this->arguments['title'], $this->arguments['compress'], $this->arguments['forceOnTop'], $this->arguments['allWrap'], $this->arguments['excludeFromConcatenation']);
} else {
$GLOBALS['TSFE']->additionalHeaderData[md5($file)] = '<link rel="' . $this->arguments['rel'] . '" type="text/css" media="' . $this->arguments['media'] . '" href="' . $file . '" />';
}
}
作者:BergischMedi
项目:vid
/**
* Load RequireJS code.
*
* @return void
* @api
*/
public function render()
{
$content = $this->renderChildren();
$this->pageRenderer->addJsInlineCode('vidi-inline', $content);
$configuration['paths']['Fab/Vidi'] = '../typo3conf/ext/vidi/Resources/Public/JavaScript';
$this->pageRenderer->addRequireJsConfiguration($configuration);
$this->pageRenderer->loadRequireJsModule('Fab/Vidi/Vidi/Main');
}
作者:BergischMedi
项目:vid
/**
* Initialize every action.
*/
public function initializeAction()
{
$this->pageRenderer->addInlineLanguageLabelFile('EXT:vidi/Resources/Private/Language/locallang.xlf');
// Configure property mapping to retrieve the file object.
if ($this->arguments->hasArgument('columns')) {
/** @var \Fab\Vidi\TypeConverter\CsvToArrayConverter $typeConverter */
$typeConverter = $this->objectManager->get('Fab\\Vidi\\TypeConverter\\CsvToArrayConverter');
$propertyMappingConfiguration = $this->arguments->getArgument('columns')->getPropertyMappingConfiguration();
$propertyMappingConfiguration->setTypeConverter($typeConverter);
}
}
作者:svenhartman
项目:vantoma
/**
* Initializes the rendering action.
*
* Use this method to add all static assets.
*/
public function initializeAction()
{
if (!$this->cache->has('brushes')) {
return;
}
$themeCss = $this->resolveFilePathReference(sprintf(self::CSS_PATH . '/shCore%s.css', $this->settings['code_snippet']['theme']));
$this->pageRenderer->addCssFile($themeCss);
$coreJs = $this->resolveFilePathReference(self::JS_PATH . '/shCore.min.js');
$this->pageRenderer->addJsFooterLibrary('codesnippet_core', $coreJs);
$autoloaderJs = $this->resolveFilePathReference(self::JS_PATH . '/shAutoloader.min.js');
$this->pageRenderer->addJsFooterLibrary('codesnippet_autoloader', $autoloaderJs);
}
作者:BergischMedi
项目:vid
/**
* 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);
}
}
作者:khanhdeu
项目:typo3tes
/**
* Reads locallang file into array (for possible include in header)
*
* @return void
*/
protected function loadLocalization()
{
$wizardLabels = $GLOBALS['LANG']->includeLLFile('EXT:form/Resources/Private/Language/locallang_wizard.xlf', FALSE, TRUE);
$controllerLabels = $GLOBALS['LANG']->includeLLFile('EXT:form/Resources/Private/Language/locallang_controller.xlf', FALSE, TRUE);
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($controllerLabels, $wizardLabels);
$this->pageRenderer->addInlineLanguageLabelArray($controllerLabels['default']);
}
作者:rickymathe
项目:TYPO3.CM
/**
* Add the needed JavaScript files for all actions
*/
public function initializeAction()
{
$this->pageRenderer->addInlineLanguageLabelFile('EXT:extensionmanager/Resources/Private/Language/locallang.xlf');
if ($this->configurationUtility->getCurrentConfiguration('extensionmanager')['offlineMode']['value']) {
$this->settings['offlineMode'] = true;
}
}
作者:subugo
项目:substaf
/**
* action show
*
* @param \Subugoe\Substaff\Domain\Model\Group $group
*/
public function showAction(\Subugoe\Substaff\Domain\Model\Group $group)
{
$this->pageRenderer->setTitle($group->getTitle());
// group's name should be shown as title
$GLOBALS['TSFE']->page['title'] = $group->getTitle();
$people = $this->personRepository->findGroupMembers($group);
$projects = $this->projectRepository->findProjectsByGroups($group->getUid());
if ($group->getParentGroup() === null) {
$subGroups = $this->groupRepository->findByParentGroup($group->getUid());
$this->view->assign('subGroups', $subGroups);
}
if ($this->settings['groupDetailTeaser']) {
$this->view->assign('showTeaser', $this->settings['groupDetailTeaser'])->assign('teaserLength', $this->settings['groupDetailTeaserLength']);
}
$this->view->assign('group', $group)->assign('people', $people)->assign('projects', $projects);
}
作者:beyond-agentu
项目:ya
/**
* Add JS inline code
*
* @param string $name
* @param string $block
* @param boolean $compress
* @param boolean $forceOnTop
* @param string $position
*/
public function addJSInlineCode($name, $block, $compress = true, $forceOnTop = false, $position = 'footer')
{
if ($position === 'header') {
$this->pageRenderer->addJsInlineCode($name, $block, $compress, $forceOnTop);
} else {
$this->pageRenderer->addJsFooterInlineCode($name, $block, $compress, $forceOnTop);
}
}
作者:raimundlandi
项目:winkel.de-DE
/**
* @test
*/
public function absoluteUrlCanBeForced()
{
$mockTagBuilder = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array('dummy'));
$this->viewHelper->_set('arguments', array('property' => 'title'));
$this->viewHelper->_set('tag', $mockTagBuilder);
$this->viewHelper->initialize();
$this->viewHelper->render(TRUE, TRUE);
$this->assertEquals($this->pageRenderer->_get('metaTags'), array('<meta property="title" content="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . '" />'));
}
作者:khanhdeu
项目:typo3tes
/**
* This method loads the locallang.xml file (default language), and
* adds all keys found in it to the TYPO3.settings.extension_builder._LOCAL_LANG object
* translated into the current language
*
* Dots in a key are replaced by a _
*
* Example:
* error.name becomes TYPO3.settings.extension_builder._LOCAL_LANG.error_name
*
* @return void
*/
private function setLocallangSettings()
{
$LL = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile('EXT:extension_builder/Resources/Private/Language/locallang.xml', 'default');
if (!empty($LL['default']) && is_array($LL['default'])) {
foreach ($LL['default'] as $key => $value) {
$this->pageRenderer->addInlineSetting('extensionBuilder._LOCAL_LANG', str_replace('.', '_', $key), \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($key, 'extension_builder'));
}
}
}
作者:nicksergi
项目:TYPO3v4-Cor
/**
* Tests the addInlineLanguageLabelFile() method.
*
* @test
*/
public function areInlineLanguageLabelsSelectedAndStripped()
{
$this->fixture->setLanguage($GLOBALS['LANG']->lang);
$this->fixture->addInlineLanguageLabelFile('EXT:lang/locallang_core.xml', 'labels.', 'lock');
$out = $this->fixture->render();
$this->assertContains('edRecord', $out);
$this->assertContains('edRecord_content', $out);
$this->assertContains('edRecordUser', $out);
}