--- /dev/null
+<?php\r
+if (!defined("_ECRIRE_INC_VERSION")) return;\r
+\r
+function yaml_sfyaml_encode($struct, $opt = array()) {\r
+ require_once _DIR_PLUGIN_YAML.'sfyaml/sfYaml.php';\r
+ require_once _DIR_PLUGIN_YAML.'sfyaml/sfYamlDumper.php';\r
+ $opt = array_merge(\r
+ array(\r
+ 'inline' => 2\r
+ ), $opt);\r
+ $yaml = new sfYamlDumper();\r
+ return $yaml->dump($struct, $opt['inline']);\r
+}\r
+\r
+function yaml_sfyaml_decode($input,$show_error=true) {\r
+ require_once _DIR_PLUGIN_YAML.'sfyaml/sfYaml.php';\r
+ require_once _DIR_PLUGIN_YAML.'sfyaml/sfYamlParser.php';\r
+\r
+ $yaml = new sfYamlParser();\r
+\r
+ try\r
+ {\r
+ $ret = $yaml->parse($input);\r
+ }\r
+ catch (Exception $e)\r
+ {\r
+ if ($show_error) \r
+ throw new InvalidArgumentException(sprintf('Unable to parse string: %s', $e->getMessage()));\r
+ else\r
+ return false; \r
+ }\r
+\r
+ return $ret;\r
+}\r
+\r
+?>
\ No newline at end of file