@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @throws RuntimeException |
59 | 59 | */ |
60 | - public function __construct(Builder $builder, string|array $paths, array|null $options = null) |
|
60 | + public function __construct(Builder $builder, string | array $paths, array | null $options = null) |
|
61 | 61 | { |
62 | 62 | $this->builder = $builder; |
63 | 63 | $this->config = $builder->getConfig(); |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | } |
75 | 75 | }); |
76 | 76 | $this->data = [ |
77 | - 'file' => '', // absolute file path |
|
78 | - 'files' => [], // bundle: array of files path |
|
79 | - 'filename' => '', // bundle: filename |
|
80 | - 'path' => '', // public path to the file |
|
81 | - 'url' => null, // URL if it's a remote file |
|
77 | + 'file' => '', // absolute file path |
|
78 | + 'files' => [], // bundle: array of files path |
|
79 | + 'filename' => '', // bundle: filename |
|
80 | + 'path' => '', // public path to the file |
|
81 | + 'url' => null, // URL if it's a remote file |
|
82 | 82 | 'missing' => false, // if file not found but missing allowed: 'missing' is true |
83 | - 'ext' => '', // file extension |
|
84 | - 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
85 | - 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
86 | - 'size' => 0, // file size (in bytes) |
|
87 | - 'width' => 0, // image width (in pixels) |
|
88 | - 'height' => 0, // image height (in pixels) |
|
89 | - 'exif' => [], // exif data |
|
90 | - 'content' => '', // file content |
|
83 | + 'ext' => '', // file extension |
|
84 | + 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
85 | + 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
86 | + 'size' => 0, // file size (in bytes) |
|
87 | + 'width' => 0, // image width (in pixels) |
|
88 | + 'height' => 0, // image height (in pixels) |
|
89 | + 'exif' => [], // exif data |
|
90 | + 'content' => '', // file content |
|
91 | 91 | ]; |
92 | 92 | |
93 | 93 | // handles options |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | public function sanitizeKey(string $key): string |
247 | 247 | { |
248 | 248 | $key = str_replace(['https://', 'http://'], '', $key); // remove protocol (if URL) |
249 | - $key = Page::slugify($key); // slugify |
|
250 | - $key = trim($key, '/'); // remove leading/trailing slashes |
|
251 | - $key = str_replace(['\\', '/'], ['-', '-'], $key); // replace slashes by hyphens |
|
252 | - $key = substr($key, 0, 200); // truncate to 200 characters (NTFS filename length limit is 255 characters) |
|
249 | + $key = Page::slugify($key); // slugify |
|
250 | + $key = trim($key, '/'); // remove leading/trailing slashes |
|
251 | + $key = str_replace(['\\', '/'], ['-', '-'], $key); // replace slashes by hyphens |
|
252 | + $key = substr($key, 0, 200); // truncate to 200 characters (NTFS filename length limit is 255 characters) |
|
253 | 253 | |
254 | 254 | return $key; |
255 | 255 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | /** |
299 | 299 | * Convert the various expressions of a TTL value into duration in seconds. |
300 | 300 | */ |
301 | - protected function duration(\DateInterval|int|null $ttl): int |
|
301 | + protected function duration(\DateInterval | int | null $ttl): int |
|
302 | 302 | { |
303 | 303 | if ($ttl === null) { |
304 | 304 | return $this->duration; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | return $ttl; |
308 | 308 | } |
309 | 309 | if ($ttl instanceof \DateInterval) { |
310 | - return (int)$ttl->format('%s'); |
|
310 | + return (int) $ttl->format('%s'); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | throw new \InvalidArgumentException('TTL values must be one of null, int, \DateInterval'); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @return Asset |
284 | 284 | */ |
285 | - public function asset($path, array|null $options = null): Asset |
|
285 | + public function asset($path, array | null $options = null): Asset |
|
286 | 286 | { |
287 | 287 | if (!\is_string($path) && !\is_array($path)) { |
288 | 288 | throw new RuntimeException(\sprintf('Argument of "%s()" must a string or an array.', \Cecil\Util::formatMethodName(__METHOD__))); |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | /** |
934 | 934 | * Hashing an object, an array or a string (with algo, md5 by default). |
935 | 935 | */ |
936 | - public function hash(object|array|string $data, $algo = 'md5'): string |
|
936 | + public function hash(object | array | string $data, $algo = 'md5'): string |
|
937 | 937 | { |
938 | 938 | switch (\gettype($data)) { |
939 | 939 | case 'object': |
@@ -53,8 +53,8 @@ |
||
53 | 53 | |
54 | 54 | // handles options |
55 | 55 | $canonical = null; // if true prefix url with baseurl config |
56 | - $format = null; // output format |
|
57 | - $language = null; // force language |
|
56 | + $format = null; // output format |
|
57 | + $language = null; // force language |
|
58 | 58 | extract(\is_array($options) ? $options : [], EXTR_IF_EXISTS); |
59 | 59 | |
60 | 60 | // canonical URL? |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | //'taxonomies' => [ // can be disabled with the special "disabled" value |
54 | 54 | // '<plural>' => '<vocabulary>', |
55 | 55 | //], |
56 | - 'pages' => [ // Markdown content management |
|
56 | + 'pages' => [// Markdown content management |
|
57 | 57 | 'dir' => 'pages', // pages files directory |
58 | 58 | 'ext' => ['md', 'markdown', 'mdown', 'mkdn', 'mkd', 'text', 'txt'], // supported files formats, by extension |
59 | 59 | 'exclude' => ['vendor', 'node_modules'], // directories, paths and files name to exclude (accepts globs, strings and regexes) |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | ], |
112 | 112 | 'external' => [ |
113 | 113 | 'blank' => false, // if true open external link in new tab |
114 | - 'noopener' => true, // add "noopener" to `rel` attribute |
|
115 | - 'noreferrer' => true, // add "noreferrer" to `rel` attribute |
|
116 | - 'nofollow' => true, // add "nofollow" to `rel` attribute |
|
114 | + 'noopener' => true, // add "noopener" to `rel` attribute |
|
115 | + 'noreferrer' => true, // add "noreferrer" to `rel` attribute |
|
116 | + 'nofollow' => true, // add "nofollow" to `rel` attribute |
|
117 | 117 | ] |
118 | 118 | ], |
119 | 119 | 'excerpt' => [ |
@@ -129,18 +129,18 @@ discard block |
||
129 | 129 | // <position> => 'Cecil\Generator\<class>', |
130 | 130 | //], |
131 | 131 | ], |
132 | - 'data' => [ // data files |
|
132 | + 'data' => [// data files |
|
133 | 133 | 'dir' => 'data', // data files directory |
134 | 134 | 'ext' => ['yaml', 'yml', 'json', 'xml', 'csv'], // loaded files by extension |
135 | 135 | 'load' => true, // enables `site.data` collection |
136 | 136 | ], |
137 | - 'static' => [ // static files |
|
137 | + 'static' => [// static files |
|
138 | 138 | 'dir' => 'static', // static files directory |
139 | 139 | 'target' => '', // subdirectory where files are copied |
140 | 140 | 'exclude' => ['sass', 'scss', '*.scss', 'package*.json', 'node_modules'], // excluded files by extension or pattern |
141 | 141 | 'load' => false, // enables `site.static` collection |
142 | 142 | ], |
143 | - 'assets' => [ // assets: CSS, JS, images, etc. |
|
143 | + 'assets' => [// assets: CSS, JS, images, etc. |
|
144 | 144 | 'dir' => 'assets', // assets files directory |
145 | 145 | 'target' => 'assets', // where processed assets are saved (in output directory) |
146 | 146 | 'remote' => [ |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | ], |
175 | 175 | 'formats' => [], // `html` filter: creates and adds formats images as `source` (ie "webp" and/or "avif") |
176 | 176 | 'cdn' => [ |
177 | - 'enabled' => false, // enables Image CDN |
|
178 | - 'canonical' => true, // is `image_url` must be canonical or not |
|
179 | - 'remote' => true, // includes remote images |
|
177 | + 'enabled' => false, // enables Image CDN |
|
178 | + 'canonical' => true, // is `image_url` must be canonical or not |
|
179 | + 'remote' => true, // includes remote images |
|
180 | 180 | //'account' => 'xxxx', // provider account |
181 | 181 | // Cloudinary |
182 | 182 | //'url' => 'https://res.cloudinary.com/%account%/image/fetch/c_limit,w_%width%,q_%quality%,f_%format%,d_default/%image_url%', |
@@ -189,22 +189,22 @@ discard block |
||
189 | 189 | ] |
190 | 190 | ], |
191 | 191 | ], |
192 | - 'layouts' => [ // layouts and templates |
|
192 | + 'layouts' => [// layouts and templates |
|
193 | 193 | 'dir' => 'layouts', // Twig templates directory |
194 | 194 | 'internal' => [ |
195 | 195 | 'dir' => 'resources/layouts', // internal templates directory |
196 | 196 | ], |
197 | - 'translations' => [ // i18n |
|
197 | + 'translations' => [// i18n |
|
198 | 198 | 'dir' => 'translations', // translations files directory |
199 | 199 | 'formats' => ['yaml', 'mo'], // translations supported formats |
200 | 200 | 'internal' => [ |
201 | 201 | 'dir' => 'resources/translations', // internal translations directory |
202 | 202 | ], |
203 | 203 | ], |
204 | - 'extensions' => [ // list of Twig extensions class |
|
204 | + 'extensions' => [// list of Twig extensions class |
|
205 | 205 | //'<name>' => 'Cecil\Renderer\Extension\<class>', |
206 | 206 | ], |
207 | - 'components' => [ // components |
|
207 | + 'components' => [// components |
|
208 | 208 | 'dir' => 'components', // components directory |
209 | 209 | 'ext' => 'twig', // components files extension |
210 | 210 | ], |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | 'themes' => [ |
216 | 216 | 'dir' => 'themes', // where themes are stored |
217 | 217 | ], |
218 | - 'output' => [ // output formats and post process |
|
218 | + 'output' => [// output formats and post process |
|
219 | 219 | 'dir' => '_site', // output directory |
220 | 220 | //'formats' => [ // https://cecil.app/documentation/configuration/#formats |
221 | 221 | // [ |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // 'exclude' => ['variable1', 'variable2'], |
227 | 227 | // ], |
228 | 228 | //], |
229 | - 'pagetypeformats' => [ // formats applied by page type |
|
229 | + 'pagetypeformats' => [// formats applied by page type |
|
230 | 230 | 'page' => ['html'], |
231 | 231 | 'homepage' => ['html', 'atom'], |
232 | 232 | 'section' => ['html', 'atom'], |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | // '<name>' => 'Cecil\Renderer\PostProcessor\<class>', |
238 | 238 | //], |
239 | 239 | ], |
240 | - 'cache' => [ // cache management |
|
240 | + 'cache' => [// cache management |
|
241 | 241 | 'enabled' => true, // enables cache support |
242 | 242 | 'dir' => '.cache', // cache files directory |
243 | 243 | 'templates' => [ |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | 'dir' => 'translations', // translations files cache directory |
256 | 256 | ], |
257 | 257 | ], |
258 | - 'optimize' => [ // files optimization |
|
258 | + 'optimize' => [// files optimization |
|
259 | 259 | 'enabled' => false, // enables files optimization |
260 | 260 | 'html' => [ |
261 | 261 | 'enabled' => true, // enables HTML files optimization |