Rename DI::apphelper() to DI::appHeler()

This commit is contained in:
Art4 2024-11-17 20:00:34 +00:00
parent e320b010c7
commit 603af2fb19
31 changed files with 44 additions and 44 deletions

View file

@ -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']);

View file

@ -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);
}

View file

@ -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

View file

@ -48,7 +48,7 @@ class OEmbed
{
$embedurl = trim($embedurl, '\'"');
$appHelper = DI::apphelper();
$appHelper = DI::appHelper();
$cache_key = 'oembed:' . $appHelper->getThemeInfoValue('videowidth') . ':' . $embedurl;

View file

@ -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);

View file

@ -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;
}

View file

@ -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;

View file

@ -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")) {

View file

@ -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;

View file

@ -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);
}

View file

@ -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);

View file

@ -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 = [];

View file

@ -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 = [];

View file

@ -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

View file

@ -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

View file

@ -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'];

View file

@ -18,7 +18,7 @@ class RandomProfile extends BaseModule
{
protected function content(array $request = []): string
{
$appHelper = DI::apphelper();
$appHelper = DI::appHelper();
$contact = Contact::getRandomContact();

View file

@ -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

View file

@ -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));

View file

@ -57,7 +57,7 @@ class Thread
return;
}
$appHelper = DI::apphelper();
$appHelper = DI::appHelper();
switch ($mode) {
case Conversation::MODE_NETWORK:

View file

@ -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]);

View file

@ -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;

View file

@ -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);

View file

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

View file

@ -21,7 +21,7 @@ class Cron
{
public static function execute()
{
$basepath = DI::apphelper()->getBasePath();
$basepath = DI::appHelper()->getBasePath();
$last = DI::keyValue()->get('last_cron');

View file

@ -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());
}
}
}

View file

@ -21,7 +21,7 @@ class Expire
{
public static function execute($param = '', $hook_function = '')
{
$appHelper = DI::apphelper();
$appHelper = DI::appHelper();
Hook::loadHooks();

View file

@ -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']);
}

View file

@ -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)) {

View file

@ -30,7 +30,7 @@ class ProfileUpdate {
return;
}
$appHelper = DI::apphelper();
$appHelper = DI::appHelper();
$inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid);

View file

@ -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;