replace strlen in readPages() with variables

see issue #671
pico-3.0
dkyme 2 years ago committed by GitHub
parent efa51f66b1
commit a3dd0b9fbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      lib/Pico.php

@ -1771,6 +1771,8 @@ class Pico
{ {
$contentDir = $this->getConfig('content_dir'); $contentDir = $this->getConfig('content_dir');
$contentExt = $this->getConfig('content_ext'); $contentExt = $this->getConfig('content_ext');
$contentDirLen = strlen($contentDir);
$contentExtLen = strlen($contentExt);
$this->pages = []; $this->pages = [];
$files = $this->getFiles($contentDir, $contentExt, self::SORT_NONE); $files = $this->getFiles($contentDir, $contentExt, self::SORT_NONE);
@ -1781,7 +1783,7 @@ class Pico
continue; continue;
} }
$id = substr($file, strlen($contentDir), -strlen($contentExt)); $id = substr($file, $contentDirLen, -$contentExtLen);
// trigger onSinglePageLoading event // trigger onSinglePageLoading event
// skip inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists) by default // skip inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists) by default

Loading…
Cancel
Save