From f4e3de4a16d043e2dfdfdb8489b0e764bf1d5e57 Mon Sep 17 00:00:00 2001 From: triatic <42704418+triatic@users.noreply.github.com> Date: Wed, 14 Nov 2018 23:59:34 +0000 Subject: [PATCH 1/3] [FacebookBridge] Better titles A slightly improved version of #454 and #468 . Build titles from content rather than author + pre-content (which doesn't reflect anything useful). --- bridges/FacebookBridge.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index ab39c10e39d..9efeff4983e 100644 --- a/bridges/FacebookBridge.php +++ b/bridges/FacebookBridge.php @@ -659,16 +659,10 @@ private function collectUserData(){ $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); - + // Build title from content + $title = strip_tags($post->find('.userContent')[0]->innertext); if(strlen($title) > 64) - $title = substr($title, 0, strpos(wordwrap($title, 64), "\n")) . '...'; + $title = substr($title, 0, 64) . '...'; $uri = $post->find('abbr')[0]->parent()->getAttribute('href'); From df085cefea3c2aa627c487666b80d7995a675d9b Mon Sep 17 00:00:00 2001 From: LogMANOriginal Date: Thu, 15 Nov 2018 21:41:02 +0000 Subject: [PATCH 2/3] Update bridges/FacebookBridge.php Co-Authored-By: triatic <42704418+triatic@users.noreply.github.com> --- bridges/FacebookBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index 9efeff4983e..af62e0efff9 100644 --- a/bridges/FacebookBridge.php +++ b/bridges/FacebookBridge.php @@ -660,7 +660,7 @@ private function collectUserData(){ } // Build title from content - $title = strip_tags($post->find('.userContent')[0]->innertext); + $title = strip_tags($post->find('.userContent', 0)->innertext); if(strlen($title) > 64) $title = substr($title, 0, 64) . '...'; From 65a780563208ca1a5c5fff96f1d500e28083f6fd Mon Sep 17 00:00:00 2001 From: LogMANOriginal Date: Thu, 15 Nov 2018 21:41:09 +0000 Subject: [PATCH 3/3] Update bridges/FacebookBridge.php Co-Authored-By: triatic <42704418+triatic@users.noreply.github.com> --- bridges/FacebookBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index af62e0efff9..070aa897075 100644 --- a/bridges/FacebookBridge.php +++ b/bridges/FacebookBridge.php @@ -662,7 +662,7 @@ private function collectUserData(){ // Build title from content $title = strip_tags($post->find('.userContent', 0)->innertext); if(strlen($title) > 64) - $title = substr($title, 0, 64) . '...'; + $title = substr($title, 0, strpos(wordwrap($title, 64), "\n")) . '...'; $uri = $post->find('abbr')[0]->parent()->getAttribute('href');