]> git.mxchange.org Git - friendica.git/commitdiff
parse_url: Trim the content of the description field.
authorMichael Vogel <icarus@dabo.de>
Sun, 2 Mar 2014 00:00:36 +0000 (01:00 +0100)
committerMichael Vogel <icarus@dabo.de>
Sun, 2 Mar 2014 00:00:36 +0000 (01:00 +0100)
mod/parse_url.php

index 52083dfbcdb39dd071026cab32c5aa75fa492b32..e50c94fd07352d980b68e7a4535eb3bb13b1bba2 100644 (file)
@@ -86,7 +86,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false) {
                if (isset($oembed_data->title))
                        $siteinfo["title"] = $oembed_data->title;
                if (isset($oembed_data->description))
-                       $siteinfo["text"] = $oembed_data->description;
+                       $siteinfo["text"] = trim($oembed_data->description);
                if (isset($oembed_data->thumbnail_url))
                        $siteinfo["image"] = $oembed_data->thumbnail_url;
        }
@@ -159,7 +159,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false) {
                         foreach ($node->attributes as $attribute)
                                 $attr[$attribute->name] = $attribute->value;
 
-               $attr["content"] = html_entity_decode($attr["content"], ENT_QUOTES, "UTF-8");
+               $attr["content"] = trim(html_entity_decode($attr["content"], ENT_QUOTES, "UTF-8"));
 
                switch (strtolower($attr["name"])) {
                        case "fulltitle":
@@ -197,7 +197,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false) {
                         foreach ($node->attributes as $attribute)
                                 $attr[$attribute->name] = $attribute->value;
 
-               $attr["content"] = html_entity_decode($attr["content"], ENT_QUOTES, "UTF-8");
+               $attr["content"] = trim(html_entity_decode($attr["content"], ENT_QUOTES, "UTF-8"));
 
                switch (strtolower($attr["property"])) {
                        case "og:image":
@@ -280,7 +280,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false) {
                        while (strpos($text, "  "))
                                $text = trim(str_replace("  ", " ", $text));
 
-                       $siteinfo["text"] = html_entity_decode(substr($text,0,350), ENT_QUOTES, "UTF-8").'...';
+                       $siteinfo["text"] = trim(html_entity_decode(substr($text,0,350), ENT_QUOTES, "UTF-8").'...');
                }
        }