Well, in
functions.php, there is this function for the censorship system:
PHP Code:
// #############################################################################
/**
* Replaces any instances of words censored in $vbulletin->options['censorwords'] with $vbulletin->options['censorchar']
*
* @param string Text to be censored
*
* @return string
*/
function fetch_censored_text($text)
{
global $vbulletin;
static $censorwords;
if (!$text)
{
// return $text rather than nothing, since this could be '' or 0
return $text;
}
if ($vbulletin->options['enablecensor'] AND !empty($vbulletin->options['censorwords']))
{
if (empty($censorwords))
{
$vbulletin->options['censorwords'] = preg_quote($vbulletin->options['censorwords'], '#');
$censorwords = preg_split('#[ \r\n\t]+#', $vbulletin->options['censorwords'], -1, PREG_SPLIT_NO_EMPTY);
}
foreach ($censorwords AS $censorword)
{
if (substr($censorword, 0, 2) == '\\{')
{
if (substr($censorword, -2, 2) == '\\}')
{
// prevents errors from the replace if the { and } are mismatched
$censorword = substr($censorword, 2, -2);
}
// ASCII character search 0-47, 58-64, 91-96, 123-127
$nonword_chars = '\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f';
// words are delimited by ASCII characters outside of A-Z, a-z and 0-9
$text = preg_replace(
'#(?<=[' . $nonword_chars . ']|^)' . $censorword . '(?=[' . $nonword_chars . ']|$)#si',
str_repeat($vbulletin->options['censorchar'], vbstrlen($censorword)),
$text
);
}
else
{
$text = preg_replace("#$censorword#si", str_repeat($vbulletin->options['censorchar'], vbstrlen($censorword)), $text);
}
}
}
// strip any admin-specified blank ascii chars
$text = strip_blank_ascii($text, $vbulletin->options['censorchar']);
return $text;
}
When a message has censored words, this function replaces each character of the word with the
censorchar.
I want to change this function to return the $text WITH the censored words, BUT beside each censored word, I want to there is a " " (space).
For example, if I write the censored word "example" I want to return " example".
I know it is droll, but I need it
Thanks in advance and sorry for my bad english.