Replace all functions from boot.php

This commit is contained in:
Michael 2022-10-18 20:42:46 +00:00 committed by Hypolite Petovan
parent 5f1028a535
commit 5d8129600d
45 changed files with 577 additions and 535 deletions

View file

@ -11,6 +11,7 @@
use Friendica\App;
use Friendica\Core\Hook;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\DI;
function mathjax_install()
@ -22,20 +23,20 @@ function mathjax_install()
function mathjax_settings_post(App $a)
{
if (!local_user() || empty($_POST['mathjax-submit'])) {
if (!Session::getLocalUser() || empty($_POST['mathjax-submit'])) {
return;
}
DI::pConfig()->set(local_user(), 'mathjax', 'use', intval($_POST['mathjax_use']));
DI::pConfig()->set(Session::getLocalUser(), 'mathjax', 'use', intval($_POST['mathjax_use']));
}
function mathjax_settings(App $a, array &$data)
{
if (!local_user()) {
if (!Session::getLocalUser()) {
return;
}
$use = DI::pConfig()->get(local_user(), 'mathjax', 'use', false);
$use = DI::pConfig()->get(Session::getLocalUser(), 'mathjax', 'use', false);
$tpl = Renderer::getMarkupTemplate('settings.tpl', 'addon/mathjax');
$html = Renderer::replaceMacros($tpl, [
@ -54,7 +55,7 @@ function mathjax_footer(App $a, string &$body)
{
// if the visitor of the page is not a local_user, use MathJax
// otherwise check the users settings.
if (!local_user() || DI::pConfig()->get(local_user(), 'mathjax', 'use', false)) {
if (!Session::getLocalUser() || DI::pConfig()->get(Session::getLocalUser(), 'mathjax', 'use', false)) {
DI::page()->registerFooterScript(__DIR__ . '/asset/MathJax.js?config=TeX-MML-AM_CHTML');
DI::page()->registerFooterScript(__DIR__ . '/mathjax.js');
}