csvxml/inc/zeichen.php
Joshua Ramon Enslin d6470110e9 Ran PHPCBF
phpcs-errors:253 phpunit-status:successful
2019-11-12 21:25:52 +01:00

57 lines
2.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?PHP
/**
* Function for sanitizing contents for prospective XML contents.
*
* @param string $transform Input string.
*
* @return string
*/
function transform(string $transform):string {
$transform = str_replace(chr(14), "", $transform);
$transform = str_replace('&quot;', '"', $transform);
$transform = str_replace('&', '&amp;', $transform);
$transform = str_replace('"', '&quot;', $transform);
$transform = str_replace('</br>', ' ', $transform);
$transform = str_replace('<br />', ' ', $transform);
$transform = str_replace('&rsquo;', '\'', $transform);
$transform = str_replace(chr(11), ' ', $transform);
$transform = str_replace('<', '&lt;', $transform);
$transform = str_replace('>', '&gt;', $transform);
$transform = str_replace('´', '&apos;', $transform);
$transform = str_replace('&sbquo', '\'', $transform);
$transform = str_replace('&lsquo', '\'', $transform);
$transform = str_replace(chr(96), '\'', $transform);
$transform = str_replace(chr(130), '\'', $transform);
$transform = str_replace(chr(145), '\'', $transform);
$transform = str_replace(chr(146), '\'', $transform);
return $transform;
}
/**
* Function for sanitizing contents for prospective XML contents.
*
* @param string $tagify Input string.
*
* @return string
*/
function tagify(string $tagify):string {
$tagify = str_replace(' ', '_', $tagify);
$tagify = str_replace('/', '_', $tagify);
$tagify = str_replace(',', '_', $tagify);
$tagify = str_replace('__', '_', $tagify);
$tagify = str_replace('Ä', 'ae', $tagify);
$tagify = str_replace('ä', 'ae', $tagify);
$tagify = str_replace('Ö', 'oe', $tagify);
$tagify = str_replace('ö', 'oe', $tagify);
$tagify = str_replace('Ü', 'ue', $tagify);
$tagify = str_replace('ü', 'ue', $tagify);
$tagify = str_replace('ß', 'ss', $tagify);
$tagify = str_replace(chr(41), '', $tagify);
$tagify = str_replace(chr(40), '', $tagify);
return $tagify;
}