diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 33 | ||||
-rw-r--r-- | includes/form.inc | 1 | ||||
-rw-r--r-- | includes/locale.inc | 8 | ||||
-rw-r--r-- | includes/mail.inc | 4 |
4 files changed, 38 insertions, 8 deletions
diff --git a/includes/common.inc b/includes/common.inc index 9ed8b2f3f..a5aa7361f 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -403,6 +403,7 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data = // Parse the URL, and make sure we can handle the schema. $uri = parse_url($url); + switch ($uri['scheme']) { case 'http': $port = isset($uri['port']) ? $uri['port'] : 80; @@ -2483,6 +2484,25 @@ function drupal_render(&$elements) { return NULL; } + // If the default values for this element haven't been loaded yet, populate + // them. + if (!isset($elements['#defaults_loaded']) || !$elements['#defaults_loaded']) { + if ((!empty($elements['#type'])) && ($info = _element_info($elements['#type']))) { + $elements += $info; + } + } + + // Make any final changes to the element before it is rendered. This means + // that the $element or the chilren can be altered or corrected before the + // element is rendered into the final text. + if (isset($elements['#pre_render'])) { + foreach ($elements['#pre_render'] as $function) { + if (function_exists($function)) { + $elements = $function($elements); + } + } + } + $content = ''; // Either the elements did not go through form_builder or one of the children // has a #weight. @@ -2534,6 +2554,16 @@ function drupal_render(&$elements) { } if (isset($content) && $content !== '') { + // Filter the outputed content and make any last changes before the + // content is sent to the browser. The changes are made on $content + // which allows the output'ed text to be filtered. + if (isset($elements['#post_render'])) { + foreach ($elements['#post_render'] as $function) { + if (function_exists($function)) { + $content = $function($content, $elements); + } + } + } $prefix = isset($elements['#prefix']) ? $elements['#prefix'] : ''; $suffix = isset($elements['#suffix']) ? $elements['#suffix'] : ''; return $prefix . $content . $suffix; @@ -2835,7 +2865,7 @@ function drupal_delete_add_query($query) { * 'question' => Optional. The question for the confirm form. * 'destination' => Optional. The destination path for form submissions and form cancellations. * - * Also, any valid options from the $options argument of confirm_form() may + * Also, any valid options from the $options argument of confirm_form() may * be passed, and they will be passed through to the confirm form. */ function drupal_delete_confirm($confirm) { @@ -3450,4 +3480,3 @@ function watchdog_severity_levels() { WATCHDOG_DEBUG => t('debug'), ); } - diff --git a/includes/form.inc b/includes/form.inc index fb7bf1724..b9648e236 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -699,6 +699,7 @@ function form_builder($form_id, $form, &$form_state) { if (isset($form['#input']) && $form['#input']) { _form_builder_handle_input_element($form_id, $form, $form_state); } + $form['#defaults_loaded'] = TRUE; // We start off assuming all form elements are in the correct order. $form['#sorted'] = TRUE; diff --git a/includes/locale.inc b/includes/locale.inc index 9e9c11057..8c364e958 100644 --- a/includes/locale.inc +++ b/includes/locale.inc @@ -1726,7 +1726,7 @@ function _locale_export_get_strings($language = NULL, $group = 'default') { /** * Generates the PO(T) file contents for given strings. - * + * * @param $language * Language object to generate the output for, or NULL if generating * translation template. @@ -1739,7 +1739,7 @@ function _locale_export_get_strings($language = NULL, $group = 'default') { */ function _locale_export_po_generate($language = NULL, $strings = array(), $header = NULL) { global $user; - + if (!isset($header)) { if (isset($language)) { $header = '# '. $language->name .' translation of '. variable_get('site_name', 'Drupal') ."\n"; @@ -1776,9 +1776,9 @@ function _locale_export_po_generate($language = NULL, $strings = array(), $heade $header .= "\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n\"\n"; } } - + $output = $header ."\n"; - + foreach ($strings as $lid => $string) { // Only process non-children, children are output below their parent. if (!isset($string['child'])) { diff --git a/includes/mail.inc b/includes/mail.inc index 283dd2f04..05fa4411a 100644 --- a/includes/mail.inc +++ b/includes/mail.inc @@ -277,7 +277,7 @@ function drupal_html_to_text($string, $allowed_tags = NULL) { } // Process blocks of text. else { - // Convert inline HTML text to plain text. + // Convert inline HTML text to plain text. $value = trim(preg_replace('/\s+/', ' ', decode_entities($value))); if (strlen($value)) { $chunk = $value; @@ -295,7 +295,7 @@ function drupal_html_to_text($string, $allowed_tags = NULL) { // Remove non-quotation markers from indentation. $indent = array_map('_drupal_html_to_text_clean', $indent); } - + $tag = !$tag; } |