Skip to content

Commit 3151b8a

Browse files
committed
Replace _api_get_timezone with api_get_timezone
1 parent 3a9c18e commit 3151b8a

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

main/admin/settings.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
15291529
case 'timezone_value':
15301530
$timezone = $row['selected_value'];
15311531
if (empty($timezone)) {
1532-
$timezone = _api_get_timezone();
1532+
$timezone = api_get_timezone();
15331533
}
15341534
$form->addLabel('', sprintf(get_lang('LocalTimeUsingPortalTimezoneXIsY'), $timezone, api_get_local_time()));
15351535
break;

main/admin/skill_list.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
} else {
3939
$updatedAt = new DateTime(
4040
api_get_utc_datetime(),
41-
new DateTimeZone(_api_get_timezone())
41+
new DateTimeZone(api_get_timezone())
4242
);
4343

4444
$skill->setStatus(1);
@@ -71,7 +71,7 @@
7171
} else {
7272
$updatedAt = new DateTime(
7373
api_get_utc_datetime(),
74-
new DateTimeZone(_api_get_timezone())
74+
new DateTimeZone(api_get_timezone())
7575
);
7676

7777
$skill->setStatus(0);

main/inc/lib/TicketManager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,15 +1284,15 @@ public static function get_ticket_detail_by_id($ticket_id)
12841284
$row['course'] = null;
12851285
$row['start_date_from_db'] = $row['start_date'];
12861286
$row['start_date'] = api_convert_and_format_date(
1287-
api_get_local_time($row['start_date']), DATE_TIME_FORMAT_LONG, _api_get_timezone()
1287+
api_get_local_time($row['start_date']), DATE_TIME_FORMAT_LONG, api_get_timezone()
12881288
);
12891289
$row['end_date_from_db'] = $row['end_date'];
12901290
$row['end_date'] = api_convert_and_format_date(
1291-
api_get_local_time($row['end_date']), DATE_TIME_FORMAT_LONG, _api_get_timezone()
1291+
api_get_local_time($row['end_date']), DATE_TIME_FORMAT_LONG, api_get_timezone()
12921292
);
12931293
$row['sys_lastedit_datetime_from_db'] = $row['sys_lastedit_datetime'];
12941294
$row['sys_lastedit_datetime'] = api_convert_and_format_date(
1295-
api_get_local_time($row['sys_lastedit_datetime']), DATE_TIME_FORMAT_LONG, _api_get_timezone()
1295+
api_get_local_time($row['sys_lastedit_datetime']), DATE_TIME_FORMAT_LONG, api_get_timezone()
12961296
);
12971297
$row['course_url'] = null;
12981298
if ($row['course_id'] != 0) {

main/inc/lib/agenda.lib.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,7 @@ public function getPlatformEvents($start, $end)
18511851
private function formatEventDate($utcTime)
18521852
{
18531853
$utcTimeZone = new DateTimeZone('UTC');
1854-
$platformTimeZone = new DateTimeZone(_api_get_timezone());
1854+
$platformTimeZone = new DateTimeZone(api_get_timezone());
18551855

18561856
$eventDate = new DateTime($utcTime, $utcTimeZone);
18571857
$eventDate->setTimezone($platformTimeZone);
@@ -2718,7 +2718,7 @@ public function importEventFile($courseInfo, $file)
27182718
);
27192719
$sentTo = array('everyone' => true);
27202720
$calendar = Sabre\VObject\Reader::read($data);
2721-
$currentTimeZone = _api_get_timezone();
2721+
$currentTimeZone = api_get_timezone();
27222722
if (!empty($calendar->VEVENT)) {
27232723
foreach ($calendar->VEVENT as $event) {
27242724
$start = $event->DTSTART->getDateTime();

main/inc/lib/internationalization.lib.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ function api_get_timezones()
353353
*
354354
* @return string The timezone chosen
355355
*/
356-
function _api_get_timezone()
356+
function api_get_timezone()
357357
{
358358
// First, get the default timezone of the server
359359
$to_timezone = date_default_timezone_get();
@@ -394,7 +394,7 @@ function _api_get_timezone()
394394
*/
395395
function api_get_utc_datetime($time = null, $return_null_if_invalid_date = false, $returnObj = false)
396396
{
397-
$from_timezone = _api_get_timezone();
397+
$from_timezone = api_get_timezone();
398398
$to_timezone = 'UTC';
399399
if (is_null($time) || empty($time) || $time === '0000-00-00 00:00:00') {
400400
if ($return_null_if_invalid_date) {
@@ -451,7 +451,7 @@ function api_get_local_time(
451451
}
452452
// Determining the timezone to be converted to
453453
if (is_null($to_timezone)) {
454-
$to_timezone = _api_get_timezone();
454+
$to_timezone = api_get_timezone();
455455
}
456456

457457
// If time is a timestamp, convert it to a string
@@ -525,7 +525,7 @@ function api_strtotime($time, $timezone = null)
525525
function api_format_date($time, $format = null, $language = null)
526526
{
527527
$system_timezone = date_default_timezone_get();
528-
date_default_timezone_set(_api_get_timezone());
528+
date_default_timezone_set(api_get_timezone());
529529

530530
if (is_string($time)) {
531531
$time = strtotime($time);
@@ -677,7 +677,7 @@ function date_to_str_ago($date, $timeZone = 'UTC')
677677
return '';
678678
}
679679

680-
$getOldTimezone = _api_get_timezone();
680+
$getOldTimezone = api_get_timezone();
681681
$timeAgo = new TimeAgo($timeZone, api_get_language_isocode());
682682
$value = $timeAgo->inWords($date);
683683

main/inc/lib/template.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ private function set_system_parameters()
514514
'site_name' => api_get_setting('siteName'),
515515
'institution' => api_get_setting('Institution'),
516516
'date' => api_format_date('now', DATE_FORMAT_LONG),
517-
'timezone' => _api_get_timezone(),
517+
'timezone' => api_get_timezone(),
518518
'gamification_mode' => api_get_setting('gamification_mode')
519519
);
520520
$this->assign('_s', $_s);

tests/main/inc/lib/internationalization.lib.test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ public function test_api_get_local_time_with_timestamp() {
971971

972972
public function test_api_get_utc_datetime_with_string() {
973973
$timestamp = time();
974-
$timezone = _api_get_timezone();
974+
$timezone = api_get_timezone();
975975
$system_timezone = date_default_timezone_get();
976976
date_default_timezone_set($timezone);
977977
$datetime = date('Y-m-d H:i:s', $timestamp);

0 commit comments

Comments
 (0)