Pico::loadConfig(): Improve Twig config parsing

Thanks @refeaime for reporting this
pico-3.0-alpha
Daniel Rudolf 8 years ago
parent d3c624777f
commit 13b167e23a
No known key found for this signature in database
GPG Key ID: A061F02CD8DE4538
  1. 9
      lib/Pico.php

@ -465,7 +465,7 @@ class Pico
'rewrite_url' => null, 'rewrite_url' => null,
'theme' => 'default', 'theme' => 'default',
'date_format' => '%D %T', 'date_format' => '%D %T',
'twig_config' => array('cache' => false, 'autoescape' => false, 'debug' => false), 'twig_config' => null,
'pages_order_by' => 'alpha', 'pages_order_by' => 'alpha',
'pages_order' => 'asc', 'pages_order' => 'asc',
'content_dir' => null, 'content_dir' => null,
@ -486,6 +486,13 @@ class Pico
$this->config['rewrite_url'] = $this->isUrlRewritingEnabled(); $this->config['rewrite_url'] = $this->isUrlRewritingEnabled();
} }
$defaultTwigConfig = array('cache' => false, 'autoescape' => false, 'debug' => false);
if (!is_array($this->config['twig_config'])) {
$this->config['twig_config'] = $defaultTwigConfig;
} else {
$this->config['twig_config'] += $defaultTwigConfig;
}
if (empty($this->config['content_dir'])) { if (empty($this->config['content_dir'])) {
// try to guess the content directory // try to guess the content directory
if (is_dir($this->getRootDir() . 'content')) { if (is_dir($this->getRootDir() . 'content')) {

Loading…
Cancel
Save