@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $controller = $routes->getDefaultController(); |
173 | 173 | } |
174 | 174 | |
175 | - if (! $fullName && is_string($controller)) { |
|
175 | + if (!$fullName && is_string($controller)) { |
|
176 | 176 | $controller = str_replace($routes->getDefaultNamespace(), '', $controller); |
177 | 177 | } |
178 | 178 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | require_once $routes_file; |
274 | 274 | } |
275 | 275 | } |
276 | - if (empty($routes) || ! ($routes instanceof RouteCollection)) { |
|
276 | + if (empty($routes) || !($routes instanceof RouteCollection)) { |
|
277 | 277 | $routes = Services::routes(); |
278 | 278 | } |
279 | 279 | |
@@ -283,14 +283,14 @@ discard block |
||
283 | 283 | $routeMiddlewares = (array) $this->dispatchRoutes($routes); |
284 | 284 | |
285 | 285 | // The bootstrapping in a middleware |
286 | - $this->middleware->append(function (ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
286 | + $this->middleware->append(function(ServerRequestInterface $request, ResponseInterface $response, callable $next): ResponseInterface { |
|
287 | 287 | $returned = $this->startController($request, $response); |
288 | 288 | |
289 | 289 | // Closure controller has run in startController(). |
290 | - if (! is_callable($this->controller)) { |
|
290 | + if (!is_callable($this->controller)) { |
|
291 | 291 | $controller = $this->createController($request, $response); |
292 | 292 | |
293 | - if (! method_exists($controller, '_remap') && ! is_callable([$controller, $this->method], false)) { |
|
293 | + if (!method_exists($controller, '_remap') && !is_callable([$controller, $this->method], false)) { |
|
294 | 294 | throw PageNotFoundException::methodNotFound($this->method); |
295 | 295 | } |
296 | 296 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | */ |
329 | 329 | $this->gatherOutput($this->middleware->handle($this->request)); |
330 | 330 | |
331 | - if (! $returnResponse) { |
|
331 | + if (!$returnResponse) { |
|
332 | 332 | $this->sendResponse(); |
333 | 333 | } |
334 | 334 | |
@@ -376,14 +376,14 @@ discard block |
||
376 | 376 | return; |
377 | 377 | } |
378 | 378 | |
379 | - if (is_cli() && ! on_test()) { |
|
379 | + if (is_cli() && !on_test()) { |
|
380 | 380 | // @codeCoverageIgnoreStart |
381 | 381 | // $this->request = Services::clirequest($this->config); |
382 | 382 | // @codeCoverageIgnoreEnd |
383 | 383 | } |
384 | 384 | |
385 | 385 | $version = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'; |
386 | - if (! is_numeric($version)) { |
|
386 | + if (!is_numeric($version)) { |
|
387 | 387 | $version = substr($version, strpos($version, '/') + 1); |
388 | 388 | } |
389 | 389 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | // Supposons le succès jusqu'à preuve du contraire. |
403 | 403 | $this->response = Services::response()->withStatus(200); |
404 | 404 | |
405 | - if (! is_cli() || on_test()) { |
|
405 | + if (!is_cli() || on_test()) { |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | $this->response = $this->response->withProtocolVersion($this->request->getProtocolVersion()); |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | { |
439 | 439 | if ($cachedResponse = Services::cache()->read($this->generateCacheName())) { |
440 | 440 | $cachedResponse = unserialize($cachedResponse); |
441 | - if (! is_array($cachedResponse) || ! isset($cachedResponse['output']) || ! isset($cachedResponse['headers'])) { |
|
441 | + if (!is_array($cachedResponse) || !isset($cachedResponse['output']) || !isset($cachedResponse['headers'])) { |
|
442 | 442 | throw new FrameworkException('Error unserializing page cache'); |
443 | 443 | } |
444 | 444 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | */ |
568 | 568 | protected function determinePath(): string |
569 | 569 | { |
570 | - if (! empty($this->path)) { |
|
570 | + if (!empty($this->path)) { |
|
571 | 571 | return $this->path; |
572 | 572 | } |
573 | 573 | |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | ? $this->request->getPath() |
576 | 576 | : $this->request->getUri()->getPath(); |
577 | 577 | |
578 | - return preg_replace('#^'.App::getUri()->getPath().'#i', '', $path); |
|
578 | + return preg_replace('#^' . App::getUri()->getPath() . '#i', '', $path); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | /** |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | } |
622 | 622 | |
623 | 623 | // Essayez de charger automatiquement la classe |
624 | - if (! class_exists($this->controller, true) || $this->method[0] === '_') { |
|
624 | + if (!class_exists($this->controller, true) || $this->method[0] === '_') { |
|
625 | 625 | throw PageNotFoundException::controllerNotFound($this->controller, $this->method); |
626 | 626 | } |
627 | 627 | |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | // Affiche l'erreur 404 |
710 | 710 | $this->response = $this->response->withStatus($e->getCode()); |
711 | 711 | |
712 | - if (! on_test()) { |
|
712 | + if (!on_test()) { |
|
713 | 713 | // @codeCoverageIgnoreStart |
714 | 714 | if (ob_get_level() > 0) { |
715 | 715 | ob_end_flush(); |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | ob_end_flush(); // @codeCoverageIgnore |
722 | 722 | } |
723 | 723 | |
724 | - throw PageNotFoundException::pageNotFound(! on_prod() || is_cli() ? $e->getMessage() : ''); |
|
724 | + throw PageNotFoundException::pageNotFound(!on_prod() || is_cli() ? $e->getMessage() : ''); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | /** |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | public function storePreviousURL($uri) |
777 | 777 | { |
778 | 778 | // Ignorer les requêtes CLI |
779 | - if (is_cli() && ! on_test()) { |
|
779 | + if (is_cli() && !on_test()) { |
|
780 | 780 | return; // @codeCoverageIgnore |
781 | 781 | } |
782 | 782 | |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | $this->middleware->prepend($this->spoofRequestMethod()); |
841 | 841 | |
842 | 842 | $middlewaresFile = CONFIG_PATH . 'middlewares.php'; |
843 | - if (file_exists($middlewaresFile) && ! in_array($middlewaresFile, get_included_files(), true)) { |
|
843 | + if (file_exists($middlewaresFile) && !in_array($middlewaresFile, get_included_files(), true)) { |
|
844 | 844 | $middleware = require $middlewaresFile; |
845 | 845 | if (is_callable($middleware)) { |
846 | 846 | $middlewareQueue = $middleware($this->middleware, $this->request); |
@@ -857,11 +857,11 @@ discard block |
||
857 | 857 | */ |
858 | 858 | private function spoofRequestMethod(): callable |
859 | 859 | { |
860 | - return static function (ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
860 | + return static function(ServerRequestInterface $request, ResponseInterface $response, callable $next) { |
|
861 | 861 | $post = $request->getParsedBody(); |
862 | 862 | |
863 | 863 | // Ne fonctionne qu'avec les formulaires POST |
864 | - if (strtoupper($request->getMethod()) === 'POST' && ! empty($post['_method'])) { |
|
864 | + if (strtoupper($request->getMethod()) === 'POST' && !empty($post['_method'])) { |
|
865 | 865 | // Accepte seulement PUT, PATCH, DELETE |
866 | 866 | if (in_array(strtoupper($post['_method']), ['PUT', 'PATCH', 'DELETE'], true)) { |
867 | 867 | $request = $request->withMethod($post['_method']); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $this->cookies = $config['cookies']; |
258 | 258 | |
259 | 259 | if (isset($config['uri'])) { |
260 | - if (! $config['uri'] instanceof UriInterface) { |
|
260 | + if (!$config['uri'] instanceof UriInterface) { |
|
261 | 261 | throw new FrameworkException('The `uri` key must be an instance of ' . UriInterface::class); |
262 | 262 | } |
263 | 263 | $uri = $config['uri']; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $ref = $this->getEnv('HTTP_REFERER'); |
398 | 398 | |
399 | 399 | $base = /* Configure::read('App.fullBaseUrl') . */ $this->webroot; |
400 | - if (! empty($ref) && ! empty($base)) { |
|
400 | + if (!empty($ref) && !empty($base)) { |
|
401 | 401 | if ($local && strpos($ref, $base) === 0) { |
402 | 402 | $ref = substr($ref, strlen($base)); |
403 | 403 | if ($ref === '' || strpos($ref, '//') === 0) { |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | |
410 | 410 | return $ref; |
411 | 411 | } |
412 | - if (! $local) { |
|
412 | + if (!$local) { |
|
413 | 413 | return $ref; |
414 | 414 | } |
415 | 415 | } |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | } |
462 | 462 | |
463 | 463 | $type = strtolower($type); |
464 | - if (! isset(static::$_detectors[$type])) { |
|
464 | + if (!isset(static::$_detectors[$type])) { |
|
465 | 465 | return false; |
466 | 466 | } |
467 | 467 | if ($args) { |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | foreach ($detect['header'] as $header => $value) { |
541 | 541 | $header = $this->getEnv('http_' . $header); |
542 | 542 | if ($header !== null) { |
543 | - if (! is_string($value) && ! is_bool($value) && is_callable($value)) { |
|
543 | + if (!is_string($value) && !is_bool($value) && is_callable($value)) { |
|
544 | 544 | return $value($header); |
545 | 545 | } |
546 | 546 | |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | public function isAll(array $types): bool |
614 | 614 | { |
615 | 615 | foreach ($types as $type) { |
616 | - if (! $this->is($type)) { |
|
616 | + if (!$this->is($type)) { |
|
617 | 617 | return false; |
618 | 618 | } |
619 | 619 | } |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | protected function normalizeHeaderName(string $name): string |
717 | 717 | { |
718 | 718 | $name = str_replace('-', '_', strtoupper($name)); |
719 | - if (! in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'], true)) { |
|
719 | + if (!in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'], true)) { |
|
720 | 720 | $name = 'HTTP_' . $name; |
721 | 721 | } |
722 | 722 | |
@@ -899,8 +899,8 @@ discard block |
||
899 | 899 | $new = clone $this; |
900 | 900 | |
901 | 901 | if ( |
902 | - ! is_string($method) |
|
903 | - || ! preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method) |
|
902 | + !is_string($method) |
|
903 | + || !preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method) |
|
904 | 904 | ) { |
905 | 905 | throw new InvalidArgumentException(sprintf( |
906 | 906 | 'Unsupported HTTP method "%s" provided', |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | } |
1145 | 1145 | } |
1146 | 1146 | |
1147 | - if (! isset($accept[$prefValue])) { |
|
1147 | + if (!isset($accept[$prefValue])) { |
|
1148 | 1148 | $accept[$prefValue] = []; |
1149 | 1149 | } |
1150 | 1150 | if ($prefValue) { |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | if ($name === null) { |
1223 | 1223 | return $this->data; |
1224 | 1224 | } |
1225 | - if (! is_array($this->data) && $name) { |
|
1225 | + if (!is_array($this->data) && $name) { |
|
1226 | 1226 | return $default; |
1227 | 1227 | } |
1228 | 1228 | |
@@ -1363,7 +1363,7 @@ discard block |
||
1363 | 1363 | */ |
1364 | 1364 | public function withProtocolVersion($version): self |
1365 | 1365 | { |
1366 | - if (! preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) { |
|
1366 | + if (!preg_match('/^(1\.[01]|2(\.[0])?)$/', $version)) { |
|
1367 | 1367 | throw new InvalidArgumentException("Unsupported protocol version '{$version}' provided"); |
1368 | 1368 | } |
1369 | 1369 | $new = clone $this; |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | public function getEnv(string $key, ?string $default = null): ?string |
1386 | 1386 | { |
1387 | 1387 | $key = strtoupper($key); |
1388 | - if (! array_key_exists($key, $this->_environment)) { |
|
1388 | + if (!array_key_exists($key, $this->_environment)) { |
|
1389 | 1389 | $this->_environment[$key] = env($key); |
1390 | 1390 | } |
1391 | 1391 | |
@@ -1597,7 +1597,7 @@ discard block |
||
1597 | 1597 | $file = Arr::get($this->uploadedFiles, $path); |
1598 | 1598 | if (is_array($file)) { |
1599 | 1599 | foreach ($file as $f) { |
1600 | - if (! ($f instanceof UploadedFile)) { |
|
1600 | + if (!($f instanceof UploadedFile)) { |
|
1601 | 1601 | return null; |
1602 | 1602 | } |
1603 | 1603 | } |
@@ -1605,7 +1605,7 @@ discard block |
||
1605 | 1605 | return $file; |
1606 | 1606 | } |
1607 | 1607 | |
1608 | - if (! ($file instanceof UploadedFileInterface)) { |
|
1608 | + if (!($file instanceof UploadedFileInterface)) { |
|
1609 | 1609 | return null; |
1610 | 1610 | } |
1611 | 1611 | |
@@ -1653,7 +1653,7 @@ discard block |
||
1653 | 1653 | continue; |
1654 | 1654 | } |
1655 | 1655 | |
1656 | - if (! $file instanceof UploadedFileInterface) { |
|
1656 | + if (!$file instanceof UploadedFileInterface) { |
|
1657 | 1657 | throw new InvalidArgumentException("Invalid file at '{$path}{$key}'"); |
1658 | 1658 | } |
1659 | 1659 | } |
@@ -1704,7 +1704,7 @@ discard block |
||
1704 | 1704 | } |
1705 | 1705 | |
1706 | 1706 | $host = $uri->getHost(); |
1707 | - if (! $host) { |
|
1707 | + if (!$host) { |
|
1708 | 1708 | return $new; |
1709 | 1709 | } |
1710 | 1710 | $port = $uri->getPort(); |
@@ -1812,7 +1812,7 @@ discard block |
||
1812 | 1812 | $validLocales = config('app.supported_locales'); |
1813 | 1813 | // S'il ne s'agit pas d'un paramètre régional valide, définissez-le |
1814 | 1814 | // aux paramètres régionaux par défaut du site. |
1815 | - if (! in_array($locale, $validLocales, true)) { |
|
1815 | + if (!in_array($locale, $validLocales, true)) { |
|
1816 | 1816 | $locale = config('app.language'); |
1817 | 1817 | } |
1818 | 1818 | |
@@ -1912,7 +1912,7 @@ discard block |
||
1912 | 1912 | $override = true; |
1913 | 1913 | } |
1914 | 1914 | |
1915 | - if ($override && ! in_array($this->_environment['REQUEST_METHOD'], ['PUT', 'POST', 'DELETE', 'PATCH'], true)) { |
|
1915 | + if ($override && !in_array($this->_environment['REQUEST_METHOD'], ['PUT', 'POST', 'DELETE', 'PATCH'], true)) { |
|
1916 | 1916 | $data = []; |
1917 | 1917 | } |
1918 | 1918 | |
@@ -1961,7 +1961,7 @@ discard block |
||
1961 | 1961 | */ |
1962 | 1962 | protected function _processFiles(array $post, array $files): array |
1963 | 1963 | { |
1964 | - if (! is_array($files)) { |
|
1964 | + if (!is_array($files)) { |
|
1965 | 1965 | return $post; |
1966 | 1966 | } |
1967 | 1967 |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | */ |
22 | 22 | function css_url(string $name) : string |
23 | 23 | { |
24 | - $name = explode('?', $name)[0]; |
|
25 | - $name = str_replace(site_url() . 'css/', '', htmlspecialchars($name)); |
|
24 | + $name = explode('?', $name)[0]; |
|
25 | + $name = str_replace(site_url() . 'css/', '', htmlspecialchars($name)); |
|
26 | 26 | |
27 | 27 | if (is_localfile($name)) { |
28 | 28 | $name .= (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
29 | 29 | $filename = WEBROOT.'css'.DS.$name; |
30 | 30 | |
31 | - return site_url() . 'css/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
31 | + return site_url() . 'css/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | return $name . (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | function js_url(string $name) : string |
51 | 51 | { |
52 | 52 | $name = explode('?', $name)[0]; |
53 | - $name = str_replace(site_url() . 'js/', '', htmlspecialchars($name)); |
|
53 | + $name = str_replace(site_url() . 'js/', '', htmlspecialchars($name)); |
|
54 | 54 | |
55 | 55 | if (is_localfile($name)) |
56 | 56 | { |
57 | 57 | $name .= (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
58 | 58 | $filename = WEBROOT.'js'.DS.$name; |
59 | 59 | |
60 | - return site_url() . 'js/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
60 | + return site_url() . 'js/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $name . (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | function lib_css_url(string $name) : string |
80 | 80 | { |
81 | 81 | $name = explode('?', $name)[0]; |
82 | - $name = str_replace(site_url() . 'lib/', '', htmlspecialchars($name)); |
|
82 | + $name = str_replace(site_url() . 'lib/', '', htmlspecialchars($name)); |
|
83 | 83 | |
84 | 84 | if (is_localfile($name)) |
85 | 85 | { |
86 | 86 | $name .= (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
87 | 87 | $filename = WEBROOT.'lib'.DS.$name; |
88 | 88 | |
89 | - return site_url() . 'lib/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
89 | + return site_url() . 'lib/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $name . (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | function lib_js_url(string $name) : string |
109 | 109 | { |
110 | 110 | $name = explode('?', $name)[0]; |
111 | - $name = str_replace(site_url() . 'lib/', '', htmlspecialchars($name)); |
|
111 | + $name = str_replace(site_url() . 'lib/', '', htmlspecialchars($name)); |
|
112 | 112 | |
113 | 113 | if (is_localfile($name)) |
114 | 114 | { |
115 | 115 | $name .= (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
116 | 116 | $filename = WEBROOT.'lib'.DS.$name; |
117 | 117 | |
118 | - return site_url() . 'lib/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
118 | + return site_url() . 'lib/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | return $name . (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | * inclu une ou plusieurs feuilles de style css |
133 | 133 | * |
134 | 134 | * @param string|string[] $name nom du fichier dont on veut inserer |
135 | - * @param bool $print Specifie si on affiche directement la sortie ou si on la retourne |
|
135 | + * @param bool $print Specifie si on affiche directement la sortie ou si on la retourne |
|
136 | 136 | * @return void|string |
137 | 137 | */ |
138 | 138 | function lib_styles($name, bool $print = true) |
139 | 139 | { |
140 | 140 | $name = (array) $name; |
141 | - $return = []; |
|
141 | + $return = []; |
|
142 | 142 | |
143 | 143 | foreach ($name As $style) |
144 | 144 | { |
@@ -152,25 +152,25 @@ discard block |
||
152 | 152 | } |
153 | 153 | else if (is_localfile($style)) |
154 | 154 | { |
155 | - $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
|
155 | + $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
|
156 | 156 | $return[] = '<link rel="stylesheet" type="text/css" href="'.lib_css_url($style).'" /> -->'; |
157 | 157 | } |
158 | - else |
|
159 | - { |
|
160 | - $return[] = '<link rel="preload" type="text/css" href="'.lib_css_url($style).'" as="style"> |
|
158 | + else |
|
159 | + { |
|
160 | + $return[] = '<link rel="preload" type="text/css" href="'.lib_css_url($style).'" as="style"> |
|
161 | 161 | <link rel="stylesheet" type="text/css" href="'.lib_css_url($style).'" />'; |
162 | - } |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | - $output = join("\n", $return); |
|
166 | + $output = join("\n", $return); |
|
167 | 167 | |
168 | - if (false === $print) |
|
169 | - { |
|
170 | - return $output; |
|
171 | - } |
|
168 | + if (false === $print) |
|
169 | + { |
|
170 | + return $output; |
|
171 | + } |
|
172 | 172 | |
173 | - echo $output; |
|
173 | + echo $output; |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | function lib_scripts($name, bool $print = true) |
191 | 191 | { |
192 | 192 | $name = (array) $name; |
193 | - $return = []; |
|
193 | + $return = []; |
|
194 | 194 | |
195 | 195 | foreach ($name As $script) |
196 | 196 | { |
@@ -203,24 +203,24 @@ discard block |
||
203 | 203 | } |
204 | 204 | else if (is_localfile($script)) |
205 | 205 | { |
206 | - $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
|
206 | + $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
|
207 | 207 | $return[] = '<script type="text/javascript" src="'.lib_js_url($script).'"></script> -->'; |
208 | 208 | } |
209 | - else |
|
210 | - { |
|
211 | - $return[] = '<script type="text/javascript" src="'.lib_js_url($script).'"></script>'; |
|
212 | - } |
|
209 | + else |
|
210 | + { |
|
211 | + $return[] = '<script type="text/javascript" src="'.lib_js_url($script).'"></script>'; |
|
212 | + } |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
216 | - $output = join("\n", $return); |
|
216 | + $output = join("\n", $return); |
|
217 | 217 | |
218 | - if (false === $print) |
|
219 | - { |
|
220 | - return $output; |
|
221 | - } |
|
218 | + if (false === $print) |
|
219 | + { |
|
220 | + return $output; |
|
221 | + } |
|
222 | 222 | |
223 | - echo $output; |
|
223 | + echo $output; |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
@@ -234,13 +234,13 @@ discard block |
||
234 | 234 | * inclu une ou plusieurs feuilles de style css |
235 | 235 | * |
236 | 236 | * @param string|string[] $name nom du fichier dont on veut inserer |
237 | - * @param bool $print Specifie si on affiche directement la sortie ou si on la retourne |
|
237 | + * @param bool $print Specifie si on affiche directement la sortie ou si on la retourne |
|
238 | 238 | * @return void|string |
239 | 239 | */ |
240 | 240 | function styles($name, bool $print = true) |
241 | 241 | { |
242 | 242 | $name = (array) $name; |
243 | - $return = []; |
|
243 | + $return = []; |
|
244 | 244 | |
245 | 245 | foreach ($name As $style) |
246 | 246 | { |
@@ -249,30 +249,30 @@ discard block |
||
249 | 249 | $style = (!preg_match('#\.css$#i', $style) ? $style.'.css' : $style); |
250 | 250 | if (is_file(WEBROOT.'css'.DS.str_replace('/', DS, $style))) |
251 | 251 | { |
252 | - $return[] = '<link rel="preload" type="text/css" href="'.css_url($style).'" as="style"> |
|
252 | + $return[] = '<link rel="preload" type="text/css" href="'.css_url($style).'" as="style"> |
|
253 | 253 | <link rel="stylesheet" type="text/css" href="'.css_url($style).'" />'; |
254 | 254 | } |
255 | 255 | else if (is_localfile($style)) |
256 | 256 | { |
257 | - $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
|
257 | + $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
|
258 | 258 | $return[] = '<link rel="stylesheet" type="text/css" href="'.css_url($style).'" /> -->'; |
259 | 259 | } |
260 | - else |
|
261 | - { |
|
262 | - $return[] = '<link rel="preload" type="text/css" href="'.css_url($style).'" as="style"> |
|
260 | + else |
|
261 | + { |
|
262 | + $return[] = '<link rel="preload" type="text/css" href="'.css_url($style).'" as="style"> |
|
263 | 263 | <link rel="stylesheet" type="text/css" href="'.css_url($style).'" />'; |
264 | - } |
|
264 | + } |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | - $output = join("\n", $return); |
|
268 | + $output = join("\n", $return); |
|
269 | 269 | |
270 | - if (false === $print) |
|
271 | - { |
|
272 | - return $output; |
|
273 | - } |
|
270 | + if (false === $print) |
|
271 | + { |
|
272 | + return $output; |
|
273 | + } |
|
274 | 274 | |
275 | - echo $output; |
|
275 | + echo $output; |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | function scripts($name, bool $print = true) |
293 | 293 | { |
294 | 294 | $name = (array) $name; |
295 | - $return = []; |
|
295 | + $return = []; |
|
296 | 296 | |
297 | 297 | foreach ($name As $script) |
298 | 298 | { |
@@ -308,21 +308,21 @@ discard block |
||
308 | 308 | $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
309 | 309 | $return[] = '<script type="text/javascript" src="'.js_url($script).'"></script> -->'; |
310 | 310 | } |
311 | - else |
|
312 | - { |
|
313 | - $return[] = '<script type="text/javascript" src="'.js_url($script).'"></script>'; |
|
314 | - } |
|
311 | + else |
|
312 | + { |
|
313 | + $return[] = '<script type="text/javascript" src="'.js_url($script).'"></script>'; |
|
314 | + } |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | |
318 | - $output = join("\n", $return); |
|
318 | + $output = join("\n", $return); |
|
319 | 319 | |
320 | - if (false === $print) |
|
321 | - { |
|
322 | - return $output; |
|
323 | - } |
|
320 | + if (false === $print) |
|
321 | + { |
|
322 | + return $output; |
|
323 | + } |
|
324 | 324 | |
325 | - echo $output; |
|
325 | + echo $output; |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
@@ -341,13 +341,13 @@ discard block |
||
341 | 341 | function less_url(string $name) : string |
342 | 342 | { |
343 | 343 | $name = explode('?', $name)[0]; |
344 | - $name = str_replace(site_url() . 'less/', '', htmlspecialchars($name)); |
|
344 | + $name = str_replace(site_url() . 'less/', '', htmlspecialchars($name)); |
|
345 | 345 | |
346 | 346 | if (is_localfile($name)) { |
347 | 347 | $name .= (!preg_match('#\.less$#i', $name) ? '.less' : ''); |
348 | 348 | $filename = WEBROOT.'less'.DS.$name; |
349 | 349 | |
350 | - return site_url() . 'less/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
350 | + return site_url() . 'less/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | return $name . (!preg_match('#\.less$#i', $name) ? '.less' : ''); |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | function less_styles($name, bool $print = true) |
371 | 371 | { |
372 | 372 | $name = (array) $name; |
373 | - $return = []; |
|
373 | + $return = []; |
|
374 | 374 | |
375 | 375 | foreach ($name As $style) |
376 | 376 | { |
@@ -386,21 +386,21 @@ discard block |
||
386 | 386 | $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
387 | 387 | $return[] = '<link rel="stylesheet" type="text/less" href="'.less_url($style).'" /> -->'; |
388 | 388 | } |
389 | - else |
|
390 | - { |
|
391 | - $return[] = '<link rel="stylesheet" type="text/less" href="'.less_url($style).'" />'; |
|
392 | - } |
|
389 | + else |
|
390 | + { |
|
391 | + $return[] = '<link rel="stylesheet" type="text/less" href="'.less_url($style).'" />'; |
|
392 | + } |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
396 | - $output = join("\n", $return); |
|
396 | + $output = join("\n", $return); |
|
397 | 397 | |
398 | - if (false === $print) |
|
399 | - { |
|
400 | - return $output; |
|
401 | - } |
|
398 | + if (false === $print) |
|
399 | + { |
|
400 | + return $output; |
|
401 | + } |
|
402 | 402 | |
403 | - echo $output; |
|
403 | + echo $output; |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
@@ -423,12 +423,12 @@ discard block |
||
423 | 423 | } |
424 | 424 | |
425 | 425 | $name = explode('?', $name)[0]; |
426 | - $name = str_replace(site_url() . 'img/', '', htmlspecialchars($name)); |
|
426 | + $name = str_replace(site_url() . 'img/', '', htmlspecialchars($name)); |
|
427 | 427 | |
428 | 428 | if (is_localfile($name)) { |
429 | 429 | $filename = WEBROOT.'img'.DS.$name; |
430 | 430 | |
431 | - return site_url() . 'img/' . $name.((file_exists($filename) && $add_version) ? '?v='.filemtime($filename) : ''); |
|
431 | + return site_url() . 'img/' . $name.((file_exists($filename) && $add_version) ? '?v='.filemtime($filename) : ''); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | return $name; |
@@ -453,8 +453,8 @@ discard block |
||
453 | 453 | { |
454 | 454 | $return = '<img src="' . img_url($name) . '" alt="' . $alt . '"'; |
455 | 455 | |
456 | - $noprint = isset($options['print']) AND $options['print'] == false; |
|
457 | - unset($options['print']); |
|
456 | + $noprint = isset($options['print']) AND $options['print'] == false; |
|
457 | + unset($options['print']); |
|
458 | 458 | |
459 | 459 | foreach ($options As $key => $value) |
460 | 460 | { |
@@ -462,10 +462,10 @@ discard block |
||
462 | 462 | } |
463 | 463 | $return .= ' />'; |
464 | 464 | |
465 | - if ($noprint === true) |
|
466 | - { |
|
467 | - return $return; |
|
468 | - } |
|
465 | + if ($noprint === true) |
|
466 | + { |
|
467 | + return $return; |
|
468 | + } |
|
469 | 469 | |
470 | 470 | echo $return; |
471 | 471 | } |
@@ -489,12 +489,12 @@ discard block |
||
489 | 489 | } |
490 | 490 | |
491 | 491 | $name = explode('?', $name)[0]; |
492 | - $name = str_replace(site_url() . 'docs/', '', htmlspecialchars($name)); |
|
492 | + $name = str_replace(site_url() . 'docs/', '', htmlspecialchars($name)); |
|
493 | 493 | |
494 | 494 | if (is_localfile($name)) { |
495 | 495 | $filename = WEBROOT.'docs'.DS.$name; |
496 | 496 | |
497 | - return site_url() . 'docs/' . $name.((file_exists($filename && $add_version)) ? '?v='.filemtime($filename) : ''); |
|
497 | + return site_url() . 'docs/' . $name.((file_exists($filename && $add_version)) ? '?v='.filemtime($filename) : ''); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | return $name; |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | } |
520 | 520 | |
521 | 521 | $name = explode('?', $name)[0]; |
522 | - $name = str_replace(site_url() . 'videos/', '', htmlspecialchars($name)); |
|
522 | + $name = str_replace(site_url() . 'videos/', '', htmlspecialchars($name)); |
|
523 | 523 | |
524 | 524 | if (is_localfile($name)) { |
525 | 525 | $filename = WEBROOT.'videos'.DS.$name; |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | $name = str_replace(site_url() . 'css/', '', htmlspecialchars($name)); |
26 | 26 | |
27 | 27 | if (is_localfile($name)) { |
28 | - $name .= (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
29 | - $filename = WEBROOT.'css'.DS.$name; |
|
28 | + $name .= (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
29 | + $filename = WEBROOT . 'css' . DS . $name; |
|
30 | 30 | |
31 | - return site_url() . 'css/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
31 | + return site_url() . 'css/' . $name . ((file_exists($filename)) ? '?v=' . filemtime($filename) : ''); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | return $name . (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | |
55 | 55 | if (is_localfile($name)) |
56 | 56 | { |
57 | - $name .= (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
58 | - $filename = WEBROOT.'js'.DS.$name; |
|
57 | + $name .= (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
58 | + $filename = WEBROOT . 'js' . DS . $name; |
|
59 | 59 | |
60 | - return site_url() . 'js/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
60 | + return site_url() . 'js/' . $name . ((file_exists($filename)) ? '?v=' . filemtime($filename) : ''); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $name . (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | |
84 | 84 | if (is_localfile($name)) |
85 | 85 | { |
86 | - $name .= (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
87 | - $filename = WEBROOT.'lib'.DS.$name; |
|
86 | + $name .= (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
|
87 | + $filename = WEBROOT . 'lib' . DS . $name; |
|
88 | 88 | |
89 | - return site_url() . 'lib/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
89 | + return site_url() . 'lib/' . $name . ((file_exists($filename)) ? '?v=' . filemtime($filename) : ''); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $name . (!preg_match('#\.css$#i', $name) ? '.css' : ''); |
@@ -112,10 +112,10 @@ discard block |
||
112 | 112 | |
113 | 113 | if (is_localfile($name)) |
114 | 114 | { |
115 | - $name .= (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
116 | - $filename = WEBROOT.'lib'.DS.$name; |
|
115 | + $name .= (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
|
116 | + $filename = WEBROOT . 'lib' . DS . $name; |
|
117 | 117 | |
118 | - return site_url() . 'lib/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
118 | + return site_url() . 'lib/' . $name . ((file_exists($filename)) ? '?v=' . filemtime($filename) : ''); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | return $name . (!preg_match('#\.js$#i', $name) ? '.js' : ''); |
@@ -144,21 +144,21 @@ discard block |
||
144 | 144 | { |
145 | 145 | if (is_string($style)) |
146 | 146 | { |
147 | - $style = (!preg_match('#\.css$#i', $style) ? $style.'.css' : $style); |
|
148 | - if (is_file(WEBROOT.'lib'.DS.str_replace('/', DS, $style))) |
|
147 | + $style = (!preg_match('#\.css$#i', $style) ? $style . '.css' : $style); |
|
148 | + if (is_file(WEBROOT . 'lib' . DS . str_replace('/', DS, $style))) |
|
149 | 149 | { |
150 | - $return[] = '<link rel="preload" type="text/css" href="'.lib_css_url($style).'" as="style"> |
|
151 | - <link rel="stylesheet" type="text/css" href="'.lib_css_url($style).'" />'; |
|
150 | + $return[] = '<link rel="preload" type="text/css" href="' . lib_css_url($style) . '" as="style"> |
|
151 | + <link rel="stylesheet" type="text/css" href="'.lib_css_url($style) . '" />'; |
|
152 | 152 | } |
153 | 153 | else if (is_localfile($style)) |
154 | 154 | { |
155 | 155 | $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
156 | - $return[] = '<link rel="stylesheet" type="text/css" href="'.lib_css_url($style).'" /> -->'; |
|
156 | + $return[] = '<link rel="stylesheet" type="text/css" href="' . lib_css_url($style) . '" /> -->'; |
|
157 | 157 | } |
158 | 158 | else |
159 | 159 | { |
160 | - $return[] = '<link rel="preload" type="text/css" href="'.lib_css_url($style).'" as="style"> |
|
161 | - <link rel="stylesheet" type="text/css" href="'.lib_css_url($style).'" />'; |
|
160 | + $return[] = '<link rel="preload" type="text/css" href="' . lib_css_url($style) . '" as="style"> |
|
161 | + <link rel="stylesheet" type="text/css" href="'.lib_css_url($style) . '" />'; |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | } |
@@ -196,19 +196,19 @@ discard block |
||
196 | 196 | { |
197 | 197 | if (is_string($script)) |
198 | 198 | { |
199 | - $script = (!preg_match('#\.js$#i', $script) ? $script.'.js' : $script); |
|
200 | - if (is_file(WEBROOT.'lib'.DS.str_replace('/', DS, $script))) |
|
199 | + $script = (!preg_match('#\.js$#i', $script) ? $script . '.js' : $script); |
|
200 | + if (is_file(WEBROOT . 'lib' . DS . str_replace('/', DS, $script))) |
|
201 | 201 | { |
202 | - $return[] = '<script type="text/javascript" src="'.lib_js_url($script).'"></script>'; |
|
202 | + $return[] = '<script type="text/javascript" src="' . lib_js_url($script) . '"></script>'; |
|
203 | 203 | } |
204 | 204 | else if (is_localfile($script)) |
205 | 205 | { |
206 | 206 | $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
207 | - $return[] = '<script type="text/javascript" src="'.lib_js_url($script).'"></script> -->'; |
|
207 | + $return[] = '<script type="text/javascript" src="' . lib_js_url($script) . '"></script> -->'; |
|
208 | 208 | } |
209 | 209 | else |
210 | 210 | { |
211 | - $return[] = '<script type="text/javascript" src="'.lib_js_url($script).'"></script>'; |
|
211 | + $return[] = '<script type="text/javascript" src="' . lib_js_url($script) . '"></script>'; |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | } |
@@ -246,21 +246,21 @@ discard block |
||
246 | 246 | { |
247 | 247 | if (is_string($style)) |
248 | 248 | { |
249 | - $style = (!preg_match('#\.css$#i', $style) ? $style.'.css' : $style); |
|
250 | - if (is_file(WEBROOT.'css'.DS.str_replace('/', DS, $style))) |
|
249 | + $style = (!preg_match('#\.css$#i', $style) ? $style . '.css' : $style); |
|
250 | + if (is_file(WEBROOT . 'css' . DS . str_replace('/', DS, $style))) |
|
251 | 251 | { |
252 | - $return[] = '<link rel="preload" type="text/css" href="'.css_url($style).'" as="style"> |
|
253 | - <link rel="stylesheet" type="text/css" href="'.css_url($style).'" />'; |
|
252 | + $return[] = '<link rel="preload" type="text/css" href="' . css_url($style) . '" as="style"> |
|
253 | + <link rel="stylesheet" type="text/css" href="'.css_url($style) . '" />'; |
|
254 | 254 | } |
255 | 255 | else if (is_localfile($style)) |
256 | 256 | { |
257 | 257 | $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
258 | - $return[] = '<link rel="stylesheet" type="text/css" href="'.css_url($style).'" /> -->'; |
|
258 | + $return[] = '<link rel="stylesheet" type="text/css" href="' . css_url($style) . '" /> -->'; |
|
259 | 259 | } |
260 | 260 | else |
261 | 261 | { |
262 | - $return[] = '<link rel="preload" type="text/css" href="'.css_url($style).'" as="style"> |
|
263 | - <link rel="stylesheet" type="text/css" href="'.css_url($style).'" />'; |
|
262 | + $return[] = '<link rel="preload" type="text/css" href="' . css_url($style) . '" as="style"> |
|
263 | + <link rel="stylesheet" type="text/css" href="'.css_url($style) . '" />'; |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | } |
@@ -296,21 +296,21 @@ discard block |
||
296 | 296 | |
297 | 297 | foreach ($name As $script) |
298 | 298 | { |
299 | - if(is_string($script)) |
|
299 | + if (is_string($script)) |
|
300 | 300 | { |
301 | - $script = (!preg_match('#\.js$#i', $script) ? $script.'.js' : $script); |
|
302 | - if (is_file(WEBROOT.'js'.DS.str_replace('/', DS, $script))) |
|
301 | + $script = (!preg_match('#\.js$#i', $script) ? $script . '.js' : $script); |
|
302 | + if (is_file(WEBROOT . 'js' . DS . str_replace('/', DS, $script))) |
|
303 | 303 | { |
304 | - $return[] = '<script type="text/javascript" src="'.js_url($script).'"></script>'; |
|
304 | + $return[] = '<script type="text/javascript" src="' . js_url($script) . '"></script>'; |
|
305 | 305 | } |
306 | 306 | else if (is_localfile($script)) |
307 | 307 | { |
308 | 308 | $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
309 | - $return[] = '<script type="text/javascript" src="'.js_url($script).'"></script> -->'; |
|
309 | + $return[] = '<script type="text/javascript" src="' . js_url($script) . '"></script> -->'; |
|
310 | 310 | } |
311 | 311 | else |
312 | 312 | { |
313 | - $return[] = '<script type="text/javascript" src="'.js_url($script).'"></script>'; |
|
313 | + $return[] = '<script type="text/javascript" src="' . js_url($script) . '"></script>'; |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | } |
@@ -344,10 +344,10 @@ discard block |
||
344 | 344 | $name = str_replace(site_url() . 'less/', '', htmlspecialchars($name)); |
345 | 345 | |
346 | 346 | if (is_localfile($name)) { |
347 | - $name .= (!preg_match('#\.less$#i', $name) ? '.less' : ''); |
|
348 | - $filename = WEBROOT.'less'.DS.$name; |
|
347 | + $name .= (!preg_match('#\.less$#i', $name) ? '.less' : ''); |
|
348 | + $filename = WEBROOT . 'less' . DS . $name; |
|
349 | 349 | |
350 | - return site_url() . 'less/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
350 | + return site_url() . 'less/' . $name . ((file_exists($filename)) ? '?v=' . filemtime($filename) : ''); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | return $name . (!preg_match('#\.less$#i', $name) ? '.less' : ''); |
@@ -376,19 +376,19 @@ discard block |
||
376 | 376 | { |
377 | 377 | if (is_string($style)) |
378 | 378 | { |
379 | - $style = (!preg_match('#\.less$#i', $style) ? $style.'.less' : $style); |
|
380 | - if (is_file(WEBROOT.'less'.DS.str_replace('/', DS, $style))) |
|
379 | + $style = (!preg_match('#\.less$#i', $style) ? $style . '.less' : $style); |
|
380 | + if (is_file(WEBROOT . 'less' . DS . str_replace('/', DS, $style))) |
|
381 | 381 | { |
382 | - $return[] = '<link rel="stylesheet" type="text/less" href="'.less_url($style).'" />'; |
|
382 | + $return[] = '<link rel="stylesheet" type="text/less" href="' . less_url($style) . '" />'; |
|
383 | 383 | } |
384 | 384 | else if (is_localfile($style)) |
385 | 385 | { |
386 | 386 | $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
387 | - $return[] = '<link rel="stylesheet" type="text/less" href="'.less_url($style).'" /> -->'; |
|
387 | + $return[] = '<link rel="stylesheet" type="text/less" href="' . less_url($style) . '" /> -->'; |
|
388 | 388 | } |
389 | 389 | else |
390 | 390 | { |
391 | - $return[] = '<link rel="stylesheet" type="text/less" href="'.less_url($style).'" />'; |
|
391 | + $return[] = '<link rel="stylesheet" type="text/less" href="' . less_url($style) . '" />'; |
|
392 | 392 | } |
393 | 393 | } |
394 | 394 | } |
@@ -426,9 +426,9 @@ discard block |
||
426 | 426 | $name = str_replace(site_url() . 'img/', '', htmlspecialchars($name)); |
427 | 427 | |
428 | 428 | if (is_localfile($name)) { |
429 | - $filename = WEBROOT.'img'.DS.$name; |
|
429 | + $filename = WEBROOT . 'img' . DS . $name; |
|
430 | 430 | |
431 | - return site_url() . 'img/' . $name.((file_exists($filename) && $add_version) ? '?v='.filemtime($filename) : ''); |
|
431 | + return site_url() . 'img/' . $name . ((file_exists($filename) && $add_version) ? '?v=' . filemtime($filename) : ''); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | return $name; |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | |
459 | 459 | foreach ($options As $key => $value) |
460 | 460 | { |
461 | - $return .= ' '.$key.'="'.$value.'"'; |
|
461 | + $return .= ' ' . $key . '="' . $value . '"'; |
|
462 | 462 | } |
463 | 463 | $return .= ' />'; |
464 | 464 | |
@@ -492,9 +492,9 @@ discard block |
||
492 | 492 | $name = str_replace(site_url() . 'docs/', '', htmlspecialchars($name)); |
493 | 493 | |
494 | 494 | if (is_localfile($name)) { |
495 | - $filename = WEBROOT.'docs'.DS.$name; |
|
495 | + $filename = WEBROOT . 'docs' . DS . $name; |
|
496 | 496 | |
497 | - return site_url() . 'docs/' . $name.((file_exists($filename && $add_version)) ? '?v='.filemtime($filename) : ''); |
|
497 | + return site_url() . 'docs/' . $name . ((file_exists($filename && $add_version)) ? '?v=' . filemtime($filename) : ''); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | return $name; |
@@ -522,9 +522,9 @@ discard block |
||
522 | 522 | $name = str_replace(site_url() . 'videos/', '', htmlspecialchars($name)); |
523 | 523 | |
524 | 524 | if (is_localfile($name)) { |
525 | - $filename = WEBROOT.'videos'.DS.$name; |
|
525 | + $filename = WEBROOT . 'videos' . DS . $name; |
|
526 | 526 | |
527 | - return site_url() . 'videos/' . $name.((file_exists($filename) && $add_version) ? '?v='.filemtime($filename) : ''); |
|
527 | + return site_url() . 'videos/' . $name . ((file_exists($filename) && $add_version) ? '?v=' . filemtime($filename) : ''); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | return $name; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | // ================================= ================================= // |
26 | 26 | |
27 | -if (! function_exists('site_url')) { |
|
27 | +if (!function_exists('site_url')) { |
|
28 | 28 | /** |
29 | 29 | * Renvoie une URL de site telle que définie par la configuration de l'application. |
30 | 30 | * |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | -if (! function_exists('base_url')) { |
|
51 | +if (!function_exists('base_url')) { |
|
52 | 52 | /** |
53 | 53 | * Renvoie l'URL de base telle que définie par la configuration de l'application. |
54 | 54 | * Les URL de base sont des URL de site coupées sans la page d'index. |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | -if (! function_exists('current_url')) { |
|
70 | +if (!function_exists('current_url')) { |
|
71 | 71 | /** |
72 | 72 | * Renvoie l'URL complète (y compris les segments) de la page où cette fonction est placée |
73 | 73 | * |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | -if (! function_exists('previous_url')) { |
|
97 | +if (!function_exists('previous_url')) { |
|
98 | 98 | /** |
99 | 99 | * Renvoie l'URL précédente sur laquelle se trouvait le visiteur actuel. Pour des raisons de sécurité |
100 | 100 | * nous vérifions d'abord une variable de session enregistrée, si elle existe, et l'utilisons. |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | -if (! function_exists('uri_string')) { |
|
122 | +if (!function_exists('uri_string')) { |
|
123 | 123 | /** |
124 | 124 | * Renvoie la partie chemin de l'URL actuelle |
125 | 125 | * |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | -if (! function_exists('index_page')) { |
|
136 | +if (!function_exists('index_page')) { |
|
137 | 137 | /** |
138 | 138 | * Renvoie la "index_page" de votre fichier de configuration |
139 | 139 | */ |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | -if (! function_exists('anchor')) { |
|
146 | +if (!function_exists('anchor')) { |
|
147 | 147 | /** |
148 | 148 | * Crée une ancre basée sur l'URL locale. |
149 | 149 | * |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | -if (! function_exists('anchor_popup')) { |
|
171 | +if (!function_exists('anchor_popup')) { |
|
172 | 172 | /** |
173 | 173 | * Lien d'ancrage - Version contextuelle |
174 | 174 | * |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | return '<a href="' . $siteUrl . '" onclick="window.open(\'' . $siteUrl . "', '_blank'); return false;\">" . $title . '</a>'; |
192 | 192 | } |
193 | 193 | |
194 | - if (! is_array($attributes)) { |
|
194 | + if (!is_array($attributes)) { |
|
195 | 195 | $attributes = [$attributes]; |
196 | 196 | |
197 | 197 | // Ref: http://www.w3schools.com/jsref/met_win_open.asp |
198 | 198 | $windowName = '_blank'; |
199 | - } elseif (! empty($attributes['window_name'])) { |
|
199 | + } elseif (!empty($attributes['window_name'])) { |
|
200 | 200 | $windowName = $attributes['window_name']; |
201 | 201 | unset($attributes['window_name']); |
202 | 202 | } else { |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
219 | -if (! function_exists('mailto')) { |
|
219 | +if (!function_exists('mailto')) { |
|
220 | 220 | /** |
221 | 221 | * Lien Mailto |
222 | 222 | * |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | -if (! function_exists('safe_mailto')) { |
|
236 | +if (!function_exists('safe_mailto')) { |
|
237 | 237 | /** |
238 | 238 | * Lien Mailto codé |
239 | 239 | * |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | -if (! function_exists('auto_link')) { |
|
325 | +if (!function_exists('auto_link')) { |
|
326 | 326 | /** |
327 | 327 | * Lien automatique |
328 | 328 | * |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | function auto_link(string $str, string $type = 'both', bool $popup = false): string |
338 | 338 | { |
339 | 339 | // Recherche et remplace tous les URLs. |
340 | - if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { |
|
340 | + if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE|PREG_SET_ORDER)) { |
|
341 | 341 | // Définissez notre HTML cible si vous utilisez des liens contextuels. |
342 | 342 | $target = ($popup) ? ' target="_blank"' : ''; |
343 | 343 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
371 | -if (! function_exists('prep_url')) { |
|
371 | +if (!function_exists('prep_url')) { |
|
372 | 372 | /** |
373 | 373 | * Ajoute simplement la partie http:// ou https:// si aucun schéma n'est inclus. |
374 | 374 | * |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
396 | -if (! function_exists('url_title')) { |
|
396 | +if (!function_exists('url_title')) { |
|
397 | 397 | /** |
398 | 398 | * Créer un titre d'URL |
399 | 399 | * |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
432 | -if (! function_exists('mb_url_title')) { |
|
432 | +if (!function_exists('mb_url_title')) { |
|
433 | 433 | /** |
434 | 434 | * Créer un titre d'URL qui prend en compte les caractères accentués |
435 | 435 | * |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
451 | -if (! function_exists('url_to')) { |
|
451 | +if (!function_exists('url_to')) { |
|
452 | 452 | /** |
453 | 453 | * Obtenir l'URL complète et absolue d'une méthode de contrôleur |
454 | 454 | * (avec arguments supplémentaires) |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | */ |
462 | 462 | function url_to(string $controller, ...$args): string |
463 | 463 | { |
464 | - if (! $route = link_to($controller, ...$args)) { |
|
464 | + if (!$route = link_to($controller, ...$args)) { |
|
465 | 465 | $explode = explode('::', $controller); |
466 | 466 | |
467 | 467 | if (isset($explode[1])) { |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | } |
476 | 476 | } |
477 | 477 | |
478 | -if (! function_exists('url_is')) { |
|
478 | +if (!function_exists('url_is')) { |
|
479 | 479 | /** |
480 | 480 | * Détermine si le chemin d'URL actuel contient le chemin donné. |
481 | 481 | * Il peut contenir un caractère générique (*) qui autorisera tout caractère valide. |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | } |
494 | 494 | } |
495 | 495 | |
496 | -if (! function_exists('link_active')) { |
|
496 | +if (!function_exists('link_active')) { |
|
497 | 497 | /** |
498 | 498 | * Lien actif dans la navbar |
499 | 499 | * Un peut comme le router-active-link de vuejs |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | return $active_class; |
508 | 508 | } |
509 | 509 | |
510 | - if (! $exact && preg_match('#^' . $path . '/?#i', $current_section)) { |
|
510 | + if (!$exact && preg_match('#^' . $path . '/?#i', $current_section)) { |
|
511 | 511 | return $active_class; |
512 | 512 | } |
513 | 513 | |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | } |
521 | 521 | } |
522 | 522 | |
523 | -if (! function_exists('clean_url')) { |
|
523 | +if (!function_exists('clean_url')) { |
|
524 | 524 | function clean_url(string $url): string |
525 | 525 | { |
526 | 526 | return Helpers::cleanUrl($url); |