common.inc

Version 1.1129 (checked in on 2010/03/18 at 19:15:02 by dries)

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.

Constants

NameDescription
CSS_DEFAULTThe default weight of CSS files added to the page.
CSS_SYSTEMThe default weight of system CSS files added to the page.
CSS_THEMEThe default weight of theme CSS files added to the page.
DRUPAL_CACHE_CUSTOMThe block is handling its own caching in its hook_block_view(). From the perspective of the block cache system, this is equivalent to DRUPAL_NO_CACHE. Useful when time based expiration is needed or a site uses a node access which invalidates standard...
DRUPAL_CACHE_GLOBALThe block or element is the same for every user on every page where it is visible.
DRUPAL_CACHE_PER_PAGEThe block or element can change depending on the page being viewed.
DRUPAL_CACHE_PER_ROLEThe block or element can change depending on the roles the user viewing the page belongs to. This is the default setting for blocks, used when the block does not specify anything.
DRUPAL_CACHE_PER_USERThe block or element can change depending on the user viewing the page. This setting can be resource-consuming for sites with large number of users, and thus should only be used when DRUPAL_CACHE_PER_ROLE is not sufficient.
DRUPAL_NO_CACHEThe block should not get cached. This setting should be used:
HTTP_REQUEST_TIMEOUTError code indicating that the request made by drupal_http_request() exceeded the specified timeout.
JS_DEFAULTThe default weight of JavaScript being added to the page.
JS_LIBRARYThe weight of JavaScript libraries, settings or jQuery plugins being added to the page.
JS_THEMEThe weight of theme JavaScript code being added to the page.
SAVED_DELETEDReturn status for saving which deleted an existing item.
SAVED_NEWReturn status for saving which involved creating a new item.
SAVED_UPDATEDReturn status for saving which involved an update to an existing item.

Functions

