Fixed bug #11985: Optimize disposal of t3lib_PageRenderer
authorOliver Hader <oliver.hader@typo3.org>
Thu, 17 Sep 2009 17:59:16 +0000 (17:59 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Thu, 17 Sep 2009 17:59:16 +0000 (17:59 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5955 709f56b5-9817-0410-a4d7-c38de5d9e867

20 files changed:
ChangeLog
t3lib/class.t3lib_pagerenderer.php
t3lib/class.t3lib_tceforms.php
tests/t3lib/t3lib_pagerenderer_testcase.php
typo3/alt_db_navframe.php
typo3/alt_doc.php
typo3/backend.php
typo3/class.browse_links.php
typo3/file_list.php
typo3/mod/web/perm/index.php
typo3/sysext/cms/tslib/class.tslib_content.php
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/cms/tslib/class.tslib_pagegen.php
typo3/sysext/recycler/mod1/index.php
typo3/sysext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php
typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php
typo3/sysext/scheduler/mod1/index.php
typo3/sysext/t3editor/class.tx_t3editor.php
typo3/sysext/taskcenter/task/index.php
typo3/template.php

index cb97a11..1903778 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
 2009-09-17  Oliver Hader  <oliver@typo3.org>
 
        * Cleanup: Set SVN properties
+       * Fixed bug #11985: Optimize disposal of t3lib_PageRenderer (thanks to Steffen Kamper)
 
 2009-09-17  Sebastian Kurfuerst  <sebastian@typo3.org>
 
index e879319..461c141 100644 (file)
@@ -34,7 +34,7 @@
  * @subpackage t3lib
  * $Id$
  */
-abstract class t3lib_PageRenderer implements t3lib_Singleton {
+class t3lib_PageRenderer implements t3lib_Singleton {
        
        protected $compressJavascript = FALSE;
        protected $compressCss = FALSE;
index 08d3ad7..62bb2b4 100644 (file)
@@ -5244,8 +5244,10 @@ class t3lib_TCEforms     {
                                $this->loadJavascriptLib('md5.js');
                        }
 
-                       $GLOBALS['SOBE']->doc->loadPrototype();
-                       $GLOBALS['SOBE']->doc->loadExtJS();
+                       /** @var $pageRenderer t3lib_PageRenderer */
+                       $pageRenderer = $GLOBALS['SOBE']->doc->getPageRenderer();
+                       $pageRenderer->loadPrototype();
+                       $pageRenderer->loadExtJS();
 
                                // make textareas resizable and flexible
                        if (!($GLOBALS['BE_USER']->uc['resizeTextareas'] == '0' && $GLOBALS['BE_USER']->uc['resizeTextareas_Flexible'] == '0')) {
@@ -5257,7 +5259,7 @@ class t3lib_TCEforms      {
                                'textareaFlexible' => (!$GLOBALS['BE_USER']->uc['resizeTextareas_Flexible'] == '0'),
                                'textareaResize' => (!$GLOBALS['BE_USER']->uc['resizeTextareas'] == '0'),
                        );
-                       $GLOBALS['SOBE']->doc->addInlineSettingArray('', $resizableSettings);
+                       $pageRenderer->addInlineSettingArray('', $resizableSettings);
 
                        $this->loadJavascriptLib('../t3lib/jsfunc.evalfield.js');
 
@@ -5270,7 +5272,7 @@ class t3lib_TCEforms      {
                                'dateFormat'       => array('j-n-Y', 'G:i j-n-Y'),
                                'dateFormatUS'     => array('n-j-Y', 'G:i n-j-Y'),
                        );
-                       $GLOBALS['SOBE']->doc->addInlineSettingArray('', $typo3Settings);
+                       $pageRenderer->addInlineSettingArray('', $typo3Settings);
 
                        $this->loadJavascriptLib('../t3lib/js/extjs/tceforms.js');
 
@@ -5286,7 +5288,7 @@ class t3lib_TCEforms      {
 
                                // if Suggest fields were processed, add the JS functions
                        if ($this->suggest->suggestCount > 0) {
-                               $GLOBALS['SOBE']->doc->loadScriptaculous();
+                               $pageRenderer->loadScriptaculous();
                                $this->loadJavascriptLib('../t3lib/js/jsfunc.tceforms_suggest.js');
                        }
 
index 4a75c59..82b7f7a 100644 (file)
@@ -24,7 +24,7 @@
 
 
 /**
- * Testcase for the t3lib_pageIncludes class in the TYPO3 core.
+ * Testcase for the t3lib_PageRenderer class in the TYPO3 core.
  *
  * @package TYPO3
  * @subpackage t3lib
  */
 class t3lib_PageRenderer_testcase extends tx_phpunit_testcase {
        /**
-        * @var t3lib_pageIncludes
+        * @var t3lib_PageRenderer
         */
        private $fixture;
 
-       const PART_COMPLETE = 0;
-       const PART_HEADER = 1;
-       const PART_FOOTER = 2;
-
        public function setUp() {
-               $className = 't3lib_PageRenderer_' . uniqid('test');
-               eval('
-                       class ' . $className . ' extends t3lib_PageRenderer {
-                       }
-               ');
-               $this->fixture = new $className();
+               $this->fixture = new t3lib_PageRenderer();
        }
 
        public function tearDown() {
@@ -216,7 +207,7 @@ class t3lib_PageRenderer_testcase extends tx_phpunit_testcase {
                
                $expectedReturnValue = '<tag method="private" name="test" />';
                $this->fixture->addFooterData('<tag method="private" name="test" />');
-               $out = $this->fixture->render(self::PART_FOOTER);
+               $out = $this->fixture->render(t3lib_PageRenderer::PART_FOOTER);
 
                $this->assertContains(
                        $expectedReturnValue,
@@ -249,7 +240,7 @@ class t3lib_PageRenderer_testcase extends tx_phpunit_testcase {
                
                $expectedReturnValue = '<script src="fileadmin/test.js" type="text/javascript"></script>';
                $this->fixture->addJsFooterLibrary('test', 'fileadmin/test.js');
-               $out = $this->fixture->render(self::PART_FOOTER);
+               $out = $this->fixture->render(t3lib_PageRenderer::PART_FOOTER);
 
                $this->assertContains(
                        $expectedReturnValue,
@@ -281,7 +272,7 @@ class t3lib_PageRenderer_testcase extends tx_phpunit_testcase {
                
                $expectedReturnValue = '<script src="fileadmin/test.js" type="text/javascript"></script>';
                $this->fixture->addJsFooterFile('fileadmin/test.js');
-               $out = $this->fixture->render(self::PART_FOOTER);
+               $out = $this->fixture->render(t3lib_PageRenderer::PART_FOOTER);
 
                $this->assertContains(
                        $expectedReturnValue,
@@ -313,7 +304,7 @@ class t3lib_PageRenderer_testcase extends tx_phpunit_testcase {
                
                $expectedReturnValue = 'var x = "testvar"';
                $this->fixture->addJsFooterInlineCode('test', 'var x = "testvar"');
-               $out = $this->fixture->render(self::PART_FOOTER);
+               $out = $this->fixture->render(t3lib_PageRenderer::PART_FOOTER);
 
                $this->assertContains(
                        $expectedReturnValue,
@@ -502,7 +493,7 @@ class t3lib_PageRenderer_testcase extends tx_phpunit_testcase {
                $this->fixture->loadExtJS();
                $this->fixture->addInlineLanguageLabel('myKey', 'myValue');
                $out = $this->fixture->enableMoveJsFromHeaderToFooter();
-               $out = $this->fixture->render(self::PART_FOOTER);
+               $out = $this->fixture->render(t3lib_PageRenderer::PART_FOOTER);
 
                $this->assertContains(
                        $expectedReturnValue,
@@ -520,7 +511,7 @@ class t3lib_PageRenderer_testcase extends tx_phpunit_testcase {
                $this->fixture->loadExtJS();
                $this->fixture->addInlineLanguageLabelArray(array('myKey1' => 'myValue1', 'myKey2' => 'myValue2',));
                $out = $this->fixture->enableMoveJsFromHeaderToFooter();
-               $out = $this->fixture->render(self::PART_FOOTER);
+               $out = $this->fixture->render(t3lib_PageRenderer::PART_FOOTER);
 
                $this->assertContains(
                        $expectedReturnValue,
@@ -539,7 +530,7 @@ class t3lib_PageRenderer_testcase extends tx_phpunit_testcase {
                $this->fixture->addInlineLanguageLabelArray(array('myKey1' => 'myValue1',));
                $this->fixture->addInlineLanguageLabelArray(array('myKey2' => 'myValue2',));
                $out = $this->fixture->enableMoveJsFromHeaderToFooter();
-               $out = $this->fixture->render(self::PART_FOOTER);
+               $out = $this->fixture->render(t3lib_PageRenderer::PART_FOOTER);
 
                $this->assertContains(
                        $expectedReturnValue,
@@ -557,7 +548,7 @@ class t3lib_PageRenderer_testcase extends tx_phpunit_testcase {
                $this->fixture->loadExtJS();
                $this->fixture->addInlineSetting('myApp', 'myKey', 'myValue');
                $out = $this->fixture->enableMoveJsFromHeaderToFooter();
-               $out = $this->fixture->render(self::PART_FOOTER);
+               $out = $this->fixture->render(t3lib_PageRenderer::PART_FOOTER);
 
                $this->assertContains(
                        $expectedReturnValue,
@@ -575,7 +566,7 @@ class t3lib_PageRenderer_testcase extends tx_phpunit_testcase {
                $this->fixture->loadExtJS();
                $this->fixture->addInlineSettingArray('myApp', array('myKey1' => 'myValue1', 'myKey2' => 'myValue2',));
                $out = $this->fixture->enableMoveJsFromHeaderToFooter();
-               $out = $this->fixture->render(self::PART_FOOTER);
+               $out = $this->fixture->render(t3lib_PageRenderer::PART_FOOTER);
 
                $this->assertContains(
                        $expectedReturnValue,
@@ -594,7 +585,7 @@ class t3lib_PageRenderer_testcase extends tx_phpunit_testcase {
                $this->fixture->addInlineSettingArray('myApp', array('myKey1' => 'myValue1',));
                $this->fixture->addInlineSettingArray('myApp', array('myKey2' => 'myValue2',));
                $out = $this->fixture->enableMoveJsFromHeaderToFooter();
-               $out = $this->fixture->render(self::PART_FOOTER);
+               $out = $this->fixture->render(t3lib_PageRenderer::PART_FOOTER);
 
                $this->assertContains(
                        $expectedReturnValue,
index 2756b39..358f9c1 100644 (file)
@@ -157,7 +157,7 @@ class SC_alt_db_navframe {
                        // 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->loadScriptaculous('effects');
+               $this->doc->getPageRenderer()->loadScriptaculous('effects');
 
                $this->doc->JScode .= $this->doc->wrapScriptTags(
                ($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
index 69d55bb..b06eba5 100644 (file)
@@ -446,7 +446,7 @@ class SC_alt_doc {
                $this->doc->setModuleTemplate('templates/alt_doc.html');
                $this->doc->form = '<form action="'.htmlspecialchars($this->R_URI).'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="document.editform._scrollPosition.value=(document.documentElement.scrollTop || document.body.scrollTop); return TBE_EDITOR.checkSubmit(1);">';
 
-               $this->doc->loadPrototype();
+               $this->doc->getPageRenderer()->loadPrototype();
                $this->doc->JScode = $this->doc->wrapScriptTags('
                        function jumpToUrl(URL,formEl)  {       //
                                if (!TBE_EDITOR.isFormChanged())        {
index 23bbab8..c8cbf00 100644 (file)
@@ -205,8 +205,10 @@ class TYPO3backend {
                 * now put the complete backend document together
                 ******************************************************/
 
-               $GLOBALS['TBE_TEMPLATE']->loadScriptaculous('builder,effects,controls,dragdrop');
-               $GLOBALS['TBE_TEMPLATE']->loadExtJS();
+               /** @var $pageRenderer t3lib_PageRenderer */
+               $pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
+               $pageRenderer->loadScriptaculous('builder,effects,controls,dragdrop');
+               $pageRenderer->loadExtJS();
                
                        // remove duplicate entries
                $this->jsFiles = array_unique($this->jsFiles);
index 721184b..5fae15e 100644 (file)
@@ -772,7 +772,7 @@ class browse_links {
                $this->doc = t3lib_div::makeInstance('template');
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                        // Load the Prototype library and browse_links.js
-               $this->doc->loadPrototype();
+               $this->doc->getPageRenderer()->loadPrototype();
                $this->doc->loadJavascriptLib('js/browse_links.js');
 
                        // init hook objects:
index 5175842..cd4ebe0 100644 (file)
@@ -165,7 +165,7 @@ class SC_file_list {
                $this->doc = t3lib_div::makeInstance('template');
                $this->doc->backPath = $BACK_PATH;
                $this->doc->setModuleTemplate('templates/file_list.html');
-               $this->doc->loadPrototype();
+               $this->doc->getPageRenderer()->loadPrototype();
 
                        // Validating the input "id" (the path, directory!) and checking it against the mounts of the user.
                $this->id = $this->basicFF->is_directory($this->id);
index 5a06961..e60a559 100755 (executable)
@@ -215,7 +215,7 @@ class SC_mod_web_perm_index {
                $this->doc->setModuleTemplate('templates/perm.html');
                $this->doc->form = '<form action="'.$GLOBALS['BACK_PATH'].'tce_db.php" method="post" name="editform">';
                $this->doc->loadJavascriptLib('../t3lib/jsfunc.updateform.js');
-               $this->doc->loadPrototype();
+               $this->doc->getPageRenderer()->loadPrototype();
                $this->doc->loadJavascriptLib(TYPO3_MOD_PATH . 'perm.js');
 
                        // Setting up the context sensitive menu:
index 3aa7ee8..30dfb2c 100644 (file)
@@ -2818,7 +2818,7 @@ class tslib_cObj {
                $typeConf = $conf[$conf['type'] . '.'];
 
                        //add SWFobject js-file
-               $GLOBALS['TSFE']->addJsFile('typo3/contrib/flashmedia/swfobject/swfobject.js');
+               $GLOBALS['TSFE']->getPageRenderer()->addJsFile('typo3/contrib/flashmedia/swfobject/swfobject.js');
                
                $player = $this->stdWrap($conf[$conf['type'] . '.']['player'], $conf[$conf['type'] . '.']['player.']);
                $installUrl = $conf['installUrl'] ? $conf['installUrl'] : $prefix . 'typo3/contrib/flashmedia/swfobject/expressInstall.swf';
@@ -2926,7 +2926,7 @@ class tslib_cObj {
                $typeConf = $conf[$conf['type'] . '.'];
 
                        //add QTobject js-file
-               $GLOBALS['TSFE']->addJsFile('typo3/contrib/flashmedia/qtobject/qtobject.js');
+               $GLOBALS['TSFE']->getPageRenderer()->addJsFile('typo3/contrib/flashmedia/qtobject/qtobject.js');
                $replaceElementIdString = uniqid('mmqt');
                $GLOBALS['TSFE']->register['MMQTID'] = $replaceElementIdString;
                $qtObject = 'QTObject' . $replaceElementIdString;
index 6531932..0cdd5ee 100644 (file)
  * @package TYPO3
  * @subpackage tslib
  */
- class tslib_fe extends t3lib_PageRenderer {
+ class tslib_fe {
 
                // CURRENT PAGE:
        var $id='';                                                     // The page id (int)
        var $pages_lockObj;                                     // Locking object for accessing "cache_pages"
 
        /**
+        * @var t3lib_PageRenderer
+        */
+       protected $pageRenderer;
+
+       /**
         * the page cache object, use this to save pages to the cache and to
         * retrieve them again
         *
                }
 
                $this->initCaches();
-               parent::__construct(PATH_tslib . 'templates/tslib_page_frontend.html');
        }
 
        /**
                }
        }
 
-
+       /**
+        * Gets instance of PageRenderer
+        * 
+        * @return      t3lib_PageRenderer
+        */
+       public function getPageRenderer() {
+               if (!isset($this->pageRenderer)) {
+                       $this->pageRenderer = t3lib_div::makeInstance('t3lib_PageRenderer');
+                       $this->pageRenderer->setTemplateFile(PATH_tslib . 'templates/tslib_page_frontend.html');
+               }
+               return $this->pageRenderer;
+       }
 
 
 
index c604658..f471af6 100644 (file)
@@ -338,23 +338,26 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
         * @return      void
         */
        public static function renderContentWithHeader($pageContent) {
+                       // get instance of t3lib_PageRenderer
+               /** @var $pageRenderer t3lib_PageRenderer */
+               $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
                
-               $GLOBALS['TSFE']->backPath = 'typo3/';
+               $pageRenderer->backPath = 'typo3/';
                
                if ($GLOBALS['TSFE']->config['config']['moveJsFromHeaderToFooter']) {
-                       $GLOBALS['TSFE']->enableMoveJsFromHeaderToFooter();
+                       $pageRenderer->enableMoveJsFromHeaderToFooter();
                }
 
                if ($GLOBALS['TSFE']->config['config']['pageRenderTemplateFile']) {
                        $file = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->config['config']['pageRenderTemplateFile']);
                        if ($file) {
-                               $GLOBALS['TSFE']->setTemplateFile($file);
+                               $pageRenderer->setTemplateFile($file);
                        }
                }
 
                $customContent = $GLOBALS['TSFE']->config['config']['headerComment'];
                if (trim($customContent)) {
-                       $GLOBALS['TSFE']->addInlineComment($customContent);
+                       $pageRenderer->addInlineComment($customContent);
                }
 
                        // Setting charset:
@@ -449,7 +452,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
 
                        // Adding doctype parts:
                if (count($docTypeParts)) {
-                       $GLOBALS['TSFE']->setXmlPrologAndDocType(implode(chr(10), $docTypeParts));
+                       $pageRenderer->setXmlPrologAndDocType(implode(chr(10), $docTypeParts));
                }
 
                        // Begin header section:
@@ -458,16 +461,16 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                } else {
                        $_attr = '';
                }
-               $GLOBALS['TSFE']->setHtmlTag('<html' . ($_attr ? ' ' . $_attr : '') . '>');
+               $pageRenderer->setHtmlTag('<html' . ($_attr ? ' ' . $_attr : '') . '>');
 
                        // Head tag:
                $headTag = $GLOBALS['TSFE']->pSetup['headTag'] ? $GLOBALS['TSFE']->pSetup['headTag'] : '<head>';
-               $GLOBALS['TSFE']->setHeadTag($headTag);
+               $pageRenderer->setHeadTag($headTag);
 
                        // Setting charset meta tag:
-               $GLOBALS['TSFE']->setCharSet($theCharset);
+               $pageRenderer->setCharSet($theCharset);
 
-               $GLOBALS['TSFE']->addInlineComment('
+               $pageRenderer->addInlineComment('
        This website is powered by TYPO3 - inspiring people to share!
        TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.
        TYPO3 is copyright 1998-2009 of Kasper Skaarhoj. Extensions are copyright of their respective owners.
@@ -475,7 +478,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
 ');
 
                if ($GLOBALS['TSFE']->baseUrl) {
-                       $GLOBALS['TSFE']->setBaseUrl($GLOBALS['TSFE']->baseUrl);
+                       $pageRenderer->setBaseUrl($GLOBALS['TSFE']->baseUrl);
                }
 
                if ($GLOBALS['TSFE']->pSetup['shortcutIcon']) {
@@ -485,10 +488,10 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                                if (($finfo = @finfo_open(FILEINFO_MIME))) {
                                        $iconMimeType = ' type="' . finfo_file($finfo, $favIcon) . '"';
                                        finfo_close($finfo);
-                                       $GLOBALS['TSFE']->setIconMimeType($iconMimeType);
+                                       $pageRenderer->setIconMimeType($iconMimeType);
                                }
                        }
-                       $GLOBALS['TSFE']->setFavIcon($favIcon);
+                       $pageRenderer->setFavIcon($favIcon);
                
                }
 
@@ -502,9 +505,9 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                        }
                        if (count($temp_styleLines)) {
                                if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {
-                                       $GLOBALS['TSFE']->addCssFile(TSpagegen::inline2TempFile(implode(chr(10), $temp_styleLines), 'css'));
+                                       $pageRenderer->addCssFile(TSpagegen::inline2TempFile(implode(chr(10), $temp_styleLines), 'css'));
                                } else {
-                                       $GLOBALS['TSFE']->addCssInlineBlock('TSFEinlineStyle', implode(chr(10), $temp_styleLines));
+                                       $pageRenderer->addCssInlineBlock('TSFEinlineStyle', implode(chr(10), $temp_styleLines));
                                }
                        }
                }
@@ -512,7 +515,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                if ($GLOBALS['TSFE']->pSetup['stylesheet']) {
                        $ss = $GLOBALS['TSFE']->tmpl->getFileName($GLOBALS['TSFE']->pSetup['stylesheet']);
                        if ($ss) {
-                               $GLOBALS['TSFE']->addCssFile($ss);
+                               $pageRenderer->addCssFile($ss);
                        }
                }
 
@@ -532,7 +535,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                                                        if (! $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['external'] && substr($ss, 0, 1) != '/') { // To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)
                                                                $ss = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')) . '/' . $ss;
                                                        }
-                                                       $GLOBALS['TSFE']->addCssInlineBlock(
+                                                       $pageRenderer->addCssInlineBlock(
                                                                'import_' . $key, 
                                                                '@import url("' . htmlspecialchars($ss) . '") ' . htmlspecialchars($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['media']) . ';', 
                                                                $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['compressed'] ? TRUE : FALSE, 
@@ -540,7 +543,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                                                                ''
                                                        );
                                                } else {
-                                                       $GLOBALS['TSFE']->addCssFile(
+                                                       $pageRenderer->addCssFile(
                                                                htmlspecialchars($ss), 
                                                                $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['alternate'] ? 'alternate stylesheet' : 'stylesheet',
                                                                $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['media'] ? $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['media'] : 'screen', 
@@ -631,37 +634,37 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
 
                if (trim($style)) {
                        if ($GLOBALS['TSFE']->config['config']['inlineStyle2TempFile']) {
-                               $GLOBALS['TSFE']->addCssFile(TSpagegen::inline2TempFile($style, 'css'));
+                               $pageRenderer->addCssFile(TSpagegen::inline2TempFile($style, 'css'));
                        } else {
-                               $GLOBALS['TSFE']->addCssInlineBlock('additionalTSFEInlineStyle', $style);
+                               $pageRenderer->addCssInlineBlock('additionalTSFEInlineStyle', $style);
                        }
                }
 
                        // Javascript Libraries
                if (is_array($GLOBALS['TSFE']->pSetup['javascriptLibs.'])) {
                        if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['Prototype']) {
-                               $GLOBALS['TSFE']->loadPrototype();
+                               $pageRenderer->loadPrototype();
                        }
                        if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous']) {
                                $modules = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous.']['modules'] ? $GLOBALS['TSFE']->pSetup['javascriptLibs.']['Scriptaculous.']['modules'] : '';
-                               $GLOBALS['TSFE']->loadScriptaculous($modules);
+                               $pageRenderer->loadScriptaculous($modules);
                        }
                        if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtCore']) {
-                               $GLOBALS['TSFE']->loadExtCore();
+                               $pageRenderer->loadExtCore();
                                if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtCore.']['debug']) {
-                                       $GLOBALS['TSFE']->enableExtCoreDebug();
+                                       $pageRenderer->enableExtCoreDebug();
                                }
                        }
                        if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs']) {
                                $css = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['css'] ? TRUE : FALSE;
                                $theme = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['theme'] ? TRUE : FALSE;
                                $adapter = $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['adapter'] ? $GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['adapter'] : '';
-                               $GLOBALS['TSFE']->loadExtJs($css, $theme, $adapter);
+                               $pageRenderer->loadExtJs($css, $theme, $adapter);
                                if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['debug']) {
-                                       $GLOBALS['TSFE']->enableExtJsDebug();
+                                       $pageRenderer->enableExtJsDebug();
                                }
                                if ($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.']['quickTips']) {
-                                       $GLOBALS['TSFE']->enableExtJSQuickTips();
+                                       $pageRenderer->enableExtJSQuickTips();
                                }
                        }
                }
@@ -675,7 +678,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                                        if (! $type) {
                                                $type = 'text/javascript';
                                        }
-                                       $GLOBALS['TSFE']->addJsLibrary(
+                                       $pageRenderer->addJsLibrary(
                                                htmlspecialchars($key), 
                                                htmlspecialchars($GLOBALS['TSFE']->absRefPrefix . $ss), 
                                                htmlspecialchars($type), 
@@ -696,7 +699,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                                        if (! $type) {
                                                $type = 'text/javascript';
                                        }
-                                       $GLOBALS['TSFE']->addJsFooterLibrary(
+                                       $pageRenderer->addJsFooterLibrary(
                                                htmlspecialchars($key), 
                                                htmlspecialchars($GLOBALS['TSFE']->absRefPrefix . $ss), 
                                                htmlspecialchars($type), 
@@ -719,7 +722,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                                                if (! $type) {
                                                        $type = 'text/javascript';
                                                }
-                                               $GLOBALS['TSFE']->addJsFile(
+                                               $pageRenderer->addJsFile(
                                                        htmlspecialchars($GLOBALS['TSFE']->absRefPrefix . $ss), 
                                                        htmlspecialchars($type), 
                                                        $GLOBALS['TSFE']->pSetup['includeJS.'][$key . '.']['compressed'] ? TRUE : FALSE, 
@@ -740,7 +743,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                                                if (! $type) {
                                                        $type = 'text/javascript';
                                                }
-                                               $GLOBALS['TSFE']->addJsFooterFile(
+                                               $pageRenderer->addJsFooterFile(
                                                        htmlspecialchars($GLOBALS['TSFE']->absRefPrefix . $ss), 
                                                        htmlspecialchars($type), 
                                                        $GLOBALS['TSFE']->pSetup['includeFooterJS.'][$key . '.']['compressed'] ? TRUE : FALSE, 
@@ -754,12 +757,12 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
 
                        // Headerdata
                if (is_array($GLOBALS['TSFE']->pSetup['headerData.'])) {
-                       $GLOBALS['TSFE']->addHeaderData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['headerData.'], 'headerData.'));
+                       $pageRenderer->addHeaderData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['headerData.'], 'headerData.'));
                }
 
                        // Footerdata
                if (is_array($GLOBALS['TSFE']->pSetup['footerData.'])) {
-                       $GLOBALS['TSFE']->addFooterData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['footerData.'], 'footerData.'));
+                       $pageRenderer->addFooterData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['footerData.'], 'footerData.'));
                }
 
                        // Title
@@ -769,10 +772,10 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                }
 
                if (strlen($titleTagContent) && intval($GLOBALS['TSFE']->config['config']['noPageTitle']) !== 2) {
-                       $GLOBALS['TSFE']->setTitle($titleTagContent);
+                       $pageRenderer->setTitle($titleTagContent);
                }
 
-               $GLOBALS['TSFE']->addMetaTag('<meta name="generator" content="TYPO3 ' . TYPO3_branch . ' CMS" />');
+               $pageRenderer->addMetaTag('<meta name="generator" content="TYPO3 ' . TYPO3_branch . ' CMS" />');
 
                $conf = $GLOBALS['TSFE']->pSetup['meta.'];
                if (is_array($conf)) {
@@ -788,7 +791,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                                                if (strtolower($key) == 'refresh') {
                                                        $a = 'http-equiv';
                                                }
-                                               $GLOBALS['TSFE']->addMetaTag('<meta ' . $a . '="' . $key . '" content="' . htmlspecialchars(trim($val)) . '" />');
+                                               $pageRenderer->addMetaTag('<meta ' . $a . '="' . $key . '" content="' . htmlspecialchars(trim($val)) . '" />');
                                        }
                                }
                        }
@@ -888,7 +891,7 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
 
                        // Should minify?
                if ($GLOBALS['TSFE']->config['config']['minifyJS']) {
-                       $GLOBALS['TSFE']->enableCompressJavascript();
+                       $pageRenderer->enableCompressJavascript();
                        $minifyErrorScript = $minifyErrorInline = '';
                        $scriptJsCode = t3lib_div::minifyJavaScript($scriptJsCode, $minifyErrorScript);
                        if ($minifyErrorScript) {
@@ -912,62 +915,62 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                if (! $GLOBALS['TSFE']->config['config']['removeDefaultJS']) {
                                // inlude default and inlineJS
                        if ($scriptJsCode) {
-                               $GLOBALS['TSFE']->addJsInlineCode('_scriptCode', $scriptJsCode, $GLOBALS['TSFE']->config['config']['minifyJS']);
+                               $pageRenderer->addJsInlineCode('_scriptCode', $scriptJsCode, $GLOBALS['TSFE']->config['config']['minifyJS']);
                        }
                        if ($inlineJS) {
-                               $GLOBALS['TSFE']->addJsInlineCode('TS_inlineJS', $inlineJS, $GLOBALS['TSFE']->config['config']['minifyJS']);
+                               $pageRenderer->addJsInlineCode('TS_inlineJS', $inlineJS, $GLOBALS['TSFE']->config['config']['minifyJS']);
                        }
                        if ($inlineFooterJs) {
-                               $GLOBALS['TSFE']->addJsFooterInlineCode('TS_inlineFooter', $inlineFooterJs, $GLOBALS['TSFE']->config['config']['minifyJS']);
+                               $pageRenderer->addJsFooterInlineCode('TS_inlineFooter', $inlineFooterJs, $GLOBALS['TSFE']->config['config']['minifyJS']);
                        }
                } elseif ($GLOBALS['TSFE']->config['config']['removeDefaultJS'] === 'external') {
                                // put default and inlineJS in external file
-                       $GLOBALS['TSFE']->addJsFile(TSpagegen::inline2TempFile($scriptJsCode . $inlineJS, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['minifyJS']);
+                       $pageRenderer->addJsFile(TSpagegen::inline2TempFile($scriptJsCode . $inlineJS, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['minifyJS']);
                        if ($inlineFooterJs) {
-                               $GLOBALS['TSFE']->addJsFooterFile(TSpagegen::inline2TempFile($inlineFooterJs, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['minifyJS']);
+                               $pageRenderer->addJsFooterFile(TSpagegen::inline2TempFile($inlineFooterJs, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['minifyJS']);
                        }
                } else {
                                // include only inlineJS
                        if ($inlineJS) {
-                               $GLOBALS['TSFE']->addJsInlineCode('TS_inlineJS', $inlineJS, $GLOBALS['TSFE']->config['config']['minifyJS']);
+                               $pageRenderer->addJsInlineCode('TS_inlineJS', $inlineJS, $GLOBALS['TSFE']->config['config']['minifyJS']);
                        }
                        if ($inlineFooterJs) {
-                               $GLOBALS['TSFE']->addJsFooterInlineCode('TS_inlineFooter', $inlineFooterJs, $GLOBALS['TSFE']->config['config']['minifyJS']);
+                               $pageRenderer->addJsFooterInlineCode('TS_inlineFooter', $inlineFooterJs, $GLOBALS['TSFE']->config['config']['minifyJS']);
                        }
                }
 
                        // ExtJS specific code
                if (is_array($GLOBALS['TSFE']->pSetup['inlineLanguageLabel.'])) {
-                       $GLOBALS['TSFE']->addInlineLanguageLabelArray($GLOBALS['TSFE']->pSetup['inlineLanguageLabel.']);                
+                       $pageRenderer->addInlineLanguageLabelArray($GLOBALS['TSFE']->pSetup['inlineLanguageLabel.']);
                } 
 
                if (is_array($GLOBALS['TSFE']->pSetup['inlineSettings.'])) {
-                       $GLOBALS['TSFE']->addInlineSettingArray('TS', $GLOBALS['TSFE']->pSetup['inlineSettings.']);             
+                       $pageRenderer->addInlineSettingArray('TS', $GLOBALS['TSFE']->pSetup['inlineSettings.']);
                }
  
                if (is_array($GLOBALS['TSFE']->pSetup['extOnReady.'])) {
-                       $GLOBALS['TSFE']->addExtOnReadyCode($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['extOnReady.'], 'extOnReady.'));           
+                       $pageRenderer->addExtOnReadyCode($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['extOnReady.'], 'extOnReady.'));
                }
  
                        // compression and concatenate settings
                if ($GLOBALS['TSFE']->config['config']['minifyCSS']) {
-                       $GLOBALS['TSFE']->enableCompressCss();
+                       $pageRenderer->enableCompressCss();
                }
                if ($GLOBALS['TSFE']->config['config']['minifyJS']) {
-                       $GLOBALS['TSFE']->enableCompressJavascript();
+                       $pageRenderer->enableCompressJavascript();
                }
                if ($GLOBALS['TSFE']->config['config']['concatenateJsAndCss']) {
-                       $GLOBALS['TSFE']->enableConcatenateFiles();
+                       $pageRenderer->enableConcatenateFiles();
                }
 
                        // add header data block
                if ($GLOBALS['TSFE']->additionalHeaderData) {
-                       $GLOBALS['TSFE']->addHeaderData(implode(chr(10), $GLOBALS['TSFE']->additionalHeaderData));
+                       $pageRenderer->addHeaderData(implode(chr(10), $GLOBALS['TSFE']->additionalHeaderData));
                }
 
                        // add footer data block
                if ($GLOBALS['TSFE']->additionalFooterData) {
-                       $GLOBALS['TSFE']->addFooterData(implode(chr(10), $GLOBALS['TSFE']->additionalFooterData));
+                       $pageRenderer->addFooterData(implode(chr(10), $GLOBALS['TSFE']->additionalFooterData));
                }
 
                // Header complete, now add content
@@ -1004,18 +1007,18 @@ See <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">wiki.t
                if (count($JSef[1])) { // Event functions:
                        $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' ' . trim(implode(' ', $JSef[1])) . '>';
                }
-               $GLOBALS['TSFE']->addBodyContent(chr(10) . $bodyTag);
+               $pageRenderer->addBodyContent(chr(10) . $bodyTag);
 
                        // Div-sections
                if ($GLOBALS['TSFE']->divSection) {
-                       $GLOBALS['TSFE']->addBodyContent(chr(10) . $GLOBALS['TSFE']->divSection);
+                       $pageRenderer->addBodyContent(chr(10) . $GLOBALS['TSFE']->divSection);
                }
 
                        // Page content
-               $GLOBALS['TSFE']->addBodyContent(chr(10) . $pageContent);
+               $pageRenderer->addBodyContent(chr(10) . $pageContent);
 
                        // Render complete page
-               $GLOBALS['TSFE']->content = $GLOBALS['TSFE']->render();
+               $GLOBALS['TSFE']->content = $pageRenderer->render();
 
                        // Ending page
                if ($GLOBALS['TSFE']->pSetup['frameSet.']) {
index 24c628f..8615cff 100644 (file)
@@ -137,7 +137,7 @@ class  tx_recycler_module1 extends t3lib_SCbase {
                        // Load CSS Stylesheets:
                $this->loadStylesheet($this->relativePath . 'res/css/customExtJs.css');
                        // Load Ext JS:
-               $this->doc->loadExtJS();
+               $this->doc->getPageRenderer()->loadExtJS();
                        // Integrate dynamic JavaScript such as configuration or lables:
                $this->doc->JScode.= t3lib_div::wrapJS('
                        Ext.namespace("Recycler");
index 069072d..865d7ef 100644 (file)
@@ -229,7 +229,7 @@ class tx_rtehtmlarea_browse_links extends browse_links {
                $this->doc = t3lib_div::makeInstance('template');
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                        // Loading the Prototype library and browse_links.js
-               $this->doc->loadPrototype();
+               $this->doc->getPageRenderer()->loadPrototype();
                $this->doc->loadJavascriptLib('js/browse_links.js');
                        // Adding context menu code
                $this->doc->getContextMenuCode();
index 435db3a..b2f79ff 100644 (file)
@@ -180,7 +180,7 @@ class tx_rtehtmlarea_select_image extends browse_links {
                $this->doc->backPath = $BACK_PATH;
 
                        // Load the Prototype library and browse_links.js
-               $this->doc->loadPrototype();
+               $this->doc->getPageRenderer()->loadPrototype();
                $this->doc->loadJavascriptLib('js/browse_links.js');
 
                $this->doc->getContextMenuCode();
index c104178..a21536e 100755 (executable)
@@ -602,9 +602,11 @@ class tx_scheduler_Module extends t3lib_SCbase {
                }
 
                        // Load necessary JavaScript
-               $this->doc->loadExtJS();
+               /** @var $pageRenderer t3lib_PageRenderer */
+               $pageRenderer = $this->doc->getPageRenderer();
+               $pageRenderer->loadExtJS();
                $this->doc->loadJavascriptLib(t3lib_extMgm::extRelPath('scheduler') . 'res/tx_scheduler_be.js');
-               $this->doc->addJsFile($this->backPath . '../t3lib/js/extjs/tceforms.js');
+               $pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/tceforms.js');
 
                        // Define settings for Date Picker
                $typo3Settings = array(
@@ -612,7 +614,7 @@ class tx_scheduler_Module extends t3lib_SCbase {
                        'dateFormat'       => array('j-n-Y', 'G:i j-n-Y'),
                        'dateFormatUS'     => array('n-j-Y', 'G:i n-j-Y'),
                );
-               $this->doc->addInlineSettingArray('', $typo3Settings);
+               $pageRenderer->addInlineSettingArray('', $typo3Settings);
 
                        // Define table layout for add/edit form
                $tableLayout = array (
@@ -834,7 +836,7 @@ class tx_scheduler_Module extends t3lib_SCbase {
                        $registeredClasses = self::getRegisteredClasses();
 
                                // Load ExtJS framework and specific JS library
-                       $this->doc->loadExtJS();
+                       $this->doc->getPageRenderer()->loadExtJS();
                        $this->doc->loadJavascriptLib(t3lib_extMgm::extRelPath('scheduler') . 'res/tx_scheduler_be.js');
 
                                // Initialise table layout
index d821abc..0799a74 100755 (executable)
@@ -128,8 +128,10 @@ class tx_t3editor {
                        $path_t3e = t3lib_extmgm::extRelPath('t3editor');
 
                                // include needed javascript-frameworks
-                       $doc->loadPrototype();
-                       $doc->loadScriptaculous();
+                       /** @var $pageRenderer t3lib_PageRenderer */
+                       $pageRenderer = $doc->getPageRenderer();
+                       $pageRenderer->loadPrototype();
+                       $pageRenderer->loadScriptaculous();
 
                                // include editor-css
                        $code.= '<link href="' .
index 2411e20..b94e585 100755 (executable)
@@ -92,7 +92,7 @@ class SC_mod_user_task_index extends t3lib_SCbase {
                $this->doc->divClass = '';
                $this->doc->form = '<form action="index.php" method="post" name="editform">';
                $this->backPath = $this->doc->backPath = $BACK_PATH;
-               $this->doc->loadPrototype();
+               $this->doc->getPageRenderer()->loadPrototype();
                $this->doc->JScode = '  <script language="javascript" type="text/javascript">
                        script_ended = 0;
                        function jumpToUrl(URL) {
index 3f9b00b..1269e5f 100644 (file)
@@ -156,7 +156,7 @@ function fw($str)   {
  * @package TYPO3
  * @subpackage core
  */
-class template extends t3lib_PageRenderer {
+class template {
 
                // Vars you typically might want to/should set from outside after making instance of this class:
        var $backPath = '';                             // 'backPath' pointing back to the PATH_typo3
@@ -209,9 +209,11 @@ class template extends t3lib_PageRenderer {
 
        var $hasDocheader = true;
 
-       // class for render the header / footer
-
-    var $pageHeaderFooterTemplateFile = '';    // alternative template file
+       /**
+        * @var t3lib_PageRenderer
+        */
+       protected $pageRenderer;
+       protected $pageHeaderFooterTemplateFile = '';   // alternative template file
 
 
        /**
@@ -222,7 +224,9 @@ class template extends t3lib_PageRenderer {
         */
        function template()     {
                global $TBE_STYLES;
-               parent::__construct(TYPO3_mainDir . 'templates/template_page_backend.html');
+
+                       // Initializes the page rendering object:
+               $this->getPageRenderer();
 
                        // Setting default scriptID:
                if (($temp_M = (string) t3lib_div::_GET('M')) && $GLOBALS['TBE_MODULES']['_PATHS'][$temp_M]) {
@@ -264,7 +268,20 @@ class template extends t3lib_PageRenderer {
        }
 
 
-
+       /**
+        * Gets instance of PageRenderer
+        * 
+        * @return      t3lib_PageRenderer
+        */
+       public function getPageRenderer() {
+               if (!isset($this->pageRenderer)) {
+                       $this->pageRenderer = t3lib_div::makeInstance('t3lib_PageRenderer');
+                       $this->pageRenderer->setTemplateFile(
+                               TYPO3_mainDir . 'templates/template_page_backend.html'
+                       );
+               }
+               return $this->pageRenderer;
+       }
 
 
 
@@ -623,11 +640,13 @@ class template extends t3lib_PageRenderer {
                        }
                }
 
+               $this->pageRenderer->backPath = $this->backPath;
+
                        // alternative template for Header and Footer
                if ($this->pageHeaderFooterTemplateFile) {
                        $file =  t3lib_div::getFileAbsFileName($this->pageHeaderFooterTemplateFile, TRUE);
                        if ($file) {
-                               $this->setAlternativeTemplateFile($file);
+                               $this->pageRenderer->setTemplateFile($file);
                        }
                }
                        // For debugging: If this outputs "QuirksMode"/"BackCompat" (IE) the browser runs in quirks-mode. Otherwise the value is "CSS1Compat"
@@ -638,7 +657,7 @@ class template extends t3lib_PageRenderer {
                header ('Content-Type:text/html;charset='.$this->charset);
 
                        // Standard HTML tag
-               $this->setHtmlTag('<html xmlns="http://www.w3.org/1999/xhtml">');
+               $this->pageRenderer->setHtmlTag('<html xmlns="http://www.w3.org/1999/xhtml">');
 
                switch($this->docType)  {
                        case 'html_3':
@@ -693,41 +712,41 @@ class template extends t3lib_PageRenderer {
                        }
                }
 
-               $this->setXmlPrologAndDocType($headerStart);
-               $this->setHeadTag('<head>' . chr(10). '<!-- TYPO3 Script ID: '.htmlspecialchars($this->scriptID).' -->');
-               $this->setCharSet($this->charset);      
-               $this->addMetaTag($this->generator());  
-               $this->setTitle($title);
+               $this->pageRenderer->setXmlPrologAndDocType($headerStart);
+               $this->pageRenderer->setHeadTag('<head>' . chr(10). '<!-- TYPO3 Script ID: '.htmlspecialchars($this->scriptID).' -->');
+               $this->pageRenderer->setCharSet($this->charset);
+               $this->pageRenderer->addMetaTag($this->generator());
+               $this->pageRenderer->setTitle($title);
                
                // add docstyles
                $this->docStyle();
 
 
                // add jsCode - has to go to headerData as it may contain the script tags already
-               $this->addHeaderData($this->JScode);
+               $this->pageRenderer->addHeaderData($this->JScode);
                
                foreach ($this->JScodeArray as $name => $code) {
-                       $this->addJsInlineCode($name, $code);   
+                       $this->pageRenderer->addJsInlineCode($name, $code);     
                }
 
                if (count($this->JScodeLibArray)) {
                        foreach($this->JScodeLibArray as $library) {
-                               $this->addHeaderData($library);
+                               $this->pageRenderer->addHeaderData($library);
                        }
                }
 
                if ($this->extJScode) {
-                       $this->addJsHandlerCode($this->extJScode, t3lib_pageIncludes::JSHANDLER_EXTONREADY);
+                       $this->pageRenderer->addExtOnReadyCode($this->extJScode);
                }
 
                        // Construct page header.
-               $str = $this->render(1);
+               $str = $this->pageRenderer->render(t3lib_PageRenderer::PART_HEADER);
 
                $this->JScodeLibArray = array();
                $this->JScode = $this->extJScode = '';
                $this->JScodeArray = array();
 
-               $this->endOfPageJsBlock = $this->render(2);
+               $this->endOfPageJsBlock = $this->pageRenderer->render(t3lib_PageRenderer::PART_FOOTER);
                
                if ($this->docType=='xhtml_frames')     {
                        return $str;
@@ -968,15 +987,15 @@ $str.=$this->docBodyTagBegin().
                $inDocStyles = implode(chr(10), $this->inDocStylesArray);
 
                if ($this->styleSheetFile) {
-                  $this->addCssFile($this->backPath . $this->styleSheetFile);                                  
+                       $this->pageRenderer->addCssFile($this->backPath . $this->styleSheetFile);
                }
                if ($this->styleSheetFile2) {
-                       $this->addCssFile($this->backPath . $this->styleSheetFile2);                                    
+                       $this->pageRenderer->addCssFile($this->backPath . $this->styleSheetFile2);
                }
 
-               $this->addCssInlineBlock('inDocStyles', $inDocStyles . chr(10) . '/*###POSTCSSMARKER###*/');
+               $this->pageRenderer->addCssInlineBlock('inDocStyles', $inDocStyles . chr(10) . '/*###POSTCSSMARKER###*/');
                if ($this->styleSheetFile_post) {
-                       $this->addCssFile($this->backPath . $this->styleSheetFile_post);
+                       $this->pageRenderer->addCssFile($this->backPath . $this->styleSheetFile_post);
        }
 
        }
@@ -991,7 +1010,7 @@ $str.=$this->docBodyTagBegin().
         * @return      void
         */
        function addStyleSheet($key, $href, $title='', $relation='stylesheet') {
-               $this->addCssFile($this->backPath . $href, $relation, $title);
+               $this->pageRenderer->addCssFile($this->backPath . $href, $relation, $title);
                }
 
        /**
@@ -1318,8 +1337,8 @@ $str.=$this->docBodyTagBegin().
         * @return      void
         */
        function loadJavascriptLib($lib)        {
-               $this->addJsFile($this->backPath . $lib);
-               }
+               $this->pageRenderer->addJsFile($this->backPath . $lib);
+       }
 
 
 
@@ -1330,7 +1349,7 @@ $str.=$this->docBodyTagBegin().
         *                      Please just call this function without expecting a return value for future calls
         */
        function getContextMenuCode()   {
-              $this->loadPrototype();
+              $this->pageRenderer->loadPrototype();
               $this->loadJavascriptLib('js/clickmenu.js');
 
               $this->JScodeArray['clickmenu'] = '
@@ -1349,7 +1368,7 @@ $str.=$this->docBodyTagBegin().
         * @return      array           If values are present: [0] = A <script> section for the HTML page header, [1] = onmousemove/onload handler for HTML tag or alike, [2] = One empty <div> layer for the follow-mouse drag element
         */
        function getDragDropCode($table)        {
-               $this->loadPrototype();
+               $this->pageRenderer->loadPrototype();
                $this->loadJavascriptLib('js/common.js');
                $this->loadJavascriptLib('js/tree.js');
 
@@ -1893,7 +1912,7 @@ $str.=$this->docBodyTagBegin().
         */
        function setModuleTemplate($filename) {
                        // Load Prototype lib for IE event
-               $this->loadPrototype();
+               $this->pageRenderer->loadPrototype();
                $this->loadJavascriptLib('js/iecompatibility.js');
                $this->moduleTemplate = $this->getHtmlTemplate($filename);
        }