mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-03 09:35:57 +02:00
[bridges] use constants instead of variable members
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
556b8a2452
commit
9a0da733ef
129 changed files with 834 additions and 834 deletions
|
@ -4,12 +4,12 @@ class GooglePlusPostBridge extends BridgeAbstract
|
|||
protected $_title;
|
||||
protected $_url;
|
||||
|
||||
public $maintainer = "Grummfy";
|
||||
public $name = "Google Plus Post Bridge";
|
||||
public $uri = "https://plus.google.com/";
|
||||
public $description = "Returns user public post (without API).";
|
||||
const MAINTAINER = "Grummfy";
|
||||
const NAME = "Google Plus Post Bridge";
|
||||
const URI = "https://plus.google.com/";
|
||||
const DESCRIPTION = "Returns user public post (without API).";
|
||||
|
||||
public $parameters = array( array(
|
||||
const PARAMETERS = array( array(
|
||||
'username'=>array(
|
||||
'name'=>'username or Id',
|
||||
'required'=>true
|
||||
|
@ -20,7 +20,7 @@ class GooglePlusPostBridge extends BridgeAbstract
|
|||
{
|
||||
// get content parsed
|
||||
// $html = $this->getSimpleHTMLDOM(__DIR__ . '/../posts2.html'
|
||||
$html = $this->getSimpleHTMLDOM($this->uri . urlencode($this->getInput('username')) . '/posts'
|
||||
$html = $this->getSimpleHTMLDOM(self::URI . urlencode($this->getInput('username')) . '/posts'
|
||||
// force language
|
||||
, false, stream_context_create(array('http'=> array(
|
||||
'header' => 'Accept-Language: fr,fr-be,fr-fr;q=0.8,en;q=0.4,en-us;q=0.2;*' . "\r\n"
|
||||
|
@ -48,7 +48,7 @@ class GooglePlusPostBridge extends BridgeAbstract
|
|||
// $item['title'] = $item['fullname'] = $post->find('header.lea', 0)->plaintext;
|
||||
$item['avatar'] = $post->find('div.ys img', 0)->src;
|
||||
// var_dump((($post->find('a.o-U-s', 0)->getAllAttributes())));
|
||||
$item['uri'] = $this->uri . $post->find('a.o-U-s', 0)->href;
|
||||
$item['uri'] = self::URI . $post->find('a.o-U-s', 0)->href;
|
||||
$item['timestamp'] = strtotime($post->find('a.o-U-s', 0)->plaintext);
|
||||
$this->items[] = $item;
|
||||
|
||||
|
@ -56,21 +56,21 @@ class GooglePlusPostBridge extends BridgeAbstract
|
|||
$hashtags = array();
|
||||
foreach($post->find('a.d-s') as $hashtag)
|
||||
{
|
||||
$hashtags[ trim($hashtag->plaintext) ] = $this->uri . $hashtag->href;
|
||||
$hashtags[ trim($hashtag->plaintext) ] = self::URI . $hashtag->href;
|
||||
}
|
||||
|
||||
$item['content'] = '';
|
||||
|
||||
// avatar display
|
||||
$item['content'] .= '<div style="float:left; margin: 0 0.5em 0.5em 0;"><a href="' . $this->uri . urlencode($this->getInput('username'));
|
||||
$item['content'] .= '<div style="float:left; margin: 0 0.5em 0.5em 0;"><a href="' . self::URI . urlencode($this->getInput('username'));
|
||||
$item['content'] .= '"><img align="top" alt="avatar" src="' . $item['avatar'].'" />' . $item['username'] . '</a></div>';
|
||||
|
||||
$content = $post->find('div.Al', 0);
|
||||
|
||||
// alter link
|
||||
// $content = $content->innertext;
|
||||
// $content = str_replace('href="./', 'href="' . $this->uri, $content);
|
||||
// $content = str_replace('href="photos', 'href="' . $this->uri . 'photos', $content);
|
||||
// $content = str_replace('href="./', 'href="' . self::URI, $content);
|
||||
// $content = str_replace('href="photos', 'href="' . self::URI . 'photos', $content);
|
||||
// XXX ugly but I don't have any idea how to do a better stuff, str_replace on link doesn't work as expected and ask too many checks
|
||||
foreach($content->find('a') as $link)
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ class GooglePlusPostBridge extends BridgeAbstract
|
|||
{
|
||||
$link->href = substr($link->href, 1);
|
||||
}
|
||||
$link->href = $this->uri . $link->href;
|
||||
$link->href = self::URI . $link->href;
|
||||
}
|
||||
}
|
||||
$content = $content->innertext;
|
||||
|
@ -107,7 +107,7 @@ class GooglePlusPostBridge extends BridgeAbstract
|
|||
|
||||
public function getURI()
|
||||
{
|
||||
return $this->_url ?: $this->uri;
|
||||
return $this->_url ?: self::URI;
|
||||
}
|
||||
|
||||
public function getCacheDuration()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue