Correction de quelques problèmes avec RSSExpander suite à la migration dans lib/Bridge.
Correction de typos. Ajout de la possibilité d'utiliser un proxy.
This commit is contained in:
parent
e582c887fb
commit
1a4a428449
6 changed files with 37 additions and 22 deletions
lib
|
@ -39,7 +39,7 @@ abstract class BridgeAbstract implements BridgeInterface{
|
|||
}
|
||||
|
||||
/**
|
||||
* Return datas store in the bridge
|
||||
* Return datas stored in the bridge
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDatas(){
|
||||
|
@ -50,7 +50,7 @@ abstract class BridgeAbstract implements BridgeInterface{
|
|||
|
||||
/**
|
||||
* Defined datas with parameters depending choose bridge
|
||||
* Note : you can defined a cache before with "setCache"
|
||||
* Note : you can define a cache before with "setCache"
|
||||
* @param array $param $_REQUEST, $_GET, $_POST, or array with bridge expected paramters
|
||||
*/
|
||||
public function setDatas(array $param){
|
||||
|
@ -90,16 +90,6 @@ abstract class BridgeAbstract implements BridgeInterface{
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default image SRC attribute to point on given server when none is provided (that's to say when image src starts with '/'
|
||||
*/
|
||||
public function defaultImageSrcTo($content, $server) {
|
||||
foreach($content->find('img') as $image) {
|
||||
if(strpos($image->src, '/')==0) {
|
||||
$image->src = $server.$image->src;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -311,7 +301,7 @@ abstract class RssExpander extends HttpCachingBridgeAbstract{
|
|||
|
||||
public function collectExpandableDatas(array $param, $name){
|
||||
if (empty($name)) {
|
||||
$this->returnError('There is no $param[\'url\'] for this RSS expander', 404);
|
||||
$this->returnError('There is no $name for this RSS expander', 404);
|
||||
}
|
||||
// $this->message("Loading from ".$param['url']);
|
||||
// Notice WE DO NOT use cache here on purpose : we want a fresh view of the RSS stream each time
|
||||
|
@ -363,3 +353,20 @@ abstract class RssExpander extends HttpCachingBridgeAbstract{
|
|||
return $this->description;
|
||||
}
|
||||
}
|
||||
|
||||
function advanced_file_get_contents($url) {
|
||||
|
||||
if(defined('PROXY_URL')) {
|
||||
$context = array(
|
||||
'http' => array(
|
||||
'proxy' => PROXY_URL,
|
||||
'request_fulluri' => true,
|
||||
),
|
||||
);
|
||||
$context = stream_context_create($context);
|
||||
return file_get_contents($url, false, $context);
|
||||
} else {
|
||||
return file_get_contents($url);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue