startElement(), finishElement() and characterHandler() must be public as they
[core.git] / inc / classes / main / template / mail / class_MailTemplateEngine.php
index 1afb1f005efb3979bc2e26d69ffe32c764a40106..7c66d76e0706d3522e026563fbbfb3f19f6935d9 100644 (file)
@@ -2,11 +2,11 @@
 /**
  * The own template engine for loading caching and sending out images
  *
- * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
+ * @link               http://www.shipsimu.org
  * @todo               This template engine does not make use of setTemplateType()
  *
  * This program is free software: you can redistribute it and/or modify
@@ -43,7 +43,7 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
        /**
         * Mailer instance
         */
-       private $mailerInstance = null;
+       private $mailerInstance = NULL;
 
        /**
         * Current main node
@@ -63,8 +63,7 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
        /**
         * Creates an instance of the class TemplateEngine and prepares it for usage
         *
-        * @param       $appInstance    A manageable application
-        * @return      $templateInstance       An instance of TemplateEngine
+        * @return      $templateInstance               An instance of TemplateEngine
         * @throws      BasePathIsEmptyException                If the provided $templateBasePath is empty
         * @throws      InvalidBasePathStringException  If $templateBasePath is no string
         * @throws      BasePathIsNoDirectoryException  If $templateBasePath is no
@@ -72,12 +71,15 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         * @throws      BasePathReadProtectedException  If $templateBasePath is
         *                                                                                      read-protected
         */
-       public static final function createMailTemplateEngine (ManageableApplication $appInstance) {
+       public static final function createMailTemplateEngine () {
                // Get a new instance
                $templateInstance = new MailTemplateEngine();
 
+               // Get the application instance from registry
+               $applicationInstance = Registry::getRegistry()->getInstance('app');
+
                // Determine base path
-               $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
+               $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $applicationInstance->getRequestInstance()->getRequestElement('app') . '/';
 
                // Is the base path valid?
                if (empty($templateBasePath)) {
@@ -144,7 +146,7 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         * @return      void
         * @throws      InvalidXmlNodeException         If an unknown/invalid XML node name was found
         */
-       protected function startElement ($resource, $element, array $attributes) {
+       public function startElement ($resource, $element, array $attributes) {
                // Initial method name which will never be called...
                $methodName = 'initEmail';
 
@@ -177,7 +179,7 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         * @return      void
         * @throws      XmlNodeMismatchException        If current main node mismatches the closing one
         */
-       protected function endElement ($resource, $nodeName) {
+       public function finishElement ($resource, $nodeName) {
                // Make all lower-case
                $nodeName = strtolower($nodeName);
 
@@ -205,14 +207,14 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         * @param       $characters             Characters to handle
         * @return      void
         */
-       protected function characterHandler ($resource, $characters) {
+       public function characterHandler ($resource, $characters) {
                // Trim all spaces away
                $characters = trim($characters);
 
                // Is this string empty?
                if (empty($characters)) {
                        // Then skip it silently
-                       return false;
+                       return;
                } // END - if
 
                // Add the message now
@@ -265,12 +267,10 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
        /**
         * Setter for subject line property
         *
-        * @param       $subjectLine    Subject line to set in email
         * @return      void
         */
-       private function setEmailPropertySubjectLine ($subjectLine) {
-               // Set the template variable
-               $this->assignVariable('subject', $subjectLine);
+       private function setEmailPropertySubjectLine () {
+               // Empty for now
        }
 
        /**
@@ -319,7 +319,7 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla
        public function getMailCacheFqfn () {
                // Initialize FQFN
                $fqfn = '';
-               $this->debugBackTrace();
+               $this->debugBackTrace('Unfinished area!');
 
                // Return it
                return $fqfn;