dl/includes/HTMLTools.php

25 lines
504 B
PHP
Raw Permalink Normal View History

2020-06-17 18:49:28 +00:00
<?php
class HTMLTools {
private static $invisibleSpace = '<span class="invisiblespace"> </span>';
public static function makeSafe ($string) {
return htmlentities($string);
}
public static function makeSafeAndWrapBetter ($string) {
return preg_replace(
array('~/|-|\.~'),
array(static::$invisibleSpace.'$0'.static::$invisibleSpace), // Put an invisible space before and after each slash, hyphen and period
static::makeSafe($string)
);
}
}
?>