Naming convention applied
authorRoland Häder <roland@mxchange.org>
Mon, 8 Nov 2010 01:50:32 +0000 (01:50 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 8 Nov 2010 01:50:32 +0000 (01:50 +0000)
inc/classes/cachesystem.class.php
inc/functions.php

index ed67f4a..587a528 100644 (file)
@@ -42,23 +42,34 @@ if (!defined('__SECURITY')) {
 
 // Caching class
 class CacheSystem {
-       // Define variables
-       var $ret = 'init';
+       // Status code
+       var $statusCode = 'init';
+
+       // Full-qualified filename
        var $fqfn = '';
+
+       // Resource to cache file
        var $pointer = false;
+
+       // Data array from cache
        var $data = array();
+
+       // Version data from cache
        var $version = array();
+
+       // Cache name
        var $name = '';
        var $rebuilt = array();
+
+       // File extension
        var $extension = '.cache';
-       var $statusDone = 'done';
        var $status = array();
        var $readable = array();
 
        // Constructor
        function CacheSystem () {
                // Failed is the default
-               $this->ret = 'failed';
+               $this->setStatusCode('failed');
 
                // Remeber path
 
@@ -67,10 +78,10 @@ class CacheSystem {
                        // Is there a .htaccess file?
                        if (isFileReadable(getCachePath() . '.htaccess')) {
                                // All done!
-                               $this->ret = $this->statusDone;
+                               $this->setStatusCode('done');
                        } else {
                                // Stop! Set a .htaccess file first
-                               $this->ret = 'htaccess';
+                               $this->setStatusCode('htaccess');
                        }
                } // END - if
        }
@@ -100,7 +111,7 @@ class CacheSystem {
        // Initializes the cache file
        function init () {
                // This will destory an existing cache file!
-               if ($this->ret == $this->statusDone) {
+               if ($this->getStatusCode() == 'done') {
                        // Reset read status
                        $this->resetCacheReadStatus();
 
@@ -337,7 +348,7 @@ class CacheSystem {
 
        // Unused method:
        function removeEntry ($search, $data, $array) {
-               if ($this->status[$this->name] == $this->statusDone) {
+               if ($this->status[$this->name] == 'done') {
                        // Load cache into dummy array
                        $dummy = $this->getArrayFromCache();
 
@@ -374,7 +385,7 @@ class CacheSystem {
                                        foreach($v as $k2 => $v2) {
                                                // Put every array element in a row...
                                                $LINE .= $this->rewriteEntry($k, $v2);
-                                       }
+                                       } // END - foreach
                                } else {
                                        // Single line found
                                        $LINE = $this->rewriteEntry($k, $v);
@@ -391,7 +402,7 @@ class CacheSystem {
 
        // Unused method
        function replaceEntry ($search, $replace, $search_key, $array) {
-               if ($this->status[$this->name] == $this->statusDone) {
+               if ($this->status[$this->name] == 'done') {
                        // Load cache into dummy array
                        $dummy = $this->getArrayFromCache();
 
@@ -526,9 +537,14 @@ class CacheSystem {
                return $line;
        }
 
-       // Getter for cache status
-       function getStatus () {
-               return $this->ret;
+       // Getter for cache status code
+       function getStatusCode () {
+               return $this->statusCode;
+       }
+
+       // Setter for cache status code
+       function setStatusCode ($status) {
+               $this->statusCode = $status;
        }
 
        // Checks wether the current cache file is readable
index 7676c14..9681a30 100644 (file)
@@ -2235,7 +2235,7 @@ function initCacheInstance () {
        $GLOBALS['cache_instance'] = new CacheSystem();
 
        // Did it work?
-       if ($GLOBALS['cache_instance']->getStatus() != 'done') {
+       if ($GLOBALS['cache_instance']->getStatusCode() != 'done') {
                // Failed to initialize cache sustem
                addFatalMessage(__FUNCTION__, __LINE__, '(<font color="#0000aa">' . __LINE__ . '</font>): {--CACHE_CANNOT_INITIALIZE--}');
        } // END - if