Replace calls for App::getCurrentTheme() with AppHelper

This commit is contained in:
Art4 2024-11-10 11:59:43 +00:00
parent e6b39e5f1c
commit 4abfc3907b
3 changed files with 24 additions and 24 deletions

View file

@ -11,6 +11,7 @@ use ArrayAccess;
use DOMDocument;
use DOMXPath;
use Friendica\App;
use Friendica\AppHelper;
use Friendica\Content\Nav;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\Hook;
@ -176,7 +177,7 @@ class Page implements ArrayAccess
* - Infinite scroll data
* - head.tpl template
*
* @param App $app The Friendica App instance
* @param AppHelper $appHelper The Friendica App instance
* @param Arguments $args The Friendica App Arguments
* @param L10n $l10n The l10n language instance
* @param IManageConfigValues $config The Friendica configuration
@ -185,7 +186,7 @@ class Page implements ArrayAccess
*
* @throws HTTPException\InternalServerErrorException
*/
private function initHead(App $app, Arguments $args, L10n $l10n, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, int $localUID)
private function initHead(AppHelper $appHelper, Arguments $args, L10n $l10n, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, int $localUID)
{
$interval = ($localUID ? $pConfig->get($localUID, 'system', 'update_interval') : 40000);
@ -209,7 +210,7 @@ class Page implements ArrayAccess
if (!empty(Renderer::$theme['stylesheet'])) {
$stylesheet = Renderer::$theme['stylesheet'];
} else {
$stylesheet = $app->getCurrentThemeStylesheetPath();
$stylesheet = $appHelper->getCurrentThemeStylesheetPath();
}
$this->registerStylesheet($stylesheet);
@ -306,7 +307,6 @@ class Page implements ArrayAccess
* - Registered footer scripts (through App->registerFooterScript())
* - footer.tpl template
*
* @param App $app The Friendica App instance
* @param Mode $mode The Friendica runtime mode
* @param L10n $l10n The l10n instance
*
@ -392,7 +392,7 @@ class Page implements ArrayAccess
/**
* Executes the creation of the current page and prints it to the screen
*
* @param App $app The Friendica App
* @param AppHelper $appHelper The Friendica App
* @param BaseURL $baseURL The Friendica Base URL
* @param Arguments $args The Friendica App arguments
* @param Mode $mode The current node mode
@ -407,7 +407,7 @@ class Page implements ArrayAccess
* @throws HTTPException\InternalServerErrorException
* @throws HTTPException\ServiceUnavailableException
*/
public function run(App $app, UserSession $session, BaseURL $baseURL, Arguments $args, Mode $mode, ResponseInterface $response, L10n $l10n, Profiler $profiler, IManageConfigValues $config, IManagePersonalConfigValues $pconfig, Nav $nav, int $localUID)
public function run(AppHelper $appHelper, UserSession $session, BaseURL $baseURL, Arguments $args, Mode $mode, ResponseInterface $response, L10n $l10n, Profiler $profiler, IManageConfigValues $config, IManagePersonalConfigValues $pconfig, Nav $nav, int $localUID)
{
$moduleName = $args->getModuleName();
@ -423,7 +423,7 @@ class Page implements ArrayAccess
$this->initContent($response, $mode);
// Load current theme info after module has been initialized as theme could have been set in module
$currentTheme = $app->getCurrentTheme();
$currentTheme = $appHelper->getCurrentTheme();
$theme_info_file = 'view/theme/' . $currentTheme . '/theme.php';
if (file_exists($theme_info_file)) {
require_once $theme_info_file;

View file

@ -9,7 +9,7 @@
*
*/
use Friendica\App;
use Friendica\AppHelper;
use Friendica\DI;
/**
@ -17,19 +17,19 @@ use Friendica\DI;
*
* @todo Check if this is really needed.
*/
function load_page(App $a)
function load_page(AppHelper $appHelper)
{
if (isset($_GET['mode']) && ($_GET['mode'] == 'minimal')) {
require 'view/theme/frio/minimal.php';
} elseif ((isset($_GET['mode']) && ($_GET['mode'] == 'none'))) {
require 'view/theme/frio/none.php';
} else {
$template = 'view/theme/' . $a->getCurrentTheme() . '/'
$template = 'view/theme/' . $appHelper->getCurrentTheme() . '/'
. ((DI::page()['template'] ?? '') ?: 'default' ) . '.php';
if (file_exists($template)) {
require_once $template;
} else {
require_once str_replace('theme/' . $a->getCurrentTheme() . '/', '', $template);
require_once str_replace('theme/' . $appHelper->getCurrentTheme() . '/', '', $template);
}
}
}

View file

@ -29,7 +29,7 @@ require_once 'view/theme/frio/theme.php';
function get_scheme_info($scheme)
{
$theme = DI::app()->getCurrentTheme();
$theme = DI::apphelper()->getCurrentTheme();
$themepath = 'view/theme/' . $theme . '/';
$scheme = Strings::sanitizeFilePathItem($scheme) ?: FRIO_DEFAULT_SCHEME;