]> git.mxchange.org Git - friendica-addons.git/commitdiff
Merge pull request #927 from nupplaphil/task/replace_getClass
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 30 Dec 2019 00:55:44 +0000 (19:55 -0500)
committerGitHub <noreply@github.com>
Mon, 30 Dec 2019 00:55:44 +0000 (19:55 -0500)
[various] CleanUp deprecated methods

33 files changed:
blockem/blockem.php
blogger/blogger.php
buffer/buffer.php
catavatar/catavatar.php
cookienotice/cookienotice.php
curweather/curweather.php
diaspora/diaspora.php
dwpost/dwpost.php
forumdirectory/forumdirectory.php
geonames/geonames.php
highlightjs/highlightjs.php
ifttt/ifttt.php
impressum/impressum.php
jappixmini/jappixmini.php
langfilter/langfilter.php
mailstream/mailstream.php
mathjax/mathjax.php
notifyall/notifyall.php
pageheader/pageheader.php
phpmailer/phpmailer.php
pumpio/pumpio.php
pumpio/pumpio_sync.php
remote_permissions/remote_permissions.php
rendertime/rendertime.php
securemail/securemail.php
smileybutton/smileybutton.php
statusnet/statusnet.php
tumblr/tumblr.php
twitter/twitter.php
twitter/twitter_sync.php
widgets/widgets.php
windowsphonepush/windowsphonepush.php
xmpp/xmpp.php

index e0c0a74a29894870218f17afc584c9f1c0e97373..6d93de1dc8f282c4bea758708732101b636c12dd 100644 (file)
@@ -11,6 +11,7 @@ use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
+use Friendica\DI;
 use Friendica\Util\Strings;
 
 function blockem_install()
@@ -43,7 +44,7 @@ function blockem_addon_settings (App $a, &$s)
        }
 
        /* Add our stylesheet to the page so we can make our settings look nice */
-       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->getBaseURL() . '/addon/blockem/blockem.css' . '" media="all" />' . "\r\n";
+       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/blockem/blockem.css' . '" media="all" />' . "\r\n";
 
        $words = PConfig::get(local_user(), 'blockem', 'words');
 
@@ -148,7 +149,7 @@ function blockem_prepare_body_content_filter(App $a, array &$hook_data)
 function blockem_display_item(App $a, array &$b = null)
 {
        if (!empty($b['output']['body']) && strstr($b['output']['body'], 'id="blockem-wrap-')) {
-               $b['output']['thumb'] = $a->getBaseURL() . "/images/person-80.jpg";
+               $b['output']['thumb'] = DI::baseUrl()->get() . "/images/person-80.jpg";
        }
 }
 
index 001224d23183df0f740b65fb3603a68ee661ee31..049ee0777558fdf767574a638a3873f4bcc673bc 100644 (file)
@@ -12,6 +12,7 @@ use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
+use Friendica\DI;
 use Friendica\Util\Network;
 use Friendica\Util\XML;
 
@@ -68,7 +69,7 @@ function blogger_settings(App $a, &$s)
 
        /* Add our stylesheet to the page so we can make our settings look nice */
 
-       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->getBaseURL() . '/addon/blogger/blogger.css' . '" media="all" />' . "\r\n";
+       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/blogger/blogger.css' . '" media="all" />' . "\r\n";
 
        /* Get the current state of our config variables */
 
index 13b5309d6475a7381e5e1b1b34d219b77395335b..24357634428e34e97dc48765de2c92e6b102c032 100644 (file)
@@ -17,6 +17,7 @@ use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\ItemContent;
 use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\Strings;
@@ -110,7 +111,7 @@ function buffer_connect(App $a)
        $client_secret = Config::get('buffer','client_secret');
 
        // The callback URL is the script that gets called after the user authenticates with buffer
-       $callback_url = $a->getBaseURL()."/buffer/connect";
+       $callback_url = DI::baseUrl()->get()."/buffer/connect";
 
        $buffer = new BufferApp($client_id, $client_secret, $callback_url);
 
@@ -119,7 +120,7 @@ function buffer_connect(App $a)
        } else {
                Logger::log("buffer_connect: authenticated");
                $o = L10n::t("You are now authenticated to buffer. ");
-               $o .= '<br /><a href="' . $a->getBaseURL() . '/settings/connectors">' . L10n::t("return to the connector page") . '</a>';
+               $o .= '<br /><a href="' . DI::baseUrl()->get() . '/settings/connectors">' . L10n::t("return to the connector page") . '</a>';
                PConfig::set(local_user(), 'buffer','access_token', $buffer->access_token);
        }
 
@@ -152,7 +153,7 @@ function buffer_settings(App $a, &$s)
 
        /* Add our stylesheet to the page so we can make our settings look nice */
 
-       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->getBaseURL() . '/addon/buffer/buffer.css' . '" media="all" />' . "\r\n";
+       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/buffer/buffer.css' . '" media="all" />' . "\r\n";
 
        /* Get the current state of our config variables */
 
@@ -181,7 +182,7 @@ function buffer_settings(App $a, &$s)
 
        if ($access_token == "") {
                $s .= '<div id="buffer-authenticate-wrapper">';
-               $s .= '<a href="'.$a->getBaseURL().'/buffer/connect">'.L10n::t("Authenticate your Buffer connection").'</a>';
+               $s .= '<a href="'.DI::baseUrl()->get().'/buffer/connect">'.L10n::t("Authenticate your Buffer connection").'</a>';
                $s .= '</div><div class="clear"></div>';
        } else {
                $s .= '<div id="buffer-enable-wrapper">';
@@ -200,7 +201,7 @@ function buffer_settings(App $a, &$s)
                $s .= '</div><div class="clear"></div>';
 
                // The callback URL is the script that gets called after the user authenticates with buffer
-               $callback_url = $a->getBaseURL() . '/buffer/connect';
+               $callback_url = DI::baseUrl()->get() . '/buffer/connect';
 
                $buffer = new BufferApp($client_id, $client_secret, $callback_url, $access_token);
 
index e70449af0aaf02c0387a2470400e1e099af35fc0..b345ea4f26ae5f15f88a616efc963486b5aac5eb 100644 (file)
@@ -15,6 +15,7 @@ use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Photo;
 use Friendica\Network\HTTPException\NotFoundException;
@@ -84,7 +85,7 @@ function catavatar_addon_settings_post(App $a, &$s)
        $seed = PConfig::get(local_user(), 'catavatar', 'seed', md5(trim(strtolower($user['email']))));
 
        if (!empty($_POST['catavatar-usecat'])) {
-               $url = $a->getBaseURL() . '/catavatar/' . local_user() . '?ts=' . time();
+               $url = DI::baseUrl()->get() . '/catavatar/' . local_user() . '?ts=' . time();
 
                $self = DBA::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
                if (!DBA::isResult($self)) {
@@ -111,7 +112,7 @@ function catavatar_addon_settings_post(App $a, &$s)
                Contact::updateSelfFromUserID(local_user(), true);
 
                // Update global directory in background
-               $url = $a->getBaseURL() . '/profile/' . $a->user['nickname'];
+               $url = DI::baseUrl()->get() . '/profile/' . $a->user['nickname'];
                if ($url && strlen(Config::get('system', 'directory'))) {
                        Worker::add(PRIORITY_LOW, 'Directory', $url);
                }
@@ -140,7 +141,7 @@ function catavatar_addon_settings_post(App $a, &$s)
 function catavatar_lookup(App $a, &$b)
 {
        $user = DBA::selectFirst('user', ['uid'], ['email' => $b['email']]);
-       $url = $a->getBaseURL() . '/catavatar/' . $user['uid'];
+       $url = DI::baseUrl()->get() . '/catavatar/' . $user['uid'];
 
        switch($b['size']) {
                case 300: $url .= "/4"; break;
index 097f3c25ce2b5a8424614b63d62dc0d988d7861b..bad867e790cd56ef8596d79fafc4685ae900c1b5 100644 (file)
@@ -12,6 +12,7 @@ use Friendica\Core\Config;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
+use Friendica\DI;
 
 /**
  * cookienotice_install
@@ -90,8 +91,8 @@ function cookienotice_page_content_top(App $a, &$b)
        $stylesheetPath = __DIR__ . '/cookienotice.css';
        $footerscriptPath = __DIR__ . '/cookienotice.js';
 
-       $a->registerStylesheet($stylesheetPath);
-       $a->registerFooterScript($footerscriptPath);
+       DI::page()->registerStylesheet($stylesheetPath);
+       DI::page()->registerFooterScript($footerscriptPath);
 }
 
 /**
index df7a701af8b3daf471134ca79d578d698dcf751b..533c83e0177fa29091cdf5d5b25bfe0bc77a277d 100644 (file)
@@ -17,6 +17,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
 use Friendica\Core\Session;
+use Friendica\DI;
 use Friendica\Util\Network;
 use Friendica\Util\Proxy as ProxyUtils;
 
@@ -103,7 +104,7 @@ function curweather_network_mod_init(App $a, &$b)
                return;
        }
 
-       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->getBaseURL() . '/addon/curweather/curweather.css' . '" media="all" />' . "\r\n";
+       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/curweather/curweather.css' . '" media="all" />' . "\r\n";
 
        // $rpt value is needed for location
        // $lang will be taken from the browser session to honour user settings
index 0d847b1447a6a53e3516d67ad191d1a297e515ba..06b5439952b34aedbc910261461bdaf26bfef3f3 100644 (file)
@@ -18,6 +18,7 @@ use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
 use Friendica\Database\DBA;
 use Friendica\Core\Worker;
+use Friendica\DI;
 
 function diaspora_install()
 {
@@ -65,7 +66,7 @@ function diaspora_settings(App $a, &$s)
 
        /* Add our stylesheet to the page so we can make our settings look nice */
 
-       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->getBaseURL() . '/addon/diaspora/diaspora.css' . '" media="all" />' . "\r\n";
+       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/diaspora/diaspora.css' . '" media="all" />' . "\r\n";
 
        /* Get the current state of our config variables */
 
@@ -231,7 +232,7 @@ function diaspora_post_local(App $a, array &$b)
 
 function diaspora_send(App $a, array &$b)
 {
-       $hostname = $a->getHostName();
+       $hostname = DI::baseUrl()->getHostname();
 
        Logger::log('diaspora_send: invoked');
 
index ebba023279e13b128afbc0a364fbd9d41f45cbbc..5c13734bbd1dc2a4d0b555485c1a2802a226103a 100644 (file)
@@ -15,6 +15,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
 use Friendica\Util\XML;
@@ -63,7 +64,7 @@ function dwpost_settings(App $a, &$s)
        }
 
        /* Add our stylesheet to the page so we can make our settings look nice */
-       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->getBaseURL() . '/addon/dwpost/dwpost.css' . '" media="all" />' . "\r\n";
+       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/dwpost/dwpost.css' . '" media="all" />' . "\r\n";
 
        /* Get the current state of our config variables */
        $enabled = PConfig::get(local_user(), 'dwpost', 'post');
index f7c8b2446e80bb152dd77a290136f077e3112789..16538d7919eeeb7198eeb238ea8a214f3e6fdca7 100644 (file)
@@ -15,6 +15,7 @@ use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\Profile;
 use Friendica\Util\Strings;
 
@@ -107,7 +108,7 @@ function forumdirectory_content(App $a)
                $total = $cnt['total'];
        }
 
-       $pager = new Pager($a->query_string, 60);
+       $pager = new Pager(DI::args()->getQueryString(), 60);
 
        $order = " ORDER BY `name` ASC ";
 
index c052cef6bea1187db9e080e19ee5601b976f8197..03a2e45be2c70c2a532fe317ad6d0ad1cf993e0e 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
+use Friendica\DI;
 use Friendica\Util\ConfigFileLoader;
 use Friendica\Util\Network;
 use Friendica\Util\XML;
@@ -136,7 +137,7 @@ function geonames_addon_settings(App $a, &$s)
 
        /* Add our stylesheet to the page so we can make our settings look nice */
        $stylesheetPath = __DIR__ . '/geonames.css';
-       $a->registerStylesheet($stylesheetPath);
+       DI::page()->registerStylesheet($stylesheetPath);
 
        /* Get the current state of our config variable */
        $enabled = intval(PConfig::get(local_user(), 'geonames', 'enable'));
index 258cb4ad156f0ca29cafcfc79db39b0c5514eb30..823541bb458aee6d3546f7f619168a607436ab0f 100644 (file)
@@ -8,6 +8,7 @@
 
 use Friendica\App;
 use Friendica\Core\Hook;
+use Friendica\DI;
 
 function highlightjs_install()
 {
@@ -29,11 +30,11 @@ function highlightjs_head(App $a, &$b)
                $style = 'default';
        }
 
-       $a->registerStylesheet(__DIR__ . '/asset/styles/' . $style . '.css');
+       DI::page()->registerStylesheet(__DIR__ . '/asset/styles/' . $style . '.css');
 }
 
 function highlightjs_footer(App $a, &$b)
 {
-       $a->registerFooterScript(__DIR__ . '/asset/highlight.pack.js');
-       $a->registerFooterScript(__DIR__ . '/highlightjs.js');
+       DI::page()->registerFooterScript(__DIR__ . '/asset/highlight.pack.js');
+       DI::page()->registerFooterScript(__DIR__ . '/highlightjs.js');
 }
index 3bb55f3568b99362a5585442e92da12f88ed4b71..c9e086968d575b0162d8e899fa59fe0fa394158f 100644 (file)
@@ -14,6 +14,7 @@ use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\Item;
 use Friendica\Util\Strings;
 
@@ -63,7 +64,7 @@ function ifttt_settings(App $a, &$s)
        $s .= '<div id="ifttt-configuration-wrapper">';
        $s .= '<p>' . L10n::t('Create an account at <a href="http://www.ifttt.com">IFTTT</a>. Create three Facebook recipes that are connected with <a href="https://ifttt.com/maker">Maker</a> (In the form "if Facebook then Maker") with the following parameters:') . '</p>';
        $s .= '<h4>URL</h4>';
-       $s .= '<p>' . $a->getBaseURL() . '/ifttt/' . $a->user['nickname'] . '</p>';
+       $s .= '<p>' . DI::baseUrl()->get() . '/ifttt/' . $a->user['nickname'] . '</p>';
        $s .= '<h4>Method</h4>';
        $s .= '<p>POST</p>';
        $s .= '<h4>Content Type</h4>';
index dc5d355282edc0412c9e01d5cce68b051e402d55..b943fd9fd302f1bac0269e3a4e5b2c30480db76e 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
+use Friendica\DI;
 use Friendica\Util\ConfigFileLoader;
 use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\Strings;
@@ -34,8 +35,7 @@ function impressum_uninstall() {
 function impressum_module() {
 }
 function impressum_content() {
-    $a = \get_app();
-    $a->internalRedirect('friendica/');
+    DI::baseUrl()->redirect('friendica/');
 }
 
 function obfuscate_email ($s) {
index 8f0a1f7162ac9b2ecc9944d6b47c4577e68ea9a8..1a768dea66f6a95871ec0e99308153b759c254be 100644 (file)
@@ -70,6 +70,7 @@ use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\User;
 use Friendica\Util\Network;
 
@@ -324,10 +325,10 @@ function jappixmini_settings(App $a, &$s)
 
        if (!$activate) {
                // load scripts if not yet activated so that password can be saved
-               $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->getBaseURL() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;g=mini.xml"></script>' . "\r\n";
-               $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->getBaseURL() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;f=presence.js~caps.js~name.js~roster.js"></script>' . "\r\n";
+               $a->page['htmlhead'] .= '<script type="text/javascript" src="' . DI::baseUrl()->get() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;g=mini.xml"></script>' . "\r\n";
+               $a->page['htmlhead'] .= '<script type="text/javascript" src="' . DI::baseUrl()->get() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;f=presence.js~caps.js~name.js~roster.js"></script>' . "\r\n";
 
-               $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->getBaseURL() . '/addon/jappixmini/lib.js"></script>' . "\r\n";
+               $a->page['htmlhead'] .= '<script type="text/javascript" src="' . DI::baseUrl()->get() . '/addon/jappixmini/lib.js"></script>' . "\r\n";
        }
 
        $s .= '<span id="settings_jappixmini_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_jappixmini_expanded\'); openClose(\'settings_jappixmini_inflated\');">';
@@ -490,10 +491,10 @@ function jappixmini_script(App $a)
                return;
        }
 
-       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->getBaseURL() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;g=mini.xml"></script>' . "\r\n";
-       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->getBaseURL() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;f=presence.js~caps.js~name.js~roster.js"></script>' . "\r\n";
+       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . DI::baseUrl()->get() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;g=mini.xml"></script>' . "\r\n";
+       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . DI::baseUrl()->get() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;f=presence.js~caps.js~name.js~roster.js"></script>' . "\r\n";
 
-       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->getBaseURL() . '/addon/jappixmini/lib.js"></script>' . "\r\n";
+       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . DI::baseUrl()->get() . '/addon/jappixmini/lib.js"></script>' . "\r\n";
 
        $username = PConfig::get(local_user(), 'jappixmini', 'username');
        $username = str_replace("'", "\\'", $username);
@@ -514,7 +515,7 @@ function jappixmini_script(App $a)
        // set proxy if necessary
        $use_proxy = Config::get('jappixmini', 'bosh_proxy');
        if ($use_proxy) {
-               $proxy = $a->getBaseURL() . '/addon/jappixmini/proxy.php';
+               $proxy = DI::baseUrl()->get() . '/addon/jappixmini/proxy.php';
        } else {
                $proxy = "";
        }
@@ -569,10 +570,10 @@ function jappixmini_login(App $a, &$o)
 {
        // create client secret on login to be able to encrypt jabber passwords
        // for setDB and str_sha1, needed by jappixmini_addon_set_client_secret
-       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->getBaseURL() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;f=datastore.js~jsjac.js"></script>' . "\r\n";
+       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . DI::baseUrl()->get() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;f=datastore.js~jsjac.js"></script>' . "\r\n";
 
        // for jappixmini_addon_set_client_secret
-       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->getBaseURL() . '/addon/jappixmini/lib.js"></script>' . "\r\n";
+       $a->page['htmlhead'] .= '<script type="text/javascript" src="' . DI::baseUrl()->get() . '/addon/jappixmini/lib.js"></script>' . "\r\n";
 
        // save hash of password
        $o = str_replace("<form ", "<form onsubmit=\"jappixmini_addon_set_client_secret(this.elements['id_password'].value);return true;\" ", $o);
@@ -700,6 +701,6 @@ function jappixmini_download_source(App $a, &$b)
 {
        // Jappix Mini source download link on About page
        $b .= '<h1>Jappix Mini</h1>';
-       $b .= '<p>This site uses the jappixmini addon, which includes Jappix Mini by the <a href="' . $a->getBaseURL() . '/addon/jappixmini/jappix/AUTHORS">Jappix authors</a> and is distributed under the terms of the <a href="' . $a->getBaseURL() . '/addon/jappixmini/jappix/COPYING">GNU Affero General Public License</a>.</p>';
-       $b .= '<p>You can download the <a href="' . $a->getBaseURL() . '/addon/jappixmini.tgz">source code of the addon</a>. The rest of Friendica is distributed under compatible licenses and can be retrieved from <a href="https://github.com/friendica/friendica">https://github.com/friendica/friendica</a> and <a href="https://github.com/friendica/friendica-addons">https://github.com/friendica/friendica-addons</a></p>';
+       $b .= '<p>This site uses the jappixmini addon, which includes Jappix Mini by the <a href="' . DI::baseUrl()->get() . '/addon/jappixmini/jappix/AUTHORS">Jappix authors</a> and is distributed under the terms of the <a href="' . DI::baseUrl()->get() . '/addon/jappixmini/jappix/COPYING">GNU Affero General Public License</a>.</p>';
+       $b .= '<p>You can download the <a href="' . DI::baseUrl()->get() . '/addon/jappixmini.tgz">source code of the addon</a>. The rest of Friendica is distributed under compatible licenses and can be retrieved from <a href="https://github.com/friendica/friendica">https://github.com/friendica/friendica</a> and <a href="https://github.com/friendica/friendica-addons">https://github.com/friendica/friendica-addons</a></p>';
 }
index 950219698a58a722706e33bc29e19b4f2f37d2a9..f4728c772c8bfe8d7b2913387f4426ffe0a57e14 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
+use Friendica\DI;
 
 /* Define the hooks we want to use
  * that is, we have settings, we need to save the settings and we want
@@ -122,7 +123,7 @@ function langfilter_prepare_body_content_filter(App $a, &$hook_data)
 
        // Never filter own messages
        // TODO: find a better way to extract this
-       $logged_user_profile = $a->getBaseURL() . '/profile/' . $a->user['nickname'];
+       $logged_user_profile = DI::baseUrl()->get() . '/profile/' . $a->user['nickname'];
        if ($logged_user_profile == $hook_data['item']['author-link']) {
                return;
        }
index d6d880f13edc4a8ed490dbd9e9a7d6bd4f1b2b70..02e6dcb6a2aee8cd6d8268ebda0198c5445a96e8 100644 (file)
@@ -14,6 +14,7 @@ use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Protocol\Activity;
 use Friendica\Util\Network;
 use Friendica\Model\Item;
@@ -306,7 +307,7 @@ function mailstream_send(\Friendica\App $a, $message_id, $item, $user) {
                $template = Renderer::getMarkupTemplate('mail.tpl', 'addon/mailstream/');
                $mail->AltBody = BBCode::toPlaintext($item['body']);
                $item['body'] = BBCode::convert($item['body']);
-               $item['url'] = $a->getBaseURL() . '/display/' . $item['guid'];
+               $item['url'] = DI::baseUrl()->get() . '/display/' . $item['guid'];
                $mail->Body = Renderer::replaceMacros($template, [
                                                 '$upstream' => L10n::t('Upstream'),
                                                 '$local' => L10n::t('Local'),
index 6e80d68f6f987984cd57e6f44b5f5950fb79cdb3..2974f762d5306971af0b5386ca6b1daf16cea8b1 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
+use Friendica\DI;
 
 function mathjax_install()
 {
@@ -64,7 +65,7 @@ function mathjax_footer(App $a, &$b)
        //  if the visitor of the page is not a local_user, use MathJax
        //  otherwise check the users settings.
        if (!local_user() || PConfig::get(local_user(), 'mathjax', 'use', false)) {
-               $a->registerFooterScript(__DIR__ . '/asset/MathJax.js?config=TeX-MML-AM_CHTML');
-               $a->registerFooterScript(__DIR__ . '/mathjax.js');
+               DI::page()->registerFooterScript(__DIR__ . '/asset/MathJax.js?config=TeX-MML-AM_CHTML');
+               DI::page()->registerFooterScript(__DIR__ . '/mathjax.js');
        }
 }
index af52e668ef135d2576b324139863a2fb0ed45c64..92a1a2e333ed77f4229a14f86388d0bcc64e952d 100644 (file)
@@ -15,6 +15,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
+use Friendica\DI;
 use Friendica\Util\Emailer;
 
 function notifyall_install()
@@ -31,7 +32,7 @@ function notifyall_module() {}
 
 function notifyall_addon_admin(App $a, &$o)
 {
-       $o = '<div></div>&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . $a->getBaseURL() . '/notifyall">' . L10n::t('Send email to all members') . '</a></br/>';
+       $o = '<div></div>&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . DI::baseUrl()->get() . '/notifyall">' . L10n::t('Send email to all members') . '</a></br/>';
 }
 
 
@@ -56,7 +57,7 @@ function notifyall_post(App $a)
        }
 
        if (!Config::get('config', 'sender_email')) {
-               $sender_email = 'noreply@' . $a->getHostName();
+               $sender_email = 'noreply@' . DI::baseUrl()->getHostname();
        } else {
                $sender_email = Config::get('config', 'sender_email');
        }
@@ -96,7 +97,7 @@ function notifyall_post(App $a)
        }
 
        notice(L10n::t('Emails sent'));
-       $a->internalRedirect('admin');
+       DI::baseUrl()->redirect('admin');
 }
 
 function notifyall_content(&$a)
index fd07fc1dec2392c73127b667e1f650d5338fff09..1a7fb4eb601b0bafba7ed786894ef912bece11e9 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\Config;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
+use Friendica\DI;
 
 function pageheader_install() {
     Hook::register('page_content_top', __FILE__, 'pageheader_fetch');
@@ -26,7 +27,7 @@ function pageheader_addon_admin(App &$a, &$s)
 
     /* Add our stylesheet to the page so we can make our settings look nice */
        $stylesheetPath = __DIR__ . '/pageheader.css';
-       $a->registerStylesheet($stylesheetPath);
+       DI::page()->registerStylesheet($stylesheetPath);
 
        $words = Config::get('pageheader','text');
        if(! $words)
@@ -65,7 +66,7 @@ function pageheader_fetch(App $a, &$b)
        }
 
        $stylesheetPath = __DIR__ .'/pageheader.css';
-       $a->registerStylesheet($stylesheetPath);
+       DI::page()->registerStylesheet($stylesheetPath);
     
     if ($s) {
         $b .= '<div class="pageheader">' . $s . '</div>';
index a5ab25583012426320ed104635834e7897bb7d9e..7f91c27750b8d8ab420677426a517e75958dd93e 100644 (file)
@@ -10,6 +10,7 @@
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\Hook;
+use Friendica\DI;
 use Friendica\Util\ConfigFileLoader;
 use PHPMailer\PHPMailer\PHPMailer;
 use PHPMailer\PHPMailer\Exception;
@@ -99,6 +100,6 @@ function phpmailer_emailer_send_prepare(App $a, array &$b)
 
                $b['sent'] = $mail->send();
        } catch (Exception $e) {
-               $a->getLogger()->error('PHPMailer error', ['ErrorInfo' => $mail->ErrorInfo, 'code' => $e->getCode(), 'message' => $e->getMessage()]);
+               DI::logger()->error('PHPMailer error', ['ErrorInfo' => $mail->ErrorInfo, 'code' => $e->getCode(), 'message' => $e->getMessage()]);
        }
 }
index e8b740c2b5b04f381eb3d5ce63ec9b156fd9ad8c..7c2149cfefae2600ae4bdfec3c1427db489680d6 100644 (file)
@@ -17,6 +17,7 @@ use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
 use Friendica\Model\Item;
@@ -105,7 +106,7 @@ function pumpio_registerclient(App $a, $host)
        $application_name  = Config::get('pumpio', 'application_name');
 
        if ($application_name == "") {
-               $application_name = $a->getHostName();
+               $application_name = DI::baseUrl()->getHostname();
        }
 
        $adminlist = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
@@ -114,8 +115,8 @@ function pumpio_registerclient(App $a, $host)
        $params["contacts"] = $adminlist[0];
        $params["application_type"] = "native";
        $params["application_name"] = $application_name;
-       $params["logo_url"] = $a->getBaseURL()."/images/friendica-256.png";
-       $params["redirect_uris"] = $a->getBaseURL()."/pumpio/connect";
+       $params["logo_url"] = DI::baseUrl()->get()."/images/friendica-256.png";
+       $params["redirect_uris"] = DI::baseUrl()->get()."/pumpio/connect";
 
        Logger::log("pumpio_registerclient: ".$url." parameters ".print_r($params, true), Logger::DEBUG);
 
@@ -166,7 +167,7 @@ function pumpio_connect(App $a)
        }
 
        // The callback URL is the script that gets called after the user authenticates with pumpio
-       $callback_url = $a->getBaseURL()."/pumpio/connect";
+       $callback_url = DI::baseUrl()->get()."/pumpio/connect";
 
        // Let's begin.  First we need a Request Token.  The request token is required to send the user
        // to pumpio's login page.
@@ -203,7 +204,7 @@ function pumpio_connect(App $a)
        if ($success) {
                Logger::log("pumpio_connect: authenticated");
                $o = L10n::t("You are now authenticated to pumpio.");
-               $o .= '<br /><a href="'.$a->getBaseURL().'/settings/connectors">'.L10n::t("return to the connector page").'</a>';
+               $o .= '<br /><a href="'.DI::baseUrl()->get().'/settings/connectors">'.L10n::t("return to the connector page").'</a>';
        } else {
                Logger::log("pumpio_connect: could not connect");
                $o = 'Could not connect to pumpio. Refresh the page or try again later.';
@@ -238,7 +239,7 @@ function pumpio_settings(App $a, &$s)
 
        /* Add our stylesheet to the page so we can make our settings look nice */
 
-       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->getBaseURL() . '/addon/pumpio/pumpio.css' . '" media="all" />' . "\r\n";
+       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/pumpio/pumpio.css' . '" media="all" />' . "\r\n";
 
        /* Get the current state of our config variables */
 
@@ -288,7 +289,7 @@ function pumpio_settings(App $a, &$s)
                $s .= '<div id="pumpio-password-wrapper">';
                if (($oauth_token == "") || ($oauth_token_secret == "")) {
                        $s .= '<div id="pumpio-authenticate-wrapper">';
-                       $s .= '<a href="'.$a->getBaseURL().'/pumpio/connect">'.L10n::t("Authenticate your pump.io connection").'</a>';
+                       $s .= '<a href="'.DI::baseUrl()->get().'/pumpio/connect">'.L10n::t("Authenticate your pump.io connection").'</a>';
                        $s .= '</div><div class="clear"></div>';
                } else {
                        $s .= '<div id="pumpio-import-wrapper">';
@@ -772,7 +773,7 @@ function pumpio_fetchtimeline(App $a, $uid)
                $application_name  = Config::get('pumpio', 'application_name');
        }
        if ($application_name == "") {
-               $application_name = $a->getHostName();
+               $application_name = DI::baseUrl()->getHostname();
        }
 
        $first_time = ($lastdate == "");
index de794ad6a97a89140fc059aa1afe498aacc46330..f59d621f45b84be1f2056cccb1c1b498061e61ac 100644 (file)
@@ -3,7 +3,7 @@ use Friendica\Core\Config;
 use Friendica\Core\Logger;
 
 function pumpio_sync_run(&$argv, &$argc) {
-       $a = Friendica\BaseObject::getApp();
+       $a = Friendica\DI::app();
 
        require_once("addon/pumpio/pumpio.php");
 
index ad6d7b251ee81173c01eb656c91f87bba28419c5..7d42c5606295c0078f81f3f3bc3fdda3a8134e0c 100644 (file)
@@ -7,14 +7,13 @@
  * Status: Unsupported
  */
 
-use Friendica\BaseObject;
 use Friendica\Core\Config;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
-use Friendica\Util\ACLFormatter;
+use Friendica\DI;
 use Friendica\Util\Strings;
 
 function remote_permissions_install() {
@@ -125,8 +124,7 @@ function remote_permissions_content($a, $item_copy) {
 
                        $item = $r[0];
 
-                       /** @var ACLFormatter $aclFormatter */
-                       $aclFormatter = BaseObject::getClass(ACLFormatter::class);
+                       $aclFormatter = DI::aclFormatter();
 
                        $allowed_users = $aclFormatter->expand($item['allow_cid']);
                        $allowed_groups = $aclFormatter->expand($item['allow_gid']);
index a54fc489d3442cad2d92c08537bd7953a759d51d..505bceca59d1afc7f431acd00579acd8eb5b10f3 100644 (file)
@@ -9,6 +9,7 @@
 
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
+use Friendica\DI;
 
 function rendertime_install() {
        Hook::register('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end');
@@ -30,14 +31,14 @@ function rendertime_init_1(&$a) {
 function rendertime_page_end(Friendica\App $a, &$o)
 {
 
-       $profiler = $a->getProfiler();
+       $profiler = DI::profiler();
 
        $duration = microtime(true) - $profiler->get('start');
 
        $ignored_modules = ["fbrowser"];
-       $ignored = in_array($a->module, $ignored_modules);
+       $ignored = in_array(DI::module()->getName(), $ignored_modules);
 
-       if (is_site_admin() && (($_GET['mode'] ?? '') != 'minimal') && !$a->is_mobile && !$a->is_tablet && !$ignored) {
+       if (is_site_admin() && (($_GET['mode'] ?? '') != 'minimal') && !DI::mode()->isMobile() && !DI::mode()->isMobile() && !$ignored) {
 
                $o = $o . '<div class="renderinfo">' . L10n::t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s",
                                round($profiler->get('database') - $profiler->get('database_write'), 3),
index 5662714bc2f98f0ef1cf25baf3c2930c75cda452..029e040ac76ccd2ac940fa931c1f83702ef362b1 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
+use Friendica\DI;
 use Friendica\Util\Emailer;
 
 require_once __DIR__ . '/vendor/autoload.php';
@@ -92,7 +93,7 @@ function securemail_settings_post(App &$a, array &$b)
                if ($_POST['securemail-submit'] == L10n::t('Save and send test')) {
                        $sitename = Config::get('config', 'sitename');
 
-                       $hostname = $a->getHostName();
+                       $hostname = DI::baseUrl()->getHostname();
                        if (strpos($hostname, ':')) {
                                $hostname = substr($hostname, 0, strpos($hostname, ':'));
                        }
index 593eed8b0912c6b6484379d53dbafc34feb43e99..9711ecf2e62bf6168bcc61929e98e78c1c9cc117 100644 (file)
@@ -7,6 +7,7 @@
  */
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
+use Friendica\DI;
 
 function smileybutton_install() {
        //Register hooks
@@ -32,7 +33,7 @@ function show_button(Friendica\App $a, &$b) {
                return;
 
        // Disable for mobile because most mobiles have a smiley key for ther own
-       if ($a->is_mobile || $a->is_tablet)
+       if (DI::mode()->isMobile() || DI::mode()->isMobile())
                return;
 
        /**
@@ -70,29 +71,29 @@ function show_button(Friendica\App $a, &$b) {
        ];
 
        $icons = [
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-heart.gif" alt="<3" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-brokenheart.gif" alt="</3" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-smile.gif" alt=":-)" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-wink.gif" alt=";-)" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-frown.gif" alt=":-(" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-tongue-out.gif" alt=":-P" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-kiss.gif" alt=":-X" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-laughing.gif" alt=":-D" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-surprised.gif" alt=":-O" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-thumbsup.gif" alt="\\o/" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-Oo.gif" alt="O_o" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-cry.gif" alt=":\'(" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-foot-in-mouth.gif" alt=":-!" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-undecided.gif" alt=":-/" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-embarassed.gif" alt=":-[" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-cool.gif" alt="8-)" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/beer_mug.gif" alt=":beer" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/coffee.gif" alt=":coffee" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-facepalm.gif" alt=":facepalm" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/like.gif" alt=":like" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/dislike.gif" alt=":dislike" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/friendica-16.png" alt="~friendica" />',
-               '<img class="smiley" src="' . $a->getBaseURL() . '/images/rhash-16.png" alt="red" />'
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-heart.gif" alt="<3" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-brokenheart.gif" alt="</3" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-smile.gif" alt=":-)" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-wink.gif" alt=";-)" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-frown.gif" alt=":-(" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-tongue-out.gif" alt=":-P" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-kiss.gif" alt=":-X" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-laughing.gif" alt=":-D" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-surprised.gif" alt=":-O" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-thumbsup.gif" alt="\\o/" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-Oo.gif" alt="O_o" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-cry.gif" alt=":\'(" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-foot-in-mouth.gif" alt=":-!" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-undecided.gif" alt=":-/" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-embarassed.gif" alt=":-[" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-cool.gif" alt="8-)" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/beer_mug.gif" alt=":beer" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/coffee.gif" alt=":coffee" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-facepalm.gif" alt=":facepalm" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/like.gif" alt=":like" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/dislike.gif" alt=":dislike" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/friendica-16.png" alt="~friendica" />',
+               '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/rhash-16.png" alt="red" />'
        ];
 
        // Call hooks to get aditional smileies from other addons
@@ -116,7 +117,7 @@ function show_button(Friendica\App $a, &$b) {
        $css_file = 'addon/smileybutton/view/' . $a->getCurrentTheme() . '.css';
        if (! file_exists($css_file))
                $css_file = 'addon/smileybutton/view/default.css';
-       $css_url = $a->getBaseURL().'/'.$css_file;
+       $css_url = DI::baseUrl()->get().'/'.$css_file;
 
        $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$css_url.'" media="all" />'."\r\n";
 
@@ -125,7 +126,7 @@ function show_button(Friendica\App $a, &$b) {
        $image = 'addon/smileybutton/view/' . $a->getCurrentTheme() . '.png';
        if (! file_exists($image))
                $image = 'addon/smileybutton/view/default.png';
-       $image_url = $a->getBaseURL().'/'.$image;
+       $image_url = DI::baseUrl()->get().'/'.$image;
 
        //Add the hmtl and script to the page
        $b = <<< EOT
index fee8fd8236aebe5f536f9f128e1856469d79b067..0f48b87fe6cd1224934162fda6435703d6d153f1 100644 (file)
@@ -50,6 +50,7 @@ use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
 use Friendica\Model\Item;
@@ -167,7 +168,7 @@ function statusnet_settings_post(App $a, $post)
                                        }
                                }
                        }
-                       $a->internalRedirect('settings/connectors');
+                       DI::baseUrl()->redirect('settings/connectors');
                } else {
                        if (isset($_POST['statusnet-consumersecret'])) {
                                //  check if we can reach the API of the GNU Social server
@@ -195,7 +196,7 @@ function statusnet_settings_post(App $a, $post)
                                                notice(L10n::t('We could not contact the GNU Social API with the Path you entered.') . EOL);
                                        }
                                }
-                               $a->internalRedirect('settings/connectors');
+                               DI::baseUrl()->redirect('settings/connectors');
                        } else {
                                if (isset($_POST['statusnet-pin'])) {
                                        //  if the user supplied us with a PIN from GNU Social, let the magic of OAuth happen
@@ -213,7 +214,7 @@ function statusnet_settings_post(App $a, $post)
                                        PConfig::set(local_user(), 'statusnet', 'post', 1);
                                        PConfig::set(local_user(), 'statusnet', 'post_taglinks', 1);
                                        //  reload the Addon Settings page, if we don't do it see Bug #42
-                                       $a->internalRedirect('settings/connectors');
+                                       DI::baseUrl()->redirect('settings/connectors');
                                } else {
                                        //  if no PIN is supplied in the POST variables, the user has changed the setting
                                        //  to post a dent for every new __public__ posting to the wall
@@ -238,7 +239,7 @@ function statusnet_settings(App $a, &$s)
        if (!local_user()) {
                return;
        }
-       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->getBaseURL() . '/addon/statusnet/statusnet.css' . '" media="all" />' . "\r\n";
+       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/statusnet/statusnet.css' . '" media="all" />' . "\r\n";
        /*       * *
         * 1) Check that we have a base api url and a consumer key & secret
         * 2) If no OAuthtoken & stuff is present, generate button to get some
@@ -735,7 +736,7 @@ function statusnet_prepare_body(App $a, &$b)
                }
 
                $item = $b["item"];
-               $item["plink"] = $a->getBaseURL() . "/display/" . $item["guid"];
+               $item["plink"] = DI::baseUrl()->get() . "/display/" . $item["guid"];
 
                $condition = ['uri' => $item["thr-parent"], 'uid' => local_user()];
                $orig_post = Item::selectFirst(['author-link', 'uri'], $condition);
@@ -837,7 +838,7 @@ function statusnet_fetchtimeline(App $a, $uid)
                $application_name = Config::get('statusnet', 'application_name');
        }
        if ($application_name == "") {
-               $application_name = $a->getHostName();
+               $application_name = DI::baseUrl()->getHostname();
        }
 
        $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
@@ -1528,7 +1529,7 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
                        if ($mtch[1] == "#") {
                                // Replacing the hash tags that are directed to the GNU Social server with internal links
                                $snhash = "#[url=" . $mtch[2] . "]" . $mtch[3] . "[/url]";
-                               $frdchash = '#[url=' . $a->getBaseURL() . '/search?tag=' . $mtch[3] . ']' . $mtch[3] . '[/url]';
+                               $frdchash = '#[url=' . DI::baseUrl()->get() . '/search?tag=' . $mtch[3] . ']' . $mtch[3] . '[/url]';
                                $body = str_replace($snhash, $frdchash, $body);
 
                                $str_tags .= $frdchash;
index c0e65c7ef9b4415bfbeec6bc16a75f1d73d0d976..ac9208ca9c1bcebc5d06a647bf71f34faa320c42 100644 (file)
@@ -18,6 +18,7 @@ use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Util\Strings;
 
 function tumblr_install()
@@ -109,7 +110,7 @@ function tumblr_connect(App $a)
 
        // The callback URL is the script that gets called after the user authenticates with tumblr
        // In this example, it would be the included callback.php
-       $callback_url = $a->getBaseURL()."/tumblr/callback";
+       $callback_url = DI::baseUrl()->get()."/tumblr/callback";
 
        // Let's begin.  First we need a Request Token.  The request token is required to send the user
        // to Tumblr's login page.
@@ -188,7 +189,7 @@ function tumblr_callback(App $a)
        PConfig::set(local_user(), "tumblr", "oauth_token_secret", $access_token['oauth_token_secret']);
 
        $o = L10n::t("You are now authenticated to tumblr.");
-       $o .= '<br /><a href="'.$a->getBaseURL().'/settings/connectors">'.L10n::t("return to the connector page").'</a>';
+       $o .= '<br /><a href="' . DI::baseUrl()->get() . '/settings/connectors">' . L10n::t("return to the connector page") . '</a>';
 
        return $o;
 }
@@ -219,7 +220,7 @@ function tumblr_settings(App $a, &$s)
 
        /* Add our stylesheet to the page so we can make our settings look nice */
 
-       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->getBaseURL() . '/addon/tumblr/tumblr.css' . '" media="all" />' . "\r\n";
+       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/tumblr/tumblr.css' . '" media="all" />' . "\r\n";
 
        /* Get the current state of our config variables */
 
@@ -242,7 +243,7 @@ function tumblr_settings(App $a, &$s)
        $s .= '</span>';
 
        $s .= '<div id="tumblr-username-wrapper">';
-       $s .= '<a href="'.$a->getBaseURL().'/tumblr/connect">'.L10n::t("(Re-)Authenticate your tumblr page").'</a>';
+       $s .= '<a href="'.DI::baseUrl()->get().'/tumblr/connect">'.L10n::t("(Re-)Authenticate your tumblr page").'</a>';
        $s .= '</div><div class="clear"></div>';
 
        $s .= '<div id="tumblr-enable-wrapper">';
index 6cc11f9b1aa8cf69e86d6e5660862f9df0ed4ab2..52a5948090cf9d938872623ec3098379ec3cc109 100644 (file)
@@ -78,6 +78,7 @@ use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Conversation;
 use Friendica\Model\Group;
@@ -263,7 +264,7 @@ function twitter_settings_post(App $a)
                                info($e->getMessage());
                        }
                        //  reload the Addon Settings page, if we don't do it see Bug #42
-                       $a->internalRedirect('settings/connectors');
+                       DI::baseUrl()->redirect('settings/connectors');
                } else {
                        //  if no PIN is supplied in the POST variables, the user has changed the setting
                        //  to post a tweet for every new __public__ posting to the wall
@@ -287,7 +288,7 @@ function twitter_settings(App $a, &$s)
        if (!local_user()) {
                return;
        }
-       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->getBaseURL() . '/addon/twitter/twitter.css' . '" media="all" />' . "\r\n";
+       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/twitter/twitter.css' . '" media="all" />' . "\r\n";
        /*       * *
         * 1) Check that we have global consumer key & secret
         * 2) If no OAuthtoken & stuff is present, generate button to get some
@@ -838,7 +839,7 @@ function twitter_prepare_body(App $a, array &$b)
        if ($b["preview"]) {
                $max_char = 280;
                $item = $b["item"];
-               $item["plink"] = $a->getBaseURL() . "/display/" . $item["guid"];
+               $item["plink"] = DI::baseUrl()->get() . "/display/" . $item["guid"];
 
                $condition = ['uri' => $item["thr-parent"], 'uid' => local_user()];
                $orig_post = Item::selectFirst(['author-link'], $condition);
@@ -939,7 +940,7 @@ function twitter_fetchtimeline(App $a, $uid)
        $application_name = Config::get('twitter', 'application_name');
 
        if ($application_name == "") {
-               $application_name = $a->getHostName();
+               $application_name = DI::baseUrl()->getHostname();
        }
 
        $has_picture = false;
@@ -1145,7 +1146,7 @@ function twitter_expand_entities(App $a, $body, $item, $picture)
        $tags_arr = [];
 
        foreach ($item->entities->hashtags AS $hashtag) {
-               $url = '#[url=' . $a->getBaseURL() . '/search?tag=' . $hashtag->text . ']' . $hashtag->text . '[/url]';
+               $url = '#[url=' . DI::baseUrl()->get() . '/search?tag=' . $hashtag->text . ']' . $hashtag->text . '[/url]';
                $tags_arr['#' . $hashtag->text] = $url;
                $body = str_replace('#' . $hashtag->text, $url, $body);
        }
@@ -1278,7 +1279,7 @@ function twitter_expand_entities(App $a, $body, $item, $picture)
                                }
 
                                $basetag = str_replace('_', ' ', substr($tag, 1));
-                               $url = '#[url=' . $a->getBaseURL() . '/search?tag=' . $basetag . ']' . $basetag . '[/url]';
+                               $url = '#[url=' . DI::baseUrl()->get() . '/search?tag=' . $basetag . ']' . $basetag . '[/url]';
                                $body = str_replace($tag, $url, $body);
                                $tags_arr['#' . $basetag] = $url;
                        } elseif (strpos($tag, '@') === 0) {
@@ -1632,7 +1633,7 @@ function twitter_fetchhometimeline(App $a, $uid)
        $application_name = Config::get('twitter', 'application_name');
 
        if ($application_name == "") {
-               $application_name = $a->getHostName();
+               $application_name = DI::baseUrl()->getHostname();
        }
 
        $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
index b2c655e7c809b0fb6e00cdfad159d9d6b77745cb..d320763bafa4d871ed493911cc9088f406f0bb65 100644 (file)
@@ -5,7 +5,7 @@ use Friendica\Core\Logger;
 
 function twitter_sync_run($argv, $argc)
 {
-       $a = Friendica\BaseObject::getApp();
+       $a = Friendica\DI::app();
 
        require_once 'addon/twitter/twitter.php';
 
index 5c075964837bd943efbebfd38b2a34fc982dccbc..c22c3f68cab903c20af87182e8e957205e470a8c 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
+use Friendica\DI;
 
 function widgets_install() {
        Hook::register('addon_settings', 'addon/widgets/widgets.php', 'widgets_settings');
@@ -76,8 +77,7 @@ function widgets_module() {
 }
 
 function _abs_url($s){
-       $a = \get_app();
-       return preg_replace("|href=(['\"])([^h][^t][^t][^p])|", "href=\$1".$a->getBaseURL()."/\$2", $s);
+       return preg_replace("|href=(['\"])([^h][^t][^t][^p])|", "href=\$1" . DI::baseUrl()->get() . "/\$2", $s);
 }
 
 function _randomAlphaNum($length){
index 242fe96db217cd7a563924d328269b1ff7174330..8d35e787cc86da6b5a60e78da84ca50f217ba975 100644 (file)
  */
 
 use Friendica\App;
-use Friendica\BaseObject;
 use Friendica\Content\Text\BBCode;
 use Friendica\Content\Text\HTML;
-use Friendica\App\Authentication;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
-use Friendica\Core\Session;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\Item;
 use Friendica\Model\User;
 
@@ -475,9 +473,7 @@ function windowsphonepush_login(App $a)
                die('This api requires login');
        }
 
-       /** @var Authentication $authentication */
-       $authentication = BaseObject::getClass(Authentication::class);
-       $authentication->setForUser($a, $record);
-       $_SESSION["allow_api"] = true;
+       DI::auth()->setForUser($a, $record);
+       DI::session()->set('allow_api', true);
        Hook::callAll('logged_in', $a->user);
 }
index f596a6791154272bed040a7ea48a786ccc6882ee..dbcaf67d204af1bc0e5c2bd4318bd9590e9a40dc 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
+use Friendica\DI;
 use Friendica\Util\Strings;
 
 function xmpp_install()
@@ -52,7 +53,7 @@ function xmpp_addon_settings(App $a, &$s)
 
        /* Add our stylesheet to the xmpp so we can make our settings look nice */
 
-       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->getBaseURL() . '/addon/xmpp/xmpp.css' . '" media="all" />' . "\r\n";
+       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/xmpp/xmpp.css' . '" media="all" />' . "\r\n";
 
        /* Get the current state of our config variable */
 
@@ -142,7 +143,7 @@ function xmpp_converse(App $a)
                return;
        }
 
-       if ($a->is_mobile || $a->is_tablet) {
+       if (DI::mode()->isMobile() || DI::mode()->isMobile()) {
                return;
        }
 
@@ -150,7 +151,7 @@ function xmpp_converse(App $a)
                return;
        }
 
-       if (in_array($a->query_string, ["admin/federation/"])) {
+       if (in_array(DI::args()->getQueryString(), ["admin/federation/"])) {
                return;
        }
 
@@ -167,7 +168,7 @@ function xmpp_converse(App $a)
                        PConfig::set(local_user(), "xmpp", "password", $password);
                }
 
-               $jid = $a->user["nickname"] . "@" . $a->getHostName() . "/converse-" . Strings::getRandomHex(5);
+               $jid = $a->user["nickname"] . "@" . DI::baseUrl()->getHostname() . "/converse-" . Strings::getRandomHex(5);
 
                $auto_login = "auto_login: true,
                        authentication: 'login',