Cleanup + expanded CompileableTemplate with a lot public methods from BaseTemplateEngine
[core.git] / inc / classes / main / template / class_BaseTemplateEngine.php
index 94a6ce0e9d8fd3909d275edf538d8623402ef9a7..e4f3130db5bc4df7e91be7f6391baedd3b9fe156 100644 (file)
@@ -505,7 +505,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         * @param               $templateBasePath               The relative base path for all templates
         * @return      void
         */
-       public final function setTemplateBasePath ($templateBasePath) {
+       protected final function setTemplateBasePath ($templateBasePath) {
                // And set it
                $this->templateBasePath = (string) $templateBasePath;
        }
@@ -537,7 +537,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         *                                                      templates
         * @return      void
         */
-       public final function setRawTemplateExtension ($templateExtension) {
+       protected final function setRawTemplateExtension ($templateExtension) {
                // And set it
                $this->templateExtension = (string) $templateExtension;
        }
@@ -549,7 +549,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         *                                                      templates
         * @return      void
         */
-       public final function setCodeTemplateExtension ($codeExtension) {
+       protected final function setCodeTemplateExtension ($codeExtension) {
                // And set it
                $this->codeExtension = (string) $codeExtension;
        }
@@ -583,7 +583,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         *                                                              templates
         * @return      void
         */
-       public final function setCompileOutputPath ($compileOutputPath) {
+       protected final function setCompileOutputPath ($compileOutputPath) {
                // And set it
                $this->compileOutputPath = (string) $compileOutputPath;
        }
@@ -651,7 +651,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
         *
         * @return      $compiledData   Compiled template data
         */
-       public final function getCompiledData () {
+       protected final function getCompiledData () {
                //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: ' . strlen($this->compiledData) . ' Bytes read.');
                return $this->compiledData;
        }
@@ -760,7 +760,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                        $this->assignVariable($variableName, '');
                } else {
                        // Configuration variables
-                       $this->assignConfigVariable($variableName);
+                       $this->assignConfigVariable($var);
                }
        }
 
@@ -830,13 +830,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                                //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']:template=' . $template);
 
                                // Template not found, but maybe variable assigned?
-                               if ($this->getVariableIndex($template, 'config') !== FALSE) {
-                                       // Use that content here
-                                       $this->loadedRawData[$template] = $this->readVariable($template, 'config');
-
-                                       // Recursive protection:
-                                       array_push($this->loadedTemplates, $template);
-                               } elseif ($this->getVariableIndex($template) !== FALSE) {
+                               if ($this->getVariableIndex($template) !== FALSE) {
                                        // Use that content here
                                        $this->loadedRawData[$template] = $this->readVariable($template);
 
@@ -1188,24 +1182,24 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
 
                // Sweet and simple...
                //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: variableName=' . $variableName . ',getConfigEntry()=' . $this->getConfigInstance()->getConfigEntry($variableName));
-               $this->setVariable('config', $variableName, $this->getConfigInstance()->getConfigEntry($variableName));
+               $this->assignVariable($variableName, $this->getConfigInstance()->getConfigEntry($variableName));
        }
 
        /**
-        * Injects an array of config variables into the stack of currently loaded
-        * template. This method should only be used in very rare circumstances,
-        * e.g. when you have to copy a whole set of variables into the template
-        * engine. Before you use this method, please make sure you have considered
-        * all other possiblities.
+        * Assigns a lot variables into the stack of currently loaded template.
+        * This method should only be used in very rare circumstances, e.g. when
+        * you have to copy a whole set of variables into the template engine.
+        * Before you use this method, please make sure you have considered all
+        * other possiblities.
         *
-        * @param       $variables      An array with variables to be injected
+        * @param       $variables      An array with variables to be assigned
         * @return      void
         */
-       public function injectConfigVariables (array $variables) {
+       public function assignMultipleVariables (array $variables) {
                // "Inject" all
                foreach ($variables as $name => $value) {
                        // Set variable with name for 'config' group
-                       $this->setVariable('config', $name, $value);
+                       $this->assignVariable($name, $value);
                } // END - foreach
        }
 
@@ -1277,7 +1271,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                                $this->assignConfigVariable($value);
                        } else {
                                // Re-assign the value directly
-                               $this->setVariable('config', $currVariable['name'], $value);
+                               $this->assignVariable($currVariable['name'], $value);
                        }
                } // END - foreach
        }
@@ -1550,7 +1544,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem {
                // Get a XmlParser instance
                $parserInstance = ObjectFactory::createObjectByConfiguredName('xml_parser_class', array($this));
 
-               // Check if we have XML compacting enabled
+               // Check if XML compacting is enabled
                if ($this->isXmlCompactingEnabled()) {
                        // Yes, so get a decorator class for transparent compacting
                        $parserInstance = ObjectFactory::createObjectByConfiguredName('deco_compacting_xml_parser_class', array($parserInstance));