1
0
mirror of https://github.com/shuchkin/simplexlsxgen.git synced 2023-08-10 21:12:59 +03:00
This commit is contained in:
Sergey Shuchkin
2021-10-29 03:37:04 +06:00
parent 79ffbb5e30
commit 9a555eef9b
2 changed files with 6 additions and 30 deletions

View File

@ -659,6 +659,8 @@ class SimpleXLSXGen {
return $this;
}
public function esc( $str ) {
return str_replace( ['&', '<', '>', "\x03"], ['&amp;', '&lt;', '&gt;', ''], $str );
// XML UTF-8: #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
// but we use fast version
return str_replace( ['&', '<', '>', "\x00","\x03","\x0B"], ['&amp;', '&lt;', '&gt;', '', '', ''], $str );
}
}