public function save() { $data = array('version' => $this->_data['version']); if ($this->is_master()) { foreach ($this->_data as $key => $value) { $data[$key] = $this->_data[$key]; } } else { // write only overwrited keys $master = new ConfigCompiler(0, $this->_preview); $master->load(); foreach ($this->_data as $key => $value) { if (!ConfigCompiler::child_key_sealed($key, $master->_data, $this->_data)) { $data[$key] = $this->_data[$key]; } } } $filename = Config::util_config_filename($this->_blog_id, $this->_preview); if (defined('JSON_PRETTY_PRINT')) { $config = json_encode($data, JSON_PRETTY_PRINT); } else { // for older php versions $config = json_encode($data); } Util_File::file_put_contents_atomic($filename, $config); }
public function is_sealed($key) { if ($this->is_master()) { return false; } // better to use master config data here, but // its faster and preciese enough for UI return ConfigCompiler::child_key_sealed($key, $this->_data, $this->_data); }