From 4b6527e27335756b4c0f2509bd206fd023de39b7 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Mon, 16 Dec 2019 01:08:47 +0100 Subject: [PATCH] Remove deprecated App::registerStylesheet()/FooterScript() - replace with DI::page()->registerStylesheet()/FooterScript() --- cookienotice/cookienotice.php | 5 +++-- geonames/geonames.php | 3 ++- highlightjs/highlightjs.php | 7 ++++--- mathjax/mathjax.php | 5 +++-- pageheader/pageheader.php | 5 +++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/cookienotice/cookienotice.php b/cookienotice/cookienotice.php index 097f3c25..bad867e7 100644 --- a/cookienotice/cookienotice.php +++ b/cookienotice/cookienotice.php @@ -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); } /** diff --git a/geonames/geonames.php b/geonames/geonames.php index c052cef6..03a2e45b 100644 --- a/geonames/geonames.php +++ b/geonames/geonames.php @@ -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')); diff --git a/highlightjs/highlightjs.php b/highlightjs/highlightjs.php index 258cb4ad..823541bb 100644 --- a/highlightjs/highlightjs.php +++ b/highlightjs/highlightjs.php @@ -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'); } diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index 6e80d68f..2974f762 100644 --- a/mathjax/mathjax.php +++ b/mathjax/mathjax.php @@ -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'); } } diff --git a/pageheader/pageheader.php b/pageheader/pageheader.php index fd07fc1d..1a7fb4eb 100644 --- a/pageheader/pageheader.php +++ b/pageheader/pageheader.php @@ -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 .= '';