MyBB Community Forums

Full Version: Replace Apostrophes(+bug)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For technical reasons, I'm trying to replace the Apostrophe within post messages with '
I just put the replace inside the function htmlspecialchars_uni($message), but that didn't work Sad
function htmlspecialchars_uni($message)
{
	$message = preg_replace("#&(?!\#[0-9]+;)#si", "&", $message); // Fix & but allow unicode
	$message = str_replace("<", "&lt;", $message);
	$message = str_replace(">", "&gt;", $message);
	$message = str_replace("'", "'", $message);
	$message = str_replace("\"", "&quot;", $message);
	return $message;
}
Did I miss some cache that affects? Or where should I do the replacement?

Thanks in advance.

---
OK, I've just realized that I could use the parse_message_start hook. So problem solved Big Grin

---
p.d. Just notice that there's a bug in MyBB. The second apostrophe should read &#39 ; (without the space)