X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fhub%2Fmain%2Ftemplate%2Fclass_BaseXmlTemplateEngine.php;h=676e09b005dfcba3c5110e38a0143fc03b87f07f;hb=b3fdb8014a8f1028502534e229bceea2e4f6686d;hp=2cb598f38bafa944ebc3d3535131b6771fe82ede;hpb=d158de7fb54536874f866c02e0e61f26115419d9;p=hub.git diff --git a/application/hub/main/template/class_BaseXmlTemplateEngine.php b/application/hub/main/template/class_BaseXmlTemplateEngine.php index 2cb598f38..676e09b00 100644 --- a/application/hub/main/template/class_BaseXmlTemplateEngine.php +++ b/application/hub/main/template/class_BaseXmlTemplateEngine.php @@ -2,11 +2,11 @@ /** * A generic XML template engine class * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.shipsimu.org * @todo This template engine does not make use of setTemplateType() * * This program is free software: you can redistribute it and/or modify @@ -26,17 +26,17 @@ class BaseXmlTemplateEngine extends BaseTemplateEngine { /** * Main nodes in the XML tree */ - protected $mainNodes = array(); + private $mainNodes = array(); /** * Sub nodes in the XML tree */ - protected $subNodes = array(); + private $subNodes = array(); /** * Current main node */ - protected $curr = array(); + private $curr = array(); /** * XML template type @@ -99,7 +99,7 @@ class BaseXmlTemplateEngine extends BaseTemplateEngine { } elseif (!is_dir($templateBasePath)) { // Is not a path throw new BasePathIsNoDirectoryException(array($this, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); - } elseif (!is_readable($templateBasePath)) { + } elseif (!BaseFrameworkSystem::isReadableFile($templateBasePath)) { // Is not readable throw new BasePathReadProtectedException(array($this, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH); } @@ -115,16 +115,16 @@ class BaseXmlTemplateEngine extends BaseTemplateEngine { $this->setCompileOutputPath($this->getConfigInstance()->getConfigEntry('base_path') . $this->getConfigInstance()->getConfigEntry('compile_output_path')); // Init a variable stacker - $stackerInstance = ObjectFactory::createObjectByConfiguredName($typePrefix . '_' . $xmlTemplateType . '_stacker_class'); + $stackInstance = ObjectFactory::createObjectByConfiguredName($typePrefix . '_' . $xmlTemplateType . '_stacker_class'); // Set name $this->stackerName = $typePrefix . '_' . $xmlTemplateType; // Init stacker - $stackerInstance->initStacker($this->stackerName); + $stackInstance->initStack($this->stackerName); // Set it - $this->setStackerInstance($stackerInstance); + $this->setStackInstance($stackInstance); // Set XML template type and prefix $this->xmlTemplateType = $xmlTemplateType; @@ -191,6 +191,16 @@ class BaseXmlTemplateEngine extends BaseTemplateEngine { return $this->stackerName; } + /** + * Setter for sub node array + * + * @param $subNodes Array with valid sub node names + * @return void + */ + public final function setSubNodes (array $subNodes) { + $this->subNodes = $subNodes; + } + /** * Getter for sub node array * @@ -211,19 +221,25 @@ class BaseXmlTemplateEngine extends BaseTemplateEngine { // Read the variable $value = parent::readVariable($key, 'general'); + // Is this null? + if (is_null($value)) { + // Bah, needs fixing. + $this->debugInstance('key=' . $key . ' returns NULL'); + } // END - if + // Return value return $value; } /** - * Handles the template dependency for given node + * Handles the template dependency for given XML node * - * @param $node The node we should load a dependency template + * @param $node The XML node we should load a dependency template * @param $templateDependency A template to load to satisfy dependencies * @return void */ protected function handleTemplateDependency ($node, $templateDependency) { - // Check that node is not empty + // Check that the XML node is not empty assert(!empty($node)); // Is the template dependency set?