Merge pull request #782 from annando/lsr-pictures

Leistungsschutzrecht: Optionally suppress pictures
This commit is contained in:
Hypolite Petovan 2018-12-17 17:20:30 -05:00 committed by GitHub
commit 9a06c525e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 5 deletions

View File

@ -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,
],

View File

@ -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"]);
}