nitter/nitter.php aktualisiert
This commit is contained in:
parent
ebd54b2398
commit
1e13884a12
1 changed files with 8 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Name: nitter
|
* 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
|
* Version: 2.1
|
||||||
* Author: Tobias Diekershoff <tobias@social.diekershoff.de>
|
* 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)
|
function nitter_render(array &$b)
|
||||||
{
|
{
|
||||||
// this needs to be a system setting
|
// this needs to be a system setting
|
||||||
$replaced = false;
|
$replaced = false;
|
||||||
$nitter = DI::config()->get('nitter', 'server', 'https://nitter.net');
|
$nitter = DI::config()->get('nitter', 'server', 'https://nitter.net');
|
||||||
if (strstr($b['html'], 'https://mobile.twitter.com')) {
|
if (strstr($b['html'], 'https://mobile.twitter.com/')) {
|
||||||
$b['html'] = str_replace('https://mobile.twitter.com', $nitter, $b['html']);
|
$b['html'] = str_replace('https://mobile.twitter.com/', $nitter, $b['html']);
|
||||||
$replaced = true;
|
$replaced = true;
|
||||||
}
|
}
|
||||||
if (strstr($b['html'], 'https://twitter.com')) {
|
if (strstr($b['html'], 'https://twitter.com/')) {
|
||||||
$b['html'] = str_replace('https://twitter.com', $nitter, $b['html']);
|
$b['html'] = str_replace('https://twitter.com/', $nitter, $b['html']);
|
||||||
$replaced = true;
|
$replaced = true;
|
||||||
}
|
}
|
||||||
if (strstr($b['html'], 'https://x.com')) {
|
if (strstr($b['html'], 'https://x.com/')) {
|
||||||
$b['html'] = str_replace('https://x.com', $nitter, $b['html']);
|
$b['html'] = str_replace('https://x.com/', $nitter, $b['html']);
|
||||||
$replaced = true;
|
$replaced = true;
|
||||||
}
|
}
|
||||||
if ($replaced) {
|
if ($replaced) {
|
||||||
|
|
Loading…
Reference in a new issue