From 751eb8f244d16fd11d3cecfc4335bc4003dd6b18 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 22 Dec 2009 08:21:53 +0000 Subject: [PATCH] Language support can now be disabled (e.g. good for hub announcement descriptor) --- .../template/class_BaseTemplateEngine.php | 58 +++++++++++++++---- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/inc/classes/main/template/class_BaseTemplateEngine.php b/inc/classes/main/template/class_BaseTemplateEngine.php index c8924f7a..4f9b1e8c 100644 --- a/inc/classes/main/template/class_BaseTemplateEngine.php +++ b/inc/classes/main/template/class_BaseTemplateEngine.php @@ -131,6 +131,11 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ private $codeEnd = '?>'; + /** + * Language support is enabled by default + */ + private $languageSupport = true; + // Exception codes for the template engine const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED = 0x110; const EXCEPTION_TEMPLATE_CONTAINS_INVALID_VAR = 0x111; @@ -535,16 +540,30 @@ class BaseTemplateEngine extends BaseFrameworkSystem { $ext = (string) $extOther; } - // Construct the FQFN for the template by honoring the current language - $fqfn = sprintf("%s%s%s%s/%s/%s%s", - $this->getConfigInstance()->getConfigEntry('base_path'), - $this->getTemplateBasePath(), - $this->getGenericBasePath(), - $this->getLanguageInstance()->getLanguageCode(), - $this->getTemplateType(), - (string) $template, - $ext - ); + // Is language support enabled? + if ($this->isLanguageSupportEnabled()) { + // Construct the FQFN for the template by honoring the current language + $fqfn = sprintf("%s%s%s%s/%s/%s%s", + $this->getConfigInstance()->getConfigEntry('base_path'), + $this->getTemplateBasePath(), + $this->getGenericBasePath(), + $this->getLanguageInstance()->getLanguageCode(), + $this->getTemplateType(), + (string) $template, + $ext + ); + } else { + // Construct the FQFN for the template without language + $fqfn = sprintf("%s%s%s%s/%s%s", + $this->getConfigInstance()->getConfigEntry('base_path'), + $this->getTemplateBasePath(), + $this->getGenericBasePath(), + $this->getTemplateType(), + (string) $template, + $ext + ); + } + die($fqfn); // First try this try { @@ -1298,6 +1317,25 @@ class BaseTemplateEngine extends BaseFrameworkSystem { // Parse the XML document $parserInstance->parseXmlContent($content); } + + /** + * Enables or disables language support + * + * @param $languageSupport New language support setting + * @return void + */ + public final function enableLanguageSupport ($languageSupport = true) { + $this->languageSupport = (bool) $languageSupport; + } + + /** + * Checks wether language support is enabled + * + * @return $languageSupport Wether language support is enabled or disabled + */ + public final function isLanguageSupportEnabled () { + return $this->languageSupport; + } } // [EOF] -- 2.30.2