From 02eb1b74f748f40f6d9d4ba2aec87da9f707dbf2 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 1 Apr 2018 02:32:58 -0400 Subject: [PATCH] [showmore] Prevent use with content filters --- showmore/showmore.php | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) 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') . '' . + ''; } } -- 2.39.5