You are here

function _sheetnode_phpexcel_sanitize_filename in Sheetnode 7.2

Same name and namespace in other branches
  1. 6 modules/sheetnode_phpexcel/sheetnode_phpexcel.module \_sheetnode_phpexcel_sanitize_filename()
  2. 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 313
Module file for the sheetnode_phpexcel module. This manages handling of files for sheetnode.

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, '-');
}