nitter/nitter.php aktualisiert

This commit is contained in:
loma-one 2024-01-23 08:15:24 +01:00
parent ebd54b2398
commit 1e13884a12
1 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,7 @@
<?php
/*
* Name: nitter
* Description: Replaces links to twitter.com an "x.com" to a nitter server in all displays of postings on a node.
* Description: Replaces links to twitter.com and "x.com" to a nitter server in all displays of postings on a node.
* Version: 2.1
* Author: Tobias Diekershoff <tobias@social.diekershoff.de>
*
@ -55,23 +55,23 @@ function nitter_addon_admin(string &$o)
}
/*
* replace "twitter.com" an "x.com" with "nitter.net"
* replace "twitter.com" and "x.com" with "nitter.net"
*/
function nitter_render(array &$b)
{
// this needs to be a system setting
$replaced = false;
$nitter = DI::config()->get('nitter', 'server', 'https://nitter.net');
if (strstr($b['html'], 'https://mobile.twitter.com')) {
$b['html'] = str_replace('https://mobile.twitter.com', $nitter, $b['html']);
if (strstr($b['html'], 'https://mobile.twitter.com/')) {
$b['html'] = str_replace('https://mobile.twitter.com/', $nitter, $b['html']);
$replaced = true;
}
if (strstr($b['html'], 'https://twitter.com')) {
$b['html'] = str_replace('https://twitter.com', $nitter, $b['html']);
if (strstr($b['html'], 'https://twitter.com/')) {
$b['html'] = str_replace('https://twitter.com/', $nitter, $b['html']);
$replaced = true;
}
if (strstr($b['html'], 'https://x.com')) {
$b['html'] = str_replace('https://x.com', $nitter, $b['html']);
if (strstr($b['html'], 'https://x.com/')) {
$b['html'] = str_replace('https://x.com/', $nitter, $b['html']);
$replaced = true;
}
if ($replaced) {