From: Roland Häder Date: Fri, 18 May 2012 20:07:20 +0000 (+0000) Subject: Used convertDashesToUnderscores() X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=48732bab3b2ca49cf44cfa5d7921c4073a41809c;p=core.git Used convertDashesToUnderscores() --- diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index d42cfc39..7ad8f74d 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -1628,6 +1628,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $fieldArray = $resultInstance->current(); //* DEBUG: */ $this->debugOutput($fieldName.':
'.print_r($fieldArray, true).'
'); + // Convert dashes to underscore + $fieldName = $this->convertDashesToUnderscores($fieldName); + // Does the field exist? if (isset($fieldArray[$fieldName])) { // Get it diff --git a/inc/classes/main/criteria/class_BaseCriteria.php b/inc/classes/main/criteria/class_BaseCriteria.php index 4b77b8f1..a3daa36e 100644 --- a/inc/classes/main/criteria/class_BaseCriteria.php +++ b/inc/classes/main/criteria/class_BaseCriteria.php @@ -79,7 +79,7 @@ class BaseCriteria extends BaseFrameworkSystem { * @return void */ public final function addCriteria ($criteriaKey, $criteriaValue) { - $this->criteria[str_replace('-', '_', $criteriaKey)] = (string)$criteriaValue; + $this->criteria[$this->convertDashesToUnderscores($criteriaKey)] = (string)$criteriaValue; } /** @@ -103,7 +103,7 @@ class BaseCriteria extends BaseFrameworkSystem { */ public function getCriteriaElemnent ($criteriaKey) { // Convert dashes to underscore - $criteriaKey = str_replace('-', '_', $criteriaKey); + $criteriaKey = $this->convertDashesToUnderscores($criteriaKey); // Default is not found $value = NULL; @@ -132,12 +132,12 @@ class BaseCriteria extends BaseFrameworkSystem { // Walk through all entries foreach ($entryArray as $key => $entry) { // Convert dashes to underscore - $key = str_replace('-', '_', $key); + $key = $this->convertDashesToUnderscores($key); // Then walk through all search criteria foreach ($this->criteria as $criteriaKey => $criteriaValue) { // Convert dashes to underscore - $criteriaKey = str_replace('-', '_', $criteriaKey); + $criteriaKey = $this->convertDashesToUnderscores($criteriaKey); // Is the element found and does it match? if (($key == $criteriaKey) && ($criteriaValue == $entry)) { @@ -167,7 +167,7 @@ class BaseCriteria extends BaseFrameworkSystem { // Now walk through all criterias foreach ($this->criteria as $criteriaKey => $criteriaValue) { // Convert dashes to underscore - $criteriaKey = str_replace('-', '_', $criteriaKey); + $criteriaKey = $this->convertDashesToUnderscores($criteriaKey); // Is the value in array or is $onlyKeys empty? if ((isset($onlyKeys[$criteriaKey])) || (count($onlyKeys) == 0)) { diff --git a/inc/classes/main/template/class_BaseTemplateEngine.php b/inc/classes/main/template/class_BaseTemplateEngine.php index 96952b44..272b9d71 100644 --- a/inc/classes/main/template/class_BaseTemplateEngine.php +++ b/inc/classes/main/template/class_BaseTemplateEngine.php @@ -173,7 +173,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ private function getVariableIndex ($var, $stack = NULL) { // Replace all dashes to underscores to match variables with configuration entries - $var = trim(str_replace('-', '_', $var)); + $var = trim($this->convertDashesToUnderscores($var)); // First everything is not found $found = false; @@ -248,7 +248,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ protected function readVariable ($var, $stack = NULL) { // Replace all dashes to underscores to match variables with configuration entries - $var = trim(str_replace('-', '_', $var)); + $var = trim($this->convertDashesToUnderscores($var)); // First everything is not found $content = NULL; @@ -336,7 +336,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ public function addGroupVariable ($var, $value) { // Replace all dashes to underscores to match variables with configuration entries - $var = trim(str_replace('-', '_', $var)); + $var = trim($this->convertDashesToUnderscores($var)); // Debug message //* DEBUG: */ $this->debugOutput(__METHOD__.': group=' . $this->currGroup . ', var=' . $var . ', value=' . $value); @@ -373,7 +373,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ private function modifyVariable ($var, $value) { // Replace all dashes to underscores to match variables with configuration entries - $var = trim(str_replace('-', '_', $var)); + $var = trim($this->convertDashesToUnderscores($var)); // Get index for variable $index = $this->getVariableIndex($var); @@ -412,7 +412,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ protected function setVariable ($varGroup, $var, $value) { // Replace all dashes to underscores to match variables with configuration entries - $var = trim(str_replace('-', '_', $var)); + $var = trim($this->convertDashesToUnderscores($var)); // Get index for variable $index = $this->getVariableIndex($var); @@ -437,7 +437,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ private function generateVariableArray ($var, $value) { // Replace all dashes to underscores to match variables with configuration entries - $var = trim(str_replace('-', '_', $var)); + $var = trim($this->convertDashesToUnderscores($var)); // Generate the temporary array $varData = array( @@ -587,7 +587,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ public final function assignVariable ($var, $value) { // Replace all dashes to underscores to match variables with configuration entries - $var = trim(str_replace('-', '_', $var)); + $var = trim($this->convertDashesToUnderscores($var)); // Empty variable found? if (empty($var)) { @@ -783,7 +783,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ private function assignTemplateVariable ($varName, $var) { // Replace all dashes to underscores to match variables with configuration entries - $var = trim(str_replace('-', '_', $var)); + $var = trim($this->convertDashesToUnderscores($var)); // Debug message //* DEBUG: */ $this->debugOutput(__METHOD__ . ': varName=' . $varName . ',var=' . $var); @@ -1007,7 +1007,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { // Search for all variables foreach ($varMatches[1] as $key => $var) { // Replace all dashes to underscores to match variables with configuration entries - $var = trim(str_replace('-', '_', $var)); + $var = trim($this->convertDashesToUnderscores($var)); // Debug message $this->debugOutput(__METHOD__ . ':key=' . $key . ',var=' . $var); @@ -1148,7 +1148,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { */ public function assignConfigVariable ($var) { // Replace all dashes to underscores to match variables with configuration entries - $var = trim(str_replace('-', '_', $var)); + $var = trim($this->convertDashesToUnderscores($var)); // Sweet and simple... //* DEBUG: */ $this->debugOutput(__METHOD__ . ': var=' . $var . ',getConfigEntry()=' . $this->getConfigInstance()->getConfigEntry($var));