From 603af2fb19da3570fd14d78e2d79ebada3160318 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 17 Nov 2024 20:00:34 +0000 Subject: [PATCH] Rename DI::apphelper() to DI::appHeler() --- mod/item.php | 2 +- src/App.php | 2 +- src/Console/PostUpdate.php | 2 +- src/Content/OEmbed.php | 2 +- src/Content/Text/BBCode.php | 2 +- src/Core/Hook.php | 6 +++--- src/Core/Renderer.php | 2 +- src/Core/Theme.php | 6 +++--- src/Core/Worker.php | 6 +++--- src/DI.php | 4 ++-- src/Model/Item.php | 2 +- src/Module/Admin/Summary.php | 2 +- src/Module/Api/Friendica/Events/Create.php | 4 ++-- src/Module/Home.php | 2 +- src/Module/OAuth/Acknowledge.php | 2 +- src/Module/OAuth/Authorize.php | 6 +++--- src/Module/RandomProfile.php | 2 +- src/Module/Settings/Account.php | 4 ++-- src/Module/Update/Profile.php | 2 +- src/Object/Thread.php | 2 +- src/Protocol/ActivityPub/Queue.php | 2 +- src/Protocol/Feed.php | 2 +- src/Security/OpenWebAuth.php | 4 ++-- src/Util/Temporal.php | 2 +- src/Worker/Cron.php | 2 +- src/Worker/DBUpdate.php | 2 +- src/Worker/Expire.php | 2 +- src/Worker/FetchMissingActivity.php | 2 +- src/Worker/Notifier.php | 4 ++-- src/Worker/ProfileUpdate.php | 2 +- view/theme/frio/php/scheme.php | 2 +- 31 files changed, 44 insertions(+), 44 deletions(-) diff --git a/mod/item.php b/mod/item.php index f184186e16..decb957bcc 100644 --- a/mod/item.php +++ b/mod/item.php @@ -284,7 +284,7 @@ function item_process(array $post, array $request, bool $preview, string $return unset($post['api_source']); if (!empty($request['scheduled_at'])) { - $scheduled_at = DateTimeFormat::convert($request['scheduled_at'], 'UTC', DI::apphelper()->getTimeZone()); + $scheduled_at = DateTimeFormat::convert($request['scheduled_at'], 'UTC', DI::appHelper()->getTimeZone()); if ($scheduled_at > DateTimeFormat::utcNow()) { unset($post['created']); unset($post['edited']); diff --git a/src/App.php b/src/App.php index c5a7990994..46639f8939 100644 --- a/src/App.php +++ b/src/App.php @@ -129,7 +129,7 @@ class App implements AppHelper $this->l10n = $l10n; $this->args = $args; $this->session = $session; - $this->appHelper = DI::apphelper(); + $this->appHelper = DI::appHelper(); $this->load($dbaDefinition, $viewDefinition); } diff --git a/src/Console/PostUpdate.php b/src/Console/PostUpdate.php index 2d0357a460..318712cdc5 100644 --- a/src/Console/PostUpdate.php +++ b/src/Console/PostUpdate.php @@ -58,7 +58,7 @@ HELP; $this->appMode = $appMode; $this->keyValue = $keyValue; $this->l10n = $l10n; - $this->basePath = DI::apphelper()->getBasePath(); + $this->basePath = DI::appHelper()->getBasePath(); } protected function doExecute(): int diff --git a/src/Content/OEmbed.php b/src/Content/OEmbed.php index 55f5e0ad0f..4d3c589041 100644 --- a/src/Content/OEmbed.php +++ b/src/Content/OEmbed.php @@ -48,7 +48,7 @@ class OEmbed { $embedurl = trim($embedurl, '\'"'); - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); $cache_key = 'oembed:' . $appHelper->getThemeInfoValue('videowidth') . ':' . $embedurl; diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 238bac1205..bcac088e7e 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1926,7 +1926,7 @@ class BBCode private static function convertVideoPlatformsToHtml(string $text, bool $try_oembed): string { - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); $text = self::normalizeVideoLinks($text); diff --git a/src/Core/Hook.php b/src/Core/Hook.php index bbf634401a..44dfad70bc 100644 --- a/src/Core/Hook.php +++ b/src/Core/Hook.php @@ -80,7 +80,7 @@ class Hook */ public static function register(string $hook, string $file, string $function, int $priority = 0) { - $file = str_replace(DI::apphelper()->getBasePath() . DIRECTORY_SEPARATOR, '', $file); + $file = str_replace(DI::appHelper()->getBasePath() . DIRECTORY_SEPARATOR, '', $file); $condition = ['hook' => $hook, 'file' => $file, 'function' => $function]; if (DBA::exists('hook', $condition)) { @@ -101,7 +101,7 @@ class Hook */ public static function unregister(string $hook, string $file, string $function): bool { - $relative_file = str_replace(DI::apphelper()->getBasePath() . DIRECTORY_SEPARATOR, '', $file); + $relative_file = str_replace(DI::appHelper()->getBasePath() . DIRECTORY_SEPARATOR, '', $file); // This here is only needed for fixing a problem that existed on the develop branch $condition = ['hook' => $hook, 'file' => $file, 'function' => $function]; @@ -197,7 +197,7 @@ class Hook public static function callSingle(string $name, array $hook, &$data = null) { // Don't run a theme's hook if the user isn't using the theme - if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/' . DI::apphelper()->getCurrentTheme()) === false) { + if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/' . DI::appHelper()->getCurrentTheme()) === false) { return; } diff --git a/src/Core/Renderer.php b/src/Core/Renderer.php index 6ddd8d4ad1..6fb6e02ead 100644 --- a/src/Core/Renderer.php +++ b/src/Core/Renderer.php @@ -155,7 +155,7 @@ class Renderer if (isset(self::$template_engine_instance[$template_engine])) { return self::$template_engine_instance[$template_engine]; } else { - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); $class = self::$template_engines[$template_engine]; $obj = new $class($appHelper->getCurrentTheme(), $appHelper->getThemeInfo()); self::$template_engine_instance[$template_engine] = $obj; diff --git a/src/Core/Theme.php b/src/Core/Theme.php index 81d1016831..eedc64e066 100644 --- a/src/Core/Theme.php +++ b/src/Core/Theme.php @@ -208,7 +208,7 @@ class Theme */ public static function getPathForFile(string $file): string { - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); $theme = $appHelper->getCurrentTheme(); @@ -245,7 +245,7 @@ class Theme return 'view/theme/' . $theme . '/style.css'; } - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); $query_params = []; @@ -267,7 +267,7 @@ class Theme { $theme = Strings::sanitizeFilePathItem($theme); - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); $base_theme = $appHelper->getThemeInfoValue('extends') ?? ''; if (file_exists("view/theme/$theme/config.php")) { diff --git a/src/Core/Worker.php b/src/Core/Worker.php index 6aa8d4331d..5d33dc57fe 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -533,7 +533,7 @@ class Worker */ private static function execFunction(array $queue, string $funcname, array $argv, bool $method_call) { - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); self::coolDown(); @@ -1371,7 +1371,7 @@ class Worker */ public static function getRetrial(): int { - $queue = DI::apphelper()->getQueue(); + $queue = DI::appHelper()->getQueue(); return $queue['retrial'] ?? 0; } @@ -1384,7 +1384,7 @@ class Worker */ public static function defer(int $worker_defer_limit = 0): bool { - $queue = DI::apphelper()->getQueue(); + $queue = DI::appHelper()->getQueue(); if (empty($queue)) { return false; diff --git a/src/DI.php b/src/DI.php index 8f5c9859e5..5604fe9df2 100644 --- a/src/DI.php +++ b/src/DI.php @@ -71,7 +71,7 @@ abstract class DI // /** - * @deprecated 2024.12 use DI::apphelper() instead + * @deprecated 2024.12 use DI::appHelper() instead * * @return App */ @@ -80,7 +80,7 @@ abstract class DI return self::$dice->create(App::class); } - public static function apphelper(): AppHelper + public static function appHelper(): AppHelper { return self::$dice->create(AppHelper::class); } diff --git a/src/Model/Item.php b/src/Model/Item.php index b0b4d80d19..ffdb9c67f0 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -3348,7 +3348,7 @@ class Item */ public static function prepareBody(array &$item, bool $attach = false, bool $is_preview = false, bool $only_cache = false): string { - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); $uid = DI::userSession()->getLocalUserId(); Hook::callAll('prepare_body_init', $item); diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index a586b117da..736c8b3e2e 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -29,7 +29,7 @@ class Summary extends BaseAdmin { parent::content(); - $basePath = DI::apphelper()->getBasePath(); + $basePath = DI::appHelper()->getBasePath(); // are there MyISAM tables in the DB? If so, trigger a warning message $warningtext = []; diff --git a/src/Module/Api/Friendica/Events/Create.php b/src/Module/Api/Friendica/Events/Create.php index fdde2e9c18..3766fa1fbe 100644 --- a/src/Module/Api/Friendica/Events/Create.php +++ b/src/Module/Api/Friendica/Events/Create.php @@ -59,11 +59,11 @@ class Create extends BaseApi $finish = DBA::NULL_DATETIME; $nofinish = true; } else { - $finish = DateTimeFormat::convert($request['end_time'], 'UTC', DI::apphelper()->getTimeZone()); + $finish = DateTimeFormat::convert($request['end_time'], 'UTC', DI::appHelper()->getTimeZone()); $nofinish = false; } - $start = DateTimeFormat::convert($request['start_time'], 'UTC', DI::apphelper()->getTimeZone()); + $start = DateTimeFormat::convert($request['start_time'], 'UTC', DI::appHelper()->getTimeZone()); // create event $event = []; diff --git a/src/Module/Home.php b/src/Module/Home.php index 94cb08773e..9c72398f7a 100644 --- a/src/Module/Home.php +++ b/src/Module/Home.php @@ -32,7 +32,7 @@ class Home extends BaseModule protected function content(array $request = []): string { - $basePath = DI::apphelper()->getBasePath(); + $basePath = DI::appHelper()->getBasePath(); $config = DI::config(); // currently no returned data is used diff --git a/src/Module/OAuth/Acknowledge.php b/src/Module/OAuth/Acknowledge.php index 82ad166bc9..78e4083e42 100644 --- a/src/Module/OAuth/Acknowledge.php +++ b/src/Module/OAuth/Acknowledge.php @@ -26,7 +26,7 @@ class Acknowledge extends BaseApi protected function post(array $request = []) { DI::session()->set('oauth_acknowledge', true); - DI::apphelper()->redirect(DI::session()->get('return_path')); + DI::appHelper()->redirect(DI::session()->get('return_path')); } protected function content(array $request = []): string diff --git a/src/Module/OAuth/Authorize.php b/src/Module/OAuth/Authorize.php index 8d77573e72..8179bfa886 100644 --- a/src/Module/OAuth/Authorize.php +++ b/src/Module/OAuth/Authorize.php @@ -60,14 +60,14 @@ class Authorize extends BaseApi $uid = DI::userSession()->getLocalUserId(); if (empty($uid)) { Logger::info('Redirect to login'); - DI::apphelper()->redirect('login?' . http_build_query(['return_authorize' => $redirect])); + DI::appHelper()->redirect('login?' . http_build_query(['return_authorize' => $redirect])); } else { Logger::info('Already logged in user', ['uid' => $uid]); } if (!OAuth::existsTokenForUser($application, $uid) && !DI::session()->get('oauth_acknowledge')) { Logger::info('Redirect to acknowledge'); - DI::apphelper()->redirect('oauth/acknowledge?' . http_build_query(['return_authorize' => $redirect, 'application' => $application['name']])); + DI::appHelper()->redirect('oauth/acknowledge?' . http_build_query(['return_authorize' => $redirect, 'application' => $application['name']])); } DI::session()->remove('oauth_acknowledge'); @@ -78,7 +78,7 @@ class Authorize extends BaseApi } if ($application['redirect_uri'] != 'urn:ietf:wg:oauth:2.0:oob') { - DI::apphelper()->redirect($request['redirect_uri'] . (strpos($request['redirect_uri'], '?') ? '&' : '?') . http_build_query(['code' => $token['code'], 'state' => $request['state']])); + DI::appHelper()->redirect($request['redirect_uri'] . (strpos($request['redirect_uri'], '?') ? '&' : '?') . http_build_query(['code' => $token['code'], 'state' => $request['state']])); } self::$oauth_code = $token['code']; diff --git a/src/Module/RandomProfile.php b/src/Module/RandomProfile.php index d590af634f..bc43d48511 100644 --- a/src/Module/RandomProfile.php +++ b/src/Module/RandomProfile.php @@ -18,7 +18,7 @@ class RandomProfile extends BaseModule { protected function content(array $request = []): string { - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); $contact = Contact::getRandomContact(); diff --git a/src/Module/Settings/Account.php b/src/Module/Settings/Account.php index 6c8a473470..3046e28775 100644 --- a/src/Module/Settings/Account.php +++ b/src/Module/Settings/Account.php @@ -109,7 +109,7 @@ class Account extends BaseSettings } if (strlen($timezone) && $timezone != $user['timezone']) { - DI::apphelper()->setTimeZone($timezone); + DI::appHelper()->setTimeZone($timezone); } $fields = [ @@ -400,7 +400,7 @@ class Account extends BaseSettings $expire_network_only = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'expire', 'network_only', false); if (!strlen($user['timezone'])) { - $timezone = DI::apphelper()->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 diff --git a/src/Module/Update/Profile.php b/src/Module/Update/Profile.php index bcfce3fa38..b9360d7360 100644 --- a/src/Module/Update/Profile.php +++ b/src/Module/Update/Profile.php @@ -23,7 +23,7 @@ class Profile extends BaseModule { protected function rawContent(array $request = []) { - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); // Ensure we've got a profile owner if updating. $appHelper->setProfileOwner((int)($request['p'] ?? 0)); diff --git a/src/Object/Thread.php b/src/Object/Thread.php index e0585e3222..2363ab197d 100644 --- a/src/Object/Thread.php +++ b/src/Object/Thread.php @@ -57,7 +57,7 @@ class Thread return; } - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); switch ($mode) { case Conversation::MODE_NETWORK: diff --git a/src/Protocol/ActivityPub/Queue.php b/src/Protocol/ActivityPub/Queue.php index 678decb1ca..059ba1a388 100644 --- a/src/Protocol/ActivityPub/Queue.php +++ b/src/Protocol/ActivityPub/Queue.php @@ -192,7 +192,7 @@ class Queue } if (!empty($entry['wid'])) { - $worker = DI::apphelper()->getQueue(); + $worker = DI::appHelper()->getQueue(); $wid = $worker['id'] ?? 0; if ($entry['wid'] != $wid) { $workerqueue = DBA::selectFirst('workerqueue', ['pid'], ['id' => $entry['wid'], 'done' => false]); diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index 9800fd2433..62d58a0ec8 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -1014,7 +1014,7 @@ class Feed // Display events in the user's timezone if (strlen($owner['timezone'])) { - DI::apphelper()->setTimeZone($owner['timezone']); + DI::appHelper()->setTimeZone($owner['timezone']); } $previous_created = $last_update; diff --git a/src/Security/OpenWebAuth.php b/src/Security/OpenWebAuth.php index 79117c4ecc..4090fa7378 100644 --- a/src/Security/OpenWebAuth.php +++ b/src/Security/OpenWebAuth.php @@ -114,7 +114,7 @@ class OpenWebAuth */ public static function init(string $token) { - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); // Clean old OpenWebAuthToken entries. OpenWebAuthToken::purge('owt', '3 MINUTE'); @@ -160,7 +160,7 @@ class OpenWebAuth */ public static function addVisitorCookieForHandle(string $handle): array { - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); // Try to find the public contact entry of the visitor. $cid = Contact::getIdForURL($handle); diff --git a/src/Util/Temporal.php b/src/Util/Temporal.php index 64ab47b98c..098b60d5e8 100644 --- a/src/Util/Temporal.php +++ b/src/Util/Temporal.php @@ -264,7 +264,7 @@ class Temporal $input_text, DI::l10n()->t( 'Time zone: %s Change in Settings', - str_replace('_', ' ', DI::apphelper()->getTimeZone()) . ' (GMT ' . DateTimeFormat::localNow('P') . ')', + str_replace('_', ' ', DI::appHelper()->getTimeZone()) . ' (GMT ' . DateTimeFormat::localNow('P') . ')', DI::baseUrl() . '/settings' ), $required ? '*' : '', diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index e6d11db370..c10a548559 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -21,7 +21,7 @@ class Cron { public static function execute() { - $basepath = DI::apphelper()->getBasePath(); + $basepath = DI::appHelper()->getBasePath(); $last = DI::keyValue()->get('last_cron'); diff --git a/src/Worker/DBUpdate.php b/src/Worker/DBUpdate.php index 87a3fae27f..4e01e62898 100644 --- a/src/Worker/DBUpdate.php +++ b/src/Worker/DBUpdate.php @@ -19,7 +19,7 @@ class DBUpdate { // Just in case the last update wasn't failed if (DI::config()->get('system', 'update', Update::SUCCESS) != Update::FAILED) { - Update::run(DI::apphelper()->getBasePath()); + Update::run(DI::appHelper()->getBasePath()); } } } diff --git a/src/Worker/Expire.php b/src/Worker/Expire.php index 2193791229..baaef454ff 100644 --- a/src/Worker/Expire.php +++ b/src/Worker/Expire.php @@ -21,7 +21,7 @@ class Expire { public static function execute($param = '', $hook_function = '') { - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); Hook::loadHooks(); diff --git a/src/Worker/FetchMissingActivity.php b/src/Worker/FetchMissingActivity.php index 7224f85cdb..5b6e8ffd03 100644 --- a/src/Worker/FetchMissingActivity.php +++ b/src/Worker/FetchMissingActivity.php @@ -40,7 +40,7 @@ class FetchMissingActivity Logger::info('Defer limit reached, activity could not be fetched', ['url' => $url]); // recursively delete all entries that belong to this worker task - $queue = DI::apphelper()->getQueue(); + $queue = DI::appHelper()->getQueue(); if (!empty($queue['id'])) { Queue::deleteByWorkerId($queue['id']); } diff --git a/src/Worker/Notifier.php b/src/Worker/Notifier.php index 90e47273de..42868e4e0e 100644 --- a/src/Worker/Notifier.php +++ b/src/Worker/Notifier.php @@ -42,7 +42,7 @@ class Notifier { public static function execute(string $cmd, int $post_uriid, int $sender_uid = 0) { - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); Logger::info('Invoked', ['cmd' => $cmd, 'target' => $post_uriid, 'sender_uid' => $sender_uid]); @@ -414,7 +414,7 @@ class Notifier */ private static function delivery(string $cmd, int $post_uriid, int $sender_uid, array $target_item, array $parent, array $thr_parent, array $owner, bool $batch_delivery, bool $in_batch, array $contacts, array $ap_contacts, array $conversants = []): int { - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); $delivery_queue_count = 0; if (!empty($target_item['verb']) && ($target_item['verb'] == Activity::ANNOUNCE)) { diff --git a/src/Worker/ProfileUpdate.php b/src/Worker/ProfileUpdate.php index fb8ecfd857..685229b3b5 100644 --- a/src/Worker/ProfileUpdate.php +++ b/src/Worker/ProfileUpdate.php @@ -30,7 +30,7 @@ class ProfileUpdate { return; } - $appHelper = DI::apphelper(); + $appHelper = DI::appHelper(); $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid); diff --git a/view/theme/frio/php/scheme.php b/view/theme/frio/php/scheme.php index b8547fee3d..5c11c8a5d1 100644 --- a/view/theme/frio/php/scheme.php +++ b/view/theme/frio/php/scheme.php @@ -29,7 +29,7 @@ require_once 'view/theme/frio/theme.php'; function get_scheme_info($scheme) { - $theme = DI::apphelper()->getCurrentTheme(); + $theme = DI::appHelper()->getCurrentTheme(); $themepath = 'view/theme/' . $theme . '/'; $scheme = Strings::sanitizeFilePathItem($scheme) ?: FRIO_DEFAULT_SCHEME;