common.inc

Version 1.611.2.25 (checked in on 2009/09/16 at 17:29:09 by drumm)

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
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
base_pathReturns the base URL path of the Drupal installation. At the very least, this will always default to /.
check_file
check_urlPrepare a URL for use in an HTML attribute. Strips harmful protocols.
drupal_access_deniedGenerates a 403 error if the request is not allowed.
drupal_add_cssAdds a CSS file to the stylesheet queue.
drupal_add_feedAdd a feed URL for the current page.
drupal_add_jsAdd a JavaScript file, setting or inline code to the page.
drupal_add_linkAdd a <link> tag to the page's HEAD.
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_clear_css_cacheDelete all cached CSS files.
drupal_clear_path_cacheReset the static variable which holds the aliases mapped for this request.
drupal_cloneProvide a substitute clone() function for PHP4.
drupal_cron_cleanupShutdown function for cron cleanup.
drupal_cron_runExecutes a cron run when called
drupal_evalEvaluate a string of PHP code.
drupal_final_markupMake any final alterations to the rendered xhtml.
drupal_get_breadcrumbGet the breadcrumb trail for the current page.
drupal_get_contentGet assigned content.
drupal_get_cssReturns a themed representation of all stylesheets that should be attached to the page. It loads the CSS in order, with 'core' CSS first, then 'module' CSS, then 'theme' CSS files. This ensures proper cascading of styles...
drupal_get_destinationPrepare a destination query string for use in combination with drupal_goto(). Used to direct the user back to the referring page after completing a form. By default the current URL is returned. If a destination exists in the previous request, that...
drupal_get_feedsGet the feed URLs for the current page.
drupal_get_headersGet the HTTP response headers for the current page.
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. References to JavaScript files are placed in a certain order: first, all 'core' files, then all 'module' and finally all 'theme' JavaScript...
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_tokenGenerate a token based on $value, the current user session and private key.
drupal_gotoSend the user to a different Drupal page.
drupal_http_requestPerform an HTTP request.
drupal_mailSend an e-mail message, using Drupal variables and default settings. More information in the PHP function reference for mail()
drupal_map_assocForm an associative array from a linear array.
drupal_not_foundGenerates a 404 error if the request can not be handled.
drupal_page_footerPerform end-of-request tasks.
drupal_query_string_encodeParse an array into a valid urlencoded query string.
drupal_renderRenders HTML given a structured array tree. Recursively iterates over each of the array elements, generating HTML code. This function is usually called from within a another function, like drupal_get_form() or node_view().
drupal_set_breadcrumbSet the breadcrumb trail for the current page.
drupal_set_contentSet content for a specified region.
drupal_set_headerSet an HTTP response header for the current page.
drupal_set_html_headAdd output to the head tag of the HTML page. This function can be called as long the headers aren't sent.
drupal_site_offlineGenerates a site off-line message
drupal_system_listingReturns an array of files objects of the given type from the site-wide directory (i.e. modules/), the all-sites directory (i.e. sites/all/modules/), the profiles directory, and site-specific directory (i.e. sites/somesite/modules/). The returned array...
drupal_to_jsConverts a PHP variable into its Javascript equivalent.
drupal_urlencodeWrapper around urlencode() which avoids Apache quirks.
drupal_valid_tokenValidate a token based on $value, the current user session and private key.
element_childCheck if the key is a child.
element_childrenGet keys of a structured array tree element that are not properties (i.e., do not begin with '#').
element_propertiesGet properties of a structured array element. Properties begin with '#'.
element_propertyCheck if the key is a property.
error_handlerLog errors as defined by administrator Error levels: 0 = Log errors to database. 1 = Log errors to database and to screen.
fix_gpc_magicCorrect double-escaping problems caused by "magic quotes" in some PHP installations.
flood_is_allowedCheck 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_eventRegister an event for the current visitor (hostname/IP) 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_xml_elementsFormat XML elements.
lFormat an internal Drupal link.
locale_initializeInitialize the localization system.
page_set_cacheStore the current page in the cache.
parse_sizeParse a given byte count.
tTranslate strings to the current locale.
urlGenerate a URL from a Drupal menu path. Will also pass-through existing URLs.
valid_email_addressVerify the syntax of the given e-mail address.
valid_urlVerify the syntax of the given URL.
xmlrpcPerforms one or more XML-RPC request(s).
_drupal_add_jsHelper function for drupal_add_js().
_drupal_bootstrap_full
_element_sortFunction used by uasort in drupal_render() to sort structured arrays by weight.
_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.
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.