projects
/
core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
50705b4
)
Renamed variables, removeVariable() does not expect indexes
author
Roland Häder
<roland@mxchange.org>
Wed, 27 Jun 2012 16:57:40 +0000
(16:57 +0000)
committer
Roland Häder
<roland@mxchange.org>
Wed, 27 Jun 2012 16:57:40 +0000
(16:57 +0000)
inc/classes/interfaces/template/class_CompileableTemplate.php
patch
|
blob
|
history
inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php
patch
|
blob
|
history
inc/classes/main/template/class_BaseTemplateEngine.php
patch
|
blob
|
history
inc/config/class_FrameworkConfiguration.php
patch
|
blob
|
history
diff --git
a/inc/classes/interfaces/template/class_CompileableTemplate.php
b/inc/classes/interfaces/template/class_CompileableTemplate.php
index b54d9c68a47f9f13655898db4843025eb6734bce..41791914ee5581de90d9de32d04206018624081f 100644
(file)
--- a/
inc/classes/interfaces/template/class_CompileableTemplate.php
+++ b/
inc/classes/interfaces/template/class_CompileableTemplate.php
@@
-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 $var
iableName
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 ($var
iableName
, $value);
/**
* Load a specified web template into the engine
/**
* Load a specified web template into the engine
@@
-68,27
+68,27
@@
interface CompileableTemplate extends FrameworkInterface {
/**
* Adds a variable to current group
*
/**
* Adds a variable to current group
*
- * @param $var
Variable to set
- * @param $value Value to store in variable
+ * @param $var
iableName
Variable to set
+ * @param $value
Value to store in variable
* @return void
*/
* @return void
*/
- function addGroupVariable ($var, $value);
+ function addGroupVariable ($var
iableName
, $value);
/**
* Removes a given variable
*
/**
* Removes a given variable
*
- * @param $var
The variable we are looking for
+ * @param $var
iableName
The variable we are looking for
* @return void
*/
* @return void
*/
- function removeVariable ($var);
+ function removeVariable ($var
iableName
);
/**
* Assign a given congfiguration variable with a value
*
/**
* Assign a given congfiguration variable with a value
*
- * @param $var
The configuration variable we want to assign
+ * @param $var
iableName
The configuration variable we want to assign
* @return void
*/
* @return void
*/
- function assignConfigVariable ($var);
+ function assignConfigVariable ($var
iableName
);
/**
* Compiles configuration place-holders in all variables. This 'walks'
/**
* Compiles configuration place-holders in all variables. This 'walks'
diff --git
a/inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php
b/inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php
index ff33d1caf6bd5e792aff0cf3b988b7739735a93d..e2d0f4c4717b0e8bfcc6cc69ae8838ac64a6baec 100644
(file)
--- a/
inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php
+++ b/
inc/classes/main/decorator/template/class_XmlRewriterTemplateDecorator.php
@@
-184,12
+184,12
@@
class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableT
/**
* Removes a given variable
*
/**
* Removes a given variable
*
- * @param $var
The variable we are looking for
+ * @param $var
iableName
The variable we are looking for
* @return void
*/
* @return void
*/
- public final function removeVariable ($var) {
+ public final function removeVariable ($var
iableName
) {
// Call the inner class' method
// Call the inner class' method
- $this->getTemplateInstance()->removeVariable($var);
+ $this->getTemplateInstance()->removeVariable($var
iableName
);
}
/**
}
/**
@@
-217,12
+217,12
@@
class XmlRewriterTemplateDecorator extends BaseDecorator implements CompileableT
/**
* Assign a given congfiguration variable with a value
*
/**
* Assign a given congfiguration variable with a value
*
- * @param $var
The configuration variable we want to assign
+ * @param $var
iableName
The configuration variable we want to assign
* @return void
*/
* @return void
*/
- public function assignConfigVariable ($var) {
+ public function assignConfigVariable ($var
iableName
) {
// Call the inner class' method
// Call the inner class' method
- $this->getTemplateInstance()->assignConfigVariable($var);
+ $this->getTemplateInstance()->assignConfigVariable($var
iableName
);
}
/**
}
/**
diff --git
a/inc/classes/main/template/class_BaseTemplateEngine.php
b/inc/classes/main/template/class_BaseTemplateEngine.php
index a95838ec3cb117e8834566975ed9518a2b9c0faa..334ff102e899e7fae1ed29f665493effc436019e 100644
(file)
--- a/
inc/classes/main/template/class_BaseTemplateEngine.php
+++ b/
inc/classes/main/template/class_BaseTemplateEngine.php
@@
-167,13
+167,13
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
/**
* Search for a variable in the stack
*
/**
* Search for a variable in the stack
*
- * @param $var
The variable we are looking for
- * @param $stack Optional variable stack to look in
- * @return $index FALSE means not found, >=0 means found on a specific index
+ * @param $var
iableName
The variable we are looking for
+ * @param $stack
Optional variable stack to look in
+ * @return $index
FALSE means not found, >=0 means found on a specific index
*/
*/
- private function getVariableIndex ($var, $stack = NULL) {
+ private function getVariableIndex ($var
iableName
, $stack = NULL) {
// Replace all dashes to underscores to match variables with configuration entries
// Replace all dashes to underscores to match variables with configuration entries
- $var
= trim($this->convertDashesToUnderscores($var
));
+ $var
iableName = trim($this->convertDashesToUnderscores($variableName
));
// First everything is not found
$found = false;
// First everything is not found
$found = false;
@@
-189,9
+189,9
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
if ($this->isVarStackSet($stack)) {
// Now search for it
foreach ($this->getVarStack($stack) as $index => $currEntry) {
if ($this->isVarStackSet($stack)) {
// Now search for it
foreach ($this->getVarStack($stack) as $index => $currEntry) {
- //* DEBUG: */ $this->debugOutput(__METHOD__.':currGroup=' . $stack . ',idx=' . $index . ',currEntry=' . $currEntry['name'] . ',var
=' . $var
);
+ //* DEBUG: */ $this->debugOutput(__METHOD__.':currGroup=' . $stack . ',idx=' . $index . ',currEntry=' . $currEntry['name'] . ',var
iableName=' . $variableName
);
// Is the entry found?
// Is the entry found?
- if ($currEntry['name'] == $var) {
+ if ($currEntry['name'] == $var
iableName
) {
// Found!
//* DEBUG: */ $this->debugOutput(__METHOD__.':FOUND!');
$found = $index;
// Found!
//* DEBUG: */ $this->debugOutput(__METHOD__.':FOUND!');
$found = $index;
@@
-242,13
+242,13
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
/**
* Return a content of a variable or null if not found
*
/**
* 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
+ * @param $var
iableName
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, $stack = NULL) {
+ protected function readVariable ($var
iableName
, $stack = NULL) {
// Replace all dashes to underscores to match variables with configuration entries
// Replace all dashes to underscores to match variables with configuration entries
- $var
= trim($this->convertDashesToUnderscores($var
));
+ $var
iableName = trim($this->convertDashesToUnderscores($variableName
));
// First everything is not found
$content = NULL;
// First everything is not found
$content = NULL;
@@
-261,7
+261,7
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
} // END - if
// Get variable index
} // END - if
// Get variable index
- $found = $this->getVariableIndex($var, $stack);
+ $found = $this->getVariableIndex($var
iableName
, $stack);
// Is the variable found?
if ($found !== false) {
// Is the variable found?
if ($found !== false) {
@@
-270,23
+270,23
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
} // END - if
// Return the current position
} // END - if
// Return the current position
- //* DEBUG: */ $this->debugOutput(__METHOD__.': group=' . $stack . ',var
=' . $var
. ', content[' . gettype($content) . ']=' . $content);
+ //* DEBUG: */ $this->debugOutput(__METHOD__.': group=' . $stack . ',var
iableName=' . $variableName
. ', content[' . gettype($content) . ']=' . $content);
return $content;
}
/**
* Add a variable to the stack
*
return $content;
}
/**
* Add a variable to the stack
*
- * @param $var
The variable we are looking for
+ * @param $var
iableName
The variable we are looking for
* @param $value The value we want to store in the variable
* @return void
*/
* @param $value The value we want to store in the variable
* @return void
*/
- private function addVariable ($var, $value) {
+ private function addVariable ($var
iableName
, $value) {
// Set general variable group
$this->setVariableGroup('general');
// Add it to the stack
// Set general variable group
$this->setVariableGroup('general');
// Add it to the stack
- $this->addGroupVariable($var, $value);
+ $this->addGroupVariable($var
iableName
, $value);
}
/**
}
/**
@@
-330,22
+330,22
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
/**
* Adds a variable to current group
*
/**
* Adds a variable to current group
*
- * @param $var
Variable to set
- * @param $value Value to store in variable
+ * @param $var
iableName
Variable to set
+ * @param $value
Value to store in variable
* @return void
*/
* @return void
*/
- public function addGroupVariable ($var, $value) {
+ public function addGroupVariable ($var
iableName
, $value) {
// Replace all dashes to underscores to match variables with configuration entries
// Replace all dashes to underscores to match variables with configuration entries
- $var
= trim($this->convertDashesToUnderscores($var
));
+ $var
iableName = trim($this->convertDashesToUnderscores($variableName
));
// Debug message
// Debug message
- //* DEBUG: */ $this->debugOutput(__METHOD__.': group=' . $this->currGroup . ', var
=' . $var
. ', value=' . $value);
+ //* DEBUG: */ $this->debugOutput(__METHOD__.': group=' . $this->currGroup . ', var
iableName=' . $variableName
. ', value=' . $value);
// Get current variables in group
$currVars = $this->readCurrentGroup();
// Append our variable
// Get current variables in group
$currVars = $this->readCurrentGroup();
// Append our variable
- $currVars[] = $this->generateVariableArray($var, $value);
+ $currVars[] = $this->generateVariableArray($var
iableName
, $value);
// Add it to the stack
$this->setVarStack($this->currGroup, $currVars);
// Add it to the stack
$this->setVarStack($this->currGroup, $currVars);
@@
-366,22
+366,22
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
/**
* Modify an entry on the stack
*
/**
* Modify an entry on the stack
*
- * @param $var
The variable we are looking for
- * @param $value The value we want to store in the variable
+ * @param $var
iableName
The variable we are looking for
+ * @param $value
The value we want to store in the variable
* @return void
* @throws NoVariableException If the given variable is not found
*/
* @return void
* @throws NoVariableException If the given variable is not found
*/
- private function modifyVariable ($var, $value) {
+ private function modifyVariable ($var
iableName
, $value) {
// Replace all dashes to underscores to match variables with configuration entries
// Replace all dashes to underscores to match variables with configuration entries
- $var
= trim($this->convertDashesToUnderscores($var
));
+ $var
iableName = trim($this->convertDashesToUnderscores($variableName
));
// Get index for variable
// Get index for variable
- $index = $this->getVariableIndex($var);
+ $index = $this->getVariableIndex($var
iableName
);
// Is the variable set?
if ($index === false) {
// Unset variables cannot be modified
// Is the variable set?
if ($index === false) {
// Unset variables cannot be modified
- throw new NoVariableException(array($this, $var, $value), self::EXCEPTION_VARIABLE_IS_MISSING);
+ throw new NoVariableException(array($this, $var
iableName
, $value), self::EXCEPTION_VARIABLE_IS_MISSING);
} // END - if
// Then modify it
} // END - if
// Then modify it
@@
-405,22
+405,22
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
* variable is already set. If so, the variable got modified, otherwise
* added.
*
* variable is already set. If so, the variable got modified, otherwise
* added.
*
- * @param $varGroup Variable group to use
- * @param $var
Variable to set
- * @param $value Value to set
+ * @param $varGroup
Variable group to use
+ * @param $var
iableName
Variable to set
+ * @param $value
Value to set
* @return void
*/
* @return void
*/
- protected function setVariable ($varGroup, $var, $value) {
+ protected function setVariable ($varGroup, $var
iableName
, $value) {
// Replace all dashes to underscores to match variables with configuration entries
// Replace all dashes to underscores to match variables with configuration entries
- $var
= trim($this->convertDashesToUnderscores($var
));
+ $var
iableName = trim($this->convertDashesToUnderscores($variableName
));
// Get index for variable
// Get index for variable
- $index = $this->getVariableIndex($var);
+ $index = $this->getVariableIndex($var
iableName
);
// Is the variable set?
if ($index === false) {
// Not found, add it
// Is the variable set?
if ($index === false) {
// Not found, add it
- $this->varStack[$varGroup][] = $this->generateVariableArray($var, $value);
+ $this->varStack[$varGroup][] = $this->generateVariableArray($var
iableName
, $value);
} else {
// Then modify it
$this->setVariableValue($this->currGroup, $index, $value);
} else {
// Then modify it
$this->setVariableValue($this->currGroup, $index, $value);
@@
-431,17
+431,17
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
* "Generates" (better returns) an array for all variables for given
* variable/value pay.
*
* "Generates" (better returns) an array for all variables for given
* variable/value pay.
*
- * @param $var
Variable to set
- * @param $value Value to set
- * @return $varData Variable data array
+ * @param $var
iableName
Variable to set
+ * @param $value
Value to set
+ * @return $varData
Variable data array
*/
*/
- private function generateVariableArray ($var, $value) {
+ private function generateVariableArray ($var
iableName
, $value) {
// Replace all dashes to underscores to match variables with configuration entries
// Replace all dashes to underscores to match variables with configuration entries
- $var
= trim($this->convertDashesToUnderscores($var
));
+ $var
iableName = trim($this->convertDashesToUnderscores($variableName
));
// Generate the temporary array
$varData = array(
// Generate the temporary array
$varData = array(
- 'name' => $var,
+ 'name' => $var
iableName
,
'value' => $value
);
'value' => $value
);
@@
-580,45
+580,45
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
/**
* Assign (add) a given variable with a value
*
/**
* 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
+ * @param $var
iableName
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
*/
* @return void
* @throws EmptyVariableException If the variable name is left empty
*/
- public final function assignVariable ($var, $value) {
+ public final function assignVariable ($var
iableName
, $value) {
// Replace all dashes to underscores to match variables with configuration entries
// Replace all dashes to underscores to match variables with configuration entries
- $var
= trim($this->convertDashesToUnderscores($var
));
+ $var
iableName = trim($this->convertDashesToUnderscores($variableName
));
// Empty variable found?
// Empty variable found?
- if (empty($var)) {
+ if (empty($var
iableName
)) {
// Throw an exception
// Throw an exception
- throw new EmptyVariableException(array($this, 'var'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ throw new EmptyVariableException(array($this, 'var
iableName
'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} // END - if
// First search for the variable if it was already added
} // END - if
// First search for the variable if it was already added
- $index = $this->getVariableIndex($var);
+ $index = $this->getVariableIndex($var
iableName
);
// Was it found?
if ($index === false) {
// Add it to the stack
// Was it found?
if ($index === false) {
// Add it to the stack
- //* DEBUG: */ $this->debugOutput(__METHOD__ . ':ADD: ' . $var . '[' . gettype($value) . ']=' . $value);
- $this->addVariable($var, $value);
+ //* DEBUG: */ $this->debugOutput(__METHOD__ . ':ADD: ' . $var
iableName
. '[' . gettype($value) . ']=' . $value);
+ $this->addVariable($var
iableName
, $value);
} elseif (!empty($value)) {
// Modify the stack entry
} elseif (!empty($value)) {
// Modify the stack entry
- //* DEBUG: */ $this->debugOutput(__METHOD__ . ':MOD: ' . $var . '[' . gettype($value) . ']=' . $value);
- $this->modifyVariable($var, $value);
+ //* DEBUG: */ $this->debugOutput(__METHOD__ . ':MOD: ' . $var
iableName
. '[' . gettype($value) . ']=' . $value);
+ $this->modifyVariable($var
iableName
, $value);
}
}
/**
* Removes a given variable
*
}
}
/**
* Removes a given variable
*
- * @param $var
The variable we are looking for
+ * @param $var
iableName
The variable we are looking for
* @return void
*/
* @return void
*/
- public final function removeVariable ($var) {
+ public final function removeVariable ($var
iableName
) {
// First search for the variable if it was already added
// First search for the variable if it was already added
- $index = $this->getVariableIndex($var);
+ $index = $this->getVariableIndex($var
iableName
);
// Was it found?
if ($index !== false) {
// Was it found?
if ($index !== false) {
@@
-777,24
+777,25
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
* Try to assign an extracted template variable as a "content" or 'config'
* variable.
*
* Try to assign an extracted template variable as a "content" or 'config'
* variable.
*
- * @param $varName The variable's name (shall be content orconfig) by
- * default
- * @param $var The variable we want to assign
+ * @param $varName The variable's name (shall be content or config)
+ * by default
+ * @param $variableName The variable we want to assign
+ * @return void
*/
private function assignTemplateVariable ($varName, $var) {
// Replace all dashes to underscores to match variables with configuration entries
*/
private function assignTemplateVariable ($varName, $var) {
// Replace all dashes to underscores to match variables with configuration entries
- $var
= trim($this->convertDashesToUnderscores($var
));
+ $var
iableName = trim($this->convertDashesToUnderscores($variableName
));
// Debug message
// Debug message
- //* DEBUG: */ $this->debugOutput(__METHOD__ . ': varName=' . $varName . ',var
=' . $var
);
+ //* DEBUG: */ $this->debugOutput(__METHOD__ . ': varName=' . $varName . ',var
iableName=' . $variableName
);
// Is it not a config variable?
if ($varName != 'config') {
// Regular template variables
// Is it not a config variable?
if ($varName != 'config') {
// Regular template variables
- $this->assignVariable($var, '');
+ $this->assignVariable($var
iableName
, '');
} else {
// Configuration variables
} else {
// Configuration variables
- $this->assignConfigVariable($var);
+ $this->assignConfigVariable($var
iableName
);
}
}
}
}
@@
-1019,7
+1020,7
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
} // END - if
// Do we have some quotes left and right side? Then it is free text
} // END - if
// Do we have some quotes left and right side? Then it is free text
- if ((substr($varMatches[2][$key], 0, 1) ==
"\"") && (substr($varMatches[2][$key], -1, 1) == "\""
)) {
+ if ((substr($varMatches[2][$key], 0, 1) ==
'"') && (substr($varMatches[2][$key], -1, 1) == '"'
)) {
// Free string detected! Which we can assign directly
$this->assignVariable($var, $varMatches[3][$key]);
} elseif (!empty($varMatches[2][$key])) {
// Free string detected! Which we can assign directly
$this->assignVariable($var, $varMatches[3][$key]);
} elseif (!empty($varMatches[2][$key])) {
@@
-1143,16
+1144,16
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
/**
* Assign a given congfiguration variable with a value
*
/**
* Assign a given congfiguration variable with a value
*
- * @param $var
The configuration variable we want to assign
+ * @param $var
iableName
The configuration variable we want to assign
* @return void
*/
* @return void
*/
- public function assignConfigVariable ($var) {
+ public function assignConfigVariable ($var
iableName
) {
// Replace all dashes to underscores to match variables with configuration entries
// Replace all dashes to underscores to match variables with configuration entries
- $var
= trim($this->convertDashesToUnderscores($var
));
+ $var
iableName = trim($this->convertDashesToUnderscores($variableName
));
// Sweet and simple...
// Sweet and simple...
- //* DEBUG: */ $this->debugOutput(__METHOD__ . ': var
=' . $var . ',getConfigEntry()=' . $this->getConfigInstance()->getConfigEntry($var
));
- $this->setVariable('config', $var
, $this->getConfigInstance()->getConfigEntry($var
));
+ //* DEBUG: */ $this->debugOutput(__METHOD__ . ': var
iableName=' . $variableName . ',getConfigEntry()=' . $this->getConfigInstance()->getConfigEntry($variableName
));
+ $this->setVariable('config', $var
iableName, $this->getConfigInstance()->getConfigEntry($variableName
));
}
/**
}
/**
@@
-1194,7
+1195,7
@@
class BaseTemplateEngine extends BaseFrameworkSystem {
//* DEBUG: */ $this->debugOutput(__METHOD__ . ': name=' . $currVariable['name'] . ',value=' . $value);
// Remove it from stack
//* DEBUG: */ $this->debugOutput(__METHOD__ . ': name=' . $currVariable['name'] . ',value=' . $value);
// Remove it from stack
- $this->removeVariable($
index
, 'general');
+ $this->removeVariable($
currVariable['name']
, 'general');
// Re-assign the variable
//* DEBUG: */ $this->debugOutput(__METHOD__ . ': value='. $value . ',name=' . $currVariable['name'] . ',index=' . $index);
// Re-assign the variable
//* DEBUG: */ $this->debugOutput(__METHOD__ . ': value='. $value . ',name=' . $currVariable['name'] . ',index=' . $index);
diff --git
a/inc/config/class_FrameworkConfiguration.php
b/inc/config/class_FrameworkConfiguration.php
index 914d13a183b397e0d77b573176932c384be6dd50..20d80cd6b365d3e48659c0119346b1c5d3f1ad3d 100644
(file)
--- a/
inc/config/class_FrameworkConfiguration.php
+++ b/
inc/config/class_FrameworkConfiguration.php
@@
-176,7
+176,7
@@
class FrameworkConfiguration implements Registerable {
} // END - if
// Set the configuration value
} // END - if
// Set the configuration value
- /
/
* NOISY-DEBUG: */ print(__METHOD__ . ':configEntry=' . $configEntry . ',configValue=' . $configValue . PHP_EOL);
+ /* NOISY-DEBUG: */ print(__METHOD__ . ':configEntry=' . $configEntry . ',configValue=' . $configValue . PHP_EOL);
$this->config[$configEntry] = $configValue;
// Resort the array
$this->config[$configEntry] = $configValue;
// Resort the array