WooCommerce Square - Version 3.0.3

Version Description

  • 2022-06-01 =
  • Fix - Customer Token Editor wasn't loading for some stores after updating to Square 3.0.0. #799
  • Fix - No such file or directory warnings on case-sensitive filesystems. #799
  • Dev - Bump compatibility to WP 6.0. #812
Download this release

Release Info

Developer automattic
Plugin Icon 128x128 WooCommerce Square
Version 3.0.3
Comparing to
See all releases

Code changes from version 3.0.2 to 3.0.3

changelog.txt CHANGED
@@ -1,5 +1,10 @@
1
  *** WooCommerce Square Changelog ***
2
 
 
 
 
 
 
3
  = 3.0.2 - 2022-05-17 =
4
  * Fix - Prevent fatal error caused by stale transient (cached location data from previous Square API). #788
5
  * Fix - Disable all plugin features if server requirements are not met, to prevent fatal errors. #793
1
  *** WooCommerce Square Changelog ***
2
 
3
+ = 3.0.3 - 2022-06-01 =
4
+ * Fix - Customer Token Editor wasn't loading for some stores after updating to Square 3.0.0. #799
5
+ * Fix - No such file or directory warnings on case-sensitive filesystems. #799
6
+ * Dev - Bump compatibility to WP 6.0. #812
7
+
8
  = 3.0.2 - 2022-05-17 =
9
  * Fix - Prevent fatal error caused by stale transient (cached location data from previous Square API). #788
10
  * Fix - Disable all plugin features if server requirements are not met, to prevent fatal errors. #793
i18n/languages/woocommerce-square.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Square 3.0.2\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-square\n"
8
- "POT-Creation-Date: 2022-05-17 02:42:33+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Square 3.0.3\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-square\n"
8
+ "POT-Creation-Date: 2022-06-01 06:05:29+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
includes/Framework/PaymentGateway/Admin/Payment_Gateway_Admin_Order.php CHANGED
@@ -287,7 +287,7 @@ class Payment_Gateway_Admin_Order {
287
  $total_captured = $gateway->get_order_meta( $order, 'capture_total' );
288
  $remaining_total = Square_Helper::number_format( (float) $order->get_total() - (float) $total_captured );
289
 
290
- include( $this->get_plugin()->get_payment_gateway_framework_path() . '/admin/views/html-order-partial-capture.php' );
291
  }
292
 
293
 
287
  $total_captured = $gateway->get_order_meta( $order, 'capture_total' );
288
  $remaining_total = Square_Helper::number_format( (float) $order->get_total() - (float) $total_captured );
289
 
290
+ include( $this->get_plugin()->get_payment_gateway_framework_path() . '/Admin/views/html-order-partial-capture.php' );
291
  }
292
 
293
 
includes/Framework/PaymentGateway/Admin/Payment_Gateway_Admin_Payment_Token_Editor.php CHANGED
@@ -101,7 +101,7 @@ class Payment_Gateway_Admin_Payment_Token_Editor {
101
  $columns = $this->get_columns();
102
  $actions = $this->get_actions();
103
 
104
- include( $this->get_gateway()->get_plugin()->get_payment_gateway_framework_path() . '/admin/views/html-user-payment-token-editor.php' );
105
  }
106
 
107
 
@@ -124,7 +124,7 @@ class Payment_Gateway_Admin_Payment_Token_Editor {
124
 
125
  foreach ( $tokens as $token ) {
126
 
127
- include( $this->get_gateway()->get_plugin()->get_payment_gateway_framework_path() . '/admin/views/html-user-payment-token-editor-token.php' );
128
 
129
  $index++;
130
  }
@@ -195,7 +195,7 @@ class Payment_Gateway_Admin_Payment_Token_Editor {
195
 
196
  ob_start();
197
 
198
- include( $this->get_gateway()->get_plugin()->get_payment_gateway_framework_path() . '/admin/views/html-user-payment-token-editor-token.php' );
199
 
200
  $html = ob_get_clean();
201
 
101
  $columns = $this->get_columns();
102
  $actions = $this->get_actions();
103
 
104
+ include( $this->get_gateway()->get_plugin()->get_payment_gateway_framework_path() . '/Admin/views/html-user-payment-token-editor.php' );
105
  }
106
 
107
 
124
 
125
  foreach ( $tokens as $token ) {
126
 
127
+ include( $this->get_gateway()->get_plugin()->get_payment_gateway_framework_path() . '/Admin/views/html-user-payment-token-editor-token.php' );
128
 
129
  $index++;
130
  }
195
 
196
  ob_start();
197
 
198
+ include( $this->get_gateway()->get_plugin()->get_payment_gateway_framework_path() . '/Admin/views/html-user-payment-token-editor-token.php' );
199
 
200
  $html = ob_get_clean();
201
 
includes/Framework/PaymentGateway/Admin/Payment_Gateway_Admin_User_Handler.php CHANGED
@@ -82,7 +82,7 @@ class Payment_Gateway_Admin_User_Handler {
82
  $section_title = $this->get_title();
83
  $section_description = $this->get_description();
84
 
85
- include( $this->get_plugin()->get_payment_gateway_framework_path() . '/admin/views/html-user-profile-section.php' );
86
  }
87
 
88
 
@@ -122,7 +122,7 @@ class Payment_Gateway_Admin_User_Handler {
122
  $name = $field['name'];
123
  $value = $field['value'];
124
 
125
- include( $this->get_plugin()->get_payment_gateway_framework_path() . '/admin/views/html-user-profile-field-customer-id.php' );
126
  }
127
  }
