Rename function name

pull/2487/head
jmontoyaa 9 years ago
parent 06145ce0d8
commit 97b9a5e10c
  1. 28
      main/inc/lib/internationalization.lib.php

@ -57,8 +57,6 @@ define('PERSON_NAME_EMAIL_ADDRESS', PERSON_NAME_WESTERN_ORDER);
// For backward compatibility this format has been set to Eastern order.
define('PERSON_NAME_DATA_EXPORT', PERSON_NAME_EASTERN_ORDER);
/**
* Returns a translated (localized) string, called by its identificator.
* @param string $variable This is the identificator (name) of the translated string to be retrieved.
@ -105,10 +103,9 @@ function get_lang($variable, $reserved = null, $language = null) {
}
// Caching results from some API functions, for speed.
static $initialized, $encoding, $langpath, $test_server_mode, $show_special_markup;
static $initialized, $show_special_markup;
if (!isset($initialized)) {
$langpath = api_get_path(SYS_LANG_PATH);
$test_server_mode = api_get_setting('server_type') == 'test';
$test_server_mode = api_get_setting('server_type') === 'test';
$show_special_markup = api_get_setting('hide_dltt_markup') != 'true' || $test_server_mode;
$initialized = true;
}
@ -462,9 +459,10 @@ function api_get_local_time(
try {
$date = new DateTime($time, new DateTimezone($from_timezone));
$date->setTimezone(new DateTimeZone($to_timezone));
return apiGetHumanDateTime($date, $showTime, $humanForm);
return api_get_human_date_time($date, $showTime, $humanForm);
} catch (Exception $e) {
return null;
return '';
}
}
@ -627,15 +625,20 @@ function api_format_date($time, $format = null, $language = null)
} else {
// We replace %a %A %b %B masks of date format with translated strings
$translated = &_api_get_day_month_names($language);
$date_format = str_replace(array('%A', '%a', '%B', '%b'),
array($translated['days_long'][(int)strftime('%w', $time )],
$date_format = str_replace(
array('%A', '%a', '%B', '%b'),
array(
$translated['days_long'][(int)strftime('%w', $time)],
$translated['days_short'][(int)strftime('%w', $time)],
$translated['months_long'][(int)strftime('%m', $time) - 1],
$translated['months_short'][(int)strftime('%m', $time) - 1]),
$date_format);
$translated['months_short'][(int)strftime('%m', $time) - 1],
),
$date_format
);
$formatted_date = api_to_system_encoding(strftime($date_format, $time), 'UTF-8');
}
date_default_timezone_set($system_timezone);
return $formatted_date;
}
@ -1966,7 +1969,8 @@ function _api_convert_encoding_supports($encoding) {
* @param bool $humanForm Whether to show day-month-year (true) or year-month-day (false)
* @return string Formatted date
*/
function apiGetHumanDateTime($date, $showTime = true, $humanForm = false) {
function api_get_human_date_time($date, $showTime = true, $humanForm = false)
{
if ($showTime) {
if ($humanForm) {
return $date->format('j M Y H:i:s');

Loading…
Cancel
Save