1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-06 08:37:30 +02:00

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:
Teromene
2015-11-27 14:20:33 +00:00
parent e1cdca6971
commit a07839019e
6 changed files with 37 additions and 22 deletions

View File

@@ -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);
}
}

View File

@@ -91,7 +91,7 @@ CARD;
} else if($inputEntry['type'] == 'number') {
$card .= '<input '.$additionalInfoString.' id="' . $idArg . '" type="number" value="" placeholder="' . $inputEntry['exampleValue'] . '" name="' . $inputEntry['identifier'] . '" /><br />' . PHP_EOL;
} else if($inputEntry['type'] == 'list') {
$card .= '<select '.$additionalInfoString.' id="' . $idArg . '" name="' . $inputEntry['name'] . '" >';
$card .= '<select '.$additionalInfoString.' id="' . $idArg . '" name="' . $inputEntry['identifier'] . '" >';
foreach($inputEntry['values'] as $listValues) {
$card .= "<option $additionalInfoString value='" . $listValues['value'] . "'>" . $listValues['name'] . "</option>";
@@ -157,9 +157,7 @@ class HTMLSanitizer {
$element->outertext = '';
} else {
foreach($element->getAllAttributes() as $attributeName => $attribute) {
if(!in_array($attributeName, $this->keptAttributes)) $element->removeAttribute($attributeName);
}
}
}
@@ -167,6 +165,13 @@ class HTMLSanitizer {
return $htmlContent;
}
public static function defaultImageSrcTo($content, $server) {
foreach($content->find('img') as $image) {
if(strpos($image->src, '/')==0) {
$image->src = $server.$image->src;
}
}
}
}
?>