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.pull/1460/head
parent
5a3dc93c0d
commit
31d6e74a19
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Name: nitter
|
* Name: nitter
|
||||||
* Description: Replaces links to twitter.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.0
|
* Version: 2.1
|
||||||
* Author: Tobias Diekershoff <tobias@social.diekershoff.de>
|
* Author: Tobias Diekershoff <tobias@social.diekershoff.de>
|
||||||
*
|
*
|
||||||
* Copyright (c) 2020 Tobias Diekershoff
|
* 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)
|
function nitter_render(array &$b)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,11 @@ function nitter_render(array &$b)
|
||||||
$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')) {
|
||||||
|
$b['html'] = str_replace('https://x.com', $nitter, $b['html']);
|
||||||
|
$replaced = true;
|
||||||
|
}
|
||||||
if ($replaced) {
|
if ($replaced) {
|
||||||
$b['html'] .= '<hr><p><small>' . DI::l10n()->t('(Nitter addon enabled: Twitter links via %s)', $nitter) . '</small></p>';
|
$b['html'] .= '<hr><p><small>' . DI::l10n()->t('(Nitter addon enabled: Twitter links via %s)', $nitter) . '</small></p>';
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue