@@ -15,7 +15,7 @@ |
||
15 | 15 | base_path('vendor/mews/captcha/config/captcha.php') => config_path('captcha.php'), |
16 | 16 | ], 'config'); |
17 | 17 | |
18 | - $this->app['validator']->extend('captcha', function ($attribute, $value, $parameters) { |
|
18 | + $this->app[ 'validator' ]->extend('captcha', function($attribute, $value, $parameters) { |
|
19 | 19 | return captcha_check($value); |
20 | 20 | }); |
21 | 21 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function register() |
15 | 15 | { |
16 | - if (! $this->app->configurationIsCached()) { |
|
16 | + if (!$this->app->configurationIsCached()) { |
|
17 | 17 | $this->configureDefaults(); |
18 | 18 | } |
19 | 19 | |
@@ -27,20 +27,20 @@ discard block |
||
27 | 27 | */ |
28 | 28 | protected function configureDefaults() |
29 | 29 | { |
30 | - $config = $this->app['config']; |
|
30 | + $config = $this->app[ 'config' ]; |
|
31 | 31 | |
32 | 32 | // Append "app.domains" |
33 | - $config['app.domains'] = array_map(function ($value) { |
|
33 | + $config[ 'app.domains' ] = array_map(function($value) { |
|
34 | 34 | if (is_string($domain = parse_url($value, PHP_URL_HOST))) { |
35 | 35 | if (str_contains($domain, '.')) { |
36 | 36 | return $domain; |
37 | 37 | } |
38 | 38 | } |
39 | - }, $config['support.url']); |
|
39 | + }, $config[ 'support.url' ]); |
|
40 | 40 | |
41 | 41 | // Set "mail.from.name" |
42 | - if ($config['mail.from.name'] == 'Example') { |
|
43 | - $config['mail.from.name'] = $config['app.name']; |
|
42 | + if ($config[ 'mail.from.name' ] == 'Example') { |
|
43 | + $config[ 'mail.from.name' ] = $config[ 'app.name' ]; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function configureForCurrentRequest() |
51 | 51 | { |
52 | - $config = $this->app['config']; |
|
53 | - $request = $this->app['request']; |
|
52 | + $config = $this->app[ 'config' ]; |
|
53 | + $request = $this->app[ 'request' ]; |
|
54 | 54 | |
55 | - $identifier = array_search($request->getHost(), $config['app.domains']); |
|
55 | + $identifier = array_search($request->getHost(), $config[ 'app.domains' ]); |
|
56 | 56 | |
57 | 57 | // Configure the cookie domain |
58 | 58 | if ($identifier && $config->has('support.cookie_domain.'.$identifier)) { |
59 | - $config['session.domain'] = $config['support.cookie_domain.'.$identifier]; |
|
59 | + $config[ 'session.domain' ] = $config[ 'support.cookie_domain.'.$identifier ]; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Configure the auth defaults |
63 | - if ($identifier && is_array($auth = $config['support.auth.'.$identifier])) { |
|
64 | - $config['auth.defaults'] = $auth; |
|
63 | + if ($identifier && is_array($auth = $config[ 'support.auth.'.$identifier ])) { |
|
64 | + $config[ 'auth.defaults' ] = $auth; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | $inputs = $request->input(); |
21 | 21 | |
22 | - array_walk_recursive($inputs, function (&$value) { |
|
22 | + array_walk_recursive($inputs, function(&$value) { |
|
23 | 23 | $value = trim($value); |
24 | 24 | }); |
25 | 25 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $extension = ExtensionGuesser::getInstance()->guess($mimeType); |
41 | 41 | |
42 | - if (! is_null($extension)) { |
|
42 | + if (!is_null($extension)) { |
|
43 | 43 | if ('jpeg' == $extension) { |
44 | 44 | $extension = 'jpg'; |
45 | 45 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | ]; |
143 | 143 | } |
144 | 144 | |
145 | - return isset($iDeviceModels[$platform]) ? $iDeviceModels[$platform] : $platform; |
|
145 | + return isset($iDeviceModels[ $platform ]) ? $iDeviceModels[ $platform ] : $platform; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | 'vip.sina.com' => 'http://mail.sina.com.cn', |
167 | 167 | ]; |
168 | 168 | |
169 | - $domain = strtolower($match[1]); |
|
169 | + $domain = strtolower($match[ 1 ]); |
|
170 | 170 | |
171 | - return isset($list[$domain]) ? $list[$domain] : 'http://mail.'.$domain; |
|
171 | + return isset($list[ $domain ]) ? $list[ $domain ] : 'http://mail.'.$domain; |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $random = str_random(strlen($text)); |
191 | 191 | |
192 | 192 | // 按字符拼接:随机字符串 + 随机字符串异或原文 |
193 | - $tmp = static::sampleEncryption($text, $random, function ($a, $b) { |
|
193 | + $tmp = static::sampleEncryption($text, $random, function($a, $b) { |
|
194 | 194 | return $b.($a ^ $b); |
195 | 195 | }); |
196 | 196 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $tmpLength = strlen($tmp); |
218 | 218 | $result = ''; |
219 | 219 | for ($i = 0; $i < $tmpLength, ($i + 1) < $tmpLength; $i += 2) { |
220 | - $result .= $tmp[$i] ^ $tmp[$i + 1]; |
|
220 | + $result .= $tmp[ $i ] ^ $tmp[ $i + 1 ]; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | return $result; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $key = (string) $key; |
243 | 243 | $keyLength = strlen($key); |
244 | 244 | if (is_null($callback)) { |
245 | - $callback = function ($a, $b) { |
|
245 | + $callback = function($a, $b) { |
|
246 | 246 | return $a ^ $b; |
247 | 247 | }; |
248 | 248 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $result = ''; |
251 | 251 | $textLength = strlen($text); |
252 | 252 | for ($i = 0; $i < $textLength; $i++) { |
253 | - $tmp = $callback($text[$i], $key[$i % $keyLength], $i); |
|
253 | + $tmp = $callback($text[ $i ], $key[ $i % $keyLength ], $i); |
|
254 | 254 | if (false === $tmp) { |
255 | 255 | break; |
256 | 256 | } |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | while ($number >= $charactersLength) { |
286 | 286 | $mod = (int) bcmod($number, $charactersLength); |
287 | 287 | $number = (int) bcdiv($number, $charactersLength); |
288 | - $string = $characters[$mod].$string; |
|
288 | + $string = $characters[ $mod ].$string; |
|
289 | 289 | } |
290 | 290 | |
291 | - return $characters[$number].$string; |
|
291 | + return $characters[ $number ].$string; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | $number = 0; |
312 | 312 | for ($i = 0; $i < $stringLength; $i++) { |
313 | - $index = strpos($characters, $string[$i]); |
|
313 | + $index = strpos($characters, $string[ $i ]); |
|
314 | 314 | $number = (int) bcadd($number, bcmul($index, bcpow($charactersLength, $i))); |
315 | 315 | } |
316 | 316 |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Ramsey\Uuid\Uuid; |
4 | 4 | |
5 | -if (! function_exists('is_domain')) { |
|
5 | +if (!function_exists('is_domain')) { |
|
6 | 6 | /** |
7 | 7 | * Determines the current domain equals to the given domain identifier. |
8 | 8 | * |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | } |
16 | 16 | } |
17 | 17 | |
18 | -if (! function_exists('app_url')) { |
|
18 | +if (!function_exists('app_url')) { |
|
19 | 19 | /** |
20 | 20 | * Generate an URL for the application. |
21 | 21 | * |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | function app_url($path = '', $parameters = null, $identifier = 'site') |
28 | 28 | { |
29 | 29 | $path = trim($path, '/'); |
30 | - if (! empty($path) && ! starts_with($path, ['?', '&', '#'])) { |
|
30 | + if (!empty($path) && !starts_with($path, [ '?', '&', '#' ])) { |
|
31 | 31 | $path = '/'.$path; |
32 | 32 | } |
33 | 33 | |
34 | - if (! is_null($parameters)) { |
|
34 | + if (!is_null($parameters)) { |
|
35 | 35 | $query = http_build_query($parameters); |
36 | - if (! empty($query)) { |
|
37 | - $path .= (str_contains($path, ['?', '&', '#']) ? '&' : '?').$query; |
|
36 | + if (!empty($query)) { |
|
37 | + $path .= (str_contains($path, [ '?', '&', '#' ]) ? '&' : '?').$query; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | -if (! function_exists('revision')) { |
|
49 | +if (!function_exists('revision')) { |
|
50 | 50 | /** |
51 | 51 | * Get the revisioned asset path. |
52 | 52 | * |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | -if (! function_exists('asset_url')) { |
|
66 | +if (!function_exists('asset_url')) { |
|
67 | 67 | /** |
68 | 68 | * Generate an asset URL. |
69 | 69 | * |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | -if (! function_exists('cdn_url')) { |
|
83 | +if (!function_exists('cdn_url')) { |
|
84 | 84 | /** |
85 | 85 | * Generate an asset CDN URL. |
86 | 86 | * |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | -if (! function_exists('gravatar')) { |
|
96 | +if (!function_exists('gravatar')) { |
|
97 | 97 | /** |
98 | 98 | * Generate a Gravatar url. |
99 | 99 | * |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | -if (! function_exists('optimus_encode')) { |
|
126 | +if (!function_exists('optimus_encode')) { |
|
127 | 127 | /** |
128 | 128 | * Encode a number with Optimus. |
129 | 129 | * |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | -if (! function_exists('optimus_decode')) { |
|
139 | +if (!function_exists('optimus_decode')) { |
|
140 | 140 | /** |
141 | 141 | * Decode a number with Optimus. |
142 | 142 | * |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | -if (! function_exists('random_uuid')) { |
|
152 | +if (!function_exists('random_uuid')) { |
|
153 | 153 | /** |
154 | 154 | * Generate a version 4 (random) UUID. |
155 | 155 | * |