From ac948286448f4e0d4ef71d2dc8daaac53e8c902b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 3 Mar 2013 22:35:01 +0000 Subject: [PATCH] Use array_push() instead of [] --- inc/classes/main/cache/class_MemoryCache.php | 2 +- inc/classes/main/criteria/class_BaseCriteria.php | 2 +- .../databases/class_LocalFileDatabase.php | 2 +- inc/classes/main/filter/class_FilterChain.php | 2 +- inc/classes/main/mailer/class_BaseMailer.php | 2 +- inc/classes/main/registry/class_BaseRegistry.php | 2 +- inc/classes/main/response/class_BaseResponse.php | 4 ++-- .../main/template/class_BaseTemplateEngine.php | 16 ++++++++-------- .../api/wernisportal/class_WernisApi.php | 10 +++++----- inc/loader/class_ClassLoader.php | 10 +++++----- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/inc/classes/main/cache/class_MemoryCache.php b/inc/classes/main/cache/class_MemoryCache.php index 7f254d33..d9d252ce 100644 --- a/inc/classes/main/cache/class_MemoryCache.php +++ b/inc/classes/main/cache/class_MemoryCache.php @@ -78,7 +78,7 @@ class MemoryCache extends BaseFrameworkSystem implements Cacheable { // So look for array element? if (($exists === TRUE) && (!is_null($arrayElement))) { // Get it - $array = $this->offetget($offset); + $array = $this->offsetGet($offset); // Is it an array and element is found? if ((is_array($array)) && (isset($array[$arrayElement]))) { diff --git a/inc/classes/main/criteria/class_BaseCriteria.php b/inc/classes/main/criteria/class_BaseCriteria.php index 9597c14a..da807125 100644 --- a/inc/classes/main/criteria/class_BaseCriteria.php +++ b/inc/classes/main/criteria/class_BaseCriteria.php @@ -202,7 +202,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->criteria['choice'][$this->convertDashesToUnderscores($criteriaKey)][] = (string) $criteriaValue; + array_push($this->criteria['choice'][$this->convertDashesToUnderscores($criteriaKey)], (string) $criteriaValue); } /** diff --git a/inc/classes/main/database/databases/class_LocalFileDatabase.php b/inc/classes/main/database/databases/class_LocalFileDatabase.php index f49a9f16..efc67c3e 100644 --- a/inc/classes/main/database/databases/class_LocalFileDatabase.php +++ b/inc/classes/main/database/databases/class_LocalFileDatabase.php @@ -408,7 +408,7 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackendIn // Entry found! //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: indexKey=' . $this->getIndexKey() . ',idx=' . $idx . ',dataArray=' . print_r($dataArray, TRUE)); - $resultData[BaseDatabaseBackend::RESULT_INDEX_ROWS][] = $dataArray; + array_push($resultData[BaseDatabaseBackend::RESULT_INDEX_ROWS], $dataArray); // Count found entries up $limitFound++; diff --git a/inc/classes/main/filter/class_FilterChain.php b/inc/classes/main/filter/class_FilterChain.php index 3aff6387..c192bf3f 100644 --- a/inc/classes/main/filter/class_FilterChain.php +++ b/inc/classes/main/filter/class_FilterChain.php @@ -57,7 +57,7 @@ class FilterChain extends BaseFrameworkSystem implements Registerable { * @return void */ public final function addFilter (Filterable $filterInstance) { - $this->filters[] = $filterInstance; + array_push($this->filters, $filterInstance); } /** diff --git a/inc/classes/main/mailer/class_BaseMailer.php b/inc/classes/main/mailer/class_BaseMailer.php index 71124d2f..ffd0bc15 100644 --- a/inc/classes/main/mailer/class_BaseMailer.php +++ b/inc/classes/main/mailer/class_BaseMailer.php @@ -79,7 +79,7 @@ class BaseMailer extends BaseFrameworkSystem { } // END - if // Add it as a recipient - $this->recipientList[$templateName]['recipients'][] = $userInstance; + array_pushh($this->recipientList[$templateName]['recipients'], $userInstance); } /** diff --git a/inc/classes/main/registry/class_BaseRegistry.php b/inc/classes/main/registry/class_BaseRegistry.php index 4fd9aaf6..fc0b4c19 100644 --- a/inc/classes/main/registry/class_BaseRegistry.php +++ b/inc/classes/main/registry/class_BaseRegistry.php @@ -97,7 +97,7 @@ class BaseRegistry extends BaseFrameworkSystem implements Registerable { */ public final function addEntry ($key, $value) { // Simply add it - $this->rawEntries[$key][] = $value; + array_push($this->rawEntries[$key], $value); } /** diff --git a/inc/classes/main/response/class_BaseResponse.php b/inc/classes/main/response/class_BaseResponse.php index c8cfa4f5..2533d7c9 100644 --- a/inc/classes/main/response/class_BaseResponse.php +++ b/inc/classes/main/response/class_BaseResponse.php @@ -125,7 +125,7 @@ class BaseResponse extends BaseFrameworkSystem { */ public final function addFatalMessage ($messageId) { // Adds the resolved message id to the fatal message list - $this->fatalMessages[] = $this->getApplicationInstance()->getLanguageInstance()->getMessage($messageId); + array_push($this->fatalMessages, $this->getApplicationInstance()->getLanguageInstance()->getMessage($messageId)); } /** @@ -136,7 +136,7 @@ class BaseResponse extends BaseFrameworkSystem { */ public final function addFatalMessagePlain ($message) { // Adds the resolved message id to the fatal message list - $this->fatalMessages[] = $message; + array_push($this->fatalMessages, $message); } /** diff --git a/inc/classes/main/template/class_BaseTemplateEngine.php b/inc/classes/main/template/class_BaseTemplateEngine.php index 46667de5..0f7f32fc 100644 --- a/inc/classes/main/template/class_BaseTemplateEngine.php +++ b/inc/classes/main/template/class_BaseTemplateEngine.php @@ -345,7 +345,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { $currVars = $this->readCurrentGroup(); // Append our variable - $currVars[] = $this->generateVariableArray($variableName, $value); + array_push($currVars, $this->generateVariableArray($variableName, $value)); // Add it to the stack $this->setVarStack($this->currGroup, $currVars); @@ -420,7 +420,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { // Is the variable set? if ($index === FALSE) { // Not found, add it - $this->varStack[$varGroup][] = $this->generateVariableArray($variableName, $value); + array_push($this->varStack[$varGroup], $this->generateVariableArray($variableName, $value)); } else { // Then modify it $this->setVariableValue($this->currGroup, $index, $value); @@ -879,13 +879,13 @@ class BaseTemplateEngine extends BaseFrameworkSystem { $this->loadedRawData[$template] = $this->readVariable($template, 'config'); // Recursive protection: - $this->loadedTemplates[] = $template; + array_push($this->loadedTemplates, $template); } elseif ($this->getVariableIndex($template) !== FALSE) { // Use that content here $this->loadedRawData[$template] = $this->readVariable($template); // Recursive protection: - $this->loadedTemplates[] = $template; + array_push($this->loadedTemplates, $template); } else { // Then try to search for code-templates try { @@ -895,10 +895,10 @@ class BaseTemplateEngine extends BaseFrameworkSystem { // Remember this template for recursion detection // RECURSIVE PROTECTION! - $this->loadedTemplates[] = $template; + array_push($this->loadedTemplates, $template); } catch (FileIoException $e) { // Even this is not done... :/ - $this->rawTemplates[] = $template; + array_push($this->rawTemplates, $template); } } } // END - if @@ -923,7 +923,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { } // END - if // Remember this template being compiled - $this->compiledTemplates[] = $template; + array_push($this->compiledTemplates, $template); // Compile the loaded code in five steps: // @@ -994,7 +994,7 @@ class BaseTemplateEngine extends BaseFrameworkSystem { // Remember this template for recursion detection // RECURSIVE PROTECTION! - $this->loadedTemplates[] = $template; + array_push($this->loadedTemplates, $template); } catch (FileIoException $e) { // This template was never found. We silently ignore it unset($this->rawTemplates[$key]); diff --git a/inc/classes/third_party/api/wernisportal/class_WernisApi.php b/inc/classes/third_party/api/wernisportal/class_WernisApi.php index d2e10548..45c42f18 100644 --- a/inc/classes/third_party/api/wernisportal/class_WernisApi.php +++ b/inc/classes/third_party/api/wernisportal/class_WernisApi.php @@ -392,7 +392,7 @@ class WernisApi extends BaseFrameworkSystem { // Generate request header $request = "GET /".trim($script)." HTTP/1.0\r\n"; $request .= "Host: ".$host."\r\n"; - $request .= sprintf("User-Agent: Bube oder Dame / 1.0 by Quix0r [Spieler: %d]\r\n\r\n", $this->w_id); + $request .= sprintf("User-Agent: WernisApi/1.0 by Quix0r [Spieler: %d]\r\n\r\n", $this->w_id); // Initialize array $response = array(); @@ -402,17 +402,17 @@ class WernisApi extends BaseFrameworkSystem { // Read response while(!feof($fp)) { - $response[] = trim(fgets($fp, 1024)); - } + array_push($response, trim(fgets($fp, 1024))); + } // END - while // Close socket fclose($fp); // Was the request successfull? - if ((!ereg("200 OK", $response[0])) && (empty($response[0]))) { + if ((!ereg('200 OK', $response[0])) && (empty($response[0]))) { // Not found / access forbidden $response = array('', '', ''); - } + } // END - if // Return response return $response; diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php index 7c9afa93..d7c3c33d 100644 --- a/inc/loader/class_ClassLoader.php +++ b/inc/loader/class_ClassLoader.php @@ -253,10 +253,10 @@ class ClassLoader { * scanning the whole directory structure starting from given base * path. */ - $ignoreList[] = '.'; - $ignoreList[] = '..'; - $ignoreList[] = '.htaccess'; - $ignoreList[] = '.svn'; + array_push($ignoreList, '.'); + array_push($ignoreList, '..'); + array_push($ignoreList, '.htaccess'); + array_push($ignoreList, '.svn'); // Keep it in class for later usage $this->ignoreList = $ignoreList; @@ -346,7 +346,7 @@ class ClassLoader { $this->total++; // Mark this class as loaded - $this->loadedClasses[] = $this->classes[$fileName]; + array_push($this->loadedClasses, $this->classes[$fileName]); // Remove it from classes list unset($this->classes[$fileName]); -- 2.39.5