1
0
Fork 0
forked from blallo/rss-bridge

[DealabsBridge] Follow site changes, fix unhandled case (#703)

* [DealabsBridge] Follow site changes, fix unhandled case

- Fixed the case where no discount was shown
- Changed some CSS class to follow the website changes
This commit is contained in:
sysadminstory 2018-05-29 10:52:13 +02:00 committed by LogMANOriginal
parent 2d8f4dc3c5
commit 1045850043

View file

@ -148,7 +148,6 @@ class DealabsBridge extends BridgeAbstract {
'cept-thread-image-link', 'cept-thread-image-link',
'imgFrame', 'imgFrame',
'imgFrame--noBorder', 'imgFrame--noBorder',
'box--all-i',
'thread-listImgCell', 'thread-listImgCell',
) )
); );
@ -179,6 +178,7 @@ class DealabsBridge extends BridgeAbstract {
' ', /* Notice this is a space! */ ' ', /* Notice this is a space! */
array( array(
'cept-description-container', 'cept-description-container',
'userHtml',
'overflow--wrap-break', 'overflow--wrap-break',
'size--all-s', 'size--all-s',
'size--fromW3-m', 'size--fromW3-m',
@ -302,12 +302,18 @@ class DealabsBridge extends BridgeAbstract {
private function getReduction($deal) private function getReduction($deal)
{ {
if($deal->find('span[class*=mute--text text--lineThrough]', 0) != null) { if($deal->find('span[class*=mute--text text--lineThrough]', 0) != null) {
$discountHtml = $deal->find('span[class=space--ml-1 size--all-l size--fromW3-xl]', 0);
if($discountHtml != null) {
$discount = $discountHtml->plaintext;
} else {
$discount = '';
}
return '<div>Réduction : <span style="text-decoration: line-through;">' return '<div>Réduction : <span style="text-decoration: line-through;">'
. $deal->find( . $deal->find(
'span[class*=mute--text text--lineThrough]', 0 'span[class*=mute--text text--lineThrough]', 0
)->plaintext )->plaintext
. '</span>&nbsp;' . '</span>&nbsp;'
. $deal->find('span[class=space--ml-1 size--all-l size--fromW3-xl]', 0)->plaintext . $discount
. '</div>'; . '</div>';
} else { } else {
return ''; return '';
@ -412,6 +418,7 @@ class DealabsBridge extends BridgeAbstract {
'November', 'November',
'December' 'December'
); );
$string = str_replace('Actualisé ', '', $string);
$date_str = trim(str_replace($month_fr, $month_en, $string)); $date_str = trim(str_replace($month_fr, $month_en, $string));
if(!preg_match('/[0-9]{4}/', $string)) { if(!preg_match('/[0-9]{4}/', $string)) {