X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Ftemplate%2Fmail%2Fclass_MailTemplateEngine.php;h=c4e49b22f580e106554f88b39c41ed704112c82c;hp=99072276eefb33f9dd3fd33ed3b6bad31f2cc118;hb=36a96a3b68cb6da4e1b431fbc5983821de918618;hpb=84e2207412d3c6ea9f940a83b2cdd4503509808a diff --git a/inc/classes/main/template/mail/class_MailTemplateEngine.php b/inc/classes/main/template/mail/class_MailTemplateEngine.php index 99072276..c4e49b22 100644 --- a/inc/classes/main/template/mail/class_MailTemplateEngine.php +++ b/inc/classes/main/template/mail/class_MailTemplateEngine.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @todo This template engine does not make use of setTemplateType() @@ -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,16 +71,15 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla * @throws BasePathReadProtectedException If $templateBasePath is * read-protected */ - public final static function createMailTemplateEngine (ManageableApplication $appInstance) { + public static final function createMailTemplateEngine () { // Get a new instance $templateInstance = new MailTemplateEngine(); - // Get language and file I/O instances from application - $langInstance = $appInstance->getLanguageInstance(); - $ioInstance = $appInstance->getFileIoInstance(); + // 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)) { @@ -98,22 +96,15 @@ class MailTemplateEngine extends BaseTemplateEngine implements CompileableTempla throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH); } - // Get configuration instance - $configInstance = FrameworkConfiguration::getInstance(); - // Set the base path $templateInstance->setTemplateBasePath($templateBasePath); - // Set the language and IO instances - $templateInstance->setLanguageInstance($langInstance); - $templateInstance->setFileIoInstance($ioInstance); - // Set template extensions - $templateInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension')); - $templateInstance->setCodeTemplateExtension($configInstance->getConfigEntry('code_template_extension')); + $templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension')); + $templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('code_template_extension')); // Absolute output path for compiled templates - $templateInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path')); + $templateInstance->setCompileOutputPath($templateInstance->getConfigInstance()->getConfigEntry('base_path') . $templateInstance->getConfigInstance()->getConfigEntry('compile_output_path')); // Return the prepared instance return $templateInstance;