/**
* Find a particular template file and return its path
*
* @param string $strTemplate The name of the template
* @param string $strFormat The file extension
*
* @return string The path to the template file
*
* @throws \InvalidArgumentException If $strFormat is unknown
* @throws \RuntimeException If the template group folder is insecure
*/
public static function getTemplate($strTemplate, $strFormat = 'html5')
{
$arrAllowed = trimsplit(',', \Config::get('templateFiles'));
array_push($arrAllowed, 'html5');
// see #3398
if (!in_array($strFormat, $arrAllowed)) {
throw new \InvalidArgumentException('Invalid output format ' . $strFormat);
}
$strTemplate = basename($strTemplate);
// Check for a theme folder
if (TL_MODE == 'FE') {
/** @var \PageModel $objPage */
global $objPage;
if ($objPage->templateGroup != '') {
if (\Validator::isInsecurePath($objPage->templateGroup)) {
throw new \RuntimeException('Invalid path ' . $objPage->templateGroup);
}
return \TemplateLoader::getPath($strTemplate, $strFormat, $objPage->templateGroup);
}
}
return \TemplateLoader::getPath($strTemplate, $strFormat);
}