X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=showmore%2Fshowmore.php;h=e39acdeea60cd2498bfd8baafe674f410663af44;hb=eaf1a2e61854bdd25f2741b94d8a4ebf7131fcee;hp=89cec83d4d6dc75590c3eb356ef8eadeed12762c;hpb=8f7503d573ad90e8150b1f288b5e9c09f9479c2a;p=friendica-addons.git 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') . '' . + ''; } }