@@ -62,8 +62,7 @@ |
||
| 62 | 62 | $query[0] = rtrim($query[0], '/'); |
| 63 | 63 | $query[0] .= $suffix; |
| 64 | 64 | $path = implode('?', $query); |
| 65 | - } |
|
| 66 | - else{ |
|
| 65 | + } else{ |
|
| 67 | 66 | $path .= $suffix; |
| 68 | 67 | } |
| 69 | 68 | } |
@@ -128,8 +128,7 @@ discard block |
||
| 128 | 128 | $logger->info('Delete config item ['.$item.']'); |
| 129 | 129 | unset(self::$config[$item]); |
| 130 | 130 | return true; |
| 131 | - } |
|
| 132 | - else{ |
|
| 131 | + } else{ |
|
| 133 | 132 | $logger->warning('Config item ['.$item.'] to be deleted does not exists'); |
| 134 | 133 | return false; |
| 135 | 134 | } |
@@ -179,8 +178,7 @@ discard block |
||
| 179 | 178 | 0, |
| 180 | 179 | strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME'])) |
| 181 | 180 | ); |
| 182 | - } |
|
| 183 | - else{ |
|
| 181 | + } else{ |
|
| 184 | 182 | $logger->warning('Can not determine the application base URL automatically, use http://localhost as default'); |
| 185 | 183 | $baseUrl = 'http://localhost/'; |
| 186 | 184 | } |
@@ -234,8 +234,7 @@ discard block |
||
| 234 | 234 | //first check for CSRF |
| 235 | 235 | if (get_config('csrf_enable', false) && ! Security::validateCSRF()){ |
| 236 | 236 | show_error('Invalide data, Cross Site Request Forgery do his job, the data to validate is corrupted.'); |
| 237 | - } |
|
| 238 | - else{ |
|
| 237 | + } else{ |
|
| 239 | 238 | $this->logger->info('CSRF is not enabled in configuration or not set manully, no need to check it'); |
| 240 | 239 | } |
| 241 | 240 | } |
@@ -255,8 +254,7 @@ discard block |
||
| 255 | 254 | foreach ($this->getData() as $inputName => $inputVal) { |
| 256 | 255 | if(is_array($this->data[$inputName])){ |
| 257 | 256 | $this->data[$inputName] = array_map('trim', $this->data[$inputName]); |
| 258 | - } |
|
| 259 | - else{ |
|
| 257 | + } else{ |
|
| 260 | 258 | $this->data[$inputName] = trim($this->data[$inputName]); |
| 261 | 259 | } |
| 262 | 260 | |
@@ -624,8 +622,7 @@ discard block |
||
| 624 | 622 | if ($inputVal == '' && $callbackReturn == true) { |
| 625 | 623 | $this->_setError($inputName, $ruleName, $this->_getLabel($inputName)); |
| 626 | 624 | } |
| 627 | - } |
|
| 628 | - else if($inputVal == '') { |
|
| 625 | + } else if($inputVal == '') { |
|
| 629 | 626 | $this->_setError($inputName, $ruleName, $this->_getLabel($inputName)); |
| 630 | 627 | } |
| 631 | 628 | } |
@@ -684,8 +681,7 @@ discard block |
||
| 684 | 681 | $this->_setError($inputName, $ruleName . ',post:key', array($this->_getLabel($inputName), $this->_getLabel(str_replace('post:', '', $doNotEqual)))); |
| 685 | 682 | continue; |
| 686 | 683 | } |
| 687 | - } |
|
| 688 | - else{ |
|
| 684 | + } else{ |
|
| 689 | 685 | if ($inputVal == $doNotEqual) { |
| 690 | 686 | $this->_setError($inputName, $ruleName . ',string', array($this->_getLabel($inputName), $doNotEqual)); |
| 691 | 687 | continue; |
@@ -48,8 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | if(is_object($logger)){ |
| 50 | 50 | $this->logger = $logger; |
| 51 | - } |
|
| 52 | - else{ |
|
| 51 | + } else{ |
|
| 53 | 52 | $this->logger =& class_loader('Log', 'classes'); |
| 54 | 53 | $this->logger->setLogger('Library::FileCache'); |
| 55 | 54 | } |
@@ -95,8 +94,7 @@ discard block |
||
| 95 | 94 | // Unlinking when the file was expired |
| 96 | 95 | unlink($filePath); |
| 97 | 96 | return false; |
| 98 | - } |
|
| 99 | - else{ |
|
| 97 | + } else{ |
|
| 100 | 98 | $this->logger->info('The cache not yet expire, now return the cache data for key ['. $key .'], the cache will expire at [' . date('Y-m-d H:i:s', $data['expire']) . ']'); |
| 101 | 99 | return $data['data']; |
| 102 | 100 | } |
@@ -133,8 +131,7 @@ discard block |
||
| 133 | 131 | $this->logger->error('Can not write cache data into file [' .$filePath. '] for the key ['. $key .'], return false'); |
| 134 | 132 | fclose($handle); |
| 135 | 133 | return false; |
| 136 | - } |
|
| 137 | - else{ |
|
| 134 | + } else{ |
|
| 138 | 135 | $this->logger->info('Cache data saved into file [' .$filePath. '] for the key ['. $key .']'); |
| 139 | 136 | fclose($handle); |
| 140 | 137 | chmod($filePath, 0640); |
@@ -156,8 +153,7 @@ discard block |
||
| 156 | 153 | if(! file_exists($filePath)){ |
| 157 | 154 | $this->logger->info('This cache file does not exists skipping'); |
| 158 | 155 | return false; |
| 159 | - } |
|
| 160 | - else{ |
|
| 156 | + } else{ |
|
| 161 | 157 | $this->logger->info('Found cache file [' .$filePath. '] remove it'); |
| 162 | 158 | unlink($filePath); |
| 163 | 159 | return true; |
@@ -210,8 +206,7 @@ discard block |
||
| 210 | 206 | $list = glob(CACHE_PATH . '*.cache'); |
| 211 | 207 | if(! $list){ |
| 212 | 208 | $this->logger->info('No cache files were found skipping'); |
| 213 | - } |
|
| 214 | - else{ |
|
| 209 | + } else{ |
|
| 215 | 210 | $this->logger->info('Found [' . count($list) . '] cache files to remove if expired'); |
| 216 | 211 | foreach ($list as $file) { |
| 217 | 212 | $this->logger->debug('Processing the cache file [' . $file . ']'); |
@@ -219,12 +214,10 @@ discard block |
||
| 219 | 214 | $data = @unserialize($this->compressCacheData ? gzinflate($data) : $data); |
| 220 | 215 | if(! $data){ |
| 221 | 216 | $this->logger->warning('Can not unserialize the cache data for file [' . $file . ']'); |
| 222 | - } |
|
| 223 | - else if(time() > $data['expire']){ |
|
| 217 | + } else if(time() > $data['expire']){ |
|
| 224 | 218 | $this->logger->info('The cache data for file [' . $file . '] already expired remove it'); |
| 225 | 219 | unlink($file); |
| 226 | - } |
|
| 227 | - else{ |
|
| 220 | + } else{ |
|
| 228 | 221 | $this->logger->info('The cache data for file [' . $file . '] not yet expired skip it'); |
| 229 | 222 | } |
| 230 | 223 | } |
@@ -239,8 +232,7 @@ discard block |
||
| 239 | 232 | $list = glob(CACHE_PATH . '*.cache'); |
| 240 | 233 | if(! $list){ |
| 241 | 234 | $this->logger->info('No cache files were found skipping'); |
| 242 | - } |
|
| 243 | - else{ |
|
| 235 | + } else{ |
|
| 244 | 236 | $this->logger->info('Found [' . count($list) . '] cache files to remove'); |
| 245 | 237 | foreach ($list as $file) { |
| 246 | 238 | $this->logger->debug('Processing the cache file [' . $file . ']'); |
@@ -267,8 +259,7 @@ discard block |
||
| 267 | 259 | |
| 268 | 260 | $this->logger->warning('The zlib extension is not loaded set cache compress data to FALSE'); |
| 269 | 261 | $this->compressCacheData = false; |
| 270 | - } |
|
| 271 | - else{ |
|
| 262 | + } else{ |
|
| 272 | 263 | $this->compressCacheData = $status; |
| 273 | 264 | } |
| 274 | 265 | return $this; |
@@ -266,8 +266,7 @@ discard block |
||
| 266 | 266 | //if the application is running in CLI mode use the first argument |
| 267 | 267 | else if(IS_CLI && isset($_SERVER['argv'][1])){ |
| 268 | 268 | $routeUri = $_SERVER['argv'][1]; |
| 269 | - } |
|
| 270 | - else if(isset($_SERVER['REQUEST_URI'])){ |
|
| 269 | + } else if(isset($_SERVER['REQUEST_URI'])){ |
|
| 271 | 270 | $routeUri = $_SERVER['REQUEST_URI']; |
| 272 | 271 | } |
| 273 | 272 | $this->logger->debug('Check if URL suffix is enabled in the configuration'); |
@@ -363,15 +362,13 @@ discard block |
||
| 363 | 362 | if(! class_exists($controller, false)){ |
| 364 | 363 | $e404 = true; |
| 365 | 364 | $this->logger->warning('The controller file [' .$classFilePath. '] exists but does not contain the class [' . $controller . ']'); |
| 366 | - } |
|
| 367 | - else{ |
|
| 365 | + } else{ |
|
| 368 | 366 | $controllerInstance = new $controller(); |
| 369 | 367 | $controllerMethod = $this->getMethod(); |
| 370 | 368 | if(! method_exists($controllerInstance, $controllerMethod)){ |
| 371 | 369 | $e404 = true; |
| 372 | 370 | $this->logger->warning('The controller [' . $controller . '] exist but does not contain the method [' . $controllerMethod . ']'); |
| 373 | - } |
|
| 374 | - else{ |
|
| 371 | + } else{ |
|
| 375 | 372 | $this->logger->info('Routing data is set correctly now GO!'); |
| 376 | 373 | call_user_func_array(array($controllerInstance, $controllerMethod), $this->args); |
| 377 | 374 | //render the final page to user |
@@ -379,8 +376,7 @@ discard block |
||
| 379 | 376 | get_instance()->response->renderFinalPage(); |
| 380 | 377 | } |
| 381 | 378 | } |
| 382 | - } |
|
| 383 | - else{ |
|
| 379 | + } else{ |
|
| 384 | 380 | $this->logger->info('The controller file path [' . $classFilePath . '] does not exist'); |
| 385 | 381 | $e404 = true; |
| 386 | 382 | } |
@@ -486,8 +482,7 @@ discard block |
||
| 486 | 482 | $this->logger->info('The current request use the module [' . $moduleControllerMethod[0] . ']'); |
| 487 | 483 | $this->module = $moduleControllerMethod[0]; |
| 488 | 484 | $moduleControllerMethod = explode('@', $moduleControllerMethod[1]); |
| 489 | - } |
|
| 490 | - else{ |
|
| 485 | + } else{ |
|
| 491 | 486 | $this->logger->info('The current request does not use the module'); |
| 492 | 487 | $moduleControllerMethod = explode('@', $this->callback[$index]); |
| 493 | 488 | } |
@@ -543,8 +538,7 @@ discard block |
||
| 543 | 538 | } |
| 544 | 539 | //args |
| 545 | 540 | $this->args = $segment; |
| 546 | - } |
|
| 547 | - else{ |
|
| 541 | + } else{ |
|
| 548 | 542 | $this->logger->info('The application contains a loaded module will check if the current request is found in the module list'); |
| 549 | 543 | if(in_array($segment[0], $modules)){ |
| 550 | 544 | $this->logger->info('Found, the current request use the module [' . $segment[0] . ']'); |
@@ -558,8 +552,7 @@ discard block |
||
| 558 | 552 | if(! $path){ |
| 559 | 553 | $this->logger->info('The controller [' . $this->controller . '] not found in the module, may be will use the module [' . $this->module . '] as controller'); |
| 560 | 554 | $this->controller = $this->module; |
| 561 | - } |
|
| 562 | - else{ |
|
| 555 | + } else{ |
|
| 563 | 556 | $this->controllerPath = $path; |
| 564 | 557 | array_shift($segment); |
| 565 | 558 | } |
@@ -571,8 +564,7 @@ discard block |
||
| 571 | 564 | } |
| 572 | 565 | //the remaining is for args |
| 573 | 566 | $this->args = $segment; |
| 574 | - } |
|
| 575 | - else{ |
|
| 567 | + } else{ |
|
| 576 | 568 | $this->logger->info('The current request information is not found in the module list'); |
| 577 | 569 | //controller |
| 578 | 570 | if(isset($segment[0])){ |
@@ -615,8 +607,7 @@ discard block |
||
| 615 | 607 | protected function setLoggerFromParamOrCreateNewInstance(Log $logger = null){ |
| 616 | 608 | if ($logger !== null){ |
| 617 | 609 | $this->logger = $logger; |
| 618 | - } |
|
| 619 | - else{ |
|
| 610 | + } else{ |
|
| 620 | 611 | $this->logger =& class_loader('Log', 'classes'); |
| 621 | 612 | $this->logger->setLogger('Library::Router'); |
| 622 | 613 | } |
@@ -60,8 +60,7 @@ discard block |
||
| 60 | 60 | if(Session::exists($key) && Session::exists($keyExpire) && Session::get($keyExpire) > $currentTime){ |
| 61 | 61 | $logger->info('The CSRF token not yet expire just return it'); |
| 62 | 62 | return Session::get($key); |
| 63 | - } |
|
| 64 | - else{ |
|
| 63 | + } else{ |
|
| 65 | 64 | $newTime = $currentTime + $expire; |
| 66 | 65 | $token = sha1(uniqid()) . sha1(uniqid()); |
| 67 | 66 | $logger->info('The CSRF informations are listed below: key [' .$key. '], key expire [' .$keyExpire. '], expire time [' .$expire. '], token [' .$token. ']'); |
@@ -123,8 +122,7 @@ discard block |
||
| 123 | 122 | $logger->info('IP address ' . $ip . ' allowed using the wildcard "*" or the full IP'); |
| 124 | 123 | //wildcard to access all ip address |
| 125 | 124 | return; |
| 126 | - } |
|
| 127 | - else{ |
|
| 125 | + } else{ |
|
| 128 | 126 | // go through all whitelisted ips |
| 129 | 127 | foreach ($list as $ipaddr) { |
| 130 | 128 | // find the wild card * in whitelisted ip (f.e. find position in "127.0.*" or "127*") |
@@ -149,8 +147,7 @@ discard block |
||
| 149 | 147 | show_error('Access to this application is not allowed'); |
| 150 | 148 | } |
| 151 | 149 | } |
| 152 | - } |
|
| 153 | - else{ |
|
| 150 | + } else{ |
|
| 154 | 151 | $logger->info('Whitelist IP access is not enabled in the configuration, ignore checking'); |
| 155 | 152 | } |
| 156 | 153 | } |
@@ -107,8 +107,7 @@ discard block |
||
| 107 | 107 | if ($moduleModelFilePath){ |
| 108 | 108 | $logger->info('Found model [' . $class . '] from module [' .$module. '], the file path is [' .$moduleModelFilePath. '] we will used it'); |
| 109 | 109 | $classFilePath = $moduleModelFilePath; |
| 110 | - } |
|
| 111 | - else{ |
|
| 110 | + } else{ |
|
| 112 | 111 | $logger->info('Cannot find model [' . $class . '] from modules using the default location'); |
| 113 | 112 | } |
| 114 | 113 | $logger->info('The model file path to be loaded is [' . $classFilePath . ']'); |
@@ -120,12 +119,10 @@ discard block |
||
| 120 | 119 | $obj->{$instance} = $c; |
| 121 | 120 | static::$loaded[$instance] = $class; |
| 122 | 121 | $logger->info('Model [' . $class . '] --> ' . $classFilePath . ' loaded successfully.'); |
| 123 | - } |
|
| 124 | - else{ |
|
| 122 | + } else{ |
|
| 125 | 123 | show_error('The file '.$classFilePath.' exists but does not contain the class ['. $class . ']'); |
| 126 | 124 | } |
| 127 | - } |
|
| 128 | - else{ |
|
| 125 | + } else{ |
|
| 129 | 126 | show_error('Unable to find the model [' . $class . ']'); |
| 130 | 127 | } |
| 131 | 128 | } |
@@ -168,8 +165,7 @@ discard block |
||
| 168 | 165 | $libraryFilePath = CORE_LIBRARY_PATH . $file; |
| 169 | 166 | $class = ucfirst($class); |
| 170 | 167 | $logger->info('This library is a system library'); |
| 171 | - } |
|
| 172 | - else{ |
|
| 168 | + } else{ |
|
| 173 | 169 | $logger->info('This library is not a system library'); |
| 174 | 170 | //first check if this library is in the module |
| 175 | 171 | $libraryFilePath = self::getLibraryPathUsingModuleInfo($class); |
@@ -214,8 +210,7 @@ discard block |
||
| 214 | 210 | if ($moduleFunctionPath){ |
| 215 | 211 | $logger->info('Found helper [' . $function . '] from module [' .$module. '], the file path is [' .$moduleFunctionPath. '] we will used it'); |
| 216 | 212 | $functionFilePath = $moduleFunctionPath; |
| 217 | - } |
|
| 218 | - else{ |
|
| 213 | + } else{ |
|
| 219 | 214 | $logger->info('Cannot find helper [' . $function . '] from modules using the default location'); |
| 220 | 215 | } |
| 221 | 216 | if (! $functionFilePath){ |
@@ -234,8 +229,7 @@ discard block |
||
| 234 | 229 | require_once $functionFilePath; |
| 235 | 230 | static::$loaded['function_' . $function] = $functionFilePath; |
| 236 | 231 | $logger->info('Helper [' . $function . '] --> ' . $functionFilePath . ' loaded successfully.'); |
| 237 | - } |
|
| 238 | - else{ |
|
| 232 | + } else{ |
|
| 239 | 233 | show_error('Unable to find helper file [' . $file . ']'); |
| 240 | 234 | } |
| 241 | 235 | } |
@@ -268,8 +262,7 @@ discard block |
||
| 268 | 262 | if ($moduleConfigPath){ |
| 269 | 263 | $logger->info('Found config [' . $filename . '] from module [' .$module. '], the file path is [' .$moduleConfigPath. '] we will used it'); |
| 270 | 264 | $configFilePath = $moduleConfigPath; |
| 271 | - } |
|
| 272 | - else{ |
|
| 265 | + } else{ |
|
| 273 | 266 | $logger->info('Cannot find config [' . $filename . '] from modules using the default location'); |
| 274 | 267 | } |
| 275 | 268 | $logger->info('The config file path to be loaded is [' . $configFilePath . ']'); |
@@ -283,8 +276,7 @@ discard block |
||
| 283 | 276 | $logger->info('The custom application configuration loaded are listed below: ' . stringfy_vars($config)); |
| 284 | 277 | unset($config); |
| 285 | 278 | } |
| 286 | - } |
|
| 287 | - else{ |
|
| 279 | + } else{ |
|
| 288 | 280 | show_error('Unable to find config file ['. $configFilePath . ']'); |
| 289 | 281 | } |
| 290 | 282 | } |
@@ -323,8 +315,7 @@ discard block |
||
| 323 | 315 | if ($moduleLanguagePath){ |
| 324 | 316 | $logger->info('Found language [' . $language . '] from module [' .$module. '], the file path is [' .$moduleLanguagePath. '] we will used it'); |
| 325 | 317 | $languageFilePath = $moduleLanguagePath; |
| 326 | - } |
|
| 327 | - else{ |
|
| 318 | + } else{ |
|
| 328 | 319 | $logger->info('Cannot find language [' . $language . '] from modules using the default location'); |
| 329 | 320 | } |
| 330 | 321 | if (! $languageFilePath){ |
@@ -377,8 +368,7 @@ discard block |
||
| 377 | 368 | $module = $path[0]; |
| 378 | 369 | $class = ucfirst($path[1]); |
| 379 | 370 | } |
| 380 | - } |
|
| 381 | - else{ |
|
| 371 | + } else{ |
|
| 382 | 372 | $class = ucfirst($class); |
| 383 | 373 | } |
| 384 | 374 | if (! $module && !empty($obj->moduleName)){ |
@@ -499,8 +489,7 @@ discard block |
||
| 499 | 489 | if (isset($path[1])){ |
| 500 | 490 | $instance = strtolower($path[1]); |
| 501 | 491 | } |
| 502 | - } |
|
| 503 | - else{ |
|
| 492 | + } else{ |
|
| 504 | 493 | $instance = strtolower($class); |
| 505 | 494 | } |
| 506 | 495 | return $instance; |
@@ -522,8 +511,7 @@ discard block |
||
| 522 | 511 | if ($moduleLibraryPath){ |
| 523 | 512 | $logger->info('Found library [' . $class . '] from module [' .$module. '], the file path is [' .$moduleLibraryPath. '] we will used it'); |
| 524 | 513 | $libraryFilePath = $moduleLibraryPath; |
| 525 | - } |
|
| 526 | - else{ |
|
| 514 | + } else{ |
|
| 527 | 515 | $logger->info('Cannot find library [' . $class . '] from modules using the default location'); |
| 528 | 516 | } |
| 529 | 517 | return $libraryFilePath; |
@@ -547,12 +535,10 @@ discard block |
||
| 547 | 535 | $obj->{$instance} = $c; |
| 548 | 536 | static::$loaded[$instance] = $class; |
| 549 | 537 | $logger->info('Library [' . $class . '] --> ' . $libraryFilePath . ' loaded successfully.'); |
| 550 | - } |
|
| 551 | - else{ |
|
| 538 | + } else{ |
|
| 552 | 539 | show_error('The file '.$libraryFilePath.' exists but does not contain the class '.$class); |
| 553 | 540 | } |
| 554 | - } |
|
| 555 | - else{ |
|
| 541 | + } else{ |
|
| 556 | 542 | show_error('Unable to find library class [' . $class . ']'); |
| 557 | 543 | } |
| 558 | 544 | } |
@@ -578,8 +564,7 @@ discard block |
||
| 578 | 564 | } |
| 579 | 565 | static::$loaded['lang_' . $language] = $languageFilePath; |
| 580 | 566 | $logger->info('Language [' . $language . '] --> ' . $languageFilePath . ' loaded successfully.'); |
| 581 | - } |
|
| 582 | - else{ |
|
| 567 | + } else{ |
|
| 583 | 568 | show_error('Unable to find language [' . $language . ']'); |
| 584 | 569 | } |
| 585 | 570 | } |
@@ -156,8 +156,7 @@ |
||
| 156 | 156 | $this->updateQueryBuilderAndRunnerProperties(); |
| 157 | 157 | |
| 158 | 158 | return is_object($this->pdo); |
| 159 | - } |
|
| 160 | - catch (PDOException $e){ |
|
| 159 | + } catch (PDOException $e){ |
|
| 161 | 160 | $this->logger->fatal($e->getMessage()); |
| 162 | 161 | show_error('Cannot connect to Database.'); |
| 163 | 162 | return false; |
@@ -48,16 +48,14 @@ discard block |
||
| 48 | 48 | require_once CONFIG_PATH . 'config_pagination.php'; |
| 49 | 49 | if (empty($config) || ! is_array($config)){ |
| 50 | 50 | show_error('No configuration found in ' . CONFIG_PATH . 'config_pagination.php'); |
| 51 | - } |
|
| 52 | - else{ |
|
| 51 | + } else{ |
|
| 53 | 52 | $config = array_merge($config, $overwriteConfig); |
| 54 | 53 | $this->config = $config; |
| 55 | 54 | //put it gobally |
| 56 | 55 | Config::setAll($config); |
| 57 | 56 | unset($config); |
| 58 | 57 | } |
| 59 | - } |
|
| 60 | - else{ |
|
| 58 | + } else{ |
|
| 61 | 59 | show_error('Unable to find the pagination configuration file'); |
| 62 | 60 | } |
| 63 | 61 | } |
@@ -115,18 +113,15 @@ discard block |
||
| 115 | 113 | $query = ''; |
| 116 | 114 | if ($queryString == ''){ |
| 117 | 115 | $query = '?' . $pageQueryName . '='; |
| 118 | - } |
|
| 119 | - else{ |
|
| 116 | + } else{ |
|
| 120 | 117 | $tab = explode($pageQueryName . '=', $queryString); |
| 121 | 118 | $nb = count($tab); |
| 122 | 119 | if ($nb == 1){ |
| 123 | 120 | $query = '?' . $queryString . '&' . $pageQueryName . '='; |
| 124 | - } |
|
| 125 | - else{ |
|
| 121 | + } else{ |
|
| 126 | 122 | if ($tab[0] == ''){ |
| 127 | 123 | $query = '?' . $pageQueryName . '='; |
| 128 | - } |
|
| 129 | - else{ |
|
| 124 | + } else{ |
|
| 130 | 125 | $query = '?' . $tab[0] . '' . $pageQueryName . '='; |
| 131 | 126 | } |
| 132 | 127 | } |
@@ -180,11 +175,9 @@ discard block |
||
| 180 | 175 | $navbar = null; |
| 181 | 176 | if ($currentPageNumber == 1){ |
| 182 | 177 | $navbar .= $this->buildPaginationLinkForFirstPage($begin, $end, $currentPageNumber); |
| 183 | - } |
|
| 184 | - else if ($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){ |
|
| 178 | + } else if ($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){ |
|
| 185 | 179 | $navbar .= $this->buildPaginationLinkForMiddlePage($begin, $end, $currentPageNumber); |
| 186 | - } |
|
| 187 | - else if ($currentPageNumber == $numberOfPage){ |
|
| 180 | + } else if ($currentPageNumber == $numberOfPage){ |
|
| 188 | 181 | $navbar .= $this->buildPaginationLinkForLastPage($begin, $end, $currentPageNumber); |
| 189 | 182 | } |
| 190 | 183 | $navbar = $this->config['pagination_open'] . $navbar . $this->config['pagination_close']; |
@@ -205,20 +198,17 @@ discard block |
||
| 205 | 198 | if ($numberOfLink % 2 == 0){ |
| 206 | 199 | $start = $currentPageNumber - ($numberOfLink / 2) + 1; |
| 207 | 200 | $end = $currentPageNumber + ($numberOfLink / 2); |
| 208 | - } |
|
| 209 | - else{ |
|
| 201 | + } else{ |
|
| 210 | 202 | $start = $currentPageNumber - floor($numberOfLink / 2); |
| 211 | 203 | $end = $currentPageNumber + floor($numberOfLink / 2); |
| 212 | 204 | } |
| 213 | 205 | if ($start <= 1){ |
| 214 | 206 | $begin = 1; |
| 215 | 207 | $end = $numberOfLink; |
| 216 | - } |
|
| 217 | - else if ($start > 1 && $end < $numberOfPage){ |
|
| 208 | + } else if ($start > 1 && $end < $numberOfPage){ |
|
| 218 | 209 | $begin = $start; |
| 219 | 210 | $end = $end; |
| 220 | - } |
|
| 221 | - else{ |
|
| 211 | + } else{ |
|
| 222 | 212 | $begin = ($numberOfPage - $numberOfLink) + 1; |
| 223 | 213 | $end = $numberOfPage; |
| 224 | 214 | } |
@@ -245,8 +235,7 @@ discard block |
||
| 245 | 235 | for($i = $begin; $i <= $end; $i++){ |
| 246 | 236 | if ($i == $currentPageNumber){ |
| 247 | 237 | $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close']; |
| 248 | - } |
|
| 249 | - else{ |
|
| 238 | + } else{ |
|
| 250 | 239 | $navbar .= $this->config['digit_open'] |
| 251 | 240 | . '<a href="' . $query . $i . '" ' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' |
| 252 | 241 | . $this->config['digit_close']; |
@@ -274,8 +263,7 @@ discard block |
||
| 274 | 263 | for($i = $begin; $i <= $end; $i++){ |
| 275 | 264 | if ($i == $currentPageNumber){ |
| 276 | 265 | $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close']; |
| 277 | - } |
|
| 278 | - else{ |
|
| 266 | + } else{ |
|
| 279 | 267 | $navbar .= $this->config['digit_open'] |
| 280 | 268 | . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i .'</a>' |
| 281 | 269 | . $this->config['digit_close']; |
@@ -303,8 +291,7 @@ discard block |
||
| 303 | 291 | $navbar .= $this->config['active_link_open'] |
| 304 | 292 | . $currentPageNumber |
| 305 | 293 | . $this->config['active_link_close']; |
| 306 | - } |
|
| 307 | - else{ |
|
| 294 | + } else{ |
|
| 308 | 295 | $navbar .= $this->config['digit_open'] |
| 309 | 296 | . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' |
| 310 | 297 | . $this->config['digit_close']; |