Unified BBCode conversion, improved proxy functionality

This commit is contained in:
Michael 2023-07-15 20:12:08 +00:00
parent 81d2d4b70e
commit 8bb33dccd1
22 changed files with 61 additions and 35 deletions

View file

@ -78,7 +78,7 @@ class Show extends BaseApi
foreach ($profileFields as $profileField) {
$custom_fields[] = [
'label' => $profileField->label,
'value' => BBCode::convert($profileField->value, false, BBCode::TWITTER_API),
'value' => BBCode::convertForUriId($profileField->uriId, $profileField->value, BBCode::TWITTER_API),
];
}

View file

@ -58,7 +58,7 @@ class Babel extends BaseModule
'content' => visible_whitespace($plain)
];
$html = Text\BBCode::convert($bbcode);
$html = Text\BBCode::convertForUriId(0, $bbcode);
$results[] = [
'title' => DI::l10n()->t('BBCode::convert (raw HTML)'),
'content' => visible_whitespace($html)
@ -125,7 +125,7 @@ class Babel extends BaseModule
'title' => DI::l10n()->t('PageInfo::appendToBody'),
'content' => visible_whitespace($body2)
];
$html3 = Text\BBCode::convert($body2);
$html3 = Text\BBCode::convertForUriId(0, $body2);
$results[] = [
'title' => DI::l10n()->t('PageInfo::appendToBody => BBCode::convert (raw HTML)'),
'content' => visible_whitespace($html3)
@ -203,7 +203,7 @@ class Babel extends BaseModule
'content' => visible_whitespace($bbcode)
];
$html2 = Text\BBCode::convert($bbcode);
$html2 = Text\BBCode::convertForUriId(0, $bbcode);
$results[] = [
'title' => DI::l10n()->t('HTML::toBBCode => BBCode::convert'),
'content' => $html2

View file

@ -337,7 +337,7 @@ class Create extends BaseModule
'$contact' => $contact,
'$category' => $category,
'$rules' => $rules ?? [],
'$comment' => BBCode::convert($this->session->get('report_comment') ?? '', false, ),
'$comment' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $this->session->get('report_comment') ?? '', BBCode::EXTERNAL),
'$posts' => count($request['uri-ids']),
]);
}

View file

@ -147,7 +147,7 @@ class Introductions extends BaseNotifications
$knowyou = '';
}
$convertedName = BBCode::convert($Introduction->getName());
$convertedName = BBCode::convertForUriId($owner['uri-id'], $Introduction->getName());
$helptext = $this->t('Shall your connection be bidirectional or not?');
$helptext2 = $this->t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $convertedName, $convertedName);

View file

@ -150,7 +150,7 @@ class Register extends BaseModule
'$invite_label' => DI::l10n()->t('Your invitation code: '),
'$invite_id' => $invite_id,
'$regtitle' => DI::l10n()->t('Registration'),
'$registertext' => BBCode::convert(DI::config()->get('config', 'register_text', '')),
'$registertext' => BBCode::convertForUriId(User::getSystemUriId(), DI::config()->get('config', 'register_text', '')),
'$fillwith' => $fillwith,
'$fillext' => $fillext,
'$oidlabel' => $oidlabel,

View file

@ -27,6 +27,7 @@ use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Content\Text\BBCode;
use Friendica\Model\User;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
@ -98,9 +99,9 @@ class Tos extends BaseModule
return Renderer::replaceMacros($tpl, [
'$title' => $this->t('Terms of Service'),
'$tostext' => BBCode::convert($this->config->get('system', 'tostext')),
'$tostext' => BBCode::convertForUriId(User::getSystemUriId(), $this->config->get('system', 'tostext')),
'$rulestitle' => $this->t('Rules'),
'$rules' => BBCode::convert($rules),
'$rules' => BBCode::convertForUriId(User::getSystemUriId(), $rules),
'$displayprivstatement' => $this->config->get('system', 'tosprivstatement'),
'$privstatementtitle' => $this->t('Privacy Statement'),
'$privacy_operate' => $this->t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'),