common.inc

  1. drupal
    1. drupal6
    2. drupal7

Version 1.912 (checked in on 2009/05/26 at 09:12:28 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.

Funktionen & Methoden

NameBeschreibung
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.
drupal_access_deniedGenerates a 403 error if the request is not allowed.
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_jsAdd a JavaScript file, setting or inline code to the page.
drupal_add_linkAdd a <link> tag to the page's HEAD.
drupal_add_region_contentAdd content to a specified region.
drupal_add_tabledragAssist in adding the tableDrag JavaScript behavior to a themed table.
drupal_alterHands off structured Drupal arrays 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_clear_css_cacheDelete all cached CSS files.
drupal_clear_js_cacheDelete all cached JS files.
drupal_clear_path_cacheReset the static variable which holds the aliases mapped for this request.
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_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 query string for use in combination with drupal_goto().
drupal_get_feedsGet the feed URLs 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.
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_rdf_namespacesReturn a string containing RDF namespaces for the <html> tag of an XHTML page.
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_gotoSend the user to a different Drupal page.
drupal_http_requestPerform an HTTP request.
drupal_implode_tagsImplode an array of tags into a string.
drupal_install_schemaCreate all tables that a module defines in its hook_schema().
drupal_jsonReturn 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_foundGenerates a 404 error if the request can not be handled.
drupal_page_footerPerform end-of-request tasks.
drupal_parse_info_fileParse Drupal info file format.
drupal_query_string_encodeParse an array into a valid urlencoded query string.
drupal_random_bytesReturns a string of highly randomized bytes (over the full 8-bit range).
drupal_renderRenders HTML given a structured array tree.
drupal_render_childrenRender children of an element and concatenate them.
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_site_offlineGenerates a site offline message.
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_to_jsConverts a PHP variable into its Javascript equivalent.
drupal_uninstall_schemaRemove all tables that a module defines in its hook_schema().
drupal_urlencodeWrapper around urlencode() which avoids Apache quirks.
drupal_valid_tokenValidate a token based on $value, the current user session and private key.
drupal_write_recordSave a record to the database based upon the schema.
element_basic_defaultsRetrieve the basic default properties that are common to all elements.
element_childCheck if the key is a child.
element_childrenReturn the children of an element, optionally sorted by weight.
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.
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_is_allowedCheck if the current visitor (hostname/IP) is allowed to proceed with the specified event.
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.
page_set_cacheStore the current page in the cache.
parse_sizeParse a given byte count.
tTranslate strings to the page language or a given language.
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.
watchdog_severity_levelsSeverity levels, as defined in RFC 3164: http://www.ietf.org/rfc/rfc3164.txt.
_drupal_bootstrap_full
_drupal_build_css_pathHelper function for drupal_build_css_cache().
_drupal_decode_exceptionDecode an exception, especially to retrive the correct caller.
_drupal_error_handlerCustom PHP error handler.
_drupal_exception_handlerCustom PHP exception handler.
_drupal_flush_css_jsHelper function to change query-strings on css/js files.
_drupal_get_last_callerGets the last caller from a backtrace.
_drupal_initialize_schemaFill in required default values for table definitions returned by hook_schema().
_drupal_load_stylesheetLoads stylesheets recursively and returns contents with corrected paths.
_drupal_log_errorLog a PHP error or exception, display an error page in fatal cases.
_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.

Konstanten

NameBeschreibung
ERROR_REPORTING_DISPLAY_ALLError reporting level: display all messages.
ERROR_REPORTING_DISPLAY_SOMEError reporting level: display errors and warnings.
ERROR_REPORTING_HIDEError reporting level: display no errors.
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.

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen