Skip to content

Commit

Permalink
fixing formatting of braces
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Jun 20, 2012
1 parent fe6ee30 commit f13a40f
Show file tree
Hide file tree
Showing 303 changed files with 1,793 additions and 1,793 deletions.
62 changes: 31 additions & 31 deletions Config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* Try apc or memcache, default to the namespaceFile cache.
*/
$cacheEngine = 'File';
switch(true){
switch(true) {
case function_exists('apc_cache_info') && ini_get('apc.enabled'):
$cacheEngine = 'Apc';
break;
Expand Down Expand Up @@ -83,8 +83,8 @@
* Event to get the values from all the plugins and cache them
*/
$cachedConfigs = Cache::read('global_configs');
if(!empty($cachedConfigs)){
foreach($cachedConfigs as $k => $v){
if(!empty($cachedConfigs)) {
foreach($cachedConfigs as $k => $v) {
Configure::write($k, $v);
}
}
Expand All @@ -106,10 +106,10 @@
/**
* Make sure the json defines are loaded.
*/
if(!defined('JSON_ERROR_NONE')){define('JSON_ERROR_NONE', 0);}
if(!defined('JSON_ERROR_DEPTH')){define('JSON_ERROR_DEPTH', 1);}
if(!defined('JSON_ERROR_CTRL_CHAR')){define('JSON_ERROR_CTRL_CHAR', 3);}
if(!defined('JSON_ERROR_SYNTAX')){define('JSON_ERROR_SYNTAX', 4);}
if(!defined('JSON_ERROR_NONE')) {define('JSON_ERROR_NONE', 0);}
if(!defined('JSON_ERROR_DEPTH')) {define('JSON_ERROR_DEPTH', 1);}
if(!defined('JSON_ERROR_CTRL_CHAR')) {define('JSON_ERROR_CTRL_CHAR', 3);}
if(!defined('JSON_ERROR_SYNTAX')) {define('JSON_ERROR_SYNTAX', 4);}

if (!function_exists('lcfirst')) {
function lcfirst($str) {
Expand All @@ -121,12 +121,12 @@ function configureCache($cacheDetails) {
foreach($cacheDetails['setupCache'] as $plugin => $cache) {
$cache['config']['prefix'] = isset($cache['config']['prefix']) ? $cache['config']['prefix'] : '';
$folder = str_replace('.', DS, $cache['config']['prefix']);
if(!strstr($folder, 'core' . DS)){
if(!strstr($folder, 'core' . DS)) {
$folder = 'plugins' . DS . $folder;
}

if(Configure::read('Cache.engine') == 'Libs.NamespaceFile') {
if(!is_dir(CACHE . $folder)){
if(!is_dir(CACHE . $folder)) {
$Folder = new Folder(CACHE . $folder, true);
}
}
Expand Down Expand Up @@ -176,7 +176,7 @@ function cachePrefix() {
* @param string $str the stuff you want escaped
* @return string the escaped string
*/
function regexEscape($str){
function regexEscape($str) {
$patterns = array(
'/\//', '/\^/', '/\./', '/\$/', '/\|/',
'/\(/', '/\)/', '/\[/', '/\]/', '/\*/',
Expand All @@ -200,7 +200,7 @@ function regexEscape($str){
*
* @return a nice unique name
*/
function cacheName($prefix = 'PleaseNameMe', $data = null){
function cacheName($prefix = 'PleaseNameMe', $data = null) {
$hash = '';

if ($data) {
Expand Down Expand Up @@ -230,9 +230,9 @@ function cacheName($prefix = 'PleaseNameMe', $data = null){
*
* @return a nice name
*/
function prettyName($class = null){
if($class !== null){
if(!class_exists('Inflector')){
function prettyName($class = null) {
if($class !== null) {
if(!class_exists('Inflector')) {
App::import('Inflector');
}

Expand All @@ -257,13 +257,13 @@ function prettyName($class = null){
function debugRoute($route) {
echo 'InfinitasRouter::connect(\''.$route['Route']['url'].'\', array(';
$parts = array();
foreach($route['Route']['values'] as $k => $v){
foreach($route['Route']['values'] as $k => $v) {
$parts[] = "'$k' => '$v'";
}
echo implode(', ', $parts);
echo '), array(';
$parts = array();
foreach($route['Route']['regex'] as $k => $v){
foreach($route['Route']['regex'] as $k => $v) {
$parts[] = "'$k' => '$v'";
}
echo implode(', ', $parts);
Expand Down Expand Up @@ -341,7 +341,7 @@ function debugBacktrace($backtrace) {
}

$lines = sprintf(
'<script type="text/javascript">function debugToggle(id){var e = document.getElementById(\'backtrace-\' + id);if(e.style.display == \'block\') {e.style.display = \'none\';}else {e.style.display = \'block\';}}</script>'.
'<script type="text/javascript">function debugToggle(id) {var e = document.getElementById(\'backtrace-\' + id);if(e.style.display == \'block\') {e.style.display = \'none\';}else {e.style.display = \'block\';}}</script>'.
'<table style="width:80%%; margin:auto;"><tr><th>%s</th></tr><tr>%s</tr></table>',
implode('</th><th>', array('Line', 'File', 'Function')),
implode('</tr><tr>', array_reverse($lines))
Expand All @@ -365,8 +365,8 @@ function debugBacktrace($backtrace) {
*
* @return string size in human readable
*/
function convert($size){
if(!$size){
function convert($size) {
if(!$size) {
return '0 b';
}
$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
Expand All @@ -389,7 +389,7 @@ function convert($size){
*
* @return mixed true if $print, array if !$print
*/
function memoryUsage($print = true, $convert = true){
function memoryUsage($print = true, $convert = true) {
$memory = array(
'current' => memory_get_usage(),
'current_t' => memory_get_usage(true),
Expand All @@ -398,14 +398,14 @@ function memoryUsage($print = true, $convert = true){
'limit' => ini_get('memory_limit')
);

if($convert){
if($convert) {
$memory['current'] = convert($memory['current']);
$memory['current_t'] = convert($memory['current_t']);
$memory['max'] = convert($memory['max']);
$memory['max_'] = convert($memory['max_']);
}

if((bool)$print){
if((bool)$print) {
pr($memory);
unset($memory);
return true;
Expand All @@ -423,24 +423,24 @@ function memoryUsage($print = true, $convert = true){
* @param <type> $print
* @return <type>
*/
function serverLoad($print = true){
function serverLoad($print = true) {
// try file method
$load = @file_get_contents('/proc/loadavg');
if($load){
if($load) {
$load = explode(' ', $load, 4);
unset($load[3]);
}

// try exec
if(!$load){
if(!$load) {
$load = @exec('uptime');

// try shell_exec
if(!$load){
if(!$load) {
$load = @shell_exec('uptime');
}

if($load){
if($load) {
$load = explode(' ', $load);
$load[2] = trim(array_pop($load));
$load[1] = str_replace(',', '', array_pop($load));
Expand All @@ -451,7 +451,7 @@ function serverLoad($print = true){
}
}

if((bool)$print){
if((bool)$print) {
pr($load);
unset($load);
return true;
Expand All @@ -460,7 +460,7 @@ function serverLoad($print = true){
return $load;
}

function systemInfo($extendedInfo = false){
function systemInfo($extendedInfo = false) {
$return = array();
$return['Server'] = array(
'name' => php_uname('n'),
Expand All @@ -475,12 +475,12 @@ function systemInfo($extendedInfo = false){
'sapi' => php_sapi_name()
);

if(!$extendedInfo){
if(!$extendedInfo) {
return $return;
}

$extentions = get_loaded_extensions();
foreach($extentions as $extention){
foreach($extentions as $extention) {
$return['Php']['extentions'][] = array(
'name' => $extention,
'version' => phpversion($extention)
Expand Down
6 changes: 3 additions & 3 deletions Config/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Used to configure some base settings and load configs from all the plugins in the app.
*/

if(substr(env('SERVER_ADDR'), 0, 3) == 127 || substr(env('HTTP_HOST'), -3) == 'dev'){
if(substr(env('SERVER_ADDR'), 0, 3) == 127 || substr(env('HTTP_HOST'), -3) == 'dev') {
Configure::write('debug', 2);
}
else{
Expand All @@ -22,14 +22,14 @@
*/
define('LOG_ERROR', 2);

if(phpversion() >= 5.3){
if(phpversion() >= 5.3) {
date_default_timezone_set(date_default_timezone_get());
}

/**
* if debug is off check for view file cache
*/
if(Configure::read('debug') == 0){
if(Configure::read('debug') == 0) {
Configure::write('Cache.check', true);
}

Expand Down

0 comments on commit f13a40f

Please sign in to comment.