]> git.mxchange.org Git - friendica.git/commitdiff
Remove get_app() in favor of DI::app()
authornupplaPhil <admin@philipp.info>
Sat, 4 Jan 2020 22:42:01 +0000 (23:42 +0100)
committernupplaPhil <admin@philipp.info>
Sat, 4 Jan 2020 22:42:01 +0000 (23:42 +0100)
26 files changed:
boot.php
include/api.php
include/enotify.php
mod/fbrowser.php
mod/item.php
mod/message.php
mod/settings.php
src/BaseModule.php
src/Console/DocBloxErrorChecker.php
src/Console/PhpToPo.php
src/Content/OEmbed.php
src/Content/Text/HTML.php
src/Content/Widget.php
src/Content/Widget/CalendarExport.php
src/Core/Worker.php
src/Model/Contact.php
src/Model/Mail.php
src/Model/Photo.php
src/Model/Profile.php
src/Protocol/DFRN.php
src/Render/FriendicaSmarty.php
src/Render/FriendicaSmartyEngine.php
src/Util/Network.php
tests/include/ApiTest.php
view/theme/frio/php/scheme.php
view/theme/vier/theme.php

index fa99a7bb3922a062fc0f7c6b834f83cdeba3be8e..d54ee72a3d83c42336dc5a745fe4c4e24cf1314a 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -234,20 +234,6 @@ if (!defined('CURLE_OPERATION_TIMEDOUT')) {
        define('CURLE_OPERATION_TIMEDOUT', CURLE_OPERATION_TIMEOUTED);
 }
 
