19 lines
256 B
PHP
19 lines
256 B
PHP
|
<?php
|
||
|
|
||
|
function slugify($string, $maxlength = 50) {
|
||
|
return preg_replace([
|
||
|
'\s+',
|
||
|
'[^a-z0-9\-_]'
|
||
|
], [
|
||
|
'-',
|
||
|
''
|
||
|
],
|
||
|
strtolower(trim($string))
|
||
|
);
|
||
|
}
|
||
|
|
||
|
|
||
|
function escape4xml($string) {
|
||
|
return htmlspecialchars($string, ENT_QUOTES | ENT_XML1);
|
||
|
}
|