Replace typehint App with AppHelper in view folder

This commit is contained in:
Art4 2024-11-10 23:53:03 +00:00
parent 5baa54e81c
commit 629c4af3c8
7 changed files with 36 additions and 35 deletions

View file

@ -7,11 +7,11 @@
* *
*/ */
use Friendica\App; use Friendica\AppHelper;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
function theme_content(App $a) function theme_content(AppHelper $appHelper)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -20,10 +20,10 @@ function theme_content(App $a)
$colorset = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset'); $colorset = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset');
$user = true; $user = true;
return clean_form($a, $colorset, $user); return clean_form($appHelper, $colorset, $user);
} }
function theme_post(App $a) function theme_post(AppHelper $appHelper)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -34,23 +34,23 @@ function theme_post(App $a)
} }
} }
function theme_admin(App $a) function theme_admin(AppHelper $appHelper)
{ {
$colorset = DI::config()->get('duepuntozero', 'colorset'); $colorset = DI::config()->get('duepuntozero', 'colorset');
$user = false; $user = false;
return clean_form($a, $colorset, $user); return clean_form($appHelper, $colorset, $user);
} }
function theme_admin_post(App $a) function theme_admin_post(AppHelper $appHelper)
{ {
if (isset($_POST['duepuntozero-settings-submit'])) { if (isset($_POST['duepuntozero-settings-submit'])) {
DI::config()->set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']); DI::config()->set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
} }
} }
/// @TODO $a is no longer used /// @TODO $appHelper is no longer used
function clean_form(App $a, &$colorset, $user) function clean_form(AppHelper $appHelper, &$colorset, $user)
{ {
$colorset = [ $colorset = [
'default' => DI::l10n()->t('default'), 'default' => DI::l10n()->t('default'),

View file

@ -7,7 +7,8 @@
* *
*/ */
use Friendica\App; use Friendica\App\Mode;
use Friendica\AppHelper;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
@ -15,13 +16,13 @@ use Friendica\DI;
* This script can be included even when the app is in maintenance mode which requires us to avoid any config call * This script can be included even when the app is in maintenance mode which requires us to avoid any config call
*/ */
function duepuntozero_init(App $a) { function duepuntozero_init(AppHelper $appHelper) {
Renderer::setActiveTemplateEngine('smarty3'); Renderer::setActiveTemplateEngine('smarty3');
$colorset = null; $colorset = null;
if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) { if (DI::mode()->has(Mode::MAINTENANCEDISABLED)) {
$colorset = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset'); $colorset = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset');
if (!$colorset) if (!$colorset)
$colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings $colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings

View file

@ -7,14 +7,14 @@
* *
*/ */
use Friendica\App; use Friendica\AppHelper;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
require_once 'view/theme/frio/php/Image.php'; require_once 'view/theme/frio/php/Image.php';
require_once 'view/theme/frio/php/scheme.php'; require_once 'view/theme/frio/php/scheme.php';
function theme_post(App $a) function theme_post(AppHelper $appHelper)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;

View file

@ -7,11 +7,11 @@
* *
*/ */
use Friendica\App; use Friendica\AppHelper;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
function theme_content(App $a) { function theme_content(AppHelper $appHelper) {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
} }
@ -21,10 +21,10 @@ function theme_content(App $a) {
$tfs = DI::pConfig()->get(DI::userSession()->getLocalUserId(),"quattro","tfs"); $tfs = DI::pConfig()->get(DI::userSession()->getLocalUserId(),"quattro","tfs");
$pfs = DI::pConfig()->get(DI::userSession()->getLocalUserId(),"quattro","pfs"); $pfs = DI::pConfig()->get(DI::userSession()->getLocalUserId(),"quattro","pfs");
return quattro_form($a,$align, $color, $tfs, $pfs); return quattro_form($appHelper,$align, $color, $tfs, $pfs);
} }
function theme_post(App $a) { function theme_post(AppHelper $appHelper) {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
} }
@ -37,16 +37,16 @@ function theme_post(App $a) {
} }
} }
function theme_admin(App $a) { function theme_admin(AppHelper $appHelper) {
$align = DI::config()->get('quattro', 'align' ); $align = DI::config()->get('quattro', 'align' );
$color = DI::config()->get('quattro', 'color' ); $color = DI::config()->get('quattro', 'color' );
$tfs = DI::config()->get("quattro","tfs"); $tfs = DI::config()->get("quattro","tfs");
$pfs = DI::config()->get("quattro","pfs"); $pfs = DI::config()->get("quattro","pfs");
return quattro_form($a,$align, $color, $tfs, $pfs); return quattro_form($appHelper,$align, $color, $tfs, $pfs);
} }
function theme_admin_post(App $a) { function theme_admin_post(AppHelper $appHelper) {
if (isset($_POST['quattro-settings-submit'])){ if (isset($_POST['quattro-settings-submit'])){
DI::config()->set('quattro', 'align', $_POST['quattro_align']); DI::config()->set('quattro', 'align', $_POST['quattro_align']);
DI::config()->set('quattro', 'color', $_POST['quattro_color']); DI::config()->set('quattro', 'color', $_POST['quattro_color']);
@ -56,7 +56,7 @@ function theme_admin_post(App $a) {
} }
/// @TODO $a is no longer used here /// @TODO $a is no longer used here
function quattro_form(App $a, $align, $color, $tfs, $pfs) { function quattro_form(AppHelper $appHelper, $align, $color, $tfs, $pfs) {
$colors = [ $colors = [
"dark" => "Quattro", "dark" => "Quattro",
"lilac" => "Lilac", "lilac" => "Lilac",

View file

@ -12,14 +12,14 @@
* Maintainer: Tobias <https://diekershoff.homeunix.net/friendica/profile/tobias> * Maintainer: Tobias <https://diekershoff.homeunix.net/friendica/profile/tobias>
*/ */
use Friendica\App; use Friendica\AppHelper;
use Friendica\DI; use Friendica\DI;
/* /*
* This script can be included even when the app is in maintenance mode which requires us to avoid any config call * This script can be included even when the app is in maintenance mode which requires us to avoid any config call
*/ */
function quattro_init(App $a) { function quattro_init(AppHelper $appHelper) {
DI::page()['htmlhead'] .= '<script src="'.DI::baseUrl().'/view/theme/quattro/tinycon.min.js"></script>'; DI::page()['htmlhead'] .= '<script src="'.DI::baseUrl().'/view/theme/quattro/tinycon.min.js"></script>';
DI::page()['htmlhead'] .= '<script src="'.DI::baseUrl().'/view/theme/quattro/js/quattro.js"></script>';; DI::page()['htmlhead'] .= '<script src="'.DI::baseUrl().'/view/theme/quattro/js/quattro.js"></script>';;
} }

View file

@ -20,7 +20,7 @@
* Screenshot: <a href="screenshot.png">Screenshot</a> * Screenshot: <a href="screenshot.png">Screenshot</a>
*/ */
use Friendica\App; use Friendica\AppHelper;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
@ -28,7 +28,7 @@ use Friendica\DI;
* This script can be included even when the app is in maintenance mode which requires us to avoid any config call * This script can be included even when the app is in maintenance mode which requires us to avoid any config call
*/ */
function smoothly_init(App $a) { function smoothly_init(AppHelper $appHelper) {
Renderer::setActiveTemplateEngine('smarty3'); Renderer::setActiveTemplateEngine('smarty3');
$cssFile = null; $cssFile = null;

View file

@ -7,13 +7,13 @@
* *
*/ */
use Friendica\App; use Friendica\AppHelper;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
require_once __DIR__ . '/theme.php'; require_once __DIR__ . '/theme.php';
function theme_content(App $a) function theme_content(AppHelper $appHelper)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -40,11 +40,11 @@ function theme_content(App $a)
$show_friends = get_vier_config('show_friends', true); $show_friends = get_vier_config('show_friends', true);
$show_lastusers = get_vier_config('show_lastusers', true); $show_lastusers = get_vier_config('show_lastusers', true);
return vier_form($a,$style, $show_pages, $show_profiles, $show_helpers, return vier_form($appHelper,$style, $show_pages, $show_profiles, $show_helpers,
$show_services, $show_friends, $show_lastusers); $show_services, $show_friends, $show_lastusers);
} }
function theme_post(App $a) function theme_post(AppHelper $appHelper)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -62,7 +62,7 @@ function theme_post(App $a)
} }
function theme_admin(App $a) { function theme_admin(AppHelper $appHelper) {
if (!function_exists('get_vier_config')) if (!function_exists('get_vier_config'))
return; return;
@ -85,13 +85,13 @@ function theme_admin(App $a) {
$show_services = get_vier_config('show_services', true, true); $show_services = get_vier_config('show_services', true, true);
$show_friends = get_vier_config('show_friends', true, true); $show_friends = get_vier_config('show_friends', true, true);
$show_lastusers = get_vier_config('show_lastusers', true, true); $show_lastusers = get_vier_config('show_lastusers', true, true);
$o .= vier_form($a,$style, $show_pages, $show_profiles, $show_helpers, $show_services, $o .= vier_form($appHelper,$style, $show_pages, $show_profiles, $show_helpers, $show_services,
$show_friends, $show_lastusers); $show_friends, $show_lastusers);
return $o; return $o;
} }
function theme_admin_post(App $a) { function theme_admin_post(AppHelper $appHelper) {
if (isset($_POST['vier-settings-submit'])){ if (isset($_POST['vier-settings-submit'])){
DI::config()->set('vier', 'style', $_POST['vier_style']); DI::config()->set('vier', 'style', $_POST['vier_style']);
DI::config()->set('vier', 'show_pages', $_POST['vier_show_pages']); DI::config()->set('vier', 'show_pages', $_POST['vier_show_pages']);
@ -104,8 +104,8 @@ function theme_admin_post(App $a) {
} }
} }
/// @TODO $a is no longer used /// @TODO $appHelper is no longer used
function vier_form(App $a, $style, $show_pages, $show_profiles, $show_helpers, $show_services, $show_friends, $show_lastusers) { function vier_form(AppHelper $appHelper, $style, $show_pages, $show_profiles, $show_helpers, $show_services, $show_friends, $show_lastusers) {
$styles = [ $styles = [
"breathe"=>"Breathe", "breathe"=>"Breathe",
"netcolour"=>"Coloured Networks", "netcolour"=>"Coloured Networks",