JuKu / JuKuCMS

Open Source CMS should be the fastest CMS world wide (WIP).
Other
5 stars 1 forks source link

Preferences #139

Closed JuKu closed 6 years ago

JuKu commented 6 years ago

Plugins & Themes should have own preferences, like "CMS/made simple".

// create preferences
$this->SetPreference('piwik_url', $config['root_url'] . '/piwik');
$this->SetPreference('site_id', 1);
$this->SetPreference('token_auth', '08b938cba83663677ac14e5037616bbc');
$this->SetPreference('period', 'week');
$this->SetPreference('autoinclude', 0);
$this->SetPreference('include_today', false);
$this->SetPreference('dashboardheight', 500);
JuKu commented 6 years ago

Sample Code:

$prefs = new Preferences("plugin_myplugin");
$prefs->load();

//set preferences
$prefs->set("key1", "value1");
$prefs->set("key2", 2);
$prefs->set("my-other-key", "my-other-value");

//...

$prefs->save();

Every plugin should automatically have preferences.