From 7edf8a72774b2d821a717d305d66f26ecaef659d Mon Sep 17 00:00:00 2001 From: rWatcher Date: Fri, 31 Jul 2009 15:13:13 -0400 Subject: [PATCH] Updated MetaDescription module with klp29's suggestions. --- .../views/metadescription_block.html.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/metadescription/views/metadescription_block.html.php b/modules/metadescription/views/metadescription_block.html.php index 665eb9dc..c4a5cb87 100644 --- a/modules/metadescription/views/metadescription_block.html.php +++ b/modules/metadescription/views/metadescription_block.html.php @@ -11,6 +11,19 @@ } } } + + $metaDescription = ""; + $metaDescription = trim(nl2br(p::purify($item->description))); + // If description is empty, use title instead. + if ($metaDescription == "") { + $metaDescription = p::clean($item->title); + } + // Strip HTML + $metaDescription = strip_tags($metaDescription); + // Strip Line Breaks + $metaDescription = str_replace("\n", " ", $metaDescription); + // Limit Description to 150 characters. + $metaDescription = substr($metaDescription, 0,150); ?> - +