diff --git a/src/Core/Addon.php b/src/Core/Addon.php index 39a1737946..f798021252 100644 --- a/src/Core/Addon.php +++ b/src/Core/Addon.php @@ -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]; diff --git a/src/Module/Admin/Addons/Details.php b/src/Module/Admin/Addons/Details.php index a102f4d269..671d23c199 100644 --- a/src/Module/Admin/Addons/Details.php +++ b/src/Module/Admin/Addons/Details.php @@ -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: '), diff --git a/src/Module/Profile/Index.php b/src/Module/Profile/Index.php index 699466f0e5..e7d02863e8 100644 --- a/src/Module/Profile/Index.php +++ b/src/Module/Profile/Index.php @@ -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