@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $this->determineRouteParamsInformation(); |
395 | 395 | |
396 | 396 | //if the request method not match |
397 | - if(!$this->routeMethodMatch){ |
|
397 | + if (!$this->routeMethodMatch) { |
|
398 | 398 | //create the instance of Controller |
399 | 399 | $cError = new Controller(); |
400 | 400 | $cError->response->setStatus(405); |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | * Remove the DOCUMENT_ROOT and front controller from segments if exists |
466 | 466 | * @return void |
467 | 467 | */ |
468 | - protected function removeDocumentRootFrontControllerFromSegments(){ |
|
468 | + protected function removeDocumentRootFrontControllerFromSegments() { |
|
469 | 469 | $segment = $this->segments; |
470 | 470 | $globals = & class_loader('GlobalVar', 'classes'); |
471 | 471 | $rootFolder = substr($globals->server('SCRIPT_NAME'), 0, strpos( |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | //Remove "/" at the first or folder root |
476 | 476 | $rootFolder = trim($rootFolder, $this->uriTrim); |
477 | 477 | $segmentString = implode('/', $segment); |
478 | - if(preg_match('#^' . $rootFolder .'#', $segmentString)){ |
|
478 | + if (preg_match('#^' . $rootFolder . '#', $segmentString)) { |
|
479 | 479 | $segmentString = substr($segmentString, strlen($rootFolder)); |
480 | 480 | } |
481 | 481 | //Remove the "/" after replace like "root_folder/foo" => "/foo" |
@@ -521,11 +521,11 @@ discard block |
||
521 | 521 | protected function setRouteParamsUsingPredefinedConfig($findIndex) { |
522 | 522 | $callback = $this->callback[$findIndex]; |
523 | 523 | //if callback is array so means user defined the HTTP Method |
524 | - if(is_array($callback) && count($callback) > 0){ |
|
525 | - if(array_key_exists($this->requestMethod, $callback)){ |
|
524 | + if (is_array($callback) && count($callback) > 0) { |
|
525 | + if (array_key_exists($this->requestMethod, $callback)) { |
|
526 | 526 | $callback = $callback[$this->requestMethod]; |
527 | 527 | } |
528 | - else{ |
|
528 | + else { |
|
529 | 529 | //Wrong request method |
530 | 530 | $this->logger->warning('The request method [' . $this->requestMethod . '] is not allowed'); |
531 | 531 | $this->routeMethodMatch = false; |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | break; |
612 | 612 | } |
613 | 613 | } |
614 | - if($findIndex !== -1){ |
|
614 | + if ($findIndex !== -1) { |
|
615 | 615 | /* |
616 | 616 | * $args[0] => full string captured by preg_match |
617 | 617 | * $args[1], $args[2], $args[n] => contains the value of |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | * Find file path of the current controller using the current module |
639 | 639 | * @return boolean true if the file path is found otherwise false. |
640 | 640 | */ |
641 | - protected function findControllerFullPathUsingCurrentModule(){ |
|
641 | + protected function findControllerFullPathUsingCurrentModule() { |
|
642 | 642 | $path = $this->moduleInstance->findControllerFullPath(ucfirst($this->controller), $this->module); |
643 | 643 | if (!$path) { |
644 | 644 | $this->logger->info('The controller [' . $this->controller . '] not ' |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | * or the current request does not use module |
656 | 656 | * @return void |
657 | 657 | */ |
658 | - protected function setRouteParamsIfNoModuleOrNotFound(){ |
|
658 | + protected function setRouteParamsIfNoModuleOrNotFound() { |
|
659 | 659 | $segment = $this->segments; |
660 | 660 | //controller |
661 | 661 | if (isset($segment[0])) { |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | * or the current request use module |
677 | 677 | * @return void |
678 | 678 | */ |
679 | - protected function setRouteParamsIfAppHasModuleOrFound(){ |
|
679 | + protected function setRouteParamsIfAppHasModuleOrFound() { |
|
680 | 680 | //get the module list |
681 | 681 | $modules = $this->moduleInstance->getModuleList(); |
682 | 682 | $segment = $this->segments; |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | if (isset($segment[0])) { |
689 | 689 | $this->controller = $segment[0]; |
690 | 690 | //check if the request use the same module name and controller |
691 | - if($this->findControllerFullPathUsingCurrentModule()){ |
|
691 | + if ($this->findControllerFullPathUsingCurrentModule()) { |
|
692 | 692 | array_shift($segment); |
693 | 693 | } |
694 | 694 | } |
@@ -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'); |
@@ -403,10 +403,10 @@ discard block |
||
403 | 403 | * @return object the current instance |
404 | 404 | */ |
405 | 405 | protected function filterValidationData() { |
406 | - foreach ($this->data as $key => $value ) { |
|
406 | + foreach ($this->data as $key => $value) { |
|
407 | 407 | if (is_string($value)) { |
408 | 408 | $this->data[$key] = trim($value); |
409 | - } else if(is_array($value)) { |
|
409 | + } else if (is_array($value)) { |
|
410 | 410 | $this->data[$key] = array_map('trim', $value); |
411 | 411 | } |
412 | 412 | } |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | '{paramValue}' => $paramValue |
450 | 450 | ); |
451 | 451 | if ($field2 !== null) { |
452 | - $template['{field2}'] = $field2; |
|
452 | + $template['{field2}'] = $field2; |
|
453 | 453 | $template['{value2}'] = $this->getFieldValue($field2); |
454 | 454 | $template['{label2}'] = $this->getFieldLabel($field2); |
455 | 455 | } |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | $rule, |
1137 | 1137 | $paramValue |
1138 | 1138 | ); |
1139 | - } else{ |
|
1139 | + } else { |
|
1140 | 1140 | $this->forceError = true; |
1141 | 1141 | show_error('The callback validation function/method "' . $paramValue . '" does not exist'); |
1142 | 1142 | } |