Replaces links to twitter.com and x.com to a nitter server
Some links are now linked to x.com instead of twitter.com. The addon does not redirect the links to x.com yet. This will now be changed.
This commit is contained in:
parent
5a3dc93c0d
commit
31d6e74a19
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/*
|
||||
* Name: nitter
|
||||
* Description: Replaces links to twitter.com to a nitter server in all displays of postings on a node.
|
||||
* Version: 2.0
|
||||
* 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>
|
||||
*
|
||||
* Copyright (c) 2020 Tobias Diekershoff
|
||||
|
@ -55,7 +55,7 @@ function nitter_addon_admin(string &$o)
|
|||
}
|
||||
|
||||
/*
|
||||
* replace "twitter.com" with "nitter.net"
|
||||
* replace "twitter.com" an "x.com" with "nitter.net"
|
||||
*/
|
||||
function nitter_render(array &$b)
|
||||
{
|
||||
|
@ -70,7 +70,11 @@ function nitter_render(array &$b)
|
|||
$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']);
|
||||
$replaced = true;
|
||||
}
|
||||
if ($replaced) {
|
||||
$b['html'] .= '<hr><p><small>' . DI::l10n()->t('(Nitter addon enabled: Twitter links via %s)', $nitter) . '</small></p>';
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue