function check_plain

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

Also validates strings as UTF-8.


$text: The text to be checked or processed.

Return value

An HTML safe version of $text, or an empty string if $text is not valid UTF-8.

See also


Related topics

262 calls to check_plain()
action_admin_manage in drupal/core/modules/action/
Menu callback; Displays an overview of available and configured actions.
action_views_form_substitutions in drupal/core/modules/action/
Implements hook_views_form_substitutions().
aggregator_block_view in drupal/core/modules/aggregator/aggregator.module
Implements hook_block_view().
aggregator_categorize_items in drupal/core/modules/aggregator/
Form constructor to build the page list form.
aggregator_form_feed in drupal/core/modules/aggregator/
Form constructor for adding and editing feed sources.

... See full list

15 string references to 'check_plain'
AccountFormController::form in drupal/core/modules/user/lib/Drupal/user/AccountFormController.php
Overrides Drupal\Core\Entity\EntityFormController::form().
aggregator_form_opml in drupal/core/modules/aggregator/
Form constructor for importing feeds from OPML.
AttributeArray::__toString in drupal/core/lib/Drupal/Core/Template/AttributeArray.php
Implements the magic __toString() method.
block_admin_configure in drupal/core/modules/block/
Form constructor for the block configuration form.
FilterPluginBase::buildExposeForm in drupal/core/modules/views/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php
Options form subform for exposed filter options.

... See full list


drupal/core/includes/, line 1585
Functions that need to be loaded on every Drupal request.


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