@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | */ |
45 | 45 | class Assets extends BaseClass { |
46 | 46 | |
47 | - /** |
|
48 | - * Construct new instance |
|
49 | - */ |
|
47 | + /** |
|
48 | + * Construct new instance |
|
49 | + */ |
|
50 | 50 | public function __construct() { |
51 | 51 | parent::__construct(); |
52 | 52 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @see Assets:link |
96 | 96 | */ |
97 | 97 | public function css($path) { |
98 | - return $this->link($path, 'css'); |
|
98 | + return $this->link($path, 'css'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -443,10 +443,10 @@ discard block |
||
443 | 443 | * @return object the current instance |
444 | 444 | */ |
445 | 445 | protected function filterValidationData() { |
446 | - foreach ($this->data as $key => $value ) { |
|
446 | + foreach ($this->data as $key => $value) { |
|
447 | 447 | if (is_string($value)) { |
448 | 448 | $this->data[$key] = trim($value); |
449 | - } else if(is_array($value)) { |
|
449 | + } else if (is_array($value)) { |
|
450 | 450 | $this->data[$key] = array_map('trim', $value); |
451 | 451 | } |
452 | 452 | } |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | $rule, |
1162 | 1162 | $paramValue |
1163 | 1163 | ); |
1164 | - } else{ |
|
1164 | + } else { |
|
1165 | 1165 | $this->forceError = true; |
1166 | 1166 | show_error('The callback validation function/method "' . $paramValue . '" does not exist'); |
1167 | 1167 | } |
@@ -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 string|null |
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 | /** |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | $value = $this->getFieldValue($field); |
1031 | 1031 | list($table, $column) = explode('.', $paramValue); |
1032 | 1032 | $obj->database->getQueryBuilder()->from($table) |
1033 | - ->where($column, $value); |
|
1033 | + ->where($column, $value); |
|
1034 | 1034 | $obj->database->get(); |
1035 | 1035 | if ($obj->database->numRows() > 0) { |
1036 | 1036 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -1055,8 +1055,8 @@ discard block |
||
1055 | 1055 | list($table, $column) = explode('.', $data[0]); |
1056 | 1056 | list($columnKey, $valueKey) = explode('=', $data[1]); |
1057 | 1057 | $obj->database->getQueryBuilder()->from($table) |
1058 | - ->where($column, $value) |
|
1059 | - ->where($columnKey, '!=', trim($valueKey)); |
|
1058 | + ->where($column, $value) |
|
1059 | + ->where($columnKey, '!=', trim($valueKey)); |
|
1060 | 1060 | $obj->database->get(); |
1061 | 1061 | if ($obj->database->numRows() > 0) { |
1062 | 1062 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | $value = $this->getFieldValue($field); |
1080 | 1080 | list($table, $column) = explode('.', $paramValue); |
1081 | 1081 | $obj->database->getQueryBuilder()->from($table) |
1082 | - ->where($column, $value); |
|
1082 | + ->where($column, $value); |
|
1083 | 1083 | $obj->database->get(); |
1084 | 1084 | if ($obj->database->numRows() <= 0) { |
1085 | 1085 | $this->setFieldErrorWithRequiredCheck($field, $value, $rule, $paramValue); |
@@ -1096,13 +1096,13 @@ discard block |
||
1096 | 1096 | */ |
1097 | 1097 | protected function checkRuleRegex($field, $rule, $paramValue) { |
1098 | 1098 | $value = $this->getFieldValue($field); |
1099 | - $this->setSimpleFieldError( |
|
1100 | - !preg_match($paramValue, $value), |
|
1101 | - $field, |
|
1102 | - $value, |
|
1103 | - $rule, |
|
1104 | - $paramValue |
|
1105 | - ); |
|
1099 | + $this->setSimpleFieldError( |
|
1100 | + !preg_match($paramValue, $value), |
|
1101 | + $field, |
|
1102 | + $value, |
|
1103 | + $rule, |
|
1104 | + $paramValue |
|
1105 | + ); |
|
1106 | 1106 | } |
1107 | 1107 | |
1108 | 1108 | /** |
@@ -1124,12 +1124,12 @@ discard block |
||
1124 | 1124 | $value = $this->getFieldValue($field); |
1125 | 1125 | if (is_callable($paramValue)) { |
1126 | 1126 | $this->setSimpleFieldError( |
1127 | - call_user_func_array($paramValue, array($value)) === false, |
|
1128 | - $field, |
|
1129 | - $value, |
|
1130 | - $rule, |
|
1131 | - $paramValue |
|
1132 | - ); |
|
1127 | + call_user_func_array($paramValue, array($value)) === false, |
|
1128 | + $field, |
|
1129 | + $value, |
|
1130 | + $rule, |
|
1131 | + $paramValue |
|
1132 | + ); |
|
1133 | 1133 | } else{ |
1134 | 1134 | $this->forceError = true; |
1135 | 1135 | show_error('The callback validation function/method "' . $paramValue . '" does not exist'); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - defined('ROOT_PATH') || exit('Access denied'); |
|
2 | + defined('ROOT_PATH') || exit('Access denied'); |
|
3 | 3 | /** |
4 | 4 | * TNH Framework |
5 | 5 | * |
@@ -28,68 +28,68 @@ discard block |
||
28 | 28 | * SOFTWARE. |
29 | 29 | */ |
30 | 30 | |
31 | - class Browser { |
|
32 | - |
|
33 | - /** |
|
34 | - * List of know platforms |
|
35 | - * @var array |
|
36 | - */ |
|
37 | - private $platforms = array( |
|
38 | - '/windows nt 10/i' => 'Windows 10', |
|
39 | - '/windows phone 10/i' => 'Windows Phone 10', |
|
40 | - '/windows phone 8.1/i' => 'Windows Phone 8.1', |
|
41 | - '/windows phone 8/i' => 'Windows Phone 8', |
|
42 | - '/windows nt 6.3/i' => 'Windows 8.1', |
|
43 | - '/windows nt 6.2/i' => 'Windows 8', |
|
44 | - '/windows nt 6.1/i' => 'Windows 7', |
|
45 | - '/windows nt 6.0/i' => 'Windows Vista', |
|
46 | - '/windows nt 5.2/i' => 'Windows Server 2003/XP x64', |
|
47 | - '/windows nt 5.1/i' => 'Windows XP', |
|
48 | - '/windows xp/i' => 'Windows XP', |
|
49 | - '/windows nt 5.0/i' => 'Windows 2000', |
|
50 | - '/windows me/i' => 'Windows ME', |
|
51 | - '/win98/i' => 'Windows 98', |
|
52 | - '/win95/i' => 'Windows 95', |
|
53 | - '/win16/i' => 'Windows 3.11', |
|
54 | - '/ipad/i' => 'iPad', |
|
31 | + class Browser { |
|
32 | + |
|
33 | + /** |
|
34 | + * List of know platforms |
|
35 | + * @var array |
|
36 | + */ |
|
37 | + private $platforms = array( |
|
38 | + '/windows nt 10/i' => 'Windows 10', |
|
39 | + '/windows phone 10/i' => 'Windows Phone 10', |
|
40 | + '/windows phone 8.1/i' => 'Windows Phone 8.1', |
|
41 | + '/windows phone 8/i' => 'Windows Phone 8', |
|
42 | + '/windows nt 6.3/i' => 'Windows 8.1', |
|
43 | + '/windows nt 6.2/i' => 'Windows 8', |
|
44 | + '/windows nt 6.1/i' => 'Windows 7', |
|
45 | + '/windows nt 6.0/i' => 'Windows Vista', |
|
46 | + '/windows nt 5.2/i' => 'Windows Server 2003/XP x64', |
|
47 | + '/windows nt 5.1/i' => 'Windows XP', |
|
48 | + '/windows xp/i' => 'Windows XP', |
|
49 | + '/windows nt 5.0/i' => 'Windows 2000', |
|
50 | + '/windows me/i' => 'Windows ME', |
|
51 | + '/win98/i' => 'Windows 98', |
|
52 | + '/win95/i' => 'Windows 95', |
|
53 | + '/win16/i' => 'Windows 3.11', |
|
54 | + '/ipad/i' => 'iPad', |
|
55 | 55 | '/ipod/i' => 'iPod', |
56 | 56 | '/iphone/i' => 'iPhone', |
57 | 57 | '/macintosh|mac os x/i' => 'Mac OS X', |
58 | - '/mac_powerpc/i' => 'Mac OS 9', |
|
59 | - '/android/i' => 'Android', |
|
60 | - '/ubuntu/i' => 'Ubuntu', |
|
61 | - '/linux/i' => 'Linux', |
|
62 | - '/blackberry/i' => 'BlackBerry', |
|
63 | - '/webos/i' => 'Mobile' |
|
64 | - ); |
|
65 | - |
|
66 | - /** |
|
67 | - * List of know browsers |
|
68 | - * @var array |
|
69 | - */ |
|
70 | - private $browsers = array( |
|
71 | - '/mobile/i' => 'Handheld Browser', |
|
72 | - '/msie/i' => 'Internet Explorer', |
|
73 | - '/firefox/i' => 'Firefox', |
|
74 | - '/chrome/i' => 'Chrome', |
|
75 | - '/safari/i' => 'Safari', |
|
76 | - '/edge/i' => 'Edge', |
|
77 | - '/opera/i' => 'Opera', |
|
78 | - '/netscape/i' => 'Netscape', |
|
79 | - '/maxthon/i' => 'Maxthon', |
|
80 | - '/konqueror/i' => 'Konqueror' |
|
81 | - ); |
|
82 | - |
|
83 | - /** |
|
84 | - * Agent string |
|
85 | - * @var string |
|
86 | - */ |
|
87 | - private $agent = ''; |
|
88 | - |
|
89 | - /** |
|
90 | - * Browser name |
|
91 | - * @var string |
|
92 | - */ |
|
58 | + '/mac_powerpc/i' => 'Mac OS 9', |
|
59 | + '/android/i' => 'Android', |
|
60 | + '/ubuntu/i' => 'Ubuntu', |
|
61 | + '/linux/i' => 'Linux', |
|
62 | + '/blackberry/i' => 'BlackBerry', |
|
63 | + '/webos/i' => 'Mobile' |
|
64 | + ); |
|
65 | + |
|
66 | + /** |
|
67 | + * List of know browsers |
|
68 | + * @var array |
|
69 | + */ |
|
70 | + private $browsers = array( |
|
71 | + '/mobile/i' => 'Handheld Browser', |
|
72 | + '/msie/i' => 'Internet Explorer', |
|
73 | + '/firefox/i' => 'Firefox', |
|
74 | + '/chrome/i' => 'Chrome', |
|
75 | + '/safari/i' => 'Safari', |
|
76 | + '/edge/i' => 'Edge', |
|
77 | + '/opera/i' => 'Opera', |
|
78 | + '/netscape/i' => 'Netscape', |
|
79 | + '/maxthon/i' => 'Maxthon', |
|
80 | + '/konqueror/i' => 'Konqueror' |
|
81 | + ); |
|
82 | + |
|
83 | + /** |
|
84 | + * Agent string |
|
85 | + * @var string |
|
86 | + */ |
|
87 | + private $agent = ''; |
|
88 | + |
|
89 | + /** |
|
90 | + * Browser name |
|
91 | + * @var string |
|
92 | + */ |
|
93 | 93 | private $browserName = ''; |
94 | 94 | |
95 | 95 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | private $isFacebook = false; |
130 | 130 | |
131 | - /** |
|
131 | + /** |
|
132 | 132 | * Class constructor |
133 | 133 | */ |
134 | 134 | public function __construct($userAgent = '') { |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | return $this->isFacebook; |
232 | 232 | } |
233 | 233 | |
234 | - /** |
|
235 | - * Returns a formatted string with a summary of the details of the browser. |
|
236 | - * @codeCoverageIgnore |
|
237 | - * |
|
238 | - * @return string formatted string with a summary of the browser |
|
239 | - */ |
|
234 | + /** |
|
235 | + * Returns a formatted string with a summary of the details of the browser. |
|
236 | + * @codeCoverageIgnore |
|
237 | + * |
|
238 | + * @return string formatted string with a summary of the browser |
|
239 | + */ |
|
240 | 240 | public function __toString() { |
241 | 241 | return "<strong>Browser Name:</strong> {$this->getBrowser()}<br/>\n" . |
242 | 242 | "<strong>Browser Version:</strong> {$this->getVersion()}<br/>\n" . |
@@ -248,70 +248,70 @@ discard block |
||
248 | 248 | /** |
249 | 249 | * Determine the user's platform |
250 | 250 | */ |
251 | - protected function checkPlatform() { |
|
252 | - foreach ($this->platforms as $regex => $value) { |
|
253 | - if (preg_match($regex, $this->agent) ) { |
|
254 | - $this->platform = $value; |
|
255 | - break; |
|
256 | - } |
|
257 | - } |
|
258 | - } |
|
259 | - |
|
260 | - /** |
|
251 | + protected function checkPlatform() { |
|
252 | + foreach ($this->platforms as $regex => $value) { |
|
253 | + if (preg_match($regex, $this->agent) ) { |
|
254 | + $this->platform = $value; |
|
255 | + break; |
|
256 | + } |
|
257 | + } |
|
258 | + } |
|
259 | + |
|
260 | + /** |
|
261 | 261 | * Routine to determine the browser type |
262 | 262 | */ |
263 | - protected function checkBrowser() { |
|
264 | - foreach ($this->browsers as $regex => $value) { |
|
265 | - if (preg_match($regex, $this->agent ) ) { |
|
266 | - $this->browserName = $value; |
|
267 | - break; |
|
268 | - } |
|
269 | - } |
|
270 | - } |
|
271 | - |
|
272 | - /** |
|
263 | + protected function checkBrowser() { |
|
264 | + foreach ($this->browsers as $regex => $value) { |
|
265 | + if (preg_match($regex, $this->agent ) ) { |
|
266 | + $this->browserName = $value; |
|
267 | + break; |
|
268 | + } |
|
269 | + } |
|
270 | + } |
|
271 | + |
|
272 | + /** |
|
273 | 273 | * Routine to determine the browser version |
274 | 274 | */ |
275 | - protected function checkBrowserVersion(){ |
|
276 | - $detected = $this->getBrowser(); |
|
277 | - $detect = array_search($detected, $this->browsers); |
|
278 | - $browser = str_replace(array('/i','/'), '', $detect); |
|
279 | - $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
|
280 | - if (preg_match_all($regex, $this->agent, $matches)) { |
|
281 | - $found = array_search($browser, $matches['browser']); |
|
282 | - $this->version = $matches['version'][$found]; |
|
283 | - } |
|
284 | - } |
|
285 | - |
|
286 | - /** |
|
275 | + protected function checkBrowserVersion(){ |
|
276 | + $detected = $this->getBrowser(); |
|
277 | + $detect = array_search($detected, $this->browsers); |
|
278 | + $browser = str_replace(array('/i','/'), '', $detect); |
|
279 | + $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
|
280 | + if (preg_match_all($regex, $this->agent, $matches)) { |
|
281 | + $found = array_search($browser, $matches['browser']); |
|
282 | + $this->version = $matches['version'][$found]; |
|
283 | + } |
|
284 | + } |
|
285 | + |
|
286 | + /** |
|
287 | 287 | * Determine if the browser is Mobile or not |
288 | 288 | */ |
289 | - protected function checkMobile() { |
|
290 | - if (preg_match('/(android|avantgo|blackberry|bolt|boost|cricket' |
|
289 | + protected function checkMobile() { |
|
290 | + if (preg_match('/(android|avantgo|blackberry|bolt|boost|cricket' |
|
291 | 291 | . '|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $this->agent) ) { |
292 | - $this->isMobile = true; |
|
293 | - } |
|
294 | - } |
|
292 | + $this->isMobile = true; |
|
293 | + } |
|
294 | + } |
|
295 | 295 | |
296 | - /** |
|
296 | + /** |
|
297 | 297 | * Determine if the browser is Tablet or not |
298 | 298 | */ |
299 | - protected function checkTablet() { |
|
300 | - if (preg_match('/tablet|ipad/i', $this->agent) ) { |
|
301 | - $this->isTablet = true; |
|
302 | - } |
|
303 | - } |
|
299 | + protected function checkTablet() { |
|
300 | + if (preg_match('/tablet|ipad/i', $this->agent) ) { |
|
301 | + $this->isTablet = true; |
|
302 | + } |
|
303 | + } |
|
304 | 304 | |
305 | - /** |
|
305 | + /** |
|
306 | 306 | * Determine if the browser is Robot or not |
307 | 307 | */ |
308 | - protected function checkBot() { |
|
309 | - if (preg_match('/bot/i', $this->agent) ) { |
|
310 | - $this->isRobot = true; |
|
311 | - } |
|
312 | - } |
|
308 | + protected function checkBot() { |
|
309 | + if (preg_match('/bot/i', $this->agent) ) { |
|
310 | + $this->isRobot = true; |
|
311 | + } |
|
312 | + } |
|
313 | 313 | |
314 | - /** |
|
314 | + /** |
|
315 | 315 | * Detect if URL is loaded from FacebookExternalHit |
316 | 316 | */ |
317 | 317 | protected function checkFacebook() { |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | |
327 | - /** |
|
328 | - * Protected routine to calculate and determine what |
|
329 | - * the browser is in use (including platform) |
|
330 | - */ |
|
327 | + /** |
|
328 | + * Protected routine to calculate and determine what |
|
329 | + * the browser is in use (including platform) |
|
330 | + */ |
|
331 | 331 | protected function determine() { |
332 | 332 | $this->checkPlatform(); |
333 | 333 | $this->checkBrowser(); |
@@ -338,4 +338,4 @@ discard block |
||
338 | 338 | $this->checkFacebook(); |
339 | 339 | } |
340 | 340 | |
341 | - } |
|
341 | + } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * Reset all properties |
145 | 145 | */ |
146 | 146 | public function reset() { |
147 | - $this->agent = get_instance()->globalvar->server('HTTP_USER_AGENT'); |
|
147 | + $this->agent = get_instance()->globalvar->server('HTTP_USER_AGENT'); |
|
148 | 148 | $this->browserName = 'unknown'; |
149 | 149 | $this->version = 'unknown'; |
150 | 150 | $this->platform = 'unknown'; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | protected function checkPlatform() { |
252 | 252 | foreach ($this->platforms as $regex => $value) { |
253 | - if (preg_match($regex, $this->agent) ) { |
|
253 | + if (preg_match($regex, $this->agent)) { |
|
254 | 254 | $this->platform = $value; |
255 | 255 | break; |
256 | 256 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | */ |
263 | 263 | protected function checkBrowser() { |
264 | 264 | foreach ($this->browsers as $regex => $value) { |
265 | - if (preg_match($regex, $this->agent ) ) { |
|
265 | + if (preg_match($regex, $this->agent)) { |
|
266 | 266 | $this->browserName = $value; |
267 | 267 | break; |
268 | 268 | } |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | /** |
273 | 273 | * Routine to determine the browser version |
274 | 274 | */ |
275 | - protected function checkBrowserVersion(){ |
|
275 | + protected function checkBrowserVersion() { |
|
276 | 276 | $detected = $this->getBrowser(); |
277 | 277 | $detect = array_search($detected, $this->browsers); |
278 | - $browser = str_replace(array('/i','/'), '', $detect); |
|
278 | + $browser = str_replace(array('/i', '/'), '', $detect); |
|
279 | 279 | $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
280 | 280 | if (preg_match_all($regex, $this->agent, $matches)) { |
281 | 281 | $found = array_search($browser, $matches['browser']); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | */ |
289 | 289 | protected function checkMobile() { |
290 | 290 | if (preg_match('/(android|avantgo|blackberry|bolt|boost|cricket' |
291 | - . '|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $this->agent) ) { |
|
291 | + . '|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $this->agent)) { |
|
292 | 292 | $this->isMobile = true; |
293 | 293 | } |
294 | 294 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * Determine if the browser is Tablet or not |
298 | 298 | */ |
299 | 299 | protected function checkTablet() { |
300 | - if (preg_match('/tablet|ipad/i', $this->agent) ) { |
|
300 | + if (preg_match('/tablet|ipad/i', $this->agent)) { |
|
301 | 301 | $this->isTablet = true; |
302 | 302 | } |
303 | 303 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * Determine if the browser is Robot or not |
307 | 307 | */ |
308 | 308 | protected function checkBot() { |
309 | - if (preg_match('/bot/i', $this->agent) ) { |
|
309 | + if (preg_match('/bot/i', $this->agent)) { |
|
310 | 310 | $this->isRobot = true; |
311 | 311 | } |
312 | 312 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | if (stristr($this->agent, 'FacebookExternalHit')) { |
319 | 319 | $this->isRobot = true; |
320 | 320 | $this->isFacebook = true; |
321 | - } else if (stristr($this->agent, 'FBIOS')) { |
|
321 | + } else if (stristr($this->agent, 'FBIOS')) { |
|
322 | 322 | $this->isFacebook = true; |
323 | 323 | } |
324 | 324 | } |
@@ -318,7 +318,7 @@ |
||
318 | 318 | if (stristr($this->agent, 'FacebookExternalHit')) { |
319 | 319 | $this->isRobot = true; |
320 | 320 | $this->isFacebook = true; |
321 | - } else if (stristr($this->agent, 'FBIOS')) { |
|
321 | + } else if (stristr($this->agent, 'FBIOS')) { |
|
322 | 322 | $this->isFacebook = true; |
323 | 323 | } |
324 | 324 | } |
@@ -79,7 +79,7 @@ |
||
79 | 79 | if ($cookieLang && $this->isValid($cookieLang)) { |
80 | 80 | $this->current = $cookieLang; |
81 | 81 | $this->logger->info('Language from cookie [' . $cfgKey . '] is valid so ' |
82 | - .'we will set the language using the cookie value [' . $cookieLang . ']'); |
|
82 | + .'we will set the language using the cookie value [' . $cookieLang . ']'); |
|
83 | 83 | } else { |
84 | 84 | $this->logger->info('Language from cookie [' . $cfgKey . '] is not set, use the default value [' . $this->getDefault() . ']'); |
85 | 85 | $this->current = $this->getDefault(); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $moduleConfigPath = get_instance()->module->findConfigFullPath($filename, $module); |
220 | 220 | if ($moduleConfigPath) { |
221 | 221 | $this->logger->info('Found config [' . $filename . '] from module [' . $module . '], ' |
222 | - . 'the file path is [' . $moduleConfigPath . '] we will used it'); |
|
222 | + . 'the file path is [' . $moduleConfigPath . '] we will used it'); |
|
223 | 223 | $configFilePath = $moduleConfigPath; |
224 | 224 | } else { |
225 | 225 | $this->logger->info('Cannot find config [' . $filename . '] from modules using the default location'); |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | $moduleLibraryPath = get_instance()->module->findLibraryFullPath($class, $module); |
480 | 480 | if ($moduleLibraryPath) { |
481 | 481 | $this->logger->info('Found library [' . $class . '] from module [' . $module . '], the ' |
482 | - . 'file path is [' . $moduleLibraryPath . '] we will used it'); |
|
482 | + . 'file path is [' . $moduleLibraryPath . '] we will used it'); |
|
483 | 483 | $libraryFilePath = $moduleLibraryPath; |
484 | 484 | } else { |
485 | 485 | $this->logger->info('Cannot find library [' . $class . '] from modules using the default location'); |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * @param string $appLang the application language, only if type = "language" |
336 | 336 | * @return string|null the full file path |
337 | 337 | */ |
338 | - protected function getDefaultFilePathForFunctionLanguage($file, $type, $appLang = null){ |
|
338 | + protected function getDefaultFilePathForFunctionLanguage($file, $type, $appLang = null) { |
|
339 | 339 | //Default to "function" |
340 | 340 | $searchDir = array(FUNCTIONS_PATH, CORE_FUNCTIONS_PATH); |
341 | 341 | if ($type == 'language') { |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @param string|null $module the module if is not null will return it |
360 | 360 | * @return string|null |
361 | 361 | */ |
362 | - protected function getModuleFromSuperController($module){ |
|
362 | + protected function getModuleFromSuperController($module) { |
|
363 | 363 | $obj = & get_instance(); |
364 | 364 | if (!$module && !empty($obj->moduleName)) { |
365 | 365 | $module = $obj->moduleName; |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | */ |
30 | 30 | |
31 | 31 | /** |
32 | - * DB session handler model class |
|
33 | - */ |
|
32 | + * DB session handler model class |
|
33 | + */ |
|
34 | 34 | abstract class DBSessionHandlerModel extends Model { |
35 | 35 | |
36 | 36 | /** |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @example |
42 | 42 | * array( |
43 | - * 'sid' => '', //VARCHAR(100) Note: this a primary key |
|
44 | - * 'sdata' => '', //TEXT |
|
45 | - * 'stime' => '', //unix timestamp (INT|BIGINT) |
|
46 | - * 'shost' => '', //VARCHAR(255) |
|
47 | - * 'sip' => '', //VARCHAR(128) |
|
48 | - * 'sbrowser' => '', //VARCHAR(255) |
|
49 | - * 'skey' => '' //VARCHAR(255) |
|
50 | - * ); |
|
43 | + * 'sid' => '', //VARCHAR(100) Note: this a primary key |
|
44 | + * 'sdata' => '', //TEXT |
|
45 | + * 'stime' => '', //unix timestamp (INT|BIGINT) |
|
46 | + * 'shost' => '', //VARCHAR(255) |
|
47 | + * 'sip' => '', //VARCHAR(128) |
|
48 | + * 'sbrowser' => '', //VARCHAR(255) |
|
49 | + * 'skey' => '' //VARCHAR(255) |
|
50 | + * ); |
|
51 | 51 | */ |
52 | 52 | protected $sessionTableColumns = array(); |
53 | 53 |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | if ($init) { |
47 | 47 | $this->init(); |
48 | 48 | //@codeCoverageIgnoreStart |
49 | - if (ENVIRONMENT == 'production' && in_array(strtolower($this->config['log_level']), array('debug', 'info', 'notice'))) { |
|
49 | + if (ENVIRONMENT == 'production' && in_array(strtolower($this->config['log_level']), array('debug', 'info', 'notice'))) { |
|
50 | 50 | $this->logger->warning('You are in production environment, please set ' |
51 | - . 'log level to WARNING, ERROR, CRITICAL, ALERT, EMERGENCY to increase the application performance'); |
|
51 | + . 'log level to WARNING, ERROR, CRITICAL, ALERT, EMERGENCY to increase the application performance'); |
|
52 | 52 | } |
53 | 53 | //@codeCoverageIgnoreEnd |
54 | 54 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | if (empty($this->config['base_url'])) { |
147 | 147 | if (ENVIRONMENT == 'production') { |
148 | 148 | $this->logger->warning('Application base URL is not set or invalid, please' |
149 | - . ' set application base URL to increase the application loading time'); |
|
149 | + . ' set application base URL to increase the application loading time'); |
|
150 | 150 | } |
151 | 151 | $baseUrl = null; |
152 | 152 | $protocol = 'http'; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | ); |
174 | 174 | } else { |
175 | 175 | $this->logger->warning('Can not determine the application ' |
176 | - . 'base URL automatically, use http://localhost as default'); |
|
176 | + . 'base URL automatically, use http://localhost as default'); |
|
177 | 177 | $baseUrl = 'http://localhost/'; |
178 | 178 | } |
179 | 179 | $this->config['base_url'] = $baseUrl; |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | - * Return the server port using variable |
|
186 | - * |
|
187 | - * @codeCoverageIgnore |
|
188 | - * @return string |
|
189 | - */ |
|
185 | + * Return the server port using variable |
|
186 | + * |
|
187 | + * @codeCoverageIgnore |
|
188 | + * @return string |
|
189 | + */ |
|
190 | 190 | protected function getServerPort() { |
191 | 191 | $globals = & class_loader('GlobalVar', 'classes'); |
192 | 192 | $serverPort = $globals->server('SERVER_PORT'); |
@@ -318,7 +318,7 @@ |
||
318 | 318 | * Get some parameters need like ip address, hostname, browser info, etc. |
319 | 319 | * @return array |
320 | 320 | */ |
321 | - protected function getSessionDataParams(){ |
|
321 | + protected function getSessionDataParams() { |
|
322 | 322 | $this->OBJ->loader->functions('user_agent'); |
323 | 323 | $this->OBJ->loader->library('Browser'); |
324 | 324 |
@@ -276,14 +276,14 @@ discard block |
||
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
279 | - * Setting the route configuration using the configuration file |
|
280 | - * and additional configuration from param |
|
281 | - * @param array $overwriteConfig the additional configuration |
|
282 | - * to overwrite with the existing one |
|
283 | - * @param boolean $useConfigFile whether to use route configuration file |
|
284 | - * |
|
285 | - * @return object |
|
286 | - */ |
|
279 | + * Setting the route configuration using the configuration file |
|
280 | + * and additional configuration from param |
|
281 | + * @param array $overwriteConfig the additional configuration |
|
282 | + * to overwrite with the existing one |
|
283 | + * @param boolean $useConfigFile whether to use route configuration file |
|
284 | + * |
|
285 | + * @return object |
|
286 | + */ |
|
287 | 287 | public function setRouteConfiguration(array $overwriteConfig = array(), $useConfigFile = true) { |
288 | 288 | $route = array(); |
289 | 289 | if ($useConfigFile && file_exists(CONFIG_PATH . 'routes.php')) { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | //the URL like http://domain.com/module/controller/method/arg1/arg2/argn |
365 | 365 | if (!$this->controller) { |
366 | 366 | $this->logger->info('Cannot determine the routing information ' |
367 | - . 'using the predefined routes configuration, will use the request URI parameters'); |
|
367 | + . 'using the predefined routes configuration, will use the request URI parameters'); |
|
368 | 368 | //determine route parameters using the route URI param |
369 | 369 | $this->determineRouteParamsFromRequestUri(); |
370 | 370 | } |
@@ -478,11 +478,11 @@ discard block |
||
478 | 478 | } |
479 | 479 | } |
480 | 480 | |
481 | - /** |
|
482 | - * Remove the URL suffix and query string values if exists |
|
483 | - * @param string $uri the route URI to process |
|
484 | - * @return string the final route uri after processed |
|
485 | - */ |
|
481 | + /** |
|
482 | + * Remove the URL suffix and query string values if exists |
|
483 | + * @param string $uri the route URI to process |
|
484 | + * @return string the final route uri after processed |
|
485 | + */ |
|
486 | 486 | protected function removeSuffixAndQueryStringFromUri($uri) { |
487 | 487 | $this->logger->debug('Check if URL suffix is enabled in the configuration'); |
488 | 488 | //remove url suffix from the request URI |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | $this->logger->info( |
599 | 599 | 'After loop in predefined routes configuration,' |
600 | 600 | . 'the module name is set but the controller is not set,' |
601 | - . 'so we will use module as the controller' |
|
601 | + . 'so we will use module as the controller' |
|
602 | 602 | ); |
603 | 603 | $this->controller = $this->module; |
604 | 604 | } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | * Remove the DOCUMENT_ROOT and front controller from segments if exists |
451 | 451 | * @return void |
452 | 452 | */ |
453 | - protected function removeDocumentRootFrontControllerFromSegments(){ |
|
453 | + protected function removeDocumentRootFrontControllerFromSegments() { |
|
454 | 454 | $segment = $this->segments; |
455 | 455 | $globals = & class_loader('GlobalVar', 'classes'); |
456 | 456 | $rootFolder = substr($globals->server('SCRIPT_NAME'), 0, strpos( |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | break; |
582 | 582 | } |
583 | 583 | } |
584 | - if($findIndex !== -1){ |
|
584 | + if ($findIndex !== -1) { |
|
585 | 585 | /* |
586 | 586 | * $args[0] => full string captured by preg_match |
587 | 587 | * $args[1], $args[2], $args[n] => contains the value of |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | * Find file path of the current controller using the current module |
609 | 609 | * @return boolean true if the file path is found otherwise false. |
610 | 610 | */ |
611 | - protected function findControllerFullPathUsingCurrentModule(){ |
|
611 | + protected function findControllerFullPathUsingCurrentModule() { |
|
612 | 612 | $path = $this->moduleInstance->findControllerFullPath(ucfirst($this->controller), $this->module); |
613 | 613 | if (!$path) { |
614 | 614 | $this->logger->info('The controller [' . $this->controller . '] not ' |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | * or the current request does not use module |
626 | 626 | * @return void |
627 | 627 | */ |
628 | - protected function setRouteParamsIfNoModuleOrNotFound(){ |
|
628 | + protected function setRouteParamsIfNoModuleOrNotFound() { |
|
629 | 629 | $segment = $this->segments; |
630 | 630 | //controller |
631 | 631 | if (isset($segment[0])) { |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * or the current request use module |
647 | 647 | * @return void |
648 | 648 | */ |
649 | - protected function setRouteParamsIfAppHasModuleOrFound(){ |
|
649 | + protected function setRouteParamsIfAppHasModuleOrFound() { |
|
650 | 650 | //get the module list |
651 | 651 | $modules = $this->moduleInstance->getModuleList(); |
652 | 652 | $segment = $this->segments; |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | if (isset($segment[0])) { |
659 | 659 | $this->controller = $segment[0]; |
660 | 660 | //check if the request use the same module name and controller |
661 | - if($this->findControllerFullPathUsingCurrentModule()){ |
|
661 | + if ($this->findControllerFullPathUsingCurrentModule()) { |
|
662 | 662 | array_shift($segment); |
663 | 663 | } |
664 | 664 | } |