writableByCurrentUser = Piwik::hasUserSuperUserAccess(); $this->readableByCurrentUser = $this->writableByCurrentUser; } /** * Returns `true` if this setting is writable for the current user, `false` if otherwise. In case it returns * writable for the current user it will be visible in the Plugin settings UI. * * @return bool */ public function isWritableByCurrentUser() { if ($this->hasConfigValue()) { return false; } return $this->writableByCurrentUser; } /** * Returns `true` if this setting can be displayed for the current user, `false` if otherwise. * * @return bool */ public function isReadableByCurrentUser() { return $this->readableByCurrentUser; } /** * Returns the display order. System settings are displayed before user settings. * * @return int */ public function getOrder() { return 30; } public function getValue() { $defaultValue = parent::getValue(); // we access value first to make sure permissions are checked $configValue = $this->getValueFromConfig(); if (isset($configValue)) { $defaultValue = $configValue; settype($defaultValue, $this->type); } return $defaultValue; } private function hasConfigValue() { $value = $this->getValueFromConfig(); return isset($value); } private function getValueFromConfig() { $config = Config::getInstance()->{$this->pluginName}; if (!empty($config) && array_key_exists($this->name, $config)) { return $config[$this->name]; } } }