Refactor Pico::isUrlRewritingEnabled()
This commit is contained in:
parent
cb15ea7493
commit
2761f8b751
14
lib/Pico.php
14
lib/Pico.php
@ -479,6 +479,10 @@ class Pico
|
|||||||
$this->config['base_url'] = rtrim($this->config['base_url'], '/') . '/';
|
$this->config['base_url'] = rtrim($this->config['base_url'], '/') . '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->config['rewrite_url'] === null) {
|
||||||
|
$this->config['rewrite_url'] = $this->isUrlRewritingEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
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')) {
|
||||||
@ -1237,13 +1241,13 @@ class Pico
|
|||||||
*/
|
*/
|
||||||
public function isUrlRewritingEnabled()
|
public function isUrlRewritingEnabled()
|
||||||
{
|
{
|
||||||
if (($this->getConfig('rewrite_url') === null) && isset($_SERVER['PICO_URL_REWRITING'])) {
|
$urlRewritingEnabled = $this->getConfig('rewrite_url');
|
||||||
return (bool) $_SERVER['PICO_URL_REWRITING'];
|
if ($urlRewritingEnabled !== null) {
|
||||||
} elseif ($this->getConfig('rewrite_url')) {
|
return $urlRewritingEnabled;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
$this->config['rewrite_url'] = (isset($_SERVER['PICO_URL_REWRITING']) && $_SERVER['PICO_URL_REWRITING']);
|
||||||
|
return $this->getConfig('rewrite_url');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user