]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Item.php
Merge pull request #8272 from MrPetovan/bug/8254-regex-url-img
[friendica.git] / src / Content / Item.php
index f086fbe19cc1b6e50706d052c948af35faa5150d..51a14435ef16e736750a383a108a128c388ef587 100644 (file)
@@ -1,4 +1,23 @@
 <?php
+/**
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Content;
 
@@ -7,7 +26,7 @@ use Friendica\Model\FileTag;
 /**
  * A content helper class for displaying items
  */
-final class Item
+class Item
 {
        /**
         * Return array with details for categories and folders for an item
@@ -42,17 +61,16 @@ final class Item
                $folders = [];
                $first = true;
 
-               if (!empty($item['author-link'])) {
-                       $url = $item['author-link'] . "?category=" . rawurlencode($savedFolderName);
-               } else {
-                       $url = '#';
-               }
-
                foreach (FileTag::fileToArray($item['file'] ?? '', 'category') as $savedFolderName) {
+                       if (!empty($item['author-link'])) {
+                               $url = $item['author-link'] . "?category=" . rawurlencode($savedFolderName);
+                       } else {
+                               $url = '#';
+                       }
                        $categories[] = [
                                'name' => $savedFolderName,
                                'url' => $url,
-                               'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&cat=' . rawurlencode($savedFolderName) : ""),
+                               'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?cat=' . rawurlencode($savedFolderName) : ""),
                                'first' => $first,
                                'last' => false
                        ];
@@ -68,7 +86,7 @@ final class Item
                                $folders[] = [
                                        'name' => $savedFolderName,
                                        'url' => "#",
-                                       'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?f=&term=' . rawurlencode($savedFolderName) : ""),
+                                       'removeurl' => ((local_user() == $item['uid']) ? 'filerm/' . $item['id'] . '?term=' . rawurlencode($savedFolderName) : ""),
                                        'first' => $first,
                                        'last' => false
                                ];