@@ -61,8 +61,7 @@ discard block |
||
| 61 | 61 | while(($module = readdir($moduleDir)) !== false){ |
| 62 | 62 | if(preg_match('/^([a-z0-9-_]+)$/i', $module) && is_dir(MODULE_PATH . $module)){ |
| 63 | 63 | self::$list[] = $module; |
| 64 | - } |
|
| 65 | - else{ |
|
| 64 | + } else{ |
|
| 66 | 65 | $logger->info('Skipping [' .$module. '], may be this is not a directory or does not exists or is invalid name'); |
| 67 | 66 | } |
| 68 | 67 | } |
@@ -72,8 +71,7 @@ discard block |
||
| 72 | 71 | |
| 73 | 72 | if(self::hasModule()){ |
| 74 | 73 | $logger->info('The application contains the module below [' . implode(', ', self::getModuleList()) . ']'); |
| 75 | - } |
|
| 76 | - else{ |
|
| 74 | + } else{ |
|
| 77 | 75 | $logger->info('The application contains no module skipping'); |
| 78 | 76 | } |
| 79 | 77 | } |
@@ -127,8 +125,7 @@ discard block |
||
| 127 | 125 | if(! empty($route) && is_array($route)){ |
| 128 | 126 | $routes = array_merge($routes, $route); |
| 129 | 127 | unset($route); |
| 130 | - } |
|
| 131 | - else{ |
|
| 128 | + } else{ |
|
| 132 | 129 | show_error('No routing configuration found in [' .$file. '] for module [' . $module . ']'); |
| 133 | 130 | } |
| 134 | 131 | } |
@@ -157,8 +154,7 @@ discard block |
||
| 157 | 154 | if(file_exists($filePath)){ |
| 158 | 155 | $logger->info('Found controller [' . $class . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 159 | 156 | return $filePath; |
| 160 | - } |
|
| 161 | - else{ |
|
| 157 | + } else{ |
|
| 162 | 158 | $logger->info('Controller [' . $class . '] does not exist in the module [' .$module. ']'); |
| 163 | 159 | return false; |
| 164 | 160 | } |
@@ -184,8 +180,7 @@ discard block |
||
| 184 | 180 | if(file_exists($filePath)){ |
| 185 | 181 | $logger->info('Found model [' . $class . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 186 | 182 | return $filePath; |
| 187 | - } |
|
| 188 | - else{ |
|
| 183 | + } else{ |
|
| 189 | 184 | $logger->info('Model [' . $class . '] does not exist in the module [' .$module. ']'); |
| 190 | 185 | return false; |
| 191 | 186 | } |
@@ -210,8 +205,7 @@ discard block |
||
| 210 | 205 | if(file_exists($filePath)){ |
| 211 | 206 | $logger->info('Found configuration [' . $configuration . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 212 | 207 | return $filePath; |
| 213 | - } |
|
| 214 | - else{ |
|
| 208 | + } else{ |
|
| 215 | 209 | $logger->info('Configuration [' . $configuration . '] does not exist in the module [' .$module. ']'); |
| 216 | 210 | return false; |
| 217 | 211 | } |
@@ -237,8 +231,7 @@ discard block |
||
| 237 | 231 | if(file_exists($filePath)){ |
| 238 | 232 | $logger->info('Found helper [' . $helper . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 239 | 233 | return $filePath; |
| 240 | - } |
|
| 241 | - else{ |
|
| 234 | + } else{ |
|
| 242 | 235 | $logger->info('Helper [' . $helper . '] does not exist in the module [' .$module. ']'); |
| 243 | 236 | return false; |
| 244 | 237 | } |
@@ -264,8 +257,7 @@ discard block |
||
| 264 | 257 | if(file_exists($filePath)){ |
| 265 | 258 | $logger->info('Found library [' . $class . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 266 | 259 | return $filePath; |
| 267 | - } |
|
| 268 | - else{ |
|
| 260 | + } else{ |
|
| 269 | 261 | $logger->info('Library [' . $class . '] does not exist in the module [' .$module. ']'); |
| 270 | 262 | return false; |
| 271 | 263 | } |
@@ -293,8 +285,7 @@ discard block |
||
| 293 | 285 | if(file_exists($filePath)){ |
| 294 | 286 | $logger->info('Found view [' . $view . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 295 | 287 | return $filePath; |
| 296 | - } |
|
| 297 | - else{ |
|
| 288 | + } else{ |
|
| 298 | 289 | $logger->info('View [' . $view . '] does not exist in the module [' .$module. ']'); |
| 299 | 290 | return false; |
| 300 | 291 | } |
@@ -321,8 +312,7 @@ discard block |
||
| 321 | 312 | if(file_exists($filePath)){ |
| 322 | 313 | $logger->info('Found language [' . $language . '] in module [' .$module. '], the file path is [' .$filePath. ']'); |
| 323 | 314 | return $filePath; |
| 324 | - } |
|
| 325 | - else{ |
|
| 315 | + } else{ |
|
| 326 | 316 | $logger->info('Language [' . $language . '] does not exist in the module [' .$module. ']'); |
| 327 | 317 | return false; |
| 328 | 318 | } |
@@ -152,8 +152,7 @@ discard block |
||
| 152 | 152 | if(! headers_sent()){ |
| 153 | 153 | header('Location: '.$url); |
| 154 | 154 | exit; |
| 155 | - } |
|
| 156 | - else{ |
|
| 155 | + } else{ |
|
| 157 | 156 | echo '<script> |
| 158 | 157 | location.href = "'.$url.'"; |
| 159 | 158 | </script>'; |
@@ -202,12 +201,10 @@ discard block |
||
| 202 | 201 | if($moduleViewPath){ |
| 203 | 202 | $path = $moduleViewPath; |
| 204 | 203 | $logger->info('Found view [' . $view . '] in module [' .$mod. '], the file path is [' .$moduleViewPath. '] we will used it'); |
| 205 | - } |
|
| 206 | - else{ |
|
| 204 | + } else{ |
|
| 207 | 205 | $logger->info('Cannot find view [' . $view . '] in module [' .$mod. '] using the default location'); |
| 208 | 206 | } |
| 209 | - } |
|
| 210 | - else{ |
|
| 207 | + } else{ |
|
| 211 | 208 | $logger->info('The current request does not use module using the default location.'); |
| 212 | 209 | } |
| 213 | 210 | } |
@@ -326,8 +323,7 @@ discard block |
||
| 326 | 323 | $logger->info('The cache page content is not yet expire for the URL [' . $url . '] send 304 header to browser'); |
| 327 | 324 | self::sendHeaders(304); |
| 328 | 325 | return; |
| 329 | - } |
|
| 330 | - else{ |
|
| 326 | + } else{ |
|
| 331 | 327 | $logger->info('The cache page content is expired or the browser don\'t send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $url . '] send cache headers to tell the browser'); |
| 332 | 328 | self::sendHeaders(200); |
| 333 | 329 | //get the cache content |
@@ -347,15 +343,13 @@ discard block |
||
| 347 | 343 | //compress the output if is available |
| 348 | 344 | if (self::$_canCompressOutput){ |
| 349 | 345 | ob_start('ob_gzhandler'); |
| 350 | - } |
|
| 351 | - else{ |
|
| 346 | + } else{ |
|
| 352 | 347 | ob_start(); |
| 353 | 348 | } |
| 354 | 349 | echo $content; |
| 355 | 350 | ob_end_flush(); |
| 356 | 351 | return; |
| 357 | - } |
|
| 358 | - else{ |
|
| 352 | + } else{ |
|
| 359 | 353 | $logger->info('The page cache content for the URL [' . $url . '] is not valid may be already expired'); |
| 360 | 354 | $cache->delete($pageCacheKey); |
| 361 | 355 | } |
@@ -396,16 +390,14 @@ discard block |
||
| 396 | 390 | //compress the output if is available |
| 397 | 391 | if (self::$_canCompressOutput){ |
| 398 | 392 | ob_start('ob_gzhandler'); |
| 399 | - } |
|
| 400 | - else{ |
|
| 393 | + } else{ |
|
| 401 | 394 | ob_start(); |
| 402 | 395 | } |
| 403 | 396 | require_once $path; |
| 404 | 397 | $output = ob_get_clean(); |
| 405 | 398 | self::sendHeaders(404); |
| 406 | 399 | echo $output; |
| 407 | - } |
|
| 408 | - else{ |
|
| 400 | + } else{ |
|
| 409 | 401 | show_error('The 404 view [' .$path. '] does not exist'); |
| 410 | 402 | } |
| 411 | 403 | } |
@@ -420,8 +412,7 @@ discard block |
||
| 420 | 412 | //compress the output if exists |
| 421 | 413 | if (self::$_canCompressOutput){ |
| 422 | 414 | ob_start('ob_gzhandler'); |
| 423 | - } |
|
| 424 | - else{ |
|
| 415 | + } else{ |
|
| 425 | 416 | ob_start(); |
| 426 | 417 | } |
| 427 | 418 | extract($data); |
@@ -429,8 +420,7 @@ discard block |
||
| 429 | 420 | $output = ob_get_clean(); |
| 430 | 421 | self::sendHeaders(503); |
| 431 | 422 | echo $output; |
| 432 | - } |
|
| 433 | - else{ |
|
| 423 | + } else{ |
|
| 434 | 424 | //can't use show_error() at this time because some dependencies not yet loaded and to prevent loop |
| 435 | 425 | set_http_status_header(503); |
| 436 | 426 | echo 'The error view [' . $path . '] does not exist'; |