Replace static calls of DI::app() with DI::apphelper()

This commit is contained in:
Art4 2024-11-06 07:57:43 +00:00
parent 4f16bbe5f5
commit 9074258b78
5 changed files with 8 additions and 12 deletions

View file

@ -284,7 +284,7 @@ function item_process(array $post, array $request, bool $preview, string $return
unset($post['api_source']); unset($post['api_source']);
if (!empty($request['scheduled_at'])) { if (!empty($request['scheduled_at'])) {
$scheduled_at = DateTimeFormat::convert($request['scheduled_at'], 'UTC', DI::app()->getTimeZone()); $scheduled_at = DateTimeFormat::convert($request['scheduled_at'], 'UTC', DI::apphelper()->getTimeZone());
if ($scheduled_at > DateTimeFormat::utcNow()) { if ($scheduled_at > DateTimeFormat::utcNow()) {
unset($post['created']); unset($post['created']);
unset($post['edited']); unset($post['edited']);

View file

@ -59,11 +59,11 @@ class Create extends BaseApi
$finish = DBA::NULL_DATETIME; $finish = DBA::NULL_DATETIME;
$nofinish = true; $nofinish = true;
} else { } else {
$finish = DateTimeFormat::convert($request['end_time'], 'UTC', DI::app()->getTimeZone()); $finish = DateTimeFormat::convert($request['end_time'], 'UTC', DI::apphelper()->getTimeZone());
$nofinish = false; $nofinish = false;
} }
$start = DateTimeFormat::convert($request['start_time'], 'UTC', DI::app()->getTimeZone()); $start = DateTimeFormat::convert($request['start_time'], 'UTC', DI::apphelper()->getTimeZone());
// create event // create event
$event = []; $event = [];

View file

@ -40,8 +40,6 @@ class Account extends BaseSettings
self::checkFormSecurityTokenRedirectOnError($redirectUrl, 'settings'); self::checkFormSecurityTokenRedirectOnError($redirectUrl, 'settings');
$a = DI::app();
$user = User::getById($this->session->getLocalUserId()); $user = User::getById($this->session->getLocalUserId());
if (!empty($request['password-submit'])) { if (!empty($request['password-submit'])) {
@ -111,7 +109,7 @@ class Account extends BaseSettings
} }
if (strlen($timezone) && $timezone != $user['timezone']) { if (strlen($timezone) && $timezone != $user['timezone']) {
$a->setTimeZone($timezone); DI::apphelper()->setTimeZone($timezone);
} }
$fields = [ $fields = [
@ -383,8 +381,6 @@ class Account extends BaseSettings
return ''; return '';
} }
$a = DI::app();
$user = User::getById($this->session->getLocalUserId()); $user = User::getById($this->session->getLocalUserId());
$username = $user['username']; $username = $user['username'];
@ -404,7 +400,7 @@ class Account extends BaseSettings
$expire_network_only = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'expire', 'network_only', false); $expire_network_only = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'expire', 'network_only', false);
if (!strlen($user['timezone'])) { if (!strlen($user['timezone'])) {
$timezone = $a->getTimeZone(); $timezone = DI::apphelper()->getTimeZone();
} }
// Set the account type to "Community" when the page is a community page but the account type doesn't fit // Set the account type to "Community" when the page is a community page but the account type doesn't fit

View file

@ -556,7 +556,7 @@ class Feed
Logger::info('Feed is too old', ['created' => $item['created'], 'uid' => $item['uid'], 'uri' => $item['uri']]); Logger::info('Feed is too old', ['created' => $item['created'], 'uid' => $item['uid'], 'uri' => $item['uri']]);
continue; continue;
} }
if (!empty($item['plink'])) { if (!empty($item['plink'])) {
$fetch_further_information = $contact['fetch_further_information'] ?? LocalRelationship::FFI_NONE; $fetch_further_information = $contact['fetch_further_information'] ?? LocalRelationship::FFI_NONE;
} else { } else {
@ -1014,7 +1014,7 @@ class Feed
// Display events in the user's timezone // Display events in the user's timezone
if (strlen($owner['timezone'])) { if (strlen($owner['timezone'])) {
DI::app()->setTimeZone($owner['timezone']); DI::apphelper()->setTimeZone($owner['timezone']);
} }
$previous_created = $last_update; $previous_created = $last_update;

View file

@ -264,7 +264,7 @@ class Temporal
$input_text, $input_text,
DI::l10n()->t( DI::l10n()->t(
'Time zone: <strong>%s</strong> <a href="%s">Change in Settings</a>', 'Time zone: <strong>%s</strong> <a href="%s">Change in Settings</a>',
str_replace('_', ' ', DI::app()->getTimeZone()) . ' (GMT ' . DateTimeFormat::localNow('P') . ')', str_replace('_', ' ', DI::apphelper()->getTimeZone()) . ' (GMT ' . DateTimeFormat::localNow('P') . ')',
DI::baseUrl() . '/settings' DI::baseUrl() . '/settings'
), ),
$required ? '*' : '', $required ? '*' : '',