Facebook: Clarify Facebook bridges (#1221)
* 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.
This commit is contained in:
parent
4c78721f03
commit
2ac44172ac
2 changed files with 27 additions and 11 deletions
|
@ -2,7 +2,7 @@
|
||||||
class FB2Bridge extends BridgeAbstract {
|
class FB2Bridge extends BridgeAbstract {
|
||||||
|
|
||||||
const MAINTAINER = 'teromene';
|
const MAINTAINER = 'teromene';
|
||||||
const NAME = 'Facebook Alternate';
|
const NAME = 'Facebook Bridge | Touch Site';
|
||||||
const URI = 'https://www.facebook.com/';
|
const URI = 'https://www.facebook.com/';
|
||||||
const CACHE_TIMEOUT = 1000;
|
const CACHE_TIMEOUT = 1000;
|
||||||
const DESCRIPTION = 'Input a page title or a profile log. For a profile log,
|
const DESCRIPTION = 'Input a page title or a profile log. For a profile log,
|
||||||
|
@ -12,7 +12,12 @@ class FB2Bridge extends BridgeAbstract {
|
||||||
'u' => array(
|
'u' => array(
|
||||||
'name' => 'Username',
|
'name' => 'Username',
|
||||||
'required' => true
|
'required' => true
|
||||||
)
|
),
|
||||||
|
'abbrev_name' => array(
|
||||||
|
'name' => 'Abbreviate author name in title',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'defaultValue' => true,
|
||||||
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
public function getIcon() {
|
public function getIcon() {
|
||||||
|
@ -102,7 +107,7 @@ EOD
|
||||||
else
|
else
|
||||||
$timestamp = 0;
|
$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);
|
. $content->find("div[class='_52jc _5qc4 _78cz _24u0 _36xo']", 0)->find('a', 0)->getAttribute('href'), ENT_QUOTES);
|
||||||
|
|
||||||
//Decode images
|
//Decode images
|
||||||
|
@ -182,8 +187,10 @@ EOD
|
||||||
$item['content'] = html_entity_decode($content, ENT_QUOTES);
|
$item['content'] = html_entity_decode($content, ENT_QUOTES);
|
||||||
|
|
||||||
$title = $author;
|
$title = $author;
|
||||||
if (strlen($title) > 24)
|
if ($this->getInput('abbrev_name') === true) {
|
||||||
$title = substr($title, 0, strpos(wordwrap($title, 24), "\n")) . '...';
|
if (strlen($title) > 24)
|
||||||
|
$title = substr($title, 0, strpos(wordwrap($title, 24), "\n")) . '...';
|
||||||
|
}
|
||||||
$title = $title . ' | ' . strip_tags($content);
|
$title = $title . ' | ' . strip_tags($content);
|
||||||
if (strlen($title) > 64)
|
if (strlen($title) > 64)
|
||||||
$title = substr($title, 0, strpos(wordwrap($title, 64), "\n")) . '...';
|
$title = substr($title, 0, strpos(wordwrap($title, 64), "\n")) . '...';
|
||||||
|
@ -281,10 +288,20 @@ EOD
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
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(){
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
class FacebookBridge extends BridgeAbstract {
|
class FacebookBridge extends BridgeAbstract {
|
||||||
|
|
||||||
const MAINTAINER = 'teromene, logmanoriginal';
|
const MAINTAINER = 'teromene, logmanoriginal';
|
||||||
const NAME = 'Facebook Bridge';
|
const NAME = 'Facebook Bridge | Main Site';
|
||||||
const URI = 'https://www.facebook.com/';
|
const URI = 'https://www.facebook.com/';
|
||||||
const CACHE_TIMEOUT = 300; // 5min
|
const CACHE_TIMEOUT = 300; // 5min
|
||||||
const DESCRIPTION = 'Input a page title or a profile log. For a profile log,
|
const DESCRIPTION = 'Input a page title or a profile log. For a profile log,
|
||||||
|
@ -66,14 +66,13 @@ class FacebookBridge extends BridgeAbstract {
|
||||||
|
|
||||||
case 'User':
|
case 'User':
|
||||||
if(!empty($this->authorName)) {
|
if(!empty($this->authorName)) {
|
||||||
return isset($this->extraInfos['name']) ? $this->extraInfos['name'] : $this->authorName
|
return isset($this->extraInfos['name']) ? $this->extraInfos['name'] : $this->authorName;
|
||||||
. ' - ' . static::NAME;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Group':
|
case 'Group':
|
||||||
if(!empty($this->groupName)) {
|
if(!empty($this->groupName)) {
|
||||||
return $this->groupName . ' - ' . static::NAME;
|
return $this->groupName;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue