|
|
@ -344,8 +344,11 @@ class Pico |
|
|
|
// load raw file content |
|
|
|
// load raw file content |
|
|
|
$this->triggerEvent('onContentLoading', array(&$this->requestFile)); |
|
|
|
$this->triggerEvent('onContentLoading', array(&$this->requestFile)); |
|
|
|
|
|
|
|
|
|
|
|
$notFoundFile = '404' . $this->getConfig('content_ext'); |
|
|
|
if ( |
|
|
|
if (file_exists($this->requestFile) && (basename($this->requestFile) !== $notFoundFile)) { |
|
|
|
file_exists($this->requestFile) |
|
|
|
|
|
|
|
&& (basename($this->requestFile) !== '404' . $this->getConfig('content_ext')) |
|
|
|
|
|
|
|
&& !preg_match('/(?:^|\/)_/', $this->requestFile) |
|
|
|
|
|
|
|
) { |
|
|
|
$this->rawContent = $this->loadFileContent($this->requestFile); |
|
|
|
$this->rawContent = $this->loadFileContent($this->requestFile); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$this->triggerEvent('on404ContentLoading', array(&$this->requestFile)); |
|
|
|
$this->triggerEvent('on404ContentLoading', array(&$this->requestFile)); |
|
|
@ -1294,6 +1297,7 @@ class Pico |
|
|
|
'time' => &$meta['time'], |
|
|
|
'time' => &$meta['time'], |
|
|
|
'date' => &$meta['date'], |
|
|
|
'date' => &$meta['date'], |
|
|
|
'date_formatted' => &$meta['date_formatted'], |
|
|
|
'date_formatted' => &$meta['date_formatted'], |
|
|
|
|
|
|
|
'hidden' => (bool) preg_match('/(?:^|\/)_/', $id), |
|
|
|
'raw_content' => &$rawContent, |
|
|
|
'raw_content' => &$rawContent, |
|
|
|
'meta' => &$meta |
|
|
|
'meta' => &$meta |
|
|
|
); |
|
|
|
); |
|
|
@ -1331,6 +1335,10 @@ class Pico |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$alphaSortClosure = function ($a, $b) use ($order) { |
|
|
|
$alphaSortClosure = function ($a, $b) use ($order) { |
|
|
|
|
|
|
|
if ($a['hidden'] xor $b['hidden']) { |
|
|
|
|
|
|
|
return (!!$a['hidden'] - !!$b['hidden']) * (($order === 'desc') ? -1 : 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$aSortKey = (basename($a['id']) === 'index') ? dirname($a['id']) : $a['id']; |
|
|
|
$aSortKey = (basename($a['id']) === 'index') ? dirname($a['id']) : $a['id']; |
|
|
|
$bSortKey = (basename($b['id']) === 'index') ? dirname($b['id']) : $b['id']; |
|
|
|
$bSortKey = (basename($b['id']) === 'index') ? dirname($b['id']) : $b['id']; |
|
|
|
|
|
|
|
|
|
|
@ -1341,8 +1349,12 @@ class Pico |
|
|
|
if ($orderBy === 'date') { |
|
|
|
if ($orderBy === 'date') { |
|
|
|
// sort by date |
|
|
|
// sort by date |
|
|
|
uasort($this->pages, function ($a, $b) use ($alphaSortClosure, $order) { |
|
|
|
uasort($this->pages, function ($a, $b) use ($alphaSortClosure, $order) { |
|
|
|
if (empty($a['time']) || empty($b['time'])) { |
|
|
|
if ($a['hidden'] xor $b['hidden']) { |
|
|
|
$cmp = (empty($a['time']) - empty($b['time'])); |
|
|
|
return $alphaSortClosure($a, $b); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$a['time'] || !$b['time']) { |
|
|
|
|
|
|
|
$cmp = (!$a['time'] - !$b['time']); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$cmp = ($b['time'] - $a['time']); |
|
|
|
$cmp = ($b['time'] - $a['time']); |
|
|
|
} |
|
|
|
} |
|
|
|