2015-06-29 16:11:01 +02:00
|
|
|
<?php namespace Todaymade\Daux;
|
|
|
|
|
2016-07-04 20:33:44 +02:00
|
|
|
use Todaymade\Daux\Tree\Content;
|
2016-09-30 22:24:33 +02:00
|
|
|
use Todaymade\Daux\Format\HTML\Config as HTMLConfig;
|
2015-06-29 16:11:01 +02:00
|
|
|
|
2016-09-30 22:24:33 +02:00
|
|
|
class Config extends BaseConfig
|
2015-07-17 23:38:06 +02:00
|
|
|
{
|
2017-05-16 23:17:06 +02:00
|
|
|
public function getTitle()
|
|
|
|
{
|
|
|
|
return $this['title'];
|
|
|
|
}
|
|
|
|
|
2016-07-04 20:33:44 +02:00
|
|
|
public function getCurrentPage()
|
|
|
|
{
|
|
|
|
return $this['current_page'];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setCurrentPage(Content $entry)
|
|
|
|
{
|
|
|
|
$this['current_page'] = $entry;
|
|
|
|
}
|
2016-07-27 23:27:51 +02:00
|
|
|
|
2016-07-28 22:48:50 +02:00
|
|
|
public function getDocumentationDirectory()
|
|
|
|
{
|
2016-07-27 23:27:51 +02:00
|
|
|
return $this['docs_directory'];
|
|
|
|
}
|
|
|
|
|
2016-07-28 22:48:50 +02:00
|
|
|
public function setDocumentationDirectory($documentationPath)
|
|
|
|
{
|
2016-07-27 23:27:51 +02:00
|
|
|
$this['docs_directory'] = $documentationPath;
|
|
|
|
}
|
|
|
|
|
2016-07-28 22:48:50 +02:00
|
|
|
public function getThemesDirectory()
|
|
|
|
{
|
2016-07-27 23:27:51 +02:00
|
|
|
return $this['themes_directory'];
|
|
|
|
}
|
|
|
|
|
2016-09-21 23:30:01 +02:00
|
|
|
public function setThemesDirectory($directory)
|
|
|
|
{
|
|
|
|
$this['themes_directory'] = $directory;
|
|
|
|
}
|
|
|
|
|
2016-09-12 23:58:58 +02:00
|
|
|
public function setThemesPath($themePath)
|
|
|
|
{
|
2016-09-06 23:11:32 +02:00
|
|
|
$this['themes_path'] = $themePath;
|
|
|
|
}
|
|
|
|
|
2016-09-12 23:58:58 +02:00
|
|
|
public function getThemesPath()
|
|
|
|
{
|
2016-09-06 23:11:32 +02:00
|
|
|
return $this['themes_path'];
|
|
|
|
}
|
|
|
|
|
2016-07-28 22:48:50 +02:00
|
|
|
public function setFormat($format)
|
|
|
|
{
|
2016-07-28 22:47:47 +02:00
|
|
|
$this['format'] = $format;
|
|
|
|
}
|
|
|
|
|
2016-07-28 22:48:50 +02:00
|
|
|
public function getFormat()
|
|
|
|
{
|
2016-07-28 22:47:47 +02:00
|
|
|
return $this['format'];
|
|
|
|
}
|
|
|
|
|
2016-09-06 23:11:32 +02:00
|
|
|
public function hasTimezone()
|
|
|
|
{
|
|
|
|
return isset($this['timezone']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTimezone()
|
|
|
|
{
|
|
|
|
return $this['timezone'];
|
|
|
|
}
|
|
|
|
|
2016-07-28 22:48:50 +02:00
|
|
|
public function isMultilanguage()
|
|
|
|
{
|
2016-07-27 23:27:51 +02:00
|
|
|
return array_key_exists('languages', $this) && !empty($this['languages']);
|
|
|
|
}
|
2016-08-02 23:39:57 +02:00
|
|
|
|
2016-08-16 23:25:06 +02:00
|
|
|
public function isLive()
|
|
|
|
{
|
|
|
|
return $this['mode'] == Daux::LIVE_MODE;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isStatic()
|
|
|
|
{
|
|
|
|
return $this['mode'] == Daux::STATIC_MODE;
|
|
|
|
}
|
|
|
|
|
2016-08-02 23:39:57 +02:00
|
|
|
public function shouldInheritIndex()
|
|
|
|
{
|
2016-08-04 22:10:36 +02:00
|
|
|
// As the global configuration is always present, we
|
|
|
|
// need to test for the existence of the legacy value
|
|
|
|
// first. Then use the current value.
|
2016-08-02 23:39:57 +02:00
|
|
|
if (array_key_exists('live', $this) && array_key_exists('inherit_index', $this['live'])) {
|
|
|
|
return $this['live']['inherit_index'];
|
|
|
|
}
|
|
|
|
|
2016-08-04 22:10:36 +02:00
|
|
|
return $this['html']['inherit_index'];
|
2016-08-02 23:39:57 +02:00
|
|
|
}
|
2016-09-15 17:20:24 +02:00
|
|
|
|
|
|
|
public function setConfigurationOverrideFile($override_file)
|
|
|
|
{
|
|
|
|
$this['override_file'] = $override_file;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getConfigurationOverrideFile()
|
|
|
|
{
|
|
|
|
if (array_key_exists('override_file', $this)) {
|
|
|
|
return $this['override_file'];
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getConfluenceConfiguration()
|
|
|
|
{
|
|
|
|
return $this['confluence'];
|
|
|
|
}
|
2016-09-30 22:24:33 +02:00
|
|
|
|
|
|
|
public function getHTML()
|
|
|
|
{
|
|
|
|
return new HTMLConfig($this['html']);
|
|
|
|
}
|
2018-06-06 23:20:29 +02:00
|
|
|
|
|
|
|
public function canCache()
|
|
|
|
{
|
|
|
|
if (array_key_exists('cache', $this)) {
|
|
|
|
return $this['cache'];
|
|
|
|
}
|
|
|
|
|
2018-06-06 23:37:26 +02:00
|
|
|
return false;
|
2018-06-06 23:20:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getCacheKey()
|
|
|
|
{
|
|
|
|
$cloned = [];
|
|
|
|
foreach ($this as $key => $value) {
|
|
|
|
$cloned[$key] = ($value instanceof Entry) ? $value->dump() : $value;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sha1(json_encode($cloned));
|
|
|
|
}
|
2015-06-29 16:11:01 +02:00
|
|
|
}
|