Remove deprecated App::registerStylesheet()/FooterScript() - replace with DI::page()->registerStylesheet()/FooterScript()

pull/927/head
nupplaPhil 2019-12-16 01:08:47 +01:00
parent 335fcf670f
commit 4b6527e273
No known key found for this signature in database
GPG Key ID: D8365C3D36B77D90
5 changed files with 15 additions and 10 deletions

View File

@ -12,6 +12,7 @@ use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI;
/** /**
* cookienotice_install * cookienotice_install
@ -90,8 +91,8 @@ function cookienotice_page_content_top(App $a, &$b)
$stylesheetPath = __DIR__ . '/cookienotice.css'; $stylesheetPath = __DIR__ . '/cookienotice.css';
$footerscriptPath = __DIR__ . '/cookienotice.js'; $footerscriptPath = __DIR__ . '/cookienotice.js';
$a->registerStylesheet($stylesheetPath); DI::page()->registerStylesheet($stylesheetPath);
$a->registerFooterScript($footerscriptPath); DI::page()->registerFooterScript($footerscriptPath);
} }
/** /**

View File

@ -13,6 +13,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Util\ConfigFileLoader; use Friendica\Util\ConfigFileLoader;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\XML; 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 */ /* Add our stylesheet to the page so we can make our settings look nice */
$stylesheetPath = __DIR__ . '/geonames.css'; $stylesheetPath = __DIR__ . '/geonames.css';
$a->registerStylesheet($stylesheetPath); DI::page()->registerStylesheet($stylesheetPath);
/* Get the current state of our config variable */ /* Get the current state of our config variable */
$enabled = intval(PConfig::get(local_user(), 'geonames', 'enable')); $enabled = intval(PConfig::get(local_user(), 'geonames', 'enable'));

View File

@ -8,6 +8,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\DI;
function highlightjs_install() function highlightjs_install()
{ {
@ -29,11 +30,11 @@ function highlightjs_head(App $a, &$b)
$style = 'default'; $style = 'default';
} }
$a->registerStylesheet(__DIR__ . '/asset/styles/' . $style . '.css'); DI::page()->registerStylesheet(__DIR__ . '/asset/styles/' . $style . '.css');
} }
function highlightjs_footer(App $a, &$b) function highlightjs_footer(App $a, &$b)
{ {
$a->registerFooterScript(__DIR__ . '/asset/highlight.pack.js'); DI::page()->registerFooterScript(__DIR__ . '/asset/highlight.pack.js');
$a->registerFooterScript(__DIR__ . '/highlightjs.js'); DI::page()->registerFooterScript(__DIR__ . '/highlightjs.js');
} }

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;
function mathjax_install() 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 // if the visitor of the page is not a local_user, use MathJax
// otherwise check the users settings. // otherwise check the users settings.
if (!local_user() || PConfig::get(local_user(), 'mathjax', 'use', false)) { if (!local_user() || PConfig::get(local_user(), 'mathjax', 'use', false)) {
$a->registerFooterScript(__DIR__ . '/asset/MathJax.js?config=TeX-MML-AM_CHTML'); DI::page()->registerFooterScript(__DIR__ . '/asset/MathJax.js?config=TeX-MML-AM_CHTML');
$a->registerFooterScript(__DIR__ . '/mathjax.js'); DI::page()->registerFooterScript(__DIR__ . '/mathjax.js');
} }
} }

View File

@ -13,6 +13,7 @@ use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI;
function pageheader_install() { function pageheader_install() {
Hook::register('page_content_top', __FILE__, 'pageheader_fetch'); 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 */ /* Add our stylesheet to the page so we can make our settings look nice */
$stylesheetPath = __DIR__ . '/pageheader.css'; $stylesheetPath = __DIR__ . '/pageheader.css';
$a->registerStylesheet($stylesheetPath); DI::page()->registerStylesheet($stylesheetPath);
$words = Config::get('pageheader','text'); $words = Config::get('pageheader','text');
if(! $words) if(! $words)
@ -65,7 +66,7 @@ function pageheader_fetch(App $a, &$b)
} }
$stylesheetPath = __DIR__ .'/pageheader.css'; $stylesheetPath = __DIR__ .'/pageheader.css';
$a->registerStylesheet($stylesheetPath); DI::page()->registerStylesheet($stylesheetPath);
if ($s) { if ($s) {
$b .= '<div class="pageheader">' . $s . '</div>'; $b .= '<div class="pageheader">' . $s . '</div>';