[TASK] Cleanup usage of getPageRenderer() 44/25844/2
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 1 Dec 2013 13:42:04 +0000 (14:42 +0100)
committerMarkus Klein <klein.t3@mfc-linz.at>
Tue, 17 Dec 2013 00:52:28 +0000 (01:52 +0100)
Change-Id: Id2dc49c9a5e5ca3ede14bc82218dd9ccdc7628ca
Resolves: #54123
Releases: 6.2
Reviewed-on: https://review.typo3.org/25844
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Xavier Perseguers
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/backend/Classes/Controller/LoginController.php
typo3/sysext/backend/Classes/Controller/PageTreeNavigationController.php
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/filelist/Classes/Controller/FileListController.php
typo3/sysext/frontend/Classes/ContentObject/FlowPlayerContentObject.php
typo3/sysext/frontend/Classes/ContentObject/ShockwaveFlashObjectContentObject.php
typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php
typo3/sysext/rtehtmlarea/Classes/Controller/FrontendRteController.php
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php

index c34a490..1bfb07a 100644 (file)
@@ -206,9 +206,11 @@ class LoginController {
                // Initialize template object:
                $GLOBALS['TBE_TEMPLATE']->bodyTagAdditions = ' onload="startUp();"';
                $GLOBALS['TBE_TEMPLATE']->moduleTemplate = $GLOBALS['TBE_TEMPLATE']->getHtmlTemplate('EXT:backend/Resources/Private/Templates/login.html');
-               $GLOBALS['TBE_TEMPLATE']->getPageRenderer()->loadExtJS();
-               $GLOBALS['TBE_TEMPLATE']->getPageRenderer()->loadPrototype();
-               $GLOBALS['TBE_TEMPLATE']->getPageRenderer()->loadScriptaculous();
+               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
+               $pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
+               $pageRenderer->loadExtJS();
+               $pageRenderer->loadPrototype();
+               $pageRenderer->loadScriptaculous();
                // Set JavaScript for creating a MD5 hash of the password:
                $GLOBALS['TBE_TEMPLATE']->JScode .= $this->getJScode();
                // Checking, if we should make a redirect.
index 034a5db..fef8449 100644 (file)
@@ -162,10 +162,12 @@ class PageTreeNavigationController {
                // Adding javascript code for AJAX (prototype), drag&drop and the pagetree as well as the click menu code
                $this->doc->getDragDropCode('pages');
                $this->doc->getContextMenuCode();
-               $this->doc->getPageRenderer()->loadScriptaculous('effects');
-               $this->doc->getPageRenderer()->loadExtJS();
+               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
+               $pageRenderer = $this->doc->getPageRenderer();
+               $pageRenderer->loadScriptaculous('effects');
+               $pageRenderer->loadExtJS();
                if ($this->hasFilterBox) {
-                       $this->doc->getPageRenderer()->addJsFile('sysext/backend/Resources/Public/JavaScript/pagetreefiltermenu.js');
+                       $pageRenderer->addJsFile('sysext/backend/Resources/Public/JavaScript/pagetreefiltermenu.js');
                }
                $this->doc->JScode .= $this->doc->wrapScriptTags(($this->currentSubScript ? 'top.currentSubScript=unescape("' . rawurlencode($this->currentSubScript) . '");' : '') . '
                // setting prefs for pagetree and drag & drop
index cffda6b..b3d68fb 100644 (file)
@@ -5531,7 +5531,7 @@ TBE_EDITOR.customEvalFunctions[\'' . $evalData . '\'] = function(value) {
                        $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/tceforms.js');
                        // If IRRE fields were processed, add the JavaScript functions:
                        if ($this->inline->inlineCount) {
-                               $GLOBALS['SOBE']->doc->getPageRenderer()->loadScriptaculous();
+                               $pageRenderer->loadScriptaculous();
                                $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js');
                                $out .= '
                                inline.setPrependFormFieldNames("' . $this->inline->prependNaming . '");
index c3fe596..0228042 100644 (file)
@@ -792,7 +792,7 @@ class DocumentTemplate {
                                $headerStart = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">';
                                $htmlTag = '<html>';
                                // Disable rendering of XHTML tags
-                               $this->getPageRenderer()->setRenderXhtml(FALSE);
+                               $this->pageRenderer->setRenderXhtml(FALSE);
                                break;
                        case 'xhtml_strict':
                                $headerStart = '<!DOCTYPE html
@@ -816,7 +816,7 @@ class DocumentTemplate {
                                $headerStart = '<!DOCTYPE html>' . LF;
                                $htmlTag = '<html>';
                                // Disable rendering of XHTML tags
-                               $this->getPageRenderer()->setRenderXhtml(FALSE);
+                               $this->pageRenderer->setRenderXhtml(FALSE);
                }
                $this->pageRenderer->setHtmlTag($htmlTag);
                // This loads the tabulator-in-textarea feature. It automatically modifies
index b4b429d..5485366 100644 (file)
@@ -371,8 +371,10 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                $lMarg = 1;
                $showHidden = $this->tt_contentConfig['showHidden'] ? '' : BackendUtility::BEenableFields('tt_content');
                $pageTitleParamForAltDoc = '&recTitle=' . rawurlencode(BackendUtility::getRecordTitle('pages', BackendUtility::getRecordWSOL('pages', $id), TRUE));
-               $GLOBALS['SOBE']->doc->getPageRenderer()->loadExtJs();
-               $GLOBALS['SOBE']->doc->getPageRenderer()->addJsFile($GLOBALS['BACK_PATH'] . 'sysext/cms/layout/js/typo3pageModule.js');
+               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
+               $pageRenderer = $GLOBALS['SOBE']->doc->getPageRenderer();
+               $pageRenderer->loadExtJs();
+               $pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . 'sysext/cms/layout/js/typo3pageModule.js');
                // Get labels for CTypes and tt_content element fields in general:
                $this->CType_labels = array();
                foreach ($GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'] as $val) {
index 06a6a40..f6e9dbf 100644 (file)
@@ -216,11 +216,13 @@ class FileListController {
                $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate('EXT:filelist/Resources/Private/Templates/file_list.html');
-               $this->doc->getPageRenderer()->loadPrototype();
-               $this->doc->getPageRenderer()->loadJQuery();
-               $this->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/DragUploader');
-               $this->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/FileListLocalisation');
-               $this->doc->getPageRenderer()->addInlineLanguagelabelFile(
+               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
+               $pageRenderer = $this->doc->getPageRenderer();
+               $pageRenderer->loadPrototype();
+               $pageRenderer->loadJQuery();
+               $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DragUploader');
+               $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/FileListLocalisation');
+               $pageRenderer->addInlineLanguagelabelFile(
                        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('lang') . 'locallang_core.xlf',
                        'file_upload'
                );
index 9d3b97b..d461dd9 100644 (file)
@@ -205,6 +205,8 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
         * @return string Output
         */
        public function render($conf = array()) {
+               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
+               $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
                $prefix = '';
                if ($GLOBALS['TSFE']->baseUrl) {
                        $prefix = $GLOBALS['TSFE']->baseUrl;
@@ -220,18 +222,18 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                $type = isset($conf['type.']) ? $this->cObj->stdWrap($conf['type'], $conf['type.']) : $conf['type'];
                $typeConf = $conf[$type . '.'];
                // Add Flowplayer js-file
-               $GLOBALS['TSFE']->getPageRenderer()->addJsFile(TYPO3_mainDir . 'contrib/flowplayer/flowplayer-3.2.12.min.js');
+               $pageRenderer->addJsFile(TYPO3_mainDir . 'contrib/flowplayer/flowplayer-3.2.12.min.js');
                // Add Flowpayer css for exprss install
-               $GLOBALS['TSFE']->getPageRenderer()->addCssFile(TYPO3_mainDir . 'contrib/flowplayer/express-install/express-install.css');
+               $pageRenderer->addCssFile(TYPO3_mainDir . 'contrib/flowplayer/express-install/express-install.css');
                // Add videoJS js-file
-               $GLOBALS['TSFE']->getPageRenderer()->addJsFile(TYPO3_mainDir . 'contrib/videojs/video-js/video.js');
+               $pageRenderer->addJsFile(TYPO3_mainDir . 'contrib/videojs/video-js/video.js');
                // Add videoJS js-file
-               $GLOBALS['TSFE']->getPageRenderer()->addJsFile(TYPO3_mainDir . 'contrib/videojs/video-js/video.js');
+               $pageRenderer->addJsFile(TYPO3_mainDir . 'contrib/videojs/video-js/video.js');
                // Add videoJS css-file
-               $GLOBALS['TSFE']->getPageRenderer()->addCssFile(TYPO3_mainDir . 'contrib/videojs/video-js/video-js.css');
+               $pageRenderer->addCssFile(TYPO3_mainDir . 'contrib/videojs/video-js/video-js.css');
                // Add extended videoJS control bar
-               $GLOBALS['TSFE']->getPageRenderer()->addJsFile(TYPO3_mainDir . 'contrib/videojs/video-js/controls/control-bar.js');
-               $GLOBALS['TSFE']->getPageRenderer()->addCssFile(TYPO3_mainDir . 'contrib/videojs/video-js/controls/control-bar.css');
+               $pageRenderer->addJsFile(TYPO3_mainDir . 'contrib/videojs/video-js/controls/control-bar.js');
+               $pageRenderer->addCssFile(TYPO3_mainDir . 'contrib/videojs/video-js/controls/control-bar.css');
                // Build Flash configuration
                $player = isset($typeConf['player.']) ? $this->cObj->stdWrap($typeConf['player'], $typeConf['player.']) : $typeConf['player'];
                if (!$player) {
@@ -346,7 +348,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                        // Assemble captions track tag
                        $videoCaptions = '<track id="' . $replaceElementIdString . '_captions_track" kind="captions" src="' . $conf['caption'] . '"></track>' . LF;
                        // Add videoJS extension for captions
-                       $GLOBALS['TSFE']->getPageRenderer()->addJsFile(TYPO3_mainDir . 'contrib/videojs/video-js/controls/captions.js');
+                       $pageRenderer->addJsFile(TYPO3_mainDir . 'contrib/videojs/video-js/controls/captions.js');
                        // Flowplayer captions
                        $conf['videoflashvars']['captionUrl'] = $conf['caption'];
                        // Flowplayer captions plugin configuration
@@ -360,7 +362,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                if ($conf['type'] == 'video') {
                        if (is_array($conf['audioSources']) && count($conf['audioSources'])) {
                                // Add videoJS audio description toggle
-                               $GLOBALS['TSFE']->getPageRenderer()->addJsFile(TYPO3_mainDir . 'contrib/videojs/video-js/controls/audio-description.js');
+                               $pageRenderer->addJsFile(TYPO3_mainDir . 'contrib/videojs/video-js/controls/audio-description.js');
                        }
                        if (isset($conf['audioFallback'])) {
                                // Audio description flowplayer config (remove controls)
@@ -707,7 +709,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                if ($jsInlineCode) {
                        $jsInlineCode = 'VideoJS.DOMReady(function(){' . $jsInlineCode . LF . '});';
                }
-               $GLOBALS['TSFE']->getPageRenderer()->addJsInlineCode($replaceElementIdString, $jsInlineCode);
+               $pageRenderer->addJsInlineCode($replaceElementIdString, $jsInlineCode);
                if (isset($conf['stdWrap.'])) {
                        $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
                }
index dab7330..d712200 100644 (file)
@@ -51,8 +51,11 @@ class ShockwaveFlashObjectContentObject extends \TYPO3\CMS\Frontend\ContentObjec
                }
                $type = isset($conf['type.']) ? $this->cObj->stdWrap($conf['type'], $conf['type.']) : $conf['type'];
                $typeConf = $conf[$type . '.'];
+               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
+               $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
+
                // Add SWFobject js-file
-               $GLOBALS['TSFE']->getPageRenderer()->addJsFile(TYPO3_mainDir . 'contrib/flashmedia/swfobject/swfobject.js');
+               $pageRenderer->addJsFile(TYPO3_mainDir . 'contrib/flashmedia/swfobject/swfobject.js');
                $player = isset($typeConf['player.']) ? $this->cObj->stdWrap($typeConf['player'], $typeConf['player.']) : $typeConf['player'];
                $installUrl = isset($conf['installUrl.']) ? $this->cObj->stdWrap($conf['installUrl'], $conf['installUrl.']) : $conf['installUrl'];
                if (!$installUrl) {
@@ -127,7 +130,7 @@ class ShockwaveFlashObjectContentObject extends \TYPO3\CMS\Frontend\ContentObjec
                $embed = 'swfobject.embedSWF("' . $conf['player'] . '", "' . $replaceElementIdString . '", "' . $width . '", "' . $height . '",
                                "' . $flashVersion . '", "' . $installUrl . '", ' . $conf['embedParams'] . ');';
                $script = $flashvars . $params . $attributes . $embed;
-               $GLOBALS['TSFE']->getPageRenderer()->addJsInlineCode($replaceElementIdString, $script);
+               $pageRenderer->addJsInlineCode($replaceElementIdString, $script);
                if (isset($conf['stdWrap.'])) {
                        $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
                }
index 8ac2431..e6ff4e6 100644 (file)
@@ -191,7 +191,6 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
                $GLOBALS['BE_USER']->pushModuleData('web_info', $this->pObj->MOD_SETTINGS);
                $this->initialize();
 
-               $this->pageRenderer = $this->doc->getPageRenderer();
                // Localization
                $this->pageRenderer->addInlineLanguageLabelFile(
                        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('linkvalidator', 'Resources/Private/Language/Module/locallang.xlf')
@@ -296,6 +295,7 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
                $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('linkvalidator') . 'Resources/Private/Templates/mod_template.html');
                $this->relativePath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('linkvalidator');
                $this->pageRecord = BackendUtility::readPageAccess($this->pObj->id, $GLOBALS['BE_USER']->getPagePermsClause(1));
+               $this->pageRenderer = $this->doc->getPageRenderer();
                $this->isAccessibleForCurrentUser = FALSE;
                if ($this->pObj->id && is_array($this->pageRecord) || !$this->pObj->id && $this->isCurrentUserAdmin()) {
                        $this->isAccessibleForCurrentUser = TRUE;
@@ -637,7 +637,7 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
         */
        protected function loadHeaderData() {
                $this->doc->addStyleSheet('linkvalidator', $this->relativePath . 'Resources/Public/Css/linkvalidator.css', 'linkvalidator');
-               $this->doc->getPageRenderer()->addJsFile($this->doc->backPath . 'js/extjs/ux/Ext.ux.FitToParent.js');
+               $this->pageRenderer->addJsFile($this->doc->backPath . 'js/extjs/ux/Ext.ux.FitToParent.js');
        }
 
        /**
index ef99566..c9e7163 100644 (file)
@@ -243,7 +243,7 @@ class FrontendRteController extends \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaBase {
                 * LOAD JS, CSS and more
                 * =======================================
                 */
-               $this->pageRenderer = $this->getPageRenderer();
+               $this->getPageRenderer();
                // Preloading the pageStyle and including RTE skin stylesheets
                $this->addPageStyle();
                $this->addSkin();
index b1c8be3..99b2f61 100644 (file)
@@ -72,6 +72,11 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
        protected $scheduler;
 
        /**
+        * @var \TYPO3\CMS\Core\Page\PageRenderer
+        */
+       protected $pageRenderer;
+
+       /**
         * Constructor
         *
         * @return \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController
@@ -92,7 +97,8 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                // Initialize document
                $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
                $this->doc->setModuleTemplate(ExtensionManagementUtility::extPath('scheduler') . 'mod1/mod_template.html');
-               $this->doc->getPageRenderer()->addCssFile(ExtensionManagementUtility::extRelPath('scheduler') . 'res/tx_scheduler_be.css');
+               $this->pageRenderer = $this->doc->getPageRenderer();
+               $this->pageRenderer->addCssFile(ExtensionManagementUtility::extRelPath('scheduler') . 'res/tx_scheduler_be.css');
                $this->doc->backPath = $this->backPath;
                $this->doc->bodyTagId = 'typo3-mod-php';
                $this->doc->bodyTagAdditions = 'class="tx_scheduler_mod1"';
@@ -136,7 +142,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                                        }
                                </script>
                        ';
-                       $this->doc->getPageRenderer()->addInlineSetting('scheduler', 'runningIcon', ExtensionManagementUtility::extRelPath('scheduler') . 'res/gfx/status_running.png');
+                       $this->pageRenderer->addInlineSetting('scheduler', 'runningIcon', ExtensionManagementUtility::extRelPath('scheduler') . 'res/gfx/status_running.png');
                        // Prepare main content
                        $this->content = $this->doc->header($GLOBALS['LANG']->getLL('function.' . $this->MOD_SETTINGS['function']));
                        $this->content .= $this->getModuleContent();
@@ -644,19 +650,17 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                        }
                }
                // Load necessary JavaScript
-               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
-               $pageRenderer = $this->doc->getPageRenderer();
-               $pageRenderer->loadExtJS();
-               $pageRenderer->addJsFile(ExtensionManagementUtility::extRelPath('scheduler') . 'res/tx_scheduler_be.js');
-               $pageRenderer->addJsFile($this->backPath . 'sysext/backend/Resources/Public/JavaScript/tceforms.js');
-               $pageRenderer->addJsFile($this->backPath . 'js/extjs/ux/Ext.ux.DateTimePicker.js');
+               $this->pageRenderer->loadExtJS();
+               $this->pageRenderer->addJsFile(ExtensionManagementUtility::extRelPath('scheduler') . 'res/tx_scheduler_be.js');
+               $this->pageRenderer->addJsFile($this->backPath . 'sysext/backend/Resources/Public/JavaScript/tceforms.js');
+               $this->pageRenderer->addJsFile($this->backPath . 'js/extjs/ux/Ext.ux.DateTimePicker.js');
                // Define settings for Date Picker
                $typo3Settings = array(
                        'datePickerUSmode' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? 1 : 0,
                        'dateFormat' => array('j-n-Y', 'G:i j-n-Y'),
                        'dateFormatUS' => array('n-j-Y', 'G:i n-j-Y')
                );
-               $pageRenderer->addInlineSettingArray('', $typo3Settings);
+               $this->pageRenderer->addInlineSettingArray('', $typo3Settings);
                // Define table layout for add/edit form
                $tableLayout = array(
                        'table' => array('<table border="0" cellspacing="0" cellpadding="0" id="edit_form" class="typo3-usersettings">', '</table>')
@@ -924,10 +928,8 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                        $content .= $flashMessage->render();
                } else {
                        // Load ExtJS framework and specific JS library
-                       /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
-                       $pageRenderer = $this->doc->getPageRenderer();
-                       $pageRenderer->loadExtJS();
-                       $pageRenderer->addJsFile(ExtensionManagementUtility::extRelPath('scheduler') . 'res/tx_scheduler_be.js');
+                       $this->pageRenderer->loadExtJS();
+                       $this->pageRenderer->addJsFile(ExtensionManagementUtility::extRelPath('scheduler') . 'res/tx_scheduler_be.js');
                        // Initialise table layout
                        $tableLayout = array(
                                'table' => array(