X-Git-Url: http://git.cyclocoop.org/?p=velocampus%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fplugins%2Fauto%2Fyaml%2Finc%2Fyaml_sfyaml.php;fp=www%2Fplugins%2Fauto%2Fyaml%2Finc%2Fyaml_sfyaml.php;h=775592fa0b77163b257f27b83fad0614306f1579;hp=0000000000000000000000000000000000000000;hb=80b4d3e85f78d402ed2e73f8f5d1bf4c19962eed;hpb=aaf970bf4cdaf76689ecc10609048e18d073820c diff --git a/www/plugins/auto/yaml/inc/yaml_sfyaml.php b/www/plugins/auto/yaml/inc/yaml_sfyaml.php new file mode 100644 index 0000000..775592f --- /dev/null +++ b/www/plugins/auto/yaml/inc/yaml_sfyaml.php @@ -0,0 +1,33 @@ + 2 + ), $opt); + $yaml = new sfYamlDumper(); + return $yaml->dump($struct, $opt['inline']); +} + +function yaml_sfyaml_decode($input) { + require_once _DIR_PLUGIN_YAML.'sfyaml/sfYaml.php'; + require_once _DIR_PLUGIN_YAML.'sfyaml/sfYamlParser.php'; + + $yaml = new sfYamlParser(); + + try + { + $ret = $yaml->parse($input); + } + catch (Exception $e) + { + throw new InvalidArgumentException(sprintf('Unable to parse string: %s', $e->getMessage())); + } + + return $ret; +} + +?> \ No newline at end of file