check_plain

Versions
4.6 – 7
check_plain($text)

Encode 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.

see drupal_validate_utf8().

Parameters

$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.

▾ 148 functions call check_plain()

aggregator_block_view in modules/aggregator/aggregator.module
Implement hook_block_view().
aggregator_categorize_items in modules/aggregator/aggregator.pages.inc
Form builder; build the page list form.
aggregator_form_feed in modules/aggregator/aggregator.admin.inc
Form builder; Generate a form to add/edit feed sources.
authorize_run_operation in includes/authorize.inc
Run the operation specified in $_SESSION['authorize_operation']
block_admin_display_form in modules/block/block.admin.inc
Generate main blocks administration form.
block_form_user_profile_form_alter in modules/block/block.module
Implement hook_form_FORM_ID_alter().
block_menu in modules/block/block.module
Implement hook_menu().
comment_multiple_delete_confirm in modules/comment/comment.admin.inc
List the selected comments and verify that the admin wants to delete them.
comment_node_update_index in modules/comment/comment.module
Implement hook_node_update_index().
comment_preview in modules/comment/comment.module
Generate a comment preview.
comment_tokens in modules/comment/comment.tokens.inc
Implement hook_tokens().
dblog_event in modules/dblog/dblog.admin.inc
Menu callback; displays details about a log message.
drupal_add_html_head_link in includes/common.inc
Add a LINK tag with a distinct 'rel' attribute to the page's HEAD.
drupal_attributes in includes/common.inc
Format an attribute string to insert in a tag.
drupal_block_denied in includes/bootstrap.inc
Handle denied users.
drupal_deliver_html_page in includes/common.inc
Package and send the result of a page callback to the browser as a normal HTML page.
drupal_deliver_page in includes/common.inc
Deliver a page callback result to the browser in the format appropriate.
drupal_get_title in includes/path.inc
Get the title of the current page, for display on the page and in the title bar.
drupal_settings_initialize in includes/bootstrap.inc
Loads the configuration and sets the base URL, cookie domain, and session name correctly.
drupal_set_title in includes/path.inc
Set the title of the current page, for display on the page and in the title bar.
field_default_form in modules/field/field.form.inc
Create a separate form element for each field.
field_default_view in modules/field/field.default.inc
Default field 'view' operation.
field_multiple_value_form in modules/field/field.form.inc
Special handling to create form elements for multiple values.
field_test_field_sanitize in modules/field/tests/field_test.field.inc
Implements hook_field_sanitize().
field_ui_display_overview_form in modules/field_ui/field_ui.admin.inc
Menu callback; presents a listing of fields display settings for a content type.
field_ui_field_edit_form in modules/field_ui/field_ui.admin.inc
Menu callback; presents the field instance edit page.
field_ui_field_overview_form in modules/field_ui/field_ui.admin.inc
Menu callback; listing of fields for a content type.
file_create_htaccess in includes/file.inc
Creates an .htaccess file in the given directory.
filter_admin_configure in modules/filter/filter.admin.inc
Build a form to change the settings for filters in a text format.
filter_admin_overview in modules/filter/filter.admin.inc
Menu callback; Displays a list of all text formats and allows them to be rearranged.
filter_xss_bad_protocol in includes/common.inc
Processes an HTML attribute value and ensures it does not contain an URL with a disallowed protocol (e.g. javascript:).
format_rss_channel in includes/common.inc
Formats an RSS channel.
format_rss_item in includes/common.inc
Format a single RSS item.
format_xml_elements in includes/common.inc
Format XML elements.
form_process_radios in includes/form.inc
Roll out a single radios element to a list of radios, using the options array as index.
form_select_options in includes/form.inc
Convert a select form element's options array into an HTML.
form_storage_test_form_submit in modules/simpletest/tests/form_test.module
Multistep form submit callback.
garland_preprocess_page in themes/garland/template.php
Override or insert variables into the page template.
hook_field_load in modules/field/field.api.php
Define custom load behavior for this module's field types.
hook_field_sanitize in modules/field/field.api.php
Define custom sanitize behavior for this module's field types.
hook_form in modules/node/node.api.php
Display a node editing form.
hook_node_update_index in modules/node/node.api.php
Act on a node being indexed for searching.
hook_search_execute in modules/search/search.api.php
Execute a search for a set of key words.
hook_update_index in modules/search/search.api.php
Update Drupal's full-text index for this module.
image_style_form in modules/image/image.admin.inc
Form builder; Edit an image style name and effects order.
l in includes/common.inc
Format an internal Drupal link.
locale_date_format_form in modules/locale/locale.module
Provide date localization configuration options to users.
locale_languages_overview_form in includes/locale.inc
User interface for the language overview screen.
locale_language_url_rewrite_session in includes/locale.inc
Rewrite URLs for the Session language provider.
locale_translate_edit_form in includes/locale.inc
User interface for string editing.
menu_block_info in modules/menu/menu.module
Implement hook_block_info().
menu_block_view in modules/menu/menu.module
Implement hook_block_view().
node_admin_nodes in modules/node/node.admin.inc
Form builder: Builds the node administration overview.
node_example_form in developer/examples/node_example.module
Implementation of hook_form().
node_list_permissions in modules/node/node.module
Helper function to generate standard node permission list for a given type.
node_multiple_delete_confirm in modules/node/node.admin.inc
node_search_execute in modules/node/node.module
Implement hook_search_execute().
node_tokens in modules/node/node.tokens.inc
Implement hook_tokens().
openid_form_user_register_form_alter in modules/openid/openid.module
Implement hook_form_alter().
openid_user_identities in modules/openid/openid.pages.inc
Menu callback; Manage OpenID identities for the specified user.
poll_teaser in modules/poll/poll.module
Creates a simple teaser that lists all the choices.
poll_view_voting in modules/poll/poll.module
Generates the voting form for a poll.
poll_votes in modules/poll/poll.pages.inc
Callback for the 'votes' tab for polls you can see other votes on
profile_admin_overview in modules/profile/profile.admin.inc
Form builder to display a listing of all editable profile fields.
profile_admin_settings_autocomplete in modules/profile/profile.admin.inc
Retrieve a pipe delimited string of autocomplete suggestions for profile categories
profile_autocomplete in modules/profile/profile.pages.inc
Callback to allow autocomplete of profile text fields.
profile_block_configure in modules/profile/profile.module
Implement hook_block_configure().
profile_browse in modules/profile/profile.pages.inc
Menu callback; display a list of user information.
profile_form_alter in modules/profile/profile.module
Implement hook_form_alter().
profile_user_view in modules/profile/profile.module
Implement hook_user_view().
profile_view_field in modules/profile/profile.module
scaffolding_example_overview_pager in developer/examples/scaffolding_example/scaffolding_example.admin.inc
Builds a sortable, paged overview of all records.
shortcut_set_switch in modules/shortcut/shortcut.admin.inc
Menu callback; Build the form for switching shortcut sets.
st in includes/install.inc
Functional equivalent of t(), used when some systems are not available.
statistics_access_log in modules/statistics/statistics.admin.inc
Menu callback; Displays recent page accesses.
system_actions_delete_form_submit in modules/system/system.admin.inc
Process system_actions_delete form submissions.
system_date_time_settings in modules/system/system.admin.inc
Form builder; Configure the site date and time settings.
system_tokens in modules/system/system.tokens.inc
Implement hook_tokens().
system_update_7003 in modules/system/system.install
Update {blocked_ips} with valid IP addresses from {access}.
system_update_7013 in modules/system/system.install
Convert default time zone offset to default time zone name.
t in includes/common.inc
Translate strings to the page language or a given language.
taxonomy_admin_vocabulary_title_callback in modules/taxonomy/taxonomy.module
Return the vocabulary name given the vocabulary object.
taxonomy_overview_vocabularies in modules/taxonomy/taxonomy.admin.inc
Form builder to list and manage vocabularies.
taxonomy_term_title in modules/taxonomy/taxonomy.module
Title callback for term pages.
taxonomy_tokens in modules/taxonomy/taxonomy.tokens.inc
Implement hook_tokens().
template_preprocess_aggregator_item in modules/aggregator/aggregator.pages.inc
Process variables for aggregator-item.tpl.php.
template_preprocess_aggregator_summary_item in modules/aggregator/aggregator.pages.inc
Process variables for aggregator-summary-item.tpl.php.
template_preprocess_aggregator_summary_items in modules/aggregator/aggregator.pages.inc
Process variables for aggregator-summary-items.tpl.php.
template_preprocess_book_export_html in modules/book/book.module
Process variables for book-export-html.tpl.php.
template_preprocess_book_navigation in modules/book/book.module
Process variables for book-navigation.tpl.php.
template_preprocess_book_node_export_html in modules/book/book.module
Process variables for book-node-export-html.tpl.php.
template_preprocess_forum_list in modules/forum/forum.module
Process variables to format a forum listing.
template_preprocess_forum_topic_list in modules/forum/forum.module
Preprocess variables to format the topic listing.
template_preprocess_node in modules/node/node.module
Process variables for node.tpl.php
template_preprocess_poll_bar in modules/poll/poll.module
Preprocess the poll_bar theme hook.
template_preprocess_poll_results in modules/poll/poll.module
Preprocess the poll_results theme hook.
template_preprocess_poll_vote in modules/poll/poll.module
Themes the voting form for a poll.
template_preprocess_profile_block in modules/profile/profile.module
Process variables for profile-block.tpl.php.
template_preprocess_search_result in modules/search/search.pages.inc
Process variables for search-result.tpl.php.
template_preprocess_username in includes/theme.inc
Preprocess variables for theme_username().
template_preprocess_user_profile_category in modules/user/user.pages.inc
Process variables for user-profile-category.tpl.php.
text_field_load in modules/field/modules/text/text.module
Implement hook_field_load().
text_field_sanitize in modules/field/modules/text/text.module
Implement hook_field_sanitize().
theme_aggregator_block_item in modules/aggregator/aggregator.module
Format an individual feed item for display in the block.
theme_aggregator_page_opml in modules/aggregator/aggregator.pages.inc
Theme the OPML feed output.
theme_authorize_report in includes/theme.maintenance.inc
Generate a report of the results from an operation run via authorize.php.
theme_button in includes/form.inc
Theme a button form element.
theme_field_formatter_taxonomy_term_plain in modules/taxonomy/taxonomy.module
Theme function for 'plain' term field formatter.
theme_file_icon in modules/file/file.module
Return an image with an appropriate icon for the given file.
theme_file_link in modules/file/file.module
Output a link to a file.
theme_file_upload_help in modules/file/file.field.inc
Generate help text based on upload validators.
theme_hidden in includes/form.inc
Theme a hidden form element.
theme_image in includes/theme.inc
Return a themed image.
theme_image_button in includes/form.inc
Theme a image button form element.
theme_image_resize_summary in modules/image/image.admin.inc
Theme callback for image resize effect summary output.
theme_image_style_preview in modules/image/image.admin.inc
Theme callback for displaying a preview of an image style.
theme_link in includes/theme.inc
Return a themed link.
theme_links in includes/theme.inc
Return a themed set of links.
theme_locale_languages_overview_form in includes/locale.inc
Theme the language overview form.
theme_menu_admin_overview in modules/menu/menu.admin.inc
Theme the menu title and description for admin page
theme_menu_local_task in includes/menu.inc
Generate the HTML output for a single local task link.
theme_node_admin_overview in modules/node/content_types.inc
theme_node_example_order_info in developer/examples/node_example.module
A custom theme function.
theme_placeholder in includes/theme.inc
Formats text for emphasized display in a placeholder inside a sentence. Used automatically by t().
theme_radio in includes/form.inc
Theme a radio button form element.
theme_scaffolding_example_record in developer/examples/scaffolding_example/scaffolding_example.pages.inc
Theme a single record.
theme_textarea in includes/form.inc
Theme a textarea form element.
theme_textfield in includes/form.inc
Theme a textfield form element.
theme_update_report in modules/update/update.report.inc
Theme project status report.
tracker_page in modules/tracker/tracker.pages.inc
Menu callback; prints a listing of active nodes on the site.
trigger_unassign_submit in modules/trigger/trigger.admin.inc
Submit callback for trigger_unassign() form.
update_do_one in includes/update.inc
Perform one update and store the results which will later be displayed on the finished page.
update_manager_update_form in modules/update/update.manager.inc
Build the form for the update manager page to update existing projects.
url in includes/common.inc
Generate a URL.
url_is_external in includes/common.inc
Return TRUE if a path is external (e.g. http://example.com).
user_autocomplete in modules/user/user.pages.inc
Menu callback; Retrieve a JSON object containing autocomplete suggestions for existing users.
user_multiple_cancel_confirm in modules/user/user.module
user_tokens in modules/user/user.tokens.inc
Implement hook_tokens().
xmlrpc_value_get_xml in includes/xmlrpc.inc
Generate XML representing the given value.
_block_render_blocks in modules/block/block.module
Render the content and subject for a set of blocks.
_filter_html_escape in modules/filter/filter.module
Escapes all HTML tags, so they will be visible instead of being effective.
_filter_html_tips in modules/filter/filter.module
Filter tips callback for HTML filter.
_filter_url_parse_full_links in modules/filter/filter.module
Make links out of absolute URLs.
_filter_url_parse_partial_links in modules/filter/filter.module
Make links out of domain names starting with "www."
_locale_languages_configure_form_language_table in includes/locale.inc
Helper function to build a language provider table.
_locale_translate_seek in includes/locale.inc
Perform a string search and display results in a table
_node_index_node in modules/node/node.module
Index a single node.
_scaffolding_example_overview_record_field in developer/examples/scaffolding_example/scaffolding_example.admin.inc
Builds the fields for a single record on the drag-and-drop overview form.

Code

includes/bootstrap.inc, line 1175

<?php
function check_plain($text) {
  // We do not want to use drupal_static() since PHP version will never change
  // during a request.
  static $php525;

  if (!isset($php525)) {
    $php525 = version_compare(PHP_VERSION, '5.2.5', '>=');
  }
  // We duplicate the preg_match() to validate strings as UTF-8 from
  // drupal_validate_utf8() here. This avoids the overhead of an additional
  // function call, since check_plain() may be called hundreds of times during
  // a request. For PHP 5.2.5+, this check for valid UTF-8 should be handled
  // internally by PHP in htmlspecialchars().
  // @see http://www.php.net/releases/5_2_5.php
  // @todo remove this when support for either IE6 or PHP < 5.2.5 is dropped.

  if ($php525) {
    return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
  }
  return (preg_match('/^./us', $text) == 1) ? htmlspecialchars($text, ENT_QUOTES, 'UTF-8') : '';
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.