if ($GLOBALS['TBE_STYLES']['htmlTemplates'][$filename]) {
$filename = $GLOBALS['TBE_STYLES']['htmlTemplates'][$filename];
}
- if (GeneralUtility::isFirstPartOfStr($filename, 'EXT:')) {
- $filename = GeneralUtility::getFileAbsFileName($filename);
- } elseif (!GeneralUtility::isAbsPath($filename)) {
- $filename = GeneralUtility::resolveBackPath($filename);
- } elseif (!GeneralUtility::isAllowedAbsPath($filename)) {
- $filename = '';
- }
- $htmlTemplate = '';
- if ($filename !== '') {
- $htmlTemplate = file_get_contents($filename);
- }
- return $htmlTemplate;
+ $filename = GeneralUtility::getFileAbsFileName($filename);
+ return $filename !== '' ? file_get_contents($filename) : '';
}
/**
} else {
// Fetch the Fluid template by file stdWrap
$file = isset($conf['file.']) ? $this->cObj->stdWrap($conf['file'], $conf['file.']) : $conf['file'];
- /** @var $templateService \TYPO3\CMS\Core\TypoScript\TemplateService */
- $templateService = $GLOBALS['TSFE']->tmpl;
- $templatePathAndFilename = $templateService->getFileName($file);
- $this->view->setTemplatePathAndFilename(PATH_site . $templatePathAndFilename);
+ // Get the absolute file name
+ $templatePathAndFilename = GeneralUtility::getFileAbsFileName($file);
+ $this->view->setTemplatePathAndFilename($templatePathAndFilename);
}
}
public function renderSetsTemplateFileInView()
{
$this->addMockViewToSubject();
- /** @var $templateService \PHPUnit_Framework_MockObject_MockObject */
- $templateService = $GLOBALS['TSFE']->tmpl;
- $templateService
- ->expects($this->any())
- ->method('getFileName')
- ->with('foo')
- ->will($this->returnValue('bar'));
$this->standaloneView
->expects($this->any())
->method('setTemplatePathAndFilename')
- ->with(PATH_site . 'bar');
- $this->subject->render(['file' => 'foo']);
+ ->with(PATH_site . 'typo3/sysext/core/bar.html');
+ $this->subject->render(['file' => 'EXT:core/bar.html']);
}
/**