mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Update to API 12
This commit is contained in:
parent
731ada7b38
commit
c59b4776ae
149 changed files with 6850 additions and 1918 deletions
|
|
@ -86,6 +86,10 @@ class Config{
|
|||
$this->load($this->file);
|
||||
$correct = $this->check();
|
||||
}
|
||||
|
||||
public function fixYAMLIndexes($str){
|
||||
return preg_replace("#^([ ]*)([a-zA-Z_]{1}[^\:]*)\:#m", "$1\"$2\":", $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file
|
||||
|
|
@ -125,7 +129,8 @@ class Config{
|
|||
$this->config = @json_decode($content, true);
|
||||
break;
|
||||
case CONFIG_YAML:
|
||||
$this->config = Spyc::YAMLLoad($content);
|
||||
$content = $this->fixYAMLIndexes($content);
|
||||
$this->config = yaml_parse($content);
|
||||
break;
|
||||
case CONFIG_SERIALIZED:
|
||||
$this->config = @unserialize($content);
|
||||
|
|
@ -172,7 +177,7 @@ class Config{
|
|||
$content = json_encode($this->config, JSON_PRETTY_PRINT | JSON_BIGINT_AS_STRING);
|
||||
break;
|
||||
case CONFIG_YAML:
|
||||
$content = Spyc::YAMLDump($this->config);
|
||||
$content = yaml_emit($this->config, YAML_UTF8_ENCODING);
|
||||
break;
|
||||
case CONFIG_SERIALIZED:
|
||||
$content = @serialize($this->config);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue