Commit 2ad0a2c1 authored by Dries's avatar Dries

- Patch #684982 by plach: audit of global language variable use.

parent da750215
......@@ -1551,8 +1551,8 @@ function filter_xss_bad_protocol($string, $decode = TRUE) {
* Arbitrary elements may be added using the $args associative array.
*/
function format_rss_channel($title, $link, $description, $items, $langcode = NULL, $args = array()) {
global $language;
$langcode = $langcode ? $langcode : $language->language;
global $language_content;
$langcode = $langcode ? $langcode : $language_content->language;
$output = "<channel>\n";
$output .= ' <title>' . check_plain($title) . "</title>\n";
......@@ -1997,8 +1997,8 @@ function format_username($account) {
* - 'external': Whether the given path is an external URL.
* - 'language': An optional language object. If the path being linked to is
* internal to the site, $options['language'] is used to look up the alias
* for the URL. If $options['language'] is omitted, the global $language
* will be used.
* for the URL. If $options['language'] is omitted, the global
* $language_content will be used.
* - 'https': Whether this URL should point to a secure location. If not
* defined, the current scheme is used, so the user stays on http or https
* respectively. TRUE enforces HTTPS and FALSE enforces HTTP, but HTTPS can
......@@ -5342,9 +5342,12 @@ function drupal_render_cid_parts($granularity = NULL) {
global $theme, $base_root, $user;
$cid_parts[] = $theme;
if (module_exists('locale')) {
global $language;
$cid_parts[] = $language->language;
// If Locale is enabled but we have only one language we do not need it as cid
// part.
if (drupal_multilingual()) {
foreach (language_types_configurable() as $language_type) {
$cid_parts[] = $GLOBALS[$language_type]->language;
}
}
if (!empty($granularity)) {
......
......@@ -73,7 +73,7 @@ function _color_theme_select_form_alter(&$form, &$form_state) {
* Callback for the theme to alter the resources used.
*/
function _color_html_alter(&$vars) {
global $language, $theme_key;
global $theme_key;
$themes = list_themes();
// Override stylesheets.
......@@ -102,7 +102,7 @@ function _color_html_alter(&$vars) {
* Callback for the theme to alter the resources used.
*/
function _color_page_alter(&$vars) {
global $language, $theme_key;
global $theme_key;
// Override logo.
$logo = variable_get('color_' . $theme_key . '_logo');
......
......@@ -68,8 +68,8 @@ function hook_language_init() {
function hook_language_switch_links_alter(array &$links, $type, $path) {
global $language;
if ($type == LANGUAGE_TYPE_CONTENT && isset($links[$language])) {
foreach ($links[$language] as $link) {
if ($type == LANGUAGE_TYPE_CONTENT && isset($links[$language->language])) {
foreach ($links[$language->language] as $link) {
$link['attributes']['class'][] = 'active-language';
}
}
......
......@@ -1000,7 +1000,7 @@ function locale_form_comment_form_alter(&$form, &$form_state, $form_id) {
// If a content type has multilingual support we set the content language as
// comment language.
if (empty($form['language']['#value']) && locale_multilingual_node_type($form['#node']->type)) {
global $language;
$form['language']['#value'] = $language->language;
global $language_content;
$form['language']['#value'] = $language_content->language;
}
}
......@@ -2354,7 +2354,7 @@ function node_block_list_alter(&$blocks) {
* The link should be an absolute URL.
*/
function node_feed($nids = FALSE, $channel = array()) {
global $base_url, $language;
global $base_url, $language_content;
if ($nids === FALSE) {
$nids = db_select('node', 'n')
......@@ -2409,7 +2409,7 @@ function node_feed($nids = FALSE, $channel = array()) {
'title' => variable_get('site_name', 'Drupal'),
'link' => $base_url,
'description' => variable_get('feed_description', ''),
'language' => $language->language
'language' => $language_content->language
);
$channel_extras = array_diff_key($channel, $channel_defaults);
$channel = array_merge($channel_defaults, $channel);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment