Commit a58940f1 authored by Dries's avatar Dries
Browse files

- Patch #1222194 by Gábor Hojtsy, plach: rename global to ().

parent edabf1fc
...@@ -183,7 +183,7 @@ ...@@ -183,7 +183,7 @@
/** /**
* The type of language used to select the user interface. * The type of language used to select the user interface.
*/ */
const LANGUAGE_TYPE_INTERFACE = 'language'; const LANGUAGE_TYPE_INTERFACE = 'language_interface';
/** /**
* The type of language used for URLs. * The type of language used for URLs.
...@@ -1518,12 +1518,12 @@ function drupal_unpack($obj, $field = 'data') { ...@@ -1518,12 +1518,12 @@ function drupal_unpack($obj, $field = 'data') {
* @ingroup sanitization * @ingroup sanitization
*/ */
function t($string, array $args = array(), array $options = array()) { function t($string, array $args = array(), array $options = array()) {
global $language; global $language_interface;
static $custom_strings; static $custom_strings;
// Merge in default. // Merge in default.
if (empty($options['langcode'])) { if (empty($options['langcode'])) {
$options['langcode'] = isset($language->langcode) ? $language->langcode : LANGUAGE_SYSTEM; $options['langcode'] = isset($language_interface->langcode) ? $language_interface->langcode : LANGUAGE_SYSTEM;
} }
if (empty($options['context'])) { if (empty($options['context'])) {
$options['context'] = ''; $options['context'] = '';
......
...@@ -1892,9 +1892,9 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL ...@@ -1892,9 +1892,9 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL
} }
// Use the default langcode if none is set. // Use the default langcode if none is set.
global $language; global $language_interface;
if (empty($langcode)) { if (empty($langcode)) {
$langcode = isset($language->langcode) ? $language->langcode : LANGUAGE_SYSTEM; $langcode = isset($language_interface->langcode) ? $language_interface->langcode : LANGUAGE_SYSTEM;
} }
switch ($type) { switch ($type) {
...@@ -2496,8 +2496,8 @@ function drupal_deliver_html_page($page_callback_result) { ...@@ -2496,8 +2496,8 @@ function drupal_deliver_html_page($page_callback_result) {
} }
// Send appropriate HTTP-Header for browsers and search engines. // Send appropriate HTTP-Header for browsers and search engines.
global $language; global $language_interface;
drupal_add_http_header('Content-Language', $language->langcode); drupal_add_http_header('Content-Language', $language_interface->langcode);
// Menu status constants are integers; page content is a string or array. // Menu status constants are integers; page content is a string or array.
if (is_int($page_callback_result)) { if (is_int($page_callback_result)) {
......
...@@ -112,8 +112,8 @@ ...@@ -112,8 +112,8 @@
* The current interface language code. * The current interface language code.
*/ */
function locale_language_from_interface() { function locale_language_from_interface() {
global $language; global $language_interface;
return isset($language->langcode) ? $language->langcode : FALSE; return isset($language_interface->langcode) ? $language_interface->langcode : FALSE;
} }
/** /**
...@@ -553,8 +553,6 @@ function locale_string_is_safe($string) { ...@@ -553,8 +553,6 @@ function locale_string_is_safe($string) {
* Drupal.formatPlural() and inserts them into the database. * Drupal.formatPlural() and inserts them into the database.
*/ */
function _locale_parse_js_file($filepath) { function _locale_parse_js_file($filepath) {
global $language;
// The file path might contain a query string, so make sure we only use the // The file path might contain a query string, so make sure we only use the
// actual file. // actual file.
$parsed_url = drupal_parse_url($filepath); $parsed_url = drupal_parse_url($filepath);
...@@ -708,12 +706,13 @@ function _locale_invalidate_js($langcode = NULL) { ...@@ -708,12 +706,13 @@ function _locale_invalidate_js($langcode = NULL) {
/** /**
* (Re-)Creates the JavaScript translation file for a language. * (Re-)Creates the JavaScript translation file for a language.
* *
* @param $language * @param $langcode
* The language, the translation file should be (re)created for. * The language, the translation file should be (re)created for.
*/ */
function _locale_rebuild_js($langcode = NULL) { function _locale_rebuild_js($langcode = NULL) {
if (!isset($langcode)) { if (!isset($langcode)) {
global $language; global $language_interface;
$language = $language_interface;
} }
else { else {
// Get information about the locale. // Get information about the locale.
......
...@@ -1092,7 +1092,7 @@ function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL) { ...@@ -1092,7 +1092,7 @@ function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL) {
// Use $mlid as a flag for whether the data being loaded is for the whole tree. // Use $mlid as a flag for whether the data being loaded is for the whole tree.
$mlid = isset($link['mlid']) ? $link['mlid'] : 0; $mlid = isset($link['mlid']) ? $link['mlid'] : 0;
// Generate a cache ID (cid) specific for this $menu_name, $link, $language, and depth. // Generate a cache ID (cid) specific for this $menu_name, $link, $language, and depth.
$cid = 'links:' . $menu_name . ':all:' . $mlid . ':' . $GLOBALS['language']->langcode . ':' . (int) $max_depth; $cid = 'links:' . $menu_name . ':all:' . $mlid . ':' . $GLOBALS['language_interface']->langcode . ':' . (int) $max_depth;
if (!isset($tree[$cid])) { if (!isset($tree[$cid])) {
// If the static variable doesn't have the data, check {cache_menu}. // If the static variable doesn't have the data, check {cache_menu}.
...@@ -1206,7 +1206,7 @@ function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail = ...@@ -1206,7 +1206,7 @@ function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail =
$max_depth = min($max_depth, MENU_MAX_DEPTH); $max_depth = min($max_depth, MENU_MAX_DEPTH);
} }
// Generate a cache ID (cid) specific for this page. // Generate a cache ID (cid) specific for this page.
$cid = 'links:' . $menu_name . ':page:' . $item['href'] . ':' . $GLOBALS['language']->langcode . ':' . (int) $item['access'] . ':' . (int) $max_depth; $cid = 'links:' . $menu_name . ':page:' . $item['href'] . ':' . $GLOBALS['language_interface']->langcode . ':' . (int) $item['access'] . ':' . (int) $max_depth;
// If we are asked for the active trail only, and $menu_name has not been // If we are asked for the active trail only, and $menu_name has not been
// built and cached for this page yet, then this likely means that it // built and cached for this page yet, then this likely means that it
// won't be built anymore, as this function is invoked from // won't be built anymore, as this function is invoked from
...@@ -1358,7 +1358,7 @@ function _menu_build_tree($menu_name, array $parameters = array()) { ...@@ -1358,7 +1358,7 @@ function _menu_build_tree($menu_name, array $parameters = array()) {
if (isset($parameters['expanded'])) { if (isset($parameters['expanded'])) {
sort($parameters['expanded']); sort($parameters['expanded']);
} }
$tree_cid = 'links:' . $menu_name . ':tree-data:' . $GLOBALS['language']->langcode . ':' . hash('sha256', serialize($parameters)); $tree_cid = 'links:' . $menu_name . ':tree-data:' . $GLOBALS['language_interface']->langcode . ':' . hash('sha256', serialize($parameters));
// If we do not have this tree in the static cache, check {cache_menu}. // If we do not have this tree in the static cache, check {cache_menu}.
if (!isset($trees[$tree_cid])) { if (!isset($trees[$tree_cid])) {
......
...@@ -2500,8 +2500,8 @@ function template_preprocess_html(&$variables) { ...@@ -2500,8 +2500,8 @@ function template_preprocess_html(&$variables) {
$variables['body_attributes_array'] = array(); $variables['body_attributes_array'] = array();
// HTML element attributes. // HTML element attributes.
$variables['html_attributes_array']['lang'] = $GLOBALS['language']->langcode; $variables['html_attributes_array']['lang'] = $GLOBALS['language_interface']->langcode;
$variables['html_attributes_array']['dir'] = $GLOBALS['language']->direction ? 'rtl' : 'ltr'; $variables['html_attributes_array']['dir'] = $GLOBALS['language_interface']->direction ? 'rtl' : 'ltr';
// Add favicon. // Add favicon.
if (theme_get_setting('toggle_favicon')) { if (theme_get_setting('toggle_favicon')) {
...@@ -2571,8 +2571,8 @@ function template_preprocess_page(&$variables) { ...@@ -2571,8 +2571,8 @@ function template_preprocess_page(&$variables) {
$variables['base_path'] = base_path(); $variables['base_path'] = base_path();
$variables['front_page'] = url(); $variables['front_page'] = url();
$variables['feed_icons'] = drupal_get_feeds(); $variables['feed_icons'] = drupal_get_feeds();
$variables['language'] = $GLOBALS['language']; $variables['language'] = $GLOBALS['language_interface'];
$variables['language']->dir = $GLOBALS['language']->direction ? 'rtl' : 'ltr'; $variables['language']->dir = $GLOBALS['language_interface']->direction ? 'rtl' : 'ltr';
$variables['logo'] = theme_get_setting('logo'); $variables['logo'] = theme_get_setting('logo');
$variables['main_menu'] = theme_get_setting('toggle_main_menu') ? menu_main_menu() : array(); $variables['main_menu'] = theme_get_setting('toggle_main_menu') ? menu_main_menu() : array();
$variables['secondary_menu'] = theme_get_setting('toggle_secondary_menu') ? menu_secondary_menu() : array(); $variables['secondary_menu'] = theme_get_setting('toggle_secondary_menu') ? menu_secondary_menu() : array();
...@@ -2774,7 +2774,7 @@ function template_preprocess_maintenance_page(&$variables) { ...@@ -2774,7 +2774,7 @@ function template_preprocess_maintenance_page(&$variables) {
} }
// set the default language if necessary // set the default language if necessary
$language = isset($GLOBALS['language']) ? $GLOBALS['language'] : language_default(); $language = isset($GLOBALS['language_interface']) ? $GLOBALS['language_interface'] : language_default();
$variables['head_title_array'] = $head_title; $variables['head_title_array'] = $head_title;
$variables['head_title'] = implode(' | ', $head_title); $variables['head_title'] = implode(' | ', $head_title);
......
...@@ -321,7 +321,7 @@ function hook_block_view_MODULE_DELTA_alter(&$data, $block) { ...@@ -321,7 +321,7 @@ function hook_block_view_MODULE_DELTA_alter(&$data, $block) {
* An array of $blocks, keyed by the block ID. * An array of $blocks, keyed by the block ID.
*/ */
function hook_block_list_alter(&$blocks) { function hook_block_list_alter(&$blocks) {
global $language, $theme_key; global $language_interface, $theme_key;
// This example shows how to achieve language specific visibility setting for // This example shows how to achieve language specific visibility setting for
// blocks. // blocks.
...@@ -345,7 +345,7 @@ function hook_block_list_alter(&$blocks) { ...@@ -345,7 +345,7 @@ function hook_block_list_alter(&$blocks) {
continue; continue;
} }
if (!isset($block_languages[$block->module][$block->delta][$language->language])) { if (!isset($block_languages[$block->module][$block->delta][$language_interface->language])) {
// This block should not be displayed with the active language, remove // This block should not be displayed with the active language, remove
// from the list. // from the list.
unset($blocks[$key]); unset($blocks[$key]);
......
...@@ -1228,17 +1228,17 @@ function book_toc($bid, $depth_limit, $exclude = array()) { ...@@ -1228,17 +1228,17 @@ function book_toc($bid, $depth_limit, $exclude = array()) {
* @see book-export-html.tpl.php * @see book-export-html.tpl.php
*/ */
function template_preprocess_book_export_html(&$variables) { function template_preprocess_book_export_html(&$variables) {
global $base_url, $language; global $base_url, $language_interface;
$variables['title'] = check_plain($variables['title']); $variables['title'] = check_plain($variables['title']);
$variables['base_url'] = $base_url; $variables['base_url'] = $base_url;
$variables['language'] = $language; $variables['language'] = $language_interface;
$variables['language_rtl'] = ($language->direction == LANGUAGE_RTL); $variables['language_rtl'] = ($language_interface->direction == LANGUAGE_RTL);
$variables['head'] = drupal_get_html_head(); $variables['head'] = drupal_get_html_head();
// HTML element attributes. // HTML element attributes.
$variables['html_attributes_array']['lang'] = $language->langcode; $variables['html_attributes_array']['lang'] = $language_interface->langcode;
$variables['html_attributes_array']['dir'] = $language->direction ? 'rtl' : 'ltr'; $variables['html_attributes_array']['dir'] = $language_interface->direction ? 'rtl' : 'ltr';
} }
/** /**
......
...@@ -1860,10 +1860,10 @@ class CommentTokenReplaceTestCase extends CommentHelperCase { ...@@ -1860,10 +1860,10 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
* Creates a comment, then tests the tokens generated from it. * Creates a comment, then tests the tokens generated from it.
*/ */
function testCommentTokenReplacement() { function testCommentTokenReplacement() {
global $language; global $language_interface;
$url_options = array( $url_options = array(
'absolute' => TRUE, 'absolute' => TRUE,
'language' => $language, 'language' => $language_interface,
); );
$this->drupalLogin($this->admin_user); $this->drupalLogin($this->admin_user);
...@@ -1896,8 +1896,8 @@ class CommentTokenReplaceTestCase extends CommentHelperCase { ...@@ -1896,8 +1896,8 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
$tests['[comment:body]'] = _text_sanitize($instance, LANGUAGE_NONE, $comment->comment_body[LANGUAGE_NONE][0], 'value'); $tests['[comment:body]'] = _text_sanitize($instance, LANGUAGE_NONE, $comment->comment_body[LANGUAGE_NONE][0], 'value');
$tests['[comment:url]'] = url('comment/' . $comment->cid, $url_options + array('fragment' => 'comment-' . $comment->cid)); $tests['[comment:url]'] = url('comment/' . $comment->cid, $url_options + array('fragment' => 'comment-' . $comment->cid));
$tests['[comment:edit-url]'] = url('comment/' . $comment->cid . '/edit', $url_options); $tests['[comment:edit-url]'] = url('comment/' . $comment->cid . '/edit', $url_options);
$tests['[comment:created:since]'] = format_interval(REQUEST_TIME - $comment->created, 2, $language->langcode); $tests['[comment:created:since]'] = format_interval(REQUEST_TIME - $comment->created, 2, $language_interface->langcode);
$tests['[comment:changed:since]'] = format_interval(REQUEST_TIME - $comment->changed, 2, $language->langcode); $tests['[comment:changed:since]'] = format_interval(REQUEST_TIME - $comment->changed, 2, $language_interface->langcode);
$tests['[comment:parent:cid]'] = $comment->pid; $tests['[comment:parent:cid]'] = $comment->pid;
$tests['[comment:parent:title]'] = check_plain($parent_comment->subject); $tests['[comment:parent:title]'] = check_plain($parent_comment->subject);
$tests['[comment:node:nid]'] = $comment->nid; $tests['[comment:node:nid]'] = $comment->nid;
...@@ -1909,7 +1909,7 @@ class CommentTokenReplaceTestCase extends CommentHelperCase { ...@@ -1909,7 +1909,7 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
$this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.')); $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
foreach ($tests as $input => $expected) { foreach ($tests as $input => $expected) {
$output = token_replace($input, array('comment' => $comment), array('language' => $language)); $output = token_replace($input, array('comment' => $comment), array('language' => $language_interface));
$this->assertEqual($output, $expected, t('Sanitized comment token %token replaced.', array('%token' => $input))); $this->assertEqual($output, $expected, t('Sanitized comment token %token replaced.', array('%token' => $input)));
} }
...@@ -1925,7 +1925,7 @@ class CommentTokenReplaceTestCase extends CommentHelperCase { ...@@ -1925,7 +1925,7 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
$tests['[comment:author:name]'] = $this->admin_user->name; $tests['[comment:author:name]'] = $this->admin_user->name;
foreach ($tests as $input => $expected) { foreach ($tests as $input => $expected) {
$output = token_replace($input, array('comment' => $comment), array('language' => $language, 'sanitize' => FALSE)); $output = token_replace($input, array('comment' => $comment), array('language' => $language_interface, 'sanitize' => FALSE));
$this->assertEqual($output, $expected, t('Unsanitized comment token %token replaced.', array('%token' => $input))); $this->assertEqual($output, $expected, t('Unsanitized comment token %token replaced.', array('%token' => $input)));
} }
...@@ -1938,7 +1938,7 @@ class CommentTokenReplaceTestCase extends CommentHelperCase { ...@@ -1938,7 +1938,7 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
$tests['[node:comment-count-new]'] = 2; $tests['[node:comment-count-new]'] = 2;
foreach ($tests as $input => $expected) { foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $node), array('language' => $language)); $output = token_replace($input, array('node' => $node), array('language' => $language_interface));
$this->assertEqual($output, $expected, t('Node comment token %token replaced.', array('%token' => $input))); $this->assertEqual($output, $expected, t('Node comment token %token replaced.', array('%token' => $input)));
} }
} }
......
...@@ -134,7 +134,7 @@ function contact_site_form_validate($form, &$form_state) { ...@@ -134,7 +134,7 @@ function contact_site_form_validate($form, &$form_state) {
* @see contact_site_form_validate() * @see contact_site_form_validate()
*/ */
function contact_site_form_submit($form, &$form_state) { function contact_site_form_submit($form, &$form_state) {
global $user, $language; global $user, $language_interface;
$values = $form_state['values']; $values = $form_state['values'];
$values['sender'] = $user; $values['sender'] = $user;
...@@ -156,12 +156,12 @@ function contact_site_form_submit($form, &$form_state) { ...@@ -156,12 +156,12 @@ function contact_site_form_submit($form, &$form_state) {
// If the user requests it, send a copy using the current language. // If the user requests it, send a copy using the current language.
if ($values['copy']) { if ($values['copy']) {
drupal_mail('contact', 'page_copy', $from, $language, $values, $from); drupal_mail('contact', 'page_copy', $from, $language_interface, $values, $from);
} }
// Send an auto-reply if necessary using the current language. // Send an auto-reply if necessary using the current language.
if ($values['category']['reply']) { if ($values['category']['reply']) {
drupal_mail('contact', 'page_autoreply', $from, $language, $values, $to); drupal_mail('contact', 'page_autoreply', $from, $language_interface, $values, $to);
} }
flood_register_event('contact', variable_get('contact_threshold_window', 3600)); flood_register_event('contact', variable_get('contact_threshold_window', 3600));
...@@ -270,7 +270,7 @@ function contact_personal_form_validate($form, &$form_state) { ...@@ -270,7 +270,7 @@ function contact_personal_form_validate($form, &$form_state) {
* @see contact_personal_form_validate() * @see contact_personal_form_validate()
*/ */
function contact_personal_form_submit($form, &$form_state) { function contact_personal_form_submit($form, &$form_state) {
global $user, $language; global $user, $language_interface;
$values = $form_state['values']; $values = $form_state['values'];
$values['sender'] = $user; $values['sender'] = $user;
...@@ -291,7 +291,7 @@ function contact_personal_form_submit($form, &$form_state) { ...@@ -291,7 +291,7 @@ function contact_personal_form_submit($form, &$form_state) {
// Send a copy if requested, using current page language. // Send a copy if requested, using current page language.
if ($values['copy']) { if ($values['copy']) {
drupal_mail('contact', 'user_copy', $from, $language, $values, $from); drupal_mail('contact', 'user_copy', $from, $language_interface, $values, $from);
} }
flood_register_event('contact', variable_get('contact_threshold_window', 3600)); flood_register_event('contact', variable_get('contact_threshold_window', 3600));
......
...@@ -43,7 +43,7 @@ function entity_modules_disabled() { ...@@ -43,7 +43,7 @@ function entity_modules_disabled() {
* @see hook_entity_info_alter() * @see hook_entity_info_alter()
*/ */
function entity_get_info($entity_type = NULL) { function entity_get_info($entity_type = NULL) {
global $language; global $language_interface;
// Use the advanced drupal_static() pattern, since this is called very often. // Use the advanced drupal_static() pattern, since this is called very often.
static $drupal_static_fast; static $drupal_static_fast;
...@@ -54,7 +54,7 @@ function entity_get_info($entity_type = NULL) { ...@@ -54,7 +54,7 @@ function entity_get_info($entity_type = NULL) {
// hook_entity_info() includes translated strings, so each language is cached // hook_entity_info() includes translated strings, so each language is cached
// separately. // separately.
$langcode = $language->langcode; $langcode = $language_interface->langcode;
if (empty($entity_info)) { if (empty($entity_info)) {
if ($cache = cache()->get("entity_info:$langcode")) { if ($cache = cache()->get("entity_info:$langcode")) {
......
...@@ -67,7 +67,7 @@ function field_info_cache_clear() { ...@@ -67,7 +67,7 @@ function field_info_cache_clear() {
* @see _field_info_collate_types_reset() * @see _field_info_collate_types_reset()
*/ */
function _field_info_collate_types() { function _field_info_collate_types() {
global $language; global $language_interface;
// Use the advanced drupal_static() pattern, since this is called very often. // Use the advanced drupal_static() pattern, since this is called very often.
static $drupal_static_fast; static $drupal_static_fast;
...@@ -79,7 +79,7 @@ function _field_info_collate_types() { ...@@ -79,7 +79,7 @@ function _field_info_collate_types() {
// The _info() hooks invoked below include translated strings, so each // The _info() hooks invoked below include translated strings, so each
// language is cached separately. // language is cached separately.
$langcode = $language->langcode; $langcode = $language_interface->langcode;
if (!isset($info)) { if (!isset($info)) {
if ($cached = cache('field')->get("field_info_types:$langcode")) { if ($cached = cache('field')->get("field_info_types:$langcode")) {
......
...@@ -1051,10 +1051,10 @@ class FileTokenReplaceTestCase extends FileFieldTestCase { ...@@ -1051,10 +1051,10 @@ class FileTokenReplaceTestCase extends FileFieldTestCase {
* Creates a file, then tests the tokens generated from it. * Creates a file, then tests the tokens generated from it.
*/ */
function testFileTokenReplacement() { function testFileTokenReplacement() {
global $language; global $language_interface;
$url_options = array( $url_options = array(
'absolute' => TRUE, 'absolute' => TRUE,
'language' => $language, 'language' => $language_interface,
); );
// Create file field. // Create file field.
...@@ -1084,8 +1084,8 @@ class FileTokenReplaceTestCase extends FileFieldTestCase { ...@@ -1084,8 +1084,8 @@ class FileTokenReplaceTestCase extends FileFieldTestCase {
$tests['[file:mime]'] = check_plain($file->filemime); $tests['[file:mime]'] = check_plain($file->filemime);
$tests['[file:size]'] = format_size($file->filesize); $tests['[file:size]'] = format_size($file->filesize);
$tests['[file:url]'] = check_plain(file_create_url($file->uri)); $tests['[file:url]'] = check_plain(file_create_url($file->uri));
$tests['[file:timestamp]'] = format_date($file->timestamp, 'medium', '', NULL, $language->langcode); $tests['[file:timestamp]'] = format_date($file->timestamp, 'medium', '', NULL, $language_interface->langcode);
$tests['[file:timestamp:short]'] = format_date($file->timestamp, 'short', '', NULL, $language->langcode); $tests['[file:timestamp:short]'] = format_date($file->timestamp, 'short', '', NULL, $language_interface->langcode);
$tests['[file:owner]'] = check_plain(user_format_name($this->admin_user)); $tests['[file:owner]'] = check_plain(user_format_name($this->admin_user));
$tests['[file:owner:uid]'] = $file->uid; $tests['[file:owner:uid]'] = $file->uid;
...@@ -1093,7 +1093,7 @@ class FileTokenReplaceTestCase extends FileFieldTestCase { ...@@ -1093,7 +1093,7 @@ class FileTokenReplaceTestCase extends FileFieldTestCase {
$this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.')); $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
foreach ($tests as $input => $expected) { foreach ($tests as $input => $expected) {
$output = token_replace($input, array('file' => $file), array('language' => $language)); $output = token_replace($input, array('file' => $file), array('language' => $language_interface));
$this->assertEqual($output, $expected, t('Sanitized file token %token replaced.', array('%token' => $input))); $this->assertEqual($output, $expected, t('Sanitized file token %token replaced.', array('%token' => $input)));
} }
...@@ -1104,7 +1104,7 @@ class FileTokenReplaceTestCase extends FileFieldTestCase { ...@@ -1104,7 +1104,7 @@ class FileTokenReplaceTestCase extends FileFieldTestCase {
$tests['[file:size]'] = format_size($file->filesize); $tests['[file:size]'] = format_size($file->filesize);
foreach ($tests as $input => $expected) { foreach ($tests as $input => $expected) {
$output = token_replace($input, array('file' => $file), array('language' => $language, 'sanitize' => FALSE)); $output = token_replace($input, array('file' => $file), array('language' => $language_interface, 'sanitize' => FALSE));
$this->assertEqual($output, $expected, t('Unsanitized file token %token replaced.', array('%token' => $input))); $this->assertEqual($output, $expected, t('Unsanitized file token %token replaced.', array('%token' => $input)));
} }
} }
......
...@@ -390,12 +390,12 @@ function filter_modules_disabled($modules) { ...@@ -390,12 +390,12 @@ function filter_modules_disabled($modules) {
* @see filter_formats_reset() * @see filter_formats_reset()
*/ */
function filter_formats($account = NULL) { function filter_formats($account = NULL) {
global $language; global $language_interface;
$formats = &drupal_static(__FUNCTION__, array()); $formats = &drupal_static(__FUNCTION__, array());
// All available formats are cached for performance. // All available formats are cached for performance.
if (!isset($formats['all'])) { if (!isset($formats['all'])) {
if ($cache = cache()->get("filter_formats:{$language->langcode}")) { if ($cache = cache()->get("filter_formats:{$language_interface->langcode}")) {
$formats['all'] = $cache->data; $formats['all'] = $cache->data;
} }
else { else {
...@@ -407,7 +407,7 @@ function filter_formats($account = NULL) { ...@@ -407,7 +407,7 @@ function filter_formats($account = NULL) {
->execute() ->execute()
->fetchAllAssoc('format'); ->fetchAllAssoc('format');
cache()->set("filter_formats:{$language->langcode}", $formats['all']); cache()->set("filter_formats:{$language_interface->langcode}", $formats['all']);
} }
} }
......
...@@ -971,11 +971,11 @@ function image_default_style_revert($style) { ...@@ -971,11 +971,11 @@ function image_default_style_revert($style) {
* @see image_effect_definition_load() * @see image_effect_definition_load()
*/ */
function image_effect_definitions() { function image_effect_definitions() {
global $language; global $language_interface;
// hook_image_effect_info() includes translated strings, so each language is // hook_image_effect_info() includes translated strings, so each language is
// cached separately. // cached separately.
$langcode = $language->langcode; $langcode = $language_interface->langcode;
$effects = &drupal_static(__FUNCTION__); $effects = &drupal_static(__FUNCTION__);
......
...@@ -192,10 +192,10 @@ function language_delete($langcode) { ...@@ -192,10 +192,10 @@ function language_dele