NameDescription
archiver_get_archiverCreate the appropriate archiver for the specified file.
archiver_get_infoRetrieves a list of all available archivers.
base_pathReturn the base URL path (i.e., directory) of the Drupal installation.
check_file
check_urlPrepare a URL for use in an HTML attribute. Strips harmful protocols.
date_iso8601Returns an ISO8601 formatted date based on the given date.
debugDebug function used for outputting debug information.
drupal_access_deniedDeliver a "access denied" error to the browser.
drupal_add_cssAdds a cascading stylesheet to the stylesheet queue.
drupal_add_feedAdd a feed URL for the current page.
drupal_add_html_headAdd output to the head tag of the HTML page.
drupal_add_html_head_linkAdd a LINK tag with a distinct 'rel' attribute to the page's HEAD.
drupal_add_jsAdd a JavaScript file, setting or inline code to the page.
drupal_add_libraryAdds multiple JavaScript or CSS files at the same time.
drupal_add_region_contentAdd content to a specified region.
drupal_add_tabledragAssist in adding the tableDrag JavaScript behavior to a themed table.
drupal_aggregate_cssDefault callback to aggregate CSS files and inline content.
drupal_alterHands off alterable variables to type-specific *_alter implementations.
drupal_attributesFormat an attribute string to insert in a tag.
drupal_build_css_cacheAggregate and optimize CSS files, putting them in the files directory.
drupal_build_js_cacheAggregate JS files, putting them in the files directory.
drupal_check_incompatibilityCheck whether a version is compatible with a given dependency.
drupal_clean_css_identifierPrepare a string for use as a valid CSS identifier (element, class or ID name).
drupal_clear_css_cacheDelete all cached CSS files.
drupal_clear_js_cacheDelete all cached JS files.
drupal_common_themeProvide theme registration for themes across .inc files.
drupal_cron_cleanupShutdown function for cron cleanup.
drupal_cron_runExecutes a cron run when called.
drupal_deliver_html_pagePackage and send the result of a page callback to the browser as HTML.
drupal_deliver_pageDeliver a page callback result to the browser in the format appropriate.
drupal_encode_pathEncodes a Drupal path for use in a URL.
drupal_exitPerform end-of-request tasks.
drupal_explode_tagsExplode a string of given tags into an array.
drupal_flush_all_cachesFlush all cached data on the site.
drupal_get_breadcrumbGet the breadcrumb trail for the current page.
drupal_get_cssReturns a themed representation of all stylesheets that should be attached to the page.
drupal_get_destinationPrepare a 'destination' URL query parameter for use in combination with drupal_goto().
drupal_get_feedsGet the feed URLs for the current page.
drupal_get_hash_saltGet a salt useful for hardening against SQL injection.
drupal_get_html_headRetrieve output to be displayed in the HEAD tag of the HTML page.
drupal_get_jsReturns a themed presentation of all JavaScript code for the current page.
drupal_get_libraryRetrieves information for a JavaScript/CSS library.
drupal_get_pathReturns the path to a system item (module, theme, etc.).
drupal_get_private_keyEnsure the private key variable used to generate tokens is set.
drupal_get_profileGet the name of the currently active install profile.
drupal_get_query_arraySplit an URL-encoded query string into an array.
drupal_get_query_parametersProcess a URL query parameter array to remove unwanted elements.
drupal_get_rdf_namespacesReturn a string containing RDF namespace declarations for use in XML and XHTML output.
drupal_get_region_contentGet assigned content for a given region.
drupal_get_schema_unprocessedReturns the unprocessed and unaltered version of a module's schema.
drupal_get_tokenGenerate a token based on $value, the current user session and private key.
drupal_get_updatersDrupal Updater registry.
drupal_gotoSend the user to a different Drupal page.
drupal_group_cssDefault callback to group CSS items.
drupal_html_classPrepare a string for use as a valid class name.
drupal_html_idPrepare a string for use as a valid HTML ID and guarantee uniqueness.
drupal_http_build_queryParse an array into a valid, rawurlencoded query string.
drupal_http_header_attributesFormat an attribute string for a HTTP header.
drupal_http_requestPerform an HTTP request.
drupal_implode_tagsImplode an array of tags into a string.
drupal_install_schemaCreates all tables in a module's hook_schema() implementation.
drupal_json_decodeConverts an HTML-safe JSON string into its PHP equivalent.
drupal_json_encodeConverts a PHP variable into its Javascript equivalent.
drupal_json_outputReturn data in JSON format.
drupal_js_defaultsConstructs an array of the defaults that are used for JavaScript items.
drupal_load_stylesheetLoads the stylesheet and resolves all @import commands.
drupal_load_stylesheet_contentProcess the contents of a stylesheet for aggregation.
drupal_map_assocForm an associative array from a linear array.
drupal_not_foundDeliver a "page not found" error to the browser.
drupal_page_footerPerform end-of-request tasks.
drupal_page_set_cacheStore the current page in the cache.
drupal_parse_dependencyParse a dependency for comparison by drupal_check_incompatibility().
drupal_parse_info_fileParse Drupal module and theme info file format.
drupal_parse_info_formatParse data in Drupal's .info format.
drupal_parse_urlWrapper around parse_url() to parse a system URL string into an associative array, suitable for url().
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_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_attachedAdd to the page all structures attached to a render() structure.
drupal_process_statesAdds JavaScript to the element to allow it to have different active states.
drupal_random_bytesReturns a string of highly randomized bytes (over the full 8-bit range).
drupal_region_classProvides a standard HTML class name that identifies a page region.
drupal_renderRenders HTML given a structured array tree.
drupal_render_cache_by_queryPrepare an element for caching based on a query. This smart caching strategy saves Drupal from querying and rendering to HTML when the underlying query is unchanged.
drupal_render_cache_getGet the rendered output of a renderable element from cache.
drupal_render_cache_setCache the rendered output of a renderable element.
drupal_render_childrenRender children of an element and concatenate them.
drupal_render_cid_createCreate the cache ID for a renderable element.
drupal_render_cid_parts/** Helper function for building cache ids.
drupal_render_pageRenders the page, including all theming.
drupal_schema_fields_sqlRetrieve a list of fields from a table schema. The list is suitable for use in a SQL query.
drupal_set_breadcrumbSet the breadcrumb trail for the current page.
drupal_set_page_contentSet the main page content value for later use.
drupal_set_time_limitAttempts to set the PHP maximum execution time.
drupal_site_offlineDeliver a "site is under maintenance" message to the browser.
drupal_sort_weightFunction used by uasort to sort structured arrays by weight, without the property weight prefix.
drupal_system_listingReturn an array of system file objects.
drupal_uninstall_schemaRemove all tables that a module defines in its hook_schema().
drupal_valid_tokenValidate a token based on $value, the current user session and private key.
drupal_write_recordSaves a record to the database based upon the schema.
element_childCheck if the key is a child.
element_childrenReturn the children of an element, optionally sorted by weight.
element_get_visible_childrenReturn the visibile children of an element.
element_infoRetrieve the default properties for the defined element type.
element_propertiesGet properties of a structured array element. Properties begin with '#'.
element_propertyCheck if the key is a property.
element_sortFunction used by uasort to sort structured arrays by weight.
entity_create_stub_entityHelper function to assemble an object structure with initial ids.
entity_extract_idsHelper function to extract id, vid, and bundle name from an entity.
entity_get_controllerGet the entity controller class for an entity type.
entity_get_infoGet the entity info array of an entity type.
entity_info_cache_clearResets the cached information about entity types.
entity_invokeInvokes entity insert/update hooks.
entity_loadLoad entities from the database.
entity_prepare_viewInvoke hook_entity_prepare_view().
entity_uriReturns the uri elements of an entity.
filter_xssFilter XSS.
filter_xss_adminVery permissive XSS/HTML filter for admin-only use.
filter_xss_bad_protocolProcesses an HTML attribute value and ensures it does not contain an URL with a disallowed protocol (e.g. javascript:).
fix_gpc_magicFix double-escaping problems caused by "magic quotes" in some PHP installations.
flood_clear_eventMake the flood control mechanism forget about an event for the current visitor.
flood_is_allowedChecks whether user is allowed to proceed with the specified event.
flood_register_eventRegister an event for the current visitor to the flood control mechanism.
format_dateFormat a date with the given configured format or a custom format string.
format_intervalFormat a time interval with the requested granularity.
format_pluralFormat a string containing a count of items.
format_rss_channelFormats an RSS channel.
format_rss_itemFormat a single RSS item.
format_sizeGenerate a string representation for the given byte count.
format_usernameFormat a username.
format_xml_elementsFormat XML elements.
hideHide an element from later rendering.
lFormat an internal Drupal link.
parse_sizeParse a given byte count.
renderRender and print an element.
showShow a hidden or already printed element from later rendering.
urlGenerate a URL.
url_is_externalReturn TRUE if a path is external (e.g. http://example.com).
valid_email_addressVerify the syntax of the given e-mail address.
valid_urlVerify the syntax of the given URL.
watchdog_severity_levelsSeverity levels, as defined in RFC 3164: http://www.ietf.org/rfc/rfc3164.txt.
xmlrpcPerforms one or more XML-RPC request(s).
_drupal_bootstrap_full
_drupal_build_css_pathHelper function for drupal_build_css_cache().
_drupal_default_html_headReturns elements that are always displayed in the HEAD tag of the HTML page.
_drupal_flush_css_jsHelper function to change query-strings on css/js files.
_drupal_load_stylesheetLoads stylesheets recursively and returns contents with corrected paths.
_drupal_schema_initializeFill in required default values for table definitions returned by hook_schema().
_filter_xss_attributesProcesses a string of HTML attributes.
_filter_xss_splitProcesses an HTML tag.
_fix_gpc_magic
_fix_gpc_magic_filesHelper function to strip slashes from $_FILES skipping over the tmp_name keys since PHP generates single backslashes for file paths on Windows systems.
_format_date_callbackCallback function for preg_replace_callback().