Merge pull request #782 from annando/lsr-pictures

Leistungsschutzrecht: Optionally suppress pictures
Ten commit jest zawarty w:
Hypolite Petovan 2018-12-17 17:20:30 -05:00 zatwierdzone przez GitHub
commit 9a06c525e9
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 23 dodań i 5 usunięć

Wyświetl plik

@ -0,0 +1,16 @@
Leistungsschutzrecht Addon
==========================
Main author Michael Vogel
This addon handles legal problems with the German link tax, named "Leistungsschutzrecht" by shortening preview texts.
Additionally it is possibly to suppress preview pictures completely to avoid any legal problems.
## configuration
If you want to suppress pictures in previews, add this to your global `config/addon.config.php`:
'leistungsschutzrecht' => [
'suppress_photos' => true,
],

Wyświetl plik

@ -24,22 +24,24 @@ function leistungsschutzrecht_uninstall() {
}
function leistungsschutzrecht_getsiteinfo($a, &$siteinfo) {
if (!isset($siteinfo["url"])) {
if (!isset($siteinfo["url"]) || empty($siteinfo['type'])) {
return;
}
// Avoid any third party pictures, to avoid copyright issues
if (($siteinfo['type'] != 'photo') && Config::get('leistungsschutzrecht', 'suppress_photos', false)) {
unset($siteinfo["image"]);
unset($siteinfo["images"]);
}
if (!leistungsschutzrecht_is_member_site($siteinfo["url"])) {
return;
}
//$siteinfo["title"] = $siteinfo["url"];
if (!empty($siteinfo["text"])) {
$siteinfo["text"] = leistungsschutzrecht_cuttext($siteinfo["text"]);
}
unset($siteinfo["image"]);
unset($siteinfo["images"]);
unset($siteinfo["keywords"]);
}