diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php index 7f963e9..c0b03a3 100644 --- a/application/ApplicationUtils.php +++ b/application/ApplicationUtils.php @@ -149,7 +149,7 @@ class ApplicationUtils 'application', 'inc', 'plugins', - $conf->get('resource.raintpl_tpl'), + 'tpl/'.$conf->get('resource.theme'), ) as $path) { if (! is_readable(realpath($path))) { $errors[] = '"'.$path.'" directory is not readable'; diff --git a/application/PageBuilder.php b/application/PageBuilder.php index 32c7f9f..7cddb71 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php @@ -79,7 +79,7 @@ class PageBuilder $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false)); $this->tpl->assign('token', getToken($this->conf)); // To be removed with a proper theme configuration. - $this->tpl->assign('conf', $this->conf); + $this->tpl->assign('conf', $this->conf->get('resource.theme', 'Default')); } /** diff --git a/application/Utils.php b/application/Utils.php index 0166ee2..d03af31 100644 --- a/application/Utils.php +++ b/application/Utils.php @@ -227,3 +227,13 @@ function autoLocale($headerLocale) } setlocale(LC_ALL, $attempts); } + +function getAllTheme() +{ + $allTheme = glob('tpl/*', GLOB_ONLYDIR); + foreach ($allTheme as $value) { + $themes[] = str_replace('tpl/', '', $value); + } + + return $themes; +} diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php index f5f753f..77804b8 100644 --- a/application/config/ConfigManager.php +++ b/application/config/ConfigManager.php @@ -189,7 +189,7 @@ class ConfigManager 'general.title', 'general.header_link', 'privacy.default_private_links', - 'redirector.url', + 'redirector.url' ); // Only logged in user can alter config. @@ -296,7 +296,7 @@ class ConfigManager $this->setEmpty('resource.updates', 'data/updates.txt'); $this->setEmpty('resource.log', 'data/log.txt'); $this->setEmpty('resource.update_check', 'data/lastupdatecheck.txt'); - $this->setEmpty('resource.raintpl_tpl', 'tpl/'); + $this->setEmpty('resource.theme', 'Default'); $this->setEmpty('resource.raintpl_tmp', 'tmp/'); $this->setEmpty('resource.thumbnails_cache', 'cache'); $this->setEmpty('resource.page_cache', 'pagecache'); diff --git a/application/config/ConfigPhp.php b/application/config/ConfigPhp.php index 27187b6..5752d37 100644 --- a/application/config/ConfigPhp.php +++ b/application/config/ConfigPhp.php @@ -40,7 +40,7 @@ class ConfigPhp implements ConfigIO 'resource.updates' => 'config.UPDATES_FILE', 'resource.log' => 'config.LOG_FILE', 'resource.update_check' => 'config.UPDATECHECK_FILENAME', - 'resource.raintpl_tpl' => 'config.RAINTPL_TPL', + 'resource.theme' => 'config.theme', 'resource.raintpl_tmp' => 'config.RAINTPL_TMP', 'resource.thumbnails_cache' => 'config.CACHEDIR', 'resource.page_cache' => 'config.PAGECACHE', diff --git a/doc/Shaarli-configuration.html b/doc/Shaarli-configuration.html index 6d717c6..3494506 100644 --- a/doc/Shaarli-configuration.html +++ b/doc/Shaarli-configuration.html @@ -172,7 +172,7 @@ It might be useful if your IP adress often changes.
updates: File path for the ran updates file.
log: Log file path.
update_check: Last update check file path.
-raintpl_tpl: Templates directory.
+theme: Templates directory.
raintpl_tmp: Template engine cache directory.
thumbnails_cache: Thumbnails cache directory.
page_cache: Shaarli's internal cache directory.
@@ -220,7 +220,7 @@ It might be useful if your IP adress often changes.
"log": "data\/log.txt", "update_check": "data\/lastupdatecheck.txt", "raintpl_tmp": "tmp\/", - "raintpl_tpl": "tpl\/", + "theme": "tpl\/", "thumbnails_cache": "cache", "page_cache": "pagecache" }, diff --git a/doc/Shaarli-configuration.md b/doc/Shaarli-configuration.md index 4a783c0..430bc5f 100644 --- a/doc/Shaarli-configuration.md +++ b/doc/Shaarli-configuration.md @@ -73,7 +73,7 @@ It might be useful if your IP adress often changes. **updates**: File path for the ran updates file. **log**: Log file path. **update_check**: Last update check file path. -**raintpl_tpl**: Templates directory. +**theme**: Templates directory. **raintpl_tmp**: Template engine cache directory. **thumbnails_cache**: Thumbnails cache directory. **page_cache**: Shaarli's internal cache directory. @@ -134,7 +134,7 @@ It might be useful if your IP adress often changes. "log": "data\/log.txt", "update_check": "data\/lastupdatecheck.txt", "raintpl_tmp": "tmp\/", - "raintpl_tpl": "tpl\/", + "theme": "tpl\/", "thumbnails_cache": "cache", "page_cache": "pagecache" }, diff --git a/doc/Theming.html b/doc/Theming.html index 13e6acf..13dda02 100644 --- a/doc/Theming.html +++ b/doc/Theming.html @@ -120,7 +120,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
  • There should now be a my-template/ directory under the tpl/ dir, containing directly all the template files.
  • Edit data/config.php to have Shaarli use this template, e.g.

    -
    $GLOBALS['config'['RAINTPL_TPL'] = 'tpl/my-template/';]('RAINTPL_TPL']-=-'tpl/my-template/';.html)
  • +
    $GLOBALS['config'['theme'] = 'tpl/my-template/';]('theme']-=-'tpl/my-template/';.html)

    Community themes & templates