diff --git a/system/text.php b/system/text.php deleted file mode 100644 index 1881b1ed..00000000 --- a/system/text.php +++ /dev/null @@ -1,98 +0,0 @@ -= $limit) - { - $out = trim($out); - - return (strlen($out) == strlen($value)) ? $out : $out.$end; - } - } - } - - /** - * Censor a string. - * - * @param string $value - * @param array $censored - * @param string $replacement - * @return string - */ - public static function censor($value, $censored, $replacement = '####') - { - $value = ' '.$value.' '; - - // Assume the word will be book-ended by the following. - $delim = '[-_\'\"`(){}<>\[\]|!?@#%&,.:;^~*+=\/ 0-9\n\r\t]'; - - foreach ($censored as $word) - { - if ($replacement != '') - { - $value = preg_replace("/({$delim})(".str_replace('\*', '\w*?', preg_quote($word, '/')).")({$delim})/i", "\\1{$replacement}\\3", $value); - } - else - { - $value = preg_replace("/({$delim})(".str_replace('\*', '\w*?', preg_quote($word, '/')).")({$delim})/ie", "'\\1'.str_repeat('#', strlen('\\2')).'\\3'", $value); - } - } - - return trim($value); - } - -} \ No newline at end of file