[ Index ]
 

Code source de Drupal 5.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/includes/ -> common.inc (sommaire)

(pas de description)

Poids: 2227 lignes (74 kb)
Inclus ou requis: 3 fois
Référencé: 0 fois
Nécessite: 9 fichiers
 includes/image.inc
 includes/tablesort.inc
 includes/xmlrpc.inc
 includes/form.inc
 includes/menu.inc
 includes/pager.inc
 includes/file.inc
 includes/unicode.inc
 includes/theme.inc

Définit 73 fonctions

  drupal_set_content()
  drupal_get_content()
  drupal_set_breadcrumb()
  drupal_get_breadcrumb()
  drupal_set_html_head()
  drupal_get_html_head()
  drupal_clear_path_cache()
  drupal_set_header()
  drupal_get_headers()
  drupal_add_feed()
  drupal_get_feeds()
  drupal_query_string_encode()
  drupal_get_destination()
  drupal_goto()
  drupal_site_offline()
  drupal_not_found()
  drupal_access_denied()
  drupal_http_request()
  error_handler()
  _fix_gpc_magic()
  _fix_gpc_magic_files()
  fix_gpc_magic()
  locale_initialize()
  t()
  valid_email_address()
  valid_url()
  flood_register_event()
  flood_is_allowed()
  check_file()
  check_url()
  format_rss_channel()
  format_rss_item()
  format_xml_elements()
  format_plural()
  parse_size()
  format_size()
  format_interval()
  format_date()
  url()
  drupal_attributes()
  l()
  drupal_page_footer()
  drupal_map_assoc()
  drupal_eval()
  drupal_get_path()
  base_path()
  drupal_clone()
  drupal_add_link()
  drupal_add_css()
  drupal_get_css()
  drupal_build_css_cache()
  drupal_clear_css_cache()
  drupal_add_js()
  _drupal_add_js()
  drupal_get_js()
  drupal_to_js()
  drupal_urlencode()
  drupal_get_private_key()
  drupal_get_token()
  drupal_valid_token()
  xmlrpc()
  _drupal_bootstrap_full()
  page_set_cache()
  drupal_mail()
  drupal_cron_run()
  drupal_cron_cleanup()
  drupal_system_listing()
  drupal_render()
  _element_sort()
  element_property()
  element_properties()
  element_child()
  element_children()

Fonctions
Fonctions qui ne font pas partie d'une Classe:

drupal_set_content($region = NULL, $data = NULL)   X-Ref
Set content for a specified region.

param: $region
param: $data

drupal_get_content($region = NULL, $delimiter = ' ')   X-Ref
Get assigned content.

param: $region
param: $delimiter

drupal_set_breadcrumb($breadcrumb = NULL)   X-Ref
Set the breadcrumb trail for the current page.

param: $breadcrumb

drupal_get_breadcrumb()   X-Ref
Get the breadcrumb trail for the current page.


drupal_set_html_head($data = NULL)   X-Ref
Add output to the head tag of the HTML page.
This function can be called as long the headers aren't sent.


drupal_get_html_head()   X-Ref
Retrieve output to be displayed in the head tag of the HTML page.


drupal_clear_path_cache()   X-Ref
Reset the static variable which holds the aliases mapped for this request.


drupal_set_header($header = NULL)   X-Ref
Set an HTTP response header for the current page.

Note: when sending a Content-Type header, always include a 'charset' type
too. This is necessary to avoid security bugs (e.g. UTF-7 XSS).

drupal_get_headers()   X-Ref
Get the HTTP response headers for the current page.


drupal_add_feed($url = NULL, $title = '')   X-Ref
Add a feed URL for the current page.

param: $url
param: $title

drupal_get_feeds($delimiter = "\n")   X-Ref
Get the feed URLs for the current page.

param: $delimiter

