@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | class ShopifyInstallShell extends Shell { |
25 | 25 | |
26 | - public function main() { |
|
26 | + public function main() { |
|
27 | 27 | |
28 | 28 | //Lets Make This FANCY |
29 | 29 | $this->clear(); |
@@ -99,7 +99,7 @@ |
||
99 | 99 | |
100 | 100 | $this->out(''); |
101 | 101 | |
102 | - if (($first_run) || (strtolower($this->in('Update Database?', ['y','n'])) == 'y')) { |
|
102 | + if (($first_run) || (strtolower($this->in('Update Database?', ['y','n'])) == 'y')) { |
|
103 | 103 | |
104 | 104 | $this->out(''); |
105 | 105 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $first_run = ((Configure::check('Multidimensional/Shopify')) ? false : true); |
34 | 34 | |
35 | 35 | //Activate Plugin |
36 | - if ((($first_run) ? (strtolower($this->in('Install Shopify Plugin?', ['y','n'])) == 'y') : (strtolower($this->in('Update Configuration?', ['y','n'])) == 'y'))) { |
|
36 | + if ((($first_run) ? (strtolower($this->in('Install Shopify Plugin?', ['y', 'n'])) == 'y') : (strtolower($this->in('Update Configuration?', ['y', 'n'])) == 'y'))) { |
|
37 | 37 | |
38 | 38 | $this->out(); |
39 | 39 | $this->out('Please enter your API credentials from your Shopify App page.', 2); |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | $this->_io->out('<error>Invalid Scope. Try again, or leave blank to continue.</error>'); |
72 | 72 | } |
73 | 73 | |
74 | - } while((count($scope)) && (strlen(trim(implode("", $scope))) > 0) && (count(array_diff($scope, $scope_array)) > 0)); |
|
74 | + } while ((count($scope)) && (strlen(trim(implode("", $scope))) > 0) && (count(array_diff($scope, $scope_array)) > 0)); |
|
75 | 75 | |
76 | - Configure::write('Multidimensional/Shopify.' . $api_key . '.scope',implode(',', $scope)); |
|
76 | + Configure::write('Multidimensional/Shopify.' . $api_key . '.scope', implode(',', $scope)); |
|
77 | 77 | |
78 | 78 | $this->out(''); |
79 | - $is_private_app = strtolower($this->in('Is this a private app?', ['y','n'])); |
|
79 | + $is_private_app = strtolower($this->in('Is this a private app?', ['y', 'n'])); |
|
80 | 80 | |
81 | 81 | if ($is_private_app == 'y') { |
82 | 82 | $is_private_app = 'true'; |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | $is_private_app = 'false'; |
85 | 85 | } |
86 | 86 | |
87 | - Configure::write('Multidimensional/Shopify.' . $api_key . '.is_private_app',$is_private_app); |
|
87 | + Configure::write('Multidimensional/Shopify.' . $api_key . '.is_private_app', $is_private_app); |
|
88 | 88 | |
89 | 89 | if ($is_private_app == 'true') { |
90 | - Configure::write('Multidimensional/Shopify.' . $api_key . '.private_app_password',$this->in('Private App Password:')); |
|
90 | + Configure::write('Multidimensional/Shopify.' . $api_key . '.private_app_password', $this->in('Private App Password:')); |
|
91 | 91 | } else { |
92 | 92 | Configure::write('Multidimensional/Shopify.' . $api_key . '.private_app_password', NULL); |
93 | 93 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $this->out(''); |
100 | 100 | |
101 | - if (($first_run) || (strtolower($this->in('Update Database?', ['y','n'])) == 'y')) { |
|
101 | + if (($first_run) || (strtolower($this->in('Update Database?', ['y', 'n'])) == 'y')) { |
|
102 | 102 | |
103 | 103 | $this->out(''); |
104 | 104 | |
@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | |
109 | 109 | if ((is_array($status)) && (count($status))) { |
110 | 110 | |
111 | - $this->out('Updating Databases',2); |
|
111 | + $this->out('Updating Databases', 2); |
|
112 | 112 | |
113 | 113 | if ($migrations->migrate()) { |
114 | - $this->out('Success!',2); |
|
114 | + $this->out('Success!', 2); |
|
115 | 115 | } else { |
116 | 116 | $this->_io->out('<error>Update Failed!</error>', 2); |
117 | 117 | } |
118 | 118 | |
119 | 119 | } else { |
120 | - $this->out('Shopify Database Files Not Found',2); |
|
120 | + $this->out('Shopify Database Files Not Found', 2); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | } |
@@ -113,7 +113,7 @@ |
||
113 | 113 | |
114 | 114 | $shop = $this->ShopifyDatabase->getShopDataFromAccessToken($accessToken, $this->api_key); |
115 | 115 | |
116 | - if($shop && is_array($shop)){ |
|
116 | + if ($shop && is_array($shop)) { |
|
117 | 117 | return ['id' => $shop['id'], 'username' => $shop['myshopify_domain']]; |
118 | 118 | } |
119 | 119 |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | if (isset($request->query['code'])) { |
98 | 98 | $accessToken = $this->ShopifyAPI->getAccessToken($shopDomain, $request->query['code']); |
99 | - } else { |
|
99 | + } else { |
|
100 | 100 | $accessToken = $this->ShopifyDatabase->getAccessTokenFromShopDomain($shopDomain, $this->api_key); |
101 | 101 | } |
102 | 102 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $shop = $this->ShopifyDatabase->getShopDataFromAccessToken($accessToken, $this->api_key); |
115 | 115 | |
116 | - if($shop && is_array($shop)){ |
|
116 | + if($shop && is_array($shop)) { |
|
117 | 117 | return ['id' => $shop['id'], 'username' => $shop['myshopify_domain']]; |
118 | 118 | } |
119 | 119 |
@@ -36,19 +36,19 @@ |
||
36 | 36 | |
37 | 37 | $this->api_key = isset($config['api_key']) ? $config['api_key'] : ''; |
38 | 38 | |
39 | - if (empty($this->api_key)) { |
|
39 | + if (empty($this->api_key)) { |
|
40 | 40 | |
41 | - $controller = $this->_registry->getController(); |
|
41 | + $controller = $this->_registry->getController(); |
|
42 | 42 | |
43 | - if (isset($controller->request->api_key)) { |
|
44 | - $this->api_key = $controller->request->api_key; |
|
45 | - } |
|
43 | + if (isset($controller->request->api_key)) { |
|
44 | + $this->api_key = $controller->request->api_key; |
|
45 | + } |
|
46 | 46 | |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | 49 | $this->ShopifyAPI = $registry->load('Multidimensional/Shopify.ShopifyAPI', [ |
50 | 50 | 'api_key' => $this->api_key |
51 | - ]); |
|
51 | + ]); |
|
52 | 52 | $this->ShopifyDatabase = $registry->load('Multidimensional/Shopify.ShopifyDatabase'); |
53 | 53 | |
54 | 54 | } |