]> git.mxchange.org Git - friendica.git/commitdiff
Move template to content/
authorMichael <heluecht@pirati.ca>
Mon, 5 Apr 2021 11:44:43 +0000 (11:44 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 5 Apr 2021 11:44:43 +0000 (11:44 +0000)
src/Model/Item.php
view/templates/audio.tpl [deleted file]
view/templates/content/audio.tpl [new file with mode: 0644]

index 765812b9ff1b545e74fb4cfb05a9933b06368170..76402280c2073583950b32cf87cb36a75f3dff54 100644 (file)
@@ -2676,7 +2676,8 @@ class Item
         */
        private static function addMediaAttachments(array $item, string $content)
        {
-               $attached = '';
+               $leading = '';
+               $trailing = '';
                foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]) as $attachment) {
                        $mime = $attachment['mimetype'];
 
@@ -2694,7 +2695,8 @@ class Item
                        }
 
                        if (($filetype == 'video')) {
-                               $attached .= Renderer::replaceMacros(Renderer::getMarkupTemplate('video_top.tpl'), [
+                               /// @todo Move the template to /content as well
+                               $leading .= Renderer::replaceMacros(Renderer::getMarkupTemplate('video_top.tpl'), [
                                        '$video' => [
                                                'id'     => $item['author-id'],
                                                'src'    => $the_url,
@@ -2702,7 +2704,7 @@ class Item
                                        ],
                                ]);
                        } elseif ($filetype == 'audio') {
-                               $attached .= Renderer::replaceMacros(Renderer::getMarkupTemplate('audio.tpl'), [
+                               $leading .= Renderer::replaceMacros(Renderer::getMarkupTemplate('content/audio.tpl'), [
                                        '$audio' => [
                                                'id'     => $item['author-id'],
                                                'src'    => $the_url,
@@ -2718,12 +2720,16 @@ class Item
 
                                /// @todo Use a template
                                $icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
-                               $attached .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" rel="noopener noreferrer" >' . $icon . '</a>';
+                               $trailing .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" rel="noopener noreferrer" >' . $icon . '</a>';
                        }
                }
 
-               if ($attached != '') {
-                       $content .= '<div class="body-attach">' . $attached . '<div class="clear"></div></div>';
+               if ($leading != '') {
+                       $content = '<div class="body-attach">' . $leading . '<div class="clear"></div></div>' . $content;
+               }
+
+               if ($trailing != '') {
+                       $content .= '<div class="body-attach">' . $trailing . '<div class="clear"></div></div>';
                }
 
                return $content;
diff --git a/view/templates/audio.tpl b/view/templates/audio.tpl
deleted file mode 100644 (file)
index 0b0467a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<audio src="{{$audio.src}}" controls>
-       <a href="{{$audio.src}}">{{$audio.src}}</a>
-</audio>
-<br>
diff --git a/view/templates/content/audio.tpl b/view/templates/content/audio.tpl
new file mode 100644 (file)
index 0000000..0b0467a
--- /dev/null
@@ -0,0 +1,4 @@
+<audio src="{{$audio.src}}" controls>
+       <a href="{{$audio.src}}">{{$audio.src}}</a>
+</audio>
+<br>