Skip to content

Commit

Permalink
fix escaping quotes in js func parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
timoj committed Sep 7, 2018
1 parent 3b0507a commit 52bbab2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
7 changes: 5 additions & 2 deletions assets/js/parcelshop.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,11 @@ function addParcelshopList(data) {
data.forEach(function (shops, i) {
var hours = getHours(shops.opening_hours);
var logo = getLogo(shops.carrier_name);
var parcelshopInfoHtml = capFirst(shops.company_name) + "<br>" + capFirst(shops.address.street_name) +
" " + shops.address.house_number + "<br>" + shops.address.city;
addMarkerToMap(shops.latitude, shops.longitude, logo, i);
parcelshopInfoHtml = parcelshopInfoHtml.replace(/"/g, '\\"').replace(/'/g, "\\'");
console.log(parcelshopInfoHtml);

var node = document.createElement("div");
node.className += "parcelshopItem parcelshopItem" + i;
Expand All @@ -281,8 +285,7 @@ function addParcelshopList(data) {
"<div id='zip_code_and_city'>" + shops.address.zip_code + " " + shops.address.city + "</div>" +
"<div id='distance'>" + Math.round(shops.distance * 1000) + "m</div></div></div>" +
"<div class='opening_hours_list'><br><strong>Openingstijden</strong>" +
"<div>" + hours + "</div><br><div id='buttonContainer'><button class='parcelshopButton' onclick='chooseParcelshopButton(\"" + capFirst(shops.company_name) + "<br>" + capFirst(shops.address.street_name) +
" " + shops.address.house_number + "<br>" + shops.address.city + "\", \"" + shops.id + "\", \"" + shops.address.alpha2 + "\")' type='button'>Kies</button></div>";
"<div>" + hours + "</div><br><div id='buttonContainer'><button class='parcelshopButton' onclick=\"chooseParcelshopButton('" + parcelshopInfoHtml + "', '" + shops.id + "', '" + shops.address.alpha2 + "')\" type='button'>Kies</button></div>";
window.parent.document.getElementById('parcelshopList').appendChild(node);
});
}
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion includes/wcwuunder-create.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct()
$this->version_obj = array(
"product" => "Woocommerce extension",
"version" => array(
"build" => "2.4.6",
"build" => "2.4.7",
"plugin" => "2.0"),
"platform" => array(
"name" => "Woocommerce",
Expand Down Expand Up @@ -118,6 +118,7 @@ private function setBookingConfig($orderId)
$bookingConfig->setWidth($this->roundButNull($dimensions[1]));
$bookingConfig->setHeight($this->roundButNull($dimensions[2]));
$bookingConfig->setWeight($totalWeight ? $totalWeight : null);
$bookingConfig->setCustomerReference($orderId);
$bookingConfig->setPreferredServiceLevel((count($order->get_items('shipping')) > 0) ? $this->get_filter_from_shippingmethod(reset($order->get_items('shipping'))->get_method_id()) : "");
$bookingConfig->setSource($this->version_obj);

Expand Down

0 comments on commit 52bbab2

Please sign in to comment.