Thats correct. Its also writable as ternary:
// or can call get_magic_quotes_gpc() which returns a boolean
$text = ini_get('magic_quotes_gpc') ? stripslashes($text) : $text;
The search and replace seems a little overboard though. You can run that through htmlspecialchars or htmlentities instead of doing the work yourself. It looks like a syntax error on the forums here, but I'm betting you that its no problem at all.