Merge branch 'develop' into phpstan-level-1

This commit is contained in:
Art4 2024-11-18 21:45:42 +00:00
commit c79f3cde22
150 changed files with 2429 additions and 1781 deletions

View file

@ -7,11 +7,11 @@
*
*/
use Friendica\App;
use Friendica\AppHelper;
use Friendica\Core\Renderer;
use Friendica\DI;
function theme_content(App $a)
function theme_content(AppHelper $appHelper)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -20,10 +20,10 @@ function theme_content(App $a)
$colorset = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset');
$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()) {
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');
$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'])) {
DI::config()->set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
}
}
/// @TODO $a is no longer used
function clean_form(App $a, &$colorset, $user)
/// @TODO $appHelper is no longer used
function clean_form(AppHelper $appHelper, &$colorset, $user)
{
$colorset = [
'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\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
*/
function duepuntozero_init(App $a) {
function duepuntozero_init(AppHelper $appHelper) {
Renderer::setActiveTemplateEngine('smarty3');
$colorset = null;
if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
if (DI::mode()->has(Mode::MAINTENANCEDISABLED)) {
$colorset = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'duepuntozero', 'colorset');
if (!$colorset)
$colorset = DI::config()->get('duepuntozero', 'colorset'); // user setting have priority, then node settings

View file

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

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;

View file

@ -12,7 +12,8 @@
* Maintainer: Hypolite Petovan <https://friendica.mrpetovan.com/profile/hypolite>
*/
use Friendica\App;
use Friendica\App\Mode;
use Friendica\AppHelper;
use Friendica\Content\Text\Plaintext;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
@ -36,12 +37,12 @@ const FRIO_CUSTOM_SCHEME = '---';
* This script can be included even when the app is in maintenance mode which requires us to avoid any config call
*/
function frio_init(App $a)
function frio_init(AppHelper $appHelper)
{
global $frio;
$frio = 'view/theme/frio';
$a->setThemeInfoValue('videowidth', 622);
$appHelper->setThemeInfoValue('videowidth', 622);
Renderer::setActiveTemplateEngine('smarty3');
@ -179,13 +180,12 @@ function frio_contact_photo_menu(&$args)
* Some links will point to the local pages because the user would expect
* local page (these pages are: search, community, help, apps, directory).
*
* @param App $a The App class
* @param array $nav_info The original nav info array: nav, banner, userinfo, sitelocation
* @throws Exception
*/
function frio_remote_nav(array &$nav_info)
{
if (DI::mode()->has(App\Mode::MAINTENANCEDISABLED)) {
if (DI::mode()->has(Mode::MAINTENANCEDISABLED)) {
// get the homelink from $_SESSION
$homelink = DI::userSession()->getMyUrl();
if (!$homelink) {

View file

@ -7,11 +7,11 @@
*
*/
use Friendica\App;
use Friendica\AppHelper;
use Friendica\Core\Renderer;
use Friendica\DI;
function theme_content(App $a) {
function theme_content(AppHelper $appHelper) {
if (!DI::userSession()->getLocalUserId()) {
return;
}
@ -21,10 +21,10 @@ function theme_content(App $a) {
$tfs = DI::pConfig()->get(DI::userSession()->getLocalUserId(),"quattro","tfs");
$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()) {
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' );
$color = DI::config()->get('quattro', 'color' );
$tfs = DI::config()->get("quattro","tfs");
$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'])){
DI::config()->set('quattro', 'align', $_POST['quattro_align']);
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
function quattro_form(App $a, $align, $color, $tfs, $pfs) {
function quattro_form(AppHelper $appHelper, $align, $color, $tfs, $pfs) {
$colors = [
"dark" => "Quattro",
"lilac" => "Lilac",

View file

@ -12,14 +12,14 @@
* Maintainer: Tobias <https://diekershoff.homeunix.net/friendica/profile/tobias>
*/
use Friendica\App;
use Friendica\AppHelper;
use Friendica\DI;
/*
* 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/js/quattro.js"></script>';;
}

View file

@ -20,7 +20,7 @@
* Screenshot: <a href="screenshot.png">Screenshot</a>
*/
use Friendica\App;
use Friendica\AppHelper;
use Friendica\Core\Renderer;
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
*/
function smoothly_init(App $a) {
function smoothly_init(AppHelper $appHelper) {
Renderer::setActiveTemplateEngine('smarty3');
$cssFile = null;

View file

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