Remove deprecated App::getBaseURL() - process methods to DI::baseUrl()->get()

This commit is contained in:
nupplaPhil 2019-12-16 01:05:14 +01:00
parent 0775c28854
commit 335fcf670f
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
19 changed files with 86 additions and 74 deletions

View file

@ -11,6 +11,7 @@ use Friendica\App;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\DI;
use Friendica\Util\Strings; use Friendica\Util\Strings;
function blockem_install() 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 */ /* 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'); $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) function blockem_display_item(App $a, array &$b = null)
{ {
if (!empty($b['output']['body']) && strstr($b['output']['body'], 'id="blockem-wrap-')) { 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";
} }
} }

View file

@ -12,6 +12,7 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\DI;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\XML; 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 */ /* 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 */ /* Get the current state of our config variables */

View file

@ -17,6 +17,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\ItemContent; use Friendica\Model\ItemContent;
use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -110,7 +111,7 @@ function buffer_connect(App $a)
$client_secret = Config::get('buffer','client_secret'); $client_secret = Config::get('buffer','client_secret');
// The callback URL is the script that gets called after the user authenticates with buffer // 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); $buffer = new BufferApp($client_id, $client_secret, $callback_url);
@ -119,7 +120,7 @@ function buffer_connect(App $a)
} else { } else {
Logger::log("buffer_connect: authenticated"); Logger::log("buffer_connect: authenticated");
$o = L10n::t("You are now authenticated to buffer. "); $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); 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 */ /* 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 */ /* Get the current state of our config variables */
@ -181,7 +182,7 @@ function buffer_settings(App $a, &$s)
if ($access_token == "") { if ($access_token == "") {
$s .= '<div id="buffer-authenticate-wrapper">'; $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>'; $s .= '</div><div class="clear"></div>';
} else { } else {
$s .= '<div id="buffer-enable-wrapper">'; $s .= '<div id="buffer-enable-wrapper">';
@ -200,7 +201,7 @@ function buffer_settings(App $a, &$s)
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
// The callback URL is the script that gets called after the user authenticates with buffer // 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); $buffer = new BufferApp($client_id, $client_secret, $callback_url, $access_token);

View file

@ -15,6 +15,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Photo; use Friendica\Model\Photo;
use Friendica\Network\HTTPException\NotFoundException; 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'])))); $seed = PConfig::get(local_user(), 'catavatar', 'seed', md5(trim(strtolower($user['email']))));
if (!empty($_POST['catavatar-usecat'])) { 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]); $self = DBA::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
if (!DBA::isResult($self)) { if (!DBA::isResult($self)) {
@ -111,7 +112,7 @@ function catavatar_addon_settings_post(App $a, &$s)
Contact::updateSelfFromUserID(local_user(), true); Contact::updateSelfFromUserID(local_user(), true);
// Update global directory in background // 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'))) { if ($url && strlen(Config::get('system', 'directory'))) {
Worker::add(PRIORITY_LOW, 'Directory', $url); Worker::add(PRIORITY_LOW, 'Directory', $url);
} }
@ -140,7 +141,7 @@ function catavatar_addon_settings_post(App $a, &$s)
function catavatar_lookup(App $a, &$b) function catavatar_lookup(App $a, &$b)
{ {
$user = DBA::selectFirst('user', ['uid'], ['email' => $b['email']]); $user = DBA::selectFirst('user', ['uid'], ['email' => $b['email']]);
$url = $a->getBaseURL() . '/catavatar/' . $user['uid']; $url = DI::baseUrl()->get() . '/catavatar/' . $user['uid'];
switch($b['size']) { switch($b['size']) {
case 300: $url .= "/4"; break; case 300: $url .= "/4"; break;

View file

@ -17,6 +17,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\DI;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Proxy as ProxyUtils;
@ -103,7 +104,7 @@ function curweather_network_mod_init(App $a, &$b)
return; 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 // $rpt value is needed for location
// $lang will be taken from the browser session to honour user settings // $lang will be taken from the browser session to honour user settings

View file

@ -66,7 +66,7 @@ function diaspora_settings(App $a, &$s)
/* Add our stylesheet to the page so we can make our settings look nice */ /* 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 */ /* Get the current state of our config variables */

View file

@ -15,6 +15,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\XML; 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 */ /* 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 */ /* Get the current state of our config variables */
$enabled = PConfig::get(local_user(), 'dwpost', 'post'); $enabled = PConfig::get(local_user(), 'dwpost', 'post');

View file

@ -14,6 +14,7 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -63,7 +64,7 @@ function ifttt_settings(App $a, &$s)
$s .= '<div id="ifttt-configuration-wrapper">'; $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 .= '<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 .= '<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 .= '<h4>Method</h4>';
$s .= '<p>POST</p>'; $s .= '<p>POST</p>';
$s .= '<h4>Content Type</h4>'; $s .= '<h4>Content Type</h4>';

View file

@ -70,6 +70,7 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Util\Network; use Friendica\Util\Network;
@ -324,10 +325,10 @@ function jappixmini_settings(App $a, &$s)
if (!$activate) { if (!$activate) {
// load scripts if not yet activated so that password can be saved // 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="' . 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="' . $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;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\');">'; $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; 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="' . 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="' . $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;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 = PConfig::get(local_user(), 'jappixmini', 'username');
$username = str_replace("'", "\\'", $username); $username = str_replace("'", "\\'", $username);
@ -514,7 +515,7 @@ function jappixmini_script(App $a)
// set proxy if necessary // set proxy if necessary
$use_proxy = Config::get('jappixmini', 'bosh_proxy'); $use_proxy = Config::get('jappixmini', 'bosh_proxy');
if ($use_proxy) { if ($use_proxy) {
$proxy = $a->getBaseURL() . '/addon/jappixmini/proxy.php'; $proxy = DI::baseUrl()->get() . '/addon/jappixmini/proxy.php';
} else { } else {
$proxy = ""; $proxy = "";
} }
@ -569,10 +570,10 @@ function jappixmini_login(App $a, &$o)
{ {
// create client secret on login to be able to encrypt jabber passwords // create client secret on login to be able to encrypt jabber passwords
// for setDB and str_sha1, needed by jappixmini_addon_set_client_secret // 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 // 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 // save hash of password
$o = str_replace("<form ", "<form onsubmit=\"jappixmini_addon_set_client_secret(this.elements['id_password'].value);return true;\" ", $o); $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 // Jappix Mini source download link on About page
$b .= '<h1>Jappix Mini</h1>'; $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>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="' . $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>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>';
} }

View file

@ -13,6 +13,7 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI;
/* Define the hooks we want to use /* Define the hooks we want to use
* that is, we have settings, we need to save the settings and we want * 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 // Never filter own messages
// TODO: find a better way to extract this // 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']) { if ($logged_user_profile == $hook_data['item']['author-link']) {
return; return;
} }

View file

@ -14,6 +14,7 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Model\Item; 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/'); $template = Renderer::getMarkupTemplate('mail.tpl', 'addon/mailstream/');
$mail->AltBody = BBCode::toPlaintext($item['body']); $mail->AltBody = BBCode::toPlaintext($item['body']);
$item['body'] = BBCode::convert($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, [ $mail->Body = Renderer::replaceMacros($template, [
'$upstream' => L10n::t('Upstream'), '$upstream' => L10n::t('Upstream'),
'$local' => L10n::t('Local'), '$local' => L10n::t('Local'),

View file

@ -32,7 +32,7 @@ function notifyall_module() {}
function notifyall_addon_admin(App $a, &$o) 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/>';
} }

View file

@ -115,8 +115,8 @@ function pumpio_registerclient(App $a, $host)
$params["contacts"] = $adminlist[0]; $params["contacts"] = $adminlist[0];
$params["application_type"] = "native"; $params["application_type"] = "native";
$params["application_name"] = $application_name; $params["application_name"] = $application_name;
$params["logo_url"] = $a->getBaseURL()."/images/friendica-256.png"; $params["logo_url"] = DI::baseUrl()->get()."/images/friendica-256.png";
$params["redirect_uris"] = $a->getBaseURL()."/pumpio/connect"; $params["redirect_uris"] = DI::baseUrl()->get()."/pumpio/connect";
Logger::log("pumpio_registerclient: ".$url." parameters ".print_r($params, true), Logger::DEBUG); Logger::log("pumpio_registerclient: ".$url." parameters ".print_r($params, true), Logger::DEBUG);
@ -167,7 +167,7 @@ function pumpio_connect(App $a)
} }
// The callback URL is the script that gets called after the user authenticates with pumpio // 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 // Let's begin. First we need a Request Token. The request token is required to send the user
// to pumpio's login page. // to pumpio's login page.
@ -204,7 +204,7 @@ function pumpio_connect(App $a)
if ($success) { if ($success) {
Logger::log("pumpio_connect: authenticated"); Logger::log("pumpio_connect: authenticated");
$o = L10n::t("You are now authenticated to pumpio."); $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 { } else {
Logger::log("pumpio_connect: could not connect"); Logger::log("pumpio_connect: could not connect");
$o = 'Could not connect to pumpio. Refresh the page or try again later.'; $o = 'Could not connect to pumpio. Refresh the page or try again later.';
@ -239,7 +239,7 @@ function pumpio_settings(App $a, &$s)
/* Add our stylesheet to the page so we can make our settings look nice */ /* 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 */ /* Get the current state of our config variables */
@ -289,7 +289,7 @@ function pumpio_settings(App $a, &$s)
$s .= '<div id="pumpio-password-wrapper">'; $s .= '<div id="pumpio-password-wrapper">';
if (($oauth_token == "") || ($oauth_token_secret == "")) { if (($oauth_token == "") || ($oauth_token_secret == "")) {
$s .= '<div id="pumpio-authenticate-wrapper">'; $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>'; $s .= '</div><div class="clear"></div>';
} else { } else {
$s .= '<div id="pumpio-import-wrapper">'; $s .= '<div id="pumpio-import-wrapper">';

View file

@ -7,6 +7,7 @@
*/ */
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\DI;
function smileybutton_install() { function smileybutton_install() {
//Register hooks //Register hooks
@ -70,29 +71,29 @@ function show_button(Friendica\App $a, &$b) {
]; ];
$icons = [ $icons = [
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-heart.gif" alt="<3" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-heart.gif" alt="<3" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-brokenheart.gif" alt="</3" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-brokenheart.gif" alt="</3" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-smile.gif" alt=":-)" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-smile.gif" alt=":-)" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-wink.gif" alt=";-)" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-wink.gif" alt=";-)" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-frown.gif" alt=":-(" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-frown.gif" alt=":-(" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-tongue-out.gif" alt=":-P" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-tongue-out.gif" alt=":-P" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-kiss.gif" alt=":-X" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-kiss.gif" alt=":-X" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-laughing.gif" alt=":-D" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-laughing.gif" alt=":-D" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-surprised.gif" alt=":-O" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-surprised.gif" alt=":-O" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-thumbsup.gif" alt="\\o/" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-thumbsup.gif" alt="\\o/" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-Oo.gif" alt="O_o" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-Oo.gif" alt="O_o" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-cry.gif" alt=":\'(" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-cry.gif" alt=":\'(" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-foot-in-mouth.gif" alt=":-!" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-foot-in-mouth.gif" alt=":-!" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-undecided.gif" alt=":-/" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-undecided.gif" alt=":-/" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-embarassed.gif" alt=":-[" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-embarassed.gif" alt=":-[" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-cool.gif" alt="8-)" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-cool.gif" alt="8-)" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/beer_mug.gif" alt=":beer" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/beer_mug.gif" alt=":beer" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/coffee.gif" alt=":coffee" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/coffee.gif" alt=":coffee" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/smiley-facepalm.gif" alt=":facepalm" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/smiley-facepalm.gif" alt=":facepalm" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/like.gif" alt=":like" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/like.gif" alt=":like" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/dislike.gif" alt=":dislike" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/images/dislike.gif" alt=":dislike" />',
'<img class="smiley" src="' . $a->getBaseURL() . '/images/friendica-16.png" alt="~friendica" />', '<img class="smiley" src="' . DI::baseUrl()->get() . '/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/rhash-16.png" alt="red" />'
]; ];
// Call hooks to get aditional smileies from other addons // 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'; $css_file = 'addon/smileybutton/view/' . $a->getCurrentTheme() . '.css';
if (! file_exists($css_file)) if (! file_exists($css_file))
$css_file = 'addon/smileybutton/view/default.css'; $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"; $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'; $image = 'addon/smileybutton/view/' . $a->getCurrentTheme() . '.png';
if (! file_exists($image)) if (! file_exists($image))
$image = 'addon/smileybutton/view/default.png'; $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 //Add the hmtl and script to the page
$b = <<< EOT $b = <<< EOT

View file

@ -239,7 +239,7 @@ function statusnet_settings(App $a, &$s)
if (!local_user()) { if (!local_user()) {
return; 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 * 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 * 2) If no OAuthtoken & stuff is present, generate button to get some
@ -736,7 +736,7 @@ function statusnet_prepare_body(App $a, &$b)
} }
$item = $b["item"]; $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()]; $condition = ['uri' => $item["thr-parent"], 'uid' => local_user()];
$orig_post = Item::selectFirst(['author-link', 'uri'], $condition); $orig_post = Item::selectFirst(['author-link', 'uri'], $condition);
@ -1529,7 +1529,7 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
if ($mtch[1] == "#") { if ($mtch[1] == "#") {
// Replacing the hash tags that are directed to the GNU Social server with internal links // Replacing the hash tags that are directed to the GNU Social server with internal links
$snhash = "#[url=" . $mtch[2] . "]" . $mtch[3] . "[/url]"; $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); $body = str_replace($snhash, $frdchash, $body);
$str_tags .= $frdchash; $str_tags .= $frdchash;

View file

@ -18,6 +18,7 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Util\Strings; use Friendica\Util\Strings;
function tumblr_install() 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 // 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 // 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 // Let's begin. First we need a Request Token. The request token is required to send the user
// to Tumblr's login page. // 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']); PConfig::set(local_user(), "tumblr", "oauth_token_secret", $access_token['oauth_token_secret']);
$o = L10n::t("You are now authenticated to tumblr."); $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; 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 */ /* 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 */ /* Get the current state of our config variables */
@ -242,7 +243,7 @@ function tumblr_settings(App $a, &$s)
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="tumblr-username-wrapper">'; $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><div class="clear"></div>';
$s .= '<div id="tumblr-enable-wrapper">'; $s .= '<div id="tumblr-enable-wrapper">';

View file

@ -288,7 +288,7 @@ function twitter_settings(App $a, &$s)
if (!local_user()) { if (!local_user()) {
return; 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 * 1) Check that we have global consumer key & secret
* 2) If no OAuthtoken & stuff is present, generate button to get some * 2) If no OAuthtoken & stuff is present, generate button to get some
@ -839,7 +839,7 @@ function twitter_prepare_body(App $a, array &$b)
if ($b["preview"]) { if ($b["preview"]) {
$max_char = 280; $max_char = 280;
$item = $b["item"]; $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()]; $condition = ['uri' => $item["thr-parent"], 'uid' => local_user()];
$orig_post = Item::selectFirst(['author-link'], $condition); $orig_post = Item::selectFirst(['author-link'], $condition);
@ -1146,7 +1146,7 @@ function twitter_expand_entities(App $a, $body, $item, $picture)
$tags_arr = []; $tags_arr = [];
foreach ($item->entities->hashtags AS $hashtag) { 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; $tags_arr['#' . $hashtag->text] = $url;
$body = str_replace('#' . $hashtag->text, $url, $body); $body = str_replace('#' . $hashtag->text, $url, $body);
} }
@ -1279,7 +1279,7 @@ function twitter_expand_entities(App $a, $body, $item, $picture)
} }
$basetag = str_replace('_', ' ', substr($tag, 1)); $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); $body = str_replace($tag, $url, $body);
$tags_arr['#' . $basetag] = $url; $tags_arr['#' . $basetag] = $url;
} elseif (strpos($tag, '@') === 0) { } elseif (strpos($tag, '@') === 0) {

View file

@ -13,6 +13,7 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
function widgets_install() { function widgets_install() {
Hook::register('addon_settings', 'addon/widgets/widgets.php', 'widgets_settings'); Hook::register('addon_settings', 'addon/widgets/widgets.php', 'widgets_settings');
@ -76,8 +77,7 @@ function widgets_module() {
} }
function _abs_url($s){ function _abs_url($s){
$a = \get_app(); return preg_replace("|href=(['\"])([^h][^t][^t][^p])|", "href=\$1" . DI::baseUrl()->get() . "/\$2", $s);
return preg_replace("|href=(['\"])([^h][^t][^t][^p])|", "href=\$1".$a->getBaseURL()."/\$2", $s);
} }
function _randomAlphaNum($length){ function _randomAlphaNum($length){

View file

@ -53,7 +53,7 @@ function xmpp_addon_settings(App $a, &$s)
/* Add our stylesheet to the xmpp so we can make our settings look nice */ /* 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 */ /* Get the current state of our config variable */