Introduced FileNotFoundException
[core.git] / inc / classes / main / template / class_BaseTemplateEngine.php
index e4f3130db5bc4df7e91be7f6391baedd3b9fe156..68511ad143380df67820e706012fa5178d4a1edf 100644 (file)
@@ -647,11 +647,11 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
        }
 
        /**
-        * Getter for compiled templates
+        * Getter for compiled templates, must be public for e.g. Mailer classes.
         *
         * @return      $compiledData   Compiled template data
         */
-       protected final function getCompiledData () {
+       public final function getCompiledData () {
                //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: ' . strlen($this->compiledData) . ' Bytes read.');
                return $this->compiledData;
        }
@@ -702,9 +702,9 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                try {
                        // Load the raw template data
                        $this->loadRawTemplateData($fqfn);
-               } catch (FileIoException $e) {
+               } catch (FileNotFoundException $e) {
                        // If we shall load a code-template we need to switch the file extension
-                       if (($this->getTemplateType() != $this->getConfigInstance()->getConfigEntry('web_template_type')) && (empty($extOther))) {
+                       if (($this->getTemplateType() != $this->getConfigInstance()->getConfigEntry('html_template_type')) && (empty($extOther))) {
                                // Switch over to the code-template extension and try it again
                                $ext = $this->getCodeTemplateExtension();
 
@@ -846,7 +846,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                                                // Remember this template for recursion detection
                                                // RECURSIVE PROTECTION!
                                                array_push($this->loadedTemplates, $template);
-                                       } catch (FileIoException $e) {
+                                       } catch (FileNotFoundException $e) {
                                                // Even this is not done... :/
                                                array_push($this->rawTemplates, $template);
                                        }
@@ -934,7 +934,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                        foreach ($this->rawTemplates as $key => $template) {
                                try {
                                        // Load the template
-                                       $this->loadWebTemplate($template);
+                                       $this->loadHtmlTemplate($template);
 
                                        // Remember it's contents
                                        $this->rawTemplates[$template] = $this->getRawTemplateData();
@@ -945,7 +945,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                                        // Remember this template for recursion detection
                                        // RECURSIVE PROTECTION!
                                        array_push($this->loadedTemplates, $template);
-                               } catch (FileIoException $e) {
+                               } catch (FileNotFoundException $e) {
                                        // This template was never found. We silently ignore it
                                        unset($this->rawTemplates[$key]);
                                }
@@ -1086,15 +1086,15 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
        }
 
        /**
-        * Load a specified web template into the engine
+        * Load a specified HTML template into the engine
         *
         * @param       $template       The web template we shall load which is located in
         *                                              'html' by default
         * @return      void
         */
-       public function loadWebTemplate ($template) {
+       public function loadHtmlTemplate ($template) {
                // Set template type
-               $this->setTemplateType($this->getConfigInstance()->getConfigEntry('web_template_type'));
+               $this->setTemplateType($this->getConfigInstance()->getConfigEntry('html_template_type'));
 
                // Load the special template
                $this->loadTemplate($template);
@@ -1238,6 +1238,21 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                $this->loadTemplate($template);
        }
 
+       /**
+        * Load a specified email template into the engine
+        *
+        * @param       $template       The email template we shall load which is
+        *                                              located in 'emails' by default
+        * @return      void
+        */
+       public function loadEmailTemplate ($template) {
+               // Set template type
+               $this->setTemplateType($this->getConfigInstance()->getConfigEntry('email_template_type'));
+
+               // Load the special template
+               $this->loadTemplate($template);
+       }
+
        /**
         * Compiles configuration place-holders in all variables. This 'walks'
         * through the variable group 'general'. It interprets all values from that