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']);
$this->l10n = $l10n;
$this->args = $args;
$this->session = $session;
- $this->appHelper = DI::apphelper();
+ $this->appHelper = DI::appHelper();
$this->load($dbaDefinition, $viewDefinition);
}
$this->appMode = $appMode;
$this->keyValue = $keyValue;
$this->l10n = $l10n;
- $this->basePath = DI::apphelper()->getBasePath();
+ $this->basePath = DI::appHelper()->getBasePath();
}
protected function doExecute(): int
{
$embedurl = trim($embedurl, '\'"');
- $appHelper = DI::apphelper();
+ $appHelper = DI::appHelper();
$cache_key = 'oembed:' . $appHelper->getThemeInfoValue('videowidth') . ':' . $embedurl;
private static function convertVideoPlatformsToHtml(string $text, bool $try_oembed): string
{
- $appHelper = DI::apphelper();
+ $appHelper = DI::appHelper();
$text = self::normalizeVideoLinks($text);
*/
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)) {
*/
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];
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;
}
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;
*/
public static function getPathForFile(string $file): string
{
- $appHelper = DI::apphelper();
+ $appHelper = DI::appHelper();
$theme = $appHelper->getCurrentTheme();
return 'view/theme/' . $theme . '/style.css';
}
- $appHelper = DI::apphelper();
+ $appHelper = DI::appHelper();
$query_params = [];
{
$theme = Strings::sanitizeFilePathItem($theme);
- $appHelper = DI::apphelper();
+ $appHelper = DI::appHelper();
$base_theme = $appHelper->getThemeInfoValue('extends') ?? '';
if (file_exists("view/theme/$theme/config.php")) {
*/
private static function execFunction(array $queue, string $funcname, array $argv, bool $method_call)
{
- $appHelper = DI::apphelper();
+ $appHelper = DI::appHelper();
self::coolDown();
*/
public static function getRetrial(): int
{
- $queue = DI::apphelper()->getQueue();
+ $queue = DI::appHelper()->getQueue();
return $queue['retrial'] ?? 0;
}
*/
public static function defer(int $worker_defer_limit = 0): bool
{
- $queue = DI::apphelper()->getQueue();
+ $queue = DI::appHelper()->getQueue();
if (empty($queue)) {
return false;
//
/**
- * @deprecated 2024.12 use DI::apphelper() instead
+ * @deprecated 2024.12 use DI::appHelper() instead
*
* @return App
*/
return self::$dice->create(App::class);
}
- public static function apphelper(): AppHelper
+ public static function appHelper(): AppHelper
{
return self::$dice->create(AppHelper::class);
}
*/
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);
{
parent::content();
- $basePath = DI::apphelper()->getBasePath();
+ $basePath = DI::appHelper()->getBasePath();
// are there MyISAM tables in the DB? If so, trigger a warning message
$warningtext = [];
$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 = [];
protected function content(array $request = []): string
{
- $basePath = DI::apphelper()->getBasePath();
+ $basePath = DI::appHelper()->getBasePath();
$config = DI::config();
// currently no returned data is used
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
$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');
}
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'];
{
protected function content(array $request = []): string
{
- $appHelper = DI::apphelper();
+ $appHelper = DI::appHelper();
$contact = Contact::getRandomContact();
}
if (strlen($timezone) && $timezone != $user['timezone']) {
- DI::apphelper()->setTimeZone($timezone);
+ DI::appHelper()->setTimeZone($timezone);
}
$fields = [
$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
{
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));
return;
}
- $appHelper = DI::apphelper();
+ $appHelper = DI::appHelper();
switch ($mode) {
case Conversation::MODE_NETWORK:
}
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]);
// 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;
*/
public static function init(string $token)
{
- $appHelper = DI::apphelper();
+ $appHelper = DI::appHelper();
// Clean old OpenWebAuthToken entries.
OpenWebAuthToken::purge('owt', '3 MINUTE');
*/
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);
$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 ? '*' : '',
{
public static function execute()
{
- $basepath = DI::apphelper()->getBasePath();
+ $basepath = DI::appHelper()->getBasePath();
$last = DI::keyValue()->get('last_cron');
{
// 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());
}
}
}
{
public static function execute($param = '', $hook_function = '')
{
- $appHelper = DI::apphelper();
+ $appHelper = DI::appHelper();
Hook::loadHooks();
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']);
}
{
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]);
*/
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)) {
return;
}
- $appHelper = DI::apphelper();
+ $appHelper = DI::appHelper();
$inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid);
function get_scheme_info($scheme)
{
- $theme = DI::apphelper()->getCurrentTheme();
+ $theme = DI::appHelper()->getCurrentTheme();
$themepath = 'view/theme/' . $theme . '/';
$scheme = Strings::sanitizeFilePathItem($scheme) ?: FRIO_DEFAULT_SCHEME;