@@ -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'); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | 'max' => 5, // number of pages by each paginated pages |
| 55 | 55 | 'path' => 'page', // path to paginated pages (e.g.: `/blog/page/2/`) |
| 56 | 56 | ], |
| 57 | - 'pages' => [ // Markdown content management |
|
| 57 | + 'pages' => [// Markdown content management |
|
| 58 | 58 | 'dir' => 'pages', // pages files directory |
| 59 | 59 | 'ext' => ['md', 'markdown', 'mdown', 'mkdn', 'mkd', 'text', 'txt'], // supported files formats, by extension |
| 60 | 60 | 'exclude' => ['vendor', 'node_modules'], // directories, paths and files name to exclude (accepts globs, strings and regexes) |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | ], |
| 113 | 113 | 'external' => [ |
| 114 | 114 | 'blank' => false, // if true open external link in new tab |
| 115 | - 'noopener' => true, // add "noopener" to `rel` attribute |
|
| 116 | - 'noreferrer' => true, // add "noreferrer" to `rel` attribute |
|
| 117 | - 'nofollow' => true, // add "nofollow" to `rel` attribute |
|
| 115 | + 'noopener' => true, // add "noopener" to `rel` attribute |
|
| 116 | + 'noreferrer' => true, // add "noreferrer" to `rel` attribute |
|
| 117 | + 'nofollow' => true, // add "nofollow" to `rel` attribute |
|
| 118 | 118 | ] |
| 119 | 119 | ], |
| 120 | 120 | 'excerpt' => [ |
@@ -126,18 +126,18 @@ discard block |
||
| 126 | 126 | // <position> => 'Cecil\Generator\<class>', |
| 127 | 127 | //], |
| 128 | 128 | ], |
| 129 | - 'data' => [ // data files |
|
| 129 | + 'data' => [// data files |
|
| 130 | 130 | 'dir' => 'data', // data files directory |
| 131 | 131 | 'ext' => ['yaml', 'yml', 'json', 'xml', 'csv'], // loaded files by extension |
| 132 | 132 | 'load' => true, // enables `site.data` collection |
| 133 | 133 | ], |
| 134 | - 'static' => [ // static files |
|
| 134 | + 'static' => [// static files |
|
| 135 | 135 | 'dir' => 'static', // static files directory |
| 136 | 136 | 'target' => '', // subdirectory where files are copied |
| 137 | 137 | 'exclude' => ['sass', 'scss', '*.scss', 'package*.json', 'node_modules'], // excluded files by extension or pattern |
| 138 | 138 | 'load' => false, // enables `site.static` collection |
| 139 | 139 | ], |
| 140 | - 'assets' => [ // assets: CSS, JS, images, etc. |
|
| 140 | + 'assets' => [// assets: CSS, JS, images, etc. |
|
| 141 | 141 | 'dir' => 'assets', // assets files directory |
| 142 | 142 | 'target' => 'assets', // where processed assets are saved (in output directory) |
| 143 | 143 | 'remote' => [ |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | ], |
| 172 | 172 | 'formats' => [], // `html` filter: creates and adds formats images as `source` (ie "webp" and/or "avif") |
| 173 | 173 | 'cdn' => [ |
| 174 | - 'enabled' => false, // enables Image CDN |
|
| 175 | - 'canonical' => true, // is `image_url` must be canonical or not |
|
| 176 | - 'remote' => true, // includes remote images |
|
| 174 | + 'enabled' => false, // enables Image CDN |
|
| 175 | + 'canonical' => true, // is `image_url` must be canonical or not |
|
| 176 | + 'remote' => true, // includes remote images |
|
| 177 | 177 | //'account' => 'xxxx', // provider account |
| 178 | 178 | // Cloudinary |
| 179 | 179 | //'url' => 'https://res.cloudinary.com/%account%/image/fetch/c_limit,w_%width%,q_%quality%,f_%format%,d_default/%image_url%', |
@@ -186,22 +186,22 @@ discard block |
||
| 186 | 186 | ] |
| 187 | 187 | ], |
| 188 | 188 | ], |
| 189 | - 'layouts' => [ // layouts and templates |
|
| 189 | + 'layouts' => [// layouts and templates |
|
| 190 | 190 | 'dir' => 'layouts', // Twig templates directory |
| 191 | 191 | 'internal' => [ |
| 192 | 192 | 'dir' => 'resources/layouts', // internal templates directory |
| 193 | 193 | ], |
| 194 | - 'translations' => [ // i18n |
|
| 194 | + 'translations' => [// i18n |
|
| 195 | 195 | 'dir' => 'translations', // translations files directory |
| 196 | 196 | 'formats' => ['yaml', 'mo'], // translations supported formats |
| 197 | 197 | 'internal' => [ |
| 198 | 198 | 'dir' => 'resources/translations', // internal translations directory |
| 199 | 199 | ], |
| 200 | 200 | ], |
| 201 | - 'extensions' => [ // list of Twig extensions class |
|
| 201 | + 'extensions' => [// list of Twig extensions class |
|
| 202 | 202 | //'<name>' => 'Cecil\Renderer\Extension\<class>', |
| 203 | 203 | ], |
| 204 | - 'components' => [ // components |
|
| 204 | + 'components' => [// components |
|
| 205 | 205 | 'dir' => 'components', // components directory |
| 206 | 206 | 'ext' => 'twig', // components files extension |
| 207 | 207 | ], |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | 'metatags' => [ |
| 216 | 216 | 'robots' => 'index,follow', // SEO robots default directive |
| 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 |
@@ -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? |