[AutoJMBridge] Use title from website for Feed Title (#1093)

* [AutoJMBridge] Use title from website for Feed Title
This commit is contained in:
sysadminstory 2019-04-20 22:22:06 +02:00 committed by Teromene
parent f9c4a84c25
commit 3b8f3da09d

View file

@ -70,6 +70,19 @@ class AutoJMBridge extends BridgeAbstract {
return self::URI . 'favicon.ico'; return self::URI . 'favicon.ico';
} }
public function getName() {
switch($this->queriedContext) {
case 'Afficher les offres de véhicules disponible en fonction des critères du site AutoJM':
$html = getSimpleHTMLDOMCached(self::URI . $this->getInput('url'), 86400);
$name = html_entity_decode($html->find('title', 0)->plaintext);
return $name;
break;
default:
return parent::getName();
}
}
public function collectData() { public function collectData() {
$model_url = self::URI . $this->getInput('url'); $model_url = self::URI . $this->getInput('url');
@ -180,6 +193,5 @@ class AutoJMBridge extends BridgeAbstract {
$html = str_get_html($content); $html = str_get_html($content);
$token = $html->find('input[type=hidden][id=form__token]', 0); $token = $html->find('input[type=hidden][id=form__token]', 0);
$this->token = $token->value; $this->token = $token->value;
} }
} }