From 4c8de5fcfdfaa5b23e7a88a58cbfdca6ce97a4b1 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Wed, 25 Jan 2017 13:10:42 +0100 Subject: [PATCH] limit the description of the meta tag to 160 characters in /mod/display --- mod/display.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mod/display.php b/mod/display.php index 115feb0ce5..adbe7c6761 100644 --- a/mod/display.php +++ b/mod/display.php @@ -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 -- 2.39.5