Replace deprecated $a->page with DI::page()

This commit is contained in:
nupplaPhil 2019-12-30 20:02:08 +01:00
parent 07269ebb69
commit 2ca621a92a
No known key found for this signature in database
GPG Key ID: D8365C3D36B77D90
16 changed files with 33 additions and 31 deletions

View File

@ -44,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="' . DI::baseUrl()->get() . '/addon/blockem/blockem.css' . '" media="all" />' . "\r\n"; DI::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');
@ -165,7 +165,7 @@ function blockem_conversation_start(App $a, array &$b)
$a->data['blockem'] = explode(',', $words); $a->data['blockem'] = explode(',', $words);
} }
$a->page['htmlhead'] .= <<< EOT DI::page()['htmlhead'] .= <<< EOT
<script> <script>
function blockemBlock(author) { function blockemBlock(author) {

View File

@ -69,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="' . DI::baseUrl()->get() . '/addon/blogger/blogger.css' . '" media="all" />' . "\r\n"; DI::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

@ -153,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="' . DI::baseUrl()->get() . '/addon/buffer/buffer.css' . '" media="all" />' . "\r\n"; DI::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 */

View File

@ -104,7 +104,7 @@ function curweather_network_mod_init(App $a, &$b)
return; return;
} }
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/addon/curweather/curweather.css' . '" media="all" />' . "\r\n"; DI::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
@ -161,7 +161,7 @@ function curweather_network_mod_init(App $a, &$b)
]); ]);
} }
$a->page['aside'] = $curweather . $a->page['aside']; DI::page()['aside'] = $curweather . DI::page()['aside'];
} }
function curweather_addon_settings_post(App $a, $post) function curweather_addon_settings_post(App $a, $post)

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="' . DI::baseUrl()->get() . '/addon/diaspora/diaspora.css' . '" media="all" />' . "\r\n"; DI::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

@ -64,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="' . DI::baseUrl()->get() . '/addon/dwpost/dwpost.css' . '" media="all" />' . "\r\n"; DI::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

@ -42,7 +42,7 @@ function forumdirectory_app_menu(App $a, array &$b)
function forumdirectory_init(App $a) function forumdirectory_init(App $a)
{ {
if (local_user()) { if (local_user()) {
$a->page['aside'] .= Widget::findPeople(); DI::page()['aside'] .= Widget::findPeople();
} }
} }

View File

@ -325,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="' . DI::baseUrl()->get() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;g=mini.xml"></script>' . "\r\n"; DI::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"; DI::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="' . DI::baseUrl()->get() . '/addon/jappixmini/lib.js"></script>' . "\r\n"; DI::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\');">';
@ -387,7 +387,7 @@ function jappixmini_settings(App $a, &$s)
$s .= '</div>'; $s .= '</div>';
$a->page['htmlhead'] .= "<script type=\"text/javascript\"> DI::page()['htmlhead'] .= "<script type=\"text/javascript\">
function jappixmini_set_password() { function jappixmini_set_password() {
encrypt = document.getElementById('jappixmini-encrypt').checked; encrypt = document.getElementById('jappixmini-encrypt').checked;
password = document.getElementById('jappixmini-password'); password = document.getElementById('jappixmini-password');
@ -491,10 +491,10 @@ function jappixmini_script(App $a)
return; return;
} }
$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"; DI::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"; DI::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="' . DI::baseUrl()->get() . '/addon/jappixmini/lib.js"></script>' . "\r\n"; DI::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);
@ -557,7 +557,7 @@ function jappixmini_script(App $a)
} }
// add javascript to start Jappix Mini // add javascript to start Jappix Mini
$a->page['htmlhead'] .= "<script type=\"text/javascript\"> DI::page()['htmlhead'] .= "<script type=\"text/javascript\">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jappixmini_addon_start('$server', '$username', '$proxy', '$bosh', $encrypt, '$password', $nickname, $contacts_json, '$contacts_hash', $autoapprove, $autosubscribe, $groupchats); jappixmini_addon_start('$server', '$username', '$proxy', '$bosh', $encrypt, '$password', $nickname, $contacts_json, '$contacts_hash', $autoapprove, $autosubscribe, $groupchats);
}); });
@ -570,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="' . DI::baseUrl()->get() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;f=datastore.js~jsjac.js"></script>' . "\r\n"; DI::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="' . DI::baseUrl()->get() . '/addon/jappixmini/lib.js"></script>' . "\r\n"; DI::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);

