inc/classes/main/debug/class_DebugConsoleOutput.php -text
inc/classes/main/debug/class_DebugErrorLogOutput.php -text
inc/classes/main/debug/class_DebugWebOutput.php -text
+inc/classes/main/decorator/.htaccess -text
+inc/classes/main/decorator/class_BaseDecorator.php -text
+inc/classes/main/decorator/template/.htaccess -text
+inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php -text
+inc/classes/main/decorator/xml/.htaccess -text
+inc/classes/main/decorator/xml/class_XmlCompactorDecorator.php -text
inc/classes/main/discovery/.htaccess -text
inc/classes/main/discovery/class_ -text
inc/classes/main/discovery/class_BaseDiscovery.php -text
/setup-repos.sh -text
/svn-externals.txt -text
templates/.htaccess -text
+templates/README.1st -text
templates/_compiled/.htaccess -text
templates/images/.htaccess -text
templates/images/_cache/.htaccess -text
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
*/
- 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
*/
- function compileVariables ();
+ function compileTemplate ();
+ /**
+ * Adds a variable to current group
+ *
+ * @param $var Variable to set
+ * @param $value Value to store in variable
+ * @return void
+ */
+ function addGroupVariable ($var, $value);
/**
- * Compile all required code/web/email-templates into the current one
+ * Removes a given variable
*
+ * @param $var The variable we are looking for
* @return void
*/
- function compileTemplate ();
+ function removeVariable ($var);
+
+ /**
+ * Assign a given congfiguration variable with a value
+ *
+ * @param $var The configuration variable we want to assign
+ * @return void
+ */
+ function assignConfigVariable ($var);
+
+ /**
+ * 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
+ */
+ 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);
/**
- * 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.
+ * Assigns all the application data with template variables
*
+ * @param $appInstance A manageable application instance
* @return void
*/
- function output ();
+ function assignApplicationData (ManageableApplication $appInstance);
+
+ /**
+ * "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 wether language support is enabled
+ *
+ * @return $languageSupport Wether 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 wether XML compacting is enabled
+ *
+ * @return $xmlCompacting Wether XML compacting is enabled or disabled
+ */
+ function isXmlCompactingEnabled ();
}
// [EOF]
?>
+
*/
private $compressorInstance = null;
+ /**
+ * A Parseable instance
+ */
+ private $parserInstance = null;
+
/**
* The real class name
*/
public final function getCompressorInstance () {
return $this->compressorInstance;
}
+
+ /**
+ * Setter for Parseable instanxe
+ *
+ * @param $parserInstance An instance of an Parseable
+ * @return void
+ */
+ public final function setParserInstance (Parseable $parserInstance) {
+ $this->parserInstance = $parserInstance;
+ }
+
+ /**
+ * Getter for Parseable instanxe
+ *
+ * @return $parserInstance An instance of an Parseable
+ */
+ public final function getParserInstance () {
+ return $this->parserInstance;
+ }
}
// [EOF]
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A general Decorator
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseDecorator extends BaseHubSystem {
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A decorator for XML template engines which rewrites the XML for compacting
+ * it.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableTemplate {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of the class TemplateEngine and prepares it for usage
+ *
+ * @param $innerTemplateInstance A CompileableTemplate instance
+ * @return $templateInstance An instance of TemplateEngine
+ */
+ public final static function createXmlRewriterTemplateDecorator (CompileableTemplate $innerTemplateInstance) {
+ // Get a new instance
+ $templateInstance = new XmlRewriterTemplateDecorator();
+
+ // Set the inner template engine
+ $templateInstance->setTemplateInstance($innerTemplateInstance);
+
+ // Return the prepared instance
+ return $templateInstance;
+ }
+
+ /**
+ * Settter for variable group
+ *
+ * @param $groupName Name of variable group
+ * @param $add Wether add this group
+ * @return void
+ */
+ public function setVariableGroup ($groupName, $add = true) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->setVariableGroup($groupName, $add);
+ }
+
+ /**
+ * Adds a variable to current group
+ *
+ * @param $var Variable to set
+ * @param $value Value to store in variable
+ * @return void
+ */
+ public function addGroupVariable ($var, $value) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->addGroupVariable($var, $value);
+ }
+
+ /**
+ * Setter for base path
+ *
+ * @param $templateBasePath The relative base path for all templates
+ * @return void
+ */
+ public final function setTemplateBasePath ($templateBasePath) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->setTemplateBasePath($templateBasePath);
+ }
+
+ /**
+ * Getter for base path
+ *
+ * @return $templateBasePath The relative base path for all templates
+ */
+ public final function getTemplateBasePath () {
+ // Call the inner class' method
+ return $this->getTemplateInstance()->getTemplateBasePath();
+ }
+
+ /**
+ * Getter for generic base path
+ *
+ * @return $templateBasePath The relative base path for all templates
+ */
+ public final function getGenericBasePath () {
+ // Call the inner class' method
+ return $this->getTemplateInstance()->getGenericBasePath();
+ }
+
+ /**
+ * Setter for template extension
+ *
+ * @param $templateExtension The file extension for all uncompiled templates
+ * @return void
+ */
+ public final function setRawTemplateExtension ($templateExtension) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->setRawTemplateExtension($templateExtension);
+ }
+
+ /**
+ * Setter for code template extension
+ *
+ * @param $codeExtension The file extension for all uncompiled templates
+ * @return void
+ */
+ public final function setCodeTemplateExtension ($codeExtension) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->setCodeTemplateExtension($codeExtension);
+ }
+
+ /**
+ * Getter for template extension
+ *
+ * @return $templateExtension The file extension for all uncompiled templates
+ */
+ public final function getRawTemplateExtension () {
+ // Call the inner class' method
+ return $this->getTemplateInstance()->getRawTemplateExtension();
+ }
+
+ /**
+ * Getter for code-template extension
+ *
+ * @return $codeExtension The file extension for all code templates
+ */
+ public final function getCodeTemplateExtension () {
+ // Call the inner class' method
+ return $this->getTemplateInstance()->getCodeTemplateExtension();
+ }
+
+ /**
+ * Setter for path of compiled templates
+ *
+ * @param $compileOutputPath The local base path for all compiled templates
+ * @return void
+ */
+ public final function setCompileOutputPath ($compileOutputPath) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->setCompileOutputPath($compileOutputPath);
+ }
+
+ /**
+ * Getter for template type
+ *
+ * @return $templateType The current template's type
+ */
+ public final function getTemplateType () {
+ // Call the inner class' method
+ return $this->getTemplateInstance()->getTemplateType();
+ }
+
+ /**
+ * Assign (add) a given variable with a value
+ *
+ * @param $var The variable we are looking for
+ * @param $value The value we want to store in the variable
+ * @return void
+ * @throws EmptyVariableException If the variable name is left empty
+ */
+ public final function assignVariable ($var, $value) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->assignVariable($var, $value);
+ }
+
+ /**
+ * Removes a given variable
+ *
+ * @param $var The variable we are looking for
+ * @return void
+ */
+ public final function removeVariable ($var) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->removeVariable($var);
+ }
+
+ /**
+ * Getter for compiled templates
+ *
+ * @return $compiledData Compiled template data
+ */
+ public final function getCompiledData () {
+ // Call the inner class' method
+ return $this->getTemplateInstance()->getCompiledData();
+ }
+
+ /**
+ * Load a specified web template into the engine
+ *
+ * @param $template The web template we shall load which is located in
+ * 'html' by default
+ * @return void
+ */
+ public function loadWebTemplate ($template) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->loadWebTemplate($template);
+ }
+
+ /**
+ * Assign a given congfiguration variable with a value
+ *
+ * @param $var The configuration variable we want to assign
+ * @return void
+ */
+ public function assignConfigVariable ($var) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->assignConfigVariable($var);
+ }
+
+ /**
+ * Load a specified code template into the engine
+ *
+ * @param $template The code template we shall load which is
+ * located in 'code' by default
+ * @return void
+ */
+ public function loadCodeTemplate ($template) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->loadCodeTemplate($template);
+ }
+
+ /**
+ * 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
+ */
+ public final function compileConfigInVariables () {
+ // Call the inner class' method
+ $this->getTemplateInstance()->compileConfigInVariables();
+ }
+
+ /**
+ * Compile all variables by inserting their respective values
+ *
+ * @return void
+ */
+ public final function compileVariables () {
+ // Call the inner class' method
+ $this->getTemplateInstance()->compileVariables();
+ }
+
+ /**
+ * Compile all required templates into the current loaded one
+ *
+ * @return void
+ */
+ public function compileTemplate () {
+ // Call the inner class' method
+ $this->getTemplateInstance()->compileTemplate();
+ }
+
+ /**
+ * 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
+ */
+ public function assignTemplateWithVariable ($templateName, $variableName) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->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
+ */
+ public function transferToResponse (Responseable $responseInstance) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->transportToResponse($responseInstance);
+ }
+
+ /**
+ * Assigns all the application data with template variables
+ *
+ * @param $appInstance A manageable application instance
+ * @return void
+ */
+ public function assignApplicationData (ManageableApplication $appInstance) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->assignApplicationData($appInstance);
+ }
+
+ /**
+ * "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
+ */
+ public function compileRawCode ($rawCode, $setMatchAsCode=false) {
+ return $this->getTemplateInstance()->compileRawCode($rawCode, $setMatchAsCode);
+ }
+
+ /**
+ * Getter for variable group array
+ *
+ * @return $vargroups All variable groups
+ */
+ public final function getVariableGroups () {
+ // Call the inner class' method
+ return $this->getTemplateInstance()->getVariableGroups();
+ }
+
+ /**
+ * Renames a variable in code and in stack
+ *
+ * @param $oldName Old name of variable
+ * @param $newName New name of variable
+ * @return void
+ */
+ public function renameVariable ($oldName, $newName) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->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
+ */
+ public function renderXmlContent ($content = null) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->renderXmlContent($content);
+ }
+
+ /**
+ * Enables or disables language support
+ *
+ * @param $languageSupport New language support setting
+ * @return void
+ */
+ public final function enableLanguageSupport ($languageSupport = true) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->enableLanguageSupport($languageSupport);
+ }
+
+ /**
+ * Checks wether language support is enabled
+ *
+ * @return $languageSupport Wether language support is enabled or disabled
+ */
+ public final function isLanguageSupportEnabled () {
+ // Call the inner class' method
+ return $this->getTemplateInstance()->isLanguageSupportEnabled();
+ }
+
+ /**
+ * Enables or disables XML compacting
+ *
+ * @param $xmlCompacting New XML compacting setting
+ * @return void
+ */
+ public final function enableXmlCompacting ($xmlCompacting = true) {
+ // Call the inner class' method
+ $this->getTemplateInstance()->enableXmlCompacting($xmlCompacting);
+ }
+
+ /**
+ * Checks wether XML compacting is enabled
+ *
+ * @return $xmlCompacting Wether XML compacting is enabled or disabled
+ */
+ public final function isXmlCompactingEnabled () {
+ // Call the inner class' method
+ return $this->getTemplateInstance()->isXmlCompactingEnabled();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A XML compacting decorator class for XML parsers
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class XmlCompactorDecorator extends BaseDecorator implements Parseable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of the class Parser and prepares it for usage
+ *
+ * @param $innerParserInstance A Parseable instance
+ * @return $parserInstance An instance of this parser
+ */
+ public final static function createXmlCompactorDecorator (Parseable $innerParserInstance) {
+ // Get a new instance
+ $parserInstance = new XmlCompactorDecorator();
+
+ // Get a new decorator instance for the template engine
+ $templateInstance = ObjectFactory::createObjectByConfiguredName('deco_xml_rewriter_template_class', array($innerParserInstance->getTemplateInstance()));
+
+ // Re-set the parser's template instance to the decorator instance
+ $innerParserInstance->setTemplateInstance($templateInstance);
+
+ // Set the inner parser instance
+ $parserInstance->setParserInstance($innerParserInstance);
+
+ // Return the prepared instance
+ return $parserInstance;
+ }
+
+ /**
+ * Parses the given XML content
+ *
+ * @param $content Valid XML content
+ * @return void
+ * @throws XmlCompactorDecoratorException If an XML error was found
+ */
+ public function parseXmlContent ($content) {
+ // Parse the content
+ $this->getParserInstance()->parseXmlContent($content);
+ }
+}
+
+// [EOF]
+?>
$templatePrefix = $this->getConfigInstance()->getConfigEntry('email_tpl_' . $templateName);
// Load this email template
- $this->getTemplateInstance()->loadEmailTemplate($templatePrefix . '_' . $templateName);
+ // @TODO This needs testing/fixes because the deprecated method
+ // loadEmailTemplate() has been removed from interface CompileableTemplate.
+ $this->getTemplateInstance()->loadCodeTemplate($templatePrefix . '_' . $templateName);
}
/**
*/
private $languageSupport = true;
+ /**
+ * XML compacting is disabled by default
+ */
+ private $xmlCompacting = false;
+
// Exception codes for the template engine
const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED = 0x110;
const EXCEPTION_TEMPLATE_CONTAINS_INVALID_VAR = 0x111;
* Search for a variable in the stack
*
* @param $var The variable we are looking for
+ * @param $stack Optional variable stack to look in
* @return $idx FALSE means not found, >=0 means found on a specific index
*/
- private function isVariableAlreadySet ($var) {
+ private function isVariableAlreadySet ($var, $stack = null) {
// First everything is not found
$found = false;
+ // If the stack is null, use the current group
+ if (is_null($stack)) $stack = $this->currGroup;
+
// Is the group there?
- if (isset($this->varStack[$this->currGroup])) {
+ if ($this->isVarStackSet($stack)) {
// Now search for it
- foreach ($this->varStack[$this->currGroup] as $idx => $currEntry) {
- //* DEBUG: */ echo __METHOD__.":currGroup={$this->currGroup},idx={$idx},currEntry={$currEntry['name']},var={$var}<br />\n";
+ foreach ($this->getVarStack($stack) as $idx => $currEntry) {
+ //* DEBUG: */ echo __METHOD__.":currGroup={$stack},idx={$idx},currEntry={$currEntry['name']},var={$var}<br />\n";
// Is the entry found?
if ($currEntry['name'] == $var) {
// Found!
return $found;
}
+ /**
+ * Checks wether the given variable stack is set
+ *
+ * @param $stack Variable stack to check
+ * @return $isSet Wether the given variable stack is set
+ */
+ protected final function isVarStackSet ($stack) {
+ // Check it
+ $isSet = isset($this->varStack[$stack]);
+
+ // Return result
+ return $isSet;
+ }
+
+ /**
+ * Getter for given variable stack
+ *
+ * @param $stack Variable stack to check
+ * @return $varStack Found variable stack
+ */
+ public final function getVarStack ($stack) {
+ return $this->varStack[$stack];
+ }
+
/**
* Return a content of a variable or null if not found
*
* @param $var The variable we are looking for
+ * @param $stack Optional variable stack to look in
* @return $content Content of the variable or null if not found
*/
- protected function readVariable ($var) {
+ protected function readVariable ($var, $stack = null) {
// First everything is not found
$content = null;
+ // If the stack is null, use the current group
+ if (is_null($stack)) $stack = $this->currGroup;
+
// Get variable index
- $found = $this->isVariableAlreadySet($var);
+ $found = $this->isVariableAlreadySet($var, $stack);
// Is the variable found?
if ($found !== false) {
// Read it
- $content = $this->varStack[$this->currGroup][$found]['value'];
+ $content = $this->getVariableValue($stack, $found);
} // END - if
// Return the current position
- //* DEBUG: */ echo __METHOD__.": group=".$this->currGroup.",var=".$var.", content[".gettype($content)."]=".$content."<br />\n";
+ //* DEBUG: */ echo __METHOD__.": group=".$stack.",var=".$var.", content[".gettype($content)."]=".$content."<br />\n";
return $content;
}
$result = array();
// Is the group there?
- if (isset($this->varStack[$this->currGroup])) {
+ if ($this->isVarStackSet($this->currGroup)) {
// Then use it
- $result = $this->varStack[$this->currGroup];
+ $result = $this->getVarStack($this->currGroup);
} // END - if
// Return result
*
* @param $groupName Name of variable group
* @param $add Wether add this group
- * @retur4n void
+ * @return void
*/
public function setVariableGroup ($groupName, $add = true) {
// Set group name
);
// Add it to the stack
- $this->varStack[$this->currGroup] = $currVars;
+ $this->setVarStack($this->currGroup, $currVars);
}
/**
// Is the variable set?
if ($idx !== false) {
// Then modify it
- $this->varStack[$this->currGroup][$idx]['value'] = $value;
+ $this->setVariableValue($this->currGroup, $idx, $value);
} // END - if
}
protected final function setRawTemplateData ($rawTemplateData) {
// And store it in this class
//* DEBUG: */ echo __METHOD__.':'.$this->getUniqueId().': '.strlen($rawTemplateData).' Bytes set.<br />\n';
- //* DEBUG: */ echo $this->currGroup.' variables: '.count($this->varStack[$this->currGroup]).', groups='.count($this->varStack).'<br />\n';
+ //* DEBUG: */ echo $this->currGroup.' variables: '.count($this->getVarStack($this->currGroup)).', groups='.count($this->varStack).'<br />\n';
$this->rawTemplateData = (string) $rawTemplateData;
}
// Recursive protection:
$this->loadedTemplates[] = $template;
- } elseif (isset($this->varStack['config'][$template])) {
+ } elseif ($this->isVariableAlreadySet($template, 'config')) {
// Use that content here
- $this->loadedRawData[$template] = $this->varStack['config'][$template];
+ $this->loadedRawData[$template] = $this->readVariable($template, 'config');
// Recursive protection:
$this->loadedTemplates[] = $template;
$content = $this->getRawTemplateData();
//* DEBUG: */ echo __METHOD__.': content before='.strlen($content).' ('.md5($content).')<br />\n';
+ // Do we have the stack?
+ if (!$this->isVarStackSet('general')) {
+ // Abort here silently
+ // @TODO This silent abort should be logged, maybe.
+ return;
+ } // END - if
+
// Walk through all variables
- foreach ($this->varStack['general'] as $currEntry) {
+ foreach ($this->getVarStack('general') as $currEntry) {
//* DEBUG: */ echo __METHOD__.': name='.$currEntry['name'].', value=<pre>'.htmlentities($currEntry['value']).'</pre>\n';
// Replace all [$var] or {?$var?} with the content
// @TODO Old behaviour, will become obsolete!
- $content = str_replace("\$content[".$currEntry['name'].']', $currEntry['value'], $content);
+ $content = str_replace('$content[' . $currEntry['name'] . ']', $currEntry['value'], $content);
// @TODO Yet another old way
- $content = str_replace('['.$currEntry['name'].']', $currEntry['value'], $content);
+ $content = str_replace('[' . $currEntry['name'] . ']', $currEntry['value'], $content);
// The new behaviour
- $content = str_replace('{?'.$currEntry['name'].'?}', $currEntry['value'], $content);
+ $content = str_replace('{?' . $currEntry['name'] . '?}', $currEntry['value'], $content);
} // END - for
//* DEBUG: */ echo __METHOD__.': content after='.strlen($content).' ('.md5($content).')<br />\n';
public function assignConfigVariable ($var) {
// Sweet and simple...
//* DEBUG: */ echo __METHOD__.':var={$var}<br />\n';
- $this->varStack['config'][$var] = $this->getConfigInstance()->getConfigEntry($var);
- }
-
- /**
- * Load a specified email template into the engine
- *
- * @param $template The email template we shall load which is located in
- * 'emails' by default
- * @return void
- * @deprecated
- * @see See loadCodeTemplate()
- */
- public function loadEmailTemplate ($template) {
- // Set template type
- $this->setTemplateType($this->getConfigInstance()->getConfigEntry('email_template_type'));
-
- // Load the special template
- $this->loadTemplate($template);
+ $this->setVariable('config', $var, $this->getConfigInstance()->getConfigEntry($var));
}
/**
* @return void
*/
public final function compileConfigInVariables () {
+ // Do we have the stack?
+ if (!$this->isVarStackSet('general')) {
+ // Abort here silently
+ // @TODO This silent abort should be logged, maybe.
+ return;
+ } // END - if
+
// Iterate through all general variables
- foreach ($this->varStack['general'] as $idx=>$currVariable) {
+ foreach ($this->getVarStack('general') as $idx=>$currVariable) {
// Compile the value
$value = $this->compileRawCode($this->readVariable($currVariable['name']), true);
// Remove it from stack
- unset($this->varStack['general'][$idx]);
+ $this->removeVariable($idx, 'general');
// Re-assign the variable
$this->assignConfigVariable($value);
$dummy = array();
// Iterate through all general variables
- foreach ($this->varStack['general'] as $currVariable) {
+ foreach ($this->getVarStack('general') as $currVariable) {
// Transfer it's name/value combination to the $content array
//* DEBUG: */ echo $currVariable['name'].'=<pre>'.htmlentities($currVariable['value']).'</pre>\n';
$dummy[$currVariable['name']] = $currVariable['value'];
// Prepare all configuration variables
$config = null;
- if (isset($this->varStack['config'])) {
- $config = $this->varStack['config'];
+ if ($this->isVarStackSet('config')) {
+ $config = $this->getVarStack('config');
} // END - if
// Remove some variables
} // END - if($templateMatches ...
}
- /**
- * A old deprecated method
- *
- * @return void
- * @deprecated
- * @see BaseTemplateEngine::transferToResponse
- */
- public function output () {
- // Check which type of template we have
- switch ($this->getTemplateType()) {
- case 'html': // Raw HTML templates can be send to the output buffer
- // Quick-N-Dirty:
- $this->getWebOutputInstance()->output($this->getCompiledData());
- break;
-
- default: // Unknown type found
- // Construct message
- $msg = sprintf("[%s->%s] Unknown/unsupported template type <span class=\"data\">%s</span> detected.",
- $this->__toString(),
- __FUNCTION__,
- $this->getTemplateType()
- );
-
- // Write the problem to the world...
- $this->debugOutput($msg);
- break;
- } // END - switch
- }
-
/**
* Loads a given view helper (by name)
*
// Get a XmlParser instance
$parserInstance = ObjectFactory::createObjectByConfiguredName('xml_parser_class', array($this));
+ // Check if we have XML compacting enabled
+ if ($this->isXmlCompactingEnabled()) {
+ // Yes, so get a decorator class for transparent compacting
+ $parserInstance = ObjectFactory::createObjectByConfiguredName('deco_compacting_xml_parser_class', array($parserInstance));
+ } // END - if
+
// Parse the XML document
$parserInstance->parseXmlContent($content);
}
public final function isLanguageSupportEnabled () {
return $this->languageSupport;
}
+
+ /**
+ * Enables or disables XML compacting
+ *
+ * @param $xmlCompacting New XML compacting setting
+ * @return void
+ */
+ public final function enableXmlCompacting ($xmlCompacting = true) {
+ $this->xmlCompacting = (bool) $xmlCompacting;
+ }
+
+ /**
+ * Checks wether XML compacting is enabled
+ *
+ * @return $xmlCompacting Wether XML compacting is enabled or disabled
+ */
+ public final function isXmlCompactingEnabled () {
+ return $this->xmlCompacting;
+ }
}
// [EOF]
* @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
+ * @todo This template engine does not make use of setTemplateType()
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Creates an instance of the class TemplateEngine and prepares it for usage
*
* @param $appInstance A manageable application
- * @return $tplInstance An instance of TemplateEngine
+ * @return $templateInstance An instance of TemplateEngine
* @throws BasePathIsEmptyException If the provided $templateBasePath is empty
* @throws InvalidBasePathStringException If $templateBasePath is no string
* @throws BasePathIsNoDirectoryException If $templateBasePath is no
*/
public final static function createConsoleTemplateEngine (ManageableApplication $appInstance) {
// Get a new instance
- $tplInstance = new ConsoleTemplateEngine();
+ $templateInstance = new ConsoleTemplateEngine();
// Get language and file I/O instances from application
$langInstance = $appInstance->getLanguageInstance();
$ioInstance = $appInstance->getFileIoInstance();
// Determine base path
- $templateBasePath = $tplInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
+ $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
// Is the base path valid?
if (empty($templateBasePath)) {
// Base path is empty
- throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ throw new BasePathIsEmptyException($templateInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (!is_string($templateBasePath)) {
// Is not a string
- throw new InvalidBasePathStringException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_STRING);
+ throw new InvalidBasePathStringException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_STRING);
} elseif (!is_dir($templateBasePath)) {
// Is not a path
- throw new BasePathIsNoDirectoryException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
+ throw new BasePathIsNoDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
} elseif (!is_readable($templateBasePath)) {
// Is not readable
- throw new BasePathReadProtectedException(array($tplInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
+ throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
}
// Get configuration instance
$configInstance = FrameworkConfiguration::getInstance();
// Set the base path
- $tplInstance->setTemplateBasePath($templateBasePath);
+ $templateInstance->setTemplateBasePath($templateBasePath);
// Set the language and IO instances
- $tplInstance->setLanguageInstance($langInstance);
- $tplInstance->setFileIoInstance($ioInstance);
+ $templateInstance->setLanguageInstance($langInstance);
+ $templateInstance->setFileIoInstance($ioInstance);
// Set template extensions
- $tplInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension'));
- $tplInstance->setCodeTemplateExtension($configInstance->getConfigEntry('code_template_extension'));
+ $templateInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension'));
+ $templateInstance->setCodeTemplateExtension($configInstance->getConfigEntry('code_template_extension'));
// Absolute output path for compiled templates
- $tplInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path'));
+ $templateInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path'));
// Return the prepared instance
- return $tplInstance;
+ return $templateInstance;
}
}
* Creates an instance of the class TemplateEngine and prepares it for usage
*
* @param $appInstance A manageable application
- * @return $tplInstance An instance of TemplateEngine
+ * @return $templateInstance An instance of TemplateEngine
* @throws BasePathIsEmptyException If the provided $templateBasePath is empty
* @throws InvalidBasePathStringException If $templateBasePath is no string
* @throws BasePathIsNoDirectoryException If $templateBasePath is no
* @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
+ * @todo This template engine does not make use of setTemplateType()
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/**
* Main nodes in the XML tree
*/
- private $mainNodes = array("mail-data");
+ private $mainNodes = array(
+ 'mail-data'
+ );
/**
* Sub nodes in the XML tree
* Creates an instance of the class TemplateEngine and prepares it for usage
*
* @param $appInstance A manageable application
- * @return $tplInstance An instance of TemplateEngine
+ * @return $templateInstance An instance of TemplateEngine
* @throws BasePathIsEmptyException If the provided $templateBasePath is empty
* @throws InvalidBasePathStringException If $templateBasePath is no string
* @throws BasePathIsNoDirectoryException If $templateBasePath is no
*/
public final static function createMailTemplateEngine (ManageableApplication $appInstance) {
// Get a new instance
- $tplInstance = new MailTemplateEngine();
+ $templateInstance = new MailTemplateEngine();
// Get language and file I/O instances from application
$langInstance = $appInstance->getLanguageInstance();
$ioInstance = $appInstance->getFileIoInstance();
// Determine base path
- $templateBasePath = $tplInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
+ $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
// Is the base path valid?
if (empty($templateBasePath)) {
// Base path is empty
- throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ throw new BasePathIsEmptyException($templateInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (!is_string($templateBasePath)) {
// Is not a string
- throw new InvalidBasePathStringException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_STRING);
+ throw new InvalidBasePathStringException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_STRING);
} elseif (!is_dir($templateBasePath)) {
// Is not a path
- throw new BasePathIsNoDirectoryException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
+ throw new BasePathIsNoDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
} elseif (!is_readable($templateBasePath)) {
// Is not readable
- throw new BasePathReadProtectedException(array($tplInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
+ throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
}
// Get configuration instance
$configInstance = FrameworkConfiguration::getInstance();
// Set the base path
- $tplInstance->setTemplateBasePath($templateBasePath);
+ $templateInstance->setTemplateBasePath($templateBasePath);
// Set the language and IO instances
- $tplInstance->setLanguageInstance($langInstance);
- $tplInstance->setFileIoInstance($ioInstance);
+ $templateInstance->setLanguageInstance($langInstance);
+ $templateInstance->setFileIoInstance($ioInstance);
// Set template extensions
- $tplInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension'));
- $tplInstance->setCodeTemplateExtension($configInstance->getConfigEntry('code_template_extension'));
+ $templateInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension'));
+ $templateInstance->setCodeTemplateExtension($configInstance->getConfigEntry('code_template_extension'));
// Absolute output path for compiled templates
- $tplInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path'));
+ $templateInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path'));
// Return the prepared instance
- return $tplInstance;
+ return $templateInstance;
}
/**
*
* @param $appInstance A manageable application
* @param $menuInstance A RenderableMenu instance
- * @return $tplInstance An instance of TemplateEngine
+ * @return $templateInstance An instance of TemplateEngine
* @throws BasePathIsEmptyException If the provided $templateBasePath is empty
* @throws InvalidBasePathStringException If $templateBasePath is no string
* @throws BasePathIsNoDirectoryException If $templateBasePath is no
*/
public final static function createMenuTemplateEngine (ManageableApplication $appInstance, RenderableMenu $menuInstance) {
// Get a new instance
- $tplInstance = new MenuTemplateEngine();
+ $templateInstance = new MenuTemplateEngine();
// Get language and file I/O instances from application
$langInstance = $appInstance->getLanguageInstance();
$ioInstance = $appInstance->getFileIoInstance();
// Determine base path
- $templateBasePath = $tplInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
+ $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
// Is the base path valid?
if (empty($templateBasePath)) {
// Base path is empty
- throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ throw new BasePathIsEmptyException($templateInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (!is_string($templateBasePath)) {
// Is not a string
- throw new InvalidBasePathStringException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_STRING);
+ throw new InvalidBasePathStringException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_STRING);
} elseif (!is_dir($templateBasePath)) {
// Is not a path
- throw new BasePathIsNoDirectoryException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
+ throw new BasePathIsNoDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
} elseif (!is_readable($templateBasePath)) {
// Is not readable
- throw new BasePathReadProtectedException(array($tplInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
+ throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
}
// Get configuration instance
$configInstance = FrameworkConfiguration::getInstance();
// Set the base path
- $tplInstance->setTemplateBasePath($templateBasePath);
+ $templateInstance->setTemplateBasePath($templateBasePath);
// Set the language and IO instances
- $tplInstance->setLanguageInstance($langInstance);
- $tplInstance->setFileIoInstance($ioInstance);
+ $templateInstance->setLanguageInstance($langInstance);
+ $templateInstance->setFileIoInstance($ioInstance);
// Set template extensions
- $tplInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension'));
- $tplInstance->setCodeTemplateExtension($configInstance->getConfigEntry('menu_template_extension'));
+ $templateInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension'));
+ $templateInstance->setCodeTemplateExtension($configInstance->getConfigEntry('menu_template_extension'));
// Absolute output path for compiled templates
- $tplInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path'));
+ $templateInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path'));
// Set the menu instance
- $tplInstance->setMenuInstance($menuInstance);
+ $templateInstance->setMenuInstance($menuInstance);
// Init a variable stacker
$stackerInstance = ObjectFactory::createObjectByConfiguredName('menu_stacker_class');
// Set it
- $tplInstance->setStackerInstance($stackerInstance);
+ $templateInstance->setStackerInstance($stackerInstance);
// Return the prepared instance
- return $tplInstance;
+ return $templateInstance;
}
/**
* Creates an instance of the class TemplateEngine and prepares it for usage
*
* @param $appInstance A manageable application
- * @return $tplInstance An instance of TemplateEngine
+ * @return $templateInstance An instance of TemplateEngine
* @throws BasePathIsEmptyException If the provided $templateBasePath is empty
* @throws InvalidBasePathStringException If $templateBasePath is no string
* @throws BasePathIsNoDirectoryException If $templateBasePath is no
*/
public final static function createWebTemplateEngine (ManageableApplication $appInstance) {
// Get a new instance
- $tplInstance = new WebTemplateEngine();
+ $templateInstance = new WebTemplateEngine();
// Get language and file I/O instances from application
$langInstance = $appInstance->getLanguageInstance();
$ioInstance = $appInstance->getFileIoInstance();
// Determine base path
- $templateBasePath = $tplInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
+ $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $appInstance->getRequestInstance()->getRequestElement('app') . '/';
// Is the base path valid?
if (empty($templateBasePath)) {
// Base path is empty
- throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ throw new BasePathIsEmptyException($templateInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (!is_string($templateBasePath)) {
// Is not a string
- throw new InvalidBasePathStringException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_STRING);
+ throw new InvalidBasePathStringException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_STRING);
} elseif (!is_dir($templateBasePath)) {
// Is not a path
- throw new BasePathIsNoDirectoryException(array($tplInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
+ throw new BasePathIsNoDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
} elseif (!is_readable($templateBasePath)) {
// Is not readable
- throw new BasePathReadProtectedException(array($tplInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
+ throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
}
// Get configuration instance
$configInstance = FrameworkConfiguration::getInstance();
// Set the base path
- $tplInstance->setTemplateBasePath($templateBasePath);
+ $templateInstance->setTemplateBasePath($templateBasePath);
// Set the language and IO instances
- $tplInstance->setLanguageInstance($langInstance);
- $tplInstance->setFileIoInstance($ioInstance);
+ $templateInstance->setLanguageInstance($langInstance);
+ $templateInstance->setFileIoInstance($ioInstance);
// Set template extensions
- $tplInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension'));
- $tplInstance->setCodeTemplateExtension($configInstance->getConfigEntry('code_template_extension'));
+ $templateInstance->setRawTemplateExtension($configInstance->getConfigEntry('raw_template_extension'));
+ $templateInstance->setCodeTemplateExtension($configInstance->getConfigEntry('code_template_extension'));
// Absolute output path for compiled templates
- $tplInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path'));
+ $templateInstance->setCompileOutputPath($configInstance->getConfigEntry('base_path') . $configInstance->getConfigEntry('compile_output_path'));
// Return the prepared instance
- return $tplInstance;
+ return $templateInstance;
}
}
// CFG: TEMPLATE-CLASS
$cfg->setConfigEntry('web_template_class', 'WebTemplateEngine');
+// CFG: DECO-XML-REWRITER-TEMPLATE-CLASS
+$cfg->setConfigEntry('deco_xml_rewriter_template_class', 'XmlRewriterTemplateDecorator');
+
// CFG: DEBUG-CLASS
$cfg->setConfigEntry('debug_class', 'DebugWebOutput');
// CFG: XML-PARSER-CLASS
$cfg->setConfigEntry('xml_parser_class', 'XmlParser');
+// CFG: DECO-COMPACTING-XML-PARSER-CLASS
+$cfg->setConfigEntry('deco_compacting_xml_parser_class', 'XmlCompactorDecorator');
+
// CFG: MATH-PRIME
$cfg->setConfigEntry('math_prime', 591623);
#!/bin/sh
-# A little helper script of mine to setup a new development check-out directory
+# A little helper script of mine to setup a new development check-out directory.
+# This script should be called where you want to create the repository and 'core'
+# must be in the same directory. This script is public domain, if it blows up
+# your washing maschine or your refrigerator stops working, this script is maybe
+# not responsible for this, ask your trusted electrican. Use it on your own risk.
-if test "$1" == ""; then
- echo "Usage: $0 <repos> Setup given repository locally."
+if test "${1}" == ""; then
+ echo "Usage: ${0} <repos> Setup given repository locally."
exit
-elif test -e "$1/.svn/"; then
- echo "$0: Repository $1 is possibly setup! Aborting..."
+elif test -e "${1}/.svn/"; then
+ echo "${0}: Repository ${1} is possibly setup! Aborting..."
exit
fi
-echo "$0: Checking out $1 ..."
-svn co svn+ssh://www.mxchange.org/var/www/svn-repos/$1/ || exit 255
-cd $1
-echo "$0: Creating base directories ..."
+echo "${0}: Checking out ${1} ..."
+svn co "svn+ssh://www.mxchange.org/var/www/svn-repos/${1}/" || exit 255
+cd "${1}"
+echo "${0}: Creating base directories ..."
svn mkdir branches tags trunk || exit 255
cd trunk
-echo "$0: Updating skeleton ..."
+echo "${0}: Updating skeleton ..."
svn up ../../skel/ || exit 255
-echo "$0: Importing skeleton repository ..."
+echo "${0}: Importing skeleton repository ..."
svn export --force ../../skel/trunk/ . || exit 255
svn add * || exit 255
-if test "$1" != "admin"; then
- echo "$0: Adding directory application/$1 ..."
- svn mkdir application/$1 || exit 255
+if test "${1}" != "admin"; then
+ echo "${0}: Adding directory application/${1} ..."
+ svn mkdir application/${1} || exit 255
else
- echo "$0: --- Not creating directory application/$1. ---"
+ echo "${0}: --- Not creating directory application/${1}. ---"
fi
-echo "$0: Linking to external 'core' repository ..."
+echo "${0}: Linking to external 'core' repository ..."
svn propset svn:externals -F ../../core/trunk/svn-externals.txt . || exit 255
-if (test "$1" != "admin" && test "$1" != "install"); then
+if (test "${1}" != "admin" && test "${1}" != "install"); then
cd application/
- if test "$1" != "qa"; then
+ if test "${1}" != "qa"; then
svn propset svn:externals -F ../../../core/trunk/application-external.txt . || exit 255
else
svn propset svn:externals "admin http://www.ship-simu.org/repos/admin/trunk/application/admin/
fi
cd .. # trunk
else
- echo "$0: --- Not setting admin external source. ---"
+ echo "${0}: --- Not setting admin external source. ---"
fi
cd .. # root
-echo "$0: Running commit ..."
+echo "${0}: Running commit ..."
svn commit -m "Initial import with linked core from skeleton" || exit 255
-echo "$0: Updating ..."
+echo "${0}: Updating ..."
svn up
-echo "$0: Exporting repositiory ..."
-svn export --force trunk/ /var/www/htdocs/$1
+echo "${0}: Exporting repositiory ..."
+svn export --force trunk/ /var/www/htdocs/${1}
cd .. # start
-echo "$0: All done."
+echo "${0}: All done."
--- /dev/null
+This directory is generic and therefor only for template caches. If you need
+templates for your application, please DO NOT put them in here. Instead create
+a directory named "templates" in your application's directory.
+
+@TODO This README needs some extending and should be then moved to docs/
+directory.
+