Version Description
- 2021-06-02 =
- Added additional costs methods to tracking
- Fixed calculation additional costs
- Fixed initial checkout validation when free shipping notice displayed
Download this release
Release Info
Developer | wpdesk |
Plugin | Flexible Shipping for WooCommerce |
Version | 4.5.1 |
Comparing to | |
See all releases |
Code changes from version 4.5.0 to 4.5.1
- classes/class-flexible-shipping-plugin.php +1 -0
- classes/table-rate/shipping-method.php +3 -23
- flexible-shipping.php +2 -2
- lang/flexible-shipping.pot +53 -35
- readme.txt +13 -2
- src/WPDesk/FS/TableRate/FreeShipping/FreeShippingNotice.php +31 -15
- src/WPDesk/FS/TableRate/FreeShipping/FreeShippingNoticeGenerator.php +2 -1
- src/WPDesk/FS/TableRate/Rule/Condition/ConditionsFactory.php +6 -3
- src/WPDesk/FS/TableRate/Rule/Cost/AbstractAdditionalCost.php +2 -3
- src/WPDesk/FS/TableRate/Rule/TrackerData.php +12 -0
- src/WPDesk/FS/TableRate/ShippingMethodSingle.php +2 -4
- src/WPDesk/FS/TableRate/ShippingMethodTrait.php +28 -0
- src/WPDesk/FS/Tracker/TrackerNotices.php +61 -0
- vendor/autoload.php +1 -1
- vendor/composer/autoload_classmap.php +8 -0
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +13 -5
- vendor/composer/platform_check.php +26 -0
- vendor_prefixed/monolog/monolog/src/Monolog/Logger.php +1 -1
- vendor_prefixed/wpdesk/wp-codeception/composer.json +7 -2
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/CommandProvider.php +4 -1
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/Configuration.php +328 -0
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/LocalCodeceptionTrait.php +213 -0
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareCodeceptionDb.php +43 -0
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareLocalCodeceptionTests.php +44 -0
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareWordpressForCodeception.php +66 -0
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunLocalCodeceptionTests.php +11 -3
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SettingsException.php +14 -0
- vendor_prefixed/wpdesk/wp-wpdesk-fs-table-rate/src/Settings/MethodSettingsFactory.php +1 -1
- vendor_prefixed/wpdesk/wp-wpdesk-helper/src/HelperRemover.php +3 -3
classes/class-flexible-shipping-plugin.php
CHANGED
@@ -482,6 +482,7 @@ class Flexible_Shipping_Plugin extends AbstractPlugin implements HookableCollect
|
|
482 |
public function create_tracker() {
|
483 |
$tracker_factory = new WPDesk_Tracker_Factory();
|
484 |
$tracker_factory->create_tracker( basename( dirname( __FILE__ ) ) );
|
|
|
485 |
}
|
486 |
|
487 |
/**
|
482 |
public function create_tracker() {
|
483 |
$tracker_factory = new WPDesk_Tracker_Factory();
|
484 |
$tracker_factory->create_tracker( basename( dirname( __FILE__ ) ) );
|
485 |
+
(new \WPDesk\FS\Tracker\TrackerNotices())->hooks();
|
486 |
}
|
487 |
|
488 |
/**
|
classes/table-rate/shipping-method.php
CHANGED
@@ -12,8 +12,10 @@ use WPDesk\FS\TableRate\ShippingMethod\CommonMethodSettings;
|
|
12 |
use WPDesk\FS\TableRate\ShippingMethod\RateCalculatorFactory;
|
13 |
use WPDesk\FS\TableRate\ShippingMethod\SettingsDisplayPreparer;
|
14 |
use WPDesk\FS\TableRate\ShippingMethod\SettingsProcessor;
|
|
|
15 |
|
16 |
class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
|
|
|
17 |
|
18 |
const METHOD_ID = 'flexible_shipping';
|
19 |
|
@@ -558,7 +560,7 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
|
|
558 |
$rate_calculator->set_logger( $logger );
|
559 |
$calculated_rate = $rate_calculator->calculate_rate( $method_settings, $this->prepare_rate_id( $method_settings->get_raw_settings() ), is_user_logged_in() );
|
560 |
if ( ! empty( $calculated_rate ) ) {
|
561 |
-
$this->add_rate( $calculated_rate );
|
562 |
$logger->debug( __( 'Shipping cost added.', 'flexible-shipping' ), $logger->get_results_context() );
|
563 |
}
|
564 |
$logger->show_notice_if_enabled();
|
@@ -608,28 +610,6 @@ class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
|
|
608 |
return $options;
|
609 |
}
|
610 |
|
611 |
-
/**
|
612 |
-
* Add a shipping rate.
|
613 |
-
*
|
614 |
-
* @param array $args .
|
615 |
-
*/
|
616 |
-
public function add_rate( $args = array() ) {
|
617 |
-
parent::add_rate( $this->set_zero_cost_if_negative( $args ) );
|
618 |
-
}
|
619 |
-
|
620 |
-
/**
|
621 |
-
* @param array $args.
|
622 |
-
*
|
623 |
-
* @return array
|
624 |
-
*/
|
625 |
-
private function set_zero_cost_if_negative( $args = array() ) {
|
626 |
-
if ( isset( $args['cost'] ) && 0.0 > (float) $args['cost'] ) {
|
627 |
-
$args['cost'] = 0.0;
|
628 |
-
}
|
629 |
-
|
630 |
-
return $args;
|
631 |
-
}
|
632 |
-
|
633 |
/**
|
634 |
* @return bool
|
635 |
*/
|
12 |
use WPDesk\FS\TableRate\ShippingMethod\RateCalculatorFactory;
|
13 |
use WPDesk\FS\TableRate\ShippingMethod\SettingsDisplayPreparer;
|
14 |
use WPDesk\FS\TableRate\ShippingMethod\SettingsProcessor;
|
15 |
+
use WPDesk\FS\TableRate\ShippingMethodTrait;
|
16 |
|
17 |
class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
|
18 |
+
use ShippingMethodTrait;
|
19 |
|
20 |
const METHOD_ID = 'flexible_shipping';
|
21 |
|
560 |
$rate_calculator->set_logger( $logger );
|
561 |
$calculated_rate = $rate_calculator->calculate_rate( $method_settings, $this->prepare_rate_id( $method_settings->get_raw_settings() ), is_user_logged_in() );
|
562 |
if ( ! empty( $calculated_rate ) ) {
|
563 |
+
$this->add_rate( $this->set_zero_cost_if_negative( $calculated_rate ) );
|
564 |
$logger->debug( __( 'Shipping cost added.', 'flexible-shipping' ), $logger->get_results_context() );
|
565 |
}
|
566 |
$logger->show_notice_if_enabled();
|
610 |
return $options;
|
611 |
}
|
612 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
613 |
/**
|
614 |
* @return bool
|
615 |
*/
|
flexible-shipping.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Flexible Shipping
|
4 |
* Plugin URI: https://wordpress.org/plugins/flexible-shipping/
|
5 |
* Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
|
6 |
-
* Version: 4.5.
|
7 |
* Author: WP Desk
|
8 |
* Author URI: https://flexibleshipping.com/?utm_source=fs&utm_medium=link&utm_campaign=plugin-list-author
|
9 |
* Text Domain: flexible-shipping
|
@@ -38,7 +38,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
38 |
} // Exit if accessed directly
|
39 |
|
40 |
/* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
|
41 |
-
$plugin_version = '4.5.
|
42 |
|
43 |
$plugin_name = 'Flexible Shipping';
|
44 |
$product_id = 'Flexible Shipping';
|
3 |
* Plugin Name: Flexible Shipping
|
4 |
* Plugin URI: https://wordpress.org/plugins/flexible-shipping/
|
5 |
* Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
|
6 |
+
* Version: 4.5.1
|
7 |
* Author: WP Desk
|
8 |
* Author URI: https://flexibleshipping.com/?utm_source=fs&utm_medium=link&utm_campaign=plugin-list-author
|
9 |
* Text Domain: flexible-shipping
|
38 |
} // Exit if accessed directly
|
39 |
|
40 |
/* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
|
41 |
+
$plugin_version = '4.5.1';
|
42 |
|
43 |
$plugin_name = 'Flexible Shipping';
|
44 |
$product_id = 'Flexible Shipping';
|
lang/flexible-shipping.pot
CHANGED
@@ -2,16 +2,16 @@
|
|
2 |
# This file is distributed under the same license as the Flexible Shipping plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Flexible Shipping 4.5.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/flexible-shipping\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2021-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
-
"X-Generator: WP-CLI 2.
|
15 |
"X-Domain: flexible-shipping\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
@@ -20,9 +20,9 @@ msgstr ""
|
|
20 |
#: classes/table-rate/multilingual.php:52
|
21 |
#: classes/table-rate/settings/flexible-shipping.php:18
|
22 |
#: classes/table-rate/settings/flexible-shipping.php:33
|
23 |
-
#: classes/table-rate/shipping-method.php:
|
24 |
#: src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php:151
|
25 |
-
#: src/WPDesk/FS/TableRate/ShippingMethodSingle.php:
|
26 |
msgid "Flexible Shipping"
|
27 |
msgstr ""
|
28 |
|
@@ -43,23 +43,23 @@ msgid "https://flexibleshipping.com/?utm_source=fs&utm_medium=link&utm_campaign=
|
|
43 |
msgstr ""
|
44 |
|
45 |
#. Translators: link.
|
46 |
-
#: classes/class-flexible-shipping-plugin.php:
|
47 |
msgid "How can We make Flexible Shipping better for you? %1$sJust write to us.%2$s"
|
48 |
msgstr ""
|
49 |
|
50 |
-
#: classes/class-flexible-shipping-plugin.php:
|
51 |
msgid "Settings"
|
52 |
msgstr ""
|
53 |
|
54 |
-
#: classes/class-flexible-shipping-plugin.php:
|
55 |
msgid "Docs"
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: classes/class-flexible-shipping-plugin.php:
|
59 |
msgid "Support"
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: classes/class-flexible-shipping-plugin.php:
|
63 |
msgid "Upgrade"
|
64 |
msgstr ""
|
65 |
|
@@ -201,7 +201,7 @@ msgid "See how to %1$sconfigure Flexible Shipping%2$s."
|
|
201 |
msgstr ""
|
202 |
|
203 |
#: classes/table-rate/settings/flexible-shipping.php:24
|
204 |
-
#: classes/table-rate/shipping-method.php:
|
205 |
#: src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php:50
|
206 |
msgid "Enable/Disable"
|
207 |
msgstr ""
|
@@ -245,63 +245,63 @@ msgstr ""
|
|
245 |
msgid "Shipping Methods"
|
246 |
msgstr ""
|
247 |
|
248 |
-
#: classes/table-rate/shipping-method.php:
|
249 |
msgid "Flexible Shipping Group"
|
250 |
msgstr ""
|
251 |
|
252 |
-
#: classes/table-rate/shipping-method.php:
|
253 |
msgid "A group of Flexible Shipping methods - useful to organize numerous shipping methods."
|
254 |
msgstr ""
|
255 |
|
256 |
-
#: classes/table-rate/shipping-method.php:
|
257 |
#: src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php:53
|
258 |
msgid "Enable this shipment method"
|
259 |
msgstr ""
|
260 |
|
261 |
-
#: classes/table-rate/shipping-method.php:
|
262 |
msgid "Shipping Title"
|
263 |
msgstr ""
|
264 |
|
265 |
-
#: classes/table-rate/shipping-method.php:
|
266 |
#: src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php:58
|
267 |
msgid "This controls the title which the user sees during checkout."
|
268 |
msgstr ""
|
269 |
|
270 |
-
#: classes/table-rate/shipping-method.php:
|
271 |
msgid "Add New"
|
272 |
msgstr ""
|
273 |
|
274 |
-
#: classes/table-rate/shipping-method.php:
|
275 |
msgid "Flexible Shipping: security check error. Shipping method order not saved!"
|
276 |
msgstr ""
|
277 |
|
278 |
-
#: classes/table-rate/shipping-method.php:
|
279 |
msgid "New Shipping Method"
|
280 |
msgstr ""
|
281 |
|
282 |
-
#: classes/table-rate/shipping-method.php:
|
283 |
msgid "Edit Shipping Method"
|
284 |
msgstr ""
|
285 |
|
286 |
-
#: classes/table-rate/shipping-method.php:
|
287 |
-
#: classes/table-rate/shipping-method.php:
|
288 |
msgid "Shipping method %s added."
|
289 |
msgstr ""
|
290 |
|
291 |
-
#: classes/table-rate/shipping-method.php:
|
292 |
msgid "Shipping method %s deleted."
|
293 |
msgstr ""
|
294 |
|
295 |
-
#: classes/table-rate/shipping-method.php:
|
296 |
msgid "Shipping method not found."
|
297 |
msgstr ""
|
298 |
|
299 |
-
#: classes/table-rate/shipping-method.php:
|
300 |
msgid "Shipping method %s updated."
|
301 |
msgstr ""
|
302 |
|
303 |
-
#: classes/table-rate/shipping-method.php:
|
304 |
-
#: src/WPDesk/FS/TableRate/ShippingMethodSingle.php:
|
305 |
msgid "Shipping cost added."
|
306 |
msgstr ""
|
307 |
|
@@ -1142,7 +1142,7 @@ msgid "No shipping method handled by Flexible Shipping found in the %1$s shippin
|
|
1142 |
msgstr ""
|
1143 |
|
1144 |
#. Translators: cart value and shop link.
|
1145 |
-
#: src/WPDesk/FS/TableRate/FreeShipping/FreeShippingNotice.php:
|
1146 |
msgid "You only need %1$s more to get free shipping! %2$sContinue shopping%3$s"
|
1147 |
msgstr ""
|
1148 |
|
@@ -1396,27 +1396,27 @@ msgstr ""
|
|
1396 |
msgid "weight to"
|
1397 |
msgstr ""
|
1398 |
|
1399 |
-
#: src/WPDesk/FS/TableRate/Rule/Cost/AbstractAdditionalCost.php:
|
1400 |
msgid "additional cost:"
|
1401 |
msgstr ""
|
1402 |
|
1403 |
#. Translators: cost per.
|
1404 |
-
#: src/WPDesk/FS/TableRate/Rule/Cost/AbstractAdditionalCost.php:
|
1405 |
msgid "%1$s per %2$s"
|
1406 |
msgstr ""
|
1407 |
|
1408 |
#. Translators: based on.
|
1409 |
-
#: src/WPDesk/FS/TableRate/Rule/Cost/AbstractAdditionalCost.php:
|
1410 |
msgid "based on: %1$s"
|
1411 |
msgstr ""
|
1412 |
|
1413 |
#. Translators: input data.
|
1414 |
-
#: src/WPDesk/FS/TableRate/Rule/Cost/AbstractAdditionalCost.php:
|
1415 |
msgid "input data: %1$s"
|
1416 |
msgstr ""
|
1417 |
|
1418 |
#. Translators: calculated.
|
1419 |
-
#: src/WPDesk/FS/TableRate/Rule/Cost/AbstractAdditionalCost.php:
|
1420 |
msgid "calculated: %1$s"
|
1421 |
msgstr ""
|
1422 |
|
@@ -1667,12 +1667,12 @@ msgstr ""
|
|
1667 |
msgid "Shipping method title: %1$s"
|
1668 |
msgstr ""
|
1669 |
|
1670 |
-
#: src/WPDesk/FS/TableRate/ShippingMethodSingle.php:
|
1671 |
msgid "A single Flexible Shipping method."
|
1672 |
msgstr ""
|
1673 |
|
1674 |
#. Translators: docs link.
|
1675 |
-
#: src/WPDesk/FS/TableRate/ShippingMethodSingle.php:
|
1676 |
msgid "A single Flexible Shipping method. Learn %1$show to configure FS shipping method →%2$s"
|
1677 |
msgstr ""
|
1678 |
|
@@ -1696,6 +1696,24 @@ msgstr ""
|
|
1696 |
msgid "This is where the rules table should be displayed. If it's not, it is usually caused by the conflict with the other plugins you are currently using, JavaScript error or the caching issue. Clear your browser's cache or deactivate the plugins which may be interfering."
|
1697 |
msgstr ""
|
1698 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1699 |
#: templates/email/after_order_table.php:15
|
1700 |
#: templates/myaccount/after_order_table.php:18
|
1701 |
msgid "Track shipment: "
|
2 |
# This file is distributed under the same license as the Flexible Shipping plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Flexible Shipping 4.5.1\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/flexible-shipping\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2021-06-02T10:55:03+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
+
"X-Generator: WP-CLI 2.5.0\n"
|
15 |
"X-Domain: flexible-shipping\n"
|
16 |
|
17 |
#. Plugin Name of the plugin
|
20 |
#: classes/table-rate/multilingual.php:52
|
21 |
#: classes/table-rate/settings/flexible-shipping.php:18
|
22 |
#: classes/table-rate/settings/flexible-shipping.php:33
|
23 |
+
#: classes/table-rate/shipping-method.php:97
|
24 |
#: src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php:151
|
25 |
+
#: src/WPDesk/FS/TableRate/ShippingMethodSingle.php:63
|
26 |
msgid "Flexible Shipping"
|
27 |
msgstr ""
|
28 |
|
43 |
msgstr ""
|
44 |
|
45 |
#. Translators: link.
|
46 |
+
#: classes/class-flexible-shipping-plugin.php:697
|
47 |
msgid "How can We make Flexible Shipping better for you? %1$sJust write to us.%2$s"
|
48 |
msgstr ""
|
49 |
|
50 |
+
#: classes/class-flexible-shipping-plugin.php:774
|
51 |
msgid "Settings"
|
52 |
msgstr ""
|
53 |
|
54 |
+
#: classes/class-flexible-shipping-plugin.php:778
|
55 |
msgid "Docs"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: classes/class-flexible-shipping-plugin.php:779
|
59 |
msgid "Support"
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: classes/class-flexible-shipping-plugin.php:785
|
63 |
msgid "Upgrade"
|
64 |
msgstr ""
|
65 |
|
201 |
msgstr ""
|
202 |
|
203 |
#: classes/table-rate/settings/flexible-shipping.php:24
|
204 |
+
#: classes/table-rate/shipping-method.php:88
|
205 |
#: src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php:50
|
206 |
msgid "Enable/Disable"
|
207 |
msgstr ""
|
245 |
msgid "Shipping Methods"
|
246 |
msgstr ""
|
247 |
|
248 |
+
#: classes/table-rate/shipping-method.php:75
|
249 |
msgid "Flexible Shipping Group"
|
250 |
msgstr ""
|
251 |
|
252 |
+
#: classes/table-rate/shipping-method.php:76
|
253 |
msgid "A group of Flexible Shipping methods - useful to organize numerous shipping methods."
|
254 |
msgstr ""
|
255 |
|
256 |
+
#: classes/table-rate/shipping-method.php:90
|
257 |
#: src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php:53
|
258 |
msgid "Enable this shipment method"
|
259 |
msgstr ""
|
260 |
|
261 |
+
#: classes/table-rate/shipping-method.php:94
|
262 |
msgid "Shipping Title"
|
263 |
msgstr ""
|
264 |
|
265 |
+
#: classes/table-rate/shipping-method.php:96
|
266 |
#: src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php:58
|
267 |
msgid "This controls the title which the user sees during checkout."
|
268 |
msgstr ""
|
269 |
|
270 |
+
#: classes/table-rate/shipping-method.php:198
|
271 |
msgid "Add New"
|
272 |
msgstr ""
|
273 |
|
274 |
+
#: classes/table-rate/shipping-method.php:358
|
275 |
msgid "Flexible Shipping: security check error. Shipping method order not saved!"
|
276 |
msgstr ""
|
277 |
|
278 |
+
#: classes/table-rate/shipping-method.php:426
|
279 |
msgid "New Shipping Method"
|
280 |
msgstr ""
|
281 |
|
282 |
+
#: classes/table-rate/shipping-method.php:429
|
283 |
msgid "Edit Shipping Method"
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: classes/table-rate/shipping-method.php:439
|
287 |
+
#: classes/table-rate/shipping-method.php:482
|
288 |
msgid "Shipping method %s added."
|
289 |
msgstr ""
|
290 |
|
291 |
+
#: classes/table-rate/shipping-method.php:465
|
292 |
msgid "Shipping method %s deleted."
|
293 |
msgstr ""
|
294 |
|
295 |
+
#: classes/table-rate/shipping-method.php:468
|
296 |
msgid "Shipping method not found."
|
297 |
msgstr ""
|
298 |
|
299 |
+
#: classes/table-rate/shipping-method.php:494
|
300 |
msgid "Shipping method %s updated."
|
301 |
msgstr ""
|
302 |
|
303 |
+
#: classes/table-rate/shipping-method.php:564
|
304 |
+
#: src/WPDesk/FS/TableRate/ShippingMethodSingle.php:272
|
305 |
msgid "Shipping cost added."
|
306 |
msgstr ""
|
307 |
|
1142 |
msgstr ""
|
1143 |
|
1144 |
#. Translators: cart value and shop link.
|
1145 |
+
#: src/WPDesk/FS/TableRate/FreeShipping/FreeShippingNotice.php:123
|
1146 |
msgid "You only need %1$s more to get free shipping! %2$sContinue shopping%3$s"
|
1147 |
msgstr ""
|
1148 |
|
1396 |
msgid "weight to"
|
1397 |
msgstr ""
|
1398 |
|
1399 |
+
#: src/WPDesk/FS/TableRate/Rule/Cost/AbstractAdditionalCost.php:105
|
1400 |
msgid "additional cost:"
|
1401 |
msgstr ""
|
1402 |
|
1403 |
#. Translators: cost per.
|
1404 |
+
#: src/WPDesk/FS/TableRate/Rule/Cost/AbstractAdditionalCost.php:107
|
1405 |
msgid "%1$s per %2$s"
|
1406 |
msgstr ""
|
1407 |
|
1408 |
#. Translators: based on.
|
1409 |
+
#: src/WPDesk/FS/TableRate/Rule/Cost/AbstractAdditionalCost.php:109
|
1410 |
msgid "based on: %1$s"
|
1411 |
msgstr ""
|
1412 |
|
1413 |
#. Translators: input data.
|
1414 |
+
#: src/WPDesk/FS/TableRate/Rule/Cost/AbstractAdditionalCost.php:111
|
1415 |
msgid "input data: %1$s"
|
1416 |
msgstr ""
|
1417 |
|
1418 |
#. Translators: calculated.
|
1419 |
+
#: src/WPDesk/FS/TableRate/Rule/Cost/AbstractAdditionalCost.php:113
|
1420 |
msgid "calculated: %1$s"
|
1421 |
msgstr ""
|
1422 |
|
1667 |
msgid "Shipping method title: %1$s"
|
1668 |
msgstr ""
|
1669 |
|
1670 |
+
#: src/WPDesk/FS/TableRate/ShippingMethodSingle.php:64
|
1671 |
msgid "A single Flexible Shipping method."
|
1672 |
msgstr ""
|
1673 |
|
1674 |
#. Translators: docs link.
|
1675 |
+
#: src/WPDesk/FS/TableRate/ShippingMethodSingle.php:69
|
1676 |
msgid "A single Flexible Shipping method. Learn %1$show to configure FS shipping method →%2$s"
|
1677 |
msgstr ""
|
1678 |
|
1696 |
msgid "This is where the rules table should be displayed. If it's not, it is usually caused by the conflict with the other plugins you are currently using, JavaScript error or the caching issue. Clear your browser's cache or deactivate the plugins which may be interfering."
|
1697 |
msgstr ""
|
1698 |
|
1699 |
+
#. Translators: username.
|
1700 |
+
#: src/WPDesk/FS/Tracker/TrackerNotices.php:42
|
1701 |
+
msgid "Hey %s,"
|
1702 |
+
msgstr ""
|
1703 |
+
|
1704 |
+
#. Translators: strong tag.
|
1705 |
+
#: src/WPDesk/FS/Tracker/TrackerNotices.php:49
|
1706 |
+
msgid "We are constantly doing our best to %1$simprove our plugins%2$s. That’s why we kindly ask for %1$syour help%2$s to make them even more useful not only for you but also for other %1$s100.000+ users%2$s. Collecting the data on how you use our plugins will allow us to set the right direction for the further development. You can stay asured that no sensitive data will be collected. Can we count on you?"
|
1707 |
+
msgstr ""
|
1708 |
+
|
1709 |
+
#: src/WPDesk/FS/Tracker/TrackerNotices.php:55
|
1710 |
+
msgid "Learn more »"
|
1711 |
+
msgstr ""
|
1712 |
+
|
1713 |
+
#: src/WPDesk/FS/Tracker/TrackerNotices.php:56
|
1714 |
+
msgid "Thank you in advance!%1$s~ Flexible Shipping Team"
|
1715 |
+
msgstr ""
|
1716 |
+
|
1717 |
#: templates/email/after_order_table.php:15
|
1718 |
#: templates/myaccount/after_order_table.php:18
|
1719 |
msgid "Track shipment: "
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Table Rate for WooCommerce by Flexible Shipping ===
|
2 |
-
Contributors: wpdesk,dyszczo,grola,piotrpo,marcinkolanko,mateuszgbiorczyk,sebastianpisula
|
3 |
Donate link: https://flexibleshipping.com/products/flexible-shipping-pro-woocommerce/?utm_source=wordpress&utm_medium=link&utm_campaign=wordpress
|
4 |
Tags: table rate, table rate shipping, conditional shipping, shipping method, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes, shipping, free shipping, advanced shipping
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.7
|
7 |
-
Stable tag: 4.5.
|
8 |
Requires PHP: 7.0
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -91,6 +91,12 @@ Multi Vendor Shipping for WooCommerce Add-on extends the Flexible Shipping plugi
|
|
91 |
|
92 |
[Buy Multi Vendor Shipping for WooCommerce Add-On now →](https://flexibleshipping.com/products/multi-vendor-shipping-woocommerce/?utm_source=wordpress-mvs&utm_medium=link&utm_campaign=wordpress)
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
= Docs =
|
95 |
|
96 |
[View Flexible Shipping Docs](https://docs.flexibleshipping.com/collection/20-fs-table-rate/?utm_source=wordpress&utm_medium=link&utm_campaign=wordpress)
|
@@ -193,6 +199,11 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
|
|
193 |
|
194 |
== Changelog ==
|
195 |
|
|
|
|
|
|
|
|
|
|
|
196 |
= 4.5.0 - 2021-05-11 =
|
197 |
* Added support for shipping method settings in condition
|
198 |
* Added support for logical operators in conditions
|
1 |
=== Table Rate for WooCommerce by Flexible Shipping ===
|
2 |
+
Contributors: wpdesk,dyszczo,grola,piotrpo,marcinkolanko,mateuszgbiorczyk,sebastianpisula,bartj
|
3 |
Donate link: https://flexibleshipping.com/products/flexible-shipping-pro-woocommerce/?utm_source=wordpress&utm_medium=link&utm_campaign=wordpress
|
4 |
Tags: table rate, table rate shipping, conditional shipping, shipping method, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes, shipping, free shipping, advanced shipping
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.7
|
7 |
+
Stable tag: 4.5.1
|
8 |
Requires PHP: 7.0
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
91 |
|
92 |
[Buy Multi Vendor Shipping for WooCommerce Add-On now →](https://flexibleshipping.com/products/multi-vendor-shipping-woocommerce/?utm_source=wordpress-mvs&utm_medium=link&utm_campaign=wordpress)
|
93 |
|
94 |
+
= Conditional Shipping Methods =
|
95 |
+
|
96 |
+
Conditionally display and hide the shipping methods in your WooCommerce store. Define the rules when the specific shipping methods should be available to pick and when not to. Extend the Flexible Shipping plugin's capabilities with conditional logic for displaying shipping methods.
|
97 |
+
|
98 |
+
[Buy Conditional Shipping Methods now →](https://flexibleshipping.com/products/conditional-shipping-methods-woocommerce/?utm_source=wordpress-cm&utm_medium=link&utm_campaign=wordpress)
|
99 |
+
|
100 |
= Docs =
|
101 |
|
102 |
[View Flexible Shipping Docs](https://docs.flexibleshipping.com/collection/20-fs-table-rate/?utm_source=wordpress&utm_medium=link&utm_campaign=wordpress)
|
199 |
|
200 |
== Changelog ==
|
201 |
|
202 |
+
= 4.5.1 - 2021-06-02 =
|
203 |
+
* Added additional costs methods to tracking
|
204 |
+
* Fixed calculation additional costs
|
205 |
+
* Fixed initial checkout validation when free shipping notice displayed
|
206 |
+
|
207 |
= 4.5.0 - 2021-05-11 =
|
208 |
* Added support for shipping method settings in condition
|
209 |
* Added support for logical operators in conditions
|
src/WPDesk/FS/TableRate/FreeShipping/FreeShippingNotice.php
CHANGED
@@ -52,48 +52,64 @@ class FreeShippingNotice implements Hookable {
|
|
52 |
* Hooks.
|
53 |
*/
|
54 |
public function hooks() {
|
55 |
-
add_action( 'woocommerce_after_calculate_totals', array( $this, '
|
|
|
56 |
}
|
57 |
|
58 |
/**
|
59 |
* Add notice to free shipping left.
|
60 |
*/
|
61 |
-
public function
|
62 |
if ( ! $this->cart->needs_shipping() ) {
|
63 |
return;
|
64 |
}
|
65 |
|
66 |
-
|
|
|
67 |
|
68 |
-
|
69 |
-
return;
|
70 |
}
|
|
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
|
78 |
-
|
79 |
-
|
80 |
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
}
|
83 |
}
|
84 |
|
85 |
/**
|
86 |
* @return bool
|
87 |
*/
|
88 |
-
private function
|
89 |
-
return is_cart()
|
90 |
}
|
91 |
|
92 |
/**
|
93 |
* @return bool
|
94 |
*/
|
95 |
private function should_add_to_checkout() {
|
96 |
-
return is_checkout() &&
|
97 |
}
|
98 |
|
99 |
/**
|
52 |
* Hooks.
|
53 |
*/
|
54 |
public function hooks() {
|
55 |
+
add_action( 'woocommerce_after_calculate_totals', array( $this, 'add_notice_on_cart_and_checkout' ) );
|
56 |
+
add_filter( 'woocommerce_package_rates', array( $this, 'add_notice_on_checkout_ajax' ), FreeShippingNoticeGenerator::PRIORITY + 1, 2 );
|
57 |
}
|
58 |
|
59 |
/**
|
60 |
* Add notice to free shipping left.
|
61 |
*/
|
62 |
+
public function add_notice_on_cart_and_checkout() {
|
63 |
if ( ! $this->cart->needs_shipping() ) {
|
64 |
return;
|
65 |
}
|
66 |
|
67 |
+
if ( $this->should_add_to_cart() || $this->should_add_to_checkout() ) {
|
68 |
+
$this->add_notice();
|
69 |
|
70 |
+
remove_action( 'woocommerce_after_calculate_totals', array( $this, 'add_notice_free_shipping' ) );
|
|
|
71 |
}
|
72 |
+
}
|
73 |
|
74 |
+
/**
|
75 |
+
* @param array $package_rates .
|
76 |
+
* @param array $package .
|
77 |
+
*
|
78 |
+
* @return array
|
79 |
+
*/
|
80 |
+
public function add_notice_on_checkout_ajax( $package_rates, $package ) {
|
81 |
+
if ( is_checkout() && wp_doing_ajax() ) {
|
82 |
+
$this->add_notice();
|
83 |
}
|
84 |
|
85 |
+
return $package_rates;
|
86 |
+
}
|
87 |
|
88 |
+
/**
|
89 |
+
* Add notice.
|
90 |
+
*/
|
91 |
+
private function add_notice() {
|
92 |
+
$amount = (float) $this->session->get( FreeShippingNoticeGenerator::SESSION_VARIABLE, 0.0 );
|
93 |
+
if ( $amount > 0.0 ) {
|
94 |
+
$message_text = $this->prepare_notice_text( $amount );
|
95 |
+
if ( ! wc_has_notice( $message_text, self::NOTICE_TYPE_SUCCESS ) ) {
|
96 |
+
wc_add_notice( $message_text, self::NOTICE_TYPE_SUCCESS, array( self::FLEXIBLE_SHIPPING_FREE_SHIPPING_NOTICE => 'yes' ) );
|
97 |
+
}
|
98 |
}
|
99 |
}
|
100 |
|
101 |
/**
|
102 |
* @return bool
|
103 |
*/
|
104 |
+
private function should_add_to_cart() {
|
105 |
+
return is_cart();
|
106 |
}
|
107 |
|
108 |
/**
|
109 |
* @return bool
|
110 |
*/
|
111 |
private function should_add_to_checkout() {
|
112 |
+
return is_checkout() && ! wp_doing_ajax();
|
113 |
}
|
114 |
|
115 |
/**
|
src/WPDesk/FS/TableRate/FreeShipping/FreeShippingNoticeGenerator.php
CHANGED
@@ -22,6 +22,7 @@ class FreeShippingNoticeGenerator implements Hookable {
|
|
22 |
const SETTING_METHOD_FREE_SHIPPING = 'method_free_shipping';
|
23 |
const SESSION_VARIABLE = 'flexible_shipping_free_shipping_amount';
|
24 |
const META_DATA_FS_METHOD = '_fs_method';
|
|
|
25 |
|
26 |
/**
|
27 |
* @var WC_Cart
|
@@ -48,7 +49,7 @@ class FreeShippingNoticeGenerator implements Hookable {
|
|
48 |
* Hooks.
|
49 |
*/
|
50 |
public function hooks() {
|
51 |
-
add_filter( 'woocommerce_package_rates', array( $this, 'add_free_shipping_notice_if_should' ),
|
52 |
}
|
53 |
|
54 |
/**
|
22 |
const SETTING_METHOD_FREE_SHIPPING = 'method_free_shipping';
|
23 |
const SESSION_VARIABLE = 'flexible_shipping_free_shipping_amount';
|
24 |
const META_DATA_FS_METHOD = '_fs_method';
|
25 |
+
const PRIORITY = 10;
|
26 |
|
27 |
/**
|
28 |
* @var WC_Cart
|
49 |
* Hooks.
|
50 |
*/
|
51 |
public function hooks() {
|
52 |
+
add_filter( 'woocommerce_package_rates', array( $this, 'add_free_shipping_notice_if_should' ), self::PRIORITY, 2 );
|
53 |
}
|
54 |
|
55 |
/**
|
src/WPDesk/FS/TableRate/Rule/Condition/ConditionsFactory.php
CHANGED
@@ -52,9 +52,12 @@ class ConditionsFactory {
|
|
52 |
* @return Condition[]
|
53 |
*/
|
54 |
private function sort_conditions( $conditions ) {
|
55 |
-
uasort(
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
58 |
|
59 |
return $conditions;
|
60 |
}
|
52 |
* @return Condition[]
|
53 |
*/
|
54 |
private function sort_conditions( $conditions ) {
|
55 |
+
uasort(
|
56 |
+
$conditions,
|
57 |
+
function ( Condition $condition1, Condition $condition2 ) {
|
58 |
+
return $condition1->get_priority() <=> $condition2->get_priority(); // phpcs:ignore.
|
59 |
+
}
|
60 |
+
);
|
61 |
|
62 |
return $conditions;
|
63 |
}
|
src/WPDesk/FS/TableRate/Rule/Cost/AbstractAdditionalCost.php
CHANGED
@@ -7,12 +7,11 @@
|
|
7 |
|
8 |
namespace WPDesk\FS\TableRate\Rule\Cost;
|
9 |
|
10 |
-
use FSVendor\WPDesk\Forms\Field;
|
11 |
-
use FSVendor\WPDesk\Forms\Field\InputTextField;
|
12 |
use FSVendor\WPDesk\Forms\Renderer\JsonNormalizedRenderer;
|
13 |
use FSVendor\WPDesk\FS\TableRate\Settings\MethodSettings;
|
14 |
use JsonSerializable;
|
15 |
use Psr\Log\LoggerInterface;
|
|
|
16 |
use WPDesk\FS\TableRate\Rule\ShippingContents\ShippingContents;
|
17 |
|
18 |
/**
|
@@ -95,7 +94,7 @@ abstract class AbstractAdditionalCost implements AdditionalCost, JsonSerializabl
|
|
95 |
if ( isset( $per_value, $additional_cost ) && 0.0 !== (float) $per_value ) {
|
96 |
$calculated_additional_cost = ceil( (float) $shipment_contents_value / (float) $per_value ) * (float) $additional_cost;
|
97 |
}
|
98 |
-
} catch (
|
99 |
$logger->debug( $e->getMessage() );
|
100 |
$calculated_additional_cost = 0;
|
101 |
}
|
7 |
|
8 |
namespace WPDesk\FS\TableRate\Rule\Cost;
|
9 |
|
|
|
|
|
10 |
use FSVendor\WPDesk\Forms\Renderer\JsonNormalizedRenderer;
|
11 |
use FSVendor\WPDesk\FS\TableRate\Settings\MethodSettings;
|
12 |
use JsonSerializable;
|
13 |
use Psr\Log\LoggerInterface;
|
14 |
+
use Throwable;
|
15 |
use WPDesk\FS\TableRate\Rule\ShippingContents\ShippingContents;
|
16 |
|
17 |
/**
|
94 |
if ( isset( $per_value, $additional_cost ) && 0.0 !== (float) $per_value ) {
|
95 |
$calculated_additional_cost = ceil( (float) $shipment_contents_value / (float) $per_value ) * (float) $additional_cost;
|
96 |
}
|
97 |
+
} catch ( Throwable $e ) {
|
98 |
$logger->debug( $e->getMessage() );
|
99 |
$calculated_additional_cost = 0;
|
100 |
}
|
src/WPDesk/FS/TableRate/Rule/TrackerData.php
CHANGED
@@ -115,6 +115,18 @@ class TrackerData implements Hookable {
|
|
115 |
|
116 |
$tracker_data['additional_cost_count'] += $additional_costs_count;
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
return $tracker_data;
|
119 |
}
|
120 |
|
115 |
|
116 |
$tracker_data['additional_cost_count'] += $additional_costs_count;
|
117 |
|
118 |
+
if ( ! isset( $tracker_data['additional_costs'] ) ) {
|
119 |
+
$tracker_data['additional_costs'] = array();
|
120 |
+
}
|
121 |
+
|
122 |
+
foreach ( wp_list_pluck( $additional_costs, 'based_on' ) as $based_on ) {
|
123 |
+
if ( ! isset( $tracker_data['additional_costs'][ $based_on ] ) ) {
|
124 |
+
$tracker_data['additional_costs'][ $based_on ] = 0;
|
125 |
+
}
|
126 |
+
|
127 |
+
$tracker_data['additional_costs'][ $based_on ] ++;
|
128 |
+
}
|
129 |
+
|
130 |
return $tracker_data;
|
131 |
}
|
132 |
|
src/WPDesk/FS/TableRate/ShippingMethodSingle.php
CHANGED
@@ -15,9 +15,7 @@ use WC_Shipping_Method;
|
|
15 |
use WPDesk\FS\TableRate\Rule\Condition\ConditionsFactory;
|
16 |
use WPDesk\FS\TableRate\Rule\Cost\RuleAdditionalCostFactory;
|
17 |
use WPDesk\FS\TableRate\Rule\Cost\RuleCostFieldsFactory;
|
18 |
-
use WPDesk\FS\TableRate\ShippingMethod\MethodSettings;
|
19 |
use WPDesk\FS\TableRate\ShippingMethod\RateCalculatorFactory;
|
20 |
-
use WPDesk\FS\TableRate\ShippingMethod\SettingsDisplayPreparer;
|
21 |
use WPDesk\FS\TableRate\ShippingMethod\SingleMethodSettings;
|
22 |
use WPDesk_Flexible_Shipping;
|
23 |
|
@@ -25,6 +23,7 @@ use WPDesk_Flexible_Shipping;
|
|
25 |
* Shipping method flexible_shipping_single
|
26 |
*/
|
27 |
class ShippingMethodSingle extends WC_Shipping_Method {
|
|
|
28 |
|
29 |
const SHIPPING_METHOD_ID = 'flexible_shipping_single';
|
30 |
|
@@ -269,12 +268,11 @@ class ShippingMethodSingle extends WC_Shipping_Method {
|
|
269 |
$calculated_rate = $rate_calculator->calculate_rate( $method_settings, $this->get_rate_id(), is_user_logged_in() );
|
270 |
|
271 |
if ( ! empty( $calculated_rate ) && $this->should_add_rate( $calculated_rate ) ) {
|
272 |
-
$this->add_rate( $calculated_rate );
|
273 |
$logger->debug( __( 'Shipping cost added.', 'flexible-shipping' ), $logger->get_results_context() );
|
274 |
}
|
275 |
|
276 |
$logger->show_notice_if_enabled();
|
277 |
-
|
278 |
}
|
279 |
|
280 |
/**
|
15 |
use WPDesk\FS\TableRate\Rule\Condition\ConditionsFactory;
|
16 |
use WPDesk\FS\TableRate\Rule\Cost\RuleAdditionalCostFactory;
|
17 |
use WPDesk\FS\TableRate\Rule\Cost\RuleCostFieldsFactory;
|
|
|
18 |
use WPDesk\FS\TableRate\ShippingMethod\RateCalculatorFactory;
|
|
|
19 |
use WPDesk\FS\TableRate\ShippingMethod\SingleMethodSettings;
|
20 |
use WPDesk_Flexible_Shipping;
|
21 |
|
23 |
* Shipping method flexible_shipping_single
|
24 |
*/
|
25 |
class ShippingMethodSingle extends WC_Shipping_Method {
|
26 |
+
use ShippingMethodTrait;
|
27 |
|
28 |
const SHIPPING_METHOD_ID = 'flexible_shipping_single';
|
29 |
|
268 |
$calculated_rate = $rate_calculator->calculate_rate( $method_settings, $this->get_rate_id(), is_user_logged_in() );
|
269 |
|
270 |
if ( ! empty( $calculated_rate ) && $this->should_add_rate( $calculated_rate ) ) {
|
271 |
+
$this->add_rate( $this->set_zero_cost_if_negative( $calculated_rate ) );
|
272 |
$logger->debug( __( 'Shipping cost added.', 'flexible-shipping' ), $logger->get_results_context() );
|
273 |
}
|
274 |
|
275 |
$logger->show_notice_if_enabled();
|
|
|
276 |
}
|
277 |
|
278 |
/**
|
src/WPDesk/FS/TableRate/ShippingMethodTrait.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Trait ShippingMethodTrait
|
4 |
+
*
|
5 |
+
* @package WPDesk\FS\TableRate
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FS\TableRate;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Common methods for shipping methods.
|
12 |
+
*/
|
13 |
+
trait ShippingMethodTrait {
|
14 |
+
/**
|
15 |
+
* @param array $args .
|
16 |
+
*
|
17 |
+
* @return array
|
18 |
+
*/
|
19 |
+
private function set_zero_cost_if_negative( $args = array() ) {
|
20 |
+
$allow_negative_costs = (bool) apply_filters( 'flexible-shipping/shipping-method/allow-negative-costs', false );
|
21 |
+
|
22 |
+
if ( ! $allow_negative_costs && isset( $args['cost'] ) && 0.0 > (float) $args['cost'] ) {
|
23 |
+
$args['cost'] = 0.0;
|
24 |
+
}
|
25 |
+
|
26 |
+
return $args;
|
27 |
+
}
|
28 |
+
}
|
src/WPDesk/FS/Tracker/TrackerNotices.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class TrackerNotices
|
4 |
+
*
|
5 |
+
* @package WPDesk\FS\Tracker
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace WPDesk\FS\Tracker;
|
9 |
+
|
10 |
+
use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Sets WPDesk tracker notices.
|
14 |
+
*
|
15 |
+
* @package WPDesk\FS\ConditionalMethods\Tracker
|
16 |
+
*/
|
17 |
+
class TrackerNotices implements Hookable {
|
18 |
+
|
19 |
+
const USAGE_DATA_URL = 'https://flexibleshipping.com/usage-tracking/';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Hooks.
|
23 |
+
*/
|
24 |
+
public function hooks() {
|
25 |
+
add_filter( 'wpdesk_tracker_notice_content', array( $this, 'tracker_notice' ), 10, 3 );
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Tracker notice content.
|
30 |
+
*
|
31 |
+
* @param string $notice .
|
32 |
+
* @param string $username .
|
33 |
+
* @param string $terms_url .
|
34 |
+
*
|
35 |
+
* @return string
|
36 |
+
*/
|
37 |
+
public function tracker_notice( $notice, $username, $terms_url ) {
|
38 |
+
ob_start();
|
39 |
+
?>
|
40 |
+
<?php
|
41 |
+
// Translators: username.
|
42 |
+
echo esc_html( sprintf( __( 'Hey %s,', 'flexible-shipping' ), $username ) );
|
43 |
+
?>
|
44 |
+
<br/>
|
45 |
+
<?php
|
46 |
+
echo wp_kses_post(
|
47 |
+
sprintf(
|
48 |
+
// Translators: strong tag.
|
49 |
+
__( 'We are constantly doing our best to %1$simprove our plugins%2$s. That’s why we kindly ask for %1$syour help%2$s to make them even more useful not only for you but also for other %1$s100.000+ users%2$s. Collecting the data on how you use our plugins will allow us to set the right direction for the further development. You can stay asured that no sensitive data will be collected. Can we count on you?', 'flexible-shipping' ),
|
50 |
+
'<strong>',
|
51 |
+
'</strong>'
|
52 |
+
)
|
53 |
+
);
|
54 |
+
?>
|
55 |
+
<a href="<?php echo esc_url( self::USAGE_DATA_URL ); ?>" target="_blank"><?php echo wp_kses_post( __( 'Learn more »', 'flexible-shipping' ) ); ?></a><br/><br/>
|
56 |
+
<?php echo wp_kses_post( sprintf( __( 'Thank you in advance!%1$s~ Flexible Shipping Team', 'flexible-shipping' ), '<br/>' ) ); // phpcs:ignore. ?>
|
57 |
+
<?php
|
58 |
+
$out = ob_get_clean();
|
59 |
+
return $out ? $out : '';
|
60 |
+
}
|
61 |
+
}
|
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 ComposerAutoloaderInitf4bde9f45928324a2dc450be343ba33e::getLoader();
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -118,10 +118,16 @@ return array(
|
|
118 |
'FSVendor\\WPDesk\\Codeception\\Command\\WooCommerceTestGenerator' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/WooCommerceTestGenerator.php',
|
119 |
'FSVendor\\WPDesk\\Composer\\Codeception\\CommandProvider' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/CommandProvider.php',
|
120 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\BaseCommand' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/BaseCommand.php',
|
|
|
121 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\CreateCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/CreateCodeceptionTests.php',
|
|
|
|
|
|
|
|
|
122 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunCodeceptionTests.php',
|
123 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunLocalCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunLocalCodeceptionTests.php',
|
124 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\SedTrait' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SedTrait.php',
|
|
|
125 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Plugin' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Plugin.php',
|
126 |
'FSVendor\\WPDesk\\FS\\Compatibility\\BlockSettings' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-fs-compatibility/src/BlockSettings.php',
|
127 |
'FSVendor\\WPDesk\\FS\\Compatibility\\Notice' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-fs-compatibility/src/Notice.php',
|
@@ -491,6 +497,7 @@ return array(
|
|
491 |
'WPDesk\\FS\\TableRate\\RulesSettingsField' => $baseDir . '/src/WPDesk/FS/TableRate/RulesSettingsField.php',
|
492 |
'WPDesk\\FS\\TableRate\\RulesTableSettings' => $baseDir . '/src/WPDesk/FS/TableRate/RulesTableSettings.php',
|
493 |
'WPDesk\\FS\\TableRate\\ShippingMethodSingle' => $baseDir . '/src/WPDesk/FS/TableRate/ShippingMethodSingle.php',
|
|
|
494 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\BlockEditing\\BlockEditing' => $baseDir . '/src/WPDesk/FS/TableRate/ShippingMethod/BlockEditing/BlockEditing.php',
|
495 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\CommonMethodSettings' => $baseDir . '/src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php',
|
496 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\Convert\\ConvertAction' => $baseDir . '/src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertAction.php',
|
@@ -507,6 +514,7 @@ return array(
|
|
507 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\SingleMethodSettings' => $baseDir . '/src/WPDesk/FS/TableRate/ShippingMethod/SingleMethodSettings.php',
|
508 |
'WPDesk\\FS\\TableRate\\SingleRuleSettings' => $baseDir . '/src/WPDesk/FS/TableRate/SingleRuleSettings.php',
|
509 |
'WPDesk\\FS\\TableRate\\UserFeedback' => $baseDir . '/src/WPDesk/FS/TableRate/UserFeedback.php',
|
|
|
510 |
'WPDesk\\Helper\\HelperAsLibrary' => $vendorDir . '/wpdesk/wp-wpdesk-helper-override/src/Helper/HelperAsLibrary.php',
|
511 |
'WPDesk\\Notice\\AjaxHandler' => $vendorDir . '/wpdesk/wp-notice/src/WPDesk/Notice/AjaxHandler.php',
|
512 |
'WPDesk\\Notice\\Factory' => $vendorDir . '/wpdesk/wp-notice/src/WPDesk/Notice/Factory.php',
|
118 |
'FSVendor\\WPDesk\\Codeception\\Command\\WooCommerceTestGenerator' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/WooCommerceTestGenerator.php',
|
119 |
'FSVendor\\WPDesk\\Composer\\Codeception\\CommandProvider' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/CommandProvider.php',
|
120 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\BaseCommand' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/BaseCommand.php',
|
121 |
+
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\Configuration' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/Configuration.php',
|
122 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\CreateCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/CreateCodeceptionTests.php',
|
123 |
+
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\LocalCodeceptionTrait' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/LocalCodeceptionTrait.php',
|
124 |
+
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareCodeceptionDb' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareCodeceptionDb.php',
|
125 |
+
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareLocalCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareLocalCodeceptionTests.php',
|
126 |
+
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareWordpressForCodeception' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareWordpressForCodeception.php',
|
127 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunCodeceptionTests.php',
|
128 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunLocalCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunLocalCodeceptionTests.php',
|
129 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\SedTrait' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SedTrait.php',
|
130 |
+
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\SettingsException' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SettingsException.php',
|
131 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Plugin' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Plugin.php',
|
132 |
'FSVendor\\WPDesk\\FS\\Compatibility\\BlockSettings' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-fs-compatibility/src/BlockSettings.php',
|
133 |
'FSVendor\\WPDesk\\FS\\Compatibility\\Notice' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-fs-compatibility/src/Notice.php',
|
497 |
'WPDesk\\FS\\TableRate\\RulesSettingsField' => $baseDir . '/src/WPDesk/FS/TableRate/RulesSettingsField.php',
|
498 |
'WPDesk\\FS\\TableRate\\RulesTableSettings' => $baseDir . '/src/WPDesk/FS/TableRate/RulesTableSettings.php',
|
499 |
'WPDesk\\FS\\TableRate\\ShippingMethodSingle' => $baseDir . '/src/WPDesk/FS/TableRate/ShippingMethodSingle.php',
|
500 |
+
'WPDesk\\FS\\TableRate\\ShippingMethodTrait' => $baseDir . '/src/WPDesk/FS/TableRate/ShippingMethodTrait.php',
|
501 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\BlockEditing\\BlockEditing' => $baseDir . '/src/WPDesk/FS/TableRate/ShippingMethod/BlockEditing/BlockEditing.php',
|
502 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\CommonMethodSettings' => $baseDir . '/src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php',
|
503 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\Convert\\ConvertAction' => $baseDir . '/src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertAction.php',
|
514 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\SingleMethodSettings' => $baseDir . '/src/WPDesk/FS/TableRate/ShippingMethod/SingleMethodSettings.php',
|
515 |
'WPDesk\\FS\\TableRate\\SingleRuleSettings' => $baseDir . '/src/WPDesk/FS/TableRate/SingleRuleSettings.php',
|
516 |
'WPDesk\\FS\\TableRate\\UserFeedback' => $baseDir . '/src/WPDesk/FS/TableRate/UserFeedback.php',
|
517 |
+
'WPDesk\\FS\\Tracker\\TrackerNotices' => $baseDir . '/src/WPDesk/FS/Tracker/TrackerNotices.php',
|
518 |
'WPDesk\\Helper\\HelperAsLibrary' => $vendorDir . '/wpdesk/wp-wpdesk-helper-override/src/Helper/HelperAsLibrary.php',
|
519 |
'WPDesk\\Notice\\AjaxHandler' => $vendorDir . '/wpdesk/wp-notice/src/WPDesk/Notice/AjaxHandler.php',
|
520 |
'WPDesk\\Notice\\Factory' => $vendorDir . '/wpdesk/wp-notice/src/WPDesk/Notice/Factory.php',
|
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 |
|
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit4dcfc3b9f680905ca917c1221c9f9a47
|
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
-
spl_autoload_register(array('
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
-
spl_autoload_unregister(array('
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
require_once __DIR__ . '/autoload_static.php';
|
32 |
|
33 |
-
call_user_func(\Composer\Autoload\
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
@@ -51,19 +51,19 @@ class ComposerAutoloaderInit4dcfc3b9f680905ca917c1221c9f9a47
|
|
51 |
$loader->register(true);
|
52 |
|
53 |
if ($useStaticLoader) {
|
54 |
-
$includeFiles = Composer\Autoload\
|
55 |
} else {
|
56 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
57 |
}
|
58 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
59 |
-
|
60 |
}
|
61 |
|
62 |
return $loader;
|
63 |
}
|
64 |
}
|
65 |
|
66 |
-
function
|
67 |
{
|
68 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
69 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInitf4bde9f45928324a2dc450be343ba33e
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInitf4bde9f45928324a2dc450be343ba33e', 'loadClassLoader'), true, true);
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitf4bde9f45928324a2dc450be343ba33e', 'loadClassLoader'));
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
require_once __DIR__ . '/autoload_static.php';
|
32 |
|
33 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitf4bde9f45928324a2dc450be343ba33e::getInitializer($loader));
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
51 |
$loader->register(true);
|
52 |
|
53 |
if ($useStaticLoader) {
|
54 |
+
$includeFiles = Composer\Autoload\ComposerStaticInitf4bde9f45928324a2dc450be343ba33e::$files;
|
55 |
} else {
|
56 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
57 |
}
|
58 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
59 |
+
composerRequiref4bde9f45928324a2dc450be343ba33e($fileIdentifier, $file);
|
60 |
}
|
61 |
|
62 |
return $loader;
|
63 |
}
|
64 |
}
|
65 |
|
66 |
+
function composerRequiref4bde9f45928324a2dc450be343ba33e($fileIdentifier, $file)
|
67 |
{
|
68 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
69 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'0509b34a4bd7aebefeac629c9dc8a978' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/notice-functions.php',
|
@@ -159,10 +159,16 @@ class ComposerStaticInit4dcfc3b9f680905ca917c1221c9f9a47
|
|
159 |
'FSVendor\\WPDesk\\Codeception\\Command\\WooCommerceTestGenerator' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/WooCommerceTestGenerator.php',
|
160 |
'FSVendor\\WPDesk\\Composer\\Codeception\\CommandProvider' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/CommandProvider.php',
|
161 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\BaseCommand' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/BaseCommand.php',
|
|
|
162 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\CreateCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/CreateCodeceptionTests.php',
|
|
|
|
|
|
|
|
|
163 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunCodeceptionTests.php',
|
164 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunLocalCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunLocalCodeceptionTests.php',
|
165 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\SedTrait' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SedTrait.php',
|
|
|
166 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Plugin' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Plugin.php',
|
167 |
'FSVendor\\WPDesk\\FS\\Compatibility\\BlockSettings' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-fs-compatibility/src/BlockSettings.php',
|
168 |
'FSVendor\\WPDesk\\FS\\Compatibility\\Notice' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-fs-compatibility/src/Notice.php',
|
@@ -532,6 +538,7 @@ class ComposerStaticInit4dcfc3b9f680905ca917c1221c9f9a47
|
|
532 |
'WPDesk\\FS\\TableRate\\RulesSettingsField' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/RulesSettingsField.php',
|
533 |
'WPDesk\\FS\\TableRate\\RulesTableSettings' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/RulesTableSettings.php',
|
534 |
'WPDesk\\FS\\TableRate\\ShippingMethodSingle' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/ShippingMethodSingle.php',
|
|
|
535 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\BlockEditing\\BlockEditing' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/ShippingMethod/BlockEditing/BlockEditing.php',
|
536 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\CommonMethodSettings' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php',
|
537 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\Convert\\ConvertAction' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertAction.php',
|
@@ -548,6 +555,7 @@ class ComposerStaticInit4dcfc3b9f680905ca917c1221c9f9a47
|
|
548 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\SingleMethodSettings' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/ShippingMethod/SingleMethodSettings.php',
|
549 |
'WPDesk\\FS\\TableRate\\SingleRuleSettings' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/SingleRuleSettings.php',
|
550 |
'WPDesk\\FS\\TableRate\\UserFeedback' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/UserFeedback.php',
|
|
|
551 |
'WPDesk\\Helper\\HelperAsLibrary' => __DIR__ . '/..' . '/wpdesk/wp-wpdesk-helper-override/src/Helper/HelperAsLibrary.php',
|
552 |
'WPDesk\\Notice\\AjaxHandler' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/Notice/AjaxHandler.php',
|
553 |
'WPDesk\\Notice\\Factory' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/Notice/Factory.php',
|
@@ -632,10 +640,10 @@ class ComposerStaticInit4dcfc3b9f680905ca917c1221c9f9a47
|
|
632 |
public static function getInitializer(ClassLoader $loader)
|
633 |
{
|
634 |
return \Closure::bind(function () use ($loader) {
|
635 |
-
$loader->prefixLengthsPsr4 =
|
636 |
-
$loader->prefixDirsPsr4 =
|
637 |
-
$loader->fallbackDirsPsr4 =
|
638 |
-
$loader->classMap =
|
639 |
|
640 |
}, null, ClassLoader::class);
|
641 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInitf4bde9f45928324a2dc450be343ba33e
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'0509b34a4bd7aebefeac629c9dc8a978' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/notice-functions.php',
|
159 |
'FSVendor\\WPDesk\\Codeception\\Command\\WooCommerceTestGenerator' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/WooCommerceTestGenerator.php',
|
160 |
'FSVendor\\WPDesk\\Composer\\Codeception\\CommandProvider' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/CommandProvider.php',
|
161 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\BaseCommand' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/BaseCommand.php',
|
162 |
+
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\Configuration' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/Configuration.php',
|
163 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\CreateCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/CreateCodeceptionTests.php',
|
164 |
+
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\LocalCodeceptionTrait' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/LocalCodeceptionTrait.php',
|
165 |
+
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareCodeceptionDb' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareCodeceptionDb.php',
|
166 |
+
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareLocalCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareLocalCodeceptionTests.php',
|
167 |
+
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareWordpressForCodeception' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareWordpressForCodeception.php',
|
168 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunCodeceptionTests.php',
|
169 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunLocalCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunLocalCodeceptionTests.php',
|
170 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\SedTrait' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SedTrait.php',
|
171 |
+
'FSVendor\\WPDesk\\Composer\\Codeception\\Commands\\SettingsException' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SettingsException.php',
|
172 |
'FSVendor\\WPDesk\\Composer\\Codeception\\Plugin' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Plugin.php',
|
173 |
'FSVendor\\WPDesk\\FS\\Compatibility\\BlockSettings' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-fs-compatibility/src/BlockSettings.php',
|
174 |
'FSVendor\\WPDesk\\FS\\Compatibility\\Notice' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-fs-compatibility/src/Notice.php',
|
538 |
'WPDesk\\FS\\TableRate\\RulesSettingsField' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/RulesSettingsField.php',
|
539 |
'WPDesk\\FS\\TableRate\\RulesTableSettings' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/RulesTableSettings.php',
|
540 |
'WPDesk\\FS\\TableRate\\ShippingMethodSingle' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/ShippingMethodSingle.php',
|
541 |
+
'WPDesk\\FS\\TableRate\\ShippingMethodTrait' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/ShippingMethodTrait.php',
|
542 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\BlockEditing\\BlockEditing' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/ShippingMethod/BlockEditing/BlockEditing.php',
|
543 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\CommonMethodSettings' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/ShippingMethod/CommonMethodSettings.php',
|
544 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\Convert\\ConvertAction' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/ShippingMethod/Convert/ConvertAction.php',
|
555 |
'WPDesk\\FS\\TableRate\\ShippingMethod\\SingleMethodSettings' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/ShippingMethod/SingleMethodSettings.php',
|
556 |
'WPDesk\\FS\\TableRate\\SingleRuleSettings' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/SingleRuleSettings.php',
|
557 |
'WPDesk\\FS\\TableRate\\UserFeedback' => __DIR__ . '/../..' . '/src/WPDesk/FS/TableRate/UserFeedback.php',
|
558 |
+
'WPDesk\\FS\\Tracker\\TrackerNotices' => __DIR__ . '/../..' . '/src/WPDesk/FS/Tracker/TrackerNotices.php',
|
559 |
'WPDesk\\Helper\\HelperAsLibrary' => __DIR__ . '/..' . '/wpdesk/wp-wpdesk-helper-override/src/Helper/HelperAsLibrary.php',
|
560 |
'WPDesk\\Notice\\AjaxHandler' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/Notice/AjaxHandler.php',
|
561 |
'WPDesk\\Notice\\Factory' => __DIR__ . '/..' . '/wpdesk/wp-notice/src/WPDesk/Notice/Factory.php',
|
640 |
public static function getInitializer(ClassLoader $loader)
|
641 |
{
|
642 |
return \Closure::bind(function () use ($loader) {
|
643 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitf4bde9f45928324a2dc450be343ba33e::$prefixLengthsPsr4;
|
644 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitf4bde9f45928324a2dc450be343ba33e::$prefixDirsPsr4;
|
645 |
+
$loader->fallbackDirsPsr4 = ComposerStaticInitf4bde9f45928324a2dc450be343ba33e::$fallbackDirsPsr4;
|
646 |
+
$loader->classMap = ComposerStaticInitf4bde9f45928324a2dc450be343ba33e::$classMap;
|
647 |
|
648 |
}, null, ClassLoader::class);
|
649 |
}
|
vendor/composer/platform_check.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// platform_check.php @generated by Composer
|
4 |
+
|
5 |
+
$issues = array();
|
6 |
+
|
7 |
+
if (!(PHP_VERSION_ID >= 70008)) {
|
8 |
+
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.0.8". You are running ' . PHP_VERSION . '.';
|
9 |
+
}
|
10 |
+
|
11 |
+
if ($issues) {
|
12 |
+
if (!headers_sent()) {
|
13 |
+
header('HTTP/1.1 500 Internal Server Error');
|
14 |
+
}
|
15 |
+
if (!ini_get('display_errors')) {
|
16 |
+
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
17 |
+
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
18 |
+
} elseif (!headers_sent()) {
|
19 |
+
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
trigger_error(
|
23 |
+
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
24 |
+
E_USER_ERROR
|
25 |
+
);
|
26 |
+
}
|
vendor_prefixed/monolog/monolog/src/Monolog/Logger.php
CHANGED
@@ -271,7 +271,7 @@ class Logger implements \Psr\Log\LoggerInterface, \FSVendor\Monolog\ResettableIn
|
|
271 |
if ($this->microsecondTimestamps && \PHP_VERSION_ID < 70100) {
|
272 |
$ts = \DateTime::createFromFormat('U.u', \sprintf('%.6F', \microtime(\true)), static::$timezone);
|
273 |
} else {
|
274 |
-
$ts = new \DateTime(
|
275 |
}
|
276 |
$ts->setTimezone(static::$timezone);
|
277 |
$record = array('message' => (string) $message, 'context' => $context, 'level' => $level, 'level_name' => $levelName, 'channel' => $this->name, 'datetime' => $ts, 'extra' => array());
|
271 |
if ($this->microsecondTimestamps && \PHP_VERSION_ID < 70100) {
|
272 |
$ts = \DateTime::createFromFormat('U.u', \sprintf('%.6F', \microtime(\true)), static::$timezone);
|
273 |
} else {
|
274 |
+
$ts = new \DateTime('now', static::$timezone);
|
275 |
}
|
276 |
$ts->setTimezone(static::$timezone);
|
277 |
$record = array('message' => (string) $message, 'context' => $context, 'level' => $level, 'level_name' => $levelName, 'channel' => $this->name, 'datetime' => $ts, 'extra' => array());
|
vendor_prefixed/wpdesk/wp-codeception/composer.json
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
}
|
18 |
],
|
19 |
"require": {
|
20 |
-
"php": ">=
|
21 |
"ext-json": "*",
|
22 |
"wpdesk\/wp-builder": "^1.0",
|
23 |
"composer-plugin-api": "^1.1|^2",
|
@@ -30,7 +30,12 @@
|
|
30 |
"codeception\/module-phpbrowser": "^1.0",
|
31 |
"codeception\/module-asserts": "^1.1",
|
32 |
"codeception\/util-universalframework": "^1.0",
|
33 |
-
"vlucas\/phpdotenv": "^4.
|
|
|
|
|
|
|
|
|
|
|
34 |
},
|
35 |
"require-dev": {
|
36 |
"phpunit\/phpunit": "<7",
|
17 |
}
|
18 |
],
|
19 |
"require": {
|
20 |
+
"php": ">=7.0",
|
21 |
"ext-json": "*",
|
22 |
"wpdesk\/wp-builder": "^1.0",
|
23 |
"composer-plugin-api": "^1.1|^2",
|
30 |
"codeception\/module-phpbrowser": "^1.0",
|
31 |
"codeception\/module-asserts": "^1.1",
|
32 |
"codeception\/util-universalframework": "^1.0",
|
33 |
+
"vlucas\/phpdotenv": "^4.2.0",
|
34 |
+
"albertofem\/rsync-lib": "^1.0",
|
35 |
+
"wp-cli\/wp-cli-bundle": "^2.4",
|
36 |
+
"symfony\/yaml": "^v3.4.47",
|
37 |
+
"lucatume\/codeception-steppify": "^1.0",
|
38 |
+
"wp-cli\/admin-command": "^2.0"
|
39 |
},
|
40 |
"require-dev": {
|
41 |
"phpunit\/phpunit": "<7",
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/CommandProvider.php
CHANGED
@@ -3,6 +3,9 @@
|
|
3 |
namespace FSVendor\WPDesk\Composer\Codeception;
|
4 |
|
5 |
use FSVendor\WPDesk\Composer\Codeception\Commands\CreateCodeceptionTests;
|
|
|
|
|
|
|
6 |
use FSVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests;
|
7 |
use FSVendor\WPDesk\Composer\Codeception\Commands\RunLocalCodeceptionTests;
|
8 |
/**
|
@@ -12,6 +15,6 @@ class CommandProvider implements \FSVendor\Composer\Plugin\Capability\CommandPro
|
|
12 |
{
|
13 |
public function getCommands()
|
14 |
{
|
15 |
-
return [new \FSVendor\WPDesk\Composer\Codeception\Commands\CreateCodeceptionTests(), new \FSVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests(), new \FSVendor\WPDesk\Composer\Codeception\Commands\RunLocalCodeceptionTests()];
|
16 |
}
|
17 |
}
|
3 |
namespace FSVendor\WPDesk\Composer\Codeception;
|
4 |
|
5 |
use FSVendor\WPDesk\Composer\Codeception\Commands\CreateCodeceptionTests;
|
6 |
+
use FSVendor\WPDesk\Composer\Codeception\Commands\PrepareCodeceptionDb;
|
7 |
+
use FSVendor\WPDesk\Composer\Codeception\Commands\PrepareLocalCodeceptionTests;
|
8 |
+
use FSVendor\WPDesk\Composer\Codeception\Commands\PrepareWordpressForCodeception;
|
9 |
use FSVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests;
|
10 |
use FSVendor\WPDesk\Composer\Codeception\Commands\RunLocalCodeceptionTests;
|
11 |
/**
|
15 |
{
|
16 |
public function getCommands()
|
17 |
{
|
18 |
+
return [new \FSVendor\WPDesk\Composer\Codeception\Commands\CreateCodeceptionTests(), new \FSVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests(), new \FSVendor\WPDesk\Composer\Codeception\Commands\RunLocalCodeceptionTests(), new \FSVendor\WPDesk\Composer\Codeception\Commands\PrepareCodeceptionDb(), new \FSVendor\WPDesk\Composer\Codeception\Commands\PrepareWordpressForCodeception(), new \FSVendor\WPDesk\Composer\Codeception\Commands\PrepareLocalCodeceptionTests()];
|
19 |
}
|
20 |
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/Configuration.php
ADDED
@@ -0,0 +1,328 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Env
|
5 |
+
* @package WPDesk\Composer\Codeception\Commands
|
6 |
+
*/
|
7 |
+
namespace FSVendor\WPDesk\Composer\Codeception\Commands;
|
8 |
+
|
9 |
+
use FSVendor\Dotenv\Dotenv;
|
10 |
+
/**
|
11 |
+
* Env.
|
12 |
+
*/
|
13 |
+
class Configuration
|
14 |
+
{
|
15 |
+
const MYSQL_IP = 'MYSQL_IP';
|
16 |
+
const MYSQL_DBNAME = 'MYSQL_DBNAME';
|
17 |
+
const MYSQL_DBUSER = 'MYSQL_DBUSER';
|
18 |
+
const MYSQL_DBPASSWORD = 'MYSQL_DBPASSWORD';
|
19 |
+
const APACHE_DOCUMENT_ROOT = 'APACHE_DOCUMENT_ROOT';
|
20 |
+
const WOOTESTS_IP = 'WOOTESTS_IP';
|
21 |
+
const DEPENDENT_PLUGINS_DIR = 'DEPENDENT_PLUGINS_DIR';
|
22 |
+
/**
|
23 |
+
* @var string
|
24 |
+
*/
|
25 |
+
private $apache_document_root;
|
26 |
+
/**
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
private $wptests_ip;
|
30 |
+
/**
|
31 |
+
* @var string
|
32 |
+
*/
|
33 |
+
private $dbhost;
|
34 |
+
/**
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
+
private $dbname;
|
38 |
+
/**
|
39 |
+
* @var string
|
40 |
+
*/
|
41 |
+
private $dbuser;
|
42 |
+
/**
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
private $dbpassword;
|
46 |
+
/**
|
47 |
+
* @var string
|
48 |
+
*/
|
49 |
+
private $dependent_plugins_dir;
|
50 |
+
/**
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
private $plugin_slug;
|
54 |
+
/**
|
55 |
+
* @var string
|
56 |
+
*/
|
57 |
+
private $plugin_file;
|
58 |
+
/**
|
59 |
+
* @var string
|
60 |
+
*/
|
61 |
+
private $plugin_title;
|
62 |
+
/**
|
63 |
+
* @var string
|
64 |
+
*/
|
65 |
+
private $plugin_product_id;
|
66 |
+
/**
|
67 |
+
* @var array
|
68 |
+
*/
|
69 |
+
private $repository_plugins;
|
70 |
+
/**
|
71 |
+
* @var array
|
72 |
+
*/
|
73 |
+
private $local_plugins;
|
74 |
+
/**
|
75 |
+
* @var array
|
76 |
+
*/
|
77 |
+
private $activate_plugins;
|
78 |
+
/**
|
79 |
+
* @var array
|
80 |
+
*/
|
81 |
+
private $prepare_database;
|
82 |
+
/**
|
83 |
+
* Configuration constructor.
|
84 |
+
*
|
85 |
+
* @param $apache_document_root
|
86 |
+
* @param $wptests_ip
|
87 |
+
* @param $dbhost
|
88 |
+
* @param $dbname
|
89 |
+
* @param $dbuser
|
90 |
+
* @param $dbpassword
|
91 |
+
* @param $dependent_plugins_dir
|
92 |
+
* @param $plugin_slug
|
93 |
+
* @param $plugin_file
|
94 |
+
* @param $plugin_title
|
95 |
+
* @param $plugin_product_id
|
96 |
+
* @param $repository_plugins
|
97 |
+
* @param $local_plugins
|
98 |
+
* @param $activate_plugins
|
99 |
+
* @param $prepare_database
|
100 |
+
*/
|
101 |
+
public function __construct($apache_document_root, $wptests_ip, $dbhost, $dbname, $dbuser, $dbpassword, $dependent_plugins_dir, $plugin_slug, $plugin_file, $plugin_title, $plugin_product_id, $repository_plugins, $local_plugins, $activate_plugins, $prepare_database)
|
102 |
+
{
|
103 |
+
$this->apache_document_root = $apache_document_root;
|
104 |
+
$this->wptests_ip = $wptests_ip;
|
105 |
+
$this->dbhost = $dbhost;
|
106 |
+
$this->dbname = $dbname;
|
107 |
+
$this->dbuser = $dbuser;
|
108 |
+
$this->dbpassword = $dbpassword;
|
109 |
+
$this->dependent_plugins_dir = $dependent_plugins_dir;
|
110 |
+
$this->plugin_slug = $plugin_slug;
|
111 |
+
$this->plugin_file = $plugin_file;
|
112 |
+
$this->plugin_title = $plugin_title;
|
113 |
+
$this->plugin_product_id = $plugin_product_id;
|
114 |
+
$this->repository_plugins = $repository_plugins;
|
115 |
+
$this->local_plugins = $local_plugins;
|
116 |
+
$this->activate_plugins = $activate_plugins;
|
117 |
+
$this->prepare_database = $prepare_database;
|
118 |
+
}
|
119 |
+
/**
|
120 |
+
* @return string
|
121 |
+
*/
|
122 |
+
public function getApacheDocumentRoot()
|
123 |
+
{
|
124 |
+
return $this->apache_document_root;
|
125 |
+
}
|
126 |
+
/**
|
127 |
+
* @return string
|
128 |
+
*/
|
129 |
+
public function getWptestsIp()
|
130 |
+
{
|
131 |
+
return $this->wptests_ip;
|
132 |
+
}
|
133 |
+
/**
|
134 |
+
* @return string
|
135 |
+
*/
|
136 |
+
public function getDbhost()
|
137 |
+
{
|
138 |
+
return $this->dbhost;
|
139 |
+
}
|
140 |
+
/**
|
141 |
+
* @return string
|
142 |
+
*/
|
143 |
+
public function getDbname()
|
144 |
+
{
|
145 |
+
return $this->dbname;
|
146 |
+
}
|
147 |
+
/**
|
148 |
+
* @return string
|
149 |
+
*/
|
150 |
+
public function getDbuser()
|
151 |
+
{
|
152 |
+
return $this->dbuser;
|
153 |
+
}
|
154 |
+
/**
|
155 |
+
* @return string
|
156 |
+
*/
|
157 |
+
public function getDbpassword()
|
158 |
+
{
|
159 |
+
return $this->dbpassword;
|
160 |
+
}
|
161 |
+
/**
|
162 |
+
* @return string
|
163 |
+
*/
|
164 |
+
public function getDependentPluginsDir()
|
165 |
+
{
|
166 |
+
return $this->dependent_plugins_dir;
|
167 |
+
}
|
168 |
+
/**
|
169 |
+
* @return string
|
170 |
+
*/
|
171 |
+
public function getPluginSlug()
|
172 |
+
{
|
173 |
+
return $this->plugin_slug;
|
174 |
+
}
|
175 |
+
/**
|
176 |
+
* @return string
|
177 |
+
*/
|
178 |
+
public function getPluginFile()
|
179 |
+
{
|
180 |
+
return $this->plugin_file;
|
181 |
+
}
|
182 |
+
/**
|
183 |
+
* @return string
|
184 |
+
*/
|
185 |
+
public function getPluginTitle()
|
186 |
+
{
|
187 |
+
return $this->plugin_title;
|
188 |
+
}
|
189 |
+
/**
|
190 |
+
* @return string
|
191 |
+
*/
|
192 |
+
public function getPluginProductId()
|
193 |
+
{
|
194 |
+
return $this->plugin_product_id;
|
195 |
+
}
|
196 |
+
/**
|
197 |
+
* @return array
|
198 |
+
*/
|
199 |
+
public function getRepositoryPlugins()
|
200 |
+
{
|
201 |
+
return $this->repository_plugins;
|
202 |
+
}
|
203 |
+
/**
|
204 |
+
* @return array
|
205 |
+
*/
|
206 |
+
public function getLocalPlugins()
|
207 |
+
{
|
208 |
+
return $this->local_plugins;
|
209 |
+
}
|
210 |
+
/**
|
211 |
+
* @return array
|
212 |
+
*/
|
213 |
+
public function getActivatePlugins()
|
214 |
+
{
|
215 |
+
return $this->activate_plugins;
|
216 |
+
}
|
217 |
+
/**
|
218 |
+
* @return array
|
219 |
+
*/
|
220 |
+
public function getPrepareDatabase()
|
221 |
+
{
|
222 |
+
return $this->prepare_database;
|
223 |
+
}
|
224 |
+
/**
|
225 |
+
* Set env variables from configuration.
|
226 |
+
*/
|
227 |
+
public function prepareEnvForConfiguration()
|
228 |
+
{
|
229 |
+
$this->putEnv('WPDESK_PLUGIN_SLUG', $this->getPluginSlug());
|
230 |
+
$this->putEnv('WPDESK_PLUGIN_FILE', $this->getPluginFile());
|
231 |
+
$this->putEnv('WPDESK_PLUGIN_TITLE', $this->getPluginTitle());
|
232 |
+
$this->putEnv('WPDESK_PLUGIN_PRODUCT_ID', $this->getPluginProductId());
|
233 |
+
}
|
234 |
+
/**
|
235 |
+
* @param string $env_variable
|
236 |
+
* @param string $value
|
237 |
+
*
|
238 |
+
* @return string
|
239 |
+
*/
|
240 |
+
private function putEnv($env_variable, $value)
|
241 |
+
{
|
242 |
+
\putenv($env_variable . '=' . $value);
|
243 |
+
}
|
244 |
+
/**
|
245 |
+
* @param array $configuration .
|
246 |
+
*
|
247 |
+
* @return Configuration
|
248 |
+
*/
|
249 |
+
public static function createFromEnvAndConfiguration(array $configuration)
|
250 |
+
{
|
251 |
+
$dotenv = \FSVendor\Dotenv\Dotenv::createImmutable(\getcwd() . '/../');
|
252 |
+
$dotenv->safeLoad();
|
253 |
+
$apache_document_root = self::prepareFromEnv(self::APACHE_DOCUMENT_ROOT, self::prepareApacheDocumentRoot());
|
254 |
+
$wptests_ip = self::prepareFromEnv(self::WOOTESTS_IP, 'wptests.lh');
|
255 |
+
$dbhost = self::prepareFromEnv(self::MYSQL_IP, 'mysqltests');
|
256 |
+
$dbname = self::prepareFromEnv(self::MYSQL_DBNAME, 'wptest');
|
257 |
+
$dbuser = self::prepareFromEnv(self::MYSQL_DBUSER, 'mysql');
|
258 |
+
$dbpassword = self::prepareFromEnv(self::MYSQL_DBPASSWORD, 'mysql');
|
259 |
+
$dependent_plugins_dir = self::prepareFromEnv(self::DEPENDENT_PLUGINS_DIR, '../');
|
260 |
+
if (isset($configuration['plugin-slug'])) {
|
261 |
+
$plugin_slug = $configuration['plugin-slug'];
|
262 |
+
} else {
|
263 |
+
throw new \FSVendor\WPDesk\Composer\Codeception\Commands\SettingsException('Missing plugin-slug setting!');
|
264 |
+
}
|
265 |
+
if (isset($configuration['plugin-file'])) {
|
266 |
+
$plugin_file = $configuration['plugin-file'];
|
267 |
+
} else {
|
268 |
+
throw new \FSVendor\WPDesk\Composer\Codeception\Commands\SettingsException('Missing plugin-file setting!');
|
269 |
+
}
|
270 |
+
if (isset($configuration['plugin-title'])) {
|
271 |
+
$plugin_title = $configuration['plugin-title'];
|
272 |
+
} else {
|
273 |
+
throw new \FSVendor\WPDesk\Composer\Codeception\Commands\SettingsException('Missing plugin-title setting!');
|
274 |
+
}
|
275 |
+
if (isset($configuration['plugin-product-id'])) {
|
276 |
+
$plugin_product_id = $configuration['plugin-product-id'];
|
277 |
+
} else {
|
278 |
+
$plugin_product_id = '';
|
279 |
+
}
|
280 |
+
$prepare_database = array();
|
281 |
+
if (isset($configuration['prepare-database']) && \is_array($configuration['prepare-database'])) {
|
282 |
+
$prepare_database = $configuration['prepare-database'];
|
283 |
+
}
|
284 |
+
$repository_plugins = self::getPluginsSettings($configuration, 'repository');
|
285 |
+
$local_plugins = self::getPluginsSettings($configuration, 'local');
|
286 |
+
$activate_plugins = self::getPluginsSettings($configuration, 'activate');
|
287 |
+
return new self($apache_document_root, $wptests_ip, $dbhost, $dbname, $dbuser, $dbpassword, $dependent_plugins_dir, $plugin_slug, $plugin_file, $plugin_title, $plugin_product_id, $repository_plugins, $local_plugins, $activate_plugins, $prepare_database);
|
288 |
+
}
|
289 |
+
/**
|
290 |
+
* @param string $env_variable .
|
291 |
+
* @param string $default_value .
|
292 |
+
*
|
293 |
+
* @return string
|
294 |
+
*/
|
295 |
+
private static function prepareFromEnv($env_variable, $default_value)
|
296 |
+
{
|
297 |
+
$value = \getenv($env_variable);
|
298 |
+
$value = $value ? $value : $default_value;
|
299 |
+
return $value;
|
300 |
+
}
|
301 |
+
/**
|
302 |
+
* @return string
|
303 |
+
*/
|
304 |
+
private static function prepareApacheDocumentRoot()
|
305 |
+
{
|
306 |
+
return self::isWindows() ? 'c:\\xampp\\htdocs\\wptests' : '/tmp/wptests';
|
307 |
+
}
|
308 |
+
/**
|
309 |
+
* @return bool
|
310 |
+
*/
|
311 |
+
public static function isWindows()
|
312 |
+
{
|
313 |
+
return \false !== \stristr(\PHP_OS, 'WIN') && \false === \stristr(\PHP_OS, 'DARWIN');
|
314 |
+
}
|
315 |
+
/**
|
316 |
+
* @param array $configuration .
|
317 |
+
* @param string $plugins_section .
|
318 |
+
*
|
319 |
+
* @return array
|
320 |
+
*/
|
321 |
+
private static function getPluginsSettings(array $configuration, $plugins_section)
|
322 |
+
{
|
323 |
+
if (\is_array($configuration) && isset($configuration['plugins'], $configuration['plugins'][$plugins_section]) && \is_array($configuration['plugins'][$plugins_section])) {
|
324 |
+
return $configuration['plugins'][$plugins_section];
|
325 |
+
}
|
326 |
+
return array();
|
327 |
+
}
|
328 |
+
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/LocalCodeceptionTrait.php
ADDED
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FSVendor\WPDesk\Composer\Codeception\Commands;
|
4 |
+
|
5 |
+
use FSVendor\Symfony\Component\Console\Output\OutputInterface;
|
6 |
+
use FSVendor\Symfony\Component\Yaml\Exception\ParseException;
|
7 |
+
use FSVendor\Symfony\Component\Yaml\Yaml;
|
8 |
+
/**
|
9 |
+
* Common methods for local Codeception tests.
|
10 |
+
*/
|
11 |
+
trait LocalCodeceptionTrait
|
12 |
+
{
|
13 |
+
private function getWpDeskConfiguration()
|
14 |
+
{
|
15 |
+
try {
|
16 |
+
$wpdesk_configuration = \FSVendor\Symfony\Component\Yaml\Yaml::parseFile(\getcwd() . '/tests/codeception/wpdesk.yml');
|
17 |
+
} catch (\FSVendor\Symfony\Component\Yaml\Exception\ParseException $e) {
|
18 |
+
$wpdesk_configuration = array();
|
19 |
+
}
|
20 |
+
return \FSVendor\WPDesk\Composer\Codeception\Commands\Configuration::createFromEnvAndConfiguration($wpdesk_configuration);
|
21 |
+
}
|
22 |
+
/**
|
23 |
+
* @param OutputInterface $output
|
24 |
+
* @param Configuration $configuration
|
25 |
+
*/
|
26 |
+
private function prepareWpConfig(\FSVendor\Symfony\Component\Console\Output\OutputInterface $output, \FSVendor\WPDesk\Composer\Codeception\Commands\Configuration $configuration)
|
27 |
+
{
|
28 |
+
$apache_document_root = $configuration->getApacheDocumentRoot();
|
29 |
+
$this->executeWpCliAndOutput('config set WP_DEBUG true --raw', $output, $apache_document_root);
|
30 |
+
$this->executeWpCliAndOutput('config set WP_DEBUG_LOG true --raw', $output, $apache_document_root);
|
31 |
+
$this->executeWpCliAndOutput('config set WP_DEBUG_DISPLAY true --raw', $output, $apache_document_root);
|
32 |
+
$this->executeWpCliAndOutput('config set WP_HOME http://' . $configuration->getWptestsIp(), $output, $apache_document_root);
|
33 |
+
$this->executeWpCliAndOutput('config set WP_SITEURL http://' . $configuration->getWptestsIp(), $output, $apache_document_root);
|
34 |
+
$this->executeWpCliAndOutput('config set WP_AUTO_UPDATE_CORE false --raw', $output, $apache_document_root);
|
35 |
+
$this->executeWpCliAndOutput('config set AUTOMATIC_UPDATER_DISABLED false --raw', $output, $apache_document_root);
|
36 |
+
}
|
37 |
+
/**
|
38 |
+
* @param OutputInterface $output
|
39 |
+
* @param Configuration $configuration
|
40 |
+
*/
|
41 |
+
private function activatePlugins(\FSVendor\Symfony\Component\Console\Output\OutputInterface $output, \FSVendor\WPDesk\Composer\Codeception\Commands\Configuration $configuration)
|
42 |
+
{
|
43 |
+
$this->executeWpCliAndOutput('plugin deactivate --all', $output, $configuration->getApacheDocumentRoot());
|
44 |
+
$plugins = '';
|
45 |
+
foreach ($configuration->getRepositoryPlugins() as $plugin) {
|
46 |
+
$plugins .= ' ' . $plugin;
|
47 |
+
}
|
48 |
+
if ($plugins) {
|
49 |
+
$this->executeWpCliAndOutput('plugin install ' . $plugins, $output, $configuration->getApacheDocumentRoot());
|
50 |
+
}
|
51 |
+
foreach ($configuration->getLocalPlugins() as $plugin) {
|
52 |
+
$source = $this->preparePathForRsync($this->prepareLocalPluginDir($plugin, $configuration->getDependentPluginsDir()) . '/*', $configuration::isWindows());
|
53 |
+
$target = $this->preparePathForRsync($this->prepareTargetDir($plugin, $configuration) . '/', $configuration::isWindows());
|
54 |
+
$rsync = 'rsync -a ' . $source . ' ' . $target . ' --exclude=node_modules --exclude=.git --exclude=tests --exclude=.idea';
|
55 |
+
$output->writeln($rsync);
|
56 |
+
$this->execAndOutput($rsync, $output);
|
57 |
+
}
|
58 |
+
foreach ($configuration->getActivatePlugins() as $plugin) {
|
59 |
+
$this->executeWpCliAndOutput('plugin activate ' . $plugin, $output, $configuration->getApacheDocumentRoot());
|
60 |
+
}
|
61 |
+
$this->executeWpCliAndOutput('plugin activate ' . $configuration->getPluginSlug(), $output, $configuration->getApacheDocumentRoot());
|
62 |
+
}
|
63 |
+
/**
|
64 |
+
* @param string $plugin .
|
65 |
+
*/
|
66 |
+
private function prepareLocalPluginDir($plugin, $local_plugins_dir = \false)
|
67 |
+
{
|
68 |
+
if (!$local_plugins_dir) {
|
69 |
+
$local_plugins_dir = \dirname(\getcwd());
|
70 |
+
}
|
71 |
+
return $this->trailingslashit($local_plugins_dir) . $plugin;
|
72 |
+
}
|
73 |
+
/**
|
74 |
+
* @param $string
|
75 |
+
*
|
76 |
+
* @return string
|
77 |
+
*/
|
78 |
+
private function trailingslashit($string)
|
79 |
+
{
|
80 |
+
return \rtrim($string, '/\\') . '/';
|
81 |
+
}
|
82 |
+
/**
|
83 |
+
* @param string $command
|
84 |
+
* @param OutputInterface $output
|
85 |
+
* @param string $apache_document_root
|
86 |
+
*/
|
87 |
+
private function executeWpCliAndOutput($command, \FSVendor\Symfony\Component\Console\Output\OutputInterface $output, $apache_document_root)
|
88 |
+
{
|
89 |
+
$output->write("WPCLI: {$command}\n");
|
90 |
+
$sep = \DIRECTORY_SEPARATOR;
|
91 |
+
$wp = "php vendor{$sep}wp-cli{$sep}wp-cli{$sep}php{$sep}boot-fs.php";
|
92 |
+
$command = $wp . ' ' . $command . ' --allow-root --path=' . $apache_document_root;
|
93 |
+
$this->execAndOutput($command, $output);
|
94 |
+
}
|
95 |
+
/**
|
96 |
+
* @param string $plugin_slug
|
97 |
+
* @param OutputInterface $output
|
98 |
+
* @param Configuration $configuration
|
99 |
+
*/
|
100 |
+
private function installPlugin($plugin_slug, \FSVendor\Symfony\Component\Console\Output\OutputInterface $output, \FSVendor\WPDesk\Composer\Codeception\Commands\Configuration $configuration)
|
101 |
+
{
|
102 |
+
$source = $this->preparePathForRsync(\getcwd() . '/*', $configuration::isWindows());
|
103 |
+
$target = $this->preparePathForRsync($this->prepareTargetDir($plugin_slug, $configuration) . '/', $configuration::isWindows());
|
104 |
+
$rsync = 'rsync -a ' . $source . ' ' . $target . ' --exclude=node_modules --exclude=.git --exclude=tests --exclude=.idea --exclude=vendor';
|
105 |
+
$this->execAndOutput($rsync, $output);
|
106 |
+
$this->execAndOutput('composer install --no-dev --working-dir=' . $configuration->getApacheDocumentRoot() . '/wp-content/plugins/' . $plugin_slug, $output);
|
107 |
+
}
|
108 |
+
/**
|
109 |
+
* @param string $path
|
110 |
+
* @param bool $is_windows
|
111 |
+
*
|
112 |
+
* @return string
|
113 |
+
*/
|
114 |
+
private function preparePathForRsync($path, $is_windows)
|
115 |
+
{
|
116 |
+
if ($is_windows) {
|
117 |
+
$path = '/cygdrive/' . $path;
|
118 |
+
$path = \str_replace(':', '', $path);
|
119 |
+
$path = \str_replace('\\', '/', $path);
|
120 |
+
}
|
121 |
+
return $path;
|
122 |
+
}
|
123 |
+
/**
|
124 |
+
* @param string $plugin_slug
|
125 |
+
* @param Configuration $configuration
|
126 |
+
*
|
127 |
+
* @return string
|
128 |
+
*/
|
129 |
+
private function prepareTargetDir($plugin_slug, \FSVendor\WPDesk\Composer\Codeception\Commands\Configuration $configuration)
|
130 |
+
{
|
131 |
+
return $configuration->getApacheDocumentRoot() . '/wp-content/plugins/' . $plugin_slug;
|
132 |
+
}
|
133 |
+
/**
|
134 |
+
* @param Configuration $configuration
|
135 |
+
* @param OutputInterface $output
|
136 |
+
*/
|
137 |
+
private function prepareCommonWpWcConfiguration(\FSVendor\WPDesk\Composer\Codeception\Commands\Configuration $configuration, \FSVendor\Symfony\Component\Console\Output\OutputInterface $output)
|
138 |
+
{
|
139 |
+
$this->executeWpCliAndOutput('db reset --yes', $output, $configuration->getApacheDocumentRoot());
|
140 |
+
$this->executeWpCliAndOutput('core install --url=' . $configuration->getWptestsIp() . ' --title=Woo-tests --admin_user=admin --admin_password=admin --admin_email=grola@seostudio.pl --skip-email', $output, $configuration->getApacheDocumentRoot());
|
141 |
+
$commands = array('theme activate storefront-wpdesk-tests', 'plugin activate woocommerce');
|
142 |
+
$commands = \array_merge($commands, $this->prepareWcOptionsCommands(), $this->prepareTaxes(), $this->prepareShippingMethods(), $this->prepareWooCommercePages(), $this->prepareCustomer(), $this->prepareDisableRESTApiPermissions(), $this->prepareCreateProductsCommands(), $configuration->getPrepareDatabase());
|
143 |
+
foreach ($commands as $command) {
|
144 |
+
$this->executeWpCliAndOutput($command, $output, $configuration->getApacheDocumentRoot());
|
145 |
+
}
|
146 |
+
}
|
147 |
+
/**
|
148 |
+
* @return array
|
149 |
+
*/
|
150 |
+
private function prepareWcOptionsCommands()
|
151 |
+
{
|
152 |
+
return array('option update woocommerce_admin_notices \'{}\'', 'option update storefront_nux_dismissed 1', 'option set woocommerce_store_address "al. Jana Pawła 12"', 'option set woocommerce_store_address_2 ""', 'option set woocommerce_store_city "Warszawa"', 'option set woocommerce_default_country "PL"', 'option set woocommerce_store_postalcode "22-100"', 'option set woocommerce_currency "PLN"', 'option set woocommerce_currency_pos "right_space"', 'option set woocommerce_product_type "physical"', 'option set woocommerce_allow_tracking "no"', 'option set --format=json woocommerce_stripe_settings \'{"enabled":"no","create_account":false,"email":false}\'', 'option set --format=json woocommerce_ppec_paypal_settings \'{"reroute_requests":false,"email":false}\'', 'option set --format=json woocommerce_cheque_settings \'{"enabled":"no"}\'', 'option set --format=json woocommerce_bacs_settings \'{"enabled":"no"}\'', 'option set --format=json woocommerce_cod_settings \'{"enabled":"yes"}\'', 'option set --format=json woocommerce_onboarding_profile \'{"skipped":true}\'', 'option set --format=json wc-admin-onboarding-profiler-reminder \'{"skipped":true}\'', 'option get woocommerce_onboarding_profile', 'option set woocommerce_task_list_hidden "yes"');
|
153 |
+
}
|
154 |
+
/**
|
155 |
+
* @return string[]
|
156 |
+
*/
|
157 |
+
private function prepareTaxes()
|
158 |
+
{
|
159 |
+
return array('wc tax create --country="PL" --rate=23 --name=VAT --shipping=true --user=admin', 'option set woocommerce_calc_taxes "yes"');
|
160 |
+
}
|
161 |
+
/**
|
162 |
+
* @return string[]
|
163 |
+
*/
|
164 |
+
private function prepareShippingMethods()
|
165 |
+
{
|
166 |
+
return array('wc shipping_zone_method create 0 --method_id="flat_rate" --settings=\'{"title": "Flat rate", "cost":1, "tax_status": "taxable"}\' --enabled=true --user=admin');
|
167 |
+
}
|
168 |
+
/**
|
169 |
+
* @return string[]
|
170 |
+
*/
|
171 |
+
private function prepareWooCommercePages()
|
172 |
+
{
|
173 |
+
return array('wc --user=admin tool run install_pages');
|
174 |
+
}
|
175 |
+
/**
|
176 |
+
* @return string[]
|
177 |
+
*/
|
178 |
+
private function prepareCustomer()
|
179 |
+
{
|
180 |
+
return array('wc customer create --email=\'customer@woo.local\' --username="customer" --billing=\'{"first_name":"First","last_name":"Last","company":"WPDesk","address_1":"Street 1","city":"City","postcode": "53-030", "country": "PL", "phone": "012345678"}\' --password=\'customer\' --user=admin');
|
181 |
+
}
|
182 |
+
/**
|
183 |
+
* @return string[]
|
184 |
+
*/
|
185 |
+
private function prepareDisableRESTApiPermissions()
|
186 |
+
{
|
187 |
+
return array('option set wpdesk_rest_api_disable_permissions "1"');
|
188 |
+
}
|
189 |
+
/**
|
190 |
+
* @return array
|
191 |
+
*/
|
192 |
+
private function prepareCreateProductsCommands()
|
193 |
+
{
|
194 |
+
return array($this->prepareCreateProductCommand('100', '100'), $this->prepareCreateProductCommand('10', '10'), $this->prepareCreateProductCommand('9', '9'), $this->prepareCreateProductCommand('1', '1'), $this->prepareCreateProductCommand('09', '0.9'), $this->prepareCreateProductCommand('009', '0.09'), $this->prepareCreateProductCommand('01', '0.1'), $this->prepareCreateProductCommand('001', '0.01'), $this->prepareCreateProductCommand('0001', '0.001'), $this->prepareCreateProductCommand('00001', '0.0001'));
|
195 |
+
}
|
196 |
+
/**
|
197 |
+
* @param string $name
|
198 |
+
* @param string $price
|
199 |
+
* @param null|string $weight
|
200 |
+
* @param null|string $sku
|
201 |
+
* @param null|string $dimensions
|
202 |
+
*
|
203 |
+
* @return string
|
204 |
+
*/
|
205 |
+
private function prepareCreateProductCommand($name, $price, $weight = null, $sku = null, $dimensions = null)
|
206 |
+
{
|
207 |
+
$product_name = "Product {$name}";
|
208 |
+
$weight = $weight ? $weight : $price;
|
209 |
+
$sku = $sku ? $sku : 'product-' . $name;
|
210 |
+
$dimensions = $dimensions ? $dimensions : '{"width":"' . $price . '","length":"' . $price . '","height":"' . $price . '"}';
|
211 |
+
return "wc product create --name=\"{$product_name}\" --virtual=false --downloadable=false --type=simple --sku={$sku} --regular_price={$price} --weight={$weight} --dimensions='{$dimensions}'";
|
212 |
+
}
|
213 |
+
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareCodeceptionDb.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FSVendor\WPDesk\Composer\Codeception\Commands;
|
4 |
+
|
5 |
+
use FSVendor\Symfony\Component\Console\Input\InputArgument;
|
6 |
+
use FSVendor\Symfony\Component\Console\Input\InputInterface;
|
7 |
+
use FSVendor\Symfony\Component\Console\Output\OutputInterface;
|
8 |
+
use FSVendor\Symfony\Component\Yaml\Exception\ParseException;
|
9 |
+
use FSVendor\Symfony\Component\Yaml\Yaml;
|
10 |
+
/**
|
11 |
+
* Prepare Database for Codeception tests command.
|
12 |
+
*
|
13 |
+
* @package WPDesk\Composer\Codeception\Commands
|
14 |
+
*/
|
15 |
+
class PrepareCodeceptionDb extends \FSVendor\WPDesk\Composer\Codeception\Commands\BaseCommand
|
16 |
+
{
|
17 |
+
use LocalCodeceptionTrait;
|
18 |
+
/**
|
19 |
+
* Configure command.
|
20 |
+
*/
|
21 |
+
protected function configure()
|
22 |
+
{
|
23 |
+
parent::configure();
|
24 |
+
$this->setName('prepare-codeception-db')->setDescription('Prepare codeception database.');
|
25 |
+
}
|
26 |
+
/**
|
27 |
+
* Execute command.
|
28 |
+
*
|
29 |
+
* @param InputInterface $input
|
30 |
+
* @param OutputInterface $output
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
+
protected function execute(\FSVendor\Symfony\Component\Console\Input\InputInterface $input, \FSVendor\Symfony\Component\Console\Output\OutputInterface $output)
|
34 |
+
{
|
35 |
+
$configuration = $this->getWpDeskConfiguration();
|
36 |
+
$this->installPlugin($configuration->getPluginSlug(), $output, $configuration);
|
37 |
+
$this->prepareCommonWpWcConfiguration($configuration, $output);
|
38 |
+
$this->prepareWpConfig($output, $configuration);
|
39 |
+
$this->executeWpCliAndOutput('plugin activate ' . $configuration->getPluginSlug(), $output, $configuration->getApacheDocumentRoot());
|
40 |
+
$this->activatePlugins($output, $configuration);
|
41 |
+
$this->executeWpCliAndOutput('db export ' . \getcwd() . '/tests/codeception/tests/_data/db.sql', $output, $configuration->getApacheDocumentRoot());
|
42 |
+
}
|
43 |
+
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareLocalCodeceptionTests.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FSVendor\WPDesk\Composer\Codeception\Commands;
|
4 |
+
|
5 |
+
use FSVendor\Symfony\Component\Console\Input\InputArgument;
|
6 |
+
use FSVendor\Symfony\Component\Console\Input\InputInterface;
|
7 |
+
use FSVendor\Symfony\Component\Console\Output\OutputInterface;
|
8 |
+
use FSVendor\Symfony\Component\Yaml\Exception\ParseException;
|
9 |
+
use FSVendor\Symfony\Component\Yaml\Yaml;
|
10 |
+
/**
|
11 |
+
* Codeception tests run command.
|
12 |
+
*
|
13 |
+
* @package WPDesk\Composer\Codeception\Commands
|
14 |
+
*/
|
15 |
+
class PrepareLocalCodeceptionTests extends \FSVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests
|
16 |
+
{
|
17 |
+
use LocalCodeceptionTrait;
|
18 |
+
/**
|
19 |
+
* Configure command.
|
20 |
+
*/
|
21 |
+
protected function configure()
|
22 |
+
{
|
23 |
+
parent::configure();
|
24 |
+
$this->setName('prepare-local-codeception-tests')->setDescription('Prepare local codeception tests.');
|
25 |
+
}
|
26 |
+
/**
|
27 |
+
* Execute command.
|
28 |
+
*
|
29 |
+
* @param InputInterface $input
|
30 |
+
* @param OutputInterface $output
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
+
protected function execute(\FSVendor\Symfony\Component\Console\Input\InputInterface $input, \FSVendor\Symfony\Component\Console\Output\OutputInterface $output)
|
34 |
+
{
|
35 |
+
$configuration = $this->getWpDeskConfiguration();
|
36 |
+
$this->installPlugin($configuration->getPluginSlug(), $output, $configuration);
|
37 |
+
$this->activatePlugins($output, $configuration);
|
38 |
+
$this->prepareWpConfig($output, $configuration);
|
39 |
+
$sep = \DIRECTORY_SEPARATOR;
|
40 |
+
$codecept = "vendor{$sep}bin{$sep}codecept";
|
41 |
+
$cleanOutput = $codecept . ' clean';
|
42 |
+
$this->execAndOutput($cleanOutput, $output);
|
43 |
+
}
|
44 |
+
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareWordpressForCodeception.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FSVendor\WPDesk\Composer\Codeception\Commands;
|
4 |
+
|
5 |
+
use FSVendor\Symfony\Component\Console\Input\InputArgument;
|
6 |
+
use FSVendor\Symfony\Component\Console\Input\InputInterface;
|
7 |
+
use FSVendor\Symfony\Component\Console\Output\OutputInterface;
|
8 |
+
use FSVendor\Symfony\Component\Yaml\Exception\ParseException;
|
9 |
+
use FSVendor\Symfony\Component\Yaml\Yaml;
|
10 |
+
/**
|
11 |
+
* Prepare Database for Codeception tests command.
|
12 |
+
*
|
13 |
+
* @package WPDesk\Composer\Codeception\Commands
|
14 |
+
*/
|
15 |
+
class PrepareWordpressForCodeception extends \FSVendor\WPDesk\Composer\Codeception\Commands\BaseCommand
|
16 |
+
{
|
17 |
+
use LocalCodeceptionTrait;
|
18 |
+
/**
|
19 |
+
* Configure command.
|
20 |
+
*/
|
21 |
+
protected function configure()
|
22 |
+
{
|
23 |
+
parent::configure();
|
24 |
+
$this->setName('prepare-wordpress-for-codeception')->setDescription('Prepare wordpress installation for codeception tests.');
|
25 |
+
}
|
26 |
+
/**
|
27 |
+
* Execute command.
|
28 |
+
*
|
29 |
+
* @param InputInterface $input
|
30 |
+
* @param OutputInterface $output
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
+
protected function execute(\FSVendor\Symfony\Component\Console\Input\InputInterface $input, \FSVendor\Symfony\Component\Console\Output\OutputInterface $output)
|
34 |
+
{
|
35 |
+
$configuration = $this->getWpDeskConfiguration();
|
36 |
+
$this->installWP($output, $configuration);
|
37 |
+
}
|
38 |
+
/**
|
39 |
+
* @param OutputInterface $output
|
40 |
+
* @param Configuration $configuration
|
41 |
+
*/
|
42 |
+
private function installWP(\FSVendor\Symfony\Component\Console\Output\OutputInterface $output, \FSVendor\WPDesk\Composer\Codeception\Commands\Configuration $configuration)
|
43 |
+
{
|
44 |
+
if (!\file_exists($configuration->getApacheDocumentRoot())) {
|
45 |
+
\mkdir($configuration->getApacheDocumentRoot(), 0777, \true);
|
46 |
+
}
|
47 |
+
$dbhost = $configuration->getDbhost();
|
48 |
+
$dbname = $configuration->getDbname();
|
49 |
+
$dbuser = $configuration->getDbuser();
|
50 |
+
$dbpassword = $configuration->getDbpassword();
|
51 |
+
$url = $configuration->getWptestsIp();
|
52 |
+
$apache_document_root = $configuration->getApacheDocumentRoot();
|
53 |
+
$this->executeWpCliAndOutput('core download --force', $output, $apache_document_root);
|
54 |
+
$this->executeWpCliAndOutput("core config --dbhost={$dbhost} --dbname={$dbname} --dbuser={$dbuser} --dbpass={$dbpassword}", $output, $apache_document_root);
|
55 |
+
$this->executeWpCliAndOutput("core install --url={$url} --title=Woo-tests --admin_user=admin --admin_password=admin --admin_email=tests@wpdesk.dev --skip-email", $output, $apache_document_root);
|
56 |
+
\copy('./vendor/wpdesk/wp-codeception/wordpress/htaccess', $apache_document_root . '/.htaccess');
|
57 |
+
$this->executeWpCliAndOutput('rewrite structure \'/%postname%/\'', $output, $apache_document_root);
|
58 |
+
$this->executeWpCliAndOutput('plugin install woocommerce', $output, $apache_document_root);
|
59 |
+
$this->executeWpCliAndOutput('theme activate storefront', $output, $apache_document_root);
|
60 |
+
$this->executeWpCliAndOutput('theme delete storefront-wpdesk-tests', $output, $apache_document_root);
|
61 |
+
$this->executeWpCliAndOutput('theme install storefront', $output, $apache_document_root);
|
62 |
+
$this->executeWpCliAndOutput('theme install https://gitlab.com/wpdesk/storefront-wpdesk-tests/-/archive/master/storefront-wpdesk-tests-master.zip', $output, $apache_document_root);
|
63 |
+
\rename($apache_document_root . '/wp-content/themes/storefront-wpdesk-tests-master', $apache_document_root . '/wp-content/themes/storefront-wpdesk-tests');
|
64 |
+
$this->executeWpCliAndOutput('theme activate storefront-wpdesk-tests', $output, $apache_document_root);
|
65 |
+
}
|
66 |
+
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunLocalCodeceptionTests.php
CHANGED
@@ -5,6 +5,8 @@ namespace FSVendor\WPDesk\Composer\Codeception\Commands;
|
|
5 |
use FSVendor\Symfony\Component\Console\Input\InputArgument;
|
6 |
use FSVendor\Symfony\Component\Console\Input\InputInterface;
|
7 |
use FSVendor\Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
8 |
/**
|
9 |
* Codeception tests run command.
|
10 |
*
|
@@ -12,13 +14,14 @@ use FSVendor\Symfony\Component\Console\Output\OutputInterface;
|
|
12 |
*/
|
13 |
class RunLocalCodeceptionTests extends \FSVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests
|
14 |
{
|
|
|
15 |
/**
|
16 |
* Configure command.
|
17 |
*/
|
18 |
protected function configure()
|
19 |
{
|
20 |
parent::configure();
|
21 |
-
$this->setName('run-local-codeception-tests')->setDescription('Run local codeception tests.')->setDefinition(array(new \FSVendor\Symfony\Component\Console\Input\InputArgument(self::SINGLE, \FSVendor\Symfony\Component\Console\Input\InputArgument::OPTIONAL, 'Name of Single test to run.', ' ')
|
22 |
}
|
23 |
/**
|
24 |
* Execute command.
|
@@ -29,9 +32,14 @@ class RunLocalCodeceptionTests extends \FSVendor\WPDesk\Composer\Codeception\Com
|
|
29 |
*/
|
30 |
protected function execute(\FSVendor\Symfony\Component\Console\Input\InputInterface $input, \FSVendor\Symfony\Component\Console\Output\OutputInterface $output)
|
31 |
{
|
|
|
|
|
32 |
$singleTest = $input->getArgument(self::SINGLE);
|
33 |
-
$
|
34 |
-
$
|
|
|
|
|
|
|
35 |
$this->execAndOutput($runLocalTests, $output);
|
36 |
}
|
37 |
}
|
5 |
use FSVendor\Symfony\Component\Console\Input\InputArgument;
|
6 |
use FSVendor\Symfony\Component\Console\Input\InputInterface;
|
7 |
use FSVendor\Symfony\Component\Console\Output\OutputInterface;
|
8 |
+
use FSVendor\Symfony\Component\Yaml\Exception\ParseException;
|
9 |
+
use FSVendor\Symfony\Component\Yaml\Yaml;
|
10 |
/**
|
11 |
* Codeception tests run command.
|
12 |
*
|
14 |
*/
|
15 |
class RunLocalCodeceptionTests extends \FSVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests
|
16 |
{
|
17 |
+
use LocalCodeceptionTrait;
|
18 |
/**
|
19 |
* Configure command.
|
20 |
*/
|
21 |
protected function configure()
|
22 |
{
|
23 |
parent::configure();
|
24 |
+
$this->setName('run-local-codeception-tests')->setDescription('Run local codeception tests.')->setDefinition(array(new \FSVendor\Symfony\Component\Console\Input\InputArgument(self::SINGLE, \FSVendor\Symfony\Component\Console\Input\InputArgument::OPTIONAL, 'Name of Single test to run.', ' ')));
|
25 |
}
|
26 |
/**
|
27 |
* Execute command.
|
32 |
*/
|
33 |
protected function execute(\FSVendor\Symfony\Component\Console\Input\InputInterface $input, \FSVendor\Symfony\Component\Console\Output\OutputInterface $output)
|
34 |
{
|
35 |
+
$configuration = $this->getWpDeskConfiguration();
|
36 |
+
$this->prepareWpConfig($output, $configuration);
|
37 |
$singleTest = $input->getArgument(self::SINGLE);
|
38 |
+
$sep = \DIRECTORY_SEPARATOR;
|
39 |
+
$codecept = "vendor{$sep}bin{$sep}codecept";
|
40 |
+
$cleanOutput = $codecept . ' clean';
|
41 |
+
$this->execAndOutput($cleanOutput, $output);
|
42 |
+
$runLocalTests = $codecept . ' run -f --steps --html --verbose acceptance ' . $singleTest;
|
43 |
$this->execAndOutput($runLocalTests, $output);
|
44 |
}
|
45 |
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SettingsException.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class SettingsException
|
5 |
+
* @package WPDesk\Composer\Codeception\Commands
|
6 |
+
*/
|
7 |
+
namespace FSVendor\WPDesk\Composer\Codeception\Commands;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Settings Exception.
|
11 |
+
*/
|
12 |
+
class SettingsException extends \RuntimeException
|
13 |
+
{
|
14 |
+
}
|
vendor_prefixed/wpdesk/wp-wpdesk-fs-table-rate/src/Settings/MethodSettingsFactory.php
CHANGED
@@ -45,7 +45,7 @@ class MethodSettingsFactory
|
|
45 |
*/
|
46 |
private static function clean_settings(array $shipping_method_array)
|
47 |
{
|
48 |
-
if ('0' === \trim($shipping_method_array[self::FIELD_METHOD_FREE_SHIPPING])) {
|
49 |
$shipping_method_array[self::FIELD_METHOD_FREE_SHIPPING] = '';
|
50 |
}
|
51 |
return $shipping_method_array;
|
45 |
*/
|
46 |
private static function clean_settings(array $shipping_method_array)
|
47 |
{
|
48 |
+
if (!isset($shipping_method_array[self::FIELD_METHOD_FREE_SHIPPING]) || '0' === \trim($shipping_method_array[self::FIELD_METHOD_FREE_SHIPPING])) {
|
49 |
$shipping_method_array[self::FIELD_METHOD_FREE_SHIPPING] = '';
|
50 |
}
|
51 |
return $shipping_method_array;
|
vendor_prefixed/wpdesk/wp-wpdesk-helper/src/HelperRemover.php
CHANGED
@@ -55,9 +55,9 @@ class HelperRemover implements \FSVendor\WPDesk\PluginBuilder\Plugin\Hookable
|
|
55 |
private function remove_object_action_by_name($action_name, $priority, $function_name)
|
56 |
{
|
57 |
global $wp_filter;
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
$default_priority_callbacks = $admin_notices_tag->callbacks[$priority];
|
62 |
foreach ($default_priority_callbacks as $callback) {
|
63 |
if (\is_array($callback) && \is_array($callback[self::CALLBACK_KEY]) && isset($callback[self::CALLBACK_KEY][self::CALLBACK_KEY_WITH_FUNCTION_NAME])) {
|
55 |
private function remove_object_action_by_name($action_name, $priority, $function_name)
|
56 |
{
|
57 |
global $wp_filter;
|
58 |
+
if (isset($wp_filter[$action_name]) && isset($wp_filter[$action_name]->callbacks[$priority])) {
|
59 |
+
/** @var WP_Hook $admin_notices_tag */
|
60 |
+
$admin_notices_tag = $wp_filter[$action_name];
|
61 |
$default_priority_callbacks = $admin_notices_tag->callbacks[$priority];
|
62 |
foreach ($default_priority_callbacks as $callback) {
|
63 |
if (\is_array($callback) && \is_array($callback[self::CALLBACK_KEY]) && isset($callback[self::CALLBACK_KEY][self::CALLBACK_KEY_WITH_FUNCTION_NAME])) {
|