From f10b3bb05c539516bc5f833e588e2895581ce21a Mon Sep 17 00:00:00 2001 From: Eliseu Amaro Date: Thu, 23 Dec 2021 18:12:49 +0000 Subject: [PATCH] [PLUGINS][MediaFeed] Fixed template path typos --- plugins/MediaFeed/MediaFeed.php | 32 +++++++++++-------- .../{mediaFeeed => mediaFeed}/tabs.html.twig | 0 2 files changed, 18 insertions(+), 14 deletions(-) rename plugins/MediaFeed/templates/{mediaFeeed => mediaFeed}/tabs.html.twig (100%) diff --git a/plugins/MediaFeed/MediaFeed.php b/plugins/MediaFeed/MediaFeed.php index 6500cc769a..0a5595609f 100644 --- a/plugins/MediaFeed/MediaFeed.php +++ b/plugins/MediaFeed/MediaFeed.php @@ -1,6 +1,6 @@ * @copyright 2018-2019, 2021 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later @@ -31,11 +32,11 @@ declare(strict_types=1); namespace Plugin\MediaFeed; use App\Core\Event; -use App\Entity\Note; -use Functional as F; -use App\Entity\Actor; -use App\Util\Formatting; use App\Core\Modules\Plugin; +use App\Entity\Actor; +use App\Entity\Note; +use App\Util\Formatting; +use Functional as F; use Symfony\Component\HttpFoundation\Request; class MediaFeed extends Plugin @@ -47,38 +48,41 @@ class MediaFeed extends Plugin } return Event::next; } + /** * Draw the media feed navigation. - * @return bool hook value; true means continue processing, false means stop. + * + * @return bool hook value; true means continue processing, false means stop */ public function onBeforeFeed(Request $request, &$res): bool { $isMediaActive = $request->get('filter-type') === 'media'; // we need two urls: one with filter-type=media and without it. - $query = strpos($request->getRequestUri(), '?'); + $query = mb_strpos($request->getRequestUri(), '?'); $mediaURL = $request->getRequestUri() . ($query !== false ? '&' : '?') . 'filter-type=media'; $allURL = $request->getPathInfo(); if ($query !== false) { - $params = explode('&', substr($request->getRequestUri(), $query + 1)); - $params = array_filter($params, fn ($s) => $s !== 'filter-type=media'); - $params = implode('&', $params); + $params = explode('&', mb_substr($request->getRequestUri(), $query + 1)); + $params = array_filter($params, fn ($s) => $s !== 'filter-type=media'); + $params = implode('&', $params); if ($params) { $allURL .= '?' . $params; } } - $res[] = Formatting::twigRenderFile('mediaFeeed/tabs.html.twig', [ + $res[] = Formatting::twigRenderFile('mediaFeed/tabs.html.twig', [ 'main' => [ 'active' => !$isMediaActive, - 'url' => $isMediaActive ? $allURL : '', + 'url' => $isMediaActive ? $allURL : '', ], 'media' => [ 'active' => $isMediaActive, - 'url' => $isMediaActive ? '' : $mediaURL, - ] + 'url' => $isMediaActive ? '' : $mediaURL, + ], ]); return Event::next; } + /** * Output our dedicated stylesheet * diff --git a/plugins/MediaFeed/templates/mediaFeeed/tabs.html.twig b/plugins/MediaFeed/templates/mediaFeed/tabs.html.twig similarity index 100% rename from plugins/MediaFeed/templates/mediaFeeed/tabs.html.twig rename to plugins/MediaFeed/templates/mediaFeed/tabs.html.twig