Packager script for latest dev version added, misc fixes, captcha verifier filter...
[shipsimu.git] / inc / classes / main / template / image / class_ImageTemplateEngine.php
index c4d30e9b25f0473e58b1e6102c6a08364d0e9f87..759b40edab997feaf3b03cbc3bc99ef759e1356a 100644 (file)
@@ -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: &gt;".$element."&lt;<br />\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->__toString().":".$this->imageInstance->__toString()) . "." . $this->imageInstance->getImageType();
+               $fqfn = $this->getBasePath().'_cache/' . md5($this->imageInstance->getImageName().":".$this->__toString().":".$this->imageInstance->__toString()) . "." . $this->imageInstance->getImageType();
 
                // Return it
                return $fqfn;