@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @throws RuntimeException |
| 64 | 64 | */ |
| 65 | - public function __construct(Builder $builder, string|array $paths, array|null $options = null) |
|
| 65 | + public function __construct(Builder $builder, string | array $paths, array | null $options = null) |
|
| 66 | 66 | { |
| 67 | 67 | $this->builder = $builder; |
| 68 | 68 | $this->config = $builder->getConfig(); |
@@ -83,21 +83,21 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | }); |
| 85 | 85 | $this->data = [ |
| 86 | - 'file' => '', // absolute file path |
|
| 87 | - 'files' => [], // array of absolute files path |
|
| 86 | + 'file' => '', // absolute file path |
|
| 87 | + 'files' => [], // array of absolute files path |
|
| 88 | 88 | 'missing' => false, // if file not found but missing allowed: 'missing' is true |
| 89 | - '_path' => '', // original path |
|
| 90 | - 'path' => '', // public path |
|
| 91 | - 'url' => null, // URL if it's a remote file |
|
| 92 | - 'ext' => '', // file extension |
|
| 93 | - 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
| 94 | - 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
| 95 | - 'size' => 0, // file size (in bytes) |
|
| 96 | - 'width' => 0, // image width (in pixels) |
|
| 97 | - 'height' => 0, // image height (in pixels) |
|
| 98 | - 'exif' => [], // image exif data |
|
| 99 | - 'content' => '', // file content |
|
| 100 | - 'hash' => '', // file content hash (md5) |
|
| 89 | + '_path' => '', // original path |
|
| 90 | + 'path' => '', // public path |
|
| 91 | + 'url' => null, // URL if it's a remote file |
|
| 92 | + 'ext' => '', // file extension |
|
| 93 | + 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
| 94 | + 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
| 95 | + 'size' => 0, // file size (in bytes) |
|
| 96 | + 'width' => 0, // image width (in pixels) |
|
| 97 | + 'height' => 0, // image height (in pixels) |
|
| 98 | + 'exif' => [], // image exif data |
|
| 99 | + 'content' => '', // file content |
|
| 100 | + 'hash' => '', // file content hash (md5) |
|
| 101 | 101 | ]; |
| 102 | 102 | |
| 103 | 103 | // handles options |
@@ -289,10 +289,10 @@ discard block |
||
| 289 | 289 | public static function sanitizeKey(string $key): string |
| 290 | 290 | { |
| 291 | 291 | $key = str_replace(['https://', 'http://'], '', $key); // remove protocol (if URL) |
| 292 | - $key = Page::slugify($key); // slugify |
|
| 293 | - $key = trim($key, '/'); // remove leading/trailing slashes |
|
| 294 | - $key = str_replace(['\\', '/'], ['-', '-'], $key); // replace slashes by hyphens |
|
| 295 | - $key = substr($key, 0, 200); // truncate to 200 characters (NTFS filename length limit is 255 characters) |
|
| 292 | + $key = Page::slugify($key); // slugify |
|
| 293 | + $key = trim($key, '/'); // remove leading/trailing slashes |
|
| 294 | + $key = str_replace(['\\', '/'], ['-', '-'], $key); // replace slashes by hyphens |
|
| 295 | + $key = substr($key, 0, 200); // truncate to 200 characters (NTFS filename length limit is 255 characters) |
|
| 296 | 296 | |
| 297 | 297 | return $key; |
| 298 | 298 | } |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | /** |
| 326 | 326 | * Convert the various expressions of a TTL value into duration in seconds. |
| 327 | 327 | */ |
| 328 | - protected function duration(int|\DateInterval $ttl): int |
|
| 328 | + protected function duration(int | \DateInterval $ttl): int |
|
| 329 | 329 | { |
| 330 | 330 | if (\is_int($ttl)) { |
| 331 | 331 | return $ttl; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | case PageType::VOCABULARY->value: |
| 135 | 135 | $layouts = [ |
| 136 | 136 | // "taxonomy/$plural.$format.$ext", // e.g.: taxonomy/tags.html.twig |
| 137 | - "vocabulary.$format.$ext", // e.g.: vocabulary.html.twig |
|
| 137 | + "vocabulary.$format.$ext", // e.g.: vocabulary.html.twig |
|
| 138 | 138 | "_default/vocabulary.$format.$ext", // e.g.: _default/vocabulary.html.twig |
| 139 | 139 | ]; |
| 140 | 140 | if ($page->hasVariable('plural')) { |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | $layouts = [ |
| 146 | 146 | // "taxonomy/$term.$format.$ext", // e.g.: taxonomy/velo.html.twig |
| 147 | 147 | // "taxonomy/$singular.$format.$ext", // e.g.: taxonomy/tag.html.twig |
| 148 | - "term.$format.$ext", // e.g.: term.html.twig |
|
| 149 | - "_default/term.$format.$ext", // e.g.: _default/term.html.twig |
|
| 150 | - "_default/list.$format.$ext", // e.g.: _default/list.html.twig |
|
| 148 | + "term.$format.$ext", // e.g.: term.html.twig |
|
| 149 | + "_default/term.$format.$ext", // e.g.: _default/term.html.twig |
|
| 150 | + "_default/list.$format.$ext", // e.g.: _default/list.html.twig |
|
| 151 | 151 | ]; |
| 152 | 152 | if ($page->hasVariable('term')) { |
| 153 | 153 | $layouts = array_merge(["taxonomy/{$page->getVariable('term')}.$format.$ext"], $layouts); |
@@ -79,81 +79,81 @@ |
||
| 79 | 79 | ], |
| 80 | 80 | 'output' => [ |
| 81 | 81 | 'formats' => [ |
| 82 | - [ // e.g.: blog/post-1/index.html |
|
| 82 | + [// e.g.: blog/post-1/index.html |
|
| 83 | 83 | 'name' => 'html', |
| 84 | 84 | 'mediatype' => 'text/html', |
| 85 | 85 | 'filename' => 'index', |
| 86 | 86 | 'extension' => 'html', |
| 87 | 87 | ], |
| 88 | - [ // e.g.: blog/atom.xml |
|
| 88 | + [// e.g.: blog/atom.xml |
|
| 89 | 89 | 'name' => 'atom', |
| 90 | 90 | 'mediatype' => 'application/atom+xml', |
| 91 | 91 | 'filename' => 'atom', |
| 92 | 92 | 'extension' => 'xml', |
| 93 | 93 | 'exclude' => ['redirect', 'paginated'], |
| 94 | 94 | ], |
| 95 | - [ // e.g.: blog/rss.xml |
|
| 95 | + [// e.g.: blog/rss.xml |
|
| 96 | 96 | 'name' => 'rss', |
| 97 | 97 | 'mediatype' => 'application/rss+xml', |
| 98 | 98 | 'filename' => 'rss', |
| 99 | 99 | 'extension' => 'xml', |
| 100 | 100 | 'exclude' => ['redirect', 'paginated'], |
| 101 | 101 | ], |
| 102 | - [ // e.g.: blog.json |
|
| 102 | + [// e.g.: blog.json |
|
| 103 | 103 | 'name' => 'json', |
| 104 | 104 | 'mediatype' => 'application/json', |
| 105 | 105 | 'extension' => 'json', |
| 106 | 106 | 'exclude' => ['redirect'], |
| 107 | 107 | ], |
| 108 | - [ // e.g.: blog.xml |
|
| 108 | + [// e.g.: blog.xml |
|
| 109 | 109 | 'name' => 'xml', |
| 110 | 110 | 'mediatype' => 'application/xml', |
| 111 | 111 | 'extension' => 'xml', |
| 112 | 112 | 'exclude' => ['redirect'], |
| 113 | 113 | ], |
| 114 | - [ // e.g.: robots.txt |
|
| 114 | + [// e.g.: robots.txt |
|
| 115 | 115 | 'name' => 'txt', |
| 116 | 116 | 'mediatype' => 'text/plain', |
| 117 | 117 | 'extension' => 'txt', |
| 118 | 118 | 'exclude' => ['redirect'], |
| 119 | 119 | ], |
| 120 | - [ // e.g.: blog/post-1/amp/index.html |
|
| 120 | + [// e.g.: blog/post-1/amp/index.html |
|
| 121 | 121 | 'name' => 'amp', |
| 122 | 122 | 'mediatype' => 'text/html', |
| 123 | 123 | 'subpath' => 'amp', |
| 124 | 124 | 'filename' => 'index', |
| 125 | 125 | 'extension' => 'html', |
| 126 | 126 | ], |
| 127 | - [ // e.g.: sw.js |
|
| 127 | + [// e.g.: sw.js |
|
| 128 | 128 | 'name' => 'js', |
| 129 | 129 | 'mediatype' => 'application/javascript', |
| 130 | 130 | 'extension' => 'js', |
| 131 | 131 | ], |
| 132 | - [ // e.g.: manifest.webmanifest |
|
| 132 | + [// e.g.: manifest.webmanifest |
|
| 133 | 133 | 'name' => 'webmanifest', |
| 134 | 134 | 'mediatype' => 'application/manifest+json', |
| 135 | 135 | 'extension' => 'webmanifest', |
| 136 | 136 | ], |
| 137 | - [ // e.g.: atom.xsl |
|
| 137 | + [// e.g.: atom.xsl |
|
| 138 | 138 | 'name' => 'xsl', |
| 139 | 139 | 'mediatype' => 'application/xml', |
| 140 | 140 | 'extension' => 'xsl', |
| 141 | 141 | ], |
| 142 | - [ // e.g.: blog/feed.json |
|
| 142 | + [// e.g.: blog/feed.json |
|
| 143 | 143 | 'name' => 'jsonfeed', |
| 144 | 144 | 'mediatype' => 'application/json', |
| 145 | 145 | 'filename' => 'feed', |
| 146 | 146 | 'extension' => 'json', |
| 147 | 147 | 'exclude' => ['redirect', 'paginated'], |
| 148 | 148 | ], |
| 149 | - [ // e.g.: video/oembed.json |
|
| 149 | + [// e.g.: video/oembed.json |
|
| 150 | 150 | 'name' => 'oembed', |
| 151 | 151 | 'mediatype' => 'application/json+oembed', |
| 152 | 152 | 'filename' => 'oembed', |
| 153 | 153 | 'extension' => 'json', |
| 154 | 154 | 'exclude' => ['redirect', 'paginated'], |
| 155 | 155 | ], |
| 156 | - [ // e.g.: video/embed.html |
|
| 156 | + [// e.g.: video/embed.html |
|
| 157 | 157 | 'name' => 'embed', |
| 158 | 158 | 'mediatype' => 'text/html', |
| 159 | 159 | 'filename' => 'embed', |