Input validation

Functions to validate user input.

Functions

NameLocationDescription
check_urlincludes/common.incPrepare a URL for use in an HTML attribute. Strips harmful protocols.
decode_entitiesincludes/common.incDecode all HTML entities (including numerical ones) to regular UTF-8 bytes. Double-escaped entities will only be decoded once ("&amp;lt;" becomes "&lt;", not "<").
drupal_add_linkincludes/common.incAdd a <link> tag to the page's HEAD.
drupal_attributesincludes/common.incFormat an attribute string to insert in a tag.
drupal_check_tokenincludes/common.incCheck the form token if there is POST data for an authenticated user to defend against cross site request forgeries.
drupal_convert_to_utf8includes/common.incConvert data to UTF-8
drupal_evalincludes/common.incEvaluate a string of PHP code.
drupal_get_pathincludes/common.incReturns the path to a system item (module, theme, etc.).
drupal_get_private_keyincludes/common.incEnsure the private key variable used to generate tokens is set.
drupal_get_tokenincludes/common.incGenerate a token based on $value, the current user session and private key.
drupal_map_associncludes/common.incForm an associative array from a linear array.
drupal_page_footerincludes/common.incPerform end-of-request tasks.
drupal_valid_tokenincludes/common.incValidate a token based on $value, the current user session and private key or penultimate private key.
drupal_xml_parser_createincludes/common.incPrepare a new XML parser.
flood_is_allowedincludes/common.incCheck if the current visitor (hostname/IP) is allowed to proceed with the specified event. The user is allowed to proceed if he did not trigger the specified event more than $threshold times per hour.
flood_register_eventincludes/common.incRegister an event for the current visitor (hostname/IP) to the flood control mechanism.
formincludes/common.incGenerate a form from a set of form elements.
format_dateincludes/common.incFormat a date with the given configured format or a custom format string.
format_intervalincludes/common.incFormat a time interval with the requested granularity.
format_nameincludes/common.incFormat a username.
format_pluralincludes/common.incFormat a string containing a count of items.
format_rss_channelincludes/common.incFormats an RSS channel.
format_rss_itemincludes/common.incFormat a single RSS item.
format_sizeincludes/common.incGenerate a string representation for the given byte count.
form_buttonincludes/common.incFormat an action button.
form_checkboxincludes/common.incFormat a checkbox.
form_checkboxesincludes/common.incFormat a set of checkboxes.
form_fileincludes/common.incFormat a file upload field.
form_get_errorsincludes/common.incReturn an associative array of all errors.
form_groupincludes/common.incFormat a group of form items.
form_hiddenincludes/common.incStore data in a hidden form field.
form_itemincludes/common.incFormat a general form item.
form_passwordincludes/common.incFormat a single-line text field that does not display its contents visibly.
form_radioincludes/common.incFormat a radio button.
form_radiosincludes/common.incFormat a set of radio buttons.
form_selectincludes/common.incFormat a dropdown menu or scrolling selection box.
form_set_errorincludes/common.incFile an error against the form element with the specified name.
form_submitincludes/common.incFormat a form submit button.
form_textareaincludes/common.incFormat a multiple-line text field.
form_textfieldincludes/common.incFormat a single-line text field.
form_tokenincludes/common.incGenerate a form token based on the session and the private key to defend against cross site request forgeries.
form_weightincludes/common.incFormat a weight selection menu.
lincludes/common.incFormat an internal Drupal link.
mime_header_encodeincludes/common.incEncodes MIME/HTTP header values that contain non-ASCII, UTF-8 encoded characters.
string_lengthincludes/common.incCount the amount of characters in a UTF-8 string. This is less than or equal to the byte count.
truncate_utf8includes/common.incTruncate a UTF-8-encoded string safely.
urlincludes/common.incGenerate an internal Drupal URL.
valid_email_addressincludes/common.incVerify the syntax of the given e-mail address.
valid_urlincludes/common.incVerify the syntax of the given URL.
_decode_entitiesincludes/common.incHelper function for decode_entities
_form_get_errorincludes/common.incReturn the error message filed against the form with the specified name.
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.