X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;ds=sidebyside;f=www%2Fplugins%2Fyaml%2Finc%2Fyaml_sfyaml.php;fp=www%2Fplugins%2Fyaml%2Finc%2Fyaml_sfyaml.php;h=1d94844d987ce9eea0e878c56ac970960ec0b62e;hb=8fcc303b842d94eccfc05fdf6cfd0b78d9123006;hp=0000000000000000000000000000000000000000;hpb=e5df6e32485f43481d5f8b3b2ae5fbb93b5a9625;p=ptitvelo%2Fweb%2Fwww.git diff --git a/www/plugins/yaml/inc/yaml_sfyaml.php b/www/plugins/yaml/inc/yaml_sfyaml.php new file mode 100644 index 0000000..1d94844 --- /dev/null +++ b/www/plugins/yaml/inc/yaml_sfyaml.php @@ -0,0 +1,36 @@ + 2 + ), $opt); + $yaml = new sfYamlDumper(); + return $yaml->dump($struct, $opt['inline']); +} + +function yaml_sfyaml_decode($input,$show_error=true) { + 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) + { + if ($show_error) + throw new InvalidArgumentException(sprintf('Unable to parse string: %s', $e->getMessage())); + else + return false; + } + + return $ret; +} + +?> \ No newline at end of file