@@ -119,7 +119,7 @@ |
||
| 119 | 119 | /** |
| 120 | 120 | * Adds navigation (next and prev) to each pages of a section. |
| 121 | 121 | */ |
| 122 | - protected function addNavigationLinks(PagesCollection $pages, string|null $sortBy = null, bool $circular = false): void |
|
| 122 | + protected function addNavigationLinks(PagesCollection $pages, string | null $sortBy = null, bool $circular = false): void |
|
| 123 | 123 | { |
| 124 | 124 | $pagesAsArray = $pages->toArray(); |
| 125 | 125 | if ($sortBy === null || $sortBy == 'date' || $sortBy == 'updated') { |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * |
| 303 | 303 | * @return Asset |
| 304 | 304 | */ |
| 305 | - public function asset($path, array|null $options = null): Asset |
|
| 305 | + public function asset($path, array | null $options = null): Asset |
|
| 306 | 306 | { |
| 307 | 307 | if (!\is_string($path) && !\is_array($path)) { |
| 308 | 308 | throw new RuntimeException(\sprintf('Argument of "%s()" must a string or an array.', \Cecil\Util::formatMethodName(__METHOD__))); |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | * |
| 534 | 534 | * @throws RuntimeException |
| 535 | 535 | */ |
| 536 | - public function html(array $context, Asset|array $assets, array $attributes = [], array $options = []): string |
|
| 536 | + public function html(array $context, Asset | array $assets, array $attributes = [], array $options = []): string |
|
| 537 | 537 | { |
| 538 | 538 | $html = array(); |
| 539 | 539 | if (!\is_array($assets)) { |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | /** |
| 1067 | 1067 | * Hashing an object, an array or a string (with algo, md5 by default). |
| 1068 | 1068 | */ |
| 1069 | - public function hash(object|array|string $data, $algo = 'md5'): string |
|
| 1069 | + public function hash(object | array | string $data, $algo = 'md5'): string |
|
| 1070 | 1070 | { |
| 1071 | 1071 | switch (\gettype($data)) { |
| 1072 | 1072 | case 'object': |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | 'metatags' => [ |
| 66 | 66 | 'robots' => 'index,follow', // SEO robots default directive |
| 67 | 67 | ], |
| 68 | - 'pages' => [ // Markdown content management |
|
| 68 | + 'pages' => [// Markdown content management |
|
| 69 | 69 | 'dir' => 'pages', // pages files directory |
| 70 | 70 | 'ext' => ['md', 'markdown', 'mdown', 'mkdn', 'mkd', 'text', 'txt'], // supported files formats, by extension |
| 71 | 71 | 'exclude' => ['vendor', 'node_modules'], // directories, paths and files name to exclude (accepts globs, strings and regexes) |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | 'caption' => false, // puts the image in a <figure> element and adds a <figcaption> containing the title |
| 100 | 100 | 'placeholder' => '', // fill <img> background before loading (`color` or `lqip`) |
| 101 | 101 | 'class' => '', // puts default CSS class(es) to each image |
| 102 | - 'remote' => [ // turns remote images into Assets to process them (disable with `false`) |
|
| 102 | + 'remote' => [// turns remote images into Assets to process them (disable with `false`) |
|
| 103 | 103 | 'fallback' => '', // path to the fallback image, stored in assets directory (empty by default) |
| 104 | 104 | ], |
| 105 | 105 | ], |
| 106 | 106 | 'links' => [ |
| 107 | - 'embed' => [ // turns links in embedded content if possible |
|
| 107 | + 'embed' => [// turns links in embedded content if possible |
|
| 108 | 108 | 'enabled' => false, |
| 109 | 109 | 'video' => ['mp4', 'webm'], // supported video file types, by extension |
| 110 | 110 | 'audio' => ['mp3', 'ogg', 'wav'], // supported audio file types, by extension |
@@ -125,16 +125,16 @@ discard block |
||
| 125 | 125 | // <position> => 'Cecil\Generator\<class>', |
| 126 | 126 | //], |
| 127 | 127 | ], |
| 128 | - 'data' => [ // data files |
|
| 128 | + 'data' => [// data files |
|
| 129 | 129 | 'dir' => 'data', // data files directory |
| 130 | 130 | 'ext' => ['yaml', 'yml', 'json', 'xml', 'csv'], // loaded files by extension |
| 131 | 131 | 'load' => true, // enables `site.data` collection |
| 132 | 132 | ], |
| 133 | - 'assets' => [ // assets: CSS, JS, images, etc. |
|
| 133 | + 'assets' => [// assets: CSS, JS, images, etc. |
|
| 134 | 134 | 'dir' => 'assets', // assets files directory |
| 135 | 135 | 'target' => '', // where processed assets are saved (in output directory) |
| 136 | 136 | 'fingerprint' => true, // enables fingerprinting |
| 137 | - 'compile' => [ // Sass files compilation |
|
| 137 | + 'compile' => [// Sass files compilation |
|
| 138 | 138 | 'style' => 'expanded', // compilation style (`expanded` or `compressed`) |
| 139 | 139 | 'import' => ['sass', 'scss', 'node_modules'], // list of imported directories |
| 140 | 140 | 'sourcemap' => false, // enables sourcemap in debug mode |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | 'images' => [ |
| 152 | 152 | 'optimize' => false, // enables images optimization with JpegOptim, Optipng, Pngquant 2, SVGO 1, Gifsicle, cwebp, avifenc |
| 153 | 153 | 'quality' => 75, // image quality after optimization or resize |
| 154 | - 'responsive' => [ // options of generated responsive images |
|
| 154 | + 'responsive' => [// options of generated responsive images |
|
| 155 | 155 | 'widths' => [480, 640, 768, 1024, 1366, 1600, 1920], // `srcset` widths |
| 156 | 156 | 'sizes' => ['default' => '100vw'], // default `sizes` attribute |
| 157 | 157 | 'densities' => [1, 2, 3], // `srcset` pixel densities |
@@ -166,26 +166,26 @@ discard block |
||
| 166 | 166 | //] |
| 167 | 167 | ], |
| 168 | 168 | ], |
| 169 | - 'static' => [ // static files |
|
| 169 | + 'static' => [// static files |
|
| 170 | 170 | 'dir' => 'static', // static files directory |
| 171 | 171 | 'target' => '', // subdirectory where files are copied |
| 172 | 172 | 'exclude' => ['sass', 'scss', '*.scss', 'package*.json', 'node_modules'], // excluded files by extension or pattern |
| 173 | 173 | 'load' => false, // enables `site.static` collection |
| 174 | 174 | ], |
| 175 | - 'layouts' => [ // layouts and templates |
|
| 175 | + 'layouts' => [// layouts and templates |
|
| 176 | 176 | 'dir' => 'layouts', // Twig templates directory |
| 177 | - 'images' => [ // how to handle images in templates |
|
| 177 | + 'images' => [// how to handle images in templates |
|
| 178 | 178 | 'formats' => [], // used by `html` function: adds alternatives image formats as `source` (e.g.: ['avif', 'webp']) |
| 179 | 179 | 'responsive' => false, // used by `html` function: adds responsive images ('width' or 'density') to `srcset` attribute |
| 180 | 180 | ], |
| 181 | - 'translations' => [ // i18n |
|
| 181 | + 'translations' => [// i18n |
|
| 182 | 182 | 'dir' => 'translations', // translations files directory |
| 183 | 183 | 'formats' => ['yaml', 'mo'], // translations supported formats |
| 184 | 184 | ], |
| 185 | - 'extensions' => [ // list of Twig extensions class |
|
| 185 | + 'extensions' => [// list of Twig extensions class |
|
| 186 | 186 | //'<name>' => 'Cecil\Renderer\Extension\<class>', |
| 187 | 187 | ], |
| 188 | - 'components' => [ // components |
|
| 188 | + 'components' => [// components |
|
| 189 | 189 | 'dir' => 'components', // components directory |
| 190 | 190 | 'ext' => 'twig', // components files extension |
| 191 | 191 | ], |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | // '<section>' => '<layout>', |
| 194 | 194 | //] |
| 195 | 195 | ], |
| 196 | - 'output' => [ // output formats and post process |
|
| 196 | + 'output' => [// output formats and post process |
|
| 197 | 197 | 'dir' => '_site', // output directory |
| 198 | 198 | //'formats' => [ // https://cecil.app/documentation/configuration/#formats |
| 199 | 199 | // [ |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | // 'exclude' => ['variable1', 'variable2'], |
| 205 | 205 | // ], |
| 206 | 206 | //], |
| 207 | - 'pagetypeformats' => [ // formats applied by page type |
|
| 207 | + 'pagetypeformats' => [// formats applied by page type |
|
| 208 | 208 | 'page' => ['html'], |
| 209 | 209 | 'homepage' => ['html', 'atom'], |
| 210 | 210 | 'section' => ['html', 'atom'], |
@@ -215,10 +215,10 @@ discard block |
||
| 215 | 215 | // '<name>' => 'Cecil\Renderer\PostProcessor\<class>', |
| 216 | 216 | //], |
| 217 | 217 | ], |
| 218 | - 'cache' => [ // cache management |
|
| 218 | + 'cache' => [// cache management |
|
| 219 | 219 | 'enabled' => true, // disable with `false` |
| 220 | 220 | 'dir' => '.cache', // cache files root directory |
| 221 | - 'assets' => [ // assets cache |
|
| 221 | + 'assets' => [// assets cache |
|
| 222 | 222 | 'ttl' => null, // assets cache TTL (no expiration by default) |
| 223 | 223 | 'remote' => [ |
| 224 | 224 | 'ttl' => 604800, // remote assets cache TTL (7 days by default) |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | 'templates' => true, // disable Twig templates cache with `false` |
| 228 | 228 | 'translations' => true, // disable translations dictionary cache with `false` |
| 229 | 229 | ], |
| 230 | - 'optimize' => [ // files optimization |
|
| 230 | + 'optimize' => [// files optimization |
|
| 231 | 231 | 'enabled' => false, // enables files optimization |
| 232 | 232 | 'html' => [ |
| 233 | 233 | 'enabled' => true, // enables HTML files optimization |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | * |
| 149 | 149 | * @return array|false An associative array with 'type' and 'url' keys if a match is found, or false otherwise |
| 150 | 150 | */ |
| 151 | - public static function matchesUrlPattern(string $url): array|false |
|
| 151 | + public static function matchesUrlPattern(string $url): array | false |
|
| 152 | 152 | { |
| 153 | 153 | $services = [ |
| 154 | 154 | 'youtube' => [ |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | /** |
| 45 | 45 | * file_get_contents() function with error handler. |
| 46 | 46 | */ |
| 47 | - public static function fileGetContents(string $filename, ?string $userAgent = null): string|false |
|
| 47 | + public static function fileGetContents(string $filename, ?string $userAgent = null): string | false |
|
| 48 | 48 | { |
| 49 | 49 | if (empty($filename)) { |
| 50 | 50 | return false; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * |
| 72 | 72 | * @throws RuntimeException |
| 73 | 73 | */ |
| 74 | - public function __construct(Builder $builder, string|array $paths, array|null $options = null) |
|
| 74 | + public function __construct(Builder $builder, string | array $paths, array | null $options = null) |
|
| 75 | 75 | { |
| 76 | 76 | $this->builder = $builder; |
| 77 | 77 | $this->config = $builder->getConfig(); |
@@ -92,22 +92,22 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | }); |
| 94 | 94 | $this->data = [ |
| 95 | - 'file' => '', // absolute file path |
|
| 96 | - 'files' => [], // array of absolute files path |
|
| 95 | + 'file' => '', // absolute file path |
|
| 96 | + 'files' => [], // array of absolute files path |
|
| 97 | 97 | 'missing' => false, // if file not found but missing allowed: 'missing' is true |
| 98 | - '_path' => '', // original path |
|
| 99 | - 'path' => '', // public path |
|
| 100 | - 'url' => null, // URL if it's a remote file |
|
| 101 | - 'ext' => '', // file extension |
|
| 102 | - 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
| 103 | - 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
| 104 | - 'size' => 0, // file size (in bytes) |
|
| 105 | - 'width' => null, // width (in pixels) |
|
| 106 | - 'height' => null, // height (in pixels) |
|
| 107 | - 'exif' => [], // image exif data |
|
| 108 | - 'duration' => null, // audio or video duration |
|
| 109 | - 'content' => '', // file content |
|
| 110 | - 'hash' => '', // file content hash (md5) |
|
| 98 | + '_path' => '', // original path |
|
| 99 | + 'path' => '', // public path |
|
| 100 | + 'url' => null, // URL if it's a remote file |
|
| 101 | + 'ext' => '', // file extension |
|
| 102 | + 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
| 103 | + 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
| 104 | + 'size' => 0, // file size (in bytes) |
|
| 105 | + 'width' => null, // width (in pixels) |
|
| 106 | + 'height' => null, // height (in pixels) |
|
| 107 | + 'exif' => [], // image exif data |
|
| 108 | + 'duration' => null, // audio or video duration |
|
| 109 | + 'content' => '', // file content |
|
| 110 | + 'hash' => '', // file content hash (md5) |
|
| 111 | 111 | ]; |
| 112 | 112 | |
| 113 | 113 | // handles options |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | * |
| 993 | 993 | * @throws RuntimeException |
| 994 | 994 | */ |
| 995 | - private function getImageSize(): array|false |
|
| 995 | + private function getImageSize(): array | false |
|
| 996 | 996 | { |
| 997 | 997 | if (!$this->data['type'] == 'image') { |
| 998 | 998 | return false; |