128
 
82
  $section_title = $this->get_title();
83
  $section_description = $this->get_description();
84
 
85
+ include( $this->get_plugin()->get_payment_gateway_framework_path() . '/Admin/views/html-user-profile-section.php' );
86
  }
87
 
88
 
122
  $name = $field['name'];
123
  $value = $field['value'];
124
 
125
+ include( $this->get_plugin()->get_payment_gateway_framework_path() . '/Admin/views/html-user-profile-field-customer-id.php' );
126
  }
127
  }
128
 
includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php CHANGED
@@ -730,9 +730,9 @@ class Payment_Gateway_Apple_Pay {
730
 
731
  if ( ! $this->api instanceof ApplePayApi\Payment_Gateway_Apple_Pay_API ) {
732
 
733
- require_once( $this->get_plugin()->get_payment_gateway_framework_path() . '/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api.php');
734
- require_once( $this->get_plugin()->get_payment_gateway_framework_path() . '/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-request.php');
735
- require_once( $this->get_plugin()->get_payment_gateway_framework_path() . '/apple-pay/api/class-sv-wc-payment-gateway-apple-pay-api-response.php');
736
 
737
  $this->api = new ApplePayApi\Payment_Gateway_Apple_Pay_API( $this->get_processing_gateway() );
738
  }
730
 
731
  if ( ! $this->api instanceof ApplePayApi\Payment_Gateway_Apple_Pay_API ) {
732
 
733
+ require_once( $this->get_plugin()->get_payment_gateway_framework_path() . '/ApplePay/Api/Payment_Gateway_Apple_Pay_Api.php' );
734
+ require_once( $this->get_plugin()->get_payment_gateway_framework_path() . '/ApplePay/Api/Payment_Gateway_Apple_Pay_Api_Request.php' );
735
+ require_once( $this->get_plugin()->get_payment_gateway_framework_path() . '/ApplePay/Api/Payment_Gateway_Apple_Pay_Api_Response.php' );
736
 
737
  $this->api = new ApplePayApi\Payment_Gateway_Apple_Pay_API( $this->get_processing_gateway() );
738
  }
includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php CHANGED
@@ -791,7 +791,7 @@ abstract class Payment_Gateway_Plugin extends Plugin {
791
 
792
  $environment = $gateway->get_environment_name();
793
 
794
- include( $this->get_payment_gateway_framework_path() . '/admin/views/html-admin-gateway-status.php' );
795
  }
796
  }
797
 
791
 
792
  $environment = $gateway->get_environment_name();
793
 
794
+ include( $this->get_payment_gateway_framework_path() . '/Admin/views/html-admin-gateway-status.php' );
795
  }
796
  }
797
 
