Updated URL Replace addon #1483

Merged
MrPetovan merged 18 commits from toddy/friendica-addons:2024.03-rc into 2024.03-rc 2024-03-19 18:00:46 +01:00
Showing only changes of commit a110b2f6c1 - Show all commits

View file

@ -89,7 +89,7 @@ function url_replace_addon_admin(string &$o)
$nitter_server,
DI::l10n()->t('Specify the URL with protocol. The default is %s.', URL_REPLACE_NITTER_DEFAULT),
null,
'placeholder="'.URL_REPLACE_NITTER_DEFAULT.'"',
'placeholder="' . URL_REPLACE_NITTER_DEFAULT . '"',
toddy marked this conversation as resolved Outdated

Code standards: Please wrap operators with spaces.

Code standards: Please wrap operators with spaces.
Outdated
Review

Strange, I did run bin/dev/php-cs-fixer/vendor/bin/php-cs-fixer for the file. However, I've seen that you've done some reformatting of my code as well in commit eeb783d71d -- I'm fine with that, but just out of curiosity: Could you please point me to the canonical configuration settings for PHP-CS-Fixer? I thought it's .php_cs.dist in the root directory, but when using that, my code does not get reformatted with spaces between operators.

Strange, I did run `bin/dev/php-cs-fixer/vendor/bin/php-cs-fixer` for the file. However, I've seen that you've done some reformatting of my code as well in commit https://git.friendi.ca/friendica/friendica-addons/commit/eeb783d71d713df23038102048284c6b170634cb -- I'm fine with that, but just out of curiosity: Could you please point me to the canonical configuration settings for PHP-CS-Fixer? I thought it's `.php_cs.dist` in the root directory, but when using that, my code does not get reformatted with spaces between operators.

Sorry about that, we're following the PSR-12 coding standards: https://www.php-fig.org/psr/psr-12/#62-binary-operators

I don't use PHP CS Fixer myself so I'd be hard-pressed to verify the configuration is correct.

Sorry about that, we're following the PSR-12 coding standards: https://www.php-fig.org/psr/psr-12/#62-binary-operators I don't use PHP CS Fixer myself so I'd be hard-pressed to verify the configuration is correct.
],
'$invidious_server_enabled' => [
'invidious_server_enabled',
@ -102,7 +102,7 @@ function url_replace_addon_admin(string &$o)
$invidious_server,
DI::l10n()->t('Specify the URL with protocol. The default is %s.', URL_REPLACE_INVIDIOUS_DEFAULT),
null,
'placeholder="'.URL_REPLACE_INVIDIOUS_DEFAULT.'"',
'placeholder="' . URL_REPLACE_INVIDIOUS_DEFAULT . '"',
],
'$proxigram_server_enabled' => [
'proxigram_server_enabled',
@ -115,7 +115,7 @@ function url_replace_addon_admin(string &$o)
$proxigram_server,
DI::l10n()->t('Specify the URL with protocol. The default is %s.', URL_REPLACE_PROXIGRAM_DEFAULT),
null,
'placeholder="'.URL_REPLACE_PROXIGRAM_DEFAULT.'"',
'placeholder="' . URL_REPLACE_PROXIGRAM_DEFAULT . '"',
],
'$twelvefeet_sites' => [
'twelvefeet_sites',
@ -136,8 +136,8 @@ function url_replace_render(array &$b)
{
$replacements = [];
$nitter_server = DI::config()->get('url_replace', 'nitter_server') ?? URL_REPLACE_NITTER_DEFAULT;
$nitter_server_enabled = DI::config()->get('url_replace', 'nitter_server_enabled', true);
$nitter_server = DI::config()->get('url_replace', 'nitter_server') ?? URL_REPLACE_NITTER_DEFAULT;
$nitter_server_enabled = DI::config()->get('url_replace', 'nitter_server_enabled') ?? true;
if ($nitter_server_enabled) {
$replacements = array_merge($replacements, [
'https://mobile.twitter.com' => $nitter_server,
@ -147,8 +147,8 @@ function url_replace_render(array &$b)
]);
}
$invidious_server = DI::config()->get('url_replace', 'invidious_server') ?? URL_REPLACE_INVIDIOUS_DEFAULT;
$invidious_server_enabled = DI::config()->get('url_replace', 'invidious_server_enabled', true);
$invidious_server = DI::config()->get('url_replace', 'invidious_server') ?? URL_REPLACE_INVIDIOUS_DEFAULT;
$invidious_server_enabled = DI::config()->get('url_replace', 'invidious_server_enabled') ?? true;
if ($invidious_server_enabled) {
$replacements = array_merge($replacements, [
'https://www.youtube.com' => $invidious_server,
@ -158,8 +158,8 @@ function url_replace_render(array &$b)
]);
}
$proxigram_server = DI::config()->get('url_replace', 'proxigram_server') ?? URL_REPLACE_PROXIGRAM_DEFAULT;
$proxigram_server_enabled = DI::config()->get('url_replace', 'proxigram_server_enabled', true);
$proxigram_server = DI::config()->get('url_replace', 'proxigram_server') ?? URL_REPLACE_PROXIGRAM_DEFAULT;
$proxigram_server_enabled = DI::config()->get('url_replace', 'proxigram_server_enabled') ?? true;
if ($proxigram_server_enabled) {
$replacements = array_merge($replacements, [
'https://www.instagram.com' => $proxigram_server,