drupal_query_string_encode($query, $exclude = array()   X-Ref
Parse an array into a valid urlencoded query string.

param: $query
param: $exclude
param: $parent
return:

drupal_get_destination()   X-Ref
Prepare 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 destination
is returned. As such, a destination can persist across multiple
pages.


drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response_code = 302)   X-Ref
Send the user to a different Drupal page.

This issues an on-site HTTP redirect. The function makes sure the redirected
URL is formatted correctly.

Usually the redirected URL is constructed from this function's input
parameters. However you may override that behavior by setting a
<em>destination</em> in either the $_REQUEST-array (i.e. by using
the query string of an URI) or the $_REQUEST['edit']-array (i.e. by
using a hidden form field). This is used to direct the user back to
the proper page after completing a form. For example, after editing
a post on the 'admin/content/node'-page or after having logged on using the
'user login'-block in a sidebar. The function drupal_get_destination()
can be used to help set the destination URL.

Drupal will ensure that messages set by drupal_set_message() and other
session data are written to the database before the user is redirected.

This function ends the request; use it rather than a print theme('page')
statement in your menu callback.

param: $path
param: $query
param: $fragment
param: $http_response_code

drupal_site_offline()   X-Ref
Generates a site off-line message


drupal_not_found()   X-Ref
Generates a 404 error if the request can not be handled.


drupal_access_denied()   X-Ref
Generates a 403 error if the request is not allowed.