includes/Plugin.php CHANGED
@@ -43,7 +43,7 @@ class Plugin extends Payment_Gateway_Plugin {
43
 
44
 
45
  /** plugin version number */
46
- const VERSION = '3.0.2';
47
 
48
  /** plugin ID */
49
  const PLUGIN_ID = 'square';
43
 
44
 
45
  /** plugin version number */
46
+ const VERSION = '3.0.3';
47
 
48
  /** plugin ID */
49
  const PLUGIN_ID = 'square';
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: woocommerce, automattic, royho, woothemes, bor0, mattdallan, menakas, chickenn00dle, jorgeatorres, jamesgallan, achyuthajoy
3
  Tags: credit card, square, woocommerce, inventory sync
4
  Requires at least: 4.6
5
- Tested up to: 5.9
6
  Requires PHP: 7.2
7
- Stable tag: 3.0.2
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -71,6 +71,11 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
71
  2. The payment gateway settings.
72
 
73
  == Changelog ==
 
 
 
 
 
74
  = 3.0.2 - 2022-05-17 =
75
  * Fix - Prevent fatal error caused by stale transient (cached location data from previous Square API). #788
76
  * Fix - Disable all plugin features if server requirements are not met, to prevent fatal errors. #793
2
  Contributors: woocommerce, automattic, royho, woothemes, bor0, mattdallan, menakas, chickenn00dle, jorgeatorres, jamesgallan, achyuthajoy
3
  Tags: credit card, square, woocommerce, inventory sync
4
  Requires at least: 4.6
5
+ Tested up to: 6.0
6
  Requires PHP: 7.2
7
+ Stable tag: 3.0.3
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
71
  2. The payment gateway settings.
72
 
73
  == Changelog ==
74
+ = 3.0.3 - 2022-06-01 =
75
+ * Fix - Customer Token Editor wasn't loading for some stores after updating to Square 3.0.0. #799
76
+ * Fix - No such file or directory warnings on case-sensitive filesystems. #799
77
+ * Dev - Bump compatibility to WP 6.0. #812
78
+
79
  = 3.0.2 - 2022-05-17 =
80
  * Fix - Prevent fatal error caused by stale transient (cached location data from previous Square API). #788
81
  * Fix - Disable all plugin features if server requirements are not met, to prevent fatal errors. #793
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit7072728371f354d13d3ec661f551a552::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit6c004c5aa07454b927fc64c1448a79c5::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -338,7 +338,7 @@ class ClassLoader
338
  * Loads the given class or interface.
339
  *
340
  * @param string $class The name of the class
341
- * @return bool|null True if loaded, null otherwise
342
  */
343
  public function loadClass($class)
344
  {
@@ -347,6 +347,8 @@ class ClassLoader
347
 
348
  return true;
349
  }
 
 
350
  }
351
 
352
  /**
338
  * Loads the given class or interface.
339
  *
340
  * @param string $class The name of the class
341
+ * @return true|null True if loaded, null otherwise
342
  */
343
  public function loadClass($class)
344
  {
347
 
348
  return true;
349
  }
350
+
351
+ return null;
352
  }
353
 
