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 ed67f4a32789ad60ce93fc3491e8fd924a2b52d5..587a5281a14b8ad033f1a6c2c1050d63948bdf27 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 7676c1404dfa4589f256a79116a78ff326bb4ef1..9681a3020a5f7a3b36b88aa3b41931ed41e438ed 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