Merge branch 'develop' into rework-addon-class

This commit is contained in:
Art4 2025-05-14 07:53:31 +00:00
commit 08b60c2558
3 changed files with 67 additions and 22 deletions

View file

@ -8,7 +8,6 @@
namespace Friendica\Core;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Util\Strings;
/**
@ -267,12 +266,6 @@ class Addon
if ($type == "author" || $type == "maintainer") {
$r = preg_match("|([^<]+)<([^>]+)>|", $v, $m);
if ($r) {
if (!empty($m[2]) && empty(parse_url($m[2], PHP_URL_SCHEME))) {
$contact = Contact::getByURL($m[2], false);
if (!empty($contact['url'])) {
$m[2] = $contact['url'];
}
}
$info[$type][] = ['name' => $m[1], 'link' => $m[2]];
} else {
$info[$type][] = ['name' => $v];

View file

@ -10,6 +10,7 @@ namespace Friendica\Module\Admin\Addons;
use Friendica\Content\Text\Markdown;
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Module\BaseAdmin;
use Friendica\Util\Strings;
@ -92,6 +93,35 @@ class Details extends BaseAdmin
$addonInfo = $addonHelper->getAddonInfo($addon);
$addonAuthors = [];
foreach ($addonInfo->getAuthors() as $addonAuthor) {
$addonAuthor['link'] = 'foo@bar.com';
if (array_key_exists('link', $addonAuthor) && empty(parse_url($addonAuthor['link'], PHP_URL_SCHEME))) {
$contact = Contact::getByURL($addonAuthor['link'], false);
if (!empty($contact['url'])) {
$addonAuthor['link'] = $contact['url'];
}
}
$addonAuthors[] = $addonAuthor;
}
$addonMaintainers = [];
foreach ($addonInfo->getMaintainers() as $addonMaintainer) {
if (array_key_exists('link', $addonMaintainer) && empty(parse_url($addonMaintainer['link'], PHP_URL_SCHEME))) {
$contact = Contact::getByURL($addonMaintainer['link'], false);
if (!empty($contact['url'])) {
$addonMaintainer['link'] = $contact['url'];
}
}
$addonMaintainers[] = $addonMaintainer;
}
$t = Renderer::getMarkupTemplate('admin/addons/details.tpl');
return Renderer::replaceMacros($t, [
@ -107,8 +137,8 @@ class Details extends BaseAdmin
'name' => $addonInfo->getName(),
'version' => $addonInfo->getVersion(),
'description' => $addonInfo->getDescription(),
'author' => $addonInfo->getAuthors(),
'maintainer' => $addonInfo->getMaintainers(),
'author' => $addonAuthors,
'maintainer' => $addonMaintainers,
],
'$str_author' => DI::l10n()->t('Author: '),
'$str_maintainer' => DI::l10n()->t('Maintainer: '),

View file

@ -23,6 +23,7 @@ use Friendica\Module\Response;
use Friendica\Profile\ProfileField\Repository\ProfileField;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Profiler;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Log\LoggerInterface;
/**
@ -56,26 +57,47 @@ class Index extends BaseModule
private $pConfig;
/** @var Mode */
private $mode;
private EventDispatcherInterface $eventDispatcher;
public function __construct(Mode $mode, IManagePersonalConfigValues $pConfig, Conversation $conversation, DateTimeFormat $dateTimeFormat, ProfileField $profileField, Page $page, IManageConfigValues $config, IHandleUserSessions $session, AppHelper $appHelper, Database $database, L10n $l10n, BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
{
public function __construct(
Mode $mode,
IManagePersonalConfigValues $pConfig,
Conversation $conversation,
DateTimeFormat $dateTimeFormat,
ProfileField $profileField,
Page $page,
IManageConfigValues $config,
IHandleUserSessions $session,
AppHelper $appHelper,
Database $database,
EventDispatcherInterface $eventDispatcher,
L10n $l10n,
BaseURL $baseUrl,
Arguments $args,
LoggerInterface $logger,
Profiler $profiler,
Response $response,
array $server,
array $parameters = []
) {
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->database = $database;
$this->appHelper = $appHelper;
$this->session = $session;
$this->config = $config;
$this->page = $page;
$this->profileField = $profileField;
$this->dateTimeFormat = $dateTimeFormat;
$this->conversation = $conversation;
$this->pConfig = $pConfig;
$this->mode = $mode;
$this->database = $database;
$this->appHelper = $appHelper;
$this->session = $session;
$this->config = $config;
$this->page = $page;
$this->profileField = $profileField;
$this->dateTimeFormat = $dateTimeFormat;
$this->conversation = $conversation;
$this->pConfig = $pConfig;
$this->mode = $mode;
$this->eventDispatcher = $eventDispatcher;
}
protected function rawContent(array $request = [])
{
(new Profile($this->profileField, $this->page, $this->config, $this->session, $this->appHelper, $this->database, $this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->response, $this->server, $this->parameters))->rawContent();
(new Profile($this->profileField, $this->page, $this->config, $this->session, $this->appHelper, $this->database, $this->eventDispatcher, $this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->response, $this->server, $this->parameters))->rawContent();
}
protected function content(array $request = []): string