function _sheetnode_phpexcel_sanitize_filename in Sheetnode 6
Same name and namespace in other branches
- 7.2 modules/sheetnode_phpexcel/sheetnode_phpexcel.module \_sheetnode_phpexcel_sanitize_filename()
- 7 modules/sheetnode_phpexcel/sheetnode_phpexcel.module \_sheetnode_phpexcel_sanitize_filename()
Helper function to sanitize a filename.
1 call to _sheetnode_phpexcel_sanitize_filename()
- _sheetnode_phpexcel_batch_export_finished in modules/
sheetnode_phpexcel/ sheetnode_phpexcel.export.inc - Batch API callback upon export completion.
File
- modules/
sheetnode_phpexcel/ sheetnode_phpexcel.module, line 277
Code
function _sheetnode_phpexcel_sanitize_filename($string) {
$string = htmlentities($string, ENT_QUOTES, 'UTF-8');
$string = preg_replace('/&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);/i', '$1', $string);
$string = preg_replace('/[^0-9a-z-_]/i', '-', $string);
return trim($string, '-');
}