]> git.mxchange.org Git - friendica.git/blobdiff - src/Object/Post.php
Avoid warning " Undefined variable $browsershare"
[friendica.git] / src / Object / Post.php
index b5c058dfd9a9b24db04cc4fee58f45abed32ad42..2cf02f8e2a1892ffd60fbedba5e03cb428407e4c 100644 (file)
@@ -231,7 +231,7 @@ class Post
 
                $origin = $item['origin'] || $item['parent-origin'];
 
-               if ($item['pinned']) {
+               if (!empty($item['featured'])) {
                        $pinned = DI::l10n()->t('Pinned item');
                }
 
@@ -249,7 +249,7 @@ class Post
                        ];
                }
 
-               if (!$item['self']) {
+               if (!$item['self'] && local_user()) {
                        $block = [
                                'blocking' => true,
                                'block'   => DI::l10n()->t('Block %s', $item['author-name']),
@@ -343,14 +343,14 @@ class Post
 
                                if ($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) {
                                        if ($origin) {
-                                               $ispinned = ($item['pinned'] ? 'pinned' : 'unpinned');
+                                               $ispinned = ($item['featured'] ? 'pinned' : 'unpinned');
 
                                                $pin = [
                                                        'do'        => DI::l10n()->t('Pin'),
                                                        'undo'      => DI::l10n()->t('Unpin'),
                                                        'toggle'    => DI::l10n()->t('Toggle pin status'),
-                                                       'classdo'   => $item['pinned'] ? 'hidden' : '',
-                                                       'classundo' => $item['pinned'] ? '' : 'hidden',
+                                                       'classdo'   => $item['featured'] ? 'hidden' : '',
+                                                       'classundo' => $item['featured'] ? '' : 'hidden',
                                                        'pinned'   => DI::l10n()->t('Pinned'),
                                                ];
                                        }
@@ -393,6 +393,8 @@ class Post
                        $title = $item['title'];
                } elseif (!empty($item['content-warning']) && DI::pConfig()->get(local_user(), 'system', 'disable_cw', false)) {
                        $title = ucfirst($item['content-warning']);
+               } else {
+                       $title = '';
                }
 
                if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
@@ -443,6 +445,12 @@ class Post
                        $languages = [DI::l10n()->t('Languages'), Item::getLanguageMessage($item)];
                }
 
+               if (in_array($item['private'], [Item::PUBLIC, Item::UNLISTED]) && in_array($item['network'], Protocol::FEDERATED)) {
+                       $browsershare = [DI::l10n()->t('Share via ...'), DI::l10n()->t('Share via external services')];
+               } else {
+                       $browsershare = null;
+               }
+
                $tmp_item = [
                        'template'        => $this->getTemplate(),
                        'type'            => implode("", array_slice(explode("/", $item['verb']), -1)),
@@ -494,7 +502,7 @@ class Post
                        'owner_photo'     => DI::baseUrl()->remove(Contact::getAvatarUrlForUrl($item['owner-link'], $item['uid'], Proxy::SIZE_THUMB)),
                        'owner_name'      => $this->getOwnerName(),
                        'plink'           => Item::getPlink($item),
-                       'browsershare'    => DI::l10n()->t('Share'),
+                       'browsershare'    => $browsershare,
                        'edpost'          => $edpost,
                        'ispinned'        => $ispinned,
                        'pin'             => $pin,