Skip to content

Commit

Permalink
Facebook: Clarify Facebook bridges (RSS-Bridge#1221)
Browse files Browse the repository at this point in the history
* Clarify Facebook bridges status

Distinguish between both Facebook bridges by their title.
This preserves all existing URLs.

* Update all URLs to secure HTTPS versions.
* Configure author name abbreviation
* Improve feed names

Use the correct feed name on each bridge.
Make sure the feed names don't repeat the "Facebook" name.
  • Loading branch information
somini authored and logmanoriginal committed Oct 28, 2019
1 parent 3b3fc39 commit 3c53943
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
31 changes: 24 additions & 7 deletions bridges/FB2Bridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class FB2Bridge extends BridgeAbstract {

const MAINTAINER = 'teromene';
const NAME = 'Facebook Alternate';
const NAME = 'Facebook Bridge | Touch Site';
const URI = 'https://www.facebook.com/';
const CACHE_TIMEOUT = 1000;
const DESCRIPTION = 'Input a page title or a profile log. For a profile log,
Expand All @@ -12,7 +12,12 @@ class FB2Bridge extends BridgeAbstract {
'u' => array(
'name' => 'Username',
'required' => true
)
),
'abbrev_name' => array(
'name' => 'Abbreviate author name in title',
'type' => 'checkbox',
'defaultValue' => true,
),
));

public function getIcon() {
Expand Down Expand Up @@ -102,7 +107,7 @@ public function collectData(){
else
$timestamp = 0;

$item['uri'] = html_entity_decode('http://touch.facebook.com'
$item['uri'] = html_entity_decode('https://touch.facebook.com'
. $content->find("div[class='_52jc _5qc4 _78cz _24u0 _36xo']", 0)->find('a', 0)->getAttribute('href'), ENT_QUOTES);

//Decode images
Expand Down Expand Up @@ -182,8 +187,10 @@ public function collectData(){
$item['content'] = html_entity_decode($content, ENT_QUOTES);

$title = $author;
if (strlen($title) > 24)
$title = substr($title, 0, strpos(wordwrap($title, 24), "\n")) . '...';
if ($this->getInput('abbrev_name') === true) {
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")) . '...';
Expand Down Expand Up @@ -281,10 +288,20 @@ private function getPageInfos($page, $cookies){
}

public function getName(){
return (isset($this->name) ? $this->name . ' - ' : '') . 'Facebook Bridge';
$username = $this->getInput('u');
if (isset($username)) {
return $this->getInput('u') . ' | Facebook';
} else {
return self::NAME;
}
}

public function getURI(){
return 'http://facebook.com';
$username = $this->getInput('u');
if (isset($username)) {
return 'https://facebook.com/' . $this->getInput('u') . '/posts';
} else {
return self::URI;
}
}
}
7 changes: 3 additions & 4 deletions bridges/FacebookBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class FacebookBridge extends BridgeAbstract {

const MAINTAINER = 'teromene, logmanoriginal';
const NAME = 'Facebook Bridge';
const NAME = 'Facebook Bridge | Main Site';
const URI = 'https://www.facebook.com/';
const CACHE_TIMEOUT = 300; // 5min
const DESCRIPTION = 'Input a page title or a profile log. For a profile log,
Expand Down Expand Up @@ -66,14 +66,13 @@ public function getName(){

case 'User':
if(!empty($this->authorName)) {
return isset($this->extraInfos['name']) ? $this->extraInfos['name'] : $this->authorName
. ' - ' . static::NAME;
return isset($this->extraInfos['name']) ? $this->extraInfos['name'] : $this->authorName;
}
break;

case 'Group':
if(!empty($this->groupName)) {
return $this->groupName . ' - ' . static::NAME;
return $this->groupName;
}
break;

Expand Down

0 comments on commit 3c53943

Please sign in to comment.