*/
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");
// Create unique ID number
$this->generateUniqueId();
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
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)) {
*/
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);
//* DEBUG: */ echo "START: >".$element."<<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);
}
}
// 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());
*/
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';
}
/**
$this->imageInstance->initResolution();
// Current main node is resolution
- $this->currMainNode = "resolution";
+ $this->currMainNode = 'resolution';
}
/**
$this->imageInstance->initBase();
// Current main node is resolution
- $this->currMainNode = "base";
+ $this->currMainNode = 'base';
}
/**
$this->imageInstance->initBackgroundColor();
// Current main node is background-color
- $this->currMainNode = "background-color";
+ $this->currMainNode = 'background-color';
}
/**
$this->imageInstance->initForegroundColor();
// Current main node is foreground-color
- $this->currMainNode = "foreground-color";
+ $this->currMainNode = 'foreground-color';
}
/**
* @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';
}
/**
*/
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;