X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Ftemplate%2Fimage%2Fclass_ImageTemplateEngine.php;h=b47c706e9f60a9ef9ca649ee4d3d09484d30f63b;hb=d527a312ec4b2983fc0ecda2179ce335c1a5a1f9;hp=c2542d816f991c81de1fa2e336447a9b83c282e0;hpb=8ff2f773e29b6628131d73271f5cac9b2756374e;p=shipsimu.git diff --git a/inc/classes/main/template/image/class_ImageTemplateEngine.php b/inc/classes/main/template/image/class_ImageTemplateEngine.php index c2542d8..b47c706 100644 --- a/inc/classes/main/template/image/class_ImageTemplateEngine.php +++ b/inc/classes/main/template/image/class_ImageTemplateEngine.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -23,7 +23,7 @@ */ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTemplate { /** - * Main nodes in the XML tree ("image" is ignored) + * Main nodes in the XML tree ('image' is ignored) */ private $mainNodes = array("base", "type", "resolution", "background-color", "foreground-color", "image-string"); @@ -56,10 +56,6 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl // Create unique ID number $this->generateUniqueId(); - - // Clean up a little - $this->removeNumberFormaters(); - $this->removeSystemArray(); } /** @@ -134,8 +130,8 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl xml_set_object($xmlParser, $this); // Set handler call-backs - xml_set_element_handler($xmlParser, "startElement", "endElement"); - xml_set_character_data_handler($xmlParser, "characterHandler"); + xml_set_element_handler($xmlParser, 'startElement', 'endElement'); + xml_set_character_data_handler($xmlParser, 'characterHandler'); // Now parse the XML tree if (!xml_parse($xmlParser, $imageContent)) { @@ -158,7 +154,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl */ public function startElement ($resource, $element, array $attributes) { // Initial method name which will never be called... - $methodName = "initImage"; + $methodName = 'initImage'; // Make the element name lower-case $element = strtolower($element); @@ -167,11 +163,11 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl //* DEBUG: */ echo "START: >".$element."<
\n"; if (in_array($element, $this->mainNodes)) { // Okay, main node found! - $methodName = "setImage" . $this->convertToClassName($element); + $methodName = 'setImage' . $this->convertToClassName($element); } elseif (in_array($element, $this->subNodes)) { // Sub node found - $methodName = "setImageProperty" . $this->convertToClassName($element); - } elseif ($element != "image") { + $methodName = 'setImageProperty' . $this->convertToClassName($element); + } elseif ($element != 'image') { // Invalid node name found throw new InvalidXmlNodeException(array($this, $element, $attributes), BaseHelper::EXCEPTION_XML_NODE_UNKNOWN); } @@ -204,7 +200,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl } // Construct method name - $methodName = "finish" . $this->convertToClassName($nodeName); + $methodName = 'finish' . $this->convertToClassName($nodeName); // Call the corresponding method call_user_func_array(array($this->imageInstance, $methodName), array()); @@ -250,19 +246,19 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl */ private function setImageType ($imageType) { // Set group to general - $this->setVariableGroup("general"); + $this->setVariableGroup('general'); // Try to compile it first to get the value from variable stack $imageType = $this->compileRawCode($imageType); // Now make a class name of it - $className = $this->convertToClassName($imageType."_image"); + $className = $this->convertToClassName($imageType.'_image'); // And try to initiate it $this->imageInstance = ObjectFactory::createObjectByName($className, array($this)); // Set current main node to type - $this->currMainNode = "type"; + $this->currMainNode = 'type'; } /** @@ -276,7 +272,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl $this->imageInstance->initResolution(); // Current main node is resolution - $this->currMainNode = "resolution"; + $this->currMainNode = 'resolution'; } /** @@ -290,7 +286,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl $this->imageInstance->initBase(); // Current main node is resolution - $this->currMainNode = "base"; + $this->currMainNode = 'base'; } /** @@ -304,7 +300,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl $this->imageInstance->initBackgroundColor(); // Current main node is background-color - $this->currMainNode = "background-color"; + $this->currMainNode = 'background-color'; } /** @@ -318,7 +314,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl $this->imageInstance->initForegroundColor(); // Current main node is foreground-color - $this->currMainNode = "foreground-color"; + $this->currMainNode = 'foreground-color'; } /** @@ -328,12 +324,12 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl * @return void * @see ImageTemplateEngine::setImageResolution */ - private function setImageImageString ($groupable = "single") { + private function setImageImageString ($groupable = 'single') { // Call the image class $this->imageInstance->initImageString($groupable); // Current main node is foreground-color - $this->currMainNode = "image-string"; + $this->currMainNode = 'image-string'; } /** @@ -464,7 +460,7 @@ class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTempl */ public function getImageCacheFqfn () { // Get the FQFN ready - $fqfn = $this->getBasePath()."_cache/" . md5($this->imageInstance->getImageName()) . "." . $this->imageInstance->getImageType(); + $fqfn = $this->getBasePath().'_cache/' . md5($this->imageInstance->getImageName().":".$this->__toString().":".$this->imageInstance->__toString()) . "." . $this->imageInstance->getImageType(); // Return it return $fqfn;