drupal_http_request($url, $headers = array()   X-Ref
Perform an HTTP request.

This is a flexible and powerful HTTP client implementation. Correctly handles
GET, POST, PUT or any other HTTP requests. Handles redirects.

param: $url
param: $headers
param: $method
param: $data
param: $retry
return:

error_handler($errno, $message, $filename, $line)   X-Ref
Log errors as defined by administrator
Error levels:
0 = Log errors to database.
1 = Log errors to database and to screen.


_fix_gpc_magic(&$item)   X-Ref
Pas de description

_fix_gpc_magic_files(&$item, $key)   X-Ref
Helper function to strip slashes from $_FILES skipping over the tmp_name keys
since PHP generates single backslashes for file paths on Windows systems.

tmp_name does not have backslashes added see
http://php.net/manual/en/features.file-upload.php#42280

fix_gpc_magic()   X-Ref
Correct double-escaping problems caused by "magic quotes" in some PHP
installations.


locale_initialize()   X-Ref
Initialize the localization system.


t($string, $args = 0)   X-Ref
Translate strings to the current locale.

All human-readable text that will be displayed somewhere within a page should be
run through the t() function.

Examples:
param: $string
param: $args
return:

valid_email_address($mail)   X-Ref
Verify the syntax of the given e-mail address.

Empty e-mail addresses are allowed. See RFC 2822 for details.

param: $mail
return:

valid_url($url, $absolute = FALSE)   X-Ref
Verify the syntax of the given URL.

This function should only be used on actual URLs. It should not be used for
Drupal menu paths, which can contain arbitrary characters.

param: $url
param: $absolute
return:

flood_register_event($name)   X-Ref
Register an event for the current visitor (hostname/IP) to the flood control mechanism.

param: $name

flood_is_allowed($name, $threshold)   X-Ref
Check 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.

param: $name
param: $number
return:

check_file($filename)   X-Ref
Pas de description

check_url($uri)   X-Ref
Prepare a URL for use in an HTML attribute. Strips harmful protocols.


format_rss_channel($title, $link, $description, $items, $language = 'en', $args = array()   X-Ref
Formats an RSS channel.

Arbitrary elements may be added using the $args associative array.

format_rss_item($title, $link, $description, $args = array()   X-Ref
Format a single RSS item.

Arbitrary elements may be added using the $args associative array.

format_xml_elements($array)   X-Ref
Format XML elements.

param: $array

format_plural($count, $singular, $plural)   X-Ref
Format a string containing a count of items.

This function ensures that the string is pluralized correctly. Since t() is
called by this function, make sure not to pass already-localized strings to it.

param: $count
param: $singular
param: $plural
return:

parse_size($size)   X-Ref
Parse a given byte count.

param: $size
return:

format_size($size)   X-Ref
Generate a string representation for the given byte count.

param: $size
return:

format_interval($timestamp, $granularity = 2)   X-Ref
Format a time interval with the requested granularity.

param: $timestamp
param: $granularity
return:

format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL)   X-Ref
Format a date with the given configured format or a custom format string.

Drupal allows administrators to select formatting strings for 'small',
'medium' and 'large' date formats. This function can handle these formats,
as well as any custom format.

param: $timestamp
param: $type
param: $format
param: $timezone
return:

url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE)   X-Ref
Generate a URL from a Drupal menu path. Will also pass-through existing URLs.

param: $path
param: $query
param: $fragment
param: $absolute
return:

drupal_attributes($attributes = array()   X-Ref
Format an attribute string to insert in a tag.

param: $attributes
return:

l($text, $path, $attributes = array()   X-Ref
Format an internal Drupal link.

This function correctly handles aliased paths, and allows themes to highlight
links to the current page correctly, so all internal links output by modules
should be generated by this function if possible.

param: $text
param: $path
param: $attributes
param: $query
param: $fragment
param: $absolute
param: $html
return:

drupal_page_footer()   X-Ref
Perform end-of-request tasks.

This function sets the page cache if appropriate, and allows modules to
react to the closing of the page by calling hook_exit().

drupal_map_assoc($array, $function = NULL)   X-Ref
Form an associative array from a linear array.

This function walks through the provided array and constructs an associative
array out of it. The keys of the resulting array will be the values of the
input array. The values will be the same as the keys unless a function is
specified, in which case the output of the function is used for the values
instead.

param: $array
param: $function

drupal_eval($code)   X-Ref
Evaluate a string of PHP code.

This is a wrapper around PHP's eval(). It uses output buffering to capture both
returned and printed text. Unlike eval(), we require code to be surrounded by
<?php ?> tags; in other words, we evaluate the code as if it were a stand-alone
PHP file.

Using this wrapper also ensures that the PHP code which is evaluated can not
overwrite any variables in the calling code, unlike a regular eval() call.

param: $code
return:

drupal_get_path($type, $name)   X-Ref
Returns the path to a system item (module, theme, etc.).

param: $type
param: $name
return:

base_path()   X-Ref
Returns the base URL path of the Drupal installation.
At the very least, this will always default to /.


drupal_clone($object)   X-Ref
Provide a substitute clone() function for PHP4.


drupal_add_link($attributes)   X-Ref
Add a <link> tag to the page's HEAD.


drupal_add_css($path = NULL, $type = 'module', $media = 'all', $preprocess = TRUE)   X-Ref
Adds a CSS file to the stylesheet queue.

param: $path
param: $type
param: $media
param: $preprocess
return:

drupal_get_css($css = NULL)   X-Ref
Returns 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 for easy overriding in modules and themes.

param: $css
return:

drupal_build_css_cache($types, $filename)   X-Ref
Aggregate and optimize CSS files, putting them in the files directory.

param: $types
param: $filename
return:

drupal_clear_css_cache()   X-Ref
Delete all cached CSS files.


drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer = FALSE, $cache = TRUE)   X-Ref
Add a JavaScript file, setting or inline code to the page.

The behavior of this function depends on the parameters it is called with.
Generally, it handles the addition of JavaScript to the page, either as
reference to an existing file or as inline code. The following actions can be
performed using this function:

- Add a file ('core', 'module' and 'theme'):
Adds a reference to a JavaScript file to the page. JavaScript files
are placed in a certain order, from 'core' first, to 'module' and finally
'theme' so that files, that are added later, can override previously added
files with ease.

- Add inline JavaScript code ('inline'):
Executes a piece of JavaScript code on the current page by placing the code
directly in the page. This can, for example, be useful to tell the user that
a new message arrived, by opening a pop up, alert box etc.

- Add settings ('setting'):
Adds a setting to Drupal's global storage of JavaScript settings. Per-page
settings are required by some modules to function properly. The settings
will be accessible at Drupal.settings.

param: $data
param: $type
param: $scope
param: $defer
param: $cache
return:

_drupal_add_js($data, $type, $scope, $defer, $cache)   X-Ref
Helper function for drupal_add_js().


drupal_get_js($scope = 'header', $javascript = NULL)   X-Ref
Returns 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 files
are added to the page. Then, all settings are output, followed by 'inline'
JavaScript code.

return:

drupal_to_js($var)   X-Ref
Converts a PHP variable into its Javascript equivalent.

We use HTML-safe strings, i.e. with <, > and & escaped.

drupal_urlencode($text)   X-Ref
Wrapper around urlencode() which avoids Apache quirks.

Should be used when placing arbitrary data in an URL. Note that Drupal paths
are urlencoded() when passed through url() and do not require urlencoding()
of individual components.

Notes:
- For esthetic reasons, we do not escape slashes. This also avoids a 'feature'
in Apache where it 404s on any path containing '%2F'.
- mod_rewrite unescapes %-encoded ampersands, hashes, and slashes when clean
URLs are used, which are interpreted as delimiters by PHP. These
characters are double escaped so PHP will still see the encoded version.
- With clean URLs, Apache changes '//' to '/', so every second slash is
double escaped.

param: $text

drupal_get_private_key()   X-Ref
Ensure the private key variable used to generate tokens is set.

return:

drupal_get_token($value = '')   X-Ref
Generate a token based on $value, the current user session and private key.

param: $value

drupal_valid_token($token, $value = '', $skip_anonymous = FALSE)   X-Ref
Validate a token based on $value, the current user session and private key.

param: $token
param: $value
param: $skip_anonymous
return:

xmlrpc($url)   X-Ref
Performs one or more XML-RPC request(s).

param: $url
param: ...
return:

_drupal_bootstrap_full()   X-Ref
Pas de description

page_set_cache()   X-Ref
Store the current page in the cache.

We try to store a gzipped version of the cache. This requires the
PHP zlib extension (http://php.net/manual/en/ref.zlib.php).
Presence of the extension is checked by testing for the function
gzencode. There are two compression algorithms: gzip and deflate.
The majority of all modern browsers support gzip or both of them.
We thus only deal with the gzip variant and unzip the cache in case
the browser does not accept gzip encoding.


drupal_mail($mailkey, $to, $subject, $body, $from = NULL, $headers = array()   X-Ref
Send an e-mail message, using Drupal variables and default settings.
More information in the PHP function reference for mail()

param: $mailkey
param: $to
param: $subject
param: $body
param: $from
param: $headers
return: Returns TRUE if the mail was successfully accepted for delivery,

drupal_cron_run()   X-Ref
Executes a cron run when called

return:

drupal_cron_cleanup()   X-Ref
Shutdown function for cron cleanup.


drupal_system_listing($mask, $directory, $key = 'name', $min_depth = 1)   X-Ref
Returns 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 will be keyed using the
key specified (name, basename, filename). Using name or basename will cause
site-specific files to be prioritized over similar files in the default
directories. That is, if a file with the same name appears in both the
site-wide directory and site-specific directory, only the site-specific
version will be included.

param: $mask
param: $directory
param: $key
param: $min_depth
return:

drupal_render(&$elements)   X-Ref
Renders 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().

param: $elements
return:

_element_sort($a, $b)   X-Ref
Function used by uasort in drupal_render() to sort structured arrays
by weight.


element_property($key)   X-Ref
Check if the key is a property.


element_properties($element)   X-Ref
Get properties of a structured array element. Properties begin with '#'.


element_child($key)   X-Ref
Check if the key is a child.


element_children($element)   X-Ref
Get keys of a structured array tree element that are not properties
(i.e., do not begin with '#').




Généré le : Fri Nov 30 16:20:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics