@@ -316,15 +316,15 @@ discard block |
||
316 | 316 | return $this; |
317 | 317 | } |
318 | 318 | |
319 | - /** |
|
320 | - * Append a mime type to allowed mime types |
|
321 | - * |
|
322 | - * @since 1.0 |
|
323 | - * @version 1.0.1 |
|
324 | - * @param string $mime |
|
325 | - * @return object |
|
326 | - * @method boolean setAllowMimeType |
|
327 | - */ |
|
319 | + /** |
|
320 | + * Append a mime type to allowed mime types |
|
321 | + * |
|
322 | + * @since 1.0 |
|
323 | + * @version 1.0.1 |
|
324 | + * @param string $mime |
|
325 | + * @return object |
|
326 | + * @method boolean setAllowMimeType |
|
327 | + */ |
|
328 | 328 | public function setAllowMimeType($mime) { |
329 | 329 | $this->allowedMimeTypes[] = strtolower($mime); |
330 | 330 | $this->file['allowed_mime_types'][] = strtolower($mime); |
@@ -438,10 +438,10 @@ discard block |
||
438 | 438 | return $this; |
439 | 439 | } |
440 | 440 | |
441 | - /** |
|
442 | - * Get the allow overwriting |
|
443 | - * @return boolean |
|
444 | - */ |
|
441 | + /** |
|
442 | + * Get the allow overwriting |
|
443 | + * @return boolean |
|
444 | + */ |
|
445 | 445 | public function isAllowOverwriting() { |
446 | 446 | return $this->overwriteFile ; |
447 | 447 | } |
@@ -532,14 +532,14 @@ discard block |
||
532 | 532 | return $this->error; |
533 | 533 | } |
534 | 534 | |
535 | - /** |
|
536 | - * Retrive status of upload |
|
537 | - * |
|
538 | - * @since 1.0 |
|
539 | - * @version 1.0 |
|
540 | - * @return boolean |
|
541 | - * @method boolean getStatus |
|
542 | - */ |
|
535 | + /** |
|
536 | + * Retrive status of upload |
|
537 | + * |
|
538 | + * @since 1.0 |
|
539 | + * @version 1.0 |
|
540 | + * @return boolean |
|
541 | + * @method boolean getStatus |
|
542 | + */ |
|
543 | 543 | public function getStatus() { |
544 | 544 | return $this->file['status']; |
545 | 545 | } |
@@ -572,11 +572,11 @@ discard block |
||
572 | 572 | && is_file($file); |
573 | 573 | } |
574 | 574 | |
575 | - /** |
|
576 | - * Set the filename if is empty using the uploaded data information |
|
577 | - * |
|
578 | - * @return object the current instance |
|
579 | - */ |
|
575 | + /** |
|
576 | + * Set the filename if is empty using the uploaded data information |
|
577 | + * |
|
578 | + * @return object the current instance |
|
579 | + */ |
|
580 | 580 | protected function setFilenameUsingUploadedData() { |
581 | 581 | // set original filename if not have a new name |
582 | 582 | if (empty($this->filename)) { |
@@ -660,12 +660,12 @@ discard block |
||
660 | 660 | return $this->maxFileSize >= $size; |
661 | 661 | } |
662 | 662 | |
663 | - /** |
|
664 | - * Check the file overwritting |
|
665 | - * @since 1.0 |
|
666 | - * @version 1.0 |
|
667 | - * @return boolean |
|
668 | - */ |
|
663 | + /** |
|
664 | + * Check the file overwritting |
|
665 | + * @since 1.0 |
|
666 | + * @version 1.0 |
|
667 | + * @return boolean |
|
668 | + */ |
|
669 | 669 | protected function checkFileOverwritting() { |
670 | 670 | if ($this->fileExists($this->destinationDirectory . $this->filename)) { |
671 | 671 | return $this->overwriteFile; |
@@ -443,7 +443,7 @@ |
||
443 | 443 | * @return boolean |
444 | 444 | */ |
445 | 445 | public function isAllowOverwriting() { |
446 | - return $this->overwriteFile ; |
|
446 | + return $this->overwriteFile; |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $addresses = array(); |
348 | 348 | foreach ($pairs as $name => $email) { |
349 | 349 | if (is_numeric($name)) { |
350 | - $name = null; |
|
350 | + $name = null; |
|
351 | 351 | } |
352 | 352 | $addresses[] = $this->formatHeader($email, $name); |
353 | 353 | } |
@@ -738,10 +738,10 @@ discard block |
||
738 | 738 | return $headers; |
739 | 739 | } |
740 | 740 | |
741 | - /** |
|
742 | - * Get the attachment message for send or the simple message |
|
743 | - * @return string |
|
744 | - */ |
|
741 | + /** |
|
742 | + * Get the attachment message for send or the simple message |
|
743 | + * @return string |
|
744 | + */ |
|
745 | 745 | protected function getMessageWithAttachmentForSend() { |
746 | 746 | $message = wordwrap($this->message, $this->wrap); |
747 | 747 | if ($this->hasAttachments()) { |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | */ |
772 | 772 | protected function sendHelloCommand() { |
773 | 773 | $responseCode = $this->sendCommand('EHLO ' . $this->getSmtpClientHostname()) |
774 | - ->getSmtpResponseCode(); |
|
774 | + ->getSmtpResponseCode(); |
|
775 | 775 | if ($responseCode !== 250) { |
776 | 776 | $this->error = $this->smtpResponse; |
777 | 777 | return false; |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | $message = $this->getMessageWithAttachmentForSend(); |
919 | 919 | $headers = $this->getHeadersForSend(); |
920 | 920 | $this->logger->info('Sending new mail using mail protocol, the information are listed below: ' |
921 | - . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
921 | + . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
922 | 922 | $result = mail($to, $this->subject, $message, $headers, $this->params); |
923 | 923 | if (!$result) { |
924 | 924 | $this->error = 'Error when sending mail using mail protocol'; |
@@ -926,10 +926,10 @@ discard block |
||
926 | 926 | return $result; |
927 | 927 | } |
928 | 928 | |
929 | - /** |
|
930 | - * Send mail using "smtp" protocol |
|
931 | - * @return boolean |
|
932 | - */ |
|
929 | + /** |
|
930 | + * Send mail using "smtp" protocol |
|
931 | + * @return boolean |
|
932 | + */ |
|
933 | 933 | protected function sendSmtp() { |
934 | 934 | if (!$this->smtpConnection()) { |
935 | 935 | return false; |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | $message = $this->getMessageWithAttachmentForSend(); |
940 | 940 | $headers = $this->getHeadersForSend(); |
941 | 941 | $this->logger->info('Sending new mail using SMTP protocol, the information are listed below: ' |
942 | - . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
942 | + . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
943 | 943 | $recipients = array_merge($this->to, $this->cc, $this->bcc); |
944 | 944 | $commands = array( |
945 | 945 | 'mail_from' => array('MAIL FROM: <' . $this->from . '>', 'MAIL_FROM', 250), |
@@ -990,17 +990,17 @@ discard block |
||
990 | 990 | } |
991 | 991 | |
992 | 992 | |
993 | - /** |
|
994 | - * Return the client hostname for SMTP |
|
995 | - * |
|
996 | - * There are only two legal types of hostname - either a fully |
|
997 | - * qualified domain name (eg: "mail.example.com") or an IP literal |
|
998 | - * (eg: "[1.2.3.4]"). |
|
999 | - * |
|
1000 | - * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 |
|
1001 | - * @link http://cbl.abuseat.org/namingproblems.html |
|
1002 | - * @return string |
|
1003 | - */ |
|
993 | + /** |
|
994 | + * Return the client hostname for SMTP |
|
995 | + * |
|
996 | + * There are only two legal types of hostname - either a fully |
|
997 | + * qualified domain name (eg: "mail.example.com") or an IP literal |
|
998 | + * (eg: "[1.2.3.4]"). |
|
999 | + * |
|
1000 | + * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 |
|
1001 | + * @link http://cbl.abuseat.org/namingproblems.html |
|
1002 | + * @return string |
|
1003 | + */ |
|
1004 | 1004 | protected function getSmtpClientHostname() { |
1005 | 1005 | $globals = &class_loader('GlobalVar', 'classes'); |
1006 | 1006 | if ($globals->server('SERVER_NAME')) { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * SOFTWARE. |
29 | 29 | */ |
30 | 30 | |
31 | - class Email extends BaseClass{ |
|
31 | + class Email extends BaseClass { |
|
32 | 32 | /** |
33 | 33 | * @var int $wrap |
34 | 34 | */ |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | $message = wordwrap($this->message, $this->wrap); |
747 | 747 | if ($this->hasAttachments()) { |
748 | 748 | $this->setAttachmentHeaders(); |
749 | - $message = $this->assembleAttachmentBody(); |
|
749 | + $message = $this->assembleAttachmentBody(); |
|
750 | 750 | } |
751 | 751 | return $message; |
752 | 752 | } |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | $this->smtpConfig['connection_timeout'] |
827 | 827 | ); |
828 | 828 | |
829 | - if (! is_resource($this->smtpSocket)) { |
|
829 | + if (!is_resource($this->smtpSocket)) { |
|
830 | 830 | $this->error = $errorNumber . ': ' . $errorMessage; |
831 | 831 | return false; |
832 | 832 | } |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | */ |
876 | 876 | if (is_resource($this->smtpSocket)) { |
877 | 877 | $method = STREAM_CRYPTO_METHOD_TLS_CLIENT; |
878 | - if(version_compare(PHP_VERSION, '5.6', '>=')) { |
|
878 | + if (version_compare(PHP_VERSION, '5.6', '>=')) { |
|
879 | 879 | $method = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; |
880 | 880 | } |
881 | 881 | stream_socket_enable_crypto($this->smtpSocket, true, $method); |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | 'To' => $to |
984 | 984 | ); |
985 | 985 | foreach ($additionalHeaders as $key => $value) { |
986 | - if (! isset($this->headers[$key])) { |
|
986 | + if (!isset($this->headers[$key])) { |
|
987 | 987 | $this->headers[$key] = $value; |
988 | 988 | } |
989 | 989 | } |
@@ -99,7 +99,7 @@ |
||
99 | 99 | * @return object the current instance |
100 | 100 | */ |
101 | 101 | public function setFilename($filename) { |
102 | - if(stripos($filename, '.pdf') === false) { |
|
102 | + if (stripos($filename, '.pdf') === false) { |
|
103 | 103 | $filename .= '.pdf'; |
104 | 104 | } |
105 | 105 | $this->filename = $filename; |
@@ -104,11 +104,11 @@ |
||
104 | 104 | * @return object the current instance |
105 | 105 | */ |
106 | 106 | public function render() { |
107 | - $this->dompdf->loadHtml($this->html); |
|
108 | - $this->dompdf->setPaper($this->paper, $this->orientation); |
|
109 | - $this->dompdf->render(); |
|
110 | - $this->rendered = true; |
|
111 | - return $this; |
|
107 | + $this->dompdf->loadHtml($this->html); |
|
108 | + $this->dompdf->setPaper($this->paper, $this->orientation); |
|
109 | + $this->dompdf->render(); |
|
110 | + $this->rendered = true; |
|
111 | + return $this; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -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) { |
@@ -522,8 +522,7 @@ |
||
522 | 522 | if(is_array($callback) && count($callback) > 0){ |
523 | 523 | if(array_key_exists($this->requestMethod, $callback)){ |
524 | 524 | $callback = $callback[$this->requestMethod]; |
525 | - } |
|
526 | - else{ |
|
525 | + } else{ |
|
527 | 526 | //Wrong request method |
528 | 527 | $this->logger->warning('The request method [' . $this->requestMethod . '] is not allowed'); |
529 | 528 | $this->routeMethodMatch = false; |
@@ -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 | } |
@@ -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 | } |