@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $files = Finder::create() |
| 55 | 55 | ->files() |
| 56 | 56 | ->in($this->config->getDataPath()) |
| 57 | - ->name('/\.('.implode('|', (array) $this->config->get('data.ext')).')$/') |
|
| 57 | + ->name('/\.(' . implode('|', (array) $this->config->get('data.ext')) . ')$/') |
|
| 58 | 58 | ->sortByName(true); |
| 59 | 59 | $total = \count($files); |
| 60 | 60 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | return; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $basename = $file->getBasename('.'.$file->getExtension()); |
|
| 103 | + $basename = $file->getBasename('.' . $file->getExtension()); |
|
| 104 | 104 | $subpath = \Cecil\Util\File::getFS()->makePathRelative( |
| 105 | 105 | $file->getPath(), |
| 106 | 106 | $this->config->getDataPath() |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | $staticFiles[$count]['date'] = (new \DateTime())->setTimestamp($file->getCTime()); |
| 77 | 77 | $staticFiles[$count]['updated'] = (new \DateTime())->setTimestamp($file->getMTime()); |
| 78 | 78 | $staticFiles[$count]['name'] = $file->getBasename(); |
| 79 | - $staticFiles[$count]['basename'] = $file->getBasename('.'.$file->getExtension()); |
|
| 79 | + $staticFiles[$count]['basename'] = $file->getBasename('.' . $file->getExtension()); |
|
| 80 | 80 | $staticFiles[$count]['ext'] = $file->getExtension(); |
| 81 | 81 | if ($subtype == 'jpeg') { |
| 82 | 82 | $staticFiles[$count]['exif'] = Util\File::readExif($file->getRealPath()); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | // ```yaml |
| 240 | 240 | // page: [html, json] |
| 241 | 241 | // ``` |
| 242 | - $formats = $this->config->get('output.pagetypeformats.'.$page->getType()); |
|
| 242 | + $formats = $this->config->get('output.pagetypeformats.' . $page->getType()); |
|
| 243 | 243 | if (empty($formats)) { |
| 244 | 244 | throw new RuntimeException('Configuration key "pagetypeformats" can\'t be empty.'); |
| 245 | 245 | } |
@@ -299,14 +299,14 @@ discard block |
||
| 299 | 299 | if (!preg_match('/<meta name="generator".*/i', $output)) { |
| 300 | 300 | $meta = sprintf('<meta name="generator" content="Cecil %s" />', Builder::getVersion()); |
| 301 | 301 | $output = preg_replace_callback('/([[:blank:]]*)(<\/head>)/i', function ($matches) use ($meta) { |
| 302 | - return str_repeat($matches[1] ?: ' ', 2).$meta."\n".$matches[1].$matches[2]; |
|
| 302 | + return str_repeat($matches[1] ?: ' ', 2) . $meta . "\n" . $matches[1] . $matches[2]; |
|
| 303 | 303 | }, $output); |
| 304 | 304 | } |
| 305 | 305 | // replace excerpt or break tag by HTML anchor |
| 306 | 306 | // https://regex101.com/r/Xl7d5I/3 |
| 307 | 307 | $pattern = '(.*)(<!--[[:blank:]]?(excerpt|break)[[:blank:]]?-->)(.*)'; |
| 308 | 308 | $replacement = '$1<span id="more"></span>$4'; |
| 309 | - $excerpt = preg_replace('/'.$pattern.'/is', $replacement, $output, 1); |
|
| 309 | + $excerpt = preg_replace('/' . $pattern . '/is', $replacement, $output, 1); |
|
| 310 | 310 | $output = $excerpt ?? $output; |
| 311 | 311 | } |
| 312 | 312 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function process(): void |
| 59 | 59 | { |
| 60 | - $namePattern = '/\.('.implode('|', (array) $this->config->get('pages.ext')).')$/'; |
|
| 60 | + $namePattern = '/\.(' . implode('|', (array) $this->config->get('pages.ext')) . ')$/'; |
|
| 61 | 61 | $content = Finder::create() |
| 62 | 62 | ->files() |
| 63 | 63 | ->in($this->config->getPagesPath()) |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $this->builder->getLogger()->error(sprintf('File "%s" doesn\'t exist.', $this->page)); |
| 81 | 81 | } |
| 82 | 82 | $content->path('.')->path(\dirname($this->page)); |
| 83 | - $content->name('/index\.('.implode('|', (array) $this->config->get('pages.ext')).')$/'); |
|
| 83 | + $content->name('/index\.(' . implode('|', (array) $this->config->get('pages.ext')) . ')$/'); |
|
| 84 | 84 | $namePattern = basename($this->page); |
| 85 | 85 | } |
| 86 | 86 | $content->name($namePattern); |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | // GitHub Gist link? |
| 149 | 149 | // https://regex101.com/r/QmCiAL/1 |
| 150 | 150 | $pattern = 'https:\/\/gist\.github.com\/[-a-zA-Z0-9_]+\/[-a-zA-Z0-9_]+'; |
| 151 | - if (preg_match('/'.$pattern.'/is', (string) $link['element']['attributes']['href'], $matches)) { |
|
| 151 | + if (preg_match('/' . $pattern . '/is', (string) $link['element']['attributes']['href'], $matches)) { |
|
| 152 | 152 | $gist = [ |
| 153 | 153 | 'extent' => $link['extent'], |
| 154 | 154 | 'element' => [ |
| 155 | 155 | 'name' => 'script', |
| 156 | 156 | 'text' => $link['element']['text'], |
| 157 | 157 | 'attributes' => [ |
| 158 | - 'src' => $matches[0].'.js', |
|
| 158 | + 'src' => $matches[0] . '.js', |
|
| 159 | 159 | 'title' => $link['element']['attributes']['title'], |
| 160 | 160 | ], |
| 161 | 161 | ], |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | // Youtube link? |
| 170 | 170 | // https://regex101.com/r/gznM1j/1 |
| 171 | 171 | $pattern = '(?:https?:\/\/)?(?:www\.)?youtu(?:\.be\/|be.com\/\S*(?:watch|embed)(?:(?:(?=\/[-a-zA-Z0-9_]{11,}(?!\S))\/)|(?:\S*v=|v\/)))([-a-zA-Z0-9_]{11,})'; |
| 172 | - if (preg_match('/'.$pattern.'/is', (string) $link['element']['attributes']['href'], $matches)) { |
|
| 172 | + if (preg_match('/' . $pattern . '/is', (string) $link['element']['attributes']['href'], $matches)) { |
|
| 173 | 173 | $iframe = [ |
| 174 | 174 | 'element' => [ |
| 175 | 175 | 'name' => 'iframe', |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | 'width' => '560', |
| 179 | 179 | 'height' => '315', |
| 180 | 180 | 'title' => $link['element']['text'], |
| 181 | - 'src' => 'https://www.youtube.com/embed/'.$matches[1], |
|
| 181 | + 'src' => 'https://www.youtube.com/embed/' . $matches[1], |
|
| 182 | 182 | 'frameborder' => '0', |
| 183 | 183 | 'allow' => 'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture', |
| 184 | 184 | 'allowfullscreen' => '', |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | if (!\array_key_exists('class', $InlineImage['element']['attributes'])) { |
| 237 | 237 | $InlineImage['element']['attributes']['class'] = ''; |
| 238 | 238 | } |
| 239 | - $InlineImage['element']['attributes']['class'] .= ' '.(string) $this->config->get('body.images.class'); |
|
| 239 | + $InlineImage['element']['attributes']['class'] .= ' ' . (string) $this->config->get('body.images.class'); |
|
| 240 | 240 | $InlineImage['element']['attributes']['class'] = trim($InlineImage['element']['attributes']['class']); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | |
| 451 | 451 | return $block; |
| 452 | 452 | } |
| 453 | - $block['element']['text'] .= $line['text']."\n"; |
|
| 453 | + $block['element']['text'] .= $line['text'] . "\n"; |
|
| 454 | 454 | |
| 455 | 455 | return $block; |
| 456 | 456 | } |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | (string) $this->config->get('assets.dir') |
| 546 | 546 | ); |
| 547 | 547 | $path = Util::joinPath($path); |
| 548 | - if (!preg_match('/'.$pattern.'/is', $path, $matches)) { |
|
| 548 | + if (!preg_match('/' . $pattern . '/is', $path, $matches)) { |
|
| 549 | 549 | return $path; |
| 550 | 550 | } |
| 551 | 551 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function getHelp() |
| 35 | 35 | { |
| 36 | - return self::$banner.parent::getHelp(); |
|
| 36 | + return self::$banner . parent::getHelp(); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | ); |
| 208 | 208 | foreach ($iterator as $file) { |
| 209 | 209 | if ($file->isFile()) { |
| 210 | - if (preg_match('/'.$pattern.'/i', $file->getPathname())) { |
|
| 210 | + if (preg_match('/' . $pattern . '/i', $file->getPathname())) { |
|
| 211 | 211 | Util\File::getFS()->remove($file->getPathname()); |
| 212 | 212 | $fileCount++; |
| 213 | 213 | $this->builder->getLogger()->debug(sprintf('Cache file "%s" removed', $file->getPathname())); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | try { |
| 240 | 240 | $keyAsArray = explode('__', $this->prepareKey($key), -1); |
| 241 | 241 | if (!empty($keyAsArray)) { |
| 242 | - $pattern = Util::joinFile($this->cacheDir, $keyAsArray[0]).'*'; |
|
| 242 | + $pattern = Util::joinFile($this->cacheDir, $keyAsArray[0]) . '*'; |
|
| 243 | 243 | foreach (glob($pattern) as $filename) { |
| 244 | 244 | Util\File::getFS()->remove($filename); |
| 245 | 245 | } |
@@ -61,8 +61,8 @@ discard block |
||
| 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? |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | // value is empty (i.e.: `url()`) |
| 78 | 78 | if (\is_null($value) || empty($value) || $value == '/') { |
| 79 | - $this->url = $base.'/'; |
|
| 79 | + $this->url = $base . '/'; |
|
| 80 | 80 | |
| 81 | 81 | return; |
| 82 | 82 | } |
@@ -94,14 +94,14 @@ discard block |
||
| 94 | 94 | $format = 'html'; |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | - $this->url = $base.'/'.ltrim((new PageRenderer($this->config))->getUrl($value, $format), '/'); |
|
| 97 | + $this->url = $base . '/' . ltrim((new PageRenderer($this->config))->getUrl($value, $format), '/'); |
|
| 98 | 98 | if ($canonical && $value->hasVariable('canonical') && $value->getVariable('canonical')['url']) { // canonical URL |
| 99 | 99 | $this->url = $value->getVariable('canonical')['url']; |
| 100 | 100 | } |
| 101 | 101 | break; |
| 102 | 102 | case $value instanceof Asset: |
| 103 | 103 | /** @var Asset $value */ |
| 104 | - $this->url = $base.'/'.ltrim($value['path'], '/'); |
|
| 104 | + $this->url = $base . '/' . ltrim($value['path'], '/'); |
|
| 105 | 105 | if ($value->isImageInCdn()) { |
| 106 | 106 | $this->url = (string) $value; |
| 107 | 107 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | ); |
| 129 | 129 | break; |
| 130 | 130 | default: |
| 131 | - $this->url = $base.'/'.$lang.ltrim($value, '/'); |
|
| 131 | + $this->url = $base . '/' . $lang . ltrim($value, '/'); |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | $classArray = explode(' ', $class); |
| 59 | 59 | foreach ($classArray as $class) { |
| 60 | 60 | if (\array_key_exists($class, $sizes)) { |
| 61 | - $result = $sizes[$class].', '; |
|
| 61 | + $result = $sizes[$class] . ', '; |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | if (!empty($result)) { |