354
  /**
vendor/composer/InstalledVersions.php CHANGED
@@ -1,335 +1,337 @@
1
  <?php
2
 
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
 
13
  namespace Composer;
14
 
15
  use Composer\Autoload\ClassLoader;
16
  use Composer\Semver\VersionParser;
17
 
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
  class InstalledVersions
26
  {
27
- private static $installed = array (
28
- 'root' =>
29
- array (
30
- 'pretty_version' => 'dev-release/3.0.2',
31
- 'version' => 'dev-release/3.0.2',
32
- 'aliases' =>
33
- array (
34
- ),
35
- 'reference' => 'ba3fd54c620278723f9131d85393b924dc692f5e',
36
- 'name' => 'woocommerce/woocommerce-square',
37
- ),
38
- 'versions' =>
39
- array (
40
- 'apimatic/jsonmapper' =>
41
- array (
42
- 'pretty_version' => 'v2.0.3',
43
- 'version' => '2.0.3.0',
44
- 'aliases' =>
45
- array (
46
- ),
47
- 'reference' => 'f7588f1ab692c402a9118e65cb9fd42b74e5e0db',
48
- ),
49
- 'apimatic/unirest-php' =>
50
- array (
51
- 'pretty_version' => '2.0.0',
52
- 'version' => '2.0.0.0',
53
- 'aliases' =>
54
- array (
55
- ),
56
- 'reference' => 'b4e399a8970c3a5c611f734282f306381f9d1eee',
57
- ),
58
- 'square/square' =>
59
- array (
60
- 'pretty_version' => '15.0.0.20211020',
61
- 'version' => '15.0.0.20211020',
62
- 'aliases' =>
63
- array (
64
- ),
65
- 'reference' => 'a31e7fbb6cd458095b2f09543d799a06c35fd2a7',
66
- ),
67
- 'woocommerce/action-scheduler' =>
68
- array (
69
- 'pretty_version' => '3.4.0',
70
- 'version' => '3.4.0.0',
71
- 'aliases' =>
72
- array (
73
- ),
74
- 'reference' => '3218a33ff14b968f8cb05de9656c2efa1eeb1330',
75
- ),
76
- 'woocommerce/woocommerce-square' =>
77
- array (
78
- 'pretty_version' => 'dev-release/3.0.2',
79
- 'version' => 'dev-release/3.0.2',
80
- 'aliases' =>
81
- array (
82
- ),
83
- 'reference' => 'ba3fd54c620278723f9131d85393b924dc692f5e',
84
- ),
85
- ),
86
- );
87
- private static $canGetVendors;
88
- private static $installedByVendor = array();
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
- public static function getInstalledPackages()
97
- {
98
- $packages = array();
99
- foreach (self::getInstalled() as $installed) {
100
- $packages[] = array_keys($installed['versions']);
101
- }
102
-
103
- if (1 === \count($packages)) {
104
- return $packages[0];
105
- }
106
-
107
- return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
108
- }
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
- public static function isInstalled($packageName)
119
- {
120
- foreach (self::getInstalled() as $installed) {
121
- if (isset($installed['versions'][$packageName])) {
122
- return true;
123
- }
124
- }
125
-
126
- return false;
127
- }
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
- public static function satisfies(VersionParser $parser, $packageName, $constraint)
143
- {
144
- $constraint = $parser->parseConstraints($constraint);
145
- $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
146
-
147
- return $provided->matches($constraint);
148
- }
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
- public static function getVersionRanges($packageName)
160
- {
161
- foreach (self::getInstalled() as $installed) {
162
- if (!isset($installed['versions'][$packageName])) {
163
- continue;
164
- }
165
-
166
- $ranges = array();
167
- if (isset($installed['versions'][$packageName]['pretty_version'])) {
168
- $ranges[] = $installed['versions'][$packageName]['pretty_version'];
169
- }
170
- if (array_key_exists('aliases', $installed['versions'][$packageName])) {
171
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
172
- }
173
- if (array_key_exists('replaced', $installed['versions'][$packageName])) {
174
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
175
- }
176
- if (array_key_exists('provided', $installed['versions'][$packageName])) {
177
- $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
178
- }
179
-
180
- return implode(' || ', $ranges);
181
- }
182
-
183
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
184
- }
185
-
186
-
187
-
188
-
189
-
190
- public static function getVersion($packageName)
191
- {
192
- foreach (self::getInstalled() as $installed) {
193
- if (!isset($installed['versions'][$packageName])) {
194
- continue;
195
- }
196
-
197
- if (!isset($installed['versions'][$packageName]['version'])) {
198
- return null;
199
- }
200
-
201
- return $installed['versions'][$packageName]['version'];
202
- }
203
-
204
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
205
- }
206
-
207
-
208
-
209
-
210
-
211
- public static function getPrettyVersion($packageName)
212
- {
213
- foreach (self::getInstalled() as $installed) {
214
- if (!isset($installed['versions'][$packageName])) {
215
- continue;
216
- }
217
-
218
- if (!isset($installed['versions'][$packageName]['pretty_version'])) {
219
- return null;
220
- }
221
-
222
- return $installed['versions'][$packageName]['pretty_version'];
223
- }
224
-
225
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
226
- }
227
-
228
-
229
-
230
-
231
-
232
- public static function getReference($packageName)
233
- {
234
- foreach (self::getInstalled() as $installed) {
235
- if (!isset($installed['versions'][$packageName])) {
236
- continue;
237
- }
238
-
239
- if (!isset($installed['versions'][$packageName]['reference'])) {
240
- return null;
241
- }
242
-
243
- return $installed['versions'][$packageName]['reference'];
244
- }
245
-
246
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
247
- }
248
-
249
-
250
-
251
-
252
-
253
- public static function getRootPackage()
254
- {
255
- $installed = self::getInstalled();
256
-
257
- return $installed[0]['root'];
258
- }
259
-
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
- public static function getRawData()
268
- {
269
- @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
270
-
271
- return self::$installed;
272
- }
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
- public static function getAllRawData()
281
- {
282
- return self::getInstalled();
283
- }
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
- public static function reload($data)
304
- {
305
- self::$installed = $data;
306
- self::$installedByVendor = array();
307
- }
308
-
309
-
310
-
311
-
312
-
313
- private static function getInstalled()
314
- {
315
- if (null === self::$canGetVendors) {
316
- self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
317
- }
318
-
319
- $installed = array();
320
-
321
- if (self::$canGetVendors) {
322
- foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
323
- if (isset(self::$installedByVendor[$vendorDir])) {
324
- $installed[] = self::$installedByVendor[$vendorDir];
325
- } elseif (is_file($vendorDir.'/composer/installed.php')) {
326
- $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
327
- }
328
- }
329
- }
330
-
331
- $installed[] = self::$installed;
332
-
333
- return $installed;
334
- }
 
 
335
  }
1
  <?php
2
 
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
 
13
  namespace Composer;
14
 
15
  use Composer\Autoload\ClassLoader;
16
  use Composer\Semver\VersionParser;
17
 
18
+ /**
19
+ * This class is copied in every Composer installed project and available to all
20
+ *
21
+ * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
22
+ *
23
+ * To require it's presence, you can require `composer-runtime-api ^2.0`
24
+ */
25
  class InstalledVersions
