mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-23 15:06:53 +00:00
Fix indent
This commit is contained in:
parent
cdca40c2bb
commit
21d81068ce
@ -1,18 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RssBridgeWordpress
|
* RssBridgeWordpress
|
||||||
* Returns the newest articles
|
* Returns the newest articles
|
||||||
*
|
*
|
||||||
* @name Wordpress Bridge
|
* @name Wordpress Bridge
|
||||||
* @description Returns the newest articles of a blog hosted on wordpress
|
* @description Returns the newest articles of a blog hosted on wordpress
|
||||||
* @use1(url="blog URL", name="blog name")
|
* @use1(url="blog URL", name="blog name")
|
||||||
*/
|
*/
|
||||||
class WordpressBridge extends BridgeAbstract{
|
class WordpressBridge extends BridgeAbstract {
|
||||||
|
|
||||||
private $url;
|
private $url;
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param) {
|
||||||
$this->processParams($param);
|
$this->processParams($param);
|
||||||
|
|
||||||
if (!$this->hasUrl()) {
|
if (!$this->hasUrl()) {
|
||||||
@ -21,11 +22,11 @@ class WordpressBridge extends BridgeAbstract{
|
|||||||
|
|
||||||
$html = file_get_html($this->url) or $this->returnError("Could not request {$this->url}.", 404);
|
$html = file_get_html($this->url) or $this->returnError("Could not request {$this->url}.", 404);
|
||||||
|
|
||||||
foreach($html->find('.post') as $article) {
|
foreach ($html->find('.post') as $article) {
|
||||||
$uri = $article->find('a',0)->href;
|
$uri = $article->find('a', 0)->href;
|
||||||
$this->items[] = $this->getDetails($uri);
|
$this->items[] = $this->getDetails($uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDetails($uri) {
|
private function getDetails($uri) {
|
||||||
$html = file_get_html($uri) or exit;
|
$html = file_get_html($uri) or exit;
|
||||||
@ -34,8 +35,8 @@ class WordpressBridge extends BridgeAbstract{
|
|||||||
|
|
||||||
$article = $html->find('.post', 0);
|
$article = $html->find('.post', 0);
|
||||||
$item->uri = $uri;
|
$item->uri = $uri;
|
||||||
$item->title = $article->find('h1',0)->innertext;
|
$item->title = $article->find('h1', 0)->innertext;
|
||||||
$item->content = $this->clearContent($article->find('.entry-content,.entry',0)->innertext);
|
$item->content = $this->clearContent($article->find('.entry-content,.entry', 0)->innertext);
|
||||||
$item->timestamp = $this->getDate($uri);
|
$item->timestamp = $this->getDate($uri);
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
@ -52,26 +53,26 @@ class WordpressBridge extends BridgeAbstract{
|
|||||||
return $date->format('U');
|
return $date->format('U');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() {
|
||||||
return "{$this->name} - Wordpress.com Bridge";
|
return "{$this->name} - Wordpress.com Bridge";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURI(){
|
public function getURI() {
|
||||||
return $this->url;
|
return $this->url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration() {
|
||||||
return 21600; // 6 hours
|
return 21600; // 6 hours
|
||||||
}
|
}
|
||||||
|
|
||||||
private function hasUrl(){
|
private function hasUrl() {
|
||||||
if (empty($this->url)){
|
if (empty($this->url)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function processParams($param){
|
private function processParams($param) {
|
||||||
$this->url = $param['url'];
|
$this->url = $param['url'];
|
||||||
$this->name = $param['name'];
|
$this->name = $param['name'];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user