]> git.sur5r.net Git - contagged/blobdiff - smarty/plugins/modifier.csv.php
CSV export
[contagged] / smarty / plugins / modifier.csv.php
diff --git a/smarty/plugins/modifier.csv.php b/smarty/plugins/modifier.csv.php
new file mode 100644 (file)
index 0000000..145c41b
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty csv modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     csv<br>
+ * Purpose:  format string for CSV output
+ * @param string
+ * @return string
+ */
+function smarty_modifier_csv($string)
+{
+       return '"'.strtr(trim($string),'"','""').'"';
+}
+
+?>