mirror of
https://github.com/friendica/friendica
synced 2025-04-30 00:24:24 +02:00
Merge branch 'develop' into rewrite/gravity-constants
This commit is contained in:
commit
26e0469de7
181 changed files with 2408 additions and 2405 deletions
|
@ -261,7 +261,7 @@ class Conversation
|
|||
break;
|
||||
}
|
||||
|
||||
$expanded .= "\t" . '<p class="wall-item-' . $verb . '-expanded" id="' . $verb . 'list-' . $id . '" style="display: none;" >' . $explikers . EOL . '</p>';
|
||||
$expanded .= "\t" . '<p class="wall-item-' . $verb . '-expanded" id="' . $verb . 'list-' . $id . '" style="display: none;" >' . $explikers . '</p>';
|
||||
}
|
||||
|
||||
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('voting_fakelink.tpl'), [
|
||||
|
@ -328,7 +328,7 @@ class Conversation
|
|||
$created_at = '';
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate("jot.tpl");
|
||||
$tpl = Renderer::getMarkupTemplate('jot.tpl');
|
||||
|
||||
$o .= Renderer::replaceMacros($tpl, [
|
||||
'$new_post' => $this->l10n->t('New Post'),
|
||||
|
@ -393,7 +393,8 @@ class Conversation
|
|||
'$message' => $this->l10n->t('Message'),
|
||||
'$browser' => $this->l10n->t('Browser'),
|
||||
|
||||
'$compose_link_title' => $this->l10n->t('Open Compose page'),
|
||||
'$compose_link_title' => $this->l10n->t('Open Compose page'),
|
||||
'$always_open_compose' => $this->pConfig->get(local_user(), 'frio', 'always_open_compose', false),
|
||||
]);
|
||||
|
||||
|
||||
|
|
|
@ -574,9 +574,10 @@ class Item
|
|||
*
|
||||
* @param string $url
|
||||
* @param integer $uid
|
||||
* @param bool $add_media
|
||||
* @return string
|
||||
*/
|
||||
public function createSharedPostByUrl(string $url, int $uid = 0): string
|
||||
public function createSharedPostByUrl(string $url, int $uid = 0, bool $add_media = false): string
|
||||
{
|
||||
if (!empty($uid)) {
|
||||
$id = ModelItem::searchByLink($url, $uid);
|
||||
|
@ -599,7 +600,7 @@ class Item
|
|||
return '';
|
||||
}
|
||||
|
||||
return $this->createSharedBlockByArray($shared_item);
|
||||
return $this->createSharedBlockByArray($shared_item, $add_media);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -607,9 +608,10 @@ class Item
|
|||
*
|
||||
* @param integer $UriId
|
||||
* @param integer $uid
|
||||
* @param bool $add_media
|
||||
* @return string
|
||||
*/
|
||||
public function createSharedPostByUriId(int $UriId, int $uid = 0): string
|
||||
public function createSharedPostByUriId(int $UriId, int $uid = 0, bool $add_media = false): string
|
||||
{
|
||||
$fields = ['uri-id', 'uri', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink', 'network'];
|
||||
$shared_item = Post::selectFirst($fields, ['uri-id' => $UriId, 'uid' => [$uid, 0], 'private' => [ModelItem::PUBLIC, ModelItem::UNLISTED]]);
|
||||
|
@ -618,7 +620,7 @@ class Item
|
|||
return '';
|
||||
}
|
||||
|
||||
return $this->createSharedBlockByArray($shared_item);
|
||||
return $this->createSharedBlockByArray($shared_item, $add_media);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -626,9 +628,10 @@ class Item
|
|||
*
|
||||
* @param string $guid
|
||||
* @param integer $uid
|
||||
* @param bool $add_media
|
||||
* @return string
|
||||
*/
|
||||
public function createSharedPostByGuid(string $guid, int $uid = 0, string $host = ''): string
|
||||
public function createSharedPostByGuid(string $guid, int $uid = 0, string $host = '', bool $add_media = false): string
|
||||
{
|
||||
$fields = ['uri-id', 'uri', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink', 'network'];
|
||||
$shared_item = Post::selectFirst($fields, ['guid' => $guid, 'uid' => [$uid, 0], 'private' => [ModelItem::PUBLIC, ModelItem::UNLISTED]]);
|
||||
|
@ -645,16 +648,17 @@ class Item
|
|||
return '';
|
||||
}
|
||||
|
||||
return $this->createSharedBlockByArray($shared_item);
|
||||
return $this->createSharedBlockByArray($shared_item, $add_media);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a share block for the given item array
|
||||
*
|
||||
* @param array $item
|
||||
* @param bool $add_media
|
||||
* @return string
|
||||
*/
|
||||
public function createSharedBlockByArray(array $item): string
|
||||
public function createSharedBlockByArray(array $item, bool $add_media = false): string
|
||||
{
|
||||
if ($item['network'] == Protocol::FEED) {
|
||||
return PageInfo::getFooterFromUrl($item['plink']);
|
||||
|
@ -662,6 +666,8 @@ class Item
|
|||
$item['guid'] = '';
|
||||
$item['uri'] = '';
|
||||
$item['body'] = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
|
||||
} elseif ($add_media) {
|
||||
$item['body'] = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
|
||||
}
|
||||
|
||||
$shared_content = BBCode::getShareOpeningTag($item['author-name'], $item['author-link'], $item['author-avatar'], $item['plink'], $item['created'], $item['guid'], $item['uri']);
|
||||
|
@ -674,7 +680,7 @@ class Item
|
|||
|
||||
// If it is a reshared post then reformat it to avoid display problems with two share elements
|
||||
if (Diaspora::isReshare($item['body'], false)) {
|
||||
if (!empty($shared['guid']) && ($encaspulated_share = self::createSharedPostByGuid($shared['guid']))) {
|
||||
if (!empty($shared['guid']) && ($encaspulated_share = self::createSharedPostByGuid($shared['guid'], 0, '', $add_media))) {
|
||||
$item['body'] = preg_replace("/\[share.*?\](.*)\[\/share\]/ism", $encaspulated_share, $item['body']);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\DI;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Conversation\Community;
|
||||
|
||||
class Nav
|
||||
{
|
||||
|
@ -251,8 +252,8 @@ class Nav
|
|||
}
|
||||
}
|
||||
|
||||
if ((local_user() || DI::config()->get('system', 'community_page_style') != CP_NO_COMMUNITY_PAGE) &&
|
||||
!(DI::config()->get('system', 'community_page_style') == CP_NO_INTERNAL_COMMUNITY)) {
|
||||
if ((local_user() || DI::config()->get('system', 'community_page_style') != Community::DISABLED_VISITOR) &&
|
||||
!(DI::config()->get('system', 'community_page_style') == Community::DISABLED)) {
|
||||
$nav['community'] = ['community', DI::l10n()->t('Community'), '', DI::l10n()->t('Conversations on this and other servers')];
|
||||
}
|
||||
|
||||
|
|
|
@ -1069,6 +1069,38 @@ class BBCode
|
|||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the share block with a link
|
||||
*
|
||||
* @param string $body
|
||||
* @return string
|
||||
*/
|
||||
public static function replaceSharedData(string $body): string
|
||||
{
|
||||
return BBCode::convertShare(
|
||||
$body,
|
||||
function (array $attributes) {
|
||||
return '♲ ' . $attributes['link'];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the share block
|
||||
*
|
||||
* @param string $body
|
||||
* @return string
|
||||
*/
|
||||
public static function removeSharedData(string $body): string
|
||||
{
|
||||
return BBCode::convertShare(
|
||||
$body,
|
||||
function (array $attributes) {
|
||||
return '';
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function converts a [share] block to text according to a provided callback function whose signature is:
|
||||
*
|
||||
|
@ -1118,7 +1150,7 @@ class BBCode
|
|||
);
|
||||
|
||||
DI::profiler()->stopRecording();
|
||||
return $return;
|
||||
return trim($return);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue