Version Description
- 2022-05-17 =
- Fix - Prevent fatal error caused by stale transient (cached location data from previous Square API). #788
- Fix - Disable all plugin features if server requirements are not met, to prevent fatal errors. #793
Download this release
Release Info
Developer | automattic |
Plugin | WooCommerce Square |
Version | 3.0.2 |
Comparing to | |
See all releases |
Code changes from version 3.0.1 to 3.0.2
- changelog.txt +5 -0
- i18n/languages/woocommerce-square.pot +28 -8
- includes/Lifecycle.php +12 -0
- includes/Plugin.php +1 -1
- includes/Settings.php +4 -2
- readme.txt +6 -1
- vendor/autoload.php +1 -1
- vendor/composer/ClassLoader.php +1 -3
- vendor/composer/InstalledVersions.php +324 -326
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_static.php +5 -5
- vendor/composer/installed.php +57 -56
- woocommerce-square.php +71 -55
changelog.txt
CHANGED
@@ -1,7 +1,12 @@
|
|
1 |
*** WooCommerce Square Changelog ***
|
2 |
|
|
|
|
|
|
|
|
|
3 |
= 3.0.1 - 2022-05-09 =
|
4 |
* Fix - Checkout stuck processing when using a card that doesn't require a postal code. #782
|
|
|
5 |
|
6 |
= 3.0.0 - 2022-05-04 =
|
7 |
* New - Upgrade the payment form on checkout to use the latest Square Web Payments SDK. PR#668
|
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
|
6 |
+
|
7 |
= 3.0.1 - 2022-05-09 =
|
8 |
* Fix - Checkout stuck processing when using a card that doesn't require a postal code. #782
|
9 |
+
* Dev - Update minimum PHP version requirement to 7.2. #787
|
10 |
|
11 |
= 3.0.0 - 2022-05-04 =
|
12 |
* New - Upgrade the payment form on checkout to use the latest Square Web Payments SDK. PR#668
|
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.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-square\n"
|
8 |
-
"POT-Creation-Date: 2022-05-
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -69,7 +69,7 @@ msgid "Stock must be fetched from Square before editing stock quantity"
|
|
69 |
msgstr ""
|
70 |
|
71 |
#: includes/Admin/Privacy.php:43 includes/Admin/Settings_Page.php:54
|
72 |
-
#: includes/Gateway.php:82 includes/Settings.php:221 includes/Settings.php:
|
73 |
msgid "Square"
|
74 |
msgstr ""
|
75 |
|
@@ -434,11 +434,11 @@ msgstr ""
|
|
434 |
msgid "The sync job has failed. Check sync records, or %s."
|
435 |
msgstr ""
|
436 |
|
437 |
-
#: includes/Framework/Lifecycle.php:303 includes/Lifecycle.php:
|
438 |
msgid "Awesome"
|
439 |
msgstr ""
|
440 |
|
441 |
-
#: includes/Framework/Lifecycle.php:304 includes/Lifecycle.php:
|
442 |
msgid "Fantastic"
|
443 |
msgstr ""
|
444 |
|
@@ -446,7 +446,7 @@ msgstr ""
|
|
446 |
msgid "Cowabunga"
|
447 |
msgstr ""
|
448 |
|
449 |
-
#: includes/Framework/Lifecycle.php:306 includes/Lifecycle.php:
|
450 |
msgid "Congratulations"
|
451 |
msgstr ""
|
452 |
|
@@ -454,7 +454,7 @@ msgstr ""
|
|
454 |
msgid "Hot dog"
|
455 |
msgstr ""
|
456 |
|
457 |
-
#: includes/Framework/Lifecycle.php:314 includes/Lifecycle.php:
|
458 |
#. translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a>
|
459 |
#. tag, %4$s - <a> tag, %5$s - </a> tag
|
460 |
msgid ""
|
@@ -2199,7 +2199,7 @@ msgid_plural "Updated data for %d products."
|
|
2199 |
msgstr[0] ""
|
2200 |
msgstr[1] ""
|
2201 |
|
2202 |
-
#: includes/Lifecycle.php:
|
2203 |
msgid "Great"
|
2204 |
msgstr ""
|
2205 |
|
@@ -3236,6 +3236,26 @@ msgstr[1] ""
|
|
3236 |
msgid "Migrated action with ID %1$d in %2$s to ID %3$d in %4$s"
|
3237 |
msgstr ""
|
3238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3239 |
#. Plugin URI of the plugin/theme
|
3240 |
msgid "https://woocommerce.com/products/square/"
|
3241 |
msgstr ""
|
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"
|
69 |
msgstr ""
|
70 |
|
71 |
#: includes/Admin/Privacy.php:43 includes/Admin/Settings_Page.php:54
|
72 |
+
#: includes/Gateway.php:82 includes/Settings.php:221 includes/Settings.php:757
|
73 |
msgid "Square"
|
74 |
msgstr ""
|
75 |
|
434 |
msgid "The sync job has failed. Check sync records, or %s."
|
435 |
msgstr ""
|
436 |
|
437 |
+
#: includes/Framework/Lifecycle.php:303 includes/Lifecycle.php:184
|
438 |
msgid "Awesome"
|
439 |
msgstr ""
|
440 |
|
441 |
+
#: includes/Framework/Lifecycle.php:304 includes/Lifecycle.php:187
|
442 |
msgid "Fantastic"
|
443 |
msgstr ""
|
444 |
|
446 |
msgid "Cowabunga"
|
447 |
msgstr ""
|
448 |
|
449 |
+
#: includes/Framework/Lifecycle.php:306 includes/Lifecycle.php:185
|
450 |
msgid "Congratulations"
|
451 |
msgstr ""
|
452 |
|
454 |
msgid "Hot dog"
|
455 |
msgstr ""
|
456 |
|
457 |
+
#: includes/Framework/Lifecycle.php:314 includes/Lifecycle.php:194
|
458 |
#. translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a>
|
459 |
#. tag, %4$s - <a> tag, %5$s - </a> tag
|
460 |
msgid ""
|
2199 |
msgstr[0] ""
|
2200 |
msgstr[1] ""
|
2201 |
|
2202 |
+
#: includes/Lifecycle.php:186
|
2203 |
msgid "Great"
|
2204 |
msgstr ""
|
2205 |
|
3236 |
msgid "Migrated action with ID %1$d in %2$s to ID %3$d in %4$s"
|
3237 |
msgstr ""
|
3238 |
|
3239 |
+
#: woocommerce-square.php:344
|
3240 |
+
msgid ""
|
3241 |
+
"<strong>All features in %1$s have been disabled</strong> due to unsupported "
|
3242 |
+
"settings:<br>"
|
3243 |
+
msgstr ""
|
3244 |
+
|
3245 |
+
#: woocommerce-square.php:351
|
3246 |
+
msgid ""
|
3247 |
+
"• <strong>Invalid PHP version: </strong>The minimum PHP version "
|
3248 |
+
"required is %1$s. You are running %2$s.<br>"
|
3249 |
+
msgstr ""
|
3250 |
+
|
3251 |
+
#: woocommerce-square.php:359
|
3252 |
+
msgid ""
|
3253 |
+
"• <strong>Invalid OPcache config: </strong><a href=\"%s\" "
|
3254 |
+
"target=\"_blank\">Please ensure the <code>save_comments</code> PHP option "
|
3255 |
+
"is enabled.</a> You may need to contact your hosting provider to change "
|
3256 |
+
"caching options."
|
3257 |
+
msgstr ""
|
3258 |
+
|
3259 |
#. Plugin URI of the plugin/theme
|
3260 |
msgid "https://woocommerce.com/products/square/"
|
3261 |
msgstr ""
|
includes/Lifecycle.php
CHANGED
@@ -54,6 +54,7 @@ class Lifecycle extends \WooCommerce\Square\Framework\Lifecycle {
|
|
54 |
'2.1.5',
|
55 |
'2.2.0',
|
56 |
'2.3.0',
|
|
|
57 |
);
|
58 |
}
|
59 |
|
@@ -232,6 +233,17 @@ class Lifecycle extends \WooCommerce\Square\Framework\Lifecycle {
|
|
232 |
update_option( 'woocommerce_square_credit_card_settings', $gateway_settings );
|
233 |
}
|
234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
/**
|
236 |
* Migrates plugin settings from v1 to v2.
|
237 |
*
|
54 |
'2.1.5',
|
55 |
'2.2.0',
|
56 |
'2.3.0',
|
57 |
+
'3.0.2',
|
58 |
);
|
59 |
}
|
60 |
|
233 |
update_option( 'woocommerce_square_credit_card_settings', $gateway_settings );
|
234 |
}
|
235 |
|
236 |
+
/**
|
237 |
+
* Deletes the transient that holds locations data.
|
238 |
+
*
|
239 |
+
* @see https://github.com/woocommerce/woocommerce-square/issues/786#issuecomment-1121388650
|
240 |
+
*
|
241 |
+
* @since 3.0.2
|
242 |
+
*/
|
243 |
+
protected function upgrade_to_3_0_2() {
|
244 |
+
delete_transient( 'wc_square_locations' );
|
245 |
+
}
|
246 |
+
|
247 |
/**
|
248 |
* Migrates plugin settings from v1 to v2.
|
249 |
*
|
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.
|
47 |
|
48 |
/** plugin ID */
|
49 |
const PLUGIN_ID = 'square';
|
43 |
|
44 |
|
45 |
/** plugin version number */
|
46 |
+
const VERSION = '3.0.2';
|
47 |
|
48 |
/** plugin ID */
|
49 |
const PLUGIN_ID = 'square';
|
includes/Settings.php
CHANGED
@@ -685,10 +685,12 @@ class Settings extends \WC_Settings_API {
|
|
685 |
return $this->locations;
|
686 |
}
|
687 |
|
|
|
|
|
688 |
// don't always need to refetch when not on Settings screen.
|
689 |
if ( ! $this->is_admin_settings_screen() ) {
|
690 |
|
691 |
-
$this->locations = get_transient(
|
692 |
}
|
693 |
|
694 |
if ( ! is_array( $this->locations ) && did_action( 'wc_square_initialized' ) ) {
|
@@ -699,7 +701,7 @@ class Settings extends \WC_Settings_API {
|
|
699 |
|
700 |
// cache the locations returned so they can be used elsewhere.
|
701 |
$this->locations = $this->get_plugin()->get_api( $this->get_access_token(), $this->is_sandbox() )->get_locations();
|
702 |
-
set_transient(
|
703 |
|
704 |
// check the returned IDs against what's currently configured.
|
705 |
$stored_location_id = $this->get_location_id();
|
685 |
return $this->locations;
|
686 |
}
|
687 |
|
688 |
+
$locations_transient_key = 'wc_square_locations_' . $this->get_plugin()->get_version();
|
689 |
+
|
690 |
// don't always need to refetch when not on Settings screen.
|
691 |
if ( ! $this->is_admin_settings_screen() ) {
|
692 |
|
693 |
+
$this->locations = get_transient( $locations_transient_key );
|
694 |
}
|
695 |
|
696 |
if ( ! is_array( $this->locations ) && did_action( 'wc_square_initialized' ) ) {
|
701 |
|
702 |
// cache the locations returned so they can be used elsewhere.
|
703 |
$this->locations = $this->get_plugin()->get_api( $this->get_access_token(), $this->is_sandbox() )->get_locations();
|
704 |
+
set_transient( $locations_transient_key, $this->locations, HOUR_IN_SECONDS );
|
705 |
|
706 |
// check the returned IDs against what's currently configured.
|
707 |
$stored_location_id = $this->get_location_id();
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -71,8 +71,13 @@ 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.1 - 2022-05-09 =
|
75 |
* Fix - Checkout stuck processing when using a card that doesn't require a postal code. #782
|
|
|
76 |
|
77 |
= 3.0.0 - 2022-05-04 =
|
78 |
* New - Upgrade the payment form on checkout to use the latest Square Web Payments SDK. PR#668
|
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 |
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
|
77 |
+
|
78 |
= 3.0.1 - 2022-05-09 =
|
79 |
* Fix - Checkout stuck processing when using a card that doesn't require a postal code. #782
|
80 |
+
* Dev - Update minimum PHP version requirement to 7.2. #787
|
81 |
|
82 |
= 3.0.0 - 2022-05-04 =
|
83 |
* New - Upgrade the payment form on checkout to use the latest Square Web Payments SDK. PR#668
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit7072728371f354d13d3ec661f551a552::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
|
342 |
*/
|
343 |
public function loadClass($class)
|
344 |
{
|
@@ -347,8 +347,6 @@ class ClassLoader
|
|
347 |
|
348 |
return true;
|
349 |
}
|
350 |
-
|
351 |
-
return null;
|
352 |
}
|
353 |
|
354 |
/**
|
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 |
|
348 |
return true;
|
349 |
}
|
|
|
|
|
350 |
}
|
351 |
|
352 |
/**
|
vendor/composer/InstalledVersions.php
CHANGED
@@ -1,337 +1,335 @@
|
|
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 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
return $installed;
|
336 |
-
}
|
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 |
}
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -24,15 +24,15 @@ class ComposerAutoloaderInit42c48ceaa986e1554a68107e2a17949b
|
|
24 |
|
25 |
require __DIR__ . '/platform_check.php';
|
26 |
|
27 |
-
spl_autoload_register(array('
|
28 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
29 |
-
spl_autoload_unregister(array('
|
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\
|
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 ComposerAutoloaderInit7072728371f354d13d3ec661f551a552
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
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) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'a' =>
|
@@ -45,10 +45,10 @@ class ComposerStaticInit42c48ceaa986e1554a68107e2a17949b
|
|
45 |
public static function getInitializer(ClassLoader $loader)
|
46 |
{
|
47 |
return \Closure::bind(function () use ($loader) {
|
48 |
-
$loader->prefixLengthsPsr4 =
|
49 |
-
$loader->prefixDirsPsr4 =
|
50 |
-
$loader->prefixesPsr0 =
|
51 |
-
$loader->classMap =
|
52 |
|
53 |
}, null, ClassLoader::class);
|
54 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit7072728371f354d13d3ec661f551a552
|
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 = ComposerStaticInit7072728371f354d13d3ec661f551a552::$prefixLengthsPsr4;
|
49 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit7072728371f354d13d3ec661f551a552::$prefixDirsPsr4;
|
50 |
+
$loader->prefixesPsr0 = ComposerStaticInit7072728371f354d13d3ec661f551a552::$prefixesPsr0;
|
51 |
+
$loader->classMap = ComposerStaticInit7072728371f354d13d3ec661f551a552::$classMap;
|
52 |
|
53 |
}, null, ClassLoader::class);
|
54 |
}
|
vendor/composer/installed.php
CHANGED
@@ -1,59 +1,60 @@
|
|
1 |
-
<?php return array(
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
'reference' => 'd273dbddced207edeeaf078ce1eabc4c13fb3131',
|
9 |
-
'name' => 'woocommerce/woocommerce-square',
|
10 |
-
'dev' => false,
|
11 |
),
|
12 |
-
'
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
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.1',
|
51 |
-
'version' => 'dev-release/3.0.1',
|
52 |
-
'type' => 'library',
|
53 |
-
'install_path' => __DIR__ . '/../../',
|
54 |
-
'aliases' => array(),
|
55 |
-
'reference' => 'd273dbddced207edeeaf078ce1eabc4c13fb3131',
|
56 |
-
'dev_requirement' => false,
|
57 |
-
),
|
58 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
);
|
woocommerce-square.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Square
|
4 |
-
* Version: 3.0.
|
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
|
@@ -59,7 +59,7 @@ class WooCommerce_Square_Loader {
|
|
59 |
const FRAMEWORK_VERSION = '5.4.0';
|
60 |
|
61 |
/** the plugin name, for displaying notices */
|
62 |
-
const PLUGIN_NAME = 'WooCommerce
|
63 |
|
64 |
|
65 |
/** @var WooCommerce_Square_Loader single instance of this class */
|
@@ -75,20 +75,14 @@ class WooCommerce_Square_Loader {
|
|
75 |
* @since 2.0.0
|
76 |
*/
|
77 |
protected function __construct() {
|
78 |
-
|
79 |
-
register_activation_hook( __FILE__, array( $this, 'activation_check' ) );
|
80 |
-
|
81 |
-
add_action( 'admin_init', array( $this, 'check_environment' ) );
|
82 |
add_action( 'admin_init', array( $this, 'add_plugin_notices' ) );
|
83 |
-
|
84 |
add_action( 'admin_notices', array( $this, 'admin_notices' ), 15 );
|
85 |
|
86 |
-
// if the environment check fails, initialize the plugin
|
87 |
if ( $this->is_environment_compatible() ) {
|
88 |
add_action( 'plugins_loaded', array( $this, 'init_plugin' ) );
|
|
|
89 |
}
|
90 |
-
|
91 |
-
add_action( 'woocommerce_blocks_payment_method_type_registration', array( $this, 'register_payment_method_block_integrations' ), 5, 1 );
|
92 |
}
|
93 |
|
94 |
|
@@ -176,40 +170,6 @@ class WooCommerce_Square_Loader {
|
|
176 |
return self::FRAMEWORK_VERSION;
|
177 |
}
|
178 |
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Checks the server environment and other factors and deactivates plugins as necessary.
|
182 |
-
*
|
183 |
-
* Based on http://wptavern.com/how-to-prevent-wordpress-plugins-from-activating-on-sites-with-incompatible-hosting-environments
|
184 |
-
*
|
185 |
-
* @since 2.0.0
|
186 |
-
*/
|
187 |
-
public function activation_check() {
|
188 |
-
|
189 |
-
if ( ! $this->is_environment_compatible() ) {
|
190 |
-
|
191 |
-
$this->deactivate_plugin();
|
192 |
-
|
193 |
-
wp_die( self::PLUGIN_NAME . ' could not be activated. ' . $this->get_environment_message() );
|
194 |
-
}
|
195 |
-
}
|
196 |
-
|
197 |
-
/**
|
198 |
-
* Checks the environment on loading WordPress, just in case the environment changes after activation.
|
199 |
-
*
|
200 |
-
* @since 2.0.0
|
201 |
-
*/
|
202 |
-
public function check_environment() {
|
203 |
-
|
204 |
-
if ( ! $this->is_environment_compatible() && is_plugin_active( plugin_basename( __FILE__ ) ) ) {
|
205 |
-
|
206 |
-
$this->deactivate_plugin();
|
207 |
-
|
208 |
-
$this->add_admin_notice( 'bad_environment', 'error', self::PLUGIN_NAME . ' has been deactivated. ' . $this->get_environment_message() );
|
209 |
-
}
|
210 |
-
}
|
211 |
-
|
212 |
-
|
213 |
/**
|
214 |
* Adds notices for out-of-date WordPress and/or WooCommerce versions.
|
215 |
*
|
@@ -344,7 +304,20 @@ class WooCommerce_Square_Loader {
|
|
344 |
?>
|
345 |
<div class="<?php echo esc_attr( $notice['class'] ); ?>">
|
346 |
<p>
|
347 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
</p>
|
349 |
</div>
|
350 |
<?php
|
@@ -361,26 +334,69 @@ class WooCommerce_Square_Loader {
|
|
361 |
*
|
362 |
* @return bool
|
363 |
*/
|
364 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
|
366 |
-
|
367 |
-
|
|
|
|
|
|
|
|
|
|
|
368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
|
370 |
/**
|
371 |
-
*
|
372 |
*
|
373 |
-
* @since
|
374 |
*
|
375 |
-
* @return
|
376 |
*/
|
377 |
-
protected function
|
378 |
-
|
379 |
-
$
|
380 |
|
381 |
-
return $
|
382 |
}
|
383 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
|
385 |
/**
|
386 |
* Register the Square Credit Card checkout block integration class
|
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
|
59 |
const FRAMEWORK_VERSION = '5.4.0';
|
60 |
|
61 |
/** the plugin name, for displaying notices */
|
62 |
+
const PLUGIN_NAME = 'Square for WooCommerce';
|
63 |
|
64 |
|
65 |
/** @var WooCommerce_Square_Loader single instance of this class */
|
75 |
* @since 2.0.0
|
76 |
*/
|
77 |
protected function __construct() {
|
|
|
|
|
|
|
|
|
78 |
add_action( 'admin_init', array( $this, 'add_plugin_notices' ) );
|
|
|
79 |
add_action( 'admin_notices', array( $this, 'admin_notices' ), 15 );
|
80 |
|
81 |
+
// if the environment check fails, don't initialize the plugin.
|
82 |
if ( $this->is_environment_compatible() ) {
|
83 |
add_action( 'plugins_loaded', array( $this, 'init_plugin' ) );
|
84 |
+
add_action( 'woocommerce_blocks_payment_method_type_registration', array( $this, 'register_payment_method_block_integrations' ), 5, 1 );
|
85 |
}
|
|
|
|
|
86 |
}
|
87 |
|
88 |
|
170 |
return self::FRAMEWORK_VERSION;
|
171 |
}
|
172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
/**
|
174 |
* Adds notices for out-of-date WordPress and/or WooCommerce versions.
|
175 |
*
|
304 |
?>
|
305 |
<div class="<?php echo esc_attr( $notice['class'] ); ?>">
|
306 |
<p>
|
307 |
+
<?php
|
308 |
+
echo wp_kses(
|
309 |
+
$notice['message'],
|
310 |
+
array(
|
311 |
+
'a' => array(
|
312 |
+
'href' => array(),
|
313 |
+
'target' => array(),
|
314 |
+
),
|
315 |
+
'code' => array(),
|
316 |
+
'strong' => array(),
|
317 |
+
'br' => array(),
|
318 |
+
)
|
319 |
+
);
|
320 |
+
?>
|
321 |
</p>
|
322 |
</div>
|
323 |
<?php
|
334 |
*
|
335 |
* @return bool
|
336 |
*/
|
337 |
+
public function is_environment_compatible() {
|
338 |
+
$is_php_valid = $this->is_php_version_valid();
|
339 |
+
$is_opcache_config_valid = $this->is_opcache_save_message_enabled();
|
340 |
+
$error_message = '';
|
341 |
+
|
342 |
+
if ( ! $is_php_valid || ! $is_opcache_config_valid ) {
|
343 |
+
$error_message .= sprintf(
|
344 |
+
__( '<strong>All features in %1$s have been disabled</strong> due to unsupported settings:<br>', 'woocommerce-square' ),
|
345 |
+
self::PLUGIN_NAME
|
346 |
+
);
|
347 |
+
}
|
348 |
|
349 |
+
if ( ! $is_php_valid ) {
|
350 |
+
$error_message .= sprintf(
|
351 |
+
__( '• <strong>Invalid PHP version: </strong>The minimum PHP version required is %1$s. You are running %2$s.<br>', 'woocommerce-square' ),
|
352 |
+
self::MINIMUM_PHP_VERSION,
|
353 |
+
PHP_VERSION
|
354 |
+
);
|
355 |
+
}
|
356 |
|
357 |
+
if ( ! $is_opcache_config_valid ) {
|
358 |
+
$error_message .= sprintf(
|
359 |
+
__( '• <strong>Invalid OPcache config: </strong><a href="%s" target="_blank">Please ensure the <code>save_comments</code> PHP option is enabled.</a> You may need to contact your hosting provider to change caching options.', 'woocommerce-square' ),
|
360 |
+
'https://woocommerce.com/document/woocommerce-square/#section-43'
|
361 |
+
);
|
362 |
+
}
|
363 |
+
|
364 |
+
if ( ! empty( $error_message ) ) {
|
365 |
+
$this->add_admin_notice(
|
366 |
+
'bad_environment',
|
367 |
+
'error',
|
368 |
+
$error_message
|
369 |
+
);
|
370 |
+
}
|
371 |
+
|
372 |
+
return $is_php_valid && $is_opcache_config_valid;
|
373 |
+
}
|
374 |
|
375 |
/**
|
376 |
+
* Returns true if opcache.save_comments is enabled.
|
377 |
*
|
378 |
+
* @since 3.0.2
|
379 |
*
|
380 |
+
* @return boolean
|
381 |
*/
|
382 |
+
protected function is_opcache_save_message_enabled() {
|
383 |
+
$zend_optimizer_plus = extension_loaded( 'Zend Optimizer+' ) && '0' === ( ini_get( 'zend_optimizerplus.save_comments' ) || '0' === ini_get( 'opcache.save_comments' ) );
|
384 |
+
$zend_opcache = extension_loaded( 'Zend OPcache' ) && '0' === ini_get( 'opcache.save_comments' );
|
385 |
|
386 |
+
return ! ( $zend_optimizer_plus || $zend_opcache );
|
387 |
}
|
388 |
|
389 |
+
/**
|
390 |
+
* Returns true if the PHP version of the environment
|
391 |
+
* meets the requirement.
|
392 |
+
*
|
393 |
+
* @since 3.0.2
|
394 |
+
*
|
395 |
+
* @return boolean
|
396 |
+
*/
|
397 |
+
protected function is_php_version_valid() {
|
398 |
+
return version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '>=' );
|
399 |
+
}
|
400 |
|
401 |
/**
|
402 |
* Register the Square Credit Card checkout block integration class
|