]> git.mxchange.org Git - friendica.git/commitdiff
optimize usage of arguments
authornupplaPhil <admin@philipp.info>
Sat, 28 Dec 2019 14:28:17 +0000 (15:28 +0100)
committernupplaPhil <admin@philipp.info>
Sat, 28 Dec 2019 14:28:17 +0000 (15:28 +0100)
src/Module/HoverCard.php
static/routes.config.php

index 4c035d521a692bd3457131f5ab8fb03e818de56f..2106809220e90ffac46ca737f0d283829fac7604 100644 (file)
@@ -20,21 +20,16 @@ class HoverCard extends BaseModule
 {
        public static function rawContent(array $parameters = [])
        {
-               /** @var Arguments $args */
-               $args = self::getClass(Arguments::class);
-
                $a = self::getApp();
 
-               // A logged in user views a profile of a user
-               if ((local_user()) && $args->get(2) === 'view') {
+               if ((local_user()) && ($parameters['action'] ?? '') === 'view') {
+                       // A logged in user views a profile of a user
                        $nickname = $a->user['nickname'];
                        $profile  = $parameters['profile'];
-
+               } elseif (empty($parameters['action'])) {
                        // Show the profile hovercard
-               } elseif ($args->getArgc() == 2) {
                        $nickname = $parameters['profile'];
                        $profile  = 0;
-
                } else {
                        /** @var L10n $l10n */
                        $l10n = self::getClass(L10n::class);
index ce2cf60c468601a0d7dc0ee862307102bc97605a..f15ec97a27139da1fa496ffe7bb930fc884296d8 100644 (file)
@@ -139,12 +139,12 @@ return [
                '/{group:\d+}/add/{contact:\d+}'    => [Module\Group::class, [R::GET, R::POST]],
                '/{group:\d+}/remove/{contact:\d+}' => [Module\Group::class, [R::GET, R::POST]],
        ],
-       '/hashtag'                  => [Module\Hashtag::class,   [R::GET]],
-       '/help[/{doc:.+}]'          => [Module\Help::class,      [R::GET]],
-       '/home'                     => [Module\Home::class,      [R::GET]],
-       '/hcard/{profile}[/{view}]' => [Module\HoverCard::class, [R::GET]],
-       '/inbox[/{nickname}]'       => [Module\Inbox::class,     [R::GET, R::POST]],
-       '/invite'                   => [Module\Invite::class,    [R::GET, R::POST]],
+       '/hashtag'                    => [Module\Hashtag::class,   [R::GET]],
+       '/help[/{doc:.+}]'            => [Module\Help::class,      [R::GET]],
+       '/home'                       => [Module\Home::class,      [R::GET]],
+       '/hcard/{profile}[/{action}]' => [Module\HoverCard::class, [R::GET]],
+       '/inbox[/{nickname}]'         => [Module\Inbox::class,     [R::GET, R::POST]],
+       '/invite'                     => [Module\Invite::class,    [R::GET, R::POST]],
 
        '/install'         => [
                '[/]'                    => [Module\Install::class, [R::GET, R::POST]],