From c6b15e10ccd0730f2d6132a89d168ebb56fd1ec8 Mon Sep 17 00:00:00 2001 From: Pellaeon Lin Date: Fri, 13 Jan 2017 10:00:42 +0800 Subject: [PATCH] Better way to build title, from content --- bridges/FacebookBridge.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index 5c7b898add5..b34b748f46d 100644 --- a/bridges/FacebookBridge.php +++ b/bridges/FacebookBridge.php @@ -184,13 +184,8 @@ function ExtractFromDelimiters($string, $start, $end) { $date = 0; } - //Build title from username and content - $title = $author; - if (strlen($title) > 24) - $title = substr($title, 0, strpos(wordwrap($title, 24), "\n")).'...'; - $title = $title.' | '.strip_tags($content); - if (strlen($title) > 64) - $title = substr($title, 0, strpos(wordwrap($title, 64), "\n")).'...'; + //Build title from content + $title = mb_substr(strip_tags($post->find('.userContent > p')[0]->innertext), 0, 20).'...'; //Build and add final item $item['uri'] = self::URI.$post->find('abbr')[0]->parent()->getAttribute('href');