@@ -156,7 +156,7 @@ |
||
| 156 | 156 | return; |
| 157 | 157 | } |
| 158 | 158 | $this->logger->info('Found the registered event listener for the ' |
| 159 | - . 'event [' . $event->getName() . '] the list are: ' . stringify_vars($list)); |
|
| 159 | + . 'event [' . $event->getName() . '] the list are: ' . stringify_vars($list)); |
|
| 160 | 160 | foreach ($list as $listener) { |
| 161 | 161 | $result = call_user_func_array($listener, array($event)); |
| 162 | 162 | if ($event->isReturnBack() === true) { |
@@ -287,12 +287,12 @@ discard block |
||
| 287 | 287 | return $this->output; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - /** |
|
| 291 | - * Set the final page to be rendered |
|
| 292 | - * @param string $output the content of the final page |
|
| 293 | - * |
|
| 294 | - * @return object |
|
| 295 | - */ |
|
| 290 | + /** |
|
| 291 | + * Set the final page to be rendered |
|
| 292 | + * @param string $output the content of the final page |
|
| 293 | + * |
|
| 294 | + * @return object |
|
| 295 | + */ |
|
| 296 | 296 | public function setOutput($output) { |
| 297 | 297 | $this->output = $output; |
| 298 | 298 | return $this; |
@@ -367,12 +367,12 @@ discard block |
||
| 367 | 367 | //@codeCoverageIgnoreEnd |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - /** |
|
| 371 | - * Dispatch the FINAL_VIEW_READY event |
|
| 372 | - * |
|
| 373 | - * @return string|null the final view content after processing by each listener |
|
| 374 | - * if they exists otherwise the same content will be returned |
|
| 375 | - */ |
|
| 370 | + /** |
|
| 371 | + * Dispatch the FINAL_VIEW_READY event |
|
| 372 | + * |
|
| 373 | + * @return string|null the final view content after processing by each listener |
|
| 374 | + * if they exists otherwise the same content will be returned |
|
| 375 | + */ |
|
| 376 | 376 | protected function dispatchFinalViewEvent() { |
| 377 | 377 | //dispatch |
| 378 | 378 | $event = get_instance()->eventdispatcher->dispatch( |
@@ -416,12 +416,12 @@ discard block |
||
| 416 | 416 | && (bool) ini_get('zlib.output_compression') === false; |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - /** |
|
| 420 | - * Return the default full file path for view |
|
| 421 | - * @param string $file the filename |
|
| 422 | - * |
|
| 423 | - * @return string|null the full file path |
|
| 424 | - */ |
|
| 419 | + /** |
|
| 420 | + * Return the default full file path for view |
|
| 421 | + * @param string $file the filename |
|
| 422 | + * |
|
| 423 | + * @return string|null the full file path |
|
| 424 | + */ |
|
| 425 | 425 | protected function getDefaultFilePathForView($file){ |
| 426 | 426 | $searchDir = array(APPS_VIEWS_PATH, CORE_VIEWS_PATH); |
| 427 | 427 | $fullFilePath = null; |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $headerModifiedSince = $globals->server('HTTP_IF_MODIFIED_SINCE'); |
| 455 | 455 | if (!empty($headerModifiedSince) && $lastModified <= strtotime($headerModifiedSince)) { |
| 456 | 456 | $this->logger->info('The cache page content is not yet expire for the ' |
| 457 | - . 'URL [' . $this->currentUrl . '] send 304 header to browser'); |
|
| 457 | + . 'URL [' . $this->currentUrl . '] send 304 header to browser'); |
|
| 458 | 458 | $this->setStatus(304); |
| 459 | 459 | $this->sendHeaders(); |
| 460 | 460 | return true; |
@@ -470,8 +470,8 @@ discard block |
||
| 470 | 470 | */ |
| 471 | 471 | protected function sendCachePageContentToBrowser(&$cache) { |
| 472 | 472 | $this->logger->info('The cache page content is expired or the browser does ' |
| 473 | - . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] ' |
|
| 474 | - . 'send cache headers to tell the browser'); |
|
| 473 | + . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] ' |
|
| 474 | + . 'send cache headers to tell the browser'); |
|
| 475 | 475 | $this->sendHeaders(); |
| 476 | 476 | //current page cache key |
| 477 | 477 | $pageCacheKey = $this->currentUrlCacheKey; |
@@ -610,18 +610,18 @@ discard block |
||
| 610 | 610 | } |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | - /** |
|
| 614 | - * Set the mandory headers, like security, etc. |
|
| 615 | - */ |
|
| 613 | + /** |
|
| 614 | + * Set the mandory headers, like security, etc. |
|
| 615 | + */ |
|
| 616 | 616 | protected function setRequiredHeaders() { |
| 617 | 617 | $requiredHeaders = array( |
| 618 | 618 | 'X-XSS-Protection' => '1; mode=block', |
| 619 | 619 | 'X-Frame-Options' => 'SAMEORIGIN' |
| 620 | 620 | ); |
| 621 | 621 | foreach ($requiredHeaders as $key => $value) { |
| 622 | - if (!isset($this->headers[$key])) { |
|
| 622 | + if (!isset($this->headers[$key])) { |
|
| 623 | 623 | $this->headers[$key] = $value; |
| 624 | - } |
|
| 624 | + } |
|
| 625 | 625 | } |
| 626 | 626 | } |
| 627 | 627 | } |
@@ -278,14 +278,14 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /** |
| 281 | - * Setting the route configuration using the configuration file |
|
| 282 | - * and additional configuration from param |
|
| 283 | - * @param array $overwriteConfig the additional configuration |
|
| 284 | - * to overwrite with the existing one |
|
| 285 | - * @param boolean $useConfigFile whether to use route configuration file |
|
| 286 | - * |
|
| 287 | - * @return object |
|
| 288 | - */ |
|
| 281 | + * Setting the route configuration using the configuration file |
|
| 282 | + * and additional configuration from param |
|
| 283 | + * @param array $overwriteConfig the additional configuration |
|
| 284 | + * to overwrite with the existing one |
|
| 285 | + * @param boolean $useConfigFile whether to use route configuration file |
|
| 286 | + * |
|
| 287 | + * @return object |
|
| 288 | + */ |
|
| 289 | 289 | public function setRouteConfiguration(array $overwriteConfig = array(), $useConfigFile = true) { |
| 290 | 290 | $route = array(); |
| 291 | 291 | if ($useConfigFile && file_exists(CONFIG_PATH . 'routes.php')) { |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | //the URL like http://domain.com/module/controller/method/arg1/arg2/argn |
| 367 | 367 | if (!$this->controller && $this->routeMethodMatch /* normally if the route method isnot match no need continue */) { |
| 368 | 368 | $this->logger->info('Cannot determine the routing information ' |
| 369 | - . 'using the predefined routes configuration, will use the request URI parameters'); |
|
| 369 | + . 'using the predefined routes configuration, will use the request URI parameters'); |
|
| 370 | 370 | //determine route parameters using the route URI param |
| 371 | 371 | $this->determineRouteParamsFromRequestUri(); |
| 372 | 372 | } |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | |
| 396 | 396 | //if the request method not match |
| 397 | 397 | if(!$this->routeMethodMatch){ |
| 398 | - //create the instance of Controller |
|
| 398 | + //create the instance of Controller |
|
| 399 | 399 | $cError = new Controller(); |
| 400 | 400 | $cError->response->setStatus(405); |
| 401 | 401 | $cError->response->setOutput('HTTP method [' . $this->requestMethod . '] not allowed'); |
@@ -493,11 +493,11 @@ discard block |
||
| 493 | 493 | } |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | - /** |
|
| 497 | - * Remove the URL suffix and query string values if exists |
|
| 498 | - * @param string $uri the route URI to process |
|
| 499 | - * @return string the final route uri after processed |
|
| 500 | - */ |
|
| 496 | + /** |
|
| 497 | + * Remove the URL suffix and query string values if exists |
|
| 498 | + * @param string $uri the route URI to process |
|
| 499 | + * @return string the final route uri after processed |
|
| 500 | + */ |
|
| 501 | 501 | protected function removeSuffixAndQueryStringFromUri($uri) { |
| 502 | 502 | $this->logger->debug('Check if URL suffix is enabled in the configuration'); |
| 503 | 503 | //remove url suffix from the request URI |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | $this->logger->info( |
| 627 | 627 | 'After loop in predefined routes configuration,' |
| 628 | 628 | . 'the module name is set but the controller is not set,' |
| 629 | - . 'so we will use module as the controller' |
|
| 629 | + . 'so we will use module as the controller' |
|
| 630 | 630 | ); |
| 631 | 631 | $this->controller = $this->module; |
| 632 | 632 | } |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * Reset the form validation instance |
|
| 129 | - * |
|
| 130 | - * @return object the current instance |
|
| 131 | - */ |
|
| 127 | + /** |
|
| 128 | + * Reset the form validation instance |
|
| 129 | + * |
|
| 130 | + * @return object the current instance |
|
| 131 | + */ |
|
| 132 | 132 | public function reset() { |
| 133 | 133 | $this->rules = array(); |
| 134 | 134 | $this->labels = array(); |
@@ -152,11 +152,11 @@ discard block |
||
| 152 | 152 | return $this; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * Return the validation data |
|
| 157 | - * |
|
| 158 | - * @return array the validation data |
|
| 159 | - */ |
|
| 155 | + /** |
|
| 156 | + * Return the validation data |
|
| 157 | + * |
|
| 158 | + * @return array the validation data |
|
| 159 | + */ |
|
| 160 | 160 | public function getData() { |
| 161 | 161 | return $this->data; |
| 162 | 162 | } |
@@ -205,11 +205,11 @@ discard block |
||
| 205 | 205 | return $this->rules; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - /** |
|
| 209 | - * Return the list of the validations rules for the given field |
|
| 210 | - * |
|
| 211 | - * @return array |
|
| 212 | - */ |
|
| 208 | + /** |
|
| 209 | + * Return the list of the validations rules for the given field |
|
| 210 | + * |
|
| 211 | + * @return array |
|
| 212 | + */ |
|
| 213 | 213 | public function getFieldRules($field) { |
| 214 | 214 | $rules = array(); |
| 215 | 215 | if (array_key_exists($field, $this->rules)) { |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @return mixed |
| 226 | 226 | */ |
| 227 | 227 | public function getFieldValue($field) { |
| 228 | - $value = null; |
|
| 228 | + $value = null; |
|
| 229 | 229 | if (array_key_exists($field, $this->data)) { |
| 230 | 230 | $value = $this->data[$field]; |
| 231 | 231 | } |
@@ -247,15 +247,15 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | |
| 250 | - /** |
|
| 251 | - * Return the list of validation errors |
|
| 252 | - * |
|
| 253 | - * @return array the errors list. |
|
| 254 | - * Format: |
|
| 255 | - * [field1] => 'error message 1', |
|
| 256 | - * [field2] => 'error message 2' |
|
| 257 | - */ |
|
| 258 | - public function getErrors() { |
|
| 250 | + /** |
|
| 251 | + * Return the list of validation errors |
|
| 252 | + * |
|
| 253 | + * @return array the errors list. |
|
| 254 | + * Format: |
|
| 255 | + * [field1] => 'error message 1', |
|
| 256 | + * [field2] => 'error message 2' |
|
| 257 | + */ |
|
| 258 | + public function getErrors() { |
|
| 259 | 259 | return $this->errors; |
| 260 | 260 | } |
| 261 | 261 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | * @param string|null $field2 the second field used in some validation rule like "matches", "not_equal" |
| 349 | 349 | * |
| 350 | 350 | */ |
| 351 | - protected function setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue = null, $field2 = null) { |
|
| 351 | + protected function setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue = null, $field2 = null) { |
|
| 352 | 352 | //if the field is not required and his value is not set don't set error |
| 353 | 353 | //but in case the field have value validate it |
| 354 | 354 | if (!$this->fieldIsRequired($field) && strlen($value) <= 0) { |
@@ -392,9 +392,9 @@ discard block |
||
| 392 | 392 | * @return string the name of the validation method |
| 393 | 393 | */ |
| 394 | 394 | protected function getRuleValidationMethod($rule) { |
| 395 | - $parts = explode('_', $rule); |
|
| 396 | - $parts = array_map('ucfirst', $parts); |
|
| 397 | - return 'checkRule' . implode('', $parts); |
|
| 395 | + $parts = explode('_', $rule); |
|
| 396 | + $parts = array_map('ucfirst', $parts); |
|
| 397 | + return 'checkRule' . implode('', $parts); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | /** |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | protected function filterValidationData() { |
| 406 | 406 | foreach ($this->data as $key => $value ) { |
| 407 | 407 | if (is_string($value)) { |
| 408 | - $this->data[$key] = trim($value); |
|
| 408 | + $this->data[$key] = trim($value); |
|
| 409 | 409 | } else if(is_array($value)) { |
| 410 | 410 | $this->data[$key] = array_map('trim', $value); |
| 411 | 411 | } |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | $template['{field2}'] = $field2; |
| 453 | 453 | $template['{value2}'] = $this->getFieldValue($field2); |
| 454 | 454 | $template['{label2}'] = $this->getFieldLabel($field2); |
| 455 | - } |
|
| 455 | + } |
|
| 456 | 456 | $message = $this->messages[$rule]; |
| 457 | 457 | //Check for custom message |
| 458 | 458 | if (isset($this->customErrors[$field][$rule])) { |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | //Get the name of the method to validate this rule |
| 484 | 484 | $method = $this->getRuleValidationMethod($realRuleName); |
| 485 | 485 | if (method_exists($this, $method)) { |
| 486 | - call_user_func_array(array($this, $method), array($field, $realRuleName, $paramValue)); |
|
| 486 | + call_user_func_array(array($this, $method), array($field, $realRuleName, $paramValue)); |
|
| 487 | 487 | } else { |
| 488 | 488 | $this->forceError = true; |
| 489 | 489 | show_error('Invalid validaton rule "' . $realRuleName . '"'); |
@@ -575,14 +575,14 @@ discard block |
||
| 575 | 575 | * @param string|null $paramValue the rule parameter |
| 576 | 576 | */ |
| 577 | 577 | protected function checkRuleMinLength($field, $rule, $paramValue) { |
| 578 | - $value = $this->getFieldValue($field); |
|
| 579 | - $this->setSimpleFieldError( |
|
| 580 | - strlen($value) < $paramValue, |
|
| 581 | - $field, |
|
| 582 | - $value, |
|
| 583 | - $rule, |
|
| 584 | - $paramValue |
|
| 585 | - ); |
|
| 578 | + $value = $this->getFieldValue($field); |
|
| 579 | + $this->setSimpleFieldError( |
|
| 580 | + strlen($value) < $paramValue, |
|
| 581 | + $field, |
|
| 582 | + $value, |
|
| 583 | + $rule, |
|
| 584 | + $paramValue |
|
| 585 | + ); |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | /** |
@@ -593,14 +593,14 @@ discard block |
||
| 593 | 593 | * @param string|null $paramValue the rule parameter |
| 594 | 594 | */ |
| 595 | 595 | protected function checkRuleMaxLength($field, $rule, $paramValue) { |
| 596 | - $value = $this->getFieldValue($field); |
|
| 597 | - $this->setSimpleFieldError( |
|
| 598 | - strlen($value) > $paramValue, |
|
| 599 | - $field, |
|
| 600 | - $value, |
|
| 601 | - $rule, |
|
| 602 | - $paramValue |
|
| 603 | - ); |
|
| 596 | + $value = $this->getFieldValue($field); |
|
| 597 | + $this->setSimpleFieldError( |
|
| 598 | + strlen($value) > $paramValue, |
|
| 599 | + $field, |
|
| 600 | + $value, |
|
| 601 | + $rule, |
|
| 602 | + $paramValue |
|
| 603 | + ); |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | /** |
@@ -611,14 +611,14 @@ discard block |
||
| 611 | 611 | * @param string|null $paramValue the rule parameter |
| 612 | 612 | */ |
| 613 | 613 | protected function checkRuleExactLength($field, $rule, $paramValue) { |
| 614 | - $value = $this->getFieldValue($field); |
|
| 615 | - $this->setSimpleFieldError( |
|
| 616 | - strlen($value) != $paramValue, |
|
| 617 | - $field, |
|
| 618 | - $value, |
|
| 619 | - $rule, |
|
| 620 | - $paramValue |
|
| 621 | - ); |
|
| 614 | + $value = $this->getFieldValue($field); |
|
| 615 | + $this->setSimpleFieldError( |
|
| 616 | + strlen($value) != $paramValue, |
|
| 617 | + $field, |
|
| 618 | + $value, |
|
| 619 | + $rule, |
|
| 620 | + $paramValue |
|
| 621 | + ); |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | /** |
@@ -631,13 +631,13 @@ discard block |
||
| 631 | 631 | protected function checkRuleMatches($field, $rule, $paramValue) { |
| 632 | 632 | $value = $this->getFieldValue($field); |
| 633 | 633 | $this->setSimpleFieldError( |
| 634 | - $value != $this->getFieldValue($paramValue), |
|
| 635 | - $field, |
|
| 636 | - $value, |
|
| 637 | - $rule, |
|
| 638 | - $paramValue, |
|
| 639 | - $paramValue //field2 |
|
| 640 | - ); |
|
| 634 | + $value != $this->getFieldValue($paramValue), |
|
| 635 | + $field, |
|
| 636 | + $value, |
|
| 637 | + $rule, |
|
| 638 | + $paramValue, |
|
| 639 | + $paramValue //field2 |
|
| 640 | + ); |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | /** |
@@ -650,13 +650,13 @@ discard block |
||
| 650 | 650 | protected function checkRuleNotEqual($field, $rule, $paramValue) { |
| 651 | 651 | $value = $this->getFieldValue($field); |
| 652 | 652 | $this->setSimpleFieldError( |
| 653 | - $value == $this->getFieldValue($paramValue), |
|
| 654 | - $field, |
|
| 655 | - $value, |
|
| 656 | - $rule, |
|
| 657 | - $paramValue, |
|
| 658 | - $paramValue //field2 |
|
| 659 | - ); |
|
| 653 | + $value == $this->getFieldValue($paramValue), |
|
| 654 | + $field, |
|
| 655 | + $value, |
|
| 656 | + $rule, |
|
| 657 | + $paramValue, |
|
| 658 | + $paramValue //field2 |
|
| 659 | + ); |
|
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | /** |
@@ -669,12 +669,12 @@ discard block |
||
| 669 | 669 | protected function checkRuleMin($field, $rule, $paramValue) { |
| 670 | 670 | $value = $this->getFieldValue($field); |
| 671 | 671 | $this->setSimpleFieldError( |
| 672 | - $value < $paramValue, |
|
| 673 | - $field, |
|
| 674 | - $value, |
|
| 675 | - $rule, |
|
| 676 | - $paramValue |
|
| 677 | - ); |
|
| 672 | + $value < $paramValue, |
|
| 673 | + $field, |
|
| 674 | + $value, |
|
| 675 | + $rule, |
|
| 676 | + $paramValue |
|
| 677 | + ); |
|
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | /** |
@@ -687,12 +687,12 @@ discard block |
||
| 687 | 687 | protected function checkRuleMax($field, $rule, $paramValue) { |
| 688 | 688 | $value = $this->getFieldValue($field); |
| 689 | 689 | $this->setSimpleFieldError( |
| 690 | - $value > $paramValue, |
|
| 691 | - $field, |
|
| 692 | - $value, |
|
| 693 | - $rule, |
|
| 694 | - $paramValue |
|
| 695 | - ); |
|
| 690 | + $value > $paramValue, |
|
| 691 | + $field, |
|
| 692 | + $value, |
|
| 693 | + $rule, |
|
| 694 | + $paramValue |
|
| 695 | + ); |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | /** |
@@ -708,12 +708,12 @@ discard block |
||
| 708 | 708 | $betweens = explode(',', $paramValue, 2); |
| 709 | 709 | $betweens = array_map('trim', $betweens); |
| 710 | 710 | $this->setSimpleFieldError( |
| 711 | - ($value < $betweens[0]) || ($value > $betweens[1]), |
|
| 712 | - $field, |
|
| 713 | - $value, |
|
| 714 | - $rule, |
|
| 715 | - $paramValue |
|
| 716 | - ); |
|
| 711 | + ($value < $betweens[0]) || ($value > $betweens[1]), |
|
| 712 | + $field, |
|
| 713 | + $value, |
|
| 714 | + $rule, |
|
| 715 | + $paramValue |
|
| 716 | + ); |
|
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | /** |
@@ -730,12 +730,12 @@ discard block |
||
| 730 | 730 | $list = array_map('trim', $list); |
| 731 | 731 | $paramValue = implode(',', $list); |
| 732 | 732 | $this->setSimpleFieldError( |
| 733 | - !in_array($value, $list), |
|
| 734 | - $field, |
|
| 735 | - $value, |
|
| 736 | - $rule, |
|
| 737 | - $paramValue |
|
| 738 | - ); |
|
| 733 | + !in_array($value, $list), |
|
| 734 | + $field, |
|
| 735 | + $value, |
|
| 736 | + $rule, |
|
| 737 | + $paramValue |
|
| 738 | + ); |
|
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | /** |
@@ -748,12 +748,12 @@ discard block |
||
| 748 | 748 | protected function checkRuleNumeric($field, $rule, $paramValue) { |
| 749 | 749 | $value = $this->getFieldValue($field); |
| 750 | 750 | $this->setSimpleFieldError( |
| 751 | - !is_numeric($value), |
|
| 752 | - $field, |
|
| 753 | - $value, |
|
| 754 | - $rule, |
|
| 755 | - $paramValue |
|
| 756 | - ); |
|
| 751 | + !is_numeric($value), |
|
| 752 | + $field, |
|
| 753 | + $value, |
|
| 754 | + $rule, |
|
| 755 | + $paramValue |
|
| 756 | + ); |
|
| 757 | 757 | } |
| 758 | 758 | |
| 759 | 759 | /** |
@@ -765,13 +765,13 @@ discard block |
||
| 765 | 765 | */ |
| 766 | 766 | protected function checkRuleInteger($field, $rule, $paramValue) { |
| 767 | 767 | $value = $this->getFieldValue($field); |
| 768 | - $this->setSimpleFieldError( |
|
| 769 | - filter_var($value, FILTER_VALIDATE_INT) === false, |
|
| 770 | - $field, |
|
| 771 | - $value, |
|
| 772 | - $rule, |
|
| 773 | - $paramValue |
|
| 774 | - ); |
|
| 768 | + $this->setSimpleFieldError( |
|
| 769 | + filter_var($value, FILTER_VALIDATE_INT) === false, |
|
| 770 | + $field, |
|
| 771 | + $value, |
|
| 772 | + $rule, |
|
| 773 | + $paramValue |
|
| 774 | + ); |
|
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | /** |
@@ -784,12 +784,12 @@ discard block |
||
| 784 | 784 | protected function checkRuleIntegerNatural($field, $rule, $paramValue) { |
| 785 | 785 | $value = $this->getFieldValue($field); |
| 786 | 786 | $this->setSimpleFieldError( |
| 787 | - filter_var($value, FILTER_VALIDATE_INT) === false || $value < 0, |
|
| 788 | - $field, |
|
| 789 | - $value, |
|
| 790 | - $rule, |
|
| 791 | - $paramValue |
|
| 792 | - ); |
|
| 787 | + filter_var($value, FILTER_VALIDATE_INT) === false || $value < 0, |
|
| 788 | + $field, |
|
| 789 | + $value, |
|
| 790 | + $rule, |
|
| 791 | + $paramValue |
|
| 792 | + ); |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | /** |
@@ -802,12 +802,12 @@ discard block |
||
| 802 | 802 | protected function checkRuleAlpha($field, $rule, $paramValue) { |
| 803 | 803 | $value = $this->getFieldValue($field); |
| 804 | 804 | $this->setSimpleFieldError( |
| 805 | - !preg_match('/^[\pL\pM\s]+$/u', $value), |
|
| 806 | - $field, |
|
| 807 | - $value, |
|
| 808 | - $rule, |
|
| 809 | - $paramValue |
|
| 810 | - ); |
|
| 805 | + !preg_match('/^[\pL\pM\s]+$/u', $value), |
|
| 806 | + $field, |
|
| 807 | + $value, |
|
| 808 | + $rule, |
|
| 809 | + $paramValue |
|
| 810 | + ); |
|
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | /** |
@@ -820,12 +820,12 @@ discard block |
||
| 820 | 820 | protected function checkRuleAlphaDash($field, $rule, $paramValue) { |
| 821 | 821 | $value = $this->getFieldValue($field); |
| 822 | 822 | $this->setSimpleFieldError( |
| 823 | - !preg_match('/^[\pL\pM_-]+$/u', $value), |
|
| 824 | - $field, |
|
| 825 | - $value, |
|
| 826 | - $rule, |
|
| 827 | - $paramValue |
|
| 828 | - ); |
|
| 823 | + !preg_match('/^[\pL\pM_-]+$/u', $value), |
|
| 824 | + $field, |
|
| 825 | + $value, |
|
| 826 | + $rule, |
|
| 827 | + $paramValue |
|
| 828 | + ); |
|
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | /** |
@@ -838,12 +838,12 @@ discard block |
||
| 838 | 838 | protected function checkRuleAlnum($field, $rule, $paramValue) { |
| 839 | 839 | $value = $this->getFieldValue($field); |
| 840 | 840 | $this->setSimpleFieldError( |
| 841 | - !preg_match('/^[\pL\pM\pN\s]+$/u', $value), |
|
| 842 | - $field, |
|
| 843 | - $value, |
|
| 844 | - $rule, |
|
| 845 | - $paramValue |
|
| 846 | - ); |
|
| 841 | + !preg_match('/^[\pL\pM\pN\s]+$/u', $value), |
|
| 842 | + $field, |
|
| 843 | + $value, |
|
| 844 | + $rule, |
|
| 845 | + $paramValue |
|
| 846 | + ); |
|
| 847 | 847 | } |
| 848 | 848 | |
| 849 | 849 | /** |
@@ -856,12 +856,12 @@ discard block |
||
| 856 | 856 | protected function checkRuleAlnumDash($field, $rule, $paramValue) { |
| 857 | 857 | $value = $this->getFieldValue($field); |
| 858 | 858 | $this->setSimpleFieldError( |
| 859 | - !preg_match('/^[\pL\pM\pN_-]+$/u', $value), |
|
| 860 | - $field, |
|
| 861 | - $value, |
|
| 862 | - $rule, |
|
| 863 | - $paramValue |
|
| 864 | - ); |
|
| 859 | + !preg_match('/^[\pL\pM\pN_-]+$/u', $value), |
|
| 860 | + $field, |
|
| 861 | + $value, |
|
| 862 | + $rule, |
|
| 863 | + $paramValue |
|
| 864 | + ); |
|
| 865 | 865 | } |
| 866 | 866 | |
| 867 | 867 | /** |
@@ -874,12 +874,12 @@ discard block |
||
| 874 | 874 | protected function checkRuleEmail($field, $rule, $paramValue) { |
| 875 | 875 | $value = $this->getFieldValue($field); |
| 876 | 876 | $this->setSimpleFieldError( |
| 877 | - filter_var($value, FILTER_VALIDATE_EMAIL) === false, |
|
| 878 | - $field, |
|
| 879 | - $value, |
|
| 880 | - $rule, |
|
| 881 | - $paramValue |
|
| 882 | - ); |
|
| 877 | + filter_var($value, FILTER_VALIDATE_EMAIL) === false, |
|
| 878 | + $field, |
|
| 879 | + $value, |
|
| 880 | + $rule, |
|
| 881 | + $paramValue |
|
| 882 | + ); |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | 885 | /** |
@@ -895,12 +895,12 @@ discard block |
||
| 895 | 895 | $format = $paramValue; |
| 896 | 896 | $dateValue = date_create_from_format($format, $value); |
| 897 | 897 | $this->setSimpleFieldError( |
| 898 | - $dateValue === false || $dateValue->format($format) !== $value, |
|
| 899 | - $field, |
|
| 900 | - $value, |
|
| 901 | - $rule, |
|
| 902 | - $paramValue |
|
| 903 | - ); |
|
| 898 | + $dateValue === false || $dateValue->format($format) !== $value, |
|
| 899 | + $field, |
|
| 900 | + $value, |
|
| 901 | + $rule, |
|
| 902 | + $paramValue |
|
| 903 | + ); |
|
| 904 | 904 | } |
| 905 | 905 | |
| 906 | 906 | /** |
@@ -913,13 +913,13 @@ discard block |
||
| 913 | 913 | */ |
| 914 | 914 | protected function checkRuleDateBefore($field, $rule, $paramValue) { |
| 915 | 915 | $value = $this->getFieldValue($field); |
| 916 | - $this->setSimpleFieldError( |
|
| 917 | - strtotime($value) >= strtotime($paramValue), |
|
| 918 | - $field, |
|
| 919 | - $value, |
|
| 920 | - $rule, |
|
| 921 | - $paramValue |
|
| 922 | - ); |
|
| 916 | + $this->setSimpleFieldError( |
|
| 917 | + strtotime($value) >= strtotime($paramValue), |
|
| 918 | + $field, |
|
| 919 | + $value, |
|
| 920 | + $rule, |
|
| 921 | + $paramValue |
|
| 922 | + ); |
|
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | /** |
@@ -933,12 +933,12 @@ discard block |
||
| 933 | 933 | protected function checkRuleDateAfter($field, $rule, $paramValue) { |
| 934 | 934 | $value = $this->getFieldValue($field); |
| 935 | 935 | $this->setSimpleFieldError( |
| 936 | - strtotime($value) <= strtotime($paramValue), |
|
| 937 | - $field, |
|
| 938 | - $value, |
|
| 939 | - $rule, |
|
| 940 | - $paramValue |
|
| 941 | - ); |
|
| 936 | + strtotime($value) <= strtotime($paramValue), |
|
| 937 | + $field, |
|
| 938 | + $value, |
|
| 939 | + $rule, |
|
| 940 | + $paramValue |
|
| 941 | + ); |
|
| 942 | 942 | } |
| 943 | 943 | |
| 944 | 944 | /** |
@@ -951,12 +951,12 @@ discard block |
||
| 951 | 951 | protected function checkRuleUrl($field, $rule, $paramValue) { |
| 952 | 952 | $value = $this->getFieldValue($field); |
| 953 | 953 | $this->setSimpleFieldError( |
| 954 | - filter_var($value, FILTER_VALIDATE_URL) === false, |
|
| 955 | - $field, |
|
| 956 | - $value, |
|
| 957 | - $rule, |
|
| 958 | - $paramValue |
|
| 959 | - ); |
|
| 954 | + filter_var($value, FILTER_VALIDATE_URL) === false, |
|
| 955 | + $field, |
|
| 956 | + $value, |
|
| 957 | + $rule, |
|
| 958 | + $paramValue |
|
| 959 | + ); |
|
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | /** |
@@ -970,12 +970,12 @@ discard block |
||
| 970 | 970 | protected function checkRuleIp($field, $rule, $paramValue) { |
| 971 | 971 | $value = $this->getFieldValue($field); |
| 972 | 972 | $this->setSimpleFieldError( |
| 973 | - filter_var($value, FILTER_VALIDATE_IP) === false, |
|
| 974 | - $field, |
|
| 975 | - $value, |
|
| 976 | - $rule, |
|
| 977 | - $paramValue |
|
| 978 | - ); |
|
| 973 | + filter_var($value, FILTER_VALIDATE_IP) === false, |
|
| 974 | + $field, |
|
| 975 | + $value, |
|
| 976 | + $rule, |
|
| 977 | + $paramValue |
|
| 978 | + ); |
|
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | /** |
@@ -988,12 +988,12 @@ discard block |
||
| 988 | 988 | protected function checkRuleIpv4($field, $rule, $paramValue) { |
| 989 | 989 | $value = $this->getFieldValue($field); |
| 990 | 990 | $this->setSimpleFieldError( |
| 991 | - filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false, |
|
| 992 | - $field, |
|
| 993 | - $value, |
|
| 994 | - $rule, |
|
| 995 | - $paramValue |
|
| 996 | - ); |
|
| 991 | + filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false, |
|
| 992 | + $field, |
|
| 993 | + $value, |
|
| 994 | + $rule, |
|
| 995 | + $paramValue |
|
| 996 | + ); |
|
| 997 | 997 | } |
| 998 | 998 | |
| 999 | 999 | /** |
@@ -1006,12 +1006,12 @@ discard block |
||
| 1006 | 1006 | protected function checkRuleIpv6($field, $rule, $paramValue) { |
| 1007 | 1007 | $value = $this->getFieldValue($field); |
| 1008 | 1008 | $this->setSimpleFieldError( |
| 1009 | - filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false, |
|
| 1010 | - $field, |
|
| 1011 | - $value, |
|
| 1012 | - $rule, |
|
| 1013 | - $paramValue |
|
| 1014 | - ); |
|
| 1009 | + filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false, |
|
| 1010 | + $field, |
|
| 1011 | + $value, |
|
| 1012 | + $rule, |
|
| 1013 | + $paramValue |
|
| 1014 | + ); |
|
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | 1017 | /** |
@@ -1032,7 +1032,7 @@ discard block |
||
| 1032 | 1032 | $value = $this->getFieldValue($field); |
| 1033 | 1033 | list($table, $column) = explode('.', $paramValue); |
| 1034 | 1034 | $obj->database->getQueryBuilder()->from($table) |
| 1035 | - ->where($column, $value); |
|
| 1035 | + ->where($column, $value); |
|
| 1036 | 1036 | $obj->database->get(); |
| 1037 | 1037 | if ($obj->database->numRows() > 0) { |
| 1038 | 1038 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -1059,8 +1059,8 @@ discard block |
||
| 1059 | 1059 | list($table, $column) = explode('.', $data[0]); |
| 1060 | 1060 | list($columnKey, $valueKey) = explode('=', $data[1]); |
| 1061 | 1061 | $obj->database->getQueryBuilder()->from($table) |
| 1062 | - ->where($column, $value) |
|
| 1063 | - ->where($columnKey, '!=', trim($valueKey)); |
|
| 1062 | + ->where($column, $value) |
|
| 1063 | + ->where($columnKey, '!=', trim($valueKey)); |
|
| 1064 | 1064 | $obj->database->get(); |
| 1065 | 1065 | if ($obj->database->numRows() > 0) { |
| 1066 | 1066 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | $value = $this->getFieldValue($field); |
| 1086 | 1086 | list($table, $column) = explode('.', $paramValue); |
| 1087 | 1087 | $obj->database->getQueryBuilder()->from($table) |
| 1088 | - ->where($column, $value); |
|
| 1088 | + ->where($column, $value); |
|
| 1089 | 1089 | $obj->database->get(); |
| 1090 | 1090 | if ($obj->database->numRows() <= 0) { |
| 1091 | 1091 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -1102,13 +1102,13 @@ discard block |
||
| 1102 | 1102 | */ |
| 1103 | 1103 | protected function checkRuleRegex($field, $rule, $paramValue) { |
| 1104 | 1104 | $value = $this->getFieldValue($field); |
| 1105 | - $this->setSimpleFieldError( |
|
| 1106 | - !preg_match($paramValue, $value), |
|
| 1107 | - $field, |
|
| 1108 | - $value, |
|
| 1109 | - $rule, |
|
| 1110 | - $paramValue |
|
| 1111 | - ); |
|
| 1105 | + $this->setSimpleFieldError( |
|
| 1106 | + !preg_match($paramValue, $value), |
|
| 1107 | + $field, |
|
| 1108 | + $value, |
|
| 1109 | + $rule, |
|
| 1110 | + $paramValue |
|
| 1111 | + ); |
|
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | 1114 | /** |
@@ -1130,12 +1130,12 @@ discard block |
||
| 1130 | 1130 | $value = $this->getFieldValue($field); |
| 1131 | 1131 | if (is_callable($paramValue)) { |
| 1132 | 1132 | $this->setSimpleFieldError( |
| 1133 | - call_user_func_array($paramValue, array($value)) === false, |
|
| 1134 | - $field, |
|
| 1135 | - $value, |
|
| 1136 | - $rule, |
|
| 1137 | - $paramValue |
|
| 1138 | - ); |
|
| 1133 | + call_user_func_array($paramValue, array($value)) === false, |
|
| 1134 | + $field, |
|
| 1135 | + $value, |
|
| 1136 | + $rule, |
|
| 1137 | + $paramValue |
|
| 1138 | + ); |
|
| 1139 | 1139 | } else{ |
| 1140 | 1140 | $this->forceError = true; |
| 1141 | 1141 | show_error('The callback validation function/method "' . $paramValue . '" does not exist'); |