Leistungsschutzrecht: Optionally suppress pictures #782

Merged
annando merged 2 commits from lsr-pictures into 2018.12-rc 2018-12-17 23:20:30 +01:00
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"]);
}