Код: Выделить всё
<dd><input id="replacement" type="text" name="replacement" value="{REPLACEMENT}" maxlength="255" /></dd>
Код: Выделить всё
<dd><textarea id="replacement" name="replacement">{REPLACEMENT}</textarea></dd>
Код: Выделить всё
$word = utf8_normalize_nfc(request_var('word', '', true));
$replacement = utf8_normalize_nfc(request_var('replacement', '', true));
Код: Выделить всё
$replacement=utf8_substr($replacement, 0, 255);
Код: Выделить всё
function censor_text($text)
Код: Выделить всё
function censor_text($text, $html=false)
Код: Выделить всё
if (sizeof($censors))
{
return preg_replace($censors['match'], $censors['replace'], $text);
}
Код: Выделить всё
if (sizeof($censors))
{
if(!isset($censors['match_html']) && !isset($censors['match_nohtml']))
{
foreach($censors['replace'] as $k => $v)
{
if(preg_match('/<\w+/', $v))
{
$censors['match_html'][$k]=$censors['match'][$k];
$censors['replace_html'][$k]=htmlspecialchars_decode($v);
}
else
{
$censors['match_html'][$k]=$censors['match'][$k];
$censors['replace_html'][$k]=$censors['replace'][$k];
$censors['match_nohtml'][$k]=$censors['match'][$k];
$censors['replace_nohtml'][$k]=$censors['replace'][$k];
}
}
}
if($html && isset($censors['match_html']) && sizeof($censors['match_html']))
{
return preg_replace($censors['match_html'], $censors['replace_html'], $text);
}
else if(isset($censors['match_nohtml']) && sizeof($censors['match_nohtml']))
{
return preg_replace($censors['match_nohtml'], $censors['replace_nohtml'], $text);
}
else
{
return $text;
}
}
/*if (sizeof($censors))
{
if(!isset($censors['no_html']))
{
$censors['replace']=array_map('htmlspecialchars_decode', $censors['replace']);
$censors['no_html']=array_map('strip_tags', $censors['replace']);
}
return preg_replace($censors['match'], ($html ? $censors['replace'] : $censors['no_html']), $text);
}*/
Код: Выделить всё
// Parse the message and subject
$message = censor_text($row['post_text']);
Код: Выделить всё
// Parse the message and subject
$message = censor_text($row['post_text'], true);
PPK
Bocman
coder
vulkan3
PPK
vulkan3
PPK писал(а):2. Замена с html кодом работает только на странице списка сообщений (и только в сообщениях)
vulkan3 писал(а):ну обычный цензор сами ссылки не изменяет только название
PPK
Код: Выделить всё
$parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true);
Код: Выделить всё
$message = censor_text($row['post_text'], true);
spoiler
Beer
PPK
Beer