From: Hypolite Petovan Date: Sun, 1 Apr 2018 06:32:58 +0000 (-0400) Subject: [showmore] Prevent use with content filters X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=02eb1b74f748f40f6d9d4ba2aec87da9f707dbf2;p=friendica-addons.git [showmore] Prevent use with content filters --- diff --git a/showmore/showmore.php b/showmore/showmore.php index 89cec83d..e39acdee 100644 --- a/showmore/showmore.php +++ b/showmore/showmore.php @@ -107,26 +107,32 @@ function get_body_length($body) { return strlen($string); } -function showmore_prepare_body(&$a,&$b) { +function showmore_prepare_body(\Friendica\App $a, &$hook_data) +{ + // No combination with content filters + if (!empty($hook_data['filter_reasons'])) { + return; + } - $words = null; - if(PConfig::get(local_user(),'showmore','disable')) + if (PConfig::get(local_user(), 'showmore', 'disable')) { return; + } - $chars = (int)PConfig::get(local_user(),'showmore','chars'); - if(!$chars) + $chars = (int) PConfig::get(local_user(), 'showmore', 'chars'); + if (!$chars) { $chars = 1100; + } - if (get_body_length($b['html']) > $chars) { + if (get_body_length($hook_data['html']) > $chars) { $found = true; - $shortened = trim(showmore_cutitem($b['html'], $chars))."..."; + $shortened = trim(showmore_cutitem($hook_data['html'], $chars)) . "..."; } - if($found) { + if ($found) { $rnd = random_string(8); - $b['html'] = ''.$shortened." ". - ''.L10n::t('show more').''. - ''; + $hook_data['html'] = '' . $shortened . " " . + '' . L10n::t('show more') . '' . + ''; } }