X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=showmore%2Fshowmore.php;h=c0f581ec724a6d8afd0c8b940401df4e5f5fbb82;hb=9e025b4771629487d9db91e32bf2a31b80eb93da;hp=277c29ced5c380a9af00976d68ab3b6761d1c5ec;hpb=c95713b19c35eff74052bf248bfc1025d5d9161b;p=friendica-addons.git diff --git a/showmore/showmore.php b/showmore/showmore.php index 277c29ce..c0f581ec 100644 --- a/showmore/showmore.php +++ b/showmore/showmore.php @@ -18,13 +18,6 @@ function showmore_install() Hook::register('addon_settings_post', 'addon/showmore/showmore.php', 'showmore_addon_settings_post'); } -function showmore_uninstall() -{ - Hook::unregister('prepare_body', 'addon/showmore/showmore.php', 'showmore_prepare_body'); - Hook::unregister('addon_settings', 'addon/showmore/showmore.php', 'showmore_addon_settings'); - Hook::unregister('addon_settings_post', 'addon/showmore/showmore.php', 'showmore_addon_settings_post'); -} - function showmore_addon_settings(&$a, &$s) { if (!local_user()) { @@ -73,7 +66,6 @@ function showmore_addon_settings_post(&$a, &$b) $enable = (!empty($_POST['showmore-enable']) ? intval($_POST['showmore-enable']) : 0); $disable = 1-$enable; DI::pConfig()->set(local_user(), 'showmore', 'disable', $disable); - info(DI::l10n()->t('Show More Settings saved.') . EOL); } } @@ -89,8 +81,9 @@ function get_body_length($body) // We need to get rid of hidden tags (display: none) // Get rid of the warning. It would be better to have some valid html as input - $dom = @DomDocument::loadHTML($body); - $xpath = new DOMXPath($dom); + $doc = new DOMDocument(); + @$doc->loadHTML($body); + $xpath = new DOMXPath($doc); /* * Checking any possible syntax of the style attribute with xpath is impossible @@ -104,7 +97,7 @@ function get_body_length($body) } } // Now we can get the body of our HTML DomDocument, it contains only what is visible - $string = $dom->saveHTML(); + $string = $doc->saveHTML(); $string = strip_tags($string); return strlen($string);