1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-13 03:54:04 +02:00

[core + bridges] add BridgeAbstract::$inputs and BridgeAbstract::getInput()

Inputs are not stored in BridgeAbstract::$parameters anymore to separate
static data from dynamic data.
The getInput method allows for more readable code.

Also fix an "undefined index 'global'" notice

Probability of breaking bridges: high !

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière
2016-08-28 01:25:33 +02:00
parent a4fd7b8b98
commit 1b3c8a8aeb
78 changed files with 303 additions and 385 deletions

View File

@@ -14,7 +14,6 @@ class FacebookBridge extends BridgeAbstract{
));
public function collectData(){
$param=$this->parameters[$this->queriedContext];
//Extract a string using start and end delimiters
function ExtractFromDelimiters($string, $start, $end) {
@@ -102,11 +101,11 @@ class FacebookBridge extends BridgeAbstract{
//Retrieve page contents
if (is_null($html)) {
if (isset($param['u']['value'])) {
if (!strpos($param['u']['value'], "/")) {
$html = $this->getSimpleHTMLDOM('https://www.facebook.com/'.urlencode($param['u']['value']).'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
if (isset($this->getInput('u'))) {
if (!strpos($this->getInput('u'), "/")) {
$html = $this->getSimpleHTMLDOM('https://www.facebook.com/'.urlencode($this->getInput('u')).'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
} else {
$html = $this->getSimpleHTMLDOM('https://www.facebook.com/pages/'.$param['u']['value'].'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
$html = $this->getSimpleHTMLDOM('https://www.facebook.com/pages/'.$this->getInput('u').'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
}
} else {
$this->returnClientError('You must specify a Facebook username.');
@@ -146,7 +145,7 @@ class FacebookBridge extends BridgeAbstract{
if(isset($element)) {
$author = str_replace(' | Facebook', '', $html->find('title#pageTitle', 0)->innertext);
$profilePic = 'https://graph.facebook.com/'.$param['u']['value'].'/picture?width=200&amp;height=200';
$profilePic = 'https://graph.facebook.com/'.$this->getInput('u').'/picture?width=200&amp;height=200';
$this->name = $author;
foreach($element->children() as $post) {
@@ -205,8 +204,8 @@ class FacebookBridge extends BridgeAbstract{
}
public function setDatas(array $param){
if (isset($param['captcha_response']['value']))
unset($param['captcha_response']['value']);
if (isset($this->getInput('captcha_response')))
unset($this->getInput('captcha_response'));
parent::setDatas($param);
}