private static function yaml_init() {
static $Spyc;
- if (empty($Spyc) and !function_exists('yaml_emit')) {
- require_once(NB_ROOT.'/lib/php/Spyc.php');
- function yaml_emit($data) { return Spyc::YAMLDump($data, false, false, true); }
- function yaml_parse_file($file) { return Spyc::YAMLLoad($file); }
+ if (!isset($Spyc)) {
+
+ if (!function_exists('yaml_emit')) {
+ require_once(NB_ROOT.'/lib/php/Spyc.php');
+ function yaml_emit($data) { return Spyc::YAMLDump($data, false, false, true); }
+ function yaml_parse_file($file) { return Spyc::YAMLLoad($file); }
+ function yaml_parse($str) { return Spyc::YAMLLoadString($str); }
+ }
+
$Spyc = true;
}
}
return "$yaml\n";
}
+ public static function yaml_decode($str) {
+ return yaml_parse($str);
+ }
+
/*
* Function: debug_backtrace_msg
* @copyright 13.07.11