common.inc
Common functions that many Drupal modules will need to reference.
The functions that are critical and need to be available even when serving a cached page are instead located in bootstrap.inc.
File
includes/common.incFunctions
Name | Description |
---|---|
archiver_get_archiver | Creates the appropriate archiver for the specified file. |
archiver_get_extensions | Returns a string of supported archive extensions. |
archiver_get_info | Retrieves a list of all available archivers. |
base_path | Returns the base URL path (i.e., directory) of the Drupal installation. |
check_url | Strips dangerous protocols from a URI and encodes it for output to HTML. |
date_iso8601 | Returns an ISO8601 formatted date based on the given date. |
debug | Outputs debug information. |
drupal_access_denied | Delivers an "access denied" error to the browser. |
drupal_add_css | Adds a cascading stylesheet to the stylesheet queue. |
drupal_add_feed | Adds a feed URL for the current page. |
drupal_add_html_head | Adds output to the HEAD tag of the HTML page. |
drupal_add_html_head_link | Adds a LINK tag with a distinct 'rel' attribute to the page's HEAD. |
drupal_add_js | Adds a JavaScript file, setting, or inline code to the page. |
drupal_add_library | Adds multiple JavaScript or CSS files at the same time. |
drupal_add_region_content | Adds content to a specified region. |
drupal_add_tabledrag | Assists in adding the tableDrag JavaScript behavior to a themed table. |
drupal_aggregate_css | Default callback to aggregate CSS files and inline content. |
drupal_array_diff_assoc_recursive | Recursively computes the difference of arrays with additional index check. |
drupal_array_get_nested_value | Retrieves a value from a nested array with variable depth. |
drupal_array_nested_key_exists | Determines whether a nested array contains the requested keys. |
drupal_array_set_nested_value | Sets a value in a nested array with variable depth. |
drupal_attributes | Converts an associative array to an XML/HTML tag attribute string. |
drupal_build_css_cache | Aggregates and optimizes CSS files into a cache file in the files directory. |
drupal_build_js_cache | Aggregates JavaScript files into a cache file in the files directory. |
drupal_check_incompatibility | Checks whether a version is compatible with a given dependency. |
drupal_clean_css_identifier | Prepares a string for use as a CSS identifier (element, class, or ID name). |
drupal_clear_css_cache | Deletes old cached CSS files. |
drupal_clear_js_cache | Deletes old cached JavaScript files and variables. |
drupal_common_theme | Provides theme registration for themes across .inc files. |
drupal_cron_cleanup | DEPRECATED: Shutdown function: Performs cron cleanup. |
drupal_cron_run | Executes a cron run when called. |
drupal_delete_file_if_stale | Callback to delete files modified more than a set time ago. |
drupal_deliver_html_page | Packages and sends the result of a page callback to the browser as HTML. |
drupal_deliver_page | Delivers a page callback result to the browser in the appropriate format. |
drupal_encode_path | Encodes a Drupal path for use in a URL. |
drupal_exit | Performs end-of-request tasks. |
drupal_explode_tags | Explodes a string of tags into an array. |
drupal_flush_all_caches | Flushes all cached data on the site. |
drupal_get_breadcrumb | Gets the breadcrumb trail for the current page. |
drupal_get_css | Returns a themed representation of all stylesheets to attach to the page. |
drupal_get_destination | Prepares a 'destination' URL query parameter for use with drupal_goto(). |
drupal_get_feeds | Gets the feed URLs for the current page. |
drupal_get_filetransfer_info | Assembles the Drupal FileTransfer registry. |
drupal_get_html_head | Retrieves output to be displayed in the HEAD tag of the HTML page. |
drupal_get_js | Returns a themed presentation of all JavaScript code for the current page. |
drupal_get_library | Retrieves information for a JavaScript/CSS library. |
drupal_get_path | Returns the path to a system item (module, theme, etc.). |
drupal_get_private_key | Ensures the private key variable used to generate tokens is set. |
drupal_get_profile | Gets the name of the currently active installation profile. |
drupal_get_query_array | Splits a URL-encoded query string into an array. |
drupal_get_query_parameters | Processes a URL query parameter array to remove unwanted elements. |
drupal_get_rdf_namespaces | Returns a string containing RDF namespace declarations for use in XML and XHTML output. |
drupal_get_region_content | Gets assigned content for a given region. |
drupal_get_schema_unprocessed | Returns the unprocessed and unaltered version of a module's schema. |
drupal_get_token | Generates a token based on $value, the user session, and the private key. |
drupal_get_updaters | Assembles the Drupal Updater registry. |
drupal_goto | Sends the user to a different page. |
drupal_group_css | Default callback to group CSS items. |
drupal_html_class | Prepares a string for use as a valid class name. |
drupal_html_id | Prepares a string for use as a valid HTML ID and guarantees uniqueness. |
drupal_http_build_query | Parses an array into a valid, rawurlencoded query string. |
drupal_http_header_attributes | Formats an attribute string for an HTTP header. |
drupal_http_request | Performs an HTTP request. |
drupal_implode_tags | Implodes an array of tags into a string. |
drupal_install_schema | Creates all tables defined in a module's hook_schema(). |
drupal_json_decode | Converts an HTML-safe JSON string into its PHP equivalent. |
drupal_json_encode | Converts a PHP variable into its JavaScript equivalent. |
drupal_json_output | Returns data in JSON format. |
drupal_js_defaults | Constructs an array of the defaults that are used for JavaScript items. |
drupal_load_stylesheet | Loads the stylesheet and resolves all @import commands. |
drupal_load_stylesheet_content | Processes the contents of a stylesheet for aggregation. |
drupal_map_assoc | Forms an associative array from a linear array. |
drupal_not_found | Delivers a "page not found" error to the browser. |
drupal_page_footer | Performs end-of-request tasks. |
drupal_page_set_cache | Stores the current page in the cache. |
drupal_parse_dependency | Parses a dependency for comparison by drupal_check_incompatibility(). |
drupal_parse_info_file | Parses Drupal module and theme .info files. |
drupal_parse_info_format | Parses data in Drupal's .info format. |
drupal_parse_url | Parses a URL string into its path, query, and fragment components. |
drupal_pre_render_conditional_comments | #pre_render callback to render #browsers into #prefix and #suffix. |
drupal_pre_render_link | #pre_render callback to render a link into #markup. |
drupal_pre_render_links | #pre_render callback that collects child links into a single array. |
drupal_pre_render_markup | #pre_render callback to append contents in #markup to #children. |
drupal_pre_render_styles | #pre_render callback to add the elements needed for CSS tags to be rendered. |
drupal_process_attached | Adds attachments to a render() structure. |
drupal_process_states | Adds JavaScript to change the state of an element based on another element. |
drupal_region_class | Provides a standard HTML class name that identifies a page region. |
drupal_render | Renders HTML given a structured array tree. |
drupal_render_cache_by_query | Prepares an element for caching based on a query. |
drupal_render_cache_get | Gets the rendered output of a renderable element from the cache. |
drupal_render_cache_set | Caches the rendered output of a renderable element. |
drupal_render_children | Renders children of an element and concatenates them. |
drupal_render_cid_create | Creates the cache ID for a renderable element. |
drupal_render_cid_parts | Returns cache ID parts for building a cache ID. |
drupal_render_collect_attached | Collects #attached for an element and its children into a single array. |
drupal_render_page | Renders the page, including all theming. |
drupal_schema_fields_sql | Retrieves a list of fields from a table schema. |
drupal_schema_field_types | Retrieves the type for every field in a table schema. |
drupal_set_breadcrumb | Sets the breadcrumb trail for the current page. |
drupal_set_page_content | Sets the main page content value for later use. |
drupal_set_time_limit | Attempts to set the PHP maximum execution time. |
drupal_site_offline | Delivers a "site is under maintenance" message to the browser. |
drupal_sort_css_js | Sorts CSS and JavaScript resources. |
drupal_sort_title | Array sorting callback; sorts elements by 'title' key. |
drupal_sort_weight | Sorts a structured array by the 'weight' element. |
drupal_strip_dangerous_protocols | Strips dangerous protocols (e.g. 'javascript:') from a URI. |
drupal_system_listing | Returns information about system object files (modules, themes, etc.). |
drupal_uninstall_schema | Removes all tables defined in a module's hook_schema(). |
drupal_valid_token | Validates a token based on $value, the user session, and the private key. |
drupal_write_record | Saves (inserts or updates) a record to the database based upon the schema. |
element_child | Checks if the key is a child. |
element_children | Identifies the children of an element array, optionally sorted by weight. |
element_get_visible_children | Returns the visible children of an element. |
element_info | Retrieves the default properties for the defined element type. |
element_info_property | Retrieves a single property for the defined element type. |
element_properties | Gets properties of a structured array element (keys beginning with '#'). |
element_property | Checks if the key is a property. |
element_set_attributes | Sets HTML attributes based on element properties. |
element_sort | Function used by uasort to sort structured arrays by weight. |
element_sort_by_title | Array sorting callback; sorts elements by title. |
entity_create_stub_entity | Helper function to assemble an object structure with initial ids. |
entity_extract_ids | Helper function to extract id, vid, and bundle name from an entity. |
entity_form_field_validate | Attaches field API validation to entity forms. |
entity_form_submit_build_entity | Copies submitted values to entity properties for simple entity forms. |
entity_get_controller | Gets the entity controller for an entity type. |
entity_get_info | Get the entity info array of an entity type. |
entity_info_cache_clear | Resets the cached information about entity types. |
entity_label | Returns the label of an entity. |
entity_language | Returns the language of an entity. |
entity_load | Load entities from the database. |
entity_load_unchanged | Loads the unchanged, i.e. not modified, entity from the database. |
entity_prepare_view | Invoke hook_entity_prepare_view(). |
entity_uri | Returns the URI elements of an entity. |
entity_view_mode_prepare | Invoke hook_entity_view_mode_alter(). |
filter_xss | Filters HTML to prevent cross-site-scripting (XSS) vulnerabilities. |
filter_xss_admin | Applies a very permissive XSS/HTML filter for admin-only use. |
filter_xss_bad_protocol | Processes an HTML attribute value and strips dangerous protocols from URLs. |
fix_gpc_magic | Fixes double-escaping caused by "magic quotes" in some PHP installations. |
flood_clear_event | Makes the flood control mechanism forget an event for the current visitor. |
flood_is_allowed | Checks whether a user is allowed to proceed with the specified event. |
flood_register_event | Registers an event for the current visitor to the flood control mechanism. |
format_date | Formats a date, using a date type or a custom date format string. |
format_interval | Formats a time interval with the requested granularity. |
format_plural | Formats a string containing a count of items. |
format_rss_channel | Formats an RSS channel. |
format_rss_item | Formats a single RSS item. |
format_size | Generates a string representation for the given byte count. |
format_username | Format a username. |
format_xml_elements | Formats XML elements. |
hide | Hides an element from later rendering. |
l | Formats an internal or external URL link as an HTML anchor tag. |
parse_size | Parses a given byte count. |
render | Renders an element. |
show | Shows a hidden element for later rendering. |
url | Generates an internal or external URL. |
url_is_external | Returns TRUE if a path is external to Drupal (e.g. http://example.com). |
valid_email_address | Verifies the syntax of the given e-mail address. |
valid_url | Verifies the syntax of the given URL. |
watchdog_severity_levels | Returns a list of severity levels, as defined in RFC 3164. |
xmlrpc | Performs one or more XML-RPC request(s). |
_drupal_bootstrap_full | |
_drupal_build_css_path | Prefixes all paths within a CSS file for drupal_build_css_cache(). |
_drupal_default_html_head | Returns elements that are always displayed in the HEAD tag of the HTML page. |
_drupal_flush_css_js | Changes the dummy query string added to all CSS and JavaScript files. |
_drupal_http_use_proxy | Helper function for determining hosts excluded from needing a proxy. |
_drupal_load_stylesheet | Loads stylesheets recursively and returns contents with corrected paths. |
_drupal_parse_response_status | Splits an HTTP response status line into components. |
_drupal_schema_initialize | Fills in required default values for table definitions from hook_schema(). |
_filter_xss_attributes | Processes a string of HTML attributes. |
_filter_xss_split | Processes an HTML tag. |
_fix_gpc_magic | Strips slashes from a string or array of strings. |
_fix_gpc_magic_files | Strips slashes from $_FILES items. |
_format_date_callback | Translates a formatted date string. |
Constants
Name | Description |
---|---|
CSS_DEFAULT | The default group for module CSS files added to the page. |
CSS_SYSTEM | The default group for system CSS files added to the page. |
CSS_THEME | The default group for theme CSS files added to the page. |
DRUPAL_CACHE_CUSTOM | The block is handling its own caching in its hook_block_view(). |
DRUPAL_CACHE_GLOBAL | The block or element is the same for every user and page that it is visible. |
DRUPAL_CACHE_PER_PAGE | The block or element can change depending on the page being viewed. |
DRUPAL_CACHE_PER_ROLE | The block or element can change depending on the user's roles. |
DRUPAL_CACHE_PER_USER | The block or element can change depending on the user. |
DRUPAL_NO_CACHE | The block should not get cached. |
HTTP_REQUEST_TIMEOUT | Error code indicating that the request exceeded the specified timeout. |
JS_DEFAULT | The default group for module JavaScript code added to the page. |
JS_LIBRARY | The default group for JavaScript and jQuery libraries added to the page. |
JS_THEME | The default group for theme JavaScript code added to the page. |
SAVED_DELETED | Return status for saving which deleted an existing item. |
SAVED_NEW | Return status for saving which involved creating a new item. |
SAVED_UPDATED | Return status for saving which involved an update to an existing item. |
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!common.inc/7.x