- Patch #988878 by Shyamala, Dave Reid: system_tokens() references a not initialized variable.
parent
c96fb3799e
commit
450cbf6320
|
@ -130,10 +130,13 @@ function system_token_info() {
|
||||||
*/
|
*/
|
||||||
function system_tokens($type, $tokens, array $data = array(), array $options = array()) {
|
function system_tokens($type, $tokens, array $data = array(), array $options = array()) {
|
||||||
$url_options = array('absolute' => TRUE);
|
$url_options = array('absolute' => TRUE);
|
||||||
if (isset($language)) {
|
if (isset($options['language'])) {
|
||||||
$url_options['language'] = $language;
|
$url_options['language'] = $options['language'];
|
||||||
|
$language_code = $options['language']->language;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$language_code = NULL;
|
||||||
}
|
}
|
||||||
$langcode = (isset($language) ? $language->language : NULL);
|
|
||||||
$sanitize = !empty($options['sanitize']);
|
$sanitize = !empty($options['sanitize']);
|
||||||
|
|
||||||
$replacements = array();
|
$replacements = array();
|
||||||
|
@ -181,19 +184,19 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
|
||||||
foreach ($tokens as $name => $original) {
|
foreach ($tokens as $name => $original) {
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
case 'short':
|
case 'short':
|
||||||
$replacements[$original] = format_date($date, 'short', '', NULL, $langcode);
|
$replacements[$original] = format_date($date, 'short', '', NULL, $language_code);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'medium':
|
case 'medium':
|
||||||
$replacements[$original] = format_date($date, 'medium', '', NULL, $langcode);
|
$replacements[$original] = format_date($date, 'medium', '', NULL, $language_code);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'long':
|
case 'long':
|
||||||
$replacements[$original] = format_date($date, 'long', '', NULL, $langcode);
|
$replacements[$original] = format_date($date, 'long', '', NULL, $language_code);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'since':
|
case 'since':
|
||||||
$replacements[$original] = format_interval((REQUEST_TIME - $date), 2, $langcode);
|
$replacements[$original] = format_interval((REQUEST_TIME - $date), 2, $language_code);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'raw':
|
case 'raw':
|
||||||
|
@ -204,7 +207,7 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
|
||||||
|
|
||||||
if ($created_tokens = token_find_with_prefix($tokens, 'custom')) {
|
if ($created_tokens = token_find_with_prefix($tokens, 'custom')) {
|
||||||
foreach ($created_tokens as $name => $original) {
|
foreach ($created_tokens as $name => $original) {
|
||||||
$replacements[$original] = format_date($date, 'custom', $name, NULL, $langcode);
|
$replacements[$original] = format_date($date, 'custom', $name, NULL, $language_code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,7 +245,7 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
|
||||||
|
|
||||||
// These tokens are default variations on the chained tokens handled below.
|
// These tokens are default variations on the chained tokens handled below.
|
||||||
case 'timestamp':
|
case 'timestamp':
|
||||||
$replacements[$original] = format_date($file->timestamp, 'medium', '', NULL, $langcode);
|
$replacements[$original] = format_date($file->timestamp, 'medium', '', NULL, $language_code);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'owner':
|
case 'owner':
|
||||||
|
|
Loading…
Reference in New Issue