Various small improvements

This commit is contained in:
Daniel Rudolf 2017-10-12 16:03:41 +02:00
parent 0318cc25d7
commit 867f81a443
No known key found for this signature in database
GPG key ID: A061F02CD8DE4538
2 changed files with 9 additions and 8 deletions

View file

@ -41,7 +41,7 @@ DID_REPLACE="no"
while IFS='' read -r LINE || [[ -n "$LINE" ]]; do
if [ "$DO_REPLACE" == "yes" ]; then
# skip lines until next entry is reached
[ "${LINE:0:2}" == " " ] && continue
[ "${LINE:0:2}" != " " ] || continue
DO_REPLACE="no"
elif [ "$LINE" == "- id: $LIST_ID" ]; then

View file

@ -1789,7 +1789,7 @@ class Pico
*/
protected function getTwigTemplate()
{
$templateName = $this->meta['template'] ?: 'index';
$templateName = !empty($this->meta['template']) ? $this->meta['template'] : 'index';
if (file_exists($this->getThemesDir() . $this->getConfig('theme') . '/' . $templateName . '.twig')) {
$templateName .= '.twig';
@ -1839,9 +1839,9 @@ class Pico
}
/**
* Returns true if URL rewriting is enabled
* Returns TRUE if URL rewriting is enabled
*
* @return boolean true if URL rewriting is enabled, false otherwise
* @return boolean TRUE if URL rewriting is enabled, FALSE otherwise
*/
public function isUrlRewritingEnabled()
{
@ -1913,19 +1913,20 @@ class Pico
* Returns the page ID of a given content file
*
* @param string $path path to the content file
* @return string|null either the corresponding page ID or null
* @return string|null either the corresponding page ID or NULL
*/
public function getPageId($path)
{
$contentDir = $this->getConfig('content_dir');
$contentDirLength = strlen($contentDir);
$contentExt = $this->getConfig('content_ext');
$contentExtLength = strlen($contentExt);
if (substr($path, 0, $contentDirLength) !== $contentDir) {
return null;
}
$contentExt = $this->getConfig('content_ext');
$contentExtLength = strlen($contentExt);
if (substr($path, -$contentExtLength) !== $contentExt) {
return null;
}