]> git.mxchange.org Git - core.git/blobdiff - inc/classes/interfaces/template/class_CompileableTemplate.php
Renamed variables, removeVariable() does not expect indexes
[core.git] / inc / classes / interfaces / template / class_CompileableTemplate.php
index 46ffe7750653c5d64c4ec1d5f26c107f0b7ff898..41791914ee5581de90d9de32d04206018624081f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -25,11 +25,11 @@ interface CompileableTemplate extends FrameworkInterface {
        /**
         * Assign variables for templates
         *
        /**
         * Assign variables for templates
         *
-        * @param       $var    The "variable" we want to assign
-        * @param       $value  The value we want to store in the variable
+        * @param       $variableName   The "variable" we want to assign
+        * @param       $value                  The value we want to store in the variable
         * @return      void
         */
         * @return      void
         */
-       function assignVariable ($var, $value);
+       function assignVariable ($variableName, $value);
 
        /**
         * Load a specified web template into the engine
 
        /**
         * Load a specified web template into the engine
@@ -51,39 +51,144 @@ interface CompileableTemplate extends FrameworkInterface {
        function loadCodeTemplate ($template);
 
        /**
        function loadCodeTemplate ($template);
 
        /**
-        * Load a specified email template into the engine
+        * Compile all variables by inserting their respective values
         *
         *
-        * @param       $template       The email template we shall load which is
-        *                                              located in "emails" by default
         * @return      void
         */
         * @return      void
         */
-       function loadEmailTemplate ($template);
+       function compileVariables ();
+
 
        /**
 
        /**
-        * Compile all variables by inserting their respective values
+        * Compile all required code/web/email-templates into the current one
         *
         * @return      void
         */
         *
         * @return      void
         */
-       function compileVariables ();
+       function compileTemplate ();
+
+       /**
+        * Adds a variable to current group
+        *
+        * @param       $variableName   Variable to set
+        * @param       $value                  Value to store in variable
+        * @return      void
+        */
+       function addGroupVariable ($variableName, $value);
 
 
+       /**
+        * Removes a given variable
+        *
+        * @param       $variableName   The variable we are looking for
+        * @return      void
+        */
+       function removeVariable ($variableName);
 
        /**
 
        /**
-        * Compile all required code/web/email-templates into the current one
+        * Assign a given congfiguration variable with a value
         *
         *
+        * @param       $variableName   The configuration variable we want to assign
         * @return      void
         */
         * @return      void
         */
-       function compileTemplate ();
+       function assignConfigVariable ($variableName);
 
        /**
 
        /**
-        * Output the compiled template to the outside world. In case of web
-        * templates this would be vaild (X)HTML code. And in case of email
-        * templates this would store a prepared email body inside the template
-        * engine.
+        * Compiles configuration place-holders in all variables. This 'walks'
+        * through the variable stack 'general'. It interprets all values from that
+        * variables as configuration entries after compiling them.
         *
         * @return      void
         */
         *
         * @return      void
         */
-       function output ();
-} // END - class
+       function compileConfigInVariables ();
+
+       /**
+        * Assigns the last loaded raw template content with a given variable
+        *
+        * @param       $templateName   Name of the template we want to assign
+        * @param       $variableName   Name of the variable we want to assign
+        * @return      void
+        */
+       function assignTemplateWithVariable ($templateName, $variableName);
+
+       /**
+        * Transfers the content of this template engine to a given response instance
+        *
+        * @param       $responseInstance       An instance of a response class
+        * @return      void
+        */
+       function transferToResponse (Responseable $responseInstance);
+
+       /**
+        * Assigns all the application data with template variables
+        *
+        * @param       $applicationInstance    A manageable application instance
+        * @return      void
+        */
+       function assignApplicationData (ManageableApplication $applicationInstance);
+
+       /**
+        * "Compiles" a variable by replacing {?var?} with it's content
+        *
+        * @param       $rawCode                        Raw code to compile
+        * @param       $setMatchAsCode         Sets $match if readVariable() returns empty result
+        * @return      $rawCode        Compile code with inserted variable value
+        */
+       function compileRawCode ($rawCode, $setMatchAsCode=false);
+
+       /**
+        * Renames a variable in code and in stack
+        *
+        * @param       $oldName        Old name of variable
+        * @param       $newName        New name of variable
+        * @return      void
+        */
+       function renameVariable ($oldName, $newName);
+
+       /**
+        * Renders the given XML content
+        *
+        * @param       $content        Valid XML content or if not set the current loaded raw content
+        * @return      void
+        * @throws      XmlParserException      If an XML error was found
+        */
+       function renderXmlContent ($content = NULL);
+
+       /**
+        * Enables or disables language support
+        *
+        * @param       $languageSupport        New language support setting
+        * @return      void
+        */
+       function enableLanguageSupport ($languageSupport = true);
+
+       /**
+        * Checks whether language support is enabled
+        *
+        * @return      $languageSupport        Whether language support is enabled or disabled
+        */
+       function isLanguageSupportEnabled ();
+
+       /**
+        * Enables or disables XML compacting
+        *
+        * @param       $xmlCompacting  New XML compacting setting
+        * @return      void
+        */
+       function enableXmlCompacting ($xmlCompacting = true);
+
+       /**
+        * Checks whether XML compacting is enabled
+        *
+        * @return      $xmlCompacting  Whether XML compacting is enabled or disabled
+        */
+       function isXmlCompactingEnabled ();
+
+       /**
+        * Removes all comments, tabs and new-line charcters to compact the content
+        *
+        * @param       $uncompactedContent             The uncompacted content
+        * @return      $compactedContent               The compacted content
+        */
+       function compactContent ($uncompactedContent);
+}
 
 // [EOF]
 ?>
 
 // [EOF]
 ?>