@@ -61,8 +61,8 @@ |
||
61 | 61 | |
62 | 62 | // handles options |
63 | 63 | $canonical = null; // if true, add prefix URL with baseurl |
64 | - $format = null; // set output format |
|
65 | - $language = null; // force language |
|
64 | + $format = null; // set output format |
|
65 | + $language = null; // force language |
|
66 | 66 | extract(is_array($options) ? $options : [], EXTR_IF_EXISTS); |
67 | 67 | |
68 | 68 | // canonical URL? |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function showable(): self |
27 | 27 | { |
28 | - return $this->filter(function (Page $page) { |
|
28 | + return $this->filter(function(Page $page) { |
|
29 | 29 | if ($page->getVariable('published') === true |
30 | 30 | && $page->isVirtual() === false |
31 | 31 | && $page->getVariable('redirect') === null |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $options['descTitle'] = $options['descTitle'] ?? false; |
60 | 60 | $options['reverse'] = $options['reverse'] ?? false; |
61 | 61 | |
62 | - return $this->usort(function ($a, $b) use ($options) { |
|
62 | + return $this->usort(function($a, $b) use ($options) { |
|
63 | 63 | if ($a[$options['variable']] == $b[$options['variable']]) { |
64 | 64 | // if dates are equal and "descTitle" is true |
65 | 65 | if ($options['descTitle'] && (isset($a['title']) && isset($b['title']))) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $options['reverse'] = false; |
84 | 84 | } |
85 | 85 | |
86 | - return $this->usort(function ($a, $b) use ($options) { |
|
86 | + return $this->usort(function($a, $b) use ($options) { |
|
87 | 87 | return ($options['reverse'] ? -1 : 1) * strnatcmp($a['title'], $b['title']); |
88 | 88 | }); |
89 | 89 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $options['reverse'] = false; |
99 | 99 | } |
100 | 100 | |
101 | - return $this->usort(function ($a, $b) use ($options) { |
|
101 | + return $this->usort(function($a, $b) use ($options) { |
|
102 | 102 | if ($a['weight'] == $b['weight']) { |
103 | 103 | return 0; |
104 | 104 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | Util::autoload($this->builder, 'generators'); |
51 | 51 | |
52 | 52 | $generators = (array) $this->builder->getConfig()->get('generators'); |
53 | - array_walk($generators, function ($generator, $priority) use ($generatorManager) { |
|
53 | + array_walk($generators, function($generator, $priority) use ($generatorManager) { |
|
54 | 54 | if (!class_exists($generator)) { |
55 | 55 | $message = \sprintf('Unable to load generator "%s".', $generator); |
56 | 56 | $this->builder->getLogger()->error($message); |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function joinPath(string ...$path): string |
42 | 42 | { |
43 | - $path = array_filter($path, function ($path) { |
|
43 | + $path = array_filter($path, function($path) { |
|
44 | 44 | return !empty($path) && !is_null($path); |
45 | 45 | }); |
46 | - array_walk($path, function (&$value, $key) { |
|
46 | + array_walk($path, function(&$value, $key) { |
|
47 | 47 | $value = str_replace('\\', '/', $value); |
48 | 48 | $value = rtrim($value, '/'); |
49 | 49 | $value = $key == 0 ? $value : ltrim($value, '/'); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public static function joinFile(string ...$path): string |
59 | 59 | { |
60 | - array_walk($path, function (&$value, $key) use (&$path) { |
|
60 | + array_walk($path, function(&$value, $key) use (&$path) { |
|
61 | 61 | $value = str_replace(['\\', '/'], [DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR], $value); |
62 | 62 | $value = rtrim($value, DIRECTORY_SEPARATOR); |
63 | 63 | $value = $key == 0 ? $value : ltrim($value, DIRECTORY_SEPARATOR); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public static function autoload(Builder $builder, string $dir): void |
87 | 87 | { |
88 | - spl_autoload_register(function ($className) use ($builder, $dir) { |
|
88 | + spl_autoload_register(function($className) use ($builder, $dir) { |
|
89 | 89 | $classFile = Util::joinFile($builder->getConfig()->getSourceDir(), $dir, "$className.php"); |
90 | 90 | if (file_exists($classFile)) { |
91 | 91 | require $classFile; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function filterBy(PagesCollection $pages, string $variable, string $value): CollectionInterface |
215 | 215 | { |
216 | - $filteredPages = $pages->filter(function (Page $page) use ($variable, $value) { |
|
216 | + $filteredPages = $pages->filter(function(Page $page) use ($variable, $value) { |
|
217 | 217 | // is a dedicated getter exists? |
218 | 218 | $method = 'get'.ucfirst($variable); |
219 | 219 | if (method_exists($page, $method) && $page->$method() == $value) { |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function sortByWeight(\Traversable $collection, bool $reverse = false): array |
249 | 249 | { |
250 | - $callback = function ($a, $b) use ($reverse) { |
|
250 | + $callback = function($a, $b) use ($reverse) { |
|
251 | 251 | if (!isset($a['weight'])) { |
252 | 252 | $a['weight'] = 0; |
253 | 253 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function sortByDate(\Traversable $collection, string $variable = 'date', bool $reverse = false, bool $descTitle = false): array |
275 | 275 | { |
276 | - $callback = function ($a, $b) use ($variable, $reverse, $descTitle) { |
|
276 | + $callback = function($a, $b) use ($variable, $reverse, $descTitle) { |
|
277 | 277 | if ($a[$variable] == $b[$variable]) { |
278 | 278 | // if dates are equal and "descTitle" is true |
279 | 279 | if ($descTitle && (isset($a['title']) && isset($b['title']))) { |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | 'title' => 'Site title', |
17 | 17 | //'baseline' => 'Site baseline', |
18 | 18 | 'baseurl' => 'http://localhost:8000/', |
19 | - 'canonicalurl' => false, // if true 'url()' function preprends URL wirh 'baseurl' |
|
19 | + 'canonicalurl' => false, // if true 'url()' function preprends URL wirh 'baseurl' |
|
20 | 20 | 'description' => 'Site description', |
21 | - 'taxonomies' => [ // default taxonomies |
|
21 | + 'taxonomies' => [// default taxonomies |
|
22 | 22 | 'tags' => 'tag', // can be disabled with 'disabled' value |
23 | 23 | 'categories' => 'category', |
24 | 24 | ], |
25 | 25 | 'pagination' => [ |
26 | - 'max' => 5, // number of pages on each paginated pages |
|
26 | + 'max' => 5, // number of pages on each paginated pages |
|
27 | 27 | 'path' => 'page', // path to paginated pages. ie: '/blog/page/2/' |
28 | 28 | ], |
29 | 29 | 'date' => [ |
@@ -181,14 +181,14 @@ discard block |
||
181 | 181 | 'format' => 'yaml', // front matter format `yaml`, `ini`, `toml` or `json` (`yaml` by default) |
182 | 182 | ], |
183 | 183 | 'body' => [ |
184 | - 'format' => 'md', // page body format (only Markdown is supported) |
|
184 | + 'format' => 'md', // page body format (only Markdown is supported) |
|
185 | 185 | 'toc' => ['h2', 'h3'], // headers used to build the table of contents |
186 | 186 | 'highlight' => [ |
187 | - 'enabled' => false, // enables code syntax highlighting (`false` by default) |
|
187 | + 'enabled' => false, // enables code syntax highlighting (`false` by default) |
|
188 | 188 | ], |
189 | 189 | 'images' => [ |
190 | 190 | 'lazy' => [ |
191 | - 'enabled' => true, // adds `loading="lazy"` attribute (`true` by default) |
|
191 | + 'enabled' => true, // adds `loading="lazy"` attribute (`true` by default) |
|
192 | 192 | ], |
193 | 193 | 'resize' => [ |
194 | 194 | 'enabled' => false, // enables image resizing by using the `width` extra attribute (`false` by default) |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | 'enabled' => false, // puts the image in a <figure> element and adds a <figcaption> containing the title (`false` by default) |
204 | 204 | ], |
205 | 205 | 'remote' => [ |
206 | - 'enabled' => true, // turns remote images to Asset to handling them (`true` by default) |
|
206 | + 'enabled' => true, // turns remote images to Asset to handling them (`true` by default) |
|
207 | 207 | ], |
208 | 208 | ], |
209 | 209 | 'excerpt' => [ |
210 | 210 | 'separator' => 'excerpt|break', // string to use as separator (`excerpt|break` by default) |
211 | - 'capture' => 'before', // part to capture, `before` or `after` the separator (`before` by default) |
|
211 | + 'capture' => 'before', // part to capture, `before` or `after` the separator (`before` by default) |
|
212 | 212 | ], |
213 | 213 | ], |
214 | 214 | // data files |
@@ -244,17 +244,17 @@ discard block |
||
244 | 244 | ], |
245 | 245 | 'assets' => [ |
246 | 246 | 'dir' => 'assets', |
247 | - 'compile' => [ // Compile Saas |
|
247 | + 'compile' => [// Compile Saas |
|
248 | 248 | 'enabled' => true, |
249 | 249 | 'style' => 'expanded', // 'expanded' or 'compressed', |
250 | 250 | 'import' => ['sass', 'scss', 'node_modules'], |
251 | 251 | 'sourcemap' => false, // works in debug mode only |
252 | 252 | //'variables' => ['var' => 'value'] |
253 | 253 | ], |
254 | - 'minify' => [ // Minify CSS and JS |
|
254 | + 'minify' => [// Minify CSS and JS |
|
255 | 255 | 'enabled' => true, |
256 | 256 | ], |
257 | - 'fingerprint' => [ // Add fingerprint |
|
257 | + 'fingerprint' => [// Add fingerprint |
|
258 | 258 | 'enabled' => true, |
259 | 259 | ], |
260 | 260 | 'target' => 'assets', // target directory of remote and resized assets |
@@ -65,26 +65,26 @@ discard block |
||
65 | 65 | $this->builder = $builder; |
66 | 66 | $this->config = $builder->getConfig(); |
67 | 67 | $paths = is_array($paths) ? $paths : [$paths]; |
68 | - array_walk($paths, function ($path) { |
|
68 | + array_walk($paths, function($path) { |
|
69 | 69 | if (empty($path)) { |
70 | 70 | throw new RuntimeException('The path parameter of "asset() can\'t be empty."'); |
71 | 71 | } |
72 | 72 | }); |
73 | 73 | $this->data = [ |
74 | - 'file' => '', // absolute file path |
|
75 | - 'files' => [], // bundle: files path |
|
76 | - 'filename' => '', // filename |
|
77 | - 'path_source' => '', // public path to the file, before transformations |
|
78 | - 'path' => '', // public path to the file, after transformations |
|
74 | + 'file' => '', // absolute file path |
|
75 | + 'files' => [], // bundle: files path |
|
76 | + 'filename' => '', // filename |
|
77 | + 'path_source' => '', // public path to the file, before transformations |
|
78 | + 'path' => '', // public path to the file, after transformations |
|
79 | 79 | 'missing' => false, // if file not found, but missing ollowed 'missing' is true |
80 | - 'ext' => '', // file extension |
|
81 | - 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
82 | - 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
83 | - 'size' => 0, // file size (in bytes) |
|
84 | - 'content_source' => '', // file content, before transformations |
|
85 | - 'content' => '', // file content, after transformations |
|
86 | - 'width' => 0, // width (in pixels) in case of an image |
|
87 | - 'height' => 0, // height (in pixels) in case of an image |
|
80 | + 'ext' => '', // file extension |
|
81 | + 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
82 | + 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
83 | + 'size' => 0, // file size (in bytes) |
|
84 | + 'content_source' => '', // file content, before transformations |
|
85 | + 'content' => '', // file content, after transformations |
|
86 | + 'width' => 0, // width (in pixels) in case of an image |
|
87 | + 'height' => 0, // height (in pixels) in case of an image |
|
88 | 88 | ]; |
89 | 89 | |
90 | 90 | // handles options |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | |
427 | 427 | try { |
428 | 428 | $img = ImageManager::make($assetResized->data['content_source']); |
429 | - $img->resize($width, null, function (\Intervention\Image\Constraint $constraint) { |
|
429 | + $img->resize($width, null, function(\Intervention\Image\Constraint $constraint) { |
|
430 | 430 | $constraint->aspectRatio(); |
431 | 431 | $constraint->upsize(); |
432 | 432 | }); |