Skip to content

Commit 673bd0a

Browse files
authored
Move provisioning code to provisioner (#38)
1 parent cc33a58 commit 673bd0a

3 files changed

Lines changed: 21 additions & 10 deletions

File tree

.styleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@ finder:
5555
- "*.php"
5656
exclude:
5757
- ".Build"
58+
not-name:
5859
- "ext_emconf.php"

Classes/Core/FrontendRenderingProvisioner.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,21 @@ public function provision(TypoScriptFrontendController $typoScriptFrontendContro
3737
$this->configureLinkBuilding($typoScriptFrontendController);
3838
$this->configurePageRenderer($typoScriptFrontendController);
3939
$this->configureImageProcessing($typoScriptFrontendController);
40+
$this->fixNoScriptInclude($typoScriptFrontendController);
4041

4142
// Create new top level content object which is required by some rendering methods
4243
$typoScriptFrontendController->newCObj();
44+
45+
// Bypass any other page rendering, by including our own dummy rendering
46+
$typoScriptFrontendController->config['config']['pageGenScript'] = 'EXT:typoscript_rendering/Scripts/DummyRendering.php';
4347
}
4448

4549
/**
4650
* @param TypoScriptFrontendController $typoScriptFrontendController
4751
*
4852
* @return void
4953
*/
50-
protected function configureLinkBuilding(TypoScriptFrontendController $typoScriptFrontendController)
54+
private function configureLinkBuilding(TypoScriptFrontendController $typoScriptFrontendController)
5155
{
5256
// Mount point parameters
5357
if ($typoScriptFrontendController->config['config']['MP_defaults']) {
@@ -97,7 +101,7 @@ protected function configureLinkBuilding(TypoScriptFrontendController $typoScrip
97101
*
98102
* @return void
99103
*/
100-
protected function configurePageRenderer(TypoScriptFrontendController $typoScriptFrontendController)
104+
private function configurePageRenderer(TypoScriptFrontendController $typoScriptFrontendController)
101105
{
102106
$pageRenderer = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Page\\PageRenderer');
103107
// Setting XHTML-doctype from doctype
@@ -138,11 +142,24 @@ protected function configurePageRenderer(TypoScriptFrontendController $typoScrip
138142
*
139143
* @return void
140144
*/
141-
protected function configureImageProcessing(TypoScriptFrontendController $typoScriptFrontendController)
145+
private function configureImageProcessing(TypoScriptFrontendController $typoScriptFrontendController)
142146
{
143147
$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'] = isset($typoScriptFrontendController->config['config']['noScaleUp']) ? '' . $typoScriptFrontendController->config['config']['noScaleUp'] : $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
144148
if (property_exists($typoScriptFrontendController, 'TYPO3_CONF_VARS')) {
145149
$typoScriptFrontendController->TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noScaleUp'];
146150
}
147151
}
152+
153+
/**
154+
* @param TypoScriptFrontendController $typoScriptFrontendController
155+
*
156+
* @return void
157+
*/
158+
private function fixNoScriptInclude(TypoScriptFrontendController $typoScriptFrontendController)
159+
{
160+
$GLOBALS['TYPO3_CONF_VARS']['FE']['noPHPscriptInclude'] = false;
161+
if (property_exists($typoScriptFrontendController, 'TYPO3_CONF_VARS')) {
162+
$typoScriptFrontendController->TYPO3_CONF_VARS['FE']['noPHPscriptInclude'] = $GLOBALS['TYPO3_CONF_VARS']['FE']['noPHPscriptInclude'];
163+
}
164+
}
148165
}

Classes/RenderingDispatcher.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ public function checkDataSubmission(TypoScriptFrontendController $typoScriptFron
7474
$renderer->renderRequest($request, $response, $renderingContext);
7575

7676
$typoScriptFrontendController->content = $response->getContent();
77-
$typoScriptFrontendController->config['config']['pageGenScript'] = 'EXT:typoscript_rendering/Scripts/DummyRendering.php';
78-
// Force DummyRendering to be included, even if TYPO3 setup disallows inclusion of PHP scripts
79-
if (property_exists($typoScriptFrontendController, 'TYPO3_CONF_VARS')) {
80-
$typoScriptFrontendController->TYPO3_CONF_VARS['FE']['noPHPscriptInclude'] = false;
81-
} else {
82-
$GLOBALS['TYPO3_CONF_VARS']['FE']['noPHPscriptInclude'] = false;
83-
}
8477
}
8578
}
8679

0 commit comments

Comments
 (0)