test changes
This commit is contained in:
@@ -85,6 +85,24 @@ Class XLSXWriter
|
||||
return $string;
|
||||
}
|
||||
|
||||
public function sanitize_filename($filename) //http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx
|
||||
{
|
||||
$nonprinting = array_map('chr', range(0,31));
|
||||
$invalid_chars = array('<', '>', '?', '"', ':', '|', '\\', '/', '*', '&');
|
||||
$all_invalids = array_merge($nonprinting,$invalid_chars);
|
||||
return str_replace($all_invalids, "", $filename);
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
public function sanitize_sheetname($sheetname)
|
||||
{
|
||||
static $badchars = '\\/?*:[]';
|
||||
static $goodchars = ' ';
|
||||
$sheetname = strtr($sheetname, $badchars, $goodchars);
|
||||
$sheetname = substr($sheetname, 0, 31);
|
||||
$sheetname = trim(trim(trim($sheetname),"'"));//trim before and after trimming single quotes
|
||||
return !empty($sheetname) ? $sheetname : 'Sheet'.((rand()%900)+100);
|
||||
}
|
||||
|
||||
public function writeToFile($filename)
|
||||
{
|
||||
@unlink($filename);//if the zip already exists, overwrite it
|
||||
|
Reference in New Issue
Block a user