xref: /dokuwiki/lib/plugins/config/core/Configuration.php (revision 5a38a129ffe7e1949e690730ee9157988de617c0)
1c6639e6aSAndreas Gohr<?php
2c6639e6aSAndreas Gohr/**
3c6639e6aSAndreas Gohr * Configuration Class
4c6639e6aSAndreas Gohr *
5c6639e6aSAndreas Gohr * @author  Chris Smith <chris@jalakai.co.uk>
6c6639e6aSAndreas Gohr * @author  Ben Coburn <btcoburn@silicodon.net>
7c6639e6aSAndreas Gohr */
8c6639e6aSAndreas Gohr
9c6639e6aSAndreas Gohrnamespace dokuwiki\plugin\config\core;
10c6639e6aSAndreas Gohr
11c6639e6aSAndreas Gohr/**
12c6639e6aSAndreas Gohr * Class configuration
13c6639e6aSAndreas Gohr */
14c6639e6aSAndreas Gohrclass Configuration {
15c6639e6aSAndreas Gohr
16c6639e6aSAndreas Gohr    const KEYMARKER = '____';
17c6639e6aSAndreas Gohr
188ea5685fSAndreas Gohr    /** @var ConfigSettings FIXME better name? */
198ea5685fSAndreas Gohr    protected $confset;
208ea5685fSAndreas Gohr
218ea5685fSAndreas Gohr
22c6639e6aSAndreas Gohr    /**
23c6639e6aSAndreas Gohr     * constructor
24c6639e6aSAndreas Gohr     */
25*5a38a129SAndreas Gohr    public function __construct() {
268ea5685fSAndreas Gohr        $this->confset = new ConfigSettings();
27c6639e6aSAndreas Gohr    }
28c6639e6aSAndreas Gohr
29c6639e6aSAndreas Gohr    /**
30c6639e6aSAndreas Gohr     * Stores setting[] array to file
31c6639e6aSAndreas Gohr     *
32c6639e6aSAndreas Gohr     * @return bool succesful?
33c6639e6aSAndreas Gohr     */
34*5a38a129SAndreas Gohr    public function save_settings() {
35*5a38a129SAndreas Gohr        $writer = new Writer();
36*5a38a129SAndreas Gohr        try {
37*5a38a129SAndreas Gohr            $writer->save($this->confset->getSettings());
38*5a38a129SAndreas Gohr        } catch(\Exception $e) {
39*5a38a129SAndreas Gohr            // fixme show message
40c6639e6aSAndreas Gohr            return false;
41c6639e6aSAndreas Gohr        }
42c6639e6aSAndreas Gohr        return true;
43c6639e6aSAndreas Gohr    }
44c6639e6aSAndreas Gohr
45c6639e6aSAndreas Gohr
46c6639e6aSAndreas Gohr}
47c6639e6aSAndreas Gohr
48