Skip to content

Commit

Permalink
Merge pull request #29 from thelia-modules/feature/clean_string
Browse files Browse the repository at this point in the history
clean string for a valid json
  • Loading branch information
Yochima authored Jan 12, 2017
2 parents 00d164a + 5241948 commit 02e06ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>1.4.5</version>
<version>1.4.6</version>
<author>
<name>Thelia</name>
<email>[email protected]</email>
Expand Down
18 changes: 14 additions & 4 deletions Loop/DpdPickupAround.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,14 @@ public function parseResults(LoopResult $loopResult)
}

// Then define all the variables
$loopResultRow->set("NAME", $item->NAME)
$loopResultRow
->set("NAME", self::cleanString($item->NAME))
->set("LONGITUDE", str_replace(",", ".", $item->LONGITUDE))
->set("LATITUDE", str_replace(",", ".", $item->LATITUDE))
->set("CODE", $item->PUDO_ID)
->set("ADDRESS", $item->ADDRESS1)
->set("ZIPCODE", $item->ZIPCODE)
->set("CITY", $item->CITY)
->set("ADDRESS", self::cleanString($item->ADDRESS1))
->set("ZIPCODE", self::cleanString($item->ZIPCODE))
->set("CITY", self::cleanString($item->CITY))
->set("DISTANCE", $distance)
->set("HOURS", $hours)
;
Expand All @@ -179,4 +180,13 @@ public function parseResults(LoopResult $loopResult)

return $loopResult;
}

public static function cleanString($string)
{
return str_replace(
array('"'),
array('\''),
$string
);
}
}

0 comments on commit 02e06ad

Please sign in to comment.