Skip to content

Commit

Permalink
Merge pull request #674 from dkyme/dkyme-patch-1
Browse files Browse the repository at this point in the history
replace strlen in readPages() with variables
  • Loading branch information
PhrozenByte authored Aug 14, 2023
2 parents efa51f6 + a3dd0b9 commit 0fa644e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Pico.php
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,8 @@ protected function readPages(): void
{
$contentDir = $this->getConfig('content_dir');
$contentExt = $this->getConfig('content_ext');
$contentDirLen = strlen($contentDir);
$contentExtLen = strlen($contentExt);

$this->pages = [];
$files = $this->getFiles($contentDir, $contentExt, self::SORT_NONE);
Expand All @@ -1781,7 +1783,7 @@ protected function readPages(): void
continue;
}

$id = substr($file, strlen($contentDir), -strlen($contentExt));
$id = substr($file, $contentDirLen, -$contentExtLen);

// trigger onSinglePageLoading event
// skip inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists) by default
Expand Down

0 comments on commit 0fa644e

Please sign in to comment.