@@ -239,16 +239,16 @@ |
||
239 | 239 | |
240 | 240 | |
241 | 241 | /** |
242 | - * Returns platform-specific SQL to disable foreign key checks. |
|
243 | - */ |
|
244 | - protected function _disableForeignKeyChecks(): string |
|
242 | + * Returns platform-specific SQL to disable foreign key checks. |
|
243 | + */ |
|
244 | + protected function _disableForeignKeyChecks(): string |
|
245 | 245 | { |
246 | 246 | return ''; |
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
250 | - * Returns platform-specific SQL to disable foreign key checks. |
|
251 | - */ |
|
250 | + * Returns platform-specific SQL to disable foreign key checks. |
|
251 | + */ |
|
252 | 252 | protected function _enableForeignKeyChecks(): string |
253 | 253 | { |
254 | 254 | return ''; |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * plusieurs espaces réservés ajoutés à la fois. |
45 | 45 | * |
46 | 46 | * @param array|string $placeholder |
47 | - * |
|
48 | - * @return mixed |
|
47 | + * |
|
48 | + * @return mixed |
|
49 | 49 | */ |
50 | 50 | public function addPlaceholder($placeholder, ?string $pattern = null); |
51 | 51 | |
@@ -164,20 +164,20 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function getRedirectCode(string $from): int; |
166 | 166 | |
167 | - /** |
|
167 | + /** |
|
168 | 168 | * Renvoie la valeur actuelle du paramètre translateURIDashes. |
169 | 169 | */ |
170 | 170 | public function shouldTranslateURIDashes(): bool; |
171 | 171 | |
172 | - /** |
|
172 | + /** |
|
173 | 173 | * Indique au système s'il faut convertir les tirets des chaînes URI en traits de soulignement. |
174 | - * Dans certains moteurs de recherche, y compris Google, les tirets créent plus de sens et permettent au moteur de recherche |
|
175 | - * de trouver plus facilement des mots et une signification dans l'URI pour un meilleur référencement. |
|
176 | - * Mais cela ne fonctionne pas bien avec les noms de méthodes PHP... |
|
174 | + * Dans certains moteurs de recherche, y compris Google, les tirets créent plus de sens et permettent au moteur de recherche |
|
175 | + * de trouver plus facilement des mots et une signification dans l'URI pour un meilleur référencement. |
|
176 | + * Mais cela ne fonctionne pas bien avec les noms de méthodes PHP... |
|
177 | 177 | */ |
178 | 178 | public function setTranslateURIDashes(bool $value): self; |
179 | 179 | |
180 | - /** |
|
180 | + /** |
|
181 | 181 | * Obtenez tous les contrôleurs dans Route Handlers |
182 | 182 | * |
183 | 183 | * @param string|null $verbe HTTP verbe. `'*'` renvoie tous les contrôleurs dans n'importe quel verbe. |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * Returns the "last" row of the current results. |
57 | 57 | * |
58 | - * @param string|int $type Le type d'objet de résultat. 'tableau', 'objet', nom de classe ou constante d'extraction PDO. |
|
59 | - * |
|
58 | + * @param string|int $type Le type d'objet de résultat. 'tableau', 'objet', nom de classe ou constante d'extraction PDO. |
|
59 | + * |
|
60 | 60 | * @return mixed |
61 | 61 | */ |
62 | 62 | public function last($type = 'object'); |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * Renvoie la ligne "suivante" des résultats actuels. |
66 | 66 | * |
67 | - * @param string|int $type Le type d'objet de résultat. 'tableau', 'objet', nom de classe ou constante d'extraction PDO. |
|
68 | - * |
|
67 | + * @param string|int $type Le type d'objet de résultat. 'tableau', 'objet', nom de classe ou constante d'extraction PDO. |
|
68 | + * |
|
69 | 69 | * @return mixed |
70 | 70 | */ |
71 | 71 | public function next($type = 'object'); |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | /** |
74 | 74 | * Renvoie la ligne "précédente" des résultats actuels. |
75 | 75 | * |
76 | - * @param string|int $type Le type d'objet de résultat. 'tableau', 'objet', nom de classe ou constante d'extraction PDO. |
|
77 | - * |
|
76 | + * @param string|int $type Le type d'objet de résultat. 'tableau', 'objet', nom de classe ou constante d'extraction PDO. |
|
77 | + * |
|
78 | 78 | * @return mixed |
79 | 79 | */ |
80 | 80 | public function previous($type = 'object'); |
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Renvoie une ligne non tamponnée et déplace le pointeur vers la ligne suivante. |
84 | - * |
|
85 | - * @param string|int $type Le type d'objet de résultat. 'tableau', 'objet', nom de classe ou constante d'extraction PDO. |
|
84 | + * |
|
85 | + * @param string|int $type Le type d'objet de résultat. 'tableau', 'objet', nom de classe ou constante d'extraction PDO. |
|
86 | 86 | * |
87 | 87 | * @return mixed |
88 | 88 | */ |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Renvoie l'objet de connexion réel. Si une connexion 'lecture' et 'écriture' a été spécifiée, |
40 | - * vous pouvez transmettre l'un ou l'autre terme pour obtenir cette connexion. |
|
41 | - * Si vous transmettez l'un ou l'autre des alias et qu'une seule connexion est présente, il doit renvoyer la seule connexion. |
|
40 | + * vous pouvez transmettre l'un ou l'autre terme pour obtenir cette connexion. |
|
41 | + * Si vous transmettez l'un ou l'autre des alias et qu'une seule connexion est présente, il doit renvoyer la seule connexion. |
|
42 | 42 | * |
43 | 43 | * @return mixed |
44 | 44 | */ |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | |
78 | 78 | /** |
79 | 79 | * Orchestre une requête sur la base de données. |
80 | - * Les requêtes doivent utiliser des objets Database\Statement pour stocker la requête et la construire. |
|
81 | - * Cette méthode fonctionne avec le cache. |
|
80 | + * Les requêtes doivent utiliser des objets Database\Statement pour stocker la requête et la construire. |
|
81 | + * Cette méthode fonctionne avec le cache. |
|
82 | 82 | * |
83 | 83 | * Doit gérer automatiquement différentes connexions pour les requêtes de lecture/écriture si nécessaire. |
84 | 84 | * |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | |
91 | 91 | /** |
92 | 92 | * Effectue une requête de base sur la base de données. |
93 | - * Aucune liaison ou mise en cache n'est effectuée, et les transactions ne sont pas traitées. |
|
94 | - * Prend simplement une chaîne de requête brute et renvoie l'ID de résultat spécifique à la base de données. |
|
93 | + * Aucune liaison ou mise en cache n'est effectuée, et les transactions ne sont pas traitées. |
|
94 | + * Prend simplement une chaîne de requête brute et renvoie l'ID de résultat spécifique à la base de données. |
|
95 | 95 | * |
96 | 96 | * @return mixed |
97 | 97 | */ |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | class Inflector |
12 | 12 | { |
13 | 13 | /** |
14 | - * Plural inflector rules |
|
15 | - * |
|
16 | - * @var array |
|
17 | - */ |
|
14 | + * Plural inflector rules |
|
15 | + * |
|
16 | + * @var array |
|
17 | + */ |
|
18 | 18 | protected static $_plural = [ |
19 | 19 | '/(s)tatus$/i' => '\1tatuses', |
20 | 20 | '/(quiz)$/i' => '\1zes', |
@@ -418,13 +418,13 @@ discard block |
||
418 | 418 | $key = '_' . $key; |
419 | 419 | $type = '_' . $type; |
420 | 420 | if ($value !== false) |
421 | - { |
|
421 | + { |
|
422 | 422 | static::$_cache[$type][$key] = $value; |
423 | 423 | |
424 | 424 | return $value; |
425 | 425 | } |
426 | 426 | if (!isset(static::$_cache[$type][$key])) |
427 | - { |
|
427 | + { |
|
428 | 428 | return false; |
429 | 429 | } |
430 | 430 | |
@@ -440,15 +440,15 @@ discard block |
||
440 | 440 | public static function reset() |
441 | 441 | { |
442 | 442 | if (empty(static::$_initialState)) |
443 | - { |
|
443 | + { |
|
444 | 444 | static::$_initialState = get_class_vars(__CLASS__); |
445 | 445 | |
446 | 446 | return; |
447 | 447 | } |
448 | 448 | foreach (static::$_initialState As $key => $val) |
449 | - { |
|
449 | + { |
|
450 | 450 | if ($key !== '_initialState') |
451 | - { |
|
451 | + { |
|
452 | 452 | static::${$key} = $val; |
453 | 453 | } |
454 | 454 | } |
@@ -479,18 +479,18 @@ discard block |
||
479 | 479 | $var = '_' . $type; |
480 | 480 | |
481 | 481 | if ($reset) |
482 | - { |
|
482 | + { |
|
483 | 483 | static::${$var} = $rules; |
484 | 484 | } |
485 | - elseif ($type === 'uninflected') |
|
486 | - { |
|
485 | + elseif ($type === 'uninflected') |
|
486 | + { |
|
487 | 487 | static::$_uninflected = array_merge( |
488 | 488 | $rules, |
489 | 489 | static::$_uninflected |
490 | 490 | ); |
491 | 491 | } |
492 | - else |
|
493 | - { |
|
492 | + else |
|
493 | + { |
|
494 | 494 | static::${$var} = $rules + static::${$var}; |
495 | 495 | } |
496 | 496 | |
@@ -506,12 +506,12 @@ discard block |
||
506 | 506 | public static function pluralize(string $word) : string |
507 | 507 | { |
508 | 508 | if (isset(static::$_cache['pluralize'][$word])) |
509 | - { |
|
509 | + { |
|
510 | 510 | return static::$_cache['pluralize'][$word]; |
511 | 511 | } |
512 | 512 | |
513 | 513 | if (!isset(static::$_cache['irregular']['pluralize'])) |
514 | - { |
|
514 | + { |
|
515 | 515 | static::$_cache['irregular']['pluralize'] = '(?:' . implode('|', array_keys(static::$_irregular)) . ')'; |
516 | 516 | } |
517 | 517 | |
@@ -523,28 +523,28 @@ discard block |
||
523 | 523 | } |
524 | 524 | |
525 | 525 | if (!isset(static::$_cache['uninflected'])) |
526 | - { |
|
526 | + { |
|
527 | 527 | static::$_cache['uninflected'] = '(?:' . implode('|', static::$_uninflected) . ')'; |
528 | 528 | } |
529 | 529 | |
530 | 530 | if (preg_match('/^(' . static::$_cache['uninflected'] . ')$/i', $word, $regs)) |
531 | - { |
|
531 | + { |
|
532 | 532 | static::$_cache['pluralize'][$word] = $word; |
533 | 533 | |
534 | 534 | return $word; |
535 | 535 | } |
536 | 536 | |
537 | 537 | foreach (static::$_plural As $rule => $replacement) |
538 | - { |
|
538 | + { |
|
539 | 539 | if (preg_match($rule, $word)) |
540 | - { |
|
540 | + { |
|
541 | 541 | static::$_cache['pluralize'][$word] = preg_replace($rule, $replacement, $word); |
542 | 542 | |
543 | 543 | return static::$_cache['pluralize'][$word]; |
544 | 544 | } |
545 | 545 | } |
546 | 546 | |
547 | - return $word; |
|
547 | + return $word; |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | /** |
@@ -556,17 +556,17 @@ discard block |
||
556 | 556 | public static function singularize (string $word) : string |
557 | 557 | { |
558 | 558 | if (isset(static::$_cache['singularize'][$word])) |
559 | - { |
|
559 | + { |
|
560 | 560 | return static::$_cache['singularize'][$word]; |
561 | 561 | } |
562 | 562 | |
563 | 563 | if (!isset(static::$_cache['irregular']['singular'])) |
564 | - { |
|
564 | + { |
|
565 | 565 | static::$_cache['irregular']['singular'] = '(?:' . implode('|', static::$_irregular) . ')'; |
566 | 566 | } |
567 | 567 | |
568 | 568 | if (preg_match('/(.*?(?:\\b|_))(' . static::$_cache['irregular']['singular'] . ')$/i', $word, $regs)) |
569 | - { |
|
569 | + { |
|
570 | 570 | static::$_cache['singularize'][$word] = $regs[1] . substr($regs[2], 0, 1) . |
571 | 571 | substr(array_search(strtolower($regs[2]), static::$_irregular, true), 1); |
572 | 572 | |
@@ -574,21 +574,21 @@ discard block |
||
574 | 574 | } |
575 | 575 | |
576 | 576 | if (!isset(static::$_cache['uninflected'])) |
577 | - { |
|
577 | + { |
|
578 | 578 | static::$_cache['uninflected'] = '(?:' . implode('|', static::$_uninflected) . ')'; |
579 | 579 | } |
580 | 580 | |
581 | 581 | if (preg_match('/^(' . static::$_cache['uninflected'] . ')$/i', $word, $regs)) |
582 | - { |
|
582 | + { |
|
583 | 583 | static::$_cache['pluralize'][$word] = $word; |
584 | 584 | |
585 | 585 | return $word; |
586 | 586 | } |
587 | 587 | |
588 | 588 | foreach (static::$_singular As $rule => $replacement) |
589 | - { |
|
589 | + { |
|
590 | 590 | if (preg_match($rule, $word)) |
591 | - { |
|
591 | + { |
|
592 | 592 | static::$_cache['singularize'][$word] = preg_replace($rule, $replacement, $word); |
593 | 593 | |
594 | 594 | return static::$_cache['singularize'][$word]; |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | $result = static::_cache($cacheKey, $string); |
614 | 614 | |
615 | 615 | if ($result === false) |
616 | - { |
|
616 | + { |
|
617 | 617 | $result = str_replace(' ', '', static::humanize($string, $delimiter)); |
618 | 618 | static::_cache($cacheKey, $string, $result); |
619 | 619 | } |
@@ -662,10 +662,10 @@ discard block |
||
662 | 662 | $result = static::_cache($cacheKey, $string); |
663 | 663 | |
664 | 664 | if ($result === false) |
665 | - { |
|
665 | + { |
|
666 | 666 | $result = explode(' ', str_replace($delimiter, ' ', $string)); |
667 | 667 | foreach ($result As &$word) |
668 | - { |
|
668 | + { |
|
669 | 669 | $word = mb_strtoupper(mb_substr($word, 0, 1)) . mb_substr($word, 1); |
670 | 670 | } |
671 | 671 | $result = implode(' ', $result); |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | $result = static::_cache($cacheKey, $string); |
690 | 690 | |
691 | 691 | if ($result === false) |
692 | - { |
|
692 | + { |
|
693 | 693 | $result = mb_strtolower(preg_replace('/(?<=\\w)([A-Z])/', $delimiter . '\\1', $string)); |
694 | 694 | static::_cache($cacheKey, $string, $result); |
695 | 695 | } |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | $result = static::_cache(__FUNCTION__, $className); |
709 | 709 | |
710 | 710 | if ($result === false) |
711 | - { |
|
711 | + { |
|
712 | 712 | $result = static::pluralize(static::underscore($className)); |
713 | 713 | static::_cache(__FUNCTION__, $className, $result); |
714 | 714 | } |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | $result = static::_cache(__FUNCTION__, $tableName); |
728 | 728 | |
729 | 729 | if ($result === false) |
730 | - { |
|
730 | + { |
|
731 | 731 | $result = static::camelize(static::singularize($tableName)); |
732 | 732 | static::_cache(__FUNCTION__, $tableName, $result); |
733 | 733 | } |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | $result = static::_cache(__FUNCTION__, $string); |
747 | 747 | |
748 | 748 | if ($result === false) |
749 | - { |
|
749 | + { |
|
750 | 750 | $camelized = static::camelize(static::underscore($string)); |
751 | 751 | $replace = strtolower(substr($camelized, 0, 1)); |
752 | 752 | $result = $replace . substr($camelized, 1); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'script', |
68 | 68 | ]; |
69 | 69 | |
70 | - public static function __callStatic($name, $arguments) |
|
70 | + public static function __callStatic($name, $arguments) |
|
71 | 71 | { |
72 | 72 | /** |
73 | 73 | * Conversion de casse d'ecriture |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | return self::convertTo($arguments[0], $name); |
77 | 77 | } |
78 | 78 | |
79 | - throw new InvalidArgumentException('Unknown method ' . __CLASS__ . '::' . $name); |
|
79 | + throw new InvalidArgumentException('Unknown method ' . __CLASS__ . '::' . $name); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -87,33 +87,33 @@ discard block |
||
87 | 87 | * @param string $converter |
88 | 88 | * @use \Jawira\CaseConverter\Convert |
89 | 89 | */ |
90 | - public static function convertTo(string $str, string $converter): string |
|
91 | - { |
|
92 | - $available_case = [ |
|
93 | - 'camel', |
|
94 | - 'pascal', |
|
95 | - 'snake', |
|
96 | - 'ada', |
|
97 | - 'macro', |
|
98 | - 'kebab', |
|
99 | - 'train', |
|
100 | - 'cobol', |
|
101 | - 'lower', |
|
102 | - 'upper', |
|
103 | - 'title', |
|
104 | - 'sentence', |
|
105 | - 'dot' |
|
106 | - ]; |
|
107 | - |
|
108 | - $converter = preg_replace("#Case$#i", '', $converter); |
|
109 | - $converter = str_replace('to', '', strtolower($converter)); |
|
110 | - |
|
111 | - if (!in_array($converter, $available_case)) { |
|
112 | - throw new InvalidArgumentException("Invalid converter type: `$converter`"); |
|
113 | - } |
|
114 | - |
|
115 | - return call_user_func([new \Jawira\CaseConverter\Convert($str), 'to'.ucfirst($converter)]); |
|
116 | - } |
|
90 | + public static function convertTo(string $str, string $converter): string |
|
91 | + { |
|
92 | + $available_case = [ |
|
93 | + 'camel', |
|
94 | + 'pascal', |
|
95 | + 'snake', |
|
96 | + 'ada', |
|
97 | + 'macro', |
|
98 | + 'kebab', |
|
99 | + 'train', |
|
100 | + 'cobol', |
|
101 | + 'lower', |
|
102 | + 'upper', |
|
103 | + 'title', |
|
104 | + 'sentence', |
|
105 | + 'dot' |
|
106 | + ]; |
|
107 | + |
|
108 | + $converter = preg_replace("#Case$#i", '', $converter); |
|
109 | + $converter = str_replace('to', '', strtolower($converter)); |
|
110 | + |
|
111 | + if (!in_array($converter, $available_case)) { |
|
112 | + throw new InvalidArgumentException("Invalid converter type: `$converter`"); |
|
113 | + } |
|
114 | + |
|
115 | + return call_user_func([new \Jawira\CaseConverter\Convert($str), 'to'.ucfirst($converter)]); |
|
116 | + } |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Return the remainder of a string after a given value. |
@@ -93,7 +93,7 @@ |
||
93 | 93 | */ |
94 | 94 | function show404(string $message = 'The page you requested was not found.', string $heading = 'Page Not Found', array $params = []) |
95 | 95 | { |
96 | - throw PageNotFoundException::pageNotFound($message); |
|
96 | + throw PageNotFoundException::pageNotFound($message); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 |
@@ -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,14 +341,14 @@ 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 | { |
348 | 348 | $name .= (!preg_match('#\.less$#i', $name) ? '.less' : ''); |
349 | 349 | $filename = WEBROOT.'less'.DS.$name; |
350 | 350 | |
351 | - return site_url() . 'less/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
351 | + return site_url() . 'less/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | return $name . (!preg_match('#\.less$#i', $name) ? '.less' : ''); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | function less_styles($name, bool $print = true) |
372 | 372 | { |
373 | 373 | $name = (array) $name; |
374 | - $return = []; |
|
374 | + $return = []; |
|
375 | 375 | |
376 | 376 | foreach ($name As $style) |
377 | 377 | { |
@@ -387,21 +387,21 @@ discard block |
||
387 | 387 | $return[] = "<!-- The specified file do not exist. we can not load it. \n\t"; |
388 | 388 | $return[] = '<link rel="stylesheet" type="text/less" href="'.less_url($style).'" /> -->'; |
389 | 389 | } |
390 | - else |
|
391 | - { |
|
392 | - $return[] = '<link rel="stylesheet" type="text/less" href="'.less_url($style).'" />'; |
|
393 | - } |
|
390 | + else |
|
391 | + { |
|
392 | + $return[] = '<link rel="stylesheet" type="text/less" href="'.less_url($style).'" />'; |
|
393 | + } |
|
394 | 394 | } |
395 | 395 | } |
396 | 396 | |
397 | - $output = join("\n", $return); |
|
397 | + $output = join("\n", $return); |
|
398 | 398 | |
399 | - if (false === $print) |
|
400 | - { |
|
401 | - return $output; |
|
402 | - } |
|
399 | + if (false === $print) |
|
400 | + { |
|
401 | + return $output; |
|
402 | + } |
|
403 | 403 | |
404 | - echo $output; |
|
404 | + echo $output; |
|
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
@@ -421,13 +421,13 @@ discard block |
||
421 | 421 | function img_url(string $name) : string |
422 | 422 | { |
423 | 423 | $name = explode('?', $name)[0]; |
424 | - $name = str_replace(site_url() . 'img/', '', htmlspecialchars($name)); |
|
424 | + $name = str_replace(site_url() . 'img/', '', htmlspecialchars($name)); |
|
425 | 425 | |
426 | 426 | if (is_localfile($name)) |
427 | 427 | { |
428 | 428 | $filename = WEBROOT.'img'.DS.$name; |
429 | 429 | |
430 | - return site_url() . 'img/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
430 | + return site_url() . 'img/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | return $name; |
@@ -452,8 +452,8 @@ discard block |
||
452 | 452 | { |
453 | 453 | $return = '<img src="' . img_url($name) . '" alt="' . $alt . '"'; |
454 | 454 | |
455 | - $noprint = isset($options['print']) AND $options['print'] == false; |
|
456 | - unset($options['print']); |
|
455 | + $noprint = isset($options['print']) AND $options['print'] == false; |
|
456 | + unset($options['print']); |
|
457 | 457 | |
458 | 458 | foreach ($options As $key => $value) |
459 | 459 | { |
@@ -461,10 +461,10 @@ discard block |
||
461 | 461 | } |
462 | 462 | $return .= ' />'; |
463 | 463 | |
464 | - if ($noprint === true) |
|
465 | - { |
|
466 | - return $return; |
|
467 | - } |
|
464 | + if ($noprint === true) |
|
465 | + { |
|
466 | + return $return; |
|
467 | + } |
|
468 | 468 | |
469 | 469 | echo $return; |
470 | 470 | } |
@@ -485,13 +485,13 @@ discard block |
||
485 | 485 | function docs_url(string $name) : string |
486 | 486 | { |
487 | 487 | $name = explode('?', $name)[0]; |
488 | - $name = str_replace(site_url() . 'docs/', '', htmlspecialchars($name)); |
|
488 | + $name = str_replace(site_url() . 'docs/', '', htmlspecialchars($name)); |
|
489 | 489 | |
490 | 490 | if (is_localfile($name)) |
491 | 491 | { |
492 | 492 | $filename = WEBROOT.'docs'.DS.$name; |
493 | 493 | |
494 | - return site_url() . 'docs/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
494 | + return site_url() . 'docs/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | return $name; |
@@ -513,13 +513,13 @@ discard block |
||
513 | 513 | function videos_url(string $name) : string |
514 | 514 | { |
515 | 515 | $name = explode('?', $name)[0]; |
516 | - $name = str_replace(site_url() . 'videos/', '', htmlspecialchars($name)); |
|
516 | + $name = str_replace(site_url() . 'videos/', '', htmlspecialchars($name)); |
|
517 | 517 | |
518 | 518 | if (is_localfile($name)) |
519 | 519 | { |
520 | 520 | $filename = WEBROOT.'videos'.DS.$name; |
521 | 521 | |
522 | - return site_url() . 'videos/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
522 | + return site_url() . 'videos/' . $name.((file_exists($filename)) ? '?v='.filemtime($filename) : ''); |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | return $name; |
@@ -177,36 +177,36 @@ |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
180 | - * Recupère ou modifie le titre de la page |
|
180 | + * Recupère ou modifie le titre de la page |
|
181 | 181 | * |
182 | - * @return string|self |
|
183 | - */ |
|
184 | - public function title(?string $title = null) |
|
185 | - { |
|
186 | - if (empty($title)) { |
|
187 | - return $this->getData()['title'] ?? ''; |
|
188 | - } |
|
182 | + * @return string|self |
|
183 | + */ |
|
184 | + public function title(?string $title = null) |
|
185 | + { |
|
186 | + if (empty($title)) { |
|
187 | + return $this->getData()['title'] ?? ''; |
|
188 | + } |
|
189 | 189 | |
190 | 190 | return $this->setVar('title', $title); |
191 | 191 | } |
192 | 192 | |
193 | - /** |
|
194 | - * Recupère ou modifie les elements de balises "meta" |
|
195 | - * |
|
196 | - * @return string|self |
|
197 | - */ |
|
198 | - public function meta(string $key, ?string $value = null) |
|
199 | - { |
|
193 | + /** |
|
194 | + * Recupère ou modifie les elements de balises "meta" |
|
195 | + * |
|
196 | + * @return string|self |
|
197 | + */ |
|
198 | + public function meta(string $key, ?string $value = null) |
|
199 | + { |
|
200 | 200 | $meta = $this->getData()['meta'] ?? []; |
201 | 201 | |
202 | - if (empty($value)) { |
|
203 | - return $meta[$key] ?? ''; |
|
204 | - } |
|
202 | + if (empty($value)) { |
|
203 | + return $meta[$key] ?? ''; |
|
204 | + } |
|
205 | 205 | |
206 | - $meta[$key] = esc($value); |
|
206 | + $meta[$key] = esc($value); |
|
207 | 207 | |
208 | 208 | return $this->setVar('meta', $meta); |
209 | - } |
|
209 | + } |
|
210 | 210 | |
211 | 211 | /** |
212 | 212 | * Construit la sortie en fonction d'un nom de fichier et de tout données déjà définies. |