26
  {
27
+ private static $installed;
28
+ private static $canGetVendors;
29
+ private static $installedByVendor = array();
30
+
31
+ /**
32
+ * Returns a list of all package names which are present, either by being installed, replaced or provided
33
+ *
34
+ * @return string[]
35
+ * @psalm-return list<string>
36
+ */
37
+ public static function getInstalledPackages()
38
+ {
39
+ $packages = array();
40
+ foreach (self::getInstalled() as $installed) {
41
+ $packages[] = array_keys($installed['versions']);
42
+ }
43
+
44
+ if (1 === \count($packages)) {
45
+ return $packages[0];
46
+ }
47
+
48
+ return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
49
+ }
50
+
51
+ /**
52
+ * Returns a list of all package names with a specific type e.g. 'library'
53
+ *
54
+ * @param string $type
55
+ * @return string[]
56
+ * @psalm-return list<string>
57
+ */
58
+ public static function getInstalledPackagesByType($type)
59
+ {
60
+ $packagesByType = array();
61
+
62
+ foreach (self::getInstalled() as $installed) {
63
+ foreach ($installed['versions'] as $name => $package) {
64
+ if (isset($package['type']) && $package['type'] === $type) {
65
+ $packagesByType[] = $name;
66
+ }
67
+ }
68
+ }
69
+
70
+ return $packagesByType;
71
+ }
72
+
73
+ /**
74
+ * Checks whether the given package is installed
75
+ *
76
+ * This also returns true if the package name is provided or replaced by another package
77
+ *
78
+ * @param string $packageName
79
+ * @param bool $includeDevRequirements
80
+ * @return bool
81
+ */
82
+ public static function isInstalled($packageName, $includeDevRequirements = true)
83
+ {
84
+ foreach (self::getInstalled() as $installed) {
85
+ if (isset($installed['versions'][$packageName])) {
86
+ return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
87
+ }
88
+ }
89
+
90
+ return false;
91
+ }
92
+
93
+ /**
94
+ * Checks whether the given package satisfies a version constraint
95
+ *
96
+ * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
97
+ *
98
+ * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
99
+ *
100
+ * @param VersionParser $parser Install composer/semver to have access to this class and functionality
101
+ * @param string $packageName
102
+ * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
103
+ * @return bool
104
+ */
105
+ public static function satisfies(VersionParser $parser, $packageName, $constraint)
106
+ {
107
+ $constraint = $parser->parseConstraints($constraint);
108
+ $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
109
+
110
+ return $provided->matches($constraint);
111
+ }
112
+
113
+ /**
114
+ * Returns a version constraint representing all the range(s) which are installed for a given package
115
+ *
116
+ * It is easier to use this via isInstalled() with the $constraint argument if you need to check
117
+ * whether a given version of a package is installed, and not just whether it exists
118
+ *
119
+ * @param string $packageName
120
+ * @return string Version constraint usable with composer/semver
121
+ */
122
+ public static function getVersionRanges($packageName)
123
+ {
124
+ foreach (self::getInstalled() as $installed) {
125
+ if (!isset($installed['versions'][$packageName])) {
126
+ continue;
127
+ }
128
+
129
+ $ranges = array();
130
+ if (isset($installed['versions'][$packageName]['pretty_version'])) {
131
+ $ranges[] = $installed['versions'][$packageName]['pretty_version'];
132
+ }
133
+ if (array_key_exists('aliases', $installed['versions'][$packageName])) {
134
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
135
+ }
136
+ if (array_key_exists('replaced', $installed['versions'][$packageName])) {
137
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
138
+ }
139
+ if (array_key_exists('provided', $installed['versions'][$packageName])) {
140
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
141
+ }
142
+
143
+ return implode(' || ', $ranges);
144
+ }
145
+
146
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
147
+ }
148
+
149
+ /**
150
+ * @param string $packageName
151
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
152
+ */
153
+ public static function getVersion($packageName)
154
+ {
155
+ foreach (self::getInstalled() as $installed) {
156
+ if (!isset($installed['versions'][$packageName])) {
157
+ continue;
158
+ }
159
+
160
+ if (!isset($installed['versions'][$packageName]['version'])) {
161
+ return null;
162
+ }
163
+
164
+ return $installed['versions'][$packageName]['version'];
165
+ }
166
+
167
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
168
+ }
169
+
170
+ /**
171
+ * @param string $packageName
172
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
173
+ */
174
+ public static function getPrettyVersion($packageName)
175
+ {
176
+ foreach (self::getInstalled() as $installed) {
177
+ if (!isset($installed['versions'][$packageName])) {
178
+ continue;
179
+ }
180
+
181
+ if (!isset($installed['versions'][$packageName]['pretty_version'])) {
182
+ return null;
183
+ }
184
+
185
+ return $installed['versions'][$packageName]['pretty_version'];
186
+ }
187
+
188
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
189
+ }
190
+
191
+ /**
192
+ * @param string $packageName
193
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
194
+ */
195
+ public static function getReference($packageName)
196
+ {
197
+ foreach (self::getInstalled() as $installed) {
198
+ if (!isset($installed['versions'][$packageName])) {
199
+ continue;
200
+ }
201
+
202
+ if (!isset($installed['versions'][$packageName]['reference'])) {
203
+ return null;
204
+ }
205
+
206
+ return $installed['versions'][$packageName]['reference'];
207
+ }
208
+
209
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
210
+ }
211
+
212
+ /**
213
+ * @param string $packageName
214
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
215
+ */
216
+ public static function getInstallPath($packageName)
217
+ {
218
+ foreach (self::getInstalled() as $installed) {
219
+ if (!isset($installed['versions'][$packageName])) {
220
+ continue;
221
+ }
222
+
223
+ return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
224
+ }
225
+
226
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
227
+ }
228
+
229
+ /**
230
+ * @return array
231
+ * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}
232
+ */
233
+ public static function getRootPackage()
234
+ {
235
+ $installed = self::getInstalled();
236
+
237
+ return $installed[0]['root'];
238
+ }
239
+
240
+ /**
241
+ * Returns the raw installed.php data for custom implementations
242
+ *
243
+ * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
244
+ * @return array[]
245
+ * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}
246
+ */
247
+ public static function getRawData()
248
+ {
249
+ @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
250
+
251
+ if (null === self::$installed) {
252
+ // only require the installed.php file if this file is loaded from its dumped location,
253
+ // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
254
+ if (substr(__DIR__, -8, 1) !== 'C') {
255
+ self::$installed = include __DIR__ . '/installed.php';
256
+ } else {
257
+ self::$installed = array();
258
+ }
259
+ }
260
+
261
+ return self::$installed;
262
+ }
263
+
264
+ /**
265
+ * Returns the raw data of all installed.php which are currently loaded for custom implementations
266
+ *
267
+ * @return array[]
268
+ * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
269
+ */
270
+ public static function getAllRawData()
271
+ {
272
+ return self::getInstalled();
273
+ }
274
+
275
+ /**
276
+ * Lets you reload the static array from another file
277
+ *
278
+ * This is only useful for complex integrations in which a project needs to use
279
+ * this class but then also needs to execute another project's autoloader in process,
280
+ * and wants to ensure both projects have access to their version of installed.php.
281
+ *
282
+ * A typical case would be PHPUnit, where it would need to make sure it reads all
283
+ * the data it needs from this class, then call reload() with
284
+ * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
285
+ * the project in which it runs can then also use this class safely, without
286
+ * interference between PHPUnit's dependencies and the project's dependencies.
287
+ *
288
+ * @param array[] $data A vendor/composer/installed.php data set
289
+ * @return void
290
+ *
291
+ * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>} $data
292
+ */
293
+ public static function reload($data)
294
+ {
295
+ self::$installed = $data;
296
+ self::$installedByVendor = array();
297
+ }
298
+
299
+ /**
300
+ * @return array[]
301
+ * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
302
+ */
303
+ private static function getInstalled()
304
+ {
305
+ if (null === self::$canGetVendors) {
306
+ self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
307
+ }
308
+
309
+ $installed = array();
310
+
311
+ if (self::$canGetVendors) {
312
+ foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
313
+ if (isset(self::$installedByVendor[$vendorDir])) {
314
+ $installed[] = self::$installedByVendor[$vendorDir];
315
+ } elseif (is_file($vendorDir.'/composer/installed.php')) {
316
+ $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
317
+ if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
318
+ self::$installed = $installed[count($installed) - 1];
319
+ }
320
+ }
321
+ }
322
+ }
323
+
324
+ if (null === self::$installed) {
325
+ // only require the installed.php file if this file is loaded from its dumped location,
326
+ // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
327
+ if (substr(__DIR__, -8, 1) !== 'C') {
328
+ self::$installed = require __DIR__ . '/installed.php';
329
+ } else {
330
+ self::$installed = array();
331
+ }
332
+ }
333
+ $installed[] = self::$installed;
334
+
335
+ return $installed;
336
+ }
337
  }
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit7072728371f354d13d3ec661f551a552
6
  {
7
  private static $loader;
8
 
@@ -24,15 +24,15 @@ class ComposerAutoloaderInit7072728371f354d13d3ec661f551a552
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
- spl_autoload_register(array('ComposerAutoloaderInit7072728371f354d13d3ec661f551a552', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
- spl_autoload_unregister(array('ComposerAutoloaderInit7072728371f354d13d3ec661f551a552', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
  require __DIR__ . '/autoload_static.php';
34
 
35
- call_user_func(\Composer\Autoload\ComposerStaticInit7072728371f354d13d3ec661f551a552::getInitializer($loader));
36
  } else {
37
  $map = require __DIR__ . '/autoload_namespaces.php';
38
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit6c004c5aa07454b927fc64c1448a79c5
6
  {
7
  private static $loader;
8
 
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
+ spl_autoload_register(array('ComposerAutoloaderInit6c004c5aa07454b927fc64c1448a79c5', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
+ spl_autoload_unregister(array('ComposerAutoloaderInit6c004c5aa07454b927fc64c1448a79c5', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
  require __DIR__ . '/autoload_static.php';
34
 
35
+ call_user_func(\Composer\Autoload\ComposerStaticInit6c004c5aa07454b927fc64c1448a79c5::getInitializer($loader));
36
  } else {
37
  $map = require __DIR__ . '/autoload_namespaces.php';
38
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit7072728371f354d13d3ec661f551a552
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'a' =>
@@ -45,10 +45,10 @@ class ComposerStaticInit7072728371f354d13d3ec661f551a552
45
  public static function getInitializer(ClassLoader $loader)
46
  {
47
  return \Closure::bind(function () use ($loader) {
48
- $loader->prefixLengthsPsr4 = ComposerStaticInit7072728371f354d13d3ec661f551a552::$prefixLengthsPsr4;
49
- $loader->prefixDirsPsr4 = ComposerStaticInit7072728371f354d13d3ec661f551a552::$prefixDirsPsr4;
50
- $loader->prefixesPsr0 = ComposerStaticInit7072728371f354d13d3ec661f551a552::$prefixesPsr0;
51
- $loader->classMap = ComposerStaticInit7072728371f354d13d3ec661f551a552::$classMap;
52
 
53
  }, null, ClassLoader::class);
54
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit6c004c5aa07454b927fc64c1448a79c5
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'a' =>
45
  public static function getInitializer(ClassLoader $loader)
46
  {
47
  return \Closure::bind(function () use ($loader) {
48
+ $loader->prefixLengthsPsr4 = ComposerStaticInit6c004c5aa07454b927fc64c1448a79c5::$prefixLengthsPsr4;
49
+ $loader->prefixDirsPsr4 = ComposerStaticInit6c004c5aa07454b927fc64c1448a79c5::$prefixDirsPsr4;
50
+ $loader->prefixesPsr0 = ComposerStaticInit6c004c5aa07454b927fc64c1448a79c5::$prefixesPsr0;
51
+ $loader->classMap = ComposerStaticInit6c004c5aa07454b927fc64c1448a79c5::$classMap;
52
 
53
  }, null, ClassLoader::class);
54
  }
vendor/composer/installed.php CHANGED
@@ -1,60 +1,59 @@
1
- <?php return array (
2
- 'root' =>
3
- array (
4
- 'pretty_version' => 'dev-release/3.0.2',
5
- 'version' => 'dev-release/3.0.2',
6
- 'aliases' =>
7
- array (
 
 
 
8
  ),
9
- 'reference' => 'ba3fd54c620278723f9131d85393b924dc692f5e',
10
- 'name' => 'woocommerce/woocommerce-square',
11
- ),
12
- 'versions' =>
13
- array (
14
- 'apimatic/jsonmapper' =>
15
- array (
16
- 'pretty_version' => 'v2.0.3',
17
- 'version' => '2.0.3.0',
18
- 'aliases' =>
19
- array (
20
- ),
21
- 'reference' => 'f7588f1ab692c402a9118e65cb9fd42b74e5e0db',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  ),
23
- 'apimatic/unirest-php' =>
24
- array (
25
- 'pretty_version' => '2.0.0',
26
- 'version' => '2.0.0.0',
27
- 'aliases' =>
28
- array (
29
- ),
30
- 'reference' => 'b4e399a8970c3a5c611f734282f306381f9d1eee',
31
- ),
32
- 'square/square' =>
33
- array (
34
- 'pretty_version' => '15.0.0.20211020',
35
- 'version' => '15.0.0.20211020',
36
- 'aliases' =>
37
- array (
38
- ),
39
- 'reference' => 'a31e7fbb6cd458095b2f09543d799a06c35fd2a7',
40
- ),
41
- 'woocommerce/action-scheduler' =>
42
- array (
43
- 'pretty_version' => '3.4.0',
44
- 'version' => '3.4.0.0',
45
- 'aliases' =>
46
- array (
47
- ),
48
- 'reference' => '3218a33ff14b968f8cb05de9656c2efa1eeb1330',
49
- ),
50
- 'woocommerce/woocommerce-square' =>
51
- array (
52
- 'pretty_version' => 'dev-release/3.0.2',
53
- 'version' => 'dev-release/3.0.2',
54
- 'aliases' =>
55
- array (
56
- ),
57
- 'reference' => 'ba3fd54c620278723f9131d85393b924dc692f5e',
58
- ),
59
- ),
60
  );
1
+ <?php return array(
2
+ 'root' => array(
3
+ 'pretty_version' => 'dev-release/3.0.3',
4
+ 'version' => 'dev-release/3.0.3',
5
+ 'type' => 'library',
6
+ 'install_path' => __DIR__ . '/../../',
7
+ 'aliases' => array(),
8
+ 'reference' => 'd7da55b543afbd20c255db4adb43cbaba1af8cb9',
9
+ 'name' => 'woocommerce/woocommerce-square',
10
+ 'dev' => false,
11
  ),
12
+ 'versions' => array(
13
+ 'apimatic/jsonmapper' => array(
14
+ 'pretty_version' => 'v2.0.3',
15
+ 'version' => '2.0.3.0',
16
+ 'type' => 'library',
17
+ 'install_path' => __DIR__ . '/../apimatic/jsonmapper',
18
+ 'aliases' => array(),
19
+ 'reference' => 'f7588f1ab692c402a9118e65cb9fd42b74e5e0db',
20
+ 'dev_requirement' => false,
21
+ ),
22
+ 'apimatic/unirest-php' => array(
23
+ 'pretty_version' => '2.0.0',
24
+ 'version' => '2.0.0.0',
25
+ 'type' => 'library',
26
+ 'install_path' => __DIR__ . '/../apimatic/unirest-php',
27
+ 'aliases' => array(),
28
+ 'reference' => 'b4e399a8970c3a5c611f734282f306381f9d1eee',
29
+ 'dev_requirement' => false,
30
+ ),
31
+ 'square/square' => array(
32
+ 'pretty_version' => '15.0.0.20211020',
33
+ 'version' => '15.0.0.20211020',
34
+ 'type' => 'library',
35
+ 'install_path' => __DIR__ . '/../square/square',
36
+ 'aliases' => array(),
37
+ 'reference' => 'a31e7fbb6cd458095b2f09543d799a06c35fd2a7',
38
+ 'dev_requirement' => false,
39
+ ),
40
+ 'woocommerce/action-scheduler' => array(
41
+ 'pretty_version' => '3.4.0',
42
+ 'version' => '3.4.0.0',
43
+ 'type' => 'wordpress-plugin',
44
+ 'install_path' => __DIR__ . '/../woocommerce/action-scheduler',
45
+ 'aliases' => array(),
46
+ 'reference' => '3218a33ff14b968f8cb05de9656c2efa1eeb1330',
47
+ 'dev_requirement' => false,
48
+ ),
49
+ 'woocommerce/woocommerce-square' => array(
50
+ 'pretty_version' => 'dev-release/3.0.3',
51
+ 'version' => 'dev-release/3.0.3',
52
+ 'type' => 'library',
53
+ 'install_path' => __DIR__ . '/../../',
54
+ 'aliases' => array(),
55
+ 'reference' => 'd7da55b543afbd20c255db4adb43cbaba1af8cb9',
56
+ 'dev_requirement' => false,
57
+ ),
58
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  );
woocommerce-square.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
- * Version: 3.0.2
5
  * Plugin URI: https://woocommerce.com/products/square/
6
  * Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
7
  * Author: WooCommerce
@@ -20,7 +20,7 @@
20
  *
21
  * WC requires at least: 3.0
22
  * WC tested up to: 6.3
23
- * Tested up to: 5.9
24
  */
25
 
26
  defined( 'ABSPATH' ) || exit;
1
  <?php
2
  /**
3
  * Plugin Name: WooCommerce Square
4
+ * Version: 3.0.3
5
  * Plugin URI: https://woocommerce.com/products/square/
6
  * Description: Adds ability to sync inventory between WooCommerce and Square POS. In addition, you can also make purchases through the Square payment gateway.
7
  * Author: WooCommerce
20
  *
21
  * WC requires at least: 3.0
22
  * WC tested up to: 6.3
23
+ * Tested up to: 6.0
24
  */
25
 
26
  defined( 'ABSPATH' ) || exit;