Skip to content

Commit

Permalink
Merge branch 'hotfix/1.0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviocopes committed Apr 21, 2016
2 parents 2fc215b + d415748 commit 198953a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v1.0.6
## 21-04-2016

1. [](#bugfix)
* Fix issue in JS settings build, backported from 2.0
* Fix issue in payment URL task fetch

# v1.0.5
## 13-03-2016

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Shopping Cart
version: 1.0.5
version: 1.0.6
description: "This plugin turns your Grav site into a shopping cart"
icon: shopping-cart
author:
Expand Down
30 changes: 20 additions & 10 deletions shoppingcart.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,16 @@ public function saveOrder()
{
/** @var Uri $uri */
$uri = $this->grav['uri'];
$task = $uri->query('task');
$task = !empty($_POST['task']) ? $_POST['task'] : $uri->query('task');
$post = !empty($_POST) ? $_POST : [];

// @todo: remove in 2.0
if (!$task) {
$uri_bits = Uri::parseUrl(urldecode($uri->query()));
parse_str($uri_bits['query'], $query);
$task = $query['task'];
}

require_once __DIR__ . '/classes/controller.php';
$controller = new ShoppingCartController($this->grav, $task, $post);
$controller->execute();
Expand Down Expand Up @@ -352,10 +359,10 @@ protected function recurse_settings($base, $settings)
{
$output = '';

foreach($settings as $key => $value) {
foreach ($settings as $key => $value) {
if (!is_array($value)) {
//Avoid adding private settings to the frontend
if (!in_array($key, ['secretKey'])) {
if ($key !== 'secretKey') {
if (is_numeric($key)) {
$key = '[' . $key . ']';
} else {
Expand All @@ -365,17 +372,20 @@ protected function recurse_settings($base, $settings)
if (!is_numeric($value)) {
$value = '"' . $value . '"';
}
$output .= 'PLUGIN_SHOPPINGCART.settings' . $base . $key .' = ' . $value . '; ' . PHP_EOL;
$output .= 'PLUGIN_SHOPPINGCART.settings' . $base . $key . ' = ' . $value . '; ' . PHP_EOL;
}

} else {
if (is_numeric($key)) {
$key = '[' . $key . ']';
} else {
$key = '.' . $key;
if ($key !== 'checkout_form') {
if (is_numeric($key)) {
$key = '[' . $key . ']';
} else {
$key = '.' . $key;
}
$output .= 'PLUGIN_SHOPPINGCART.settings' . $base . $key . ' = {}; ' . PHP_EOL;

$output .= $this->recurse_settings($base . $key, $value);
}
$output .= 'PLUGIN_SHOPPINGCART.settings' . $base . $key .' = {}; ' . PHP_EOL;
$output .= $this->recurse_settings($base . $key, $value);
}
}

Expand Down

0 comments on commit 198953a

Please sign in to comment.