@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | 'shopify_shop_domain_'.$this->ShopifyAPI->api_key => $this->ShopifyAPI->getShopDomain() |
71 | 71 | ]); |
72 | 72 | |
73 | - $this->Auth->setUser($shop_entity); |
|
73 | + $this->Auth->setUser($shop_entity); |
|
74 | 74 | |
75 | 75 | return $this->redirect([ |
76 | 76 | 'controller' => 'Shopify', |
77 | 77 | 'plugin' => false, |
78 | - 'api_key' => $this->ShopifyAPI->api_key]); |
|
78 | + 'api_key' => $this->ShopifyAPI->api_key]); |
|
79 | 79 | |
80 | 80 | |
81 | 81 | } else { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | $this->render('add'); |
111 | 111 | |
112 | - } elseif (!empty($this->request->data['shop_domain']) && !$this->error) { |
|
112 | + } elseif (!empty($this->request->data['shop_domain']) && !$this->error) { |
|
113 | 113 | |
114 | 114 | $valid_domain = $this->ShopifyAPI->validDomain( |
115 | 115 | $this->request->data['shop_domain'] |
@@ -40,17 +40,17 @@ |
||
40 | 40 | |
41 | 41 | if (empty($this->api_key)) { |
42 | 42 | |
43 | - $controller = $this->_registry->getController(); |
|
43 | + $controller = $this->_registry->getController(); |
|
44 | 44 | |
45 | - if (isset($controller->request->api_key)) { |
|
45 | + if (isset($controller->request->api_key)) { |
|
46 | 46 | $this->api_key = $controller->request->api_key; |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | |
51 | 51 | $this->ShopifyAPI = $registry->load('Multidimensional/Shopify.ShopifyAPI', [ |
52 | 52 | 'api_key' => $this->api_key |
53 | - ]); |
|
53 | + ]); |
|
54 | 54 | |
55 | 55 | $this->ShopifyDatabase = $registry->load('Multidimensional/Shopify.ShopifyDatabase'); |
56 | 56 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $first_run = ((Configure::check('Multidimensional/Shopify')) ? false : true); |
36 | 36 | |
37 | 37 | //Activate Plugin |
38 | - if ((($first_run) ? (strtolower($this->in('Install Shopify Plugin?', ['y','n'])) == 'y') : (strtolower($this->in('Update Configuration?', ['y','n'])) == 'y'))) { |
|
38 | + if ((($first_run) ? (strtolower($this->in('Install Shopify Plugin?', ['y', 'n'])) == 'y') : (strtolower($this->in('Update Configuration?', ['y', 'n'])) == 'y'))) { |
|
39 | 39 | |
40 | 40 | |
41 | 41 | $this->out(); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | $scope = array_map('trim', $scope); |
68 | 68 | $scope = array_map('strtolower', $scope); |
69 | - array_walk($scope, function (&$value) { |
|
69 | + array_walk($scope, function(&$value) { |
|
70 | 70 | $value = str_replace(" ", "_", $value); |
71 | 71 | }); |
72 | 72 | |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | $this->_io->out('<error>Invalid Scope. Try again, or leave blank to continue.</error>'); |
76 | 76 | } |
77 | 77 | |
78 | - } while((count($scope)) && (strlen(trim(implode("", $scope))) > 0) && (count(array_diff($scope, $scope_array)) > 0)); |
|
78 | + } while ((count($scope)) && (strlen(trim(implode("", $scope))) > 0) && (count(array_diff($scope, $scope_array)) > 0)); |
|
79 | 79 | |
80 | - Configure::write('Multidimensional/Shopify.' . $api_key . '.scope',implode(',', $scope)); |
|
80 | + Configure::write('Multidimensional/Shopify.' . $api_key . '.scope', implode(',', $scope)); |
|
81 | 81 | |
82 | 82 | $this->out(''); |
83 | 83 | $isPrivateApp = strtolower($this->in('Is this a private app?', ['y', 'n'])); |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | |
92 | - Configure::write('Multidimensional/Shopify.' . $api_key . '.is_private_app',$is_private_app); |
|
92 | + Configure::write('Multidimensional/Shopify.' . $api_key . '.is_private_app', $is_private_app); |
|
93 | 93 | |
94 | 94 | if ($is_private_app == 'true') { |
95 | - Configure::write('Multidimensional/Shopify.' . $api_key . '.private_app_password',$this->in('Private App Password:')); |
|
95 | + Configure::write('Multidimensional/Shopify.' . $api_key . '.private_app_password', $this->in('Private App Password:')); |
|
96 | 96 | } else { |
97 | 97 | Configure::write('Multidimensional/Shopify.' . $api_key . '.private_app_password', NULL); |
98 | 98 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | $shopEntity = $this->shops->findByMyshopifyDomain($domain)->first(); |
106 | 106 | if ($shopEntity->id) { |
107 | - return (int)$shopEntity->id; |
|
107 | + return (int) $shopEntity->id; |
|
108 | 108 | } else { |
109 | 109 | return false; |
110 | 110 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $query = $this->access_tokens->find(); |
117 | 117 | $query = $query->contain(['Shops']); |
118 | 118 | $query = $query->where(['api_key' => $apiKey, 'token' => $accessToken]); |
119 | - $query = $query->where(function ($exp, $q) { |
|
119 | + $query = $query->where(function($exp, $q) { |
|
120 | 120 | return $exp->isNull('expired_at'); |
121 | 121 | }); |
122 | 122 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $query = $this->access_tokens->find(); |
136 | 136 | $query = $query->contain(['Shops']); |
137 | 137 | $query = $query->where(['api_key' => $apiKey, 'Shops.myshopify_domain' => $shopDomain]); |
138 | - $query = $query->where(function ($exp, $q) { |
|
138 | + $query = $query->where(function($exp, $q) { |
|
139 | 139 | return $exp->isNull('expired_at'); |
140 | 140 | }); |
141 | 141 |
@@ -41,26 +41,26 @@ |
||
41 | 41 | |
42 | 42 | parent::initialize($config); |
43 | 43 | |
44 | - $this->api_key = isset($config['api_key']) ? $config['api_key'] : ''; |
|
44 | + $this->api_key = isset($config['api_key']) ? $config['api_key'] : ''; |
|
45 | 45 | |
46 | - if (!empty($this->api_key)) { |
|
46 | + if (!empty($this->api_key)) { |
|
47 | 47 | |
48 | 48 | $this->shared_secret = Configure::read('Multidimensional/Shopify.' . $this->api_key . '.shared_secret'); |
49 | 49 | $this->scope = Configure::read('Multidimensional/Shopify.' . $this->api_key . '.scope'); |
50 | 50 | $this->is_private_app = Configure::read('Multidimensional/Shopify.' . $this->api_key . '.is_private_app'); |
51 | 51 | $this->private_app_password = Configure::read('Multidimensional/Shopify.' . $this->api_key . '.private_app_password'); |
52 | 52 | |
53 | - } else { |
|
53 | + } else { |
|
54 | 54 | |
55 | 55 | throw new NotImplementedException(__('Shopify API key not found')); |
56 | 56 | |
57 | - } |
|
57 | + } |
|
58 | 58 | |
59 | - if (!$this->shared_secret) { |
|
59 | + if (!$this->shared_secret) { |
|
60 | 60 | |
61 | 61 | throw new NotImplementedException(__('Shopify shared secret not found')); |
62 | 62 | |
63 | - } |
|
63 | + } |
|
64 | 64 | |
65 | 65 | } |
66 | 66 |
@@ -147,7 +147,7 @@ |
||
147 | 147 | { |
148 | 148 | $params = explode("/", $this->response->getHeaderLine('http_x_shopify_shop_api_call_limit')); |
149 | 149 | |
150 | - return (int)$params[$index]; |
|
150 | + return (int) $params[$index]; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | public function getAuthorizeUrl($shopDomain, $redirectUrl) |