@@ -133,7 +133,7 @@ |
||
133 | 133 | $token = self::encode(hash_hmac('sha256', ClientIp::getIp($request), base64_decode($token), true)); |
134 | 134 | |
135 | 135 | return '<input type="hidden" name="'.$this->formIndex.'" value="'.htmlentities($index, ENT_QUOTES, 'UTF-8').'">' |
136 | - .'<input type="hidden" name="'.$this->formToken.'" value="'.htmlentities($token, ENT_QUOTES, 'UTF-8').'">'; |
|
136 | + .'<input type="hidden" name="'.$this->formToken.'" value="'.htmlentities($token, ENT_QUOTES, 'UTF-8').'">'; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | return $response->withStatus(403); |
76 | 76 | } |
77 | 77 | |
78 | - $generator = function ($action = null) use ($request, &$tokens) { |
|
78 | + $generator = function($action = null) use ($request, &$tokens) { |
|
79 | 79 | if (empty($action)) { |
80 | 80 | $action = $request->getUri()->getPath(); |
81 | 81 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $response = $next($request, $response); |
93 | 93 | |
94 | - return $this->insertIntoPostForms($response, function ($match) use ($generator) { |
|
94 | + return $this->insertIntoPostForms($response, function($match) use ($generator) { |
|
95 | 95 | preg_match('/action=["\']?([^"\'\s]+)["\']?/i', $match[0], $matches); |
96 | 96 | |
97 | 97 | return $match[0].$generator(isset($matches[1]) ? $matches[1] : null); |
@@ -91,7 +91,7 @@ |
||
91 | 91 | $path = $this->getPath($uri->getPath()); |
92 | 92 | $request = $request->withUri($uri->withPath($path)); |
93 | 93 | |
94 | - $generator = function ($path) { |
|
94 | + $generator = function($path) { |
|
95 | 95 | return Utils\Helpers::joinPath($this->basePath, $path); |
96 | 96 | }; |
97 | 97 |
@@ -113,13 +113,13 @@ |
||
113 | 113 | |
114 | 114 | $value = $this->encrypt(time()); |
115 | 115 | |
116 | - $generator = function () use ($value) { |
|
116 | + $generator = function() use ($value) { |
|
117 | 117 | return '<input type="hidden" name="'.$this->inputName.'" value="'.$value.'">'; |
118 | 118 | }; |
119 | 119 | |
120 | 120 | $response = $next($request, $response); |
121 | 121 | |
122 | - return $this->insertIntoPostForms($response, function ($match) use ($generator) { |
|
122 | + return $this->insertIntoPostForms($response, function($match) use ($generator) { |
|
123 | 123 | return $match[0].$generator(); |
124 | 124 | }); |
125 | 125 | } |
@@ -90,13 +90,13 @@ |
||
90 | 90 | return $response->withStatus(403); |
91 | 91 | } |
92 | 92 | |
93 | - $generator = function () { |
|
93 | + $generator = function() { |
|
94 | 94 | return '<input type="text" name="'.$this->inputName.'" class="'.$this->inputClass.'">'; |
95 | 95 | }; |
96 | 96 | |
97 | 97 | $response = $next($request, $response); |
98 | 98 | |
99 | - return $this->insertIntoPostForms($response, function ($match) use ($generator) { |
|
99 | + return $this->insertIntoPostForms($response, function($match) use ($generator) { |
|
100 | 100 | return $match[0].$generator(); |
101 | 101 | }); |
102 | 102 | } |
@@ -79,7 +79,7 @@ |
||
79 | 79 | * @param callable|string $basePath The base path in which the middleware is created (optional) |
80 | 80 | * @param callable $factory Takes no argument and MUST return a middleware callable or false |
81 | 81 | * |
82 | - * @return callable |
|
82 | + * @return \Closure |
|
83 | 83 | */ |
84 | 84 | public static function create($basePath, callable $factory = null) |
85 | 85 | { |
@@ -92,7 +92,7 @@ |
||
92 | 92 | throw new InvalidArgumentException('Invalid callable provided'); |
93 | 93 | } |
94 | 94 | |
95 | - return function (RequestInterface $request, ResponseInterface $response, callable $next) use ($basePath, $factory) { |
|
95 | + return function(RequestInterface $request, ResponseInterface $response, callable $next) use ($basePath, $factory) { |
|
96 | 96 | $path = rtrim($request->getUri()->getPath(), '/'); |
97 | 97 | $basePath = rtrim($basePath, '/'); |
98 | 98 |
@@ -141,7 +141,7 @@ |
||
141 | 141 | return $response; |
142 | 142 | |
143 | 143 | case 'text/html': |
144 | - $generator = function ($path, $transform) { |
|
144 | + $generator = function($path, $transform) { |
|
145 | 145 | $info = pathinfo($path); |
146 | 146 | |
147 | 147 | if (!isset($this->sizes[$transform])) { |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | public function __construct($spammers = null) |
18 | 18 | { |
19 | 19 | if ($spammers === null) { |
20 | - if ( file_exists( ' __DIR__.'/../../../../vendor/piwik/referrer-spam-blacklist/spammers.txt' ) ) { |
|
21 | - $spammers = __DIR__.'/../../../../vendor/piwik/referrer-spam-blacklist/spammers.txt'; |
|
22 | - } else if ( file_exists( __DIR__.'/../../../../piwik/referrer-spam-blacklist/spammers.txt' ) ) { |
|
23 | - $spammers = __DIR__.'/../../../../piwik/referrer-spam-blacklist/spammers.txt'; |
|
20 | + if (file_exists(' __DIR__.' / ../.. / ../.. / vendor / piwik / referrer - spam - blacklist / spammers.txt' ) ) { |
|
21 | + $spammers = __DIR__.'/.. / ../.. / ../vendor / piwik / referrer - spam - blacklist / spammers.txt'; |
|
22 | + } else if ( file_exists( __DIR__.'/.. / ../.. / ../piwik / referrer - spam - blacklist / spammers.txt' ) ) { |
|
23 | + $spammers = __DIR__.'/.. / ../.. / ../piwik / referrer - spam - blacklist / spammers.txt'; |
|
24 | 24 | } else { |
25 | 25 | $spammers = null; |
26 | 26 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | $referer = parse_url($request->getHeaderLine('Referer'), PHP_URL_HOST); |
52 | - $referer = preg_replace('/^(www\.)/i', '', $referer); |
|
52 | + $referer = preg_replace('/ ^ (www\.) / i', '', $referer); |
|
53 | 53 | |
54 | 54 | if (in_array($referer, $this->list, true)) { |
55 | 55 | return $response->withStatus(403); |