diff --git a/bridges/CastorusBridge.php b/bridges/CastorusBridge.php
index 69d8961..55ff7b7 100644
--- a/bridges/CastorusBridge.php
+++ b/bridges/CastorusBridge.php
@@ -6,6 +6,30 @@ class CastorusBridge extends BridgeAbstract {
$this->uri = $this->getURI();
$this->description = "Returns the latest changes";
$this->update = "2016-08-05";
+
+ $this->parameters["Get latest changes"] = '[]';
+ $this->parameters["Get latest changes via ZIP code"] =
+ '[
+ {
+ "name": "ZIP code",
+ "identifier" : "zip",
+ "type" : "text",
+ "required" : "true",
+ "exampleValue" : "74910, 74",
+ "title" : "Insert ZIP code (complete or partial)"
+ }
+ ]';
+ $this->parameters["Get latest changes via city name"] =
+ '[
+ {
+ "name": "City name",
+ "identifier" : "city",
+ "type" : "text",
+ "required" : "true",
+ "exampleValue" : "Seyssel, Seys",
+ "title" : "Insert city name (complete or partial)"
+ }
+ ]';
}
// Extracts the tile from an actitiy
@@ -55,6 +79,12 @@ class CastorusBridge extends BridgeAbstract {
}
public function collectData(array $params){
+ if(isset($params['zip']))
+ $zip_filter = trim($params['zip']);
+
+ if(isset($params['city']))
+ $city_filter = trim($params['city']);
+
$html = $this->file_get_html($this->getURI());
if(!$html)
@@ -74,6 +104,14 @@ class CastorusBridge extends BridgeAbstract {
$item->content = '' . $item->title . '
' . $this->ExtractActivityPrice($activity) . '
'; + if(isset($zip_filter) && !(substr($item->title, 0, strlen($zip_filter)) === $zip_filter)){ + continue; // Skip this item + } + + if(isset($city_filter) && !(substr($item->title, strpos($item->title, ' ') + 1, strlen($city_filter)) === $city_filter)){ + continue; // Skip this item + } + $this->items[] = $item; } }