Test Failed
Push — 1.0.0-dev ( 92a7f9...7e13dc )
by nguereza
04:45
created
tests/include/testsUtil.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 	/**
4 4
 	* Function to test private & protected method
5 5
 	*/
6
-	function runPrivateOrProtectedMethod($object, $method, array $args = array()){
6
+	function runPrivateOrProtectedMethod($object, $method, array $args = array()) {
7 7
 		$r = new ReflectionClass(get_class($object));
8 8
 		$m = $r->getMethod($method);
9 9
 		$m->setAccessible(true);
Please login to merge, or discard this patch.
tests/tnhfw/classes/EventTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 		
27 27
 		
28
-		public function testDefaultValue(){
28
+		public function testDefaultValue() {
29 29
 			$e = new Event('foo');
30 30
 			$this->assertSame($e->name, 'foo');
31 31
 			$this->assertSame($e->payload, array());
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 			$this->assertFalse($e->stop);
34 34
 		}
35 35
 		
36
-		public function testPayloadValueIsSet(){
36
+		public function testPayloadValueIsSet() {
37 37
 			$e = new Event('foo', array('bar'));
38 38
 			$this->assertSame($e->name, 'foo');
39 39
 			$this->assertSame($e->payload, array('bar'));
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			$this->assertFalse($e->stop);
42 42
 		}
43 43
 		
44
-		public function testReturnBackValueIsSetToTrue(){
44
+		public function testReturnBackValueIsSetToTrue() {
45 45
 			$e = new Event('foo', array('bar'), true);
46 46
 			$this->assertSame($e->name, 'foo');
47 47
 			$this->assertSame($e->payload, array('bar'));
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 			$this->assertFalse($e->stop);
50 50
 		}
51 51
 		
52
-		public function testStopValueIsSetToTue(){
52
+		public function testStopValueIsSetToTue() {
53 53
 			$e = new Event('foo', array('bar'), true, true);
54 54
 			$this->assertSame($e->name, 'foo');
55 55
 			$this->assertSame($e->payload, array('bar'));
Please login to merge, or discard this patch.
core/common.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 		//put the first letter of class to upper case 
54 54
 		$class = ucfirst($class);
55 55
 		static $classes = array();
56
-		if(isset($classes[$class]) /*hack for duplicate log Logger name*/ && $class != 'Log'){
56
+		if (isset($classes[$class]) /*hack for duplicate log Logger name*/ && $class != 'Log') {
57 57
 			return $classes[$class];
58 58
 		}
59 59
 		$found = false;
60 60
 		foreach (array(ROOT_PATH, CORE_PATH) as $path) {
61 61
 			$file = $path . $dir . '/' . $class . '.php';
62
-			if(file_exists($file)){
63
-				if(class_exists($class, false) == false){
62
+			if (file_exists($file)) {
63
+				if (class_exists($class, false) == false) {
64 64
 					require_once $file;
65 65
 				}
66 66
 				//already found
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 				break;
69 69
 			}
70 70
 		}
71
-		if(! $found){
71
+		if (!$found) {
72 72
 			//can't use show_error() at this time because some dependencies not yet loaded
73 73
 			set_http_status_header(503);
74 74
 			echo 'Cannot find the class [' . $class . ']';
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		/*
79 79
 		   TODO use the best method to get the Log instance
80 80
 		 */
81
-		if($class == 'Log'){
81
+		if ($class == 'Log') {
82 82
 			//can't use the instruction like "return new Log()" 
83 83
 			//because we need return the reference instance of the loaded class.
84 84
 			$log = new Log();
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	function & class_loaded($class = null){
104 104
 		static $list = array();
105
-		if($class != null){
105
+		if ($class != null) {
106 106
 			$list[strtolower($class)] = $class;
107 107
 		}
108 108
 		return $list;
@@ -117,22 +117,22 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	function & load_configurations(array $overwrite_values = array()){
119 119
 		static $config;
120
-		if(empty($config)){
120
+		if (empty($config)) {
121 121
 			$file = CONFIG_PATH . 'config.php';
122 122
 			$found = false;
123
-			if(file_exists($file)){
123
+			if (file_exists($file)) {
124 124
 				require_once $file;
125 125
 				$found = true;
126 126
 			}
127
-			if(! $found){
127
+			if (!$found) {
128 128
 				set_http_status_header(503);
129 129
 				echo 'Unable to find the configuration file [' . $file . ']';
130 130
 				exit(1);
131 131
 			}
132 132
 
133
-			if(! isset($config) || !is_array($config)){
133
+			if (!isset($config) || !is_array($config)) {
134 134
 				set_http_status_header(503);
135
-				echo 'No configuration found in file ['  . $file . ']';
135
+				echo 'No configuration found in file [' . $file . ']';
136 136
 				exit(1);
137 137
 			}
138 138
 		}
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
 	 * 
151 151
 	 * @return mixed          the config value
152 152
 	 */
153
-	function get_config($key, $default = null){
153
+	function get_config($key, $default = null) {
154 154
 		static $cfg;
155
-		if(empty($cfg)){
155
+		if (empty($cfg)) {
156 156
 			$cfg[0] = & load_configurations();
157 157
 		}
158 158
 		return array_key_exists($key, $cfg[0]) ? $cfg[0][$key] : $default;
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 	 * 
167 167
 	 * @codeCoverageIgnore
168 168
 	 */
169
-	function save_to_log($level, $message, $logger = null){
170
-		$log =& class_loader('Log', 'classes');
171
-		if($logger){
169
+	function save_to_log($level, $message, $logger = null) {
170
+		$log = & class_loader('Log', 'classes');
171
+		if ($logger) {
172 172
 			$log->setLogger($logger);
173 173
 		}
174 174
 		$log->writeLog($message, $level);
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 	 * 
182 182
 	 * @codeCoverageIgnore
183 183
 	 */
184
-	function set_http_status_header($code = 200, $text = null){
185
-		if(! $code || !is_numeric($code)){
184
+	function set_http_status_header($code = 200, $text = null) {
185
+		if (!$code || !is_numeric($code)) {
186 186
 			show_error('HTTP status code must be an integer');
187 187
 		}
188
-		if(empty($text)){
188
+		if (empty($text)) {
189 189
 			$code = abs($code);
190 190
 			$http_status = array(
191 191
 								100 => 'Continue',
@@ -234,18 +234,18 @@  discard block
 block discarded – undo
234 234
 								504 => 'Gateway Timeout',
235 235
 								505 => 'HTTP Version Not Supported',
236 236
 							);
237
-			if(isset($http_status[$code])){
237
+			if (isset($http_status[$code])) {
238 238
 				$text = $http_status[$code];
239 239
 			}
240
-			else{
240
+			else {
241 241
 				show_error('No HTTP status text found for your code please check it.');
242 242
 			}
243 243
 		}
244 244
 		
245
-		if(strpos(php_sapi_name(), 'cgi') === 0){
245
+		if (strpos(php_sapi_name(), 'cgi') === 0) {
246 246
 			header('Status: ' . $code . ' ' . $text, TRUE);
247 247
 		}
248
-		else{
248
+		else {
249 249
 			$proto = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
250 250
 			header($proto . ' ' . $code . ' ' . $text, TRUE, $code);
251 251
 		}
@@ -260,12 +260,12 @@  discard block
 block discarded – undo
260 260
 	 *  
261 261
 	 *  @codeCoverageIgnore
262 262
 	 */
263
-	function show_error($msg, $title = 'error', $logging = true){
263
+	function show_error($msg, $title = 'error', $logging = true) {
264 264
 		$title = strtoupper($title);
265 265
 		$data['error'] = $msg;
266 266
 		$data['title'] = $title;
267
-		if($logging){
268
-			save_to_log('error', '['.$title.'] '.strip_tags($msg), 'GLOBAL::ERROR');
267
+		if ($logging) {
268
+			save_to_log('error', '[' . $title . '] ' . strip_tags($msg), 'GLOBAL::ERROR');
269 269
 		}
270 270
 		$response = & class_loader('Response', 'classes');
271 271
 		$response->sendError($data);
@@ -279,18 +279,18 @@  discard block
 block discarded – undo
279 279
 	 *  
280 280
 	 *  @return boolean true if the web server uses the https protocol, false if not.
281 281
 	 */
282
-	function is_https(){
282
+	function is_https() {
283 283
 		/*
284 284
 		* some servers pass the "HTTPS" parameter in the server variable,
285 285
 		* if is the case, check if the value is "on", "true", "1".
286 286
 		*/
287
-		if(isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off'){
287
+		if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') {
288 288
 			return true;
289 289
 		}
290
-		else if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'){
290
+		else if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
291 291
 			return true;
292 292
 		}
293
-		else if(isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off'){
293
+		else if (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') {
294 294
 			return true;
295 295
 		}
296 296
 		return false;
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	 *  
306 306
 	 *  @return boolean true if is a valid URL address or false.
307 307
 	 */
308
-	function is_url($url){
308
+	function is_url($url) {
309 309
 		return preg_match('/^(http|https|ftp):\/\/(.*)/', $url);
310 310
 	}
311 311
 	
@@ -315,8 +315,8 @@  discard block
 block discarded – undo
315 315
 	 *  @param string $controllerClass the controller class name to be loaded
316 316
 	 *  @codeCoverageIgnore
317 317
 	 */
318
-	function autoload_controller($controllerClass){
319
-		if(file_exists($path = APPS_CONTROLLER_PATH . $controllerClass . '.php')){
318
+	function autoload_controller($controllerClass) {
319
+		if (file_exists($path = APPS_CONTROLLER_PATH . $controllerClass . '.php')) {
320 320
 			require_once $path;
321 321
 		}
322 322
 	}
@@ -330,11 +330,11 @@  discard block
 block discarded – undo
330 330
 	 *  
331 331
 	 *  @return boolean
332 332
 	 */
333
-	function php_exception_handler($ex){
334
-		if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors'))){
335
-			show_error('An exception is occured in file '. $ex->getFile() .' at line ' . $ex->getLine() . ' raison : ' . $ex->getMessage(), 'PHP Exception #' . $ex->getCode());
333
+	function php_exception_handler($ex) {
334
+		if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors'))) {
335
+			show_error('An exception is occured in file ' . $ex->getFile() . ' at line ' . $ex->getLine() . ' raison : ' . $ex->getMessage(), 'PHP Exception #' . $ex->getCode());
336 336
 		}
337
-		else{
337
+		else {
338 338
 			save_to_log('error', 'An exception is occured in file ' . $ex->getFile() . ' at line ' . $ex->getLine() . ' raison : ' . $ex->getMessage(), 'PHP Exception');
339 339
 		}
340 340
 		exit(1);
@@ -353,16 +353,16 @@  discard block
 block discarded – undo
353 353
 	 *  
354 354
 	 *  @return boolean	
355 355
 	 */
356
-	function php_error_handler($errno , $errstr, $errfile , $errline, array $errcontext = array()){
356
+	function php_error_handler($errno, $errstr, $errfile, $errline, array $errcontext = array()) {
357 357
 		$isError = (((E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $errno) === $errno);
358
-		if($isError){
358
+		if ($isError) {
359 359
 			set_http_status_header(500);
360 360
 		}
361
-		if (! (error_reporting() & $errno)) {
361
+		if (!(error_reporting() & $errno)) {
362 362
 			save_to_log('error', 'An error is occurred in the file ' . $errfile . ' at line ' . $errline . ' raison : ' . $errstr, 'PHP ' . $error_type, 'PHP ERROR');
363 363
 			return;
364 364
 		}
365
-		if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors'))){
365
+		if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors'))) {
366 366
 			$errorType = 'error';
367 367
 			switch ($errno) {
368 368
 				case E_USER_ERROR:
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
 					$errorType = 'error';
379 379
 					break;
380 380
 			}
381
-			show_error('An error is occurred in the file <b>' . $errfile . '</b> at line <b>' . $errline .'</b> raison : ' . $errstr, 'PHP ' . $errorType);
381
+			show_error('An error is occurred in the file <b>' . $errfile . '</b> at line <b>' . $errline . '</b> raison : ' . $errstr, 'PHP ' . $errorType);
382 382
 		}
383
-		if ($isError){
383
+		if ($isError) {
384 384
 			exit(1);
385 385
 		}
386 386
 		return true;
@@ -390,10 +390,10 @@  discard block
 block discarded – undo
390 390
 	 * This function is used to run in shutdown situation of the script
391 391
 	 * @codeCoverageIgnore
392 392
 	 */
393
-	function php_shudown_handler(){
393
+	function php_shudown_handler() {
394 394
 		$lastError = error_get_last();
395 395
 		if (isset($lastError) &&
396
-			($lastError['type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING))){
396
+			($lastError['type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING))) {
397 397
 			php_error_handler($lastError['type'], $lastError['message'], $lastError['file'], $lastError['line']);
398 398
 		}
399 399
 	}
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 	 *   
413 413
 	 *  @return string string of the HTML attribute.
414 414
 	 */
415
-	function attributes_to_string(array $attributes){
415
+	function attributes_to_string(array $attributes) {
416 416
 		$str = ' ';
417 417
 		//we check that the array passed as an argument is not empty.
418
-		if(! empty($attributes)){
419
-			foreach($attributes as $key => $value){
418
+		if (!empty($attributes)) {
419
+			foreach ($attributes as $key => $value) {
420 420
 				$key = trim(htmlspecialchars($key));
421 421
 				$value = trim(htmlspecialchars($value));
422 422
 				/*
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 				* 	$attr = array('placeholder' => 'I am a "puple"')
427 427
 				* 	$str = attributes_to_string($attr); => placeholder = "I am a \"puple\""
428 428
 				 */
429
-				if($value && strpos('"', $value) !== false){
429
+				if ($value && strpos('"', $value) !== false) {
430 430
 					$value = addslashes($value);
431 431
 				}
432
-				$str .= $key.' = "'.$value.'" ';
432
+				$str .= $key . ' = "' . $value . '" ';
433 433
 			}
434 434
 		}
435 435
 		//remove the space after using rtrim()
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	*
446 446
 	* @return string the stringfy value
447 447
 	*/
448
-	function stringfy_vars($var){
448
+	function stringfy_vars($var) {
449 449
 		return print_r($var, true);
450 450
 	}
451 451
 
@@ -456,18 +456,18 @@  discard block
 block discarded – undo
456 456
 	 * 
457 457
 	 * @return mixed   the sanitize value
458 458
 	 */
459
-	function clean_input($str){
460
-		if(is_array($str)){
459
+	function clean_input($str) {
460
+		if (is_array($str)) {
461 461
 			$str = array_map('clean_input', $str);
462 462
 		}
463
-		else if(is_object($str)){
463
+		else if (is_object($str)) {
464 464
 			$obj = $str;
465 465
 			foreach ($str as $var => $value) {
466 466
 				$obj->$var = clean_input($value);
467 467
 			}
468 468
 			$str = $obj;
469 469
 		}
470
-		else{
470
+		else {
471 471
 			$str = htmlspecialchars(strip_tags($str), ENT_QUOTES, 'UTF-8');
472 472
 		}
473 473
 		return $str;
@@ -485,11 +485,11 @@  discard block
 block discarded – undo
485 485
 	 * 
486 486
 	 * @return string the string with the hidden part.
487 487
 	 */
488
-	function string_hidden($str, $startCount = 0, $endCount = 0, $hiddenChar = '*'){
488
+	function string_hidden($str, $startCount = 0, $endCount = 0, $hiddenChar = '*') {
489 489
 		//get the string length
490 490
 		$len = strlen($str);
491 491
 		//if str is empty
492
-		if($len <= 0){
492
+		if ($len <= 0) {
493 493
 			return str_repeat($hiddenChar, 6);
494 494
 		}
495 495
 		//if the length is less than startCount and endCount
@@ -497,14 +497,14 @@  discard block
 block discarded – undo
497 497
 		//or startCount is negative or endCount is negative
498 498
 		//return the full string hidden
499 499
 		
500
-		if((($startCount + $endCount) > $len) || ($startCount == 0 && $endCount == 0) || ($startCount < 0 || $endCount < 0)){
500
+		if ((($startCount + $endCount) > $len) || ($startCount == 0 && $endCount == 0) || ($startCount < 0 || $endCount < 0)) {
501 501
 			return str_repeat($hiddenChar, $len);
502 502
 		}
503 503
 		//the start non hidden string
504 504
 		$startNonHiddenStr = substr($str, 0, $startCount);
505 505
 		//the end non hidden string
506 506
 		$endNonHiddenStr = null;
507
-		if($endCount > 0){
507
+		if ($endCount > 0) {
508 508
 			$endNonHiddenStr = substr($str, - $endCount);
509 509
 		}
510 510
 		//the hidden string
@@ -517,31 +517,31 @@  discard block
 block discarded – undo
517 517
 	 * This function is used to set the initial session config regarding the configuration
518 518
 	 * @codeCoverageIgnore
519 519
 	 */
520
-	function set_session_config(){
520
+	function set_session_config() {
521 521
 		//$_SESSION is not available on cli mode 
522
-		if(! IS_CLI){
523
-			$logger =& class_loader('Log', 'classes');
522
+		if (!IS_CLI) {
523
+			$logger = & class_loader('Log', 'classes');
524 524
 			$logger->setLogger('PHPSession');
525 525
 			//set session params
526 526
 			$sessionHandler = get_config('session_handler', 'files'); //the default is to store in the files
527 527
 			$sessionName = get_config('session_name');
528
-			if($sessionName){
528
+			if ($sessionName) {
529 529
 				session_name($sessionName);
530 530
 			}
531 531
 			$logger->info('Session handler: ' . $sessionHandler);
532 532
 			$logger->info('Session name: ' . $sessionName);
533 533
 
534
-			if($sessionHandler == 'files'){
534
+			if ($sessionHandler == 'files') {
535 535
 				$sessionSavePath = get_config('session_save_path');
536
-				if($sessionSavePath){
537
-					if(! is_dir($sessionSavePath)){
536
+				if ($sessionSavePath) {
537
+					if (!is_dir($sessionSavePath)) {
538 538
 						mkdir($sessionSavePath, 1773);
539 539
 					}
540 540
 					session_save_path($sessionSavePath);
541 541
 					$logger->info('Session save path: ' . $sessionSavePath);
542 542
 				}
543 543
 			}
544
-			else if($sessionHandler == 'database'){
544
+			else if ($sessionHandler == 'database') {
545 545
 				//load database session handle library
546 546
 				//Model
547 547
 				require_once CORE_CLASSES_MODEL_PATH . 'Model.php';
@@ -549,11 +549,11 @@  discard block
 block discarded – undo
549 549
 				//Database Session handler Model
550 550
 				require_once CORE_CLASSES_MODEL_PATH . 'DBSessionHandlerModel.php';
551 551
 
552
-				$DBS =& class_loader('DBSessionHandler', 'classes');
552
+				$DBS = & class_loader('DBSessionHandler', 'classes');
553 553
 				session_set_save_handler($DBS, true);
554 554
 				$logger->info('session save path: ' . get_config('session_save_path'));
555 555
 			}
556
-			else{
556
+			else {
557 557
 				show_error('Invalid session handler configuration');
558 558
 			}
559 559
 			$lifetime = get_config('session_cookie_lifetime', 0);
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 			$logger->info('Session lifetime: ' . $lifetime);
577 577
 			$logger->info('Session cookie path: ' . $path);
578 578
 			$logger->info('Session domain: ' . $domain);
579
-			$logger->info('Session is secure: ' . ($secure ? 'TRUE':'FALSE'));
579
+			$logger->info('Session is secure: ' . ($secure ? 'TRUE' : 'FALSE'));
580 580
 			
581
-			if((function_exists('session_status') && session_status() !== PHP_SESSION_ACTIVE) || !session_id()){
581
+			if ((function_exists('session_status') && session_status() !== PHP_SESSION_ACTIVE) || !session_id()) {
582 582
 				$logger->info('Session not yet start, start it now');
583 583
 				session_start();
584 584
 			}
Please login to merge, or discard this patch.
core/functions/function_user_agent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	
43 43
 	 
44
-	if(! function_exists('get_ip')){
44
+	if (!function_exists('get_ip')) {
45 45
 		/**
46 46
 		 *  Retrieves the user's IP address
47 47
 		 *  
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		 *  
51 51
 		 *  @return string the IP address.
52 52
 		 */
53
-		function get_ip(){
53
+		function get_ip() {
54 54
 			$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1';
55 55
 
56 56
 			if (isset($_SERVER["HTTP_CLIENT_IP"])) {
Please login to merge, or discard this patch.
core/classes/model/DBSessionHandlerModel.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		 */
46 46
 		protected $sessionTableColumns = array();
47 47
 
48
-		public function __construct(Database $db = null){
48
+		public function __construct(Database $db = null) {
49 49
 			parent::__construct($db);
50 50
 		}
51 51
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		 * Return the session database table columns
54 54
 		 * @return array 
55 55
 		 */
56
-		public function getSessionTableColumns(){
56
+		public function getSessionTableColumns() {
57 57
 			return $this->sessionTableColumns;
58 58
 		}
59 59
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		 * Set the session database table columns
62 62
 		 * @param array $columns the columns definition
63 63
 		 */
64
-		public function setSessionTableColumns(array $columns){
64
+		public function setSessionTableColumns(array $columns) {
65 65
 			$this->sessionTableColumns = $columns;
66 66
 			return $this;
67 67
 		}
Please login to merge, or discard this patch.
core/classes/model/Model.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @copyright Copyright (c) 2012, Jamie Rumbelow <http://jamierumbelow.net>
34 34
      */
35 35
 
36
-    class Model{
36
+    class Model {
37 37
 
38 38
         /* --------------------------------------------------------------
39 39
          * VARIABLES
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
          * Initialise the model, tie into the CodeIgniter superobject and
141 141
          * try our best to guess the table name.
142 142
          */
143
-        public function __construct(Database $db = null){
144
-            if(is_object($db)){
143
+        public function __construct(Database $db = null) {
144
+            if (is_object($db)) {
145 145
                 $this->setDatabaseInstance($db);
146 146
             }
147
-            else{
147
+            else {
148 148
                 $obj = & get_instance();
149
-        		if(isset($obj->database) && is_object($obj->database)){
149
+        		if (isset($obj->database) && is_object($obj->database)) {
150 150
                     /**
151 151
                     * NOTE: Need use "clone" because some Model need have the personal instance of the database library
152 152
                     * to prevent duplication
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
 
183 183
             if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
184 184
             {
185
-                $this->_database->where($this->soft_delete_key, (bool)$this->_temporary_only_deleted);
185
+                $this->_database->where($this->soft_delete_key, (bool) $this->_temporary_only_deleted);
186 186
             }
187 187
 
188 188
     		$this->_set_where($where);
189 189
 
190 190
             $this->trigger('before_get');
191
-			$type = $this->_temporary_return_type == 'array' ? 'array':false;
191
+			$type = $this->_temporary_return_type == 'array' ? 'array' : false;
192 192
             $row = $this->_database->from($this->_table)->get($type);
193 193
             $this->_temporary_return_type = $this->return_type;
194 194
             $row = $this->trigger('after_get', $row);
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
             $this->trigger('before_get');
225 225
             if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
226 226
             {
227
-                $this->_database->where($this->soft_delete_key, (bool)$this->_temporary_only_deleted);
227
+                $this->_database->where($this->soft_delete_key, (bool) $this->_temporary_only_deleted);
228 228
             }
229
-			$type = $this->_temporary_return_type == 'array' ? 'array':false;
229
+			$type = $this->_temporary_return_type == 'array' ? 'array' : false;
230 230
             $result = $this->_database->from($this->_table)->getAll($type);
231 231
             $this->_temporary_return_type = $this->return_type;
232 232
 
@@ -332,13 +332,13 @@  discard block
 block discarded – undo
332 332
         {
333 333
             $args = func_get_args();
334 334
             $data = array();
335
-            if(count($args) == 2){
336
-                if(is_array($args[1])){
335
+            if (count($args) == 2) {
336
+                if (is_array($args[1])) {
337 337
                     $data = array_pop($args);
338 338
                 }
339 339
             }
340
-            else if(count($args) == 3){
341
-                if(is_array($args[2])){
340
+            else if (count($args) == 3) {
341
+                if (is_array($args[2])) {
342 342
                     $data = array_pop($args);
343 343
                 }
344 344
             }
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
             $this->_database->where($this->primary_key, $id);
377 377
             if ($this->soft_delete)
378 378
             {
379
-                $result = $this->_database->from($this->_table)->update(array( $this->soft_delete_key => TRUE ));
379
+                $result = $this->_database->from($this->_table)->update(array($this->soft_delete_key => TRUE));
380 380
             }
381 381
             else
382 382
             {
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
             $this->_set_where($where);
398 398
             if ($this->soft_delete)
399 399
             {
400
-                $result = $this->_database->from($this->_table)->update(array( $this->soft_delete_key => TRUE ));
400
+                $result = $this->_database->from($this->_table)->update(array($this->soft_delete_key => TRUE));
401 401
             }
402 402
             else
403 403
             {
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
             $this->_database->in($this->primary_key, $primary_values);
417 417
             if ($this->soft_delete)
418 418
             {
419
-                $result = $this->_database->from($this->_table)->update(array( $this->soft_delete_key => TRUE ));
419
+                $result = $this->_database->from($this->_table)->update(array($this->soft_delete_key => TRUE));
420 420
             }
421 421
             else
422 422
             {
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
                 if (is_string($value))
463 463
                 {
464 464
                     $relationship = $value;
465
-                    $options = array( 'primary_key' => $value . '_id', 'model' => $value . '_model' );
465
+                    $options = array('primary_key' => $value . '_id', 'model' => $value . '_model');
466 466
                 }
467 467
                 else
468 468
                 {
@@ -472,10 +472,10 @@  discard block
 block discarded – undo
472 472
 
473 473
                 if (in_array($relationship, $this->_with))
474 474
                 {
475
-                    if(is_object($this->loaderInstance)){
475
+                    if (is_object($this->loaderInstance)) {
476 476
                         $this->loaderInstance->model($options['model'], $relationship . '_model');
477 477
                     }
478
-                    else{
478
+                    else {
479 479
                         Loader::model($options['model'], $relationship . '_model');    
480 480
                     }
481 481
                     if (is_object($row))
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
                 if (is_string($value))
495 495
                 {
496 496
                     $relationship = $value;
497
-                    $options = array( 'primary_key' => $this->_table . '_id', 'model' => $value . '_model' );
497
+                    $options = array('primary_key' => $this->_table . '_id', 'model' => $value . '_model');
498 498
                 }
499 499
                 else
500 500
                 {
@@ -504,10 +504,10 @@  discard block
 block discarded – undo
504 504
 
505 505
                 if (in_array($relationship, $this->_with))
506 506
                 {
507
-                    if(is_object($this->loaderInstance)){
507
+                    if (is_object($this->loaderInstance)) {
508 508
                         $this->loaderInstance->model($options['model'], $relationship . '_model');
509 509
                     }
510
-                    else{
510
+                    else {
511 511
                         Loader::model($options['model'], $relationship . '_model');    
512 512
                     }
513 513
                     if (is_object($row))
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
         public function dropdown()
534 534
         {
535 535
             $args = func_get_args();
536
-            if(count($args) == 2)
536
+            if (count($args) == 2)
537 537
             {
538 538
                 list($key, $value) = $args;
539 539
             }
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
                 $key = $this->primary_key;
543 543
                 $value = $args[0];
544 544
             }
545
-            $this->trigger('before_dropdown', array( $key, $value ));
545
+            $this->trigger('before_dropdown', array($key, $value));
546 546
             if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
547 547
             {
548 548
                 $this->_database->where($this->soft_delete_key, FALSE);
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
         {
567 567
             if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
568 568
             {
569
-                $this->_database->where($this->soft_delete_key, (bool)$this->_temporary_only_deleted);
569
+                $this->_database->where($this->soft_delete_key, (bool) $this->_temporary_only_deleted);
570 570
             }
571 571
             $where = func_get_args();
572 572
             $this->_set_where($where);
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
         {
582 582
             if ($this->soft_delete && $this->_temporary_with_deleted !== TRUE)
583 583
             {
584
-                $this->_database->where($this->soft_delete_key, (bool)$this->_temporary_only_deleted);
584
+                $this->_database->where($this->soft_delete_key, (bool) $this->_temporary_only_deleted);
585 585
             }
586 586
             $this->_database->from($this->_table)->getAll();
587 587
             return $this->_database->numRows();
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
 		/**
591 591
 		* Enabled cache temporary
592 592
 		*/
593
-		public function cached($ttl = 0){
594
-		  if($ttl > 0){
593
+		public function cached($ttl = 0) {
594
+		  if ($ttl > 0) {
595 595
 			$this->_database = $this->_database->cached($ttl);
596 596
 		  }
597 597
 		  return $this;
@@ -745,13 +745,13 @@  discard block
 block discarded – undo
745 745
             {
746 746
                 if (is_object($row))
747 747
                 {
748
-					if(isset($row->$attr)){
748
+					if (isset($row->$attr)) {
749 749
 						unset($row->$attr);
750 750
 					}
751 751
                 }
752 752
                 else
753 753
                 {
754
-					if(isset($row[$attr])){
754
+					if (isset($row[$attr])) {
755 755
 						unset($row[$attr]);
756 756
 					}
757 757
                 }
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
          * Return the database instance
764 764
          * @return Database the database instance
765 765
          */
766
-        public function getDatabaseInstance(){
766
+        public function getDatabaseInstance() {
767 767
             return $this->_database;
768 768
         }
769 769
 
@@ -771,9 +771,9 @@  discard block
 block discarded – undo
771 771
          * set the Database instance for future use
772 772
          * @param Database $db the database object
773 773
          */
774
-         public function setDatabaseInstance($db){
774
+         public function setDatabaseInstance($db) {
775 775
             $this->_database = $db;
776
-            if($this->dbCacheTime > 0){
776
+            if ($this->dbCacheTime > 0) {
777 777
                 $this->_database->setCache($this->dbCacheTime);
778 778
             }
779 779
             return $this;
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
          * Return the loader instance
784 784
          * @return Loader the loader instance
785 785
          */
786
-        public function getLoader(){
786
+        public function getLoader() {
787 787
             return $this->loaderInstance;
788 788
         }
789 789
 
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
          * set the loader instance for future use
792 792
          * @param Loader $loader the loader object
793 793
          */
794
-         public function setLoader($loader){
794
+         public function setLoader($loader) {
795 795
             $this->loaderInstance = $loader;
796 796
             return $this;
797 797
         }
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
          * Return the FormValidation instance
801 801
          * @return FormValidation the form validation instance
802 802
          */
803
-        public function getFormValidation(){
803
+        public function getFormValidation() {
804 804
             return $this->formValidationInstance;
805 805
         }
806 806
 
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
          * set the form validation instance for future use
809 809
          * @param FormValidation $fv the form validation object
810 810
          */
811
-         public function setFormValidation($fv){
811
+         public function setFormValidation($fv) {
812 812
             $this->formValidationInstance = $fv;
813 813
             return $this;
814 814
         }
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
          */
823 823
         public function order_by($criteria, $order = 'ASC')
824 824
         {
825
-            if ( is_array($criteria) )
825
+            if (is_array($criteria))
826 826
             {
827 827
                 foreach ($criteria as $key => $value)
828 828
                 {
@@ -878,22 +878,22 @@  discard block
 block discarded – undo
878 878
          */
879 879
         protected function validate(array $data)
880 880
         {
881
-            if($this->skip_validation)
881
+            if ($this->skip_validation)
882 882
             {
883 883
                 return $data;
884 884
             }
885
-            if(!empty($this->validate))
885
+            if (!empty($this->validate))
886 886
             {
887 887
                 $fv = null;
888
-                if(is_object($this->formValidationInstance)){
888
+                if (is_object($this->formValidationInstance)) {
889 889
                     $fv = $this->formValidationInstance;
890 890
                 }
891
-                else{
891
+                else {
892 892
                     Loader::library('FormValidation');
893 893
                     $fv = $this->formvalidation;
894 894
                     $this->setFormValidation($fv);
895 895
                 }
896
-                if(is_array($this->validate))
896
+                if (is_array($this->validate))
897 897
                 {
898 898
                     $fv->setData($data);
899 899
                     $fv->setRules($this->validate);
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
             {
949 949
                 $this->_database->where($params[0]);
950 950
             }
951
-        	else if(count($params) == 2)
951
+        	else if (count($params) == 2)
952 952
     		{
953 953
                 if (is_array($params[1]))
954 954
                 {
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
                     $this->_database->where($params[0], $params[1]);
960 960
                 }
961 961
     		}
962
-    		else if(count($params) == 3)
962
+    		else if (count($params) == 3)
963 963
     		{
964 964
     			$this->_database->where($params[0], $params[1], $params[2]);
965 965
     		}
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
         /**
980 980
             Shortcut to controller
981 981
         */
982
-        public function __get($key){
982
+        public function __get($key) {
983 983
             return get_instance()->{$key};
984 984
         }
985 985
 
Please login to merge, or discard this patch.
core/classes/Loader.php 1 patch
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * along with this program; if not, write to the Free Software
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25 25
 	*/
26
-	class Loader{
26
+	class Loader {
27 27
 		
28 28
 		/**
29 29
 		 * List of loaded resources
@@ -38,77 +38,77 @@  discard block
 block discarded – undo
38 38
 		private static $logger;
39 39
 
40 40
 
41
-		public function __construct(){
41
+		public function __construct() {
42 42
 			//add the resources already loaded during application bootstrap
43 43
 			//in the list to prevent duplicate or loading the resources again.
44 44
 			static::$loaded = class_loaded();
45 45
 			
46 46
 			$autoloads = array();
47 47
 			//loading of the resources in autoload.php configuration file
48
-			if(file_exists(CONFIG_PATH . 'autoload.php')){
48
+			if (file_exists(CONFIG_PATH . 'autoload.php')) {
49 49
 				require_once CONFIG_PATH . 'autoload.php';
50
-				if(! empty($autoload) && is_array($autoload)){
50
+				if (!empty($autoload) && is_array($autoload)) {
51 51
 					$autoloads = $autoload;
52 52
 					unset($autoload);
53 53
 				}
54 54
 			}
55 55
 			//loading autoload configuration for modules
56 56
 			$modulesAutoloads = Module::getModulesAutoloadConfig();
57
-			if($modulesAutoloads && is_array($modulesAutoloads)){
57
+			if ($modulesAutoloads && is_array($modulesAutoloads)) {
58 58
 				//libraries autoload
59
-				if(! empty($modulesAutoloads['libraries']) && is_array($modulesAutoloads['libraries'])){
59
+				if (!empty($modulesAutoloads['libraries']) && is_array($modulesAutoloads['libraries'])) {
60 60
 					$autoloads['libraries'] = array_merge($autoloads['libraries'], $modulesAutoloads['libraries']);
61 61
 				}
62 62
 				//config autoload
63
-				if(! empty($modulesAutoloads['config']) && is_array($modulesAutoloads['config'])){
63
+				if (!empty($modulesAutoloads['config']) && is_array($modulesAutoloads['config'])) {
64 64
 					$autoloads['config'] = array_merge($autoloads['config'], $modulesAutoloads['config']);
65 65
 				}
66 66
 				//models autoload
67
-				if(! empty($modulesAutoloads['models']) && is_array($modulesAutoloads['models'])){
67
+				if (!empty($modulesAutoloads['models']) && is_array($modulesAutoloads['models'])) {
68 68
 					$autoloads['models'] = array_merge($autoloads['models'], $modulesAutoloads['models']);
69 69
 				}
70 70
 				//functions autoload
71
-				if(! empty($modulesAutoloads['functions']) && is_array($modulesAutoloads['functions'])){
71
+				if (!empty($modulesAutoloads['functions']) && is_array($modulesAutoloads['functions'])) {
72 72
 					$autoloads['functions'] = array_merge($autoloads['functions'], $modulesAutoloads['functions']);
73 73
 				}
74 74
 				//languages autoload
75
-				if(! empty($modulesAutoloads['languages']) && is_array($modulesAutoloads['languages'])){
75
+				if (!empty($modulesAutoloads['languages']) && is_array($modulesAutoloads['languages'])) {
76 76
 					$autoloads['languages'] = array_merge($autoloads['languages'], $modulesAutoloads['languages']);
77 77
 				}
78 78
 			}
79 79
 			
80 80
 			//config autoload
81
-			if(! empty($autoloads['config']) && is_array($autoloads['config'])){
82
-				foreach($autoloads['config'] as $c){
81
+			if (!empty($autoloads['config']) && is_array($autoloads['config'])) {
82
+				foreach ($autoloads['config'] as $c) {
83 83
 					$this->config($c);
84 84
 				}
85 85
 			}
86 86
 			
87 87
 			//languages autoload
88
-			if(! empty($autoloads['languages']) && is_array($autoloads['languages'])){
89
-				foreach($autoloads['languages'] as $language){
88
+			if (!empty($autoloads['languages']) && is_array($autoloads['languages'])) {
89
+				foreach ($autoloads['languages'] as $language) {
90 90
 					$this->lang($language);
91 91
 				}
92 92
 			}
93 93
 			
94 94
 			//libraries autoload
95
-			if(! empty($autoloads['libraries']) && is_array($autoloads['libraries'])){
96
-				foreach($autoloads['libraries'] as $library){
95
+			if (!empty($autoloads['libraries']) && is_array($autoloads['libraries'])) {
96
+				foreach ($autoloads['libraries'] as $library) {
97 97
 					$this->library($library);
98 98
 				}
99 99
 			}
100 100
 			
101 101
 			//models autoload
102
-			if(! empty($autoloads['models']) && is_array($autoloads['models'])){
102
+			if (!empty($autoloads['models']) && is_array($autoloads['models'])) {
103 103
 				require_once CORE_CLASSES_MODEL_PATH . 'Model.php';
104
-				foreach($autoloads['models'] as $model){
104
+				foreach ($autoloads['models'] as $model) {
105 105
 					$this->model($model);
106 106
 				}
107 107
 			}
108 108
 			
109 109
 			//functions autoload
110
-			if(! empty($autoloads['functions']) && is_array($autoloads['functions'])){
111
-				foreach($autoloads['functions'] as $function){
110
+			if (!empty($autoloads['functions']) && is_array($autoloads['functions'])) {
111
+				foreach ($autoloads['functions'] as $function) {
112 112
 					$this->functions($function);
113 113
 				}
114 114
 			}
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 		 * Get the logger singleton instance
120 120
 		 * @return Log the logger instance
121 121
 		 */
122
-		private static function getLogger(){
123
-			if(static::$logger == null){
124
-				static::$logger[0] =& class_loader('Log', 'classes');
122
+		private static function getLogger() {
123
+			if (static::$logger == null) {
124
+				static::$logger[0] = & class_loader('Log', 'classes');
125 125
 				static::$logger[0]->setLogger('Library::Loader');
126 126
 			}
127 127
 			return static::$logger[0];
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
 		 *
136 136
 		 * @return void
137 137
 		 */
138
-		public static function model($class, $instance = null){
138
+		public static function model($class, $instance = null) {
139 139
 			$logger = static::getLogger();
140 140
 			$class = str_ireplace('.php', '', $class);
141 141
 			$class = trim($class, '/\\');
142
-			$file = ucfirst($class).'.php';
142
+			$file = ucfirst($class) . '.php';
143 143
 			$logger->debug('Loading model [' . $class . '] ...');
144
-			if(! $instance){
144
+			if (!$instance) {
145 145
 				//for module
146
-				if(strpos($class, '/') !== false){
146
+				if (strpos($class, '/') !== false) {
147 147
 					$path = explode('/', $class);
148
-					if(isset($path[1])){
148
+					if (isset($path[1])) {
149 149
 						$instance = strtolower($path[1]);
150 150
 					}
151 151
 				}
152
-				else{
152
+				else {
153 153
 					$instance = strtolower($class);
154 154
 				}
155 155
 			}
156
-			if(isset(static::$loaded[$instance])){
156
+			if (isset(static::$loaded[$instance])) {
157 157
 				$logger->info('Model [' . $class . '] already loaded no need to load it again, cost in performance');
158 158
 				return;
159 159
 			}
@@ -163,43 +163,43 @@  discard block
 block discarded – undo
163 163
 			$searchModuleName = null;
164 164
 			$obj = & get_instance();
165 165
 			//check if the request class contains module name
166
-			if(strpos($class, '/') !== false){
166
+			if (strpos($class, '/') !== false) {
167 167
 				$path = explode('/', $class);
168
-				if(isset($path[0]) && in_array($path[0], Module::getModuleList())){
168
+				if (isset($path[0]) && in_array($path[0], Module::getModuleList())) {
169 169
 					$searchModuleName = $path[0];
170 170
 					$class = ucfirst($path[1]);
171 171
 				}
172 172
 			}
173
-			else{
173
+			else {
174 174
 				$class = ucfirst($class);
175 175
 			}
176 176
 
177
-			if(! $searchModuleName && !empty($obj->moduleName)){
177
+			if (!$searchModuleName && !empty($obj->moduleName)) {
178 178
 				$searchModuleName = $obj->moduleName;
179 179
 			}
180 180
 			$moduleModelFilePath = Module::findModelFullPath($class, $searchModuleName);
181
-			if($moduleModelFilePath){
182
-				$logger->info('Found model [' . $class . '] from module [' .$searchModuleName. '], the file path is [' .$moduleModelFilePath. '] we will used it');
181
+			if ($moduleModelFilePath) {
182
+				$logger->info('Found model [' . $class . '] from module [' . $searchModuleName . '], the file path is [' . $moduleModelFilePath . '] we will used it');
183 183
 				$classFilePath = $moduleModelFilePath;
184 184
 			}
185
-			else{
185
+			else {
186 186
 				$logger->info('Cannot find model [' . $class . '] from modules using the default location');
187 187
 			}
188 188
 			$logger->info('The model file path to be loaded is [' . $classFilePath . ']');
189
-			if(file_exists($classFilePath)){
189
+			if (file_exists($classFilePath)) {
190 190
 				require_once $classFilePath;
191
-				if(class_exists($class)){
191
+				if (class_exists($class)) {
192 192
 					$c = new $class();
193 193
 					$obj = & get_instance();
194 194
 					$obj->{$instance} = $c;
195 195
 					static::$loaded[$instance] = $class;
196 196
 					$logger->info('Model [' . $class . '] --> ' . $classFilePath . ' loaded successfully.');
197 197
 				}
198
-				else{
199
-					show_error('The file '.$classFilePath.' exists but does not contain the class ['. $class . ']');
198
+				else {
199
+					show_error('The file ' . $classFilePath . ' exists but does not contain the class [' . $class . ']');
200 200
 				}
201 201
 			}
202
-			else{
202
+			else {
203 203
 				show_error('Unable to find the model [' . $class . ']');
204 204
 			}
205 205
 		}
@@ -214,31 +214,31 @@  discard block
 block discarded – undo
214 214
 		 *
215 215
 		 * @return void
216 216
 		 */
217
-		public static function library($class, $instance = null, array $params = array()){
217
+		public static function library($class, $instance = null, array $params = array()) {
218 218
 			$logger = static::getLogger();
219 219
 			$class = str_ireplace('.php', '', $class);
220 220
 			$class = trim($class, '/\\');
221
-			$file = ucfirst($class) .'.php';
221
+			$file = ucfirst($class) . '.php';
222 222
 			$logger->debug('Loading library [' . $class . '] ...');
223
-			if(! $instance){
223
+			if (!$instance) {
224 224
 				//for module
225
-				if(strpos($class, '/') !== false){
225
+				if (strpos($class, '/') !== false) {
226 226
 					$path = explode('/', $class);
227
-					if(isset($path[1])){
227
+					if (isset($path[1])) {
228 228
 						$instance = strtolower($path[1]);
229 229
 					}
230 230
 				}
231
-				else{
231
+				else {
232 232
 					$instance = strtolower($class);
233 233
 				}
234 234
 			}
235
-			if(isset(static::$loaded[$instance])){
235
+			if (isset(static::$loaded[$instance])) {
236 236
 				$logger->info('Library [' . $class . '] already loaded no need to load it again, cost in performance');
237 237
 				return;
238 238
 			}
239 239
 			$obj = & get_instance();
240 240
 			//TODO for Database library
241
-			if(strtolower($class) == 'database'){
241
+			if (strtolower($class) == 'database') {
242 242
 				$logger->info('This is the Database library ...');
243 243
 				$dbInstance = & class_loader('Database', 'classes', $params);
244 244
 				$obj->{$instance} = $dbInstance;
@@ -249,45 +249,45 @@  discard block
 block discarded – undo
249 249
 			$libraryFilePath = null;
250 250
 			$isSystem = false;
251 251
 			$logger->debug('Check if this is a system library ...');
252
-			if(file_exists(CORE_LIBRARY_PATH . $file)){
252
+			if (file_exists(CORE_LIBRARY_PATH . $file)) {
253 253
 				$isSystem = true;
254 254
 				$libraryFilePath = CORE_LIBRARY_PATH . $file;
255 255
 				$class = ucfirst($class);
256 256
 				$logger->info('This library is a system library');
257 257
 			}
258
-			else{
258
+			else {
259 259
 				$logger->info('This library is not a system library');	
260 260
 				//first check if this library is in the module
261 261
 				$logger->debug('Checking library [' . $class . '] from module list ...');
262 262
 				$searchModuleName = null;
263 263
 				//check if the request class contains module name
264
-				if(strpos($class, '/') !== false){
264
+				if (strpos($class, '/') !== false) {
265 265
 					$path = explode('/', $class);
266
-					if(isset($path[0]) && in_array($path[0], Module::getModuleList())){
266
+					if (isset($path[0]) && in_array($path[0], Module::getModuleList())) {
267 267
 						$searchModuleName = $path[0];
268 268
 						$class = ucfirst($path[1]);
269 269
 					}
270 270
 				}
271
-				else{
271
+				else {
272 272
 					$class = ucfirst($class);
273 273
 				}
274
-				if(! $searchModuleName && !empty($obj->moduleName)){
274
+				if (!$searchModuleName && !empty($obj->moduleName)) {
275 275
 					$searchModuleName = $obj->moduleName;
276 276
 				}
277 277
 				$moduleLibraryPath = Module::findLibraryFullPath($class, $searchModuleName);
278
-				if($moduleLibraryPath){
279
-					$logger->info('Found library [' . $class . '] from module [' .$searchModuleName. '], the file path is [' .$moduleLibraryPath. '] we will used it');
278
+				if ($moduleLibraryPath) {
279
+					$logger->info('Found library [' . $class . '] from module [' . $searchModuleName . '], the file path is [' . $moduleLibraryPath . '] we will used it');
280 280
 					$libraryFilePath = $moduleLibraryPath;
281 281
 				}
282
-				else{
282
+				else {
283 283
 					$logger->info('Cannot find library [' . $class . '] from modules using the default location');
284 284
 				}
285 285
 			}
286
-			if(! $libraryFilePath){
286
+			if (!$libraryFilePath) {
287 287
 				$searchDir = array(LIBRARY_PATH);
288
-				foreach($searchDir as $dir){
288
+				foreach ($searchDir as $dir) {
289 289
 					$filePath = $dir . $file;
290
-					if(file_exists($filePath)){
290
+					if (file_exists($filePath)) {
291 291
 						$libraryFilePath = $filePath;
292 292
 						//is already found not to continue
293 293
 						break;
@@ -295,20 +295,20 @@  discard block
 block discarded – undo
295 295
 				}
296 296
 			}
297 297
 			$logger->info('The library file path to be loaded is [' . $libraryFilePath . ']');
298
-			if($libraryFilePath){
298
+			if ($libraryFilePath) {
299 299
 				require_once $libraryFilePath;
300
-				if(class_exists($class)){
300
+				if (class_exists($class)) {
301 301
 					$c = $params ? new $class($params) : new $class();
302 302
 					$obj = & get_instance();
303 303
 					$obj->{$instance} = $c;
304 304
 					static::$loaded[$instance] = $class;
305 305
 					$logger->info('Library [' . $class . '] --> ' . $libraryFilePath . ' loaded successfully.');
306 306
 				}
307
-				else{
308
-					show_error('The file '.$libraryFilePath.' exists but does not contain the class '.$class);
307
+				else {
308
+					show_error('The file ' . $libraryFilePath . ' exists but does not contain the class ' . $class);
309 309
 				}
310 310
 			}
311
-			else{
311
+			else {
312 312
 				show_error('Unable to find library class [' . $class . ']');
313 313
 			}
314 314
 		}
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
 		 *
321 321
 		 * @return void
322 322
 		 */
323
-		public static function functions($function){
323
+		public static function functions($function) {
324 324
 			$logger = static::getLogger();
325 325
 			$function = str_ireplace('.php', '', $function);
326 326
 			$function = trim($function, '/\\');
327 327
 			$function = str_ireplace('function_', '', $function);
328
-			$file = 'function_'.$function.'.php';
328
+			$file = 'function_' . $function . '.php';
329 329
 			$logger->debug('Loading helper [' . $function . '] ...');
330
-			if(isset(static::$loaded['function_' . $function])){
330
+			if (isset(static::$loaded['function_' . $function])) {
331 331
 				$logger->info('Helper [' . $function . '] already loaded no need to load it again, cost in performance');
332 332
 				return;
333 333
 			}
@@ -337,30 +337,30 @@  discard block
 block discarded – undo
337 337
 			$searchModuleName = null;
338 338
 			$obj = & get_instance();
339 339
 			//check if the request class contains module name
340
-			if(strpos($function, '/') !== false){
340
+			if (strpos($function, '/') !== false) {
341 341
 				$path = explode('/', $function);
342
-				if(isset($path[0]) && in_array($path[0], Module::getModuleList())){
342
+				if (isset($path[0]) && in_array($path[0], Module::getModuleList())) {
343 343
 					$searchModuleName = $path[0];
344 344
 					$function = 'function_' . $path[1] . '.php';
345
-					$file = $path[0] . DS . 'function_'.$function.'.php';
345
+					$file = $path[0] . DS . 'function_' . $function . '.php';
346 346
 				}
347 347
 			}
348
-			if(! $searchModuleName && !empty($obj->moduleName)){
348
+			if (!$searchModuleName && !empty($obj->moduleName)) {
349 349
 				$searchModuleName = $obj->moduleName;
350 350
 			}
351 351
 			$moduleFunctionPath = Module::findFunctionFullPath($function, $searchModuleName);
352
-			if($moduleFunctionPath){
353
-				$logger->info('Found helper [' . $function . '] from module [' .$searchModuleName. '], the file path is [' .$moduleFunctionPath. '] we will used it');
352
+			if ($moduleFunctionPath) {
353
+				$logger->info('Found helper [' . $function . '] from module [' . $searchModuleName . '], the file path is [' . $moduleFunctionPath . '] we will used it');
354 354
 				$functionFilePath = $moduleFunctionPath;
355 355
 			}
356
-			else{
356
+			else {
357 357
 				$logger->info('Cannot find helper [' . $function . '] from modules using the default location');
358 358
 			}
359
-			if(! $functionFilePath){
359
+			if (!$functionFilePath) {
360 360
 				$searchDir = array(FUNCTIONS_PATH, CORE_FUNCTIONS_PATH);
361
-				foreach($searchDir as $dir){
361
+				foreach ($searchDir as $dir) {
362 362
 					$filePath = $dir . $file;
363
-					if(file_exists($filePath)){
363
+					if (file_exists($filePath)) {
364 364
 						$functionFilePath = $filePath;
365 365
 						//is already found not to continue
366 366
 						break;
@@ -368,12 +368,12 @@  discard block
 block discarded – undo
368 368
 				}
369 369
 			}
370 370
 			$logger->info('The helper file path to be loaded is [' . $functionFilePath . ']');
371
-			if($functionFilePath){
371
+			if ($functionFilePath) {
372 372
 				require_once $functionFilePath;
373 373
 				static::$loaded['function_' . $function] = $functionFilePath;
374 374
 				$logger->info('Helper [' . $function . '] --> ' . $functionFilePath . ' loaded successfully.');
375 375
 			}
376
-			else{
376
+			else {
377 377
 				show_error('Unable to find helper file [' . $file . ']');
378 378
 			}
379 379
 		}
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
 		 *
386 386
 		 * @return void
387 387
 		 */
388
-		public static function config($filename){
388
+		public static function config($filename) {
389 389
 			$logger = static::getLogger();
390 390
 			$filename = str_ireplace('.php', '', $filename);
391 391
 			$filename = trim($filename, '/\\');
392 392
 			$filename = str_ireplace('config_', '', $filename);
393
-			$file = 'config_'.$filename.'.php';
393
+			$file = 'config_' . $filename . '.php';
394 394
 			$logger->debug('Loading configuration [' . $filename . '] ...');
395
-			if(isset(static::$loaded['config_' . $filename])){
395
+			if (isset(static::$loaded['config_' . $filename])) {
396 396
 				$logger->info('Configuration [' . $path . '] already loaded no need to load it again, cost in performance');
397 397
 				return;
398 398
 			}
@@ -402,37 +402,37 @@  discard block
 block discarded – undo
402 402
 			$searchModuleName = null;
403 403
 			$obj = & get_instance();
404 404
 			//check if the request class contains module name
405
-			if(strpos($filename, '/') !== false){
405
+			if (strpos($filename, '/') !== false) {
406 406
 				$path = explode('/', $filename);
407
-				if(isset($path[0]) && in_array($path[0], Module::getModuleList())){
407
+				if (isset($path[0]) && in_array($path[0], Module::getModuleList())) {
408 408
 					$searchModuleName = $path[0];
409 409
 					$filename = $path[1] . '.php';
410
-					$file = $path[0] . DS .$filename;
410
+					$file = $path[0] . DS . $filename;
411 411
 				}
412 412
 			}
413
-			if(! $searchModuleName && !empty($obj->moduleName)){
413
+			if (!$searchModuleName && !empty($obj->moduleName)) {
414 414
 				$searchModuleName = $obj->moduleName;
415 415
 			}
416 416
 			$moduleConfigPath = Module::findConfigFullPath($filename, $searchModuleName);
417
-			if($moduleConfigPath){
418
-				$logger->info('Found config [' . $filename . '] from module [' .$searchModuleName. '], the file path is [' .$moduleConfigPath. '] we will used it');
417
+			if ($moduleConfigPath) {
418
+				$logger->info('Found config [' . $filename . '] from module [' . $searchModuleName . '], the file path is [' . $moduleConfigPath . '] we will used it');
419 419
 				$configFilePath = $moduleConfigPath;
420 420
 			}
421
-			else{
421
+			else {
422 422
 				$logger->info('Cannot find config [' . $filename . '] from modules using the default location');
423 423
 			}
424 424
 			$logger->info('The config file path to be loaded is [' . $configFilePath . ']');
425
-			if(file_exists($configFilePath)){
425
+			if (file_exists($configFilePath)) {
426 426
 				require_once $configFilePath;
427
-				if(! empty($config) && is_array($config)){
427
+				if (!empty($config) && is_array($config)) {
428 428
 					Config::setAll($config);
429 429
 				}
430
-				else{
431
-					show_error('No configuration found in ['. $configFilePath . ']');
430
+				else {
431
+					show_error('No configuration found in [' . $configFilePath . ']');
432 432
 				}
433 433
 			}
434
-			else{
435
-				show_error('Unable to find config file ['. $configFilePath . ']');
434
+			else {
435
+				show_error('Unable to find config file [' . $configFilePath . ']');
436 436
 			}
437 437
 			static::$loaded['config_' . $filename] = $configFilePath;
438 438
 			$logger->info('Configuration [' . $configFilePath . '] loaded successfully.');
@@ -448,14 +448,14 @@  discard block
 block discarded – undo
448 448
 		 *
449 449
 		 * @return void
450 450
 		 */
451
-		public static function lang($language){
451
+		public static function lang($language) {
452 452
 			$logger = static::getLogger();
453 453
 			$language = str_ireplace('.php', '', $language);
454 454
 			$language = trim($language, '/\\');
455 455
 			$language = str_ireplace('lang_', '', $language);
456
-			$file = 'lang_'.$language.'.php';
456
+			$file = 'lang_' . $language . '.php';
457 457
 			$logger->debug('Loading language [' . $language . '] ...');
458
-			if(isset(static::$loaded['lang_' . $language])){
458
+			if (isset(static::$loaded['lang_' . $language])) {
459 459
 				$logger->info('Language [' . $language . '] already loaded no need to load it again, cost in performance');
460 460
 				return;
461 461
 			}
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 			$cfgKey = get_config('language_cookie_name');
466 466
 			$objCookie = & class_loader('Cookie');
467 467
 			$cookieLang = $objCookie->get($cfgKey);
468
-			if($cookieLang){
468
+			if ($cookieLang) {
469 469
 				$appLang = $cookieLang;
470 470
 			}
471 471
 			$languageFilePath = null;
@@ -474,30 +474,30 @@  discard block
 block discarded – undo
474 474
 			$searchModuleName = null;
475 475
 			$obj = & get_instance();
476 476
 			//check if the request class contains module name
477
-			if(strpos($language, '/') !== false){
477
+			if (strpos($language, '/') !== false) {
478 478
 				$path = explode('/', $language);
479
-				if(isset($path[0]) && in_array($path[0], Module::getModuleList())){
479
+				if (isset($path[0]) && in_array($path[0], Module::getModuleList())) {
480 480
 					$searchModuleName = $path[0];
481 481
 					$language = 'lang_' . $path[1] . '.php';
482
-					$file = $path[0] . DS .$language;
482
+					$file = $path[0] . DS . $language;
483 483
 				}
484 484
 			}
485
-			if(! $searchModuleName && !empty($obj->moduleName)){
485
+			if (!$searchModuleName && !empty($obj->moduleName)) {
486 486
 				$searchModuleName = $obj->moduleName;
487 487
 			}
488 488
 			$moduleLanguagePath = Module::findLanguageFullPath($language, $searchModuleName, $appLang);
489
-			if($moduleLanguagePath){
490
-				$logger->info('Found language [' . $language . '] from module [' .$searchModuleName. '], the file path is [' .$moduleLanguagePath. '] we will used it');
489
+			if ($moduleLanguagePath) {
490
+				$logger->info('Found language [' . $language . '] from module [' . $searchModuleName . '], the file path is [' . $moduleLanguagePath . '] we will used it');
491 491
 				$languageFilePath = $moduleLanguagePath;
492 492
 			}
493
-			else{
493
+			else {
494 494
 				$logger->info('Cannot find language [' . $language . '] from modules using the default location');
495 495
 			}
496
-			if(! $languageFilePath){
496
+			if (!$languageFilePath) {
497 497
 				$searchDir = array(APP_LANG_PATH, CORE_LANG_PATH);
498
-				foreach($searchDir as $dir){
498
+				foreach ($searchDir as $dir) {
499 499
 					$filePath = $dir . $appLang . DS . $file;
500
-					if(file_exists($filePath)){
500
+					if (file_exists($filePath)) {
501 501
 						$languageFilePath = $filePath;
502 502
 						//is already found not to continue
503 503
 						break;
@@ -505,12 +505,12 @@  discard block
 block discarded – undo
505 505
 				}
506 506
 			}
507 507
 			$logger->info('The language file path to be loaded is [' . $languageFilePath . ']');
508
-			if($languageFilePath){
508
+			if ($languageFilePath) {
509 509
 				require_once $languageFilePath;
510
-				if(! empty($lang) && is_array($lang)){
511
-					$logger->info('Language file  [' .$languageFilePath. '] contains the valid languages keys add them to language list');
510
+				if (!empty($lang) && is_array($lang)) {
511
+					$logger->info('Language file  [' . $languageFilePath . '] contains the valid languages keys add them to language list');
512 512
 					//Note: may be here the class 'Lang' not yet loaded
513
-					$langObj =& class_loader('Lang', 'classes');
513
+					$langObj = & class_loader('Lang', 'classes');
514 514
 					$langObj->addLangMessages($lang);
515 515
 					//free the memory
516 516
 					unset($lang);
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 				static::$loaded['lang_' . $language] = $languageFilePath;
519 519
 				$logger->info('Language [' . $language . '] --> ' . $languageFilePath . ' loaded successfully.');
520 520
 			}
521
-			else{
521
+			else {
522 522
 				show_error('Unable to find language file [' . $file . ']');
523 523
 			}
524 524
 		}
Please login to merge, or discard this patch.
core/classes/Lang.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	/**
28 28
 	 * For application languages management
29 29
 	 */
30
-	class Lang{
30
+	class Lang {
31 31
 		
32 32
 		/**
33 33
 		 * The supported available language for this application.
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 		/**
68 68
 		 * Construct new Lang instance
69 69
 		 */
70
-		public function __construct(){
71
-	        $this->logger =& class_loader('Log', 'classes');
70
+		public function __construct() {
71
+	        $this->logger = & class_loader('Log', 'classes');
72 72
 	        $this->logger->setLogger('Library::Lang');
73 73
 
74 74
 			$this->default = get_config('default_language', 'en');
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 			
77 77
 			//add the supported languages ('key', 'display name')
78 78
 			$languages = get_config('languages', null);
79
-			if(! empty($languages)){
80
-				foreach($languages as $key => $displayName){
79
+			if (!empty($languages)) {
80
+				foreach ($languages as $key => $displayName) {
81 81
 					$this->addLang($key, $displayName);
82 82
 				}
83 83
 			}
@@ -87,15 +87,15 @@  discard block
 block discarded – undo
87 87
 			$language = null;
88 88
 			//if the language exists in cookie use it
89 89
 			$cfgKey = get_config('language_cookie_name');
90
-			$this->logger->debug('Getting current language from cookie [' .$cfgKey. ']');
90
+			$this->logger->debug('Getting current language from cookie [' . $cfgKey . ']');
91 91
 			$objCookie = & class_loader('Cookie');
92 92
 			$cookieLang = $objCookie->get($cfgKey);
93
-			if($cookieLang && $this->isValid($cookieLang)){
93
+			if ($cookieLang && $this->isValid($cookieLang)) {
94 94
 				$this->current = $cookieLang;
95
-				$this->logger->info('Language from cookie [' .$cfgKey. '] is valid so we will set the language using the cookie value [' .$cookieLang. ']');
95
+				$this->logger->info('Language from cookie [' . $cfgKey . '] is valid so we will set the language using the cookie value [' . $cookieLang . ']');
96 96
 			}
97
-			else{
98
-				$this->logger->info('Language from cookie [' .$cfgKey. '] is not set, use the default value [' .$this->getDefault(). ']');
97
+			else {
98
+				$this->logger->info('Language from cookie [' . $cfgKey . '] is not set, use the default value [' . $this->getDefault() . ']');
99 99
 				$this->current = $this->getDefault();
100 100
 			}
101 101
 		}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		 *
106 106
 		 * @return array the language message list
107 107
 		 */
108
-		public function getAll(){
108
+		public function getAll() {
109 109
 			return $this->languages;
110 110
 		}
111 111
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		 * @param string $key the language key to identify
116 116
 		 * @param string $value the language message value
117 117
 		 */
118
-		public function set($key, $value){
118
+		public function set($key, $value) {
119 119
 			$this->languages[$key] = $value;
120 120
 		}
121 121
 
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 		 *
128 128
 		 * @return string the language message value
129 129
 		 */
130
-		public function get($key, $default = 'LANGUAGE_ERROR'){
131
-			if(isset($this->languages[$key])){
130
+		public function get($key, $default = 'LANGUAGE_ERROR') {
131
+			if (isset($this->languages[$key])) {
132 132
 				return $this->languages[$key];
133 133
 			}
134
-			$this->logger->warning('Language key  [' .$key. '] does not exist use the default value [' .$default. ']');
134
+			$this->logger->warning('Language key  [' . $key . '] does not exist use the default value [' . $default . ']');
135 135
 			return $default;
136 136
 		}
137 137
 
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
 		 *
143 143
 		 * @return boolean true if the language directory exists, false or not
144 144
 		 */
145
-		public function isValid($language){
145
+		public function isValid($language) {
146 146
 			$searchDir = array(CORE_LANG_PATH, APP_LANG_PATH);
147
-			foreach($searchDir as $dir){
148
-				if(file_exists($dir . $language) && is_dir($dir . $language)){
147
+			foreach ($searchDir as $dir) {
148
+				if (file_exists($dir . $language) && is_dir($dir . $language)) {
149 149
 					return true;
150 150
 				}
151 151
 			}
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		 *
158 158
 		 * @return string the default language
159 159
 		 */
160
-		public function getDefault(){
160
+		public function getDefault() {
161 161
 			return $this->default;
162 162
 		}
163 163
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		 *
167 167
 		 * @return string the current language
168 168
 		 */
169
-		public function getCurrent(){
169
+		public function getCurrent() {
170 170
 			return $this->current;
171 171
 		}
172 172
 
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 		 * @param string $name the short language name like "en", "fr".
177 177
 		 * @param string $description the human readable description of this language
178 178
 		 */
179
-		public function addLang($name, $description){
180
-			if(isset($this->availables[$name])){
179
+		public function addLang($name, $description) {
180
+			if (isset($this->availables[$name])) {
181 181
 				return; //already added cost in performance
182 182
 			}
183
-			if($this->isValid($name)){
183
+			if ($this->isValid($name)) {
184 184
 				$this->availables[$name] = $description;
185 185
 			}
186
-			else{
186
+			else {
187 187
 				show_error('The language [' . $name . '] is not valid or does not exists.');
188 188
 			}
189 189
 		}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		 *
194 194
 		 * @return array the list of the application language
195 195
 		 */
196
-		public function getSupported(){
196
+		public function getSupported() {
197 197
 			return $this->availables;
198 198
 		}
199 199
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		 *
203 203
 		 * @param array $langs the languages array of the messages to be added
204 204
 		 */
205
-		public function addLangMessages(array $langs){
205
+		public function addLangMessages(array $langs) {
206 206
 			foreach ($langs as $key => $value) {
207 207
 				$this->set($key, $value);
208 208
 			}
Please login to merge, or discard this patch.
core/classes/Controller.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25 25
 	*/
26 26
 
27
-	class Controller{
27
+	class Controller {
28 28
 		
29 29
 		/**
30 30
 		 * The name of the module if this controller belong to an module
@@ -47,32 +47,32 @@  discard block
 block discarded – undo
47 47
 		/**
48 48
 		 * Class constructor
49 49
 		 */
50
-		public function __construct(){
51
-			$this->logger =& class_loader('Log', 'classes');
50
+		public function __construct() {
51
+			$this->logger = & class_loader('Log', 'classes');
52 52
 			$this->logger->setLogger('MainController');
53 53
 			self::$instance = & $this;
54 54
 			
55 55
 			$this->logger->debug('Adding the loaded classes to the super instance');
56
-			foreach (class_loaded() as $var => $class){
57
-				$this->$var =& class_loader($class);
56
+			foreach (class_loaded() as $var => $class) {
57
+				$this->$var = & class_loader($class);
58 58
 			}
59 59
 			
60 60
 			$this->logger->debug('Setting the cache handler instance');
61 61
 			//set cache handler instance
62
-			if(get_config('cache_enable', false)){
63
-				if(isset($this->{strtolower(get_config('cache_handler'))})){
62
+			if (get_config('cache_enable', false)) {
63
+				if (isset($this->{strtolower(get_config('cache_handler'))})) {
64 64
 					$this->cache = $this->{strtolower(get_config('cache_handler'))};
65 65
 					unset($this->{strtolower(get_config('cache_handler'))});
66 66
 				} 
67 67
 			}
68 68
 			$this->logger->debug('Loading the required classes into super instance');
69
-			$this->eventdispatcher =& class_loader('EventDispatcher', 'classes');
70
-			$this->loader =& class_loader('Loader', 'classes');
71
-			$this->lang =& class_loader('Lang', 'classes');
72
-			$this->request =& class_loader('Request', 'classes');
69
+			$this->eventdispatcher = & class_loader('EventDispatcher', 'classes');
70
+			$this->loader = & class_loader('Loader', 'classes');
71
+			$this->lang = & class_loader('Lang', 'classes');
72
+			$this->request = & class_loader('Request', 'classes');
73 73
 			//dispatch the request instance created event
74 74
 			$this->eventdispatcher->dispatch('REQUEST_CREATED');
75
-			$this->response =& class_loader('Response', 'classes', 'classes');
75
+			$this->response = & class_loader('Response', 'classes', 'classes');
76 76
 			
77 77
 			
78 78
 			//set session config
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 			set_session_config();
81 81
 			
82 82
 			//determine the current module
83
-			if(isset($this->router) && $this->router->getModule()){
83
+			if (isset($this->router) && $this->router->getModule()) {
84 84
 				$this->moduleName = $this->router->getModule();
85 85
 			}
86 86
 			//dispatch the loaded instance of super controller event
Please login to merge, or discard this patch.