From 95673c6dbd12d46bed603a2724437ed863e3215b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 28 Jun 2013 23:39:16 +0000 Subject: [PATCH] Fixed (again) some more generic array handling --- .../main/class_BaseFrameworkSystem.php | 215 ++++++++++++++++-- .../main/criteria/class_BaseCriteria.php | 6 +- .../databases/class_LocalFileDatabase.php | 6 +- .../main/debug/class_DebugWebOutput.php | 2 +- inc/classes/main/filter/class_FilterChain.php | 2 +- inc/classes/main/mailer/class_BaseMailer.php | 2 +- .../main/registry/class_BaseRegistry.php | 5 +- .../main/response/class_BaseResponse.php | 2 +- .../main/stacker/class_BaseStacker.php | 2 +- 9 files changed, 210 insertions(+), 32 deletions(-) diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 62b79bda..34b0a22e 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -426,7 +426,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Output stub message // @TODO __CLASS__ does always return BaseFrameworkSystem but not the extending (=child) class - self::createDebugInstance(__CLASS__)->debugOutput(sprintf("[unknown::%s:] Stub! Args: %s", + self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[unknown::%s:] Stub! Args: %s', $methodName, $argsString )); @@ -452,7 +452,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ public final function __set ($name, $value) { - $this->debugBackTrace(sprintf("Tried to set a missing field. name=%s, value[%s]=%s", + $this->debugBackTrace(sprintf('Tried to set a missing field. name=%s, value[%s]=%s', $name, gettype($value), $value @@ -466,7 +466,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ public final function __get ($name) { - $this->debugBackTrace(sprintf("Tried to get a missing field. name=%s", + $this->debugBackTrace(sprintf('Tried to get a missing field. name=%s', $name )); } @@ -478,7 +478,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ public final function __unset ($name) { - $this->debugBackTrace(sprintf("Tried to unset a missing field. name=%s", + $this->debugBackTrace(sprintf('Tried to unset a missing field. name=%s', $name )); } @@ -1337,11 +1337,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Is a message set? if (!empty($message)) { // Construct message - $content = sprintf("
Message: %s
\n", $message); + $content = sprintf('
Message: %s
' . PHP_EOL, $message); } // END - if // Generate the output - $content .= sprintf("
%s
", + $content .= sprintf('
%s
', trim( htmlentities( print_r($this, true) @@ -1350,7 +1350,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { ); // Output it - ApplicationEntryPoint::app_exit(sprintf("
%s debug output:
%s
\nLoaded includes:
%s
", + ApplicationEntryPoint::app_exit(sprintf('
%s debug output:
%s
Loaded includes:
%s
', $this->__toString(), $content, ClassLoader::getSelfInstance()->getPrintableIncludeList() @@ -1463,6 +1463,17 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { return $debugInstance; } + /** + * Simple output of a message with line-break + * + * @param $message Message to output + * @return void + */ + public function outputLine ($message) { + // Simply output it + print($message . PHP_EOL); + } + /** * Outputs a debug message whether to debug instance (should be set!) or * dies with or ptints the message. Do NEVER EVER rewrite the exit() call to @@ -1504,7 +1515,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Put directly out if ($doPrint === TRUE) { // Print message - print($message . chr(10)); + $this->outputLine($message); } else { // Die here exit($message); @@ -2128,6 +2139,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $isset Whether the given key is set */ protected final function isGenericArrayElementSet ($keyGroup, $subGroup, $key, $element) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element); + // Is it there? $isset = isset($this->genericArray[$keyGroup][$subGroup][$key][$element]); @@ -2143,6 +2157,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $isset Whether the given key is set */ protected final function isGenericArrayKeySet ($keyGroup, $subGroup, $key) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); + // Is it there? $isset = isset($this->genericArray[$keyGroup][$subGroup][$key]); @@ -2159,6 +2176,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $isset Whether the given group is set */ protected final function isGenericArrayGroupSet ($keyGroup, $subGroup) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup); + // Is it there? $isset = isset($this->genericArray[$keyGroup][$subGroup]); @@ -2180,8 +2200,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { trigger_error(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ' not found.'); } // END - if + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',value=' . print_r($this->genericArray[$keyGroup][$subGroup], TRUE)); + // Return it - //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ' returning!' . PHP_EOL); return $this->genericArray[$keyGroup][$subGroup]; } @@ -2194,8 +2216,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ protected final function unsetGenericArrayKey ($keyGroup, $subGroup, $key) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); + // Remove it - //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ' unset!' . PHP_EOL); unset($this->genericArray[$keyGroup][$subGroup][$key]); } @@ -2209,8 +2233,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ protected final function unsetGenericArrayElement ($keyGroup, $subGroup, $key, $element) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element); + // Remove it - //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ' unset!' . PHP_EOL); unset($this->genericArray[$keyGroup][$subGroup][$key][$element]); } @@ -2223,7 +2249,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @param $value Value to add/append * @return void */ - protected final function appendStringToGenericArrayElement ($keyGroup, $subGroup, $key, $value, $appendGlue = '') { + protected final function appendStringToGenericArrayKey ($keyGroup, $subGroup, $key, $value, $appendGlue = '') { + // Debug message + //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, TRUE) . ',appendGlue=' . $appendGlue); + // Is it already there? if ($this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) { // Append it @@ -2235,7 +2264,54 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } /** - * Initializes given generic array + * Append a string to a given generic array element + * + * @param $keyGroup Main group for the key + * @param $subGroup Sub group for the key + * @param $key Key to unset + * @param $element Element to check + * @param $value Value to add/append + * @return void + */ + protected final function appendStringToGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value, $appendGlue = '') { + // Debug message + //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, TRUE) . ',appendGlue=' . $appendGlue); + + // Is it already there? + if ($this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element)) { + // Append it + $this->genericArray[$keyGroup][$subGroup][$key][$element] .= $appendGlue . (string) $value; + } else { + // Add it + $this->genericArray[$keyGroup][$subGroup][$key][$element] = (string) $value; + } + } + + /** + * Initializes given generic array group + * + * @param $keyGroup Main group for the key + * @param $subGroup Sub group for the key + * @param $key Key to use + * @param $forceInit Optionally force initialization + * @return void + */ + protected final function initGenericArrayGroup ($keyGroup, $subGroup, $forceInit = FALSE) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',forceInit=' . intval($forceInit)); + + // Is it already set? + if (($forceInit === FALSE) && ($this->isGenericArrayGroupSet($keyGroup, $subGroup))) { + // Already initialized + trigger_error(__METHOD__ . ':keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ' already initialized.'); + } // END - if + + // Initialize it + $this->genericArray[$keyGroup][$subGroup] = array(); + } + + /** + * Initializes given generic array key * * @param $keyGroup Main group for the key * @param $subGroup Sub group for the key @@ -2244,6 +2320,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ protected final function initGenericArrayKey ($keyGroup, $subGroup, $key, $forceInit = FALSE) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',forceInit=' . intval($forceInit)); + // Is it already set? if (($forceInit === FALSE) && ($this->isGenericArrayKeySet($keyGroup, $subGroup, $key))) { // Already initialized @@ -2251,10 +2330,33 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } // END - if // Initialize it - //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . PHP_EOL); $this->genericArray[$keyGroup][$subGroup][$key] = array(); } + /** + * Initializes given generic array element + * + * @param $keyGroup Main group for the key + * @param $subGroup Sub group for the key + * @param $key Key to use + * @param $element Element to use + * @param $forceInit Optionally force initialization + * @return void + */ + protected final function initGenericArrayElement ($keyGroup, $subGroup, $key, $element, $forceInit = FALSE) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',forceInit=' . intval($forceInit)); + + // Is it already set? + if (($forceInit === FALSE) && ($this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element))) { + // Already initialized + trigger_error(__METHOD__ . ':keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ' already initialized.'); + } // END - if + + // Initialize it + $this->genericArray[$keyGroup][$subGroup][$key][$element] = array(); + } + /** * Pushes an element to a generic key * @@ -2264,7 +2366,10 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @param $value Value to add/append * @return $count Number of array elements */ - protected final function pushValueToGenericArrayElement ($keyGroup, $subGroup, $key, $value) { + protected final function pushValueToGenericArrayKey ($keyGroup, $subGroup, $key, $value) { + // Debug message + //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, TRUE)); + // Is it set? if (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) { // Initialize array @@ -2272,7 +2377,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } // END - if // Then push it - //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, TRUE) . PHP_EOL); $count = array_push($this->genericArray[$keyGroup][$subGroup][$key], $value); // Return count @@ -2281,6 +2385,35 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { return $count; } + /** + * Pushes an element to a generic array element + * + * @param $keyGroup Main group for the key + * @param $subGroup Sub group for the key + * @param $key Key to use + * @param $element Element to check + * @param $value Value to add/append + * @return $count Number of array elements + */ + protected final function pushValueToGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value) { + // Debug message + //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, TRUE)); + + // Is it set? + if (!$this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element)) { + // Initialize array + $this->initGenericArrayElement($keyGroup, $subGroup, $key, $element); + } // END - if + + // Then push it + $count = array_push($this->genericArray[$keyGroup][$subGroup][$key][$element], $value); + + // Return count + //* DEBUG: */ print(__METHOD__ . ': genericArray=' . print_r($this->genericArray[$keyGroup][$subGroup][$key], TRUE)); + //* DEBUG: */ print(__METHOD__ . ': count=' . $count . PHP_EOL); + return $count; + } + /** * Pops an element from a generic group * @@ -2290,6 +2423,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $value Last "popped" value */ protected final function popGenericArrayElement ($keyGroup, $subGroup, $key) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); + // Is it set? if (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) { // Not found @@ -2297,7 +2433,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } // END - if // Then "pop" it - //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ' pop-ing entry ...' . PHP_EOL); $value = array_pop($this->genericArray[$keyGroup][$subGroup][$key]); // Return value @@ -2315,6 +2450,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $value Last "popped" value */ protected final function shiftGenericArrayElement ($keyGroup, $subGroup, $key) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); + // Is it set? if (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) { // Not found @@ -2322,12 +2460,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } // END - if // Then "shift" it - //* DEBUG: */ print(__METHOD__ . ': keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ' shifting entry ...' . PHP_EOL); $value = array_shift($this->genericArray[$keyGroup][$subGroup][$key]); // Return value //* DEBUG: */ print(__METHOD__ . ': genericArray=' . print_r($this->genericArray[$keyGroup][$subGroup][$key], TRUE)); - //* DEBUG: */ print(__METHOD__ . ': value[' . gettype($value) . ']=' . $value . PHP_EOL); + //* DEBUG: */ print(__METHOD__ . ': value[' . gettype($value) . ']=' . print_r($value, TRUE) . PHP_EOL); return $value; } @@ -2338,6 +2475,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $count Count of given group */ protected final function countGenericArray ($keyGroup) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup); + // Is it there? if (!isset($this->genericArray[$keyGroup])) { // Abort here @@ -2347,6 +2487,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Then count it $count = count($this->genericArray[$keyGroup]); + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',count=' . $count); + // Return it return $count; } @@ -2359,6 +2502,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $count Count of given group */ protected final function countGenericArrayGroup ($keyGroup, $subGroup) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup); + // Is it there? if (!$this->isGenericArrayGroupSet($keyGroup, $subGroup)) { // Abort here @@ -2368,6 +2514,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Then count it $count = count($this->genericArray[$keyGroup][$subGroup]); + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',count=' . $count); + // Return it return $count; } @@ -2381,6 +2530,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $count Count of given key */ protected final function countGenericArrayElements ($keyGroup, $subGroup, $key) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); + // Is it there? if (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) { // Abort here @@ -2392,7 +2544,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Then count it $count = count($this->genericArray[$keyGroup][$subGroup][$key]); - //* DEBUG: */ print(__METHOD__ . ':keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',count=' . $count . PHP_EOL); + + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',count=' . $count); // Return it return $count; @@ -2405,6 +2559,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $array Whole generic array group */ protected final function getGenericArray ($keyGroup) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup); + // Is it there? if (!isset($this->genericArray[$keyGroup])) { // Then abort here @@ -2425,6 +2582,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ protected final function setGenericArrayKey ($keyGroup, $subGroup, $key, $value) { + // Debug message + //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',value[' . gettype($value) . ']=' . print_r($value, TRUE)); + // Set value here $this->genericArray[$keyGroup][$subGroup][$key] = $value; } @@ -2438,6 +2598,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $value Mixed value from generic array element */ protected final function getGenericArrayKey ($keyGroup, $subGroup, $key) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); + // Is it there? if (!$this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) { // Then abort here @@ -2459,6 +2622,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ protected final function setGenericArrayElement ($keyGroup, $subGroup, $key, $element, $value) { + // Debug message + //* NOISY-DEBUG: */ if (!is_object($value)) $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element . ',value[' . gettype($value) . ']=' . print_r($value, TRUE)); + // Then set it $this->genericArray[$keyGroup][$subGroup][$key][$element] = $value; } @@ -2473,6 +2639,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $value Mixed value from generic array element */ protected final function getGenericArrayElement ($keyGroup, $subGroup, $key, $element) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element); + // Is it there? if (!$this->isGenericArrayElementSet($keyGroup, $subGroup, $key, $element)) { // Then abort here @@ -2491,6 +2660,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $isValid Whether given sub group is valid */ protected final function isValidGenericArrayGroup ($keyGroup, $subGroup) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup); + // Determine it $isValid = (($this->isGenericArrayGroupSet($keyGroup, $subGroup)) && (is_array($this->getGenericSubArray($keyGroup, $subGroup)))); @@ -2507,6 +2679,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $isValid Whether given sub group is valid */ protected final function isValidGenericArrayKey ($keyGroup, $subGroup, $key) { + // Debug message + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); + // Determine it $isValid = (($this->isGenericArrayKeySet($keyGroup, $subGroup, $key)) && (is_array($this->getGenericArrayKey($keyGroup, $subGroup, $key)))); diff --git a/inc/classes/main/criteria/class_BaseCriteria.php b/inc/classes/main/criteria/class_BaseCriteria.php index 78a4e828..fd8e16da 100644 --- a/inc/classes/main/criteria/class_BaseCriteria.php +++ b/inc/classes/main/criteria/class_BaseCriteria.php @@ -171,7 +171,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(strtoupper($criteriaType) . '(' . $this->__toString() . ')-CRITERIA[' . __LINE__ . ']: criteriaKey=' . $criteriaKey . ',criteriaValue=' . $criteriaValue); // Append it - $this->appendStringToGenericArrayElement('criteria', $criteriaType, $criteriaKey, $criteriaValue); + $this->appendStringToGenericArrayElement('criteria', $criteriaType, 'entries', $criteriaKey, $criteriaValue); } /** @@ -190,7 +190,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(strtoupper($criteriaType) . '(' . $this->__toString() . ')-CRITERIA[' . __LINE__ . ']: criteriaKey=' . $criteriaKey . ',criteriaValue=' . $criteriaValue); // Add it - $this->pushValueToGenericArrayElement('criteria', 'choice', $this->convertDashesToUnderscores($criteriaKey), (string) $criteriaValue); + $this->pushValueToGenericArrayElement('criteria', 'choice', 'entries', $this->convertDashesToUnderscores($criteriaKey), (string) $criteriaValue); } /** @@ -243,7 +243,7 @@ class BaseCriteria extends BaseFrameworkSystem implements Criteria { // Is the criteria there? if ($this->isKeySet($criteriaType, $criteriaKey)) { // Then use it - $value = $this->getGenericArrayKey('criteria', $criteriaType, $criteriaKey); + $value = $this->getGenericArrayElement('criteria', $criteriaType, 'entries', $criteriaKey); } // END - if // Return the value diff --git a/inc/classes/main/database/databases/class_LocalFileDatabase.php b/inc/classes/main/database/databases/class_LocalFileDatabase.php index 1bb31f4d..e5cb74ea 100644 --- a/inc/classes/main/database/databases/class_LocalFileDatabase.php +++ b/inc/classes/main/database/databases/class_LocalFileDatabase.php @@ -415,7 +415,7 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackendIn } // END - if } else { // Throw an exception here - throw new SqlException(array($this, sprintf("File '%s' contains invalid data.", $dataFile), self::DB_CODE_DATA_FILE_CORRUPT), self::EXCEPTION_SQL_QUERY); + throw new SqlException(array($this, sprintf('File '%s' contains invalid data.', $dataFile), self::DB_CODE_DATA_FILE_CORRUPT), self::EXCEPTION_SQL_QUERY); } // Count entry up @@ -433,7 +433,7 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackendIn $this->setLastException($e); // So throw an SqlException here with faked error message - throw new SqlException (array($this, sprintf("Table '%s' not found", $tableName), self::DB_CODE_TABLE_MISSING), self::EXCEPTION_SQL_QUERY); + throw new SqlException (array($this, sprintf('Table '%s' not found', $tableName), self::DB_CODE_TABLE_MISSING), self::EXCEPTION_SQL_QUERY); } catch (FrameworkException $e) { // Catch all exceptions and store them in last error $this->setLastException($e); @@ -469,7 +469,7 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackendIn $this->setLastException($e); // Throw an SQL exception - throw new SqlException(array($this, sprintf("Cannot write data to table '%s', is the table created?", $dataSetInstance->getTableName()), self::DB_CODE_TABLE_UNWRITEABLE), self::EXCEPTION_SQL_QUERY); + throw new SqlException(array($this, sprintf('Cannot write data to table '%s', is the table created?', $dataSetInstance->getTableName()), self::DB_CODE_TABLE_UNWRITEABLE), self::EXCEPTION_SQL_QUERY); } } diff --git a/inc/classes/main/debug/class_DebugWebOutput.php b/inc/classes/main/debug/class_DebugWebOutput.php index 7ffe5b55..b851abac 100644 --- a/inc/classes/main/debug/class_DebugWebOutput.php +++ b/inc/classes/main/debug/class_DebugWebOutput.php @@ -54,7 +54,7 @@ class DebugWebOutput extends BaseFrameworkSystem implements Debugger, OutputStre */ public final function outputStream ($output, $stripTags = FALSE) { // Strip out
- $output = str_replace("
", '', $output); + $output = str_replace('
', '', $output); print(stripslashes($output)."
\n"); } diff --git a/inc/classes/main/filter/class_FilterChain.php b/inc/classes/main/filter/class_FilterChain.php index 4f15fa13..d1374a59 100644 --- a/inc/classes/main/filter/class_FilterChain.php +++ b/inc/classes/main/filter/class_FilterChain.php @@ -52,7 +52,7 @@ class FilterChain extends BaseFrameworkSystem implements Registerable { * @return void */ public final function addFilter (Filterable $filterInstance) { - $this->pushValueToGenericArrayElement('filters', 'generic', 'dummy', $filterInstance); + $this->pushValueToGenericArrayKey('filters', 'generic', 'dummy', $filterInstance); } /** diff --git a/inc/classes/main/mailer/class_BaseMailer.php b/inc/classes/main/mailer/class_BaseMailer.php index 9d9b1212..8e7a1545 100644 --- a/inc/classes/main/mailer/class_BaseMailer.php +++ b/inc/classes/main/mailer/class_BaseMailer.php @@ -68,7 +68,7 @@ class BaseMailer extends BaseFrameworkSystem { $templateName = $this->getTemplateName(); // Is the list initialized? - $this->pushValueToGenericArrayElement('recipients', $templateName, 'recipients', $userInstance); + $this->pushValueToGenericArrayKey('recipients', $templateName, 'recipients', $userInstance); } /** diff --git a/inc/classes/main/registry/class_BaseRegistry.php b/inc/classes/main/registry/class_BaseRegistry.php index 629c9a11..91914e1c 100644 --- a/inc/classes/main/registry/class_BaseRegistry.php +++ b/inc/classes/main/registry/class_BaseRegistry.php @@ -41,6 +41,9 @@ class BaseRegistry extends BaseFrameworkSystem implements Registerable { protected function __construct ($className) { // Call parent constructor parent::__construct($className); + + // Init raw array + $this->initGenericArrayGroup('raw', 'generic'); } /** @@ -90,7 +93,7 @@ class BaseRegistry extends BaseFrameworkSystem implements Registerable { assert(!is_array($key)); // Push it - $this->pushValueToGenericArrayElement('raw', 'generic', $key, $value); + $this->pushValueToGenericArrayKey('raw', 'generic', $key, $value); } /** diff --git a/inc/classes/main/response/class_BaseResponse.php b/inc/classes/main/response/class_BaseResponse.php index a2d0e302..7c63857c 100644 --- a/inc/classes/main/response/class_BaseResponse.php +++ b/inc/classes/main/response/class_BaseResponse.php @@ -131,7 +131,7 @@ class BaseResponse extends BaseFrameworkSystem { */ public final function addFatalMessagePlain ($message) { // Adds the resolved message id to the fatal message list - $this->pushValueToGenericArrayElement('fatal_messages', 'generic', 'message', $message); + $this->pushValueToGenericArrayKey('fatal_messages', 'generic', 'message', $message); } /** diff --git a/inc/classes/main/stacker/class_BaseStacker.php b/inc/classes/main/stacker/class_BaseStacker.php index a3419fe4..32dc9d9c 100644 --- a/inc/classes/main/stacker/class_BaseStacker.php +++ b/inc/classes/main/stacker/class_BaseStacker.php @@ -154,7 +154,7 @@ class BaseStacker extends BaseFrameworkSystem { } // Now add the value to the stack - $this->pushValueToGenericArrayElement('stacks', $stackerName, 'entries', $value); + $this->pushValueToGenericArrayKey('stacks', $stackerName, 'entries', $value); } /** -- 2.39.5