@@ -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; |
@@ -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,10 +203,10 @@ 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 | 'fallback' => [ |
| 208 | 208 | 'enabled' => false, // enables a fallback if image is not found (`false` by default) |
| 209 | - 'path' => '', // path to the fallback image, stored in assets dir (`` by default) |
|
| 209 | + 'path' => '', // path to the fallback image, stored in assets dir (`` by default) |
|
| 210 | 210 | ], |
| 211 | 211 | ], |
| 212 | 212 | 'class' => '', // put default class to each image (`` by default) |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | ], |
| 219 | 219 | 'excerpt' => [ |
| 220 | 220 | 'separator' => 'excerpt|break', // string to use as separator (`excerpt|break` by default) |
| 221 | - 'capture' => 'before', // part to capture, `before` or `after` the separator (`before` by default) |
|
| 221 | + 'capture' => 'before', // part to capture, `before` or `after` the separator (`before` by default) |
|
| 222 | 222 | ], |
| 223 | 223 | ], |
| 224 | 224 | // data files |
@@ -254,17 +254,17 @@ discard block |
||
| 254 | 254 | ], |
| 255 | 255 | 'assets' => [ |
| 256 | 256 | 'dir' => 'assets', |
| 257 | - 'compile' => [ // Compile Saas |
|
| 257 | + 'compile' => [// Compile Saas |
|
| 258 | 258 | 'enabled' => true, |
| 259 | 259 | 'style' => 'expanded', // 'expanded' or 'compressed', |
| 260 | 260 | 'import' => ['sass', 'scss', 'node_modules'], |
| 261 | 261 | 'sourcemap' => false, // works in debug mode only |
| 262 | 262 | //'variables' => ['var' => 'value'] |
| 263 | 263 | ], |
| 264 | - 'minify' => [ // Minify CSS and JS |
|
| 264 | + 'minify' => [// Minify CSS and JS |
|
| 265 | 265 | 'enabled' => true, |
| 266 | 266 | ], |
| 267 | - 'fingerprint' => [ // Add fingerprint |
|
| 267 | + 'fingerprint' => [// Add fingerprint |
|
| 268 | 268 | 'enabled' => true, |
| 269 | 269 | ], |
| 270 | 270 | 'target' => 'assets', // target directory of remote and resized assets |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | /** @var \Cecil\Collection\Page\Page $page */ |
| 43 | 43 | $page->setType(Type::HOMEPAGE); |
| 44 | 44 | // collects all pages |
| 45 | - $subPages = $this->builder->getPages()->filter(function (Page $page) use ($language) { |
|
| 45 | + $subPages = $this->builder->getPages()->filter(function(Page $page) use ($language) { |
|
| 46 | 46 | return $page->getType() == TYPE::PAGE |
| 47 | 47 | && $page->isVirtual() === false |
| 48 | 48 | && $page->getVariable('exclude') !== true |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | protected function collectTermsFromPages(): void |
| 97 | 97 | { |
| 98 | 98 | /** @var \Cecil\Collection\Page\Collection $pages */ |
| 99 | - $pages = $this->builder->getPages()->filter(function (Page $page) { |
|
| 99 | + $pages = $this->builder->getPages()->filter(function(Page $page) { |
|
| 100 | 100 | return $page->getVariable('published'); |
| 101 | 101 | })->sortByDate(); |
| 102 | 102 | foreach ($pages as $page) { |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | */ |
| 57 | 57 | public function process(): void |
| 58 | 58 | { |
| 59 | - $filteredPages = $this->builder->getPages()->filter(function (Page $page) { |
|
| 59 | + $filteredPages = $this->builder->getPages()->filter(function(Page $page) { |
|
| 60 | 60 | return !empty($page->getRendered()); |
| 61 | 61 | }); |
| 62 | 62 | $total = count($filteredPages); |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | $language = ''; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - return \Cecil\Util::joinPath($language, $path, $subpath, $filename) . $extension; |
|
| 70 | + return \Cecil\Util::joinPath($language, $path, $subpath, $filename).$extension; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | public function filterBy(PagesCollection $pages, string $variable, string $value): CollectionInterface |
| 214 | 214 | { |
| 215 | - $filteredPages = $pages->filter(function (Page $page) use ($variable, $value) { |
|
| 215 | + $filteredPages = $pages->filter(function(Page $page) use ($variable, $value) { |
|
| 216 | 216 | // is a dedicated getter exists? |
| 217 | - $method = 'get' . ucfirst($variable); |
|
| 217 | + $method = 'get'.ucfirst($variable); |
|
| 218 | 218 | if (method_exists($page, $method) && $page->$method() == $value) { |
| 219 | 219 | return $page->getType() == Type::PAGE() && !$page->isVirtual() && true; |
| 220 | 220 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | public function sortByWeight(\Traversable $collection): array |
| 247 | 247 | { |
| 248 | - $callback = function ($a, $b) { |
|
| 248 | + $callback = function($a, $b) { |
|
| 249 | 249 | if (!isset($a['weight'])) { |
| 250 | 250 | $a['weight'] = 0; |
| 251 | 251 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | */ |
| 271 | 271 | public function sortByDate(\Traversable $collection, string $variable = 'date', bool $descTitle = false): array |
| 272 | 272 | { |
| 273 | - $callback = function ($a, $b) use ($variable, $descTitle) { |
|
| 273 | + $callback = function($a, $b) use ($variable, $descTitle) { |
|
| 274 | 274 | if ($a[$variable] == $b[$variable]) { |
| 275 | 275 | // if dates are equal and "descTitle" is true |
| 276 | 276 | if ($descTitle && (isset($a['title']) && isset($b['title']))) { |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | |
| 558 | 558 | // <img> element |
| 559 | 559 | $img = \sprintf( |
| 560 | - '<img src="%s" width="' . ($asset->getWidth() ?: '') . '" height="' . ($asset->getHeight() ?: '') . '"%s>', |
|
| 560 | + '<img src="%s" width="'.($asset->getWidth() ?: '').'" height="'.($asset->getHeight() ?: '').'"%s>', |
|
| 561 | 561 | $this->url($asset, $options), |
| 562 | 562 | $htmlAttributes |
| 563 | 563 | ); |
@@ -634,8 +634,8 @@ discard block |
||
| 634 | 634 | extract($options, EXTR_IF_EXISTS); |
| 635 | 635 | |
| 636 | 636 | // https://regex101.com/r/n9TWHF/1 |
| 637 | - $pattern = '(.*)<!--[[:blank:]]?(' . $separator . ')[[:blank:]]?-->(.*)'; |
|
| 638 | - preg_match('/' . $pattern . '/is', $string, $matches); |
|
| 637 | + $pattern = '(.*)<!--[[:blank:]]?('.$separator.')[[:blank:]]?-->(.*)'; |
|
| 638 | + preg_match('/'.$pattern.'/is', $string, $matches); |
|
| 639 | 639 | |
| 640 | 640 | if (empty($matches)) { |
| 641 | 641 | return $string; |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | } |
| 837 | 837 | $hex = ltrim($variable, '#'); |
| 838 | 838 | if (strlen($hex) == 3) { |
| 839 | - $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2]; |
|
| 839 | + $hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2]; |
|
| 840 | 840 | } |
| 841 | 841 | $c = hexdec($hex); |
| 842 | 842 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | foreach ($this->config->getLanguages() as $language) { |
| 47 | 47 | $pageId = !empty($path) ? $path : 'index'; |
| 48 | 48 | if ($language['code'] !== $this->config->getLanguageDefault()) { |
| 49 | - $pageId .= '.' . $language['code']; |
|
| 49 | + $pageId .= '.'.$language['code']; |
|
| 50 | 50 | // disable multilingual support |
| 51 | 51 | if (isset($frontmatter['multilingual']) && $frontmatter['multilingual'] === false) { |
| 52 | 52 | continue; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // filters pages: home, sections and terms |
| 35 | - $filteredPages = $this->builder->getPages()->filter(function (Page $page) { |
|
| 35 | + $filteredPages = $this->builder->getPages()->filter(function(Page $page) { |
|
| 36 | 36 | return in_array($page->getType(), [Type::HOMEPAGE, Type::SECTION, Type::TERM]); |
| 37 | 37 | }); |
| 38 | 38 | /** @var Page $page */ |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $paginationPath = $pagePagination['path']; |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | - $pages = $pages->filter(function (Page $page) { |
|
| 64 | + $pages = $pages->filter(function(Page $page) { |
|
| 65 | 65 | return $page->getVariable('published'); |
| 66 | 66 | }); |
| 67 | 67 | $pagesTotal = count($pages); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $paginationPerPage |
| 88 | 88 | ); |
| 89 | 89 | $pagesInPagination = new PagesCollection( |
| 90 | - $page->getId() . '-page-' . ($i + 1), |
|
| 90 | + $page->getId().'-page-'.($i + 1), |
|
| 91 | 91 | iterator_to_array($pagesInPagination) |
| 92 | 92 | ); |
| 93 | 93 | $alteredPage = clone $page; |