View File

@ -13,6 +13,7 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI;
function js_upload_install() function js_upload_install()
{ {
@ -26,8 +27,8 @@ function js_upload_form(App $a, array &$b)
{ {
$b['default_upload'] = false; $b['default_upload'] = false;
$a->page->registerStylesheet('addon/js_upload/file-uploader/client/fileuploader.css'); DI::page()->registerStylesheet('addon/js_upload/file-uploader/client/fileuploader.css');
$a->page->registerFooterScript('addon/js_upload/file-uploader/client/fileuploader.js'); DI::page()->registerFooterScript('addon/js_upload/file-uploader/client/fileuploader.js');
$tpl = Renderer::getMarkupTemplate('js_upload.tpl', 'addon/js_upload'); $tpl = Renderer::getMarkupTemplate('js_upload.tpl', 'addon/js_upload');
$b['addon_text'] .= Renderer::replaceMacros($tpl, [ $b['addon_text'] .= Renderer::replaceMacros($tpl, [

View File

@ -15,6 +15,7 @@ use Friendica\Core\Cache;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\DI;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Proxy as ProxyUtils;
@ -40,7 +41,7 @@ function mastodoncustomemojis_uninstall()
function mastodoncustomemojis_css_hook(App $a) function mastodoncustomemojis_css_hook(App $a)
{ {
$a->page['htmlhead'] .= <<<HTML DI::page()['htmlhead'] .= <<<HTML
<!-- Style added by mastodoncustomemojis --> <!-- Style added by mastodoncustomemojis -->
<style type="text/css"> <style type="text/css">
.emoji.mastodon { .emoji.mastodon {

View File

@ -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="' . DI::baseUrl()->get() . '/addon/pumpio/pumpio.css' . '" media="all" />' . "\r\n"; DI::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 */

View File

@ -119,7 +119,7 @@ function show_button(Friendica\App $a, &$b) {
$css_file = 'addon/smileybutton/view/default.css'; $css_file = 'addon/smileybutton/view/default.css';
$css_url = DI::baseUrl()->get().'/'.$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"; DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$css_url.'" media="all" />'."\r\n";
//Get the correct image for the theme //Get the correct image for the theme

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="' . DI::baseUrl()->get() . '/addon/statusnet/statusnet.css' . '" media="all" />' . "\r\n"; DI::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

View File

@ -220,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="' . DI::baseUrl()->get() . '/addon/tumblr/tumblr.css' . '" media="all" />' . "\r\n"; DI::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 */

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="' . DI::baseUrl()->get() . '/addon/twitter/twitter.css' . '" media="all" />' . "\r\n"; DI::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

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="' . DI::baseUrl()->get() . '/addon/xmpp/xmpp.css' . '" media="all" />' . "\r\n"; DI::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 */
@ -155,8 +155,8 @@ function xmpp_converse(App $a)
return; return;
} }
$a->page['htmlhead'] .= '<link type="text/css" rel="stylesheet" media="screen" href="addon/xmpp/converse/css/converse.css" />' . "\n"; DI::page()['htmlhead'] .= '<link type="text/css" rel="stylesheet" media="screen" href="addon/xmpp/converse/css/converse.css" />' . "\n";
$a->page['htmlhead'] .= '<script src="addon/xmpp/converse/builds/converse.min.js"></script>' . "\n"; DI::page()['htmlhead'] .= '<script src="addon/xmpp/converse/builds/converse.min.js"></script>' . "\n";
if (Config::get("xmpp", "central_userbase") && !PConfig::get(local_user(), "xmpp", "individual")) { if (Config::get("xmpp", "central_userbase") && !PConfig::get(local_user(), "xmpp", "individual")) {
$bosh_proxy = Config::get("xmpp", "bosh_proxy"); $bosh_proxy = Config::get("xmpp", "bosh_proxy");
@ -216,7 +216,7 @@ function xmpp_converse(App $a)
xhr_user_search: false xhr_user_search: false
});\n"; });\n";
$a->page['htmlhead'] .= "<script> DI::page()['htmlhead'] .= "<script>
require(['converse'], function (converse) { require(['converse'], function (converse) {
$initialize $initialize
converse.listen.on('ready', function (event) { converse.listen.on('ready', function (event) {