From: Nicolas Boisselier Date: Mon, 10 Sep 2018 03:20:27 +0000 (+0100) Subject: lib/php/nb.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=7a2d3a54ae23be6fe0b3d9fab34957614b64e057;p=nb.git lib/php/nb.php --- diff --git a/lib/php/db.php b/lib/php/db.php index bec6a503..dfe27487 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -744,7 +744,7 @@ class Db extends nb { else $done[$file] = 1; if (!is_readable($file)) continue; - if (preg_match('/\.(yaml|yml)$/i',$file) and ($yaml = self::yaml_parse_file($file))) { + if (preg_match('/\.(yaml|yml)$/i',$file) and ($yaml = self::yaml_decode_file($file))) { self::$dbq = self::ar_merge(self::$dbq,$yaml); } elseif (preg_match('/\.php$/i',$file)) { diff --git a/lib/php/nb.php b/lib/php/nb.php index 889abdc5..d625c603 100644 --- a/lib/php/nb.php +++ b/lib/php/nb.php @@ -432,6 +432,9 @@ class NB { */ public static function object2array($o) { return $array = json_decode(json_encode($o), true); } + /* + * Function: yaml_init + */ private static function yaml_init() { static $Spyc; if (!isset($Spyc)) { @@ -452,14 +455,11 @@ class NB { } } - public static function yaml_parse_file($file) { + public static function yaml_decode_file($file) { self::yaml_init(); return _yaml_parse_file($file); } - /* - * Function: yaml_encode - */ public static function yaml_encode($row) { self::yaml_init(); $yaml = _yaml_emit($row);