[bridges] use constants instead of variable members

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-08-30 11:23:55 +02:00
parent 556b8a2452
commit 9a0da733ef
129 changed files with 834 additions and 834 deletions

View file

@ -1,12 +1,12 @@
<?php
class FacebookBridge extends BridgeAbstract{
public $maintainer = "teromene";
public $name = "Facebook";
public $uri = "https://www.facebook.com/";
public $description = "Input a page title or a profile log. For a profile log, please insert the parameter as follow : myExamplePage/132621766841117";
const MAINTAINER = "teromene";
const NAME = "Facebook";
const URI = "https://www.facebook.com/";
const DESCRIPTION = "Input a page title or a profile log. For a profile log, please insert the parameter as follow : myExamplePage/132621766841117";
public $parameters =array( array(
const PARAMETERS =array( array(
'u'=>array(
'name'=>'Username',
'required'=>true
@ -31,7 +31,7 @@ class FacebookBridge extends BridgeAbstract{
if (is_array($matches) && count($matches) > 1) {
$link = $matches[1];
if (strpos($link, '/') === 0)
$link = $this->uri.$link.'"';
$link = self::URI.$link.'"';
if (strpos($link, 'facebook.com/l.php?u=') !== false)
$link = urldecode(ExtractFromDelimiters($link, 'facebook.com/l.php?u=', '&'));
return ' href="'.$link.'"';
@ -104,10 +104,10 @@ class FacebookBridge extends BridgeAbstract{
//Retrieve page contents
if (is_null($html)) {
if (!strpos($this->getInput('u'), "/")) {
$html = $this->getSimpleHTMLDOM($this->uri.urlencode($this->getInput('u')).'?_fb_noscript=1')
$html = $this->getSimpleHTMLDOM(self::URI.urlencode($this->getInput('u')).'?_fb_noscript=1')
or $this->returnServerError('No results for this query.');
} else {
$html = $this->getSimpleHTMLDOM($this->uri.'pages/'.$this->getInput('u').'?_fb_noscript=1')
$html = $this->getSimpleHTMLDOM(self::URI.'pages/'.$this->getInput('u').'?_fb_noscript=1')
or $this->returnServerError('No results for this query.');
}
}
@ -123,7 +123,7 @@ class FacebookBridge extends BridgeAbstract{
foreach ($captcha->find('input, button') as $input)
$captcha_fields[$input->name] = $input->value;
$_SESSION['captcha_fields'] = $captcha_fields;
$_SESSION['captcha_action'] = $this->uri.$captcha->find('form', 0)->action;
$_SESSION['captcha_action'] = self::URI.$captcha->find('form', 0)->action;
//Show captcha filling form to the viewer, proxying the captcha image
$img = base64_encode($this->getContents($captcha->find('img', 0)->src));
@ -192,7 +192,7 @@ class FacebookBridge extends BridgeAbstract{
$title = substr($title, 0, strpos(wordwrap($title, 64), "\n")).'...';
//Build and add final item
$item['uri'] = $this->uri.$post->find('abbr')[0]->parent()->getAttribute('href');
$item['uri'] = self::URI.$post->find('abbr')[0]->parent()->getAttribute('href');
$item['content'] = $content;
$item['title'] = $title;
$item['author'] = $author;