-/**
- * @brief Retrieve the App structure
- *
- * Useful in functions which require it but don't get it passed to them
- *
- * @deprecated since version 2018.09
- * @see DI::app()
- * @return App
- */
-function get_app()
-{
-       return DI::app();
-}
-
 /**
  * @brief Used to end the current process, after saving session state.
  * @deprecated
@@ -325,7 +311,7 @@ function notice($s)
                return;
        }
 
-       $a = \get_app();
+       $a = DI::app();
        if (empty($_SESSION['sysmsg'])) {
                $_SESSION['sysmsg'] = [];
        }
@@ -343,7 +329,7 @@ function notice($s)
  */
 function info($s)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (local_user() && PConfig::get(local_user(), 'system', 'ignore_info')) {
                return;
@@ -406,7 +392,7 @@ function feed_birthday($uid, $tz)
  */
 function is_site_admin()
 {
-       $a = \get_app();
+       $a = DI::app();
 
        $admin_email = Config::get('config', 'admin_email');
 
index a6a6b505004dffc338262b5fe0b88d3671d5587c..ac0ba26c1202e1a12518ac91031b280171201427 100644 (file)
@@ -930,7 +930,7 @@ function api_format_data($root_element, $type, $data)
  */
 function api_account_verify_credentials($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -998,7 +998,7 @@ function requestdata($k)
  */
 function api_statuses_mediap($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                Logger::log('api_statuses_update: no user');
@@ -1052,7 +1052,7 @@ api_register_func('api/statuses/mediap', 'api_statuses_mediap', true, API_METHOD
  */
 function api_statuses_update($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                Logger::log('api_statuses_update: no user');
@@ -1202,7 +1202,7 @@ api_register_func('api/statuses/update_with_media', 'api_statuses_update', true,
  */
 function api_media_upload()
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                Logger::log('no user');
@@ -1257,7 +1257,7 @@ api_register_func('api/media/upload', 'api_media_upload', true, API_METHOD_POST)
  */
 function api_media_metadata_create($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                Logger::info('no user');
@@ -1404,7 +1404,7 @@ api_register_func('api/externalprofile/show', 'api_users_show');
  */
 function api_users_search($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        $userlist = [];
 
@@ -1466,7 +1466,7 @@ function api_users_lookup($type)
        if (!empty($_REQUEST['user_id'])) {
                foreach (explode(',', $_REQUEST['user_id']) as $id) {
                        if (!empty($id)) {
-                               $users[] = api_get_user(get_app(), $id);
+                               $users[] = api_get_user(DI::app(), $id);
                        }
                }
        }
@@ -1497,7 +1497,7 @@ api_register_func('api/users/lookup', 'api_users_lookup', true);
  */
 function api_search($type)
 {
-       $a = \get_app();
+       $a = DI::app();
        $user_info = api_get_user($a);
 
        if (api_user() === false || $user_info === false) {
@@ -1611,7 +1611,7 @@ api_register_func('api/search', 'api_search', true);
  */
 function api_statuses_home_timeline($type)
 {
-       $a = \get_app();
+       $a = DI::app();
        $user_info = api_get_user($a);
 
        if (api_user() === false || $user_info === false) {
@@ -1704,7 +1704,7 @@ api_register_func('api/statuses/friends_timeline', 'api_statuses_home_timeline',
  */
 function api_statuses_public_timeline($type)
 {
-       $a = \get_app();
+       $a = DI::app();
        $user_info = api_get_user($a);
 
        if (api_user() === false || $user_info === false) {
@@ -1789,7 +1789,7 @@ api_register_func('api/statuses/public_timeline', 'api_statuses_public_timeline'
  */
 function api_statuses_networkpublic_timeline($type)
 {
-       $a = \get_app();
+       $a = DI::app();
        $user_info = api_get_user($a);
 
        if (api_user() === false || $user_info === false) {
@@ -1850,7 +1850,7 @@ api_register_func('api/statuses/networkpublic_timeline', 'api_statuses_networkpu
  */
 function api_statuses_show($type)
 {
-       $a = \get_app();
+       $a = DI::app();
        $user_info = api_get_user($a);
 
        if (api_user() === false || $user_info === false) {
@@ -1929,7 +1929,7 @@ api_register_func('api/statuses/show', 'api_statuses_show', true);
  */
 function api_conversation_show($type)
 {
-       $a = \get_app();
+       $a = DI::app();
        $user_info = api_get_user($a);
 
        if (api_user() === false || $user_info === false) {
@@ -2011,7 +2011,7 @@ function api_statuses_repeat($type)
 {
        global $called_api;
 
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -2088,7 +2088,7 @@ api_register_func('api/statuses/retweet', 'api_statuses_repeat', true, API_METHO
  */
 function api_statuses_destroy($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -2135,7 +2135,7 @@ api_register_func('api/statuses/destroy', 'api_statuses_destroy', true, API_METH
  */
 function api_statuses_mentions($type)
 {
-       $a = \get_app();
+       $a = DI::app();
        $user_info = api_get_user($a);
 
        if (api_user() === false || $user_info === false) {
@@ -2204,7 +2204,7 @@ api_register_func('api/statuses/replies', 'api_statuses_mentions', true);
  */
 function api_statuses_user_timeline($type)
 {
-       $a = \get_app();
+       $a = DI::app();
        $user_info = api_get_user($a);
 
        if (api_user() === false || $user_info === false) {
@@ -2288,7 +2288,7 @@ api_register_func('api/statuses/user_timeline', 'api_statuses_user_timeline', tr
  */
 function api_favorites_create_destroy($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -2371,7 +2371,7 @@ function api_favorites($type)
 {
        global $called_api;
 
-       $a = \get_app();
+       $a = DI::app();
        $user_info = api_get_user($a);
 
        if (api_user() === false || $user_info === false) {
@@ -2836,7 +2836,7 @@ function api_contactlink_to_array($txt)
  */
 function api_format_items_activities($item, $type = "json")
 {
-       $a = \get_app();
+       $a = DI::app();
 
        $activities = [
                'like' => [],
@@ -3257,7 +3257,7 @@ api_register_func('api/lists/subscriptions', 'api_lists_list', true);
  */
 function api_lists_ownerships($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -3306,7 +3306,7 @@ api_register_func('api/lists/ownerships', 'api_lists_ownerships', true);
  */
 function api_lists_statuses($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        $user_info = api_get_user($a);
        if (api_user() === false || $user_info === false) {
@@ -3384,7 +3384,7 @@ api_register_func('api/lists/statuses', 'api_lists_statuses', true);
  */
 function api_statuses_f($qtype)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -3636,7 +3636,7 @@ function api_ff_ids($type, int $rel)
                throw new ForbiddenException();
        }
 
-       $a = \get_app();
+       $a = DI::app();
 
        api_get_user($a);
 
@@ -3723,7 +3723,7 @@ api_register_func('api/followers/ids', 'api_followers_ids', true);
  */
 function api_direct_messages_new($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -3815,7 +3815,7 @@ api_register_func('api/direct_messages/new', 'api_direct_messages_new', true, AP
  */
 function api_direct_messages_destroy($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -3983,7 +3983,7 @@ api_register_func('api/friendships/destroy', 'api_friendships_destroy', true, AP
  */
 function api_direct_messages_box($type, $box, $verbose)
 {
-       $a = \get_app();
+       $a = DI::app();
        if (api_user() === false) {
                throw new ForbiddenException();
        }
@@ -4627,7 +4627,7 @@ function api_account_update_profile_image($type)
        Contact::updateSelfFromUserID(api_user(), true);
 
        // Update global directory in background
-       $url = DI::baseUrl() . '/profile/' . \get_app()->user['nickname'];
+       $url = DI::baseUrl() . '/profile/' . DI::app()->user['nickname'];
        if ($url && strlen(Config::get('system', 'directory'))) {
                Worker::add(PRIORITY_LOW, "Directory", $url);
        }
@@ -4668,7 +4668,7 @@ api_register_func('api/account/update_profile_image', 'api_account_update_profil
 function api_account_update_profile($type)
 {
        $local_user = api_user();
-       $api_user = api_get_user(get_app());
+       $api_user = api_get_user(DI::app());
 
        if (!empty($_POST['name'])) {
                DBA::update('profile', ['name' => $_POST['name']], ['uid' => $local_user]);
@@ -4963,7 +4963,7 @@ function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $f
  */
 function prepare_photo_data($type, $scale, $photo_id)
 {
-       $a = \get_app();
+       $a = DI::app();
        $user_info = api_get_user($a);
 
        if ($user_info === false) {
@@ -5391,7 +5391,7 @@ function api_best_nickname(&$contacts)
  */
 function api_friendica_group_show($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -5461,7 +5461,7 @@ api_register_func('api/friendica/group_show', 'api_friendica_group_show', true);
  */
 function api_friendica_group_delete($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -5528,7 +5528,7 @@ api_register_func('api/friendica/group_delete', 'api_friendica_group_delete', tr
  */
 function api_lists_destroy($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -5650,7 +5650,7 @@ function group_create($name, $uid, $users = [])
  */
 function api_friendica_group_create($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -5684,7 +5684,7 @@ api_register_func('api/friendica/group_create', 'api_friendica_group_create', tr
  */
 function api_lists_create($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -5723,7 +5723,7 @@ api_register_func('api/lists/create', 'api_lists_create', true, API_METHOD_POST)
  */
 function api_friendica_group_update($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -5802,7 +5802,7 @@ api_register_func('api/friendica/group_update', 'api_friendica_group_update', tr
  */
 function api_lists_update($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -5852,7 +5852,7 @@ api_register_func('api/lists/update', 'api_lists_update', true, API_METHOD_POST)
  */
 function api_friendica_activity($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -5899,7 +5899,7 @@ api_register_func('api/friendica/activity/unattendmaybe', 'api_friendica_activit
  */
 function api_friendica_notification($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -5937,7 +5937,7 @@ function api_friendica_notification($type)
  */
 function api_friendica_notification_seen($type)
 {
-       $a = \get_app();
+       $a = DI::app();
        $user_info = api_get_user($a);
 
        if (api_user() === false || $user_info === false) {
@@ -5987,7 +5987,7 @@ api_register_func('api/friendica/notification', 'api_friendica_notification', tr
  */
 function api_friendica_direct_messages_setseen($type)
 {
-       $a = \get_app();
+       $a = DI::app();
        if (api_user() === false) {
                throw new ForbiddenException();
        }
@@ -6041,7 +6041,7 @@ api_register_func('api/friendica/direct_messages_setseen', 'api_friendica_direct
  */
 function api_friendica_direct_messages_search($type, $box = "")
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
@@ -6109,7 +6109,7 @@ api_register_func('api/friendica/direct_messages_search', 'api_friendica_direct_
  */
 function api_friendica_profile_show($type)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        if (api_user() === false) {
                throw new ForbiddenException();
index 1ddc9372ab39a349f610ae647cc7c2af70ddf0b5..0c78e569b97b552c1676b8db02aa204f6292e29a 100644 (file)
@@ -33,7 +33,7 @@ use Friendica\Util\Strings;
  */
 function notification($params)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        // Temporary logging for finding the origin
        if (!isset($params['uid'])) {
index 94d575c46fff64442ed351248be1a070cced6202..2b293a716d89355bef08cdd3db209933888bd6c2 100644 (file)
@@ -78,7 +78,7 @@ function fbrowser_content(App $a)
 
                        function _map_files1($rr)
                        {
-                               $a = \get_app();
+                               $a = DI::app();
                                $types = Images::supportedTypes();
                                $ext = $types[$rr['type']];
                                $filename_e = $rr['filename'];
index d6ce4a094436aabac6e1cc2904ee677c353777b2..90d8f3eadac3d0880d046897fb61dd05880b666e 100644 (file)
@@ -848,7 +848,7 @@ function item_post(App $a) {
 function item_post_return($baseurl, $api_source, $return_path)
 {
        // figure out how to return, depending on from whence we came
-    $a = \get_app();
+    $a = DI::app();
 
        if ($api_source) {
                return;
index 019ee61c9dbc53fd3367913b1032ec80094dd729..3d378f5158c3dde10ed88d48fc270ac9701fa42c 100644 (file)
@@ -499,7 +499,7 @@ function get_messages($uid, $start, $limit)
 
 function render_messages(array $msg, $t)
 {
-       $a = \get_app();
+       $a = DI::app();
 
        $tpl = Renderer::getMarkupTemplate($t);
        $rslt = '';
index 4f13fc72fc9e420b893187610a8a59b7aa00017c..4f44e9a00ed58530ad2dbac54bfbbe2ed2ae5e1e 100644 (file)
@@ -33,7 +33,7 @@ function get_theme_config_file($theme)
 {
        $theme = Strings::sanitizeFilePathItem($theme);
 
-       $a = \get_app();
+       $a = DI::app();
        $base_theme = $a->theme_info['extends'] ?? '';
 
        if (file_exists("view/theme/$theme/config.php")) {
index dcacce78bbd5623fcc82156939cddff575e907d8..61bfe8e8d3d7fbcaf802f39e640f7d59d16b6782 100644 (file)
@@ -88,7 +88,7 @@ abstract class BaseModule
         */
        public static function getFormSecurityToken($typename = '')
        {
-               $a = \get_app();
+               $a = DI::app();
 
                $timestamp = time();
                $sec_hash = hash('whirlpool', $a->user['guid'] . $a->user['prvkey'] . session_id() . $timestamp . $typename);
@@ -116,7 +116,7 @@ abstract class BaseModule
 
                $max_livetime = 10800; // 3 hours
 
-               $a = \get_app();
+               $a = DI::app();
 
                $x = explode('.', $hash);
                if (time() > (intval($x[0]) + $max_livetime)) {
@@ -136,7 +136,7 @@ abstract class BaseModule
        public static function checkFormSecurityTokenRedirectOnError($err_redirect, $typename = '', $formname = 'form_security_token')
        {
                if (!self::checkFormSecurityToken($typename, $formname)) {
-                       $a = \get_app();
+                       $a = DI::app();
                        Logger::log('checkFormSecurityToken failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
                        Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
                        notice(self::getFormSecurityStandardErrorMessage());
@@ -147,7 +147,7 @@ abstract class BaseModule
        public static function checkFormSecurityTokenForbiddenOnError($typename = '', $formname = 'form_security_token')
        {
                if (!self::checkFormSecurityToken($typename, $formname)) {
-                       $a = \get_app();
+                       $a = DI::app();
                        Logger::log('checkFormSecurityToken failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
                        Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
 
index 4393e99b18c43e65552492a3ab0a6821f5fc58ba..88c08666cac9d2ed91094dbae8421f80cfabe8ca 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Friendica\Console;
 
+use Friendica\App;
+
 /**
  * When I installed docblox, I had the experience that it does not generate any output at all.
  * This script may be used to find that kind of problems with the documentation build process.
@@ -29,6 +31,16 @@ class DocBloxErrorChecker extends \Asika\SimpleConsole\Console
 
        protected $helpOptions = ['h', 'help', '?'];
 
+       /** @var App */
+       private $app;
+
+       public function __construct(App $app, array $argv = null)
+       {
+               parent::__construct($argv);
+
+               $this->app = $app;
+       }
+
        protected function getHelp()
        {
                $help = <<<HELP
@@ -59,7 +71,7 @@ HELP;
                        throw new \RuntimeException('DocBlox isn\'t available.');
                }
 
-               $dir = \get_app()->getBasePath();
+               $dir = $this->app->getBasePath();
 
                //stack for dirs to search
                $dirstack = [];
index d73c7f4ab6b79d90f03a63a7f76556479f54a05d..b88ef023eab600739fe1f9abe0a255a879193711 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Friendica\Console;
 
+use Friendica\App;
+
 /**
  * Read a strings.php file and create messages.po in the same directory
  *
@@ -15,6 +17,16 @@ class PhpToPo extends \Asika\SimpleConsole\Console
        private $normBaseMsgIds = [];
        const NORM_REGEXP = "|[\\\]|";
 
+       /** @var App */
+       private $app;
+
+       public function __construct(App $app, array $argv = null)
+       {
+               parent::__construct($argv);
+
+               $this->app = $app;
+       }
+
        protected function getHelp()
        {
                $help = <<<HELP
@@ -51,7 +63,7 @@ HELP;
                        throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
                }
 
-               $a = \get_app();
+               $a = $this->app;
 
                $phpfile = realpath($this->getArgument(0));
 
index 42748d69ba6dc1af2cf73a7377295368da59dbc6..95fd6530b68e9a34b981d25daf6556c3e0f610ff 100644 (file)
@@ -57,7 +57,7 @@ class OEmbed
        {
                $embedurl = trim($embedurl, '\'"');
 
-               $a = \get_app();
+               $a = DI::app();
 
                $cache_key = 'oembed:' . $a->videowidth . ':' . $embedurl;
 
index 8a54c26a7ca8433a15abb958a015cb33f716eb68..a25883eb162d10be4a7da539bcff0981834ba222 100644 (file)
@@ -12,6 +12,7 @@ use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Config;
 use Friendica\Core\Renderer;
+use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Util\Network;
 use Friendica\Util\Proxy as ProxyUtils;
@@ -815,7 +816,7 @@ class HTML
         */
        public static function contactBlock()
        {
-               $a = \get_app();
+               $a = DI::app();
 
                return ContactBlock::getHTML($a->profile);
        }
index f1f8f25fa34921d018123fb88e05861a2ad60226..8f88a0d836f30fac17812fbca7e58d38493c8de4 100644 (file)
@@ -302,7 +302,7 @@ class Widget
         */
        public static function categories($baseurl, $selected = '')
        {
-               $a = \get_app();
+               $a = DI::app();
 
                $uid = intval($a->profile['profile_uid']);
 
@@ -420,7 +420,7 @@ class Widget
         */
        public static function tagCloud($limit = 50)
        {
-               $a = \get_app();
+               $a = DI::app();
 
                $uid = intval($a->profile['profile_uid']);
 
index c78ca21ebe6f4ad286c999c2b493186d0c4026cf..a6fea1e8a18f10eecfe6dec11c9cf1511763a313 100644 (file)
@@ -9,6 +9,7 @@ namespace Friendica\Content\Widget;
 use Friendica\Content\Feature;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
+use Friendica\DI;
 
 /**
  * TagCloud widget
@@ -24,7 +25,7 @@ class CalendarExport
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
        public static function getHTML() {
-               $a = \get_app();
+               $a = DI::app();
 
                if (empty($a->data['user'])) {
                        return;
index 02c8f65cbb6760ca384f25eb276761f7a53f8e39..1eea922396a717bd8938bef911e474e1ef9f7711 100644 (file)
@@ -48,8 +48,6 @@ class Worker
         */
        public static function processQueue($run_cron = true)
        {
-               $a = \get_app();
-
                // Ensure that all "strtotime" operations do run timezone independent
                date_default_timezone_set('UTC');
 
@@ -372,7 +370,7 @@ class Worker
         */
        private static function execFunction($queue, $funcname, $argv, $method_call)
        {
-               $a = \get_app();
+               $a = DI::app();
 
                $argc = count($argv);
 
@@ -1083,7 +1081,7 @@ class Worker
 
                $args = ['no_cron' => !$do_cron];
 
-               $a = get_app();
+               $a = DI::app();
                $process = new Core\Process(DI::logger(), DI::mode(), DI::config(), $a->getBasePath());
                $process->run($command, $args);
 
index 6cda8e404f8c15cb964fb26932a293aba55be1df..10cf4bf34169846991e31b85bb8a7c50947e327a 100644 (file)
@@ -2220,7 +2220,7 @@ class Contact
        {
                $result = ['cid' => -1, 'success' => false, 'message' => ''];
 
-               $a = \get_app();
+               $a = DI::app();
 
                // remove ajax junk, e.g. Twitter
                $url = str_replace('/#!/', '/', $url);
index ec333ed4364a892b3bc736d4a8c3fae14053e91f..eeea130a60b8ca16e2c0c36fcf3694d6eb5d102c 100644 (file)
@@ -105,7 +105,7 @@ class Mail
         */
        public static function send($recipient = 0, $body = '', $subject = '', $replyto = '')
        {
-               $a = \get_app();
+               $a = DI::app();
 
                if (!$recipient) {
                        return -1;
index eee8fbc5f7ae5bce434dbd3be1e56423c5fc242a..c4dbf2b30a1f53eda14d089cf2e8eb6da2babfad 100644 (file)
@@ -461,7 +461,7 @@ class Photo
                        $micro = DI::baseUrl() . "/photo/" . $resource_id . "-6." . $Image->getExt() . $suffix;
 
                        // Remove the cached photo
-                       $a = \get_app();
+                       $a = DI::app();
                        $basepath = $a->getBasePath();
 
                        if (is_dir($basepath . "/photo")) {
index 4bb886814dce2e331ac18a8fe9bd284d6241d9db..d7cc906fdbc5a5b49b5707e5a6642df00b4cf4f0 100644 (file)
@@ -568,7 +568,7 @@ class Profile
 
        public static function getBirthdays()
        {
-               $a = \get_app();
+               $a = DI::app();
                $o = '';
 
                if (!local_user() || DI::mode()->isMobile() || DI::mode()->isMobile()) {
@@ -665,7 +665,7 @@ class Profile
 
        public static function getEventsReminderHTML()
        {
-               $a = \get_app();
+               $a = DI::app();
                $o = '';
 
                if (!local_user() || DI::mode()->isMobile() || DI::mode()->isMobile()) {
@@ -1106,7 +1106,7 @@ class Profile
         */
        public static function addVisitorCookieForHandle($handle)
        {
-               $a = \get_app();
+               $a = DI::app();
 
                // Try to find the public contact entry of the visitor.
                $cid = Contact::getIdForURL($handle);
@@ -1144,7 +1144,7 @@ class Profile
         */
        public static function openWebAuthInit($token)
        {
-               $a = \get_app();
+               $a = DI::app();
 
                // Clean old OpenWebAuthToken entries.
                OpenWebAuthToken::purge('owt', '3 MINUTE');
index 354653c9b9898ea30b28acd269cbdc4939f96e83..798f607927d47fcb020d2c2267305f8768c8f0d7 100644 (file)
@@ -146,7 +146,7 @@ class DFRN
         */
        public static function feed($dfrn_id, $owner_nick, $last_update, $direction = 0, $onlyheader = false)
        {
-               $a = \get_app();
+               $a = DI::app();
 
                $sitefeed    = ((strlen($owner_nick)) ? false : true); // not yet implemented, need to rewrite huge chunks of following logic
                $public_feed = (($dfrn_id) ? false : true);
index deabd3baf2c0e0a8c6f5bba0dcfe0b66f0364887..83b6322df2425e1a96a882467121163279e37539 100644 (file)
@@ -4,6 +4,7 @@
  */
 namespace Friendica\Render;
 
+use Friendica\DI;
 use Smarty;
 use Friendica\Core\Renderer;
 
@@ -22,7 +23,7 @@ class FriendicaSmarty extends Smarty
        {
                parent::__construct();
 
-               $a = \get_app();
+               $a = DI::app();
                $theme = $a->getCurrentTheme();
 
                // setTemplateDir can be set to an array, which Smarty will parse in order.
index 36e46435fe675124c7279b3f3a03e636c325ae4a..d36b8f19589a46d43addb9403bd65b332a27c973 100644 (file)
@@ -5,6 +5,7 @@
 namespace Friendica\Render;
 
 use Friendica\Core\Hook;
+use Friendica\DI;
 
 /**
  * Smarty implementation of the Friendica template engine interface
@@ -32,7 +33,7 @@ class FriendicaSmartyEngine implements ITemplateEngine
                        $s = new FriendicaSmarty();
                }
 
-               $r['$APP'] = \get_app();
+               $r['$APP'] = DI::app();
 
                // "middleware": inject variables into templates
                $arr = [
@@ -54,7 +55,7 @@ class FriendicaSmartyEngine implements ITemplateEngine
 
        public function getTemplateFile($file, $root = '')
        {
-               $a = \get_app();
+               $a = DI::app();
                $template = new FriendicaSmarty();
 
                // Make sure $root ends with a slash /
index 1f16d9a724a16c1c3fce8cd52c08734930ec37bb..0f6389ce870363d5438ad857a366e41215d63f38 100644 (file)
@@ -96,7 +96,7 @@ class Network
        {
                $stamp1 = microtime(true);
 
-               $a = \get_app();
+               $a = DI::app();
 
                if (strlen($url) > 1000) {
                        Logger::log('URL is longer than 1000 characters. Callstack: ' . System::callstack(20), Logger::DEBUG);
@@ -260,7 +260,7 @@ class Network
                        return CurlResult::createErrorCurl($url);
                }
 
-               $a = \get_app();
+               $a = DI::app();
                $ch = curl_init($url);
 
                if (($redirects > 8) || (!$ch)) {
@@ -630,7 +630,7 @@ class Network
         */
        public static function finalUrl(string $url, int $depth = 1, bool $fetchbody = false)
        {
-               $a = \get_app();
+               $a = DI::app();
 
                $url = self::stripTrackingQueryParams($url);
 
index 6a5dde0c6586d4d01d4f5138482ad836fac1be0a..58e0adb99aea3f8e133188e590c6495d981b8ebe 100644 (file)
@@ -1383,7 +1383,7 @@ class ApiTest extends DatabaseTest
                                'type'     => 'image/png'
                        ]
                ];
-               $app       = \get_app();
+               $app       = DI::app();
                $app->argc = 2;
 
                $result = api_media_upload();
index fa933bd9411a1b28b8df9b57a6d259cfd2d42b2b..b2b346cccb777a0d006b4e92a4e49f1bb1476499 100644 (file)
  */
 
 use Friendica\Core\PConfig;
+use Friendica\DI;
 use Friendica\Util\Strings;
 
 function get_scheme_info($scheme)
 {
-       $theme = \get_app()->getCurrentTheme();
+       $theme = DI::app()->getCurrentTheme();
        $themepath = 'view/theme/' . $theme . '/';
        if (empty($scheme)) {
                $scheme = PConfig::get(local_user(), 'frio', 'scheme', PConfig::get(local_user(), 'frio', 'schema'));
index 98e8b680789f0102fc92014bbd87d6871ed742db..2a4abdfbeac0650e67c600729a1854ce11d992c0 100644 (file)
@@ -106,7 +106,7 @@ function get_vier_config($key, $default = false, $admin = false)
 
 function vier_community_info()
 {
-       $a = \get_app();
+       $a = DI::app();
 
        $show_pages      = get_vier_config("show_pages", 1);
        $show_profiles   = get_vier_config("show_profiles", 1);