code cleanup

This commit is contained in:
Michael Save 2012-04-13 00:18:19 +10:00
parent da52307c67
commit 51675e7a9b
14 changed files with 578 additions and 578 deletions

View file

@ -4,7 +4,7 @@
* Copyright (c) 2010-2012 Tinyboard Development Group
*/
if(realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
if (realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
// You cannot request this file directly.
exit;
}
@ -14,7 +14,7 @@ class Cache {
public static function init() {
global $config;
switch($config['cache']['enabled']) {
switch ($config['cache']['enabled']) {
case 'memcached':
self::$cache = new Memcached();
self::$cache->addServers($config['cache']['memcached']);
@ -30,9 +30,9 @@ class Cache {
$key = $config['cache']['prefix'] . $key;
$data = false;
switch($config['cache']['enabled']) {
switch ($config['cache']['enabled']) {
case 'memcached':
if(!self::$cache)
if (!self::$cache)
self::init();
$data = self::$cache->get($key);
break;
@ -48,7 +48,7 @@ class Cache {
}
// debug
if($data && $config['debug']) {
if ($data && $config['debug']) {
$debug['cached'][] = $key;
}
@ -59,12 +59,12 @@ class Cache {
$key = $config['cache']['prefix'] . $key;
if(!$expires)
if (!$expires)
$expires = $config['cache']['timeout'];
switch($config['cache']['enabled']) {
switch ($config['cache']['enabled']) {
case 'memcached':
if(!self::$cache)
if (!self::$cache)
self::init();
self::$cache->set($key, $value, $expires);
break;
@ -84,9 +84,9 @@ class Cache {
$key = $config['cache']['prefix'] . $key;
switch($config['cache']['enabled']) {
switch ($config['cache']['enabled']) {
case 'memcached':
if(!self::$cache)
if (!self::$cache)
self::init();
self::$cache->delete($key);
break;
@ -104,9 +104,9 @@ class Cache {
public static function flush() {
global $config;
switch($config['cache']['enabled']) {
switch ($config['cache']['enabled']) {
case 'memcached':
if(!self::$cache)
if (!self::$cache)
self::init();
return self::$cache->flush();
case 'apc':