X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Ftemplate%2Fimage%2Fclass_ImageTemplateEngine.php;h=4c96241a28ac891f293323fc58fc9a86b04e1162;hp=dad6ab4c5a8ab74e28243db337705c4512ffed4f;hb=66e68715d3d5a5e7fd5a3046471914ef3f9dd4b4;hpb=43deb129f6e8a12c37f0df17ad0870d3491bdd34 diff --git a/inc/classes/main/template/image/class_ImageTemplateEngine.php b/inc/classes/main/template/image/class_ImageTemplateEngine.php index dad6ab4c..4c96241a 100644 --- a/inc/classes/main/template/image/class_ImageTemplateEngine.php +++ b/inc/classes/main/template/image/class_ImageTemplateEngine.php @@ -2,11 +2,11 @@ /** * The own template engine for loading caching and sending out images * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.shipsimu.org * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,8 +69,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl /** * 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 @@ -78,16 +77,15 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl * @throws BasePathReadProtectedException If $templateBasePath is * read-protected */ - public final static function createImageTemplateEngine (ManageableApplication $appInstance) { + public static final function createImageTemplateEngine () { // Get a new instance $templateInstance = new ImageTemplateEngine(); - // 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)) { @@ -104,22 +102,15 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl 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; @@ -194,7 +185,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl * @return void * @throws XmlNodeMismatchException If current main node mismatches the closing one */ - public function endElement ($resource, $nodeName) { + public function finishElement ($resource, $nodeName) { // Make all lower-case $nodeName = strtolower($nodeName); @@ -230,11 +221,11 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl // Is this string empty? if (empty($characters)) { // Then skip it silently - return false; + return; } // END - if // Unfinished work! - $this->partialStub("Handling extra characters is not yet supported!"); + $this->partialStub('Handling extra characters is not yet supported!'); } /** @@ -329,7 +320,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl /** * "Setter" for image-string. For more details see above method! * - * @param $groupable Wether this image string is groupable + * @param $groupable Whether this image string is groupable * @return void * @see ImageTemplateEngine::setImageResolution */