aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bridges/HotUKDealsBridge.php2
-rw-r--r--bridges/PepperBridgeAbstract.php31
2 files changed, 20 insertions, 13 deletions
diff --git a/bridges/HotUKDealsBridge.php b/bridges/HotUKDealsBridge.php
index ec40bb7b..45cc6637 100644
--- a/bridges/HotUKDealsBridge.php
+++ b/bridges/HotUKDealsBridge.php
@@ -3305,7 +3305,7 @@ class HotUKDealsBridge extends PepperBridgeAbstract {
'th'
),
'local-time-relative' => array(
- 'Found ',
+ 'Posted ',
'm',
'h,',
'day',
diff --git a/bridges/PepperBridgeAbstract.php b/bridges/PepperBridgeAbstract.php
index 5380a7b8..e6e44acd 100644
--- a/bridges/PepperBridgeAbstract.php
+++ b/bridges/PepperBridgeAbstract.php
@@ -119,17 +119,25 @@ class PepperBridgeAbstract extends BridgeAbstract {
. $deal->find('div[class*=' . $selectorHot . ']', 0)
->find('span', 1)->outertext
. '</td></table>';
- $dealDateDiv = $deal->find('div[class*=' . $selectorDate . ']', 0)
- ->find('span[class=hide--toW3]');
- $itemDate = end($dealDateDiv)->plaintext;
- // In case of a Local deal, there is no date, but we can use
- // this case for other reason (like date not in the last field)
- if ($this->contains($itemDate, $this->i8n('localdeal'))) {
- $item['timestamp'] = time();
- } else if ($this->contains($itemDate, $this->i8n('relative-date-indicator'))) {
- $item['timestamp'] = $this->relativeDateToTimestamp($itemDate);
- } else {
- $item['timestamp'] = $this->parseDate($itemDate);
+
+ // Check if a clock icon is displayed on the deal
+ $clocks = $deal->find('svg[class*=icon--clock]');
+ if($clocks !== null && count($clocks) > 0) {
+ // Get the last clock, corresponding to the deal posting date
+ $clock = end($clocks);
+
+ // Find the text corresponding to the clock
+ $spanDateDiv = $clock->parent()->find('span[class=hide--toW3]', 0);
+ $itemDate = $spanDateDiv->plaintext;
+ // In case of a Local deal, there is no date, but we can use
+ // this case for other reason (like date not in the last field)
+ if ($this->contains($itemDate, $this->i8n('localdeal'))) {
+ $item['timestamp'] = time();
+ } else if ($this->contains($itemDate, $this->i8n('relative-date-indicator'))) {
+ $item['timestamp'] = $this->relativeDateToTimestamp($itemDate);
+ } else {
+ $item['timestamp'] = $this->parseDate($itemDate);
+ }
}
$this->items[] = $item;
}
@@ -564,7 +572,6 @@ HEREDOC;
'year',
''
);
-
$date->modify(str_replace($search, $replace, $str));
return $date->getTimestamp();
}