[core] remove '$param' argument from RssExpander::collectExpandableDatas
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
3bad5ec45c
commit
a67a219bf9
7 changed files with 18 additions and 28 deletions
|
@ -11,9 +11,8 @@ class AcrimedBridge extends RssExpander{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
|
||||||
|
|
||||||
parent::collectExpandableDatas($param, "http://www.acrimed.org/spip.php?page=backend");
|
parent::collectExpandableDatas("http://www.acrimed.org/spip.php?page=backend");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
class CpasbienBridge extends HttpCachingBridgeAbstract{
|
class CpasbienBridge extends HttpCachingBridgeAbstract{
|
||||||
|
|
||||||
private $request;
|
|
||||||
|
|
||||||
public function loadMetadatas() {
|
public function loadMetadatas() {
|
||||||
|
|
||||||
$this->maintainer = "lagaisse";
|
$this->maintainer = "lagaisse";
|
||||||
|
@ -23,13 +21,11 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
$param=$this->parameters[$this->queriedContext];
|
||||||
$this->loadMetadatas();
|
|
||||||
$html = '';
|
$html = '';
|
||||||
if (isset($param['q']['value'])) { /* keyword search mode */
|
if (isset($param['q']['value'])) { /* keyword search mode */
|
||||||
$this->request = str_replace(" ","-",trim($param['q']['value']));
|
$request = str_replace(" ","-",trim($param['q']['value']));
|
||||||
$html = $this->getSimpleHTMLDOM($this->uri.'/recherche/'.urlencode($this->request).'.html') or $this->returnServerError('No results for this query.');
|
$html = $this->getSimpleHTMLDOM($this->uri.'/recherche/'.urlencode($request).'.html') or $this->returnServerError('No results for this query.');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->returnClientError('You must specify a keyword (?q=...).');
|
$this->returnClientError('You must specify a keyword (?q=...).');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +42,7 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
|
||||||
$textefiche=$htmlepisode->find('#textefiche', 0)->find('p',1);
|
$textefiche=$htmlepisode->find('#textefiche', 0)->find('p',1);
|
||||||
if (isset($textefiche)) {
|
if (isset($textefiche)) {
|
||||||
$item['content'] = $textefiche->text();
|
$item['content'] = $textefiche->text();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$p=$htmlepisode->find('#textefiche',0)->find('p');
|
$p=$htmlepisode->find('#textefiche',0)->find('p');
|
||||||
if(!empty($p)){
|
if(!empty($p)){
|
||||||
$item['content'] = $htmlepisode->find('#textefiche', 0)->find('p',0)->text();
|
$item['content'] = $htmlepisode->find('#textefiche', 0)->find('p',0)->text();
|
||||||
|
@ -59,13 +54,12 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
return (!empty($this->request) ? $this->request .' - ' : '') . $this->name;
|
return $this->parameters[$this->queriedContext]['q']['value']
|
||||||
|
.' : '.$this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -15,8 +15,7 @@ class FreenewsBridge extends RssExpander {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
parent::collectExpandableDatas(FREENEWS_RSS);
|
||||||
parent::collectExpandableDatas($param, FREENEWS_RSS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function parseRSSItem($newsItem) {
|
protected function parseRSSItem($newsItem) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ class GawkerBridge extends RssExpander{
|
||||||
$url = $this->toURI(strtolower($param['site']['value']));
|
$url = $this->toURI(strtolower($param['site']['value']));
|
||||||
}
|
}
|
||||||
$this->debugMessage("loading feed from ".$this->getURI());
|
$this->debugMessage("loading feed from ".$this->getURI());
|
||||||
parent::collectExpandableDatas($param, $url);
|
parent::collectExpandableDatas($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function parseRSSItem($newsItem) {
|
protected function parseRSSItem($newsItem) {
|
||||||
|
|
|
@ -15,8 +15,7 @@ class Les400CulsBridge extends RssExpander{
|
||||||
|
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
parent::collectExpandableDatas(SEXE_FEED);
|
||||||
parent::collectExpandableDatas($param, SEXE_FEED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function parseRSSItem($newsItem) {
|
protected function parseRSSItem($newsItem) {
|
||||||
|
|
|
@ -14,8 +14,7 @@ class TheOatmealBridge extends RssExpander{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$param=$this->parameters[$this->queriedContext];
|
parent::collectExpandableDatas(THE_OATMEAL_RSS);
|
||||||
parent::collectExpandableDatas($param, THE_OATMEAL_RSS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -467,12 +467,12 @@ abstract class HttpCachingBridgeAbstract extends BridgeAbstract {
|
||||||
|
|
||||||
abstract class RssExpander extends HttpCachingBridgeAbstract {
|
abstract class RssExpander extends HttpCachingBridgeAbstract {
|
||||||
|
|
||||||
public function collectExpandableDatas(array $param, $name){
|
public function collectExpandableDatas($name){
|
||||||
if(empty($name)){
|
if(empty($name)){
|
||||||
$this->returnServerError('There is no $name for this RSS expander');
|
$this->returnServerError('There is no $name for this RSS expander');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->debugMessage('Loading from ' . $param['url']);
|
$this->debugMessage('Loading from ' . $name);
|
||||||
|
|
||||||
/* Notice we do not use cache here on purpose:
|
/* Notice we do not use cache here on purpose:
|
||||||
* we want a fresh view of the RSS stream each time
|
* we want a fresh view of the RSS stream each time
|
||||||
|
@ -480,7 +480,7 @@ abstract class RssExpander extends HttpCachingBridgeAbstract {
|
||||||
$content = $this->getContents($name) or $this->returnServerError('Could not request ' . $name);
|
$content = $this->getContents($name) or $this->returnServerError('Could not request ' . $name);
|
||||||
|
|
||||||
$rssContent = simplexml_load_string($content);
|
$rssContent = simplexml_load_string($content);
|
||||||
$this->debugMessage('loaded RSS from ' . $param['url']);
|
$this->debugMessage('loaded RSS from ' . $name);
|
||||||
// TODO insert RSS format detection
|
// TODO insert RSS format detection
|
||||||
// For now we always assume RSS 2.0
|
// For now we always assume RSS 2.0
|
||||||
$this->collect_RSS_2_0_data($rssContent);
|
$this->collect_RSS_2_0_data($rssContent);
|
||||||
|
|
Loading…
Reference in a new issue