1 bootstrap.inc check_plain($text)

Encodes special characters in a plain-text string for display as HTML.

Also validates strings as UTF-8 to prevent cross site scripting attacks on Internet Explorer 6.

Parameters

string $text: The text to be checked or processed.

Return value

string: An HTML safe version of $text. If $text is not valid UTF-8, an empty string is returned.

See also

backdrop_validate_utf8()

Related topics

File

core/includes/bootstrap.inc, line 2083
Functions that need to be loaded on every Backdrop request.

Code

function check_plain($text) {
  return htmlspecialchars((string) $text, ENT_QUOTES, 'UTF-8');
}