Double->single converted
[core.git] / inc / classes / main / template / class_BaseTemplateEngine.php
index 190e2e8054085ea72373fc576327dac03cdaf081..19e06431c0600b5d99f2af2929ff7f451da4bb4f 100644 (file)
@@ -525,19 +525,23 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         * Private loader for all template types
         *
         * @param       $template       The template we shall load
+        * @param       $extOther       An other extension to use
         * @return      void
         * @throws      FileNotFoundException   If the template was not found
         */
-       protected function loadTemplate ($template, $ext = '') {
+       protected function loadTemplate ($template, $extOther = '') {
                // Get extension for the template if empty
-               if (empty($ext)) {
+               if (empty($extOther)) {
                        // None provided, so get the raw one
                        $ext = $this->getRawTemplateExtension();
-               } // END - if
+               } else {
+                       // Then use it!
+                       $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()->readConfig('base_path'),
+                       $this->getConfigInstance()->getConfigEntry('base_path'),
                        $this->getTemplateBasePath(),
                        $this->getGenericBasePath(),
                        $this->getLanguageInstance()->getLanguageCode(),
@@ -552,7 +556,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                        $this->loadRawTemplateData($fqfn);
                } catch (FileNotFoundException $e) {
                        // If we shall load a code-template we need to switch the file extension
-                       if ($this->getTemplateType() != $this->getConfigInstance()->readConfig('web_template_type')) {
+                       if (($this->getTemplateType() != $this->getConfigInstance()->getConfigEntry('web_template_type')) && (empty($extOther))) {
                                // Switch over to the code-template extension and try it again
                                $ext = $this->getCodeTemplateExtension();
 
@@ -926,7 +930,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        public function loadWebTemplate ($template) {
                // Set template type
-               $this->setTemplateType($this->getConfigInstance()->readConfig('web_template_type'));
+               $this->setTemplateType($this->getConfigInstance()->getConfigEntry('web_template_type'));
 
                // Load the special template
                $this->loadTemplate($template);
@@ -941,7 +945,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
        public function assignConfigVariable ($var) {
                // Sweet and simple...
                //* DEBUG: */ echo __METHOD__.':var={$var}<br />\n';
-               $this->varStack['config'][$var] = $this->getConfigInstance()->readConfig($var);
+               $this->varStack['config'][$var] = $this->getConfigInstance()->getConfigEntry($var);
        }
 
        /**
@@ -953,7 +957,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        public function loadEmailTemplate ($template) {
                // Set template type
-               $this->setTemplateType($this->getConfigInstance()->readConfig('email_template_type'));
+               $this->setTemplateType($this->getConfigInstance()->getConfigEntry('email_template_type'));
 
                // Load the special template
                $this->loadTemplate($template);
@@ -968,7 +972,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        public function loadCodeTemplate ($template) {
                // Set template type
-               $this->setTemplateType($this->getConfigInstance()->readConfig('code_template_type'));
+               $this->setTemplateType($this->getConfigInstance()->getConfigEntry('code_template_type'));
 
                // Load the special template
                $this->loadTemplate($template);
@@ -982,7 +986,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        public final function compileVariables () {
                // Initialize the $content array
-               $validVar = $this->getConfigInstance()->readConfig('tpl_valid_var');
+               $validVar = $this->getConfigInstance()->getConfigEntry('tpl_valid_var');
                $dummy = array();
 
                // Iterate through all general variables
@@ -1046,7 +1050,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                        );
 
                        // Run the constructed command. This will "compile" all variables in
-                       @eval($eval);
+                       eval($eval);
 
                        // Goes something wrong?
                        if ((!isset($result)) || (empty($result))) {
@@ -1080,9 +1084,9 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         */
        public function compileTemplate () {
                // We will only work with template type "code" from configuration
-               if ($this->getTemplateType() != $this->getConfigInstance()->readConfig('code_template_type')) {
+               if ($this->getTemplateType() != $this->getConfigInstance()->getConfigEntry('code_template_type')) {
                        // Abort here
-                       throw new UnexpectedTemplateTypeException(array($this, $this->getTemplateType(), $this->getConfigInstance()->readConfig('code_template_type')), self::EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED);
+                       throw new UnexpectedTemplateTypeException(array($this, $this->getTemplateType(), $this->getConfigInstance()->getConfigEntry('code_template_type')), self::EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED);
                } // END - if
 
                // Get the raw data.