]> git.mxchange.org Git - friendica.git/commitdiff
limit the description of the meta tag to 160 characters in /mod/display
authorrabuzarus <>
Wed, 25 Jan 2017 12:10:42 +0000 (13:10 +0100)
committerrabuzarus <>
Wed, 25 Jan 2017 12:10:42 +0000 (13:10 +0100)
mod/display.php

index 115feb0ce52c84550b2d7e4b83442dd088e6670d..adbe7c67614c82ad444e08f962a9d36f39fb1c6b 100644 (file)
@@ -425,6 +425,12 @@ function display_content(App $a, $update = 0) {
                if ($title == "") {
                        $title = $author_name;
                }
+
+               // Limit the description to 160 characters
+               if (strlen($description) > 160) {
+                       $description = substr($description, 0, 157) . '...';
+               }
+
                $description = htmlspecialchars($description, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
                $title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
                $author_name = htmlspecialchars($author_name, ENT_COMPAT, 'UTF-8', true); // allow double encoding here