1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-10 18:44:04 +02:00

fix: a bunch of small changes in multiple bridges (#2644)

Mostly refactors.
This commit is contained in:
Dag
2022-04-12 23:37:30 +02:00
committed by GitHub
parent 5b7dd45b20
commit b6e8350596
12 changed files with 81 additions and 46 deletions

View File

@@ -9,7 +9,7 @@ class PillowfortBridge extends BridgeAbstract {
'name' => 'Username',
'type' => 'text',
'required' => true,
'exampleValue' => 'vaxis2',
'exampleValue' => 'SomniumAeterna',
),
'noava' => array(
'name' => 'Hide avatar',
@@ -39,6 +39,29 @@ class PillowfortBridge extends BridgeAbstract {
)
));
/**
* The Pillowfort bridge.
*
* Pillowfort pages are dynamically generated from a json file
* which holds the last 20 or so posts from the given user.
* This bridge uses that json file and HTML/CSS similar
* to the Twitter bridge for formatting.
*/
public function collectData() {
$jsonSite = getContents($this->getJSONURI());
$jsonFile = json_decode($jsonSite, true);
$posts = $jsonFile['posts'];
foreach($posts as $post) {
$item = $this->getItemFromPost($post);
//empty when 'noreblogs' is checked and current post is a reblog.
if(!empty($item))
$this->items[] = $item;
}
}
public function getName() {
$name = $this -> getUsername();
if($name != '')
@@ -56,7 +79,7 @@ class PillowfortBridge extends BridgeAbstract {
}
protected function getJSONURI() {
return $this -> getURI() . '/json';
return $this -> getURI() . '/json/?p=1';
}
protected function getUsername() {
@@ -196,27 +219,4 @@ EOD;
return $item;
}
/**
* The Pillowfort bridge.
*
* Pillowfort pages are dynamically generated from a json file
* which holds the last 20 or so posts from the given user.
* This bridge uses that json file and HTML/CSS similar
* to the Twitter bridge for formatting.
*/
public function collectData() {
$jsonSite = getContents($this -> getJSONURI());
$jsonFile = json_decode($jsonSite, true);
$posts = $jsonFile['posts'];
foreach($posts as $post) {
$item = $this->getItemFromPost($post);
//empty when 'noreblogs' is checked and current post is a reblog.
if(!empty($item))
$this->items[] = $item;
}
}
}