@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | {
|
| 74 | 74 | if (config()->has('captcha'))
|
| 75 | 75 | {
|
| 76 | - foreach(config('captcha') as $key => $value)
|
|
| 76 | + foreach (config('captcha') as $key => $value)
|
|
| 77 | 77 | {
|
| 78 | 78 | $key = camel_case($key); |
| 79 | 79 | $this->{$key} = $value;
|
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | {
|
| 95 | 95 | $alphaNumeric = array_merge(range('A', 'Z'), range('a', 'z'), range(0, 9));
|
| 96 | 96 | $text = ''; |
| 97 | - for ($i=0; $i < $this->length; $i++) {
|
|
| 98 | - $text .= $alphaNumeric[rand(0, count($alphaNumeric) -1)]; |
|
| 97 | + for ($i = 0; $i < $this->length; $i++) {
|
|
| 98 | + $text .= $alphaNumeric[rand(0, count($alphaNumeric)-1)]; |
|
| 99 | 99 | } |
| 100 | 100 | //put captcha code into session |
| 101 | 101 | session(['captcha' => $text]); |
@@ -111,14 +111,14 @@ discard block |
||
| 111 | 111 | protected function hex2rgb() {
|
| 112 | 112 | $hex = str_replace("#", "", $this->fontColor);
|
| 113 | 113 | |
| 114 | - if(strlen($hex) == 3) {
|
|
| 115 | - $r = hexdec(substr($hex,0,1).substr($hex,0,1)); |
|
| 116 | - $g = hexdec(substr($hex,1,1).substr($hex,1,1)); |
|
| 117 | - $b = hexdec(substr($hex,2,1).substr($hex,2,1)); |
|
| 114 | + if (strlen($hex) == 3) {
|
|
| 115 | + $r = hexdec(substr($hex, 0, 1).substr($hex, 0, 1)); |
|
| 116 | + $g = hexdec(substr($hex, 1, 1).substr($hex, 1, 1)); |
|
| 117 | + $b = hexdec(substr($hex, 2, 1).substr($hex, 2, 1)); |
|
| 118 | 118 | } else {
|
| 119 | - $r = hexdec(substr($hex,0,2)); |
|
| 120 | - $g = hexdec(substr($hex,2,2)); |
|
| 121 | - $b = hexdec(substr($hex,4,2)); |
|
| 119 | + $r = hexdec(substr($hex, 0, 2)); |
|
| 120 | + $g = hexdec(substr($hex, 2, 2)); |
|
| 121 | + $b = hexdec(substr($hex, 4, 2)); |
|
| 122 | 122 | } |
| 123 | 123 | $rgb = array($r, $g, $b); |
| 124 | 124 | //return implode(",", $rgb); // returns the rgb values separated by commas
|
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $this->configure(); |
| 134 | 134 | |
| 135 | 135 | imagefilledrectangle($this->img, 0, 0, $this->width, $this->height, $this->backColor); |
| 136 | - imagettftext ($this->img, $this->size, -5, 10, 40, $this->fontColor, $this->font, $this->randomText()); |
|
| 136 | + imagettftext($this->img, $this->size, -5, 10, 40, $this->fontColor, $this->font, $this->randomText()); |
|
| 137 | 137 | header("Content-type: image/png");
|
| 138 | 138 | imagepng($this->img); |
| 139 | 139 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function img() |
| 147 | 147 | {
|
| 148 | - return '<img src="' . $this->src() . '" alt="captcha">'; |
|
| 148 | + return '<img src="'.$this->src().'" alt="captcha">'; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | (config('captcha.sensitive') && $input == $code)
|
| 166 | 166 | || (strtolower($input) == strtolower($code)) |
| 167 | 167 | ) {
|
| 168 | - $response = true; |
|
| 168 | + $response = true; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | return $response; |
@@ -178,6 +178,6 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public function src() |
| 180 | 180 | {
|
| 181 | - return url('captcha') . '?' . str_random(8);
|
|
| 181 | + return url('captcha').'?'.str_random(8);
|
|
| 182 | 182 | } |
| 183 | 183 | } |