Flexible Shipping for WooCommerce - Version 3.1.3

Version Description

  • 2019-01-23 =
  • Tweaked pl translation
  • Fixed issues on shipment creating by FS Connect
Download this release

Release Info

Developer jablonowski
Plugin Icon 128x128 Flexible Shipping for WooCommerce
Version 3.1.3
Comparing to
See all releases

Code changes from version 3.1.2 to 3.1.3

classes/shipment/saas/class-shipment-saas-send.php CHANGED
@@ -165,7 +165,9 @@ class WPDesk_Flexible_Shipping_Shipment_Saas_Send {
165
  $shipment->set_saas_shipment_id( $shipment_response->getShipmentId() );
166
  $shipment->set_tracking_number( $shipment_response->getTrackingId() );
167
  $shipment->set_tracking_url( $shipment_response->getTrackingUrl() );
168
- $shipment->set_shipment_cost( $shipment_response->getShipmentCost() );
 
 
169
  $shipment->delete_meta( $shipment::META_SAAS_MESSAGE );
170
  $shipment->update_status( 'fs-' . $shipment_response->getStatus() );
171
  $shipment->save();
165
  $shipment->set_saas_shipment_id( $shipment_response->getShipmentId() );
166
  $shipment->set_tracking_number( $shipment_response->getTrackingId() );
167
  $shipment->set_tracking_url( $shipment_response->getTrackingUrl() );
168
+ if ($shipment_response->hasShipmentCost()) {
169
+ $shipment->set_shipment_cost( $shipment_response->getShipmentCost() );
170
+ }
171
  $shipment->delete_meta( $shipment::META_SAAS_MESSAGE );
172
  $shipment->update_status( 'fs-' . $shipment_response->getStatus() );
173
  $shipment->save();
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: 3.1.2
7
  Author: WP Desk
8
  Author URI: https://www.wpdesk.net/
9
  Text Domain: flexible-shipping
@@ -43,7 +43,7 @@ if ( ! class_exists( 'WPDesk_Basic_Requirement_Checker' ) ) {
43
 
44
 
45
  /* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */
46
- $plugin_version = '3.1.2';
47
  $plugin_release_timestamp = '2018-11-28';
48
 
49
  $plugin_name = '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: 3.1.3
7
  Author: WP Desk
8
  Author URI: https://www.wpdesk.net/
9
  Text Domain: flexible-shipping
43
 
44
 
45
  /* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */
46
+ $plugin_version = '3.1.3';
47
  $plugin_release_timestamp = '2018-11-28';
48
 
49
  $plugin_name = 'Flexible Shipping';
lang/flexible-shipping-pl_PL.mo CHANGED
Binary file
lang/flexible-shipping-pl_PL.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Flexible Shipping\n"
4
- "POT-Creation-Date: 2018-12-13 11:36+0100\n"
5
- "PO-Revision-Date: 2018-12-13 11:36+0100\n"
6
  "Last-Translator: Piotr Jabłonowski <piotr.jablonowski@wpdesk.net>\n"
7
  "Language-Team: Maciej Swoboda <maciej.swoboda@gmail.com>\n"
8
  "Language: pl_PL\n"
@@ -175,19 +175,19 @@ msgstr ""
175
  msgid "Bulk shipping manifest - processed orders: %d"
176
  msgstr "Zbiorcze tworzenie protokołów nadania - przetworzone zamówienia: %d"
177
 
178
- #: classes/class-flexible-shipping-plugin.php:370
179
  msgid "Settings"
180
  msgstr "Ustawienia"
181
 
182
- #: classes/class-flexible-shipping-plugin.php:372
183
  msgid "Docs"
184
  msgstr "Docs"
185
 
186
- #: classes/class-flexible-shipping-plugin.php:373
187
  msgid "Support"
188
  msgstr "Wsparcie"
189
 
190
- #: classes/class-flexible-shipping-plugin.php:379
191
  msgid "Upgrade"
192
  msgstr "Kup PRO"
193
 
@@ -497,15 +497,27 @@ msgstr "%1$s (darmowa wysyłka)"
497
  msgid "%1$s (fallback)"
498
  msgstr "%1$s (stawka awaryjna)"
499
 
500
- #: classes/saas/class-saas-live-rates-handler.php:435
 
 
 
 
 
501
  #, php-format
502
- msgid "Flexible Shipping Fallback: %1$s"
503
- msgstr "Stawka awaryjna Flexible Shipping: %1$s"
 
 
 
 
 
 
 
504
 
505
  #: classes/saas/class-saas-new-courier-settings-section.php:47
506
  #, php-format
507
  msgid "Do not you see your courier? %1$sCheck planned integrations →%2$s"
508
- msgstr "Nie widzisz swojego kuriera? %1$sSprawdź planowane integracje ->%2$s"
509
 
510
  #: classes/saas/class-saas-settings-service-checkbox.php:78
511
  msgid "Invalid requireWordpressPluginVersion capability!"
@@ -934,6 +946,10 @@ msgstr "Stawka awaryjna:"
934
  msgid "Free shipping"
935
  msgstr "Darmowa wysyłka"
936
 
 
 
 
 
937
  #: classes/saas/views/html-registration-page.php:4
938
  #, php-format
939
  msgid ""
@@ -1098,7 +1114,7 @@ msgstr ""
1098
  "Wysyłaj zamówienia szybciej z %1$sFlexible Shipping Connect%2$s%3$s"
1099
  "%4$sZarejestruj się teraz!%5$s"
1100
 
1101
- #: classes/settings/shipping-method-form.php:54 classes/shipping-method.php:911
1102
  msgid "Free"
1103
  msgstr "Bezpłatnie"
1104
 
@@ -1370,7 +1386,7 @@ msgstr "%1$s Przesyłka %2$s została utworzona."
1370
  msgid "%1$s Shipment %2$s was canceled."
1371
  msgstr "%1$s Przesyłka %2$s została anulowana."
1372
 
1373
- #: classes/shipment/saas/class-shipment-saas.php:590
1374
  msgid "Label is not avaliable for this shipment."
1375
  msgstr "Etykieta nie jest dostępna dla tej przesyłki."
1376
 
@@ -1413,90 +1429,90 @@ msgstr "Tytuł"
1413
  msgid "Add New"
1414
  msgstr "Dodaj nową"
1415
 
1416
- #: classes/shipping-method.php:353
1417
  msgid ""
1418
  "Sorry, there has been an error. The CSV is invalid or incorrect file type."
1419
  msgstr ""
1420
  "Przepraszamy, wystąpił błąd. Plik CSV jest niepoprawny lub typ pliku jest "
1421
  "nieprawidłowy."
1422
 
1423
- #: classes/shipping-method.php:363 classes/shipping-method.php:366
1424
  msgid "import"
1425
  msgstr "import"
1426
 
1427
- #: classes/shipping-method.php:375
1428
  #, php-format
1429
  msgid "Free Shipping value %s is not valid number. Row number %d."
1430
  msgstr "Wartość darmowej wysyłki %s jest niepoprawna. Numer wiersza %d."
1431
 
1432
- #: classes/shipping-method.php:381
1433
  #, php-format
1434
  msgid "Maximum Cost value %s is not valid number. Row number %d."
1435
  msgstr "Maksymalny koszt %s jest niepoprawny. Numer wiersza %d."
1436
 
1437
- #: classes/shipping-method.php:392
1438
  #, php-format
1439
  msgid "Invalid value for Calculation Method in row number %d."
1440
  msgstr "Nieprawidłowa wartość dla Metody obliczania w wierszu %d."
1441
 
1442
- #: classes/shipping-method.php:416
1443
  #, php-format
1444
  msgid "Invalid value for Based On in row number %d."
1445
  msgstr "Nieprawidłowa wartość dla Oparte na w wierszu %d."
1446
 
1447
- #: classes/shipping-method.php:421
1448
  #, php-format
1449
  msgid "Min value %s is not valid number. Row number %d."
1450
  msgstr "Wartość Min %s jest niepoprawna. Numer wiersza %d."
1451
 
1452
- #: classes/shipping-method.php:427
1453
  #, php-format
1454
  msgid "Max value %s is not valid number. Row number %d."
1455
  msgstr "Wartość Maks %s jest niepoprawna. Numer wiersza %d."
1456
 
1457
- #: classes/shipping-method.php:433
1458
  #, php-format
1459
  msgid "Cost per order value %s is not valid number. Row number %d."
1460
  msgstr "Wartość Koszt na zamówienie %s jest niepoprawna. Numer wiersza %d."
1461
 
1462
- #: classes/shipping-method.php:439
1463
  #, php-format
1464
  msgid "Additional cost value %s is not valid number. Row number %d."
1465
  msgstr "Wartość Dodatkowy koszt %s jest niepoprawna. Numer wiersza %d."
1466
 
1467
- #: classes/shipping-method.php:445
1468
  #, php-format
1469
  msgid "Value value %s is not valid number. Row number %d."
1470
  msgstr "Wartość w polu Wartość %s jest niepoprawna. Numer wiersza %d."
1471
 
1472
- #: classes/shipping-method.php:497
1473
  #, php-format
1474
  msgid "Shipping method %s imported as %s."
1475
  msgstr "Metoda wysyłki %s została zaimportowana jako %s."
1476
 
1477
- #: classes/shipping-method.php:557
1478
  msgid "New Shipping Method"
1479
  msgstr "Nowa metoda wysyłki"
1480
 
1481
- #: classes/shipping-method.php:560
1482
  msgid "Edit Shipping Method"
1483
  msgstr "Edytuj metodę wysyłki"
1484
 
1485
- #: classes/shipping-method.php:570 classes/shipping-method.php:612
1486
  #, php-format
1487
  msgid "Shipping method %s added."
1488
  msgstr "Metoda wysyłki dodana: %s."
1489
 
1490
- #: classes/shipping-method.php:595
1491
  #, php-format
1492
  msgid "Shipping method %s deleted."
1493
  msgstr "Metoda wysyłki usunięta: %s."
1494
 
1495
- #: classes/shipping-method.php:598
1496
  msgid "Shipping method not found."
1497
  msgstr "Metoda wysyłki nie znaleziona."
1498
 
1499
- #: classes/shipping-method.php:624
1500
  #, php-format
1501
  msgid "Shipping method %s updated."
1502
  msgstr "Metoda wysyłki zaktualizowana: %s."
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Flexible Shipping\n"
4
+ "POT-Creation-Date: 2019-01-23 13:21+0100\n"
5
+ "PO-Revision-Date: 2019-01-23 13:42+0100\n"
6
  "Last-Translator: Piotr Jabłonowski <piotr.jablonowski@wpdesk.net>\n"
7
  "Language-Team: Maciej Swoboda <maciej.swoboda@gmail.com>\n"
8
  "Language: pl_PL\n"
175
  msgid "Bulk shipping manifest - processed orders: %d"
176
  msgstr "Zbiorcze tworzenie protokołów nadania - przetworzone zamówienia: %d"
177
 
178
+ #: classes/class-flexible-shipping-plugin.php:372
179
  msgid "Settings"
180
  msgstr "Ustawienia"
181
 
182
+ #: classes/class-flexible-shipping-plugin.php:374
183
  msgid "Docs"
184
  msgstr "Docs"
185
 
186
+ #: classes/class-flexible-shipping-plugin.php:375
187
  msgid "Support"
188
  msgstr "Wsparcie"
189
 
190
+ #: classes/class-flexible-shipping-plugin.php:381
191
  msgid "Upgrade"
192
  msgstr "Kup PRO"
193
 
497
  msgid "%1$s (fallback)"
498
  msgstr "%1$s (stawka awaryjna)"
499
 
500
+ #: classes/saas/class-saas-live-rates-handler.php:437
501
+ #, php-format
502
+ msgid "Flexible Shipping Fallback (%1$s): %2$s"
503
+ msgstr "Stawka awaryjna Flexible Shipping (%1$s): %2$s"
504
+
505
+ #: classes/saas/class-saas-live-rates-handler.php:490
506
  #, php-format
507
+ msgid "Invalid live rates response! Error code: %1$s"
508
+ msgstr "Nieprawidłowa odpowiedź dla stawek live! Kod błędu: %1$s"
509
+
510
+ #: classes/saas/class-saas-live-rates-handler.php:509
511
+ #, php-format
512
+ msgid "Live rates response exception %1$s; %2$s occurred while sending request"
513
+ msgstr ""
514
+ "Zwrócony komunikat błędu dla stawek live: %1$s. Kod błędu dla przesłanego "
515
+ "żądania: %2$s"
516
 
517
  #: classes/saas/class-saas-new-courier-settings-section.php:47
518
  #, php-format
519
  msgid "Do not you see your courier? %1$sCheck planned integrations →%2$s"
520
+ msgstr "Nie widzisz swojego kuriera? %1$sSprawdź planowane integracje →%2$s"
521
 
522
  #: classes/saas/class-saas-settings-service-checkbox.php:78
523
  msgid "Invalid requireWordpressPluginVersion capability!"
946
  msgid "Free shipping"
947
  msgstr "Darmowa wysyłka"
948
 
949
+ #: classes/saas/views/html-order-message-stock.php:1
950
+ msgid "Additional info:"
951
+ msgstr "Dodatkowe informacje:"
952
+
953
  #: classes/saas/views/html-registration-page.php:4
954
  #, php-format
955
  msgid ""
1114
  "Wysyłaj zamówienia szybciej z %1$sFlexible Shipping Connect%2$s%3$s"
1115
  "%4$sZarejestruj się teraz!%5$s"
1116
 
1117
+ #: classes/settings/shipping-method-form.php:54 classes/shipping-method.php:912
1118
  msgid "Free"
1119
  msgstr "Bezpłatnie"
1120
 
1386
  msgid "%1$s Shipment %2$s was canceled."
1387
  msgstr "%1$s Przesyłka %2$s została anulowana."
1388
 
1389
+ #: classes/shipment/saas/class-shipment-saas.php:586
1390
  msgid "Label is not avaliable for this shipment."
1391
  msgstr "Etykieta nie jest dostępna dla tej przesyłki."
1392
 
1429
  msgid "Add New"
1430
  msgstr "Dodaj nową"
1431
 
1432
+ #: classes/shipping-method.php:354
1433
  msgid ""
1434
  "Sorry, there has been an error. The CSV is invalid or incorrect file type."
1435
  msgstr ""
1436
  "Przepraszamy, wystąpił błąd. Plik CSV jest niepoprawny lub typ pliku jest "
1437
  "nieprawidłowy."
1438
 
1439
+ #: classes/shipping-method.php:364 classes/shipping-method.php:367
1440
  msgid "import"
1441
  msgstr "import"
1442
 
1443
+ #: classes/shipping-method.php:376
1444
  #, php-format
1445
  msgid "Free Shipping value %s is not valid number. Row number %d."
1446
  msgstr "Wartość darmowej wysyłki %s jest niepoprawna. Numer wiersza %d."
1447
 
1448
+ #: classes/shipping-method.php:382
1449
  #, php-format
1450
  msgid "Maximum Cost value %s is not valid number. Row number %d."
1451
  msgstr "Maksymalny koszt %s jest niepoprawny. Numer wiersza %d."
1452
 
1453
+ #: classes/shipping-method.php:393
1454
  #, php-format
1455
  msgid "Invalid value for Calculation Method in row number %d."
1456
  msgstr "Nieprawidłowa wartość dla Metody obliczania w wierszu %d."
1457
 
1458
+ #: classes/shipping-method.php:417
1459
  #, php-format
1460
  msgid "Invalid value for Based On in row number %d."
1461
  msgstr "Nieprawidłowa wartość dla Oparte na w wierszu %d."
1462
 
1463
+ #: classes/shipping-method.php:422
1464
  #, php-format
1465
  msgid "Min value %s is not valid number. Row number %d."
1466
  msgstr "Wartość Min %s jest niepoprawna. Numer wiersza %d."
1467
 
1468
+ #: classes/shipping-method.php:428
1469
  #, php-format
1470
  msgid "Max value %s is not valid number. Row number %d."
1471
  msgstr "Wartość Maks %s jest niepoprawna. Numer wiersza %d."
1472
 
1473
+ #: classes/shipping-method.php:434
1474
  #, php-format
1475
  msgid "Cost per order value %s is not valid number. Row number %d."
1476
  msgstr "Wartość Koszt na zamówienie %s jest niepoprawna. Numer wiersza %d."
1477
 
1478
+ #: classes/shipping-method.php:440
1479
  #, php-format
1480
  msgid "Additional cost value %s is not valid number. Row number %d."
1481
  msgstr "Wartość Dodatkowy koszt %s jest niepoprawna. Numer wiersza %d."
1482
 
1483
+ #: classes/shipping-method.php:446
1484
  #, php-format
1485
  msgid "Value value %s is not valid number. Row number %d."
1486
  msgstr "Wartość w polu Wartość %s jest niepoprawna. Numer wiersza %d."
1487
 
1488
+ #: classes/shipping-method.php:498
1489
  #, php-format
1490
  msgid "Shipping method %s imported as %s."
1491
  msgstr "Metoda wysyłki %s została zaimportowana jako %s."
1492
 
1493
+ #: classes/shipping-method.php:558
1494
  msgid "New Shipping Method"
1495
  msgstr "Nowa metoda wysyłki"
1496
 
1497
+ #: classes/shipping-method.php:561
1498
  msgid "Edit Shipping Method"
1499
  msgstr "Edytuj metodę wysyłki"
1500
 
1501
+ #: classes/shipping-method.php:571 classes/shipping-method.php:613
1502
  #, php-format
1503
  msgid "Shipping method %s added."
1504
  msgstr "Metoda wysyłki dodana: %s."
1505
 
1506
+ #: classes/shipping-method.php:596
1507
  #, php-format
1508
  msgid "Shipping method %s deleted."
1509
  msgstr "Metoda wysyłki usunięta: %s."
1510
 
1511
+ #: classes/shipping-method.php:599
1512
  msgid "Shipping method not found."
1513
  msgstr "Metoda wysyłki nie znaleziona."
1514
 
1515
+ #: classes/shipping-method.php:625
1516
  #, php-format
1517
  msgid "Shipping method %s updated."
1518
  msgstr "Metoda wysyłki zaktualizowana: %s."
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flexibleshipping.com/table-rate/
4
  Tags: table rate, table rate shipping, 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
5
  Requires at least: 4.5
6
  Tested up to: 5.0.3
7
- Stable tag: 3.1.2
8
  Requires PHP: 5.6
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -175,6 +175,10 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
175
 
176
  == Changelog ==
177
 
 
 
 
 
178
  = 3.1.2 - 2019-01-16 =
179
  * Fixed adding slashes to title and description
180
  * Fixed error on saving integration settings when no service settings are saved
4
  Tags: table rate, table rate shipping, 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
5
  Requires at least: 4.5
6
  Tested up to: 5.0.3
7
+ Stable tag: 3.1.3
8
  Requires PHP: 5.6
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
175
 
176
  == Changelog ==
177
 
178
+ = 3.1.3 - 2019-01-23 =
179
+ * Tweaked pl translation
180
+ * Fixed issues on shipment creating by FS Connect
181
+
182
  = 3.1.2 - 2019-01-16 =
183
  * Fixed adding slashes to title and description
184
  * Fixed error on saving integration settings when no service settings are saved
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit428ecf70a1171d5a5a3058732fc177d4::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit0422d0a45db0447df1ec8c80007f920c::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit428ecf70a1171d5a5a3058732fc177d4
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit428ecf70a1171d5a5a3058732fc177d4
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit428ecf70a1171d5a5a3058732fc177d4', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit428ecf70a1171d5a5a3058732fc177d4', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInit428ecf70a1171d5a5a3058732fc177d4::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit428ecf70a1171d5a5a3058732fc177d4
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInit428ecf70a1171d5a5a3058732fc177d4::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequire428ecf70a1171d5a5a3058732fc177d4($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequire428ecf70a1171d5a5a3058732fc177d4($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit0422d0a45db0447df1ec8c80007f920c
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit0422d0a45db0447df1ec8c80007f920c', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit0422d0a45db0447df1ec8c80007f920c', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit0422d0a45db0447df1ec8c80007f920c::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit0422d0a45db0447df1ec8c80007f920c::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire0422d0a45db0447df1ec8c80007f920c($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire0422d0a45db0447df1ec8c80007f920c($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit428ecf70a1171d5a5a3058732fc177d4
8
  {
9
  public static $files = array (
10
  '46ae4ad8c3479aabff48f598a0e4b93f' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/functions.php',
@@ -598,9 +598,9 @@ class ComposerStaticInit428ecf70a1171d5a5a3058732fc177d4
598
  public static function getInitializer(ClassLoader $loader)
599
  {
600
  return \Closure::bind(function () use ($loader) {
601
- $loader->prefixLengthsPsr4 = ComposerStaticInit428ecf70a1171d5a5a3058732fc177d4::$prefixLengthsPsr4;
602
- $loader->prefixDirsPsr4 = ComposerStaticInit428ecf70a1171d5a5a3058732fc177d4::$prefixDirsPsr4;
603
- $loader->classMap = ComposerStaticInit428ecf70a1171d5a5a3058732fc177d4::$classMap;
604
 
605
  }, null, ClassLoader::class);
606
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit0422d0a45db0447df1ec8c80007f920c
8
  {
9
  public static $files = array (
10
  '46ae4ad8c3479aabff48f598a0e4b93f' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/functions.php',
598
  public static function getInitializer(ClassLoader $loader)
599
  {
600
  return \Closure::bind(function () use ($loader) {
601
+ $loader->prefixLengthsPsr4 = ComposerStaticInit0422d0a45db0447df1ec8c80007f920c::$prefixLengthsPsr4;
602
+ $loader->prefixDirsPsr4 = ComposerStaticInit0422d0a45db0447df1ec8c80007f920c::$prefixDirsPsr4;
603
+ $loader->classMap = ComposerStaticInit0422d0a45db0447df1ec8c80007f920c::$classMap;
604
 
605
  }, null, ClassLoader::class);
606
  }
vendor/composer/installed.json CHANGED
@@ -505,17 +505,17 @@
505
  },
506
  {
507
  "name": "wpdesk/wp-logs",
508
- "version": "1.3.0",
509
- "version_normalized": "1.3.0.0",
510
  "source": {
511
  "type": "git",
512
  "url": "https://gitlab.com/wpdesk/wp-logs.git",
513
- "reference": "1cb5b1b1e23b4b30bc4668aafd916c89a2aa0d8b"
514
  },
515
  "dist": {
516
  "type": "zip",
517
- "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-logs/repository/archive.zip?sha=1cb5b1b1e23b4b30bc4668aafd916c89a2aa0d8b",
518
- "reference": "1cb5b1b1e23b4b30bc4668aafd916c89a2aa0d8b",
519
  "shasum": ""
520
  },
521
  "require": {
@@ -524,13 +524,12 @@
524
  "psr/log": "^1.0.1"
525
  },
526
  "require-dev": {
527
- "10up/wp_mock": "^0.3",
528
- "phpunit/phpunit": "^6",
529
  "squizlabs/php_codesniffer": "^3.0.2",
530
  "wimg/php-compatibility": "^8",
531
  "wp-coding-standards/wpcs": "^0.14.1"
532
  },
533
- "time": "2018-10-30T14:45:49+00:00",
534
  "type": "library",
535
  "installation-source": "dist",
536
  "autoload": {
@@ -663,17 +662,17 @@
663
  },
664
  {
665
  "name": "wpdesk/wp-saas-platform-client",
666
- "version": "1.7.0",
667
- "version_normalized": "1.7.0.0",
668
  "source": {
669
  "type": "git",
670
  "url": "https://gitlab.com/wpdesk/wp-saas-platform-client.git",
671
- "reference": "a47f19cbc641eed35d4a6800a582bc0bd25b304d"
672
  },
673
  "dist": {
674
  "type": "zip",
675
- "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-saas-platform-client/repository/archive.zip?sha=a47f19cbc641eed35d4a6800a582bc0bd25b304d",
676
- "reference": "a47f19cbc641eed35d4a6800a582bc0bd25b304d",
677
  "shasum": ""
678
  },
679
  "require": {
@@ -690,7 +689,7 @@
690
  "squizlabs/php_codesniffer": "^3.0.2",
691
  "wp-coding-standards/wpcs": "^0.14.1"
692
  },
693
- "time": "2019-01-16T11:36:14+00:00",
694
  "type": "library",
695
  "installation-source": "dist",
696
  "autoload": {
505
  },
506
  {
507
  "name": "wpdesk/wp-logs",
508
+ "version": "1.4.0",
509
+ "version_normalized": "1.4.0.0",
510
  "source": {
511
  "type": "git",
512
  "url": "https://gitlab.com/wpdesk/wp-logs.git",
513
+ "reference": "0eaf62bfa73d6b773089c948cf5926360b4d3949"
514
  },
515
  "dist": {
516
  "type": "zip",
517
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-logs/repository/archive.zip?sha=0eaf62bfa73d6b773089c948cf5926360b4d3949",
518
+ "reference": "0eaf62bfa73d6b773089c948cf5926360b4d3949",
519
  "shasum": ""
520
  },
521
  "require": {
524
  "psr/log": "^1.0.1"
525
  },
526
  "require-dev": {
527
+ "phpunit/phpunit": "^5",
 
528
  "squizlabs/php_codesniffer": "^3.0.2",
529
  "wimg/php-compatibility": "^8",
530
  "wp-coding-standards/wpcs": "^0.14.1"
531
  },
532
+ "time": "2019-01-21T15:12:41+00:00",
533
  "type": "library",
534
  "installation-source": "dist",
535
  "autoload": {
662
  },
663
  {
664
  "name": "wpdesk/wp-saas-platform-client",
665
+ "version": "1.7.1",
666
+ "version_normalized": "1.7.1.0",
667
  "source": {
668
  "type": "git",
669
  "url": "https://gitlab.com/wpdesk/wp-saas-platform-client.git",
670
+ "reference": "a8c84aaf8e6d67ca9592cbc51bc9263136063a9a"
671
  },
672
  "dist": {
673
  "type": "zip",
674
+ "url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-saas-platform-client/repository/archive.zip?sha=a8c84aaf8e6d67ca9592cbc51bc9263136063a9a",
675
+ "reference": "a8c84aaf8e6d67ca9592cbc51bc9263136063a9a",
676
  "shasum": ""
677
  },
678
  "require": {
689
  "squizlabs/php_codesniffer": "^3.0.2",
690
  "wp-coding-standards/wpcs": "^0.14.1"
691
  },
692
+ "time": "2019-01-23T08:28:21+00:00",
693
  "type": "library",
694
  "installation-source": "dist",
695
  "autoload": {
vendor/wpdesk/wp-logs/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- /vendor/
2
- .idea
3
- composer.lock
4
- build-coverage
5
- docker-compose.yml
 
 
 
 
 
vendor/wpdesk/wp-logs/.gitlab-ci.yml DELETED
@@ -1,86 +0,0 @@
1
- variables:
2
- PHP_ERROR_REPORTING: E_ALL
3
- COMPOSER_ALLOW_SUPERUSER: 1
4
- GIT_STRATEGY: fetch
5
- MYSQL_ROOT_PASSWORD: mysql
6
- MYSQL_DATABASE: wptest
7
- MYSQL_USER: mysql
8
- MYSQL_PASSWORD: mysql
9
- MYSQL_INNODB_LOG_BUFFER_SIZE: 32M
10
- PHP_ERROR_REPORTING: E_ALL
11
- COMPOSER_ALLOW_SUPERUSER: 1
12
- GIT_STRATEGY: fetch
13
-
14
-
15
- stages:
16
- - tools
17
- - tests
18
-
19
- .template: &job-test-template
20
- stage: tests
21
- coverage: '/^\s*Lines:\s*\d+.\d+\%/'
22
-
23
- .template: &job-test-unit-template
24
- <<: *job-test-template
25
- script:
26
- - echo ${WPDESK_CI_VERSION}
27
- - ls -l
28
- - php --version
29
- - cat /tmp/wordpress-develop/src/wp-includes/version.php
30
- - cat /tmp/woocommerce/woocommerce.php
31
- - composer update --no-progress
32
- - vendor/bin/phpunit --configuration phpunit-unit.xml --coverage-text --colors=never
33
-
34
- .template: &job-test-integration-template
35
- <<: *job-test-template
36
- services:
37
- - mysql:5.6
38
- script:
39
- - echo ${WPDESK_CI_VERSION}
40
- - ls -l
41
- - php --version
42
- - cat /tmp/wordpress-develop/src/wp-includes/version.php
43
- - cat /tmp/woocommerce/woocommerce.php
44
- - composer update --no-progress
45
- - if [[ -f tests/integration/prepare.sh ]]; then sh tests/integration/prepare.sh; fi
46
- - vendor/bin/phpunit --configuration phpunit-integration.xml --coverage-text --colors=never
47
-
48
-
49
- before_script:
50
- - cd ${CI_PROJECT_DIR}
51
-
52
- phpmetric metrics:
53
- stage: tools
54
- image: wpdesknet/phpunit-woocommerce:0-0
55
- allow_failure: true
56
- when: manual
57
- artifacts:
58
- when: always
59
- expire_in: 1 month
60
- name: "metrics"
61
- paths:
62
- - ${CI_PROJECT_DIR}/phpmetric
63
- script:
64
- - echo ${WPDESK_CI_VERSION}
65
- - composer require phpmetrics/phpmetrics
66
- - composer update --no-progress
67
- - php ./vendor/bin/phpmetrics --report-html=phpmetric .
68
-
69
- churn metrics:
70
- stage: tools
71
- image: wpdesknet/phpunit-woocommerce:0-0
72
- allow_failure: true
73
- when: manual
74
- script:
75
- - echo ${WPDESK_CI_VERSION}
76
- - composer require bmitch/churn-php
77
- - composer update --no-progress
78
- - vendor/bin/churn run classes inc
79
-
80
- #unit test lastest:
81
- # <<: *job-test-unit-template
82
- # image: wpdesknet/phpunit-woocommerce:0-0
83
-
84
- integration test lastest:
85
- <<: *job-test-integration-template
86
- image: wpdesknet/phpunit-woocommerce:0-0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/wpdesk/wp-logs/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
 
 
 
 
 
1
  ## [1.3.1] - 2018-10-30
2
  ### Changed
3
- - changed
4
 
5
  ## [1.2.0] - 2018-10-29
6
  ### Changed
1
+ ## [1.4.0] - 2019-01-21
2
+ ### Changed
3
+ - WC integration now considers broken WC_Logger implementation
4
+ - Does not capture WC logger in WC < 3.5
5
+
6
  ## [1.3.1] - 2018-10-30
7
  ### Changed
8
+ - setDisableLog changes to disableLog
9
 
10
  ## [1.2.0] - 2018-10-29
11
  ### Changed
vendor/wpdesk/wp-logs/composer.json CHANGED
@@ -12,10 +12,9 @@
12
  "monolog/monolog": "^1.23"
13
  },
14
  "require-dev": {
15
- "phpunit/phpunit": "^6",
16
  "wp-coding-standards/wpcs": "^0.14.1",
17
  "squizlabs/php_codesniffer": "^3.0.2",
18
- "10up/wp_mock": "^0.3",
19
  "wimg/php-compatibility": "^8"
20
  },
21
  "autoload": {
12
  "monolog/monolog": "^1.23"
13
  },
14
  "require-dev": {
15
+ "phpunit/phpunit": "^5",
16
  "wp-coding-standards/wpcs": "^0.14.1",
17
  "squizlabs/php_codesniffer": "^3.0.2",
 
18
  "wimg/php-compatibility": "^8"
19
  },
20
  "autoload": {
vendor/wpdesk/wp-logs/phpunit-integration.xml DELETED
@@ -1,32 +0,0 @@
1
- <phpunit bootstrap="tests/integration/bootstrap.php"
2
- backupGlobals="false"
3
- convertErrorsToExceptions="true"
4
- convertNoticesToExceptions="true"
5
- convertWarningsToExceptions="true"
6
- strict="true"
7
- >
8
- <testsuites>
9
- <testsuite>
10
- <directory prefix="Test" suffix=".php">./tests/integration</directory>
11
- </testsuite>
12
- </testsuites>
13
-
14
- <filter>
15
- <whitelist>
16
- <directory suffix=".php">./src</directory>
17
- </whitelist>
18
- </filter>
19
-
20
- <logging>
21
- <log type="junit" target="build-coverage/report.junit.xml"/>
22
- <log type="coverage-html" target="build-coverage/coverage" charset="UTF-8" yui="true" highlight="true"/>
23
- <log type="coverage-text" target="build-coverage/coverage.txt"/>
24
- <log type="coverage-clover" target="build-coverage/clover.xml"/>
25
- </logging>
26
-
27
- <php>
28
- <env name="WP_DEVELOP_DIR" value="/tmp/wordpress-develop"/>
29
- <env name="WC_DEVELOP_DIR" value="/tmp/woocommerce"/>
30
- </php>
31
-
32
- </phpunit>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/wpdesk/wp-logs/phpunit-unit.xml DELETED
@@ -1,21 +0,0 @@
1
- <phpunit bootstrap="tests/unit/bootstrap.php">
2
- <testsuites>
3
- <testsuite>
4
- <directory prefix="Test" suffix=".php">./tests/unit/</directory>
5
- </testsuite>
6
- </testsuites>
7
-
8
- <filter>
9
- <whitelist>
10
- <directory suffix=".php">src</directory>
11
- </whitelist>
12
- </filter>
13
-
14
- <logging>
15
- <log type="junit" target="build-coverage/report.junit.xml"/>
16
- <log type="coverage-html" target="build-coverage/coverage" charset="UTF-8" yui="true" highlight="true"/>
17
- <log type="coverage-text" target="build-coverage/coverage.txt"/>
18
- <log type="coverage-clover" target="build-coverage/clover.xml"/>
19
- </logging>
20
-
21
- </phpunit>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/wpdesk/wp-logs/src/WC/WooCommerceCapture.php CHANGED
@@ -15,6 +15,9 @@ class WooCommerceCapture
15
  const WOOCOMMERCE_LOGGER_FILTER = 'woocommerce_logging_class';
16
  const WOOCOMMERCE_AFTER_IS_LOADED_ACTION = 'woocommerce_loaded';
17
 
 
 
 
18
  /**
19
  * Is logger filter captured by library.
20
  *
@@ -65,34 +68,49 @@ class WooCommerceCapture
65
 
66
  if ($this->captureHookFunction === null) {
67
  $this->captureHookFunction = function () use ($monolog) {
68
- return new WooCommerceMonologPlugin($monolog);
69
  };
70
  $this->monolog->pushHandler(new WooCommerceHandler($this->originalWCLogger));
71
  }
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
74
  /**
75
  * Capture WooCommerce logger and inject our decorated Logger
76
  */
77
  public function captureWcLogger()
78
  {
79
- if ($this->isCaptured) {
80
- throw new WCLoggerAlreadyCaptured('Try to free wc logger first.');
81
- }
82
-
83
- if ($this->isWooCommerceLoggerAvailable()) {
84
- $this->prepareFreeHookCallable();
85
- $this->prepareCaptureHookCallable();
86
-
87
- remove_filter(self::WOOCOMMERCE_LOGGER_FILTER, $this->freeHookFunction);
88
- add_filter(self::WOOCOMMERCE_LOGGER_FILTER, $this->captureHookFunction);
89
-
90
- $this->isCaptured = true;
91
- } elseif (function_exists('add_action')) {
92
- add_action(self::WOOCOMMERCE_AFTER_IS_LOADED_ACTION, [$this, 'captureWcLogger']);
 
 
 
 
93
  } else {
94
- $this->monolog->alert('Cannot capture WC - WordPress is not available.');
95
  }
 
96
  }
97
 
98
  /**
15
  const WOOCOMMERCE_LOGGER_FILTER = 'woocommerce_logging_class';
16
  const WOOCOMMERCE_AFTER_IS_LOADED_ACTION = 'woocommerce_loaded';
17
 
18
+ /** @var string Minimal version of WooCommerce supported by logger capture */
19
+ const SUPPORTED_WC_VERSION = '3.5.0';
20
+
21
  /**
22
  * Is logger filter captured by library.
23
  *
68
 
69
  if ($this->captureHookFunction === null) {
70
  $this->captureHookFunction = function () use ($monolog) {
71
+ return new WooCommerceMonologPlugin($monolog, $this->originalWCLogger);
72
  };
73
  $this->monolog->pushHandler(new WooCommerceHandler($this->originalWCLogger));
74
  }
75
  }
76
 
77
+ /**
78
+ * Is this version of WooCommerce is supported by logger capture
79
+ *
80
+ * @return bool
81
+ */
82
+ public static function isSupportedWCVersion()
83
+ {
84
+ return version_compare(\WooCommerce::instance()->version, self::SUPPORTED_WC_VERSION, '>=');
85
+ }
86
+
87
  /**
88
  * Capture WooCommerce logger and inject our decorated Logger
89
  */
90
  public function captureWcLogger()
91
  {
92
+ if (self::isSupportedWCVersion()) {
93
+ if ($this->isCaptured) {
94
+ throw new WCLoggerAlreadyCaptured('Try to free wc logger first.');
95
+ }
96
+
97
+ if ($this->isWooCommerceLoggerAvailable()) {
98
+ $this->prepareFreeHookCallable();
99
+ $this->prepareCaptureHookCallable();
100
+
101
+ remove_filter(self::WOOCOMMERCE_LOGGER_FILTER, $this->freeHookFunction);
102
+ add_filter(self::WOOCOMMERCE_LOGGER_FILTER, $this->captureHookFunction);
103
+
104
+ $this->isCaptured = true;
105
+ } elseif (function_exists('add_action')) {
106
+ add_action(self::WOOCOMMERCE_AFTER_IS_LOADED_ACTION, [$this, 'captureWcLogger']);
107
+ } else {
108
+ $this->monolog->alert('Cannot capture WC - WordPress is not available.');
109
+ }
110
  } else {
111
+ $this->monolog->alert('Cannot capture WC - WooCommerce version is not supported.');
112
  }
113
+
114
  }
115
 
116
  /**
vendor/wpdesk/wp-logs/src/WC/WooCommerceMonologPlugin.php CHANGED
@@ -12,14 +12,38 @@ use WC_Log_Levels;
12
  *
13
  * @package WPDesk\Logger
14
  */
15
- class WooCommerceMonologPlugin implements \WC_Logger_Interface {
 
16
 
17
- /** @var Logger */
18
- private $monolog;
19
 
20
- public function __construct( Logger $monolog ) {
21
- $this->monolog = $monolog;
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  /**
25
  * Method for compatibility reason. Do not use.
@@ -31,127 +55,129 @@ class WooCommerceMonologPlugin implements \WC_Logger_Interface {
31
  *
32
  * @deprecated
33
  */
34
- public function add( $handle, $message, $level = WC_Log_Levels::NOTICE ) {
35
- $this->log($message, $level);
36
- }
37
-
38
- /**
39
- * System is unusable.
40
- *
41
- * @param string $message
42
- * @param array $context
43
- *
44
- * @return void
45
- */
46
- public function emergency($message, $context = array())
47
- {
48
- $this->log(LogLevel::EMERGENCY, $message, $context);
49
- }
50
-
51
- public function log( $level, $message, $context = [] ) {
52
- $this->monolog->log($level, $message, $context);
53
- }
54
-
55
- /**
56
- * Action must be taken immediately.
57
- *
58
- * Example: Entire website down, database unavailable, etc. This should
59
- * trigger the SMS alerts and wake you up.
60
- *
61
- * @param string $message
62
- * @param array $context
63
- *
64
- * @return void
65
- */
66
- public function alert($message, $context = array())
67
- {
68
- $this->log(LogLevel::ALERT, $message, $context);
69
- }
70
-
71
- /**
72
- * Critical conditions.
73
- *
74
- * Example: Application component unavailable, unexpected exception.
75
- *
76
- * @param string $message
77
- * @param array $context
78
- *
79
- * @return void
80
- */
81
- public function critical($message, $context = array())
82
- {
83
- $this->log(LogLevel::CRITICAL, $message, $context);
84
- }
85
-
86
- /**
87
- * Runtime errors that do not require immediate action but should typically
88
- * be logged and monitored.
89
- *
90
- * @param string $message
91
- * @param array $context
92
- *
93
- * @return void
94
- */
95
- public function error($message, $context = array())
96
- {
97
- $this->log(LogLevel::ERROR, $message, $context);
98
- }
99
-
100
- /**
101
- * Exceptional occurrences that are not errors.
102
- *
103
- * Example: Use of deprecated APIs, poor use of an API, undesirable things
104
- * that are not necessarily wrong.
105
- *
106
- * @param string $message
107
- * @param array $context
108
- *
109
- * @return void
110
- */
111
- public function warning($message, $context = array())
112
- {
113
- $this->log(LogLevel::WARNING, $message, $context);
114
- }
115
-
116
- /**
117
- * Normal but significant events.
118
- *
119
- * @param string $message
120
- * @param array $context
121
- *
122
- * @return void
123
- */
124
- public function notice($message, $context = array())
125
- {
126
- $this->log(LogLevel::NOTICE, $message, $context);
127
- }
128
-
129
- /**
130
- * Interesting events.
131
- *
132
- * Example: User logs in, SQL logs.
133
- *
134
- * @param string $message
135
- * @param array $context
136
- *
137
- * @return void
138
- */
139
- public function info($message, $context = array())
140
- {
141
- $this->log(LogLevel::INFO, $message, $context);
142
- }
143
-
144
- /**
145
- * Detailed debug information.
146
- *
147
- * @param string $message
148
- * @param array $context
149
- *
150
- * @return void
151
- */
152
- public function debug($message, $context = array())
153
- {
154
- $this->log(LogLevel::DEBUG, $message, $context);
155
- }
 
 
156
 
157
  }
12
  *
13
  * @package WPDesk\Logger
14
  */
15
+ class WooCommerceMonologPlugin implements \WC_Logger_Interface
16
+ {
17
 
18
+ /** @var Logger */
19
+ private $monolog;
20
 
21
+ /** @var \WC_Logger */
22
+ private $originalWCLogger;
23
+
24
+ public function __construct(Logger $monolog, \WC_Logger $originalLogger)
25
+ {
26
+ $this->monolog = $monolog;
27
+ $this->originalWCLogger = $originalLogger;
28
+ }
29
+
30
+ /**
31
+ * Method added for compatibility with \WC_Logger
32
+ *
33
+ * @param string $source
34
+ */
35
+ public function clear($source = '')
36
+ {
37
+ $this->originalWCLogger->clear($source);
38
+ }
39
+
40
+ /**
41
+ * Method added for compatibility with \WC_Logger
42
+ */
43
+ public function clear_expired_logs()
44
+ {
45
+ $this->originalWCLogger->clear_expired_logs();
46
+ }
47
 
48
  /**
49
  * Method for compatibility reason. Do not use.
55
  *
56
  * @deprecated
57
  */
58
+ public function add($handle, $message, $level = WC_Log_Levels::NOTICE)
59
+ {
60
+ $this->log($message, $level);
61
+ }
62
+
63
+ /**
64
+ * System is unusable.
65
+ *
66
+ * @param string $message
67
+ * @param array $context
68
+ *
69
+ * @return void
70
+ */
71
+ public function emergency($message, $context = array())
72
+ {
73
+ $this->log(LogLevel::EMERGENCY, $message, $context);
74
+ }
75
+
76
+ public function log($level, $message, $context = [])
77
+ {
78
+ $this->monolog->log($level, $message, $context);
79
+ }
80
+
81
+ /**
82
+ * Action must be taken immediately.
83
+ *
84
+ * Example: Entire website down, database unavailable, etc. This should
85
+ * trigger the SMS alerts and wake you up.
86
+ *
87
+ * @param string $message
88
+ * @param array $context
89
+ *
90
+ * @return void
91
+ */
92
+ public function alert($message, $context = array())
93
+ {
94
+ $this->log(LogLevel::ALERT, $message, $context);
95
+ }
96
+
97
+ /**
98
+ * Critical conditions.
99
+ *
100
+ * Example: Application component unavailable, unexpected exception.
101
+ *
102
+ * @param string $message
103
+ * @param array $context
104
+ *
105
+ * @return void
106
+ */
107
+ public function critical($message, $context = array())
108
+ {
109
+ $this->log(LogLevel::CRITICAL, $message, $context);
110
+ }
111
+
112
+ /**
113
+ * Runtime errors that do not require immediate action but should typically
114
+ * be logged and monitored.
115
+ *
116
+ * @param string $message
117
+ * @param array $context
118
+ *
119
+ * @return void
120
+ */
121
+ public function error($message, $context = array())
122
+ {
123
+ $this->log(LogLevel::ERROR, $message, $context);
124
+ }
125
+
126
+ /**
127
+ * Exceptional occurrences that are not errors.
128
+ *
129
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things
130
+ * that are not necessarily wrong.
131
+ *
132
+ * @param string $message
133
+ * @param array $context
134
+ *
135
+ * @return void
136
+ */
137
+ public function warning($message, $context = array())
138
+ {
139
+ $this->log(LogLevel::WARNING, $message, $context);
140
+ }
141
+
142
+ /**
143
+ * Normal but significant events.
144
+ *
145
+ * @param string $message
146
+ * @param array $context
147
+ *
148
+ * @return void
149
+ */
150
+ public function notice($message, $context = array())
151
+ {
152
+ $this->log(LogLevel::NOTICE, $message, $context);
153
+ }
154
+
155
+ /**
156
+ * Interesting events.
157
+ *
158
+ * Example: User logs in, SQL logs.
159
+ *
160
+ * @param string $message
161
+ * @param array $context
162
+ *
163
+ * @return void
164
+ */
165
+ public function info($message, $context = array())
166
+ {
167
+ $this->log(LogLevel::INFO, $message, $context);
168
+ }
169
+
170
+ /**
171
+ * Detailed debug information.
172
+ *
173
+ * @param string $message
174
+ * @param array $context
175
+ *
176
+ * @return void
177
+ */
178
+ public function debug($message, $context = array())
179
+ {
180
+ $this->log(LogLevel::DEBUG, $message, $context);
181
+ }
182
 
183
  }
vendor/wpdesk/wp-logs/tests/integration/TestBasicLoggerFactory.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
-
3
- use Monolog\Logger;
4
- use WPDesk\Logger\BasicLoggerFactory;
5
-
6
- class TestBasicLoggerFactory extends WP_UnitTestCase {
7
-
8
- const LOGGER_NAME = 'test-channel';
9
-
10
- public function testCanCreateLogger() {
11
- $factory = new BasicLoggerFactory();
12
- $logger = $factory->createLogger(self::LOGGER_NAME);
13
- $this->assertInstanceOf(Logger::class, $logger, "Logger should be created");
14
- }
15
-
16
- public function testCanReturnLoggerFromRegistry() {
17
- $factory = new BasicLoggerFactory();
18
- $logger1 = $factory->createLogger(self::LOGGER_NAME);
19
- $logger2 = $factory->createLogger(self::LOGGER_NAME);
20
- $logger3 = $factory->getLogger();
21
-
22
- $this->assertSame($logger1, $logger2, "Should return the same loggers");
23
- $this->assertSame($logger2, $logger3, "Should return the same loggers");
24
-
25
- $otherLogger = $factory->createLogger('other-name');
26
- $this->assertNotSame($logger1, $otherLogger, "Should return different loggers");
27
- }
28
- }
29
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/wpdesk/wp-logs/tests/integration/TestLoggerFacade.php DELETED
@@ -1,62 +0,0 @@
1
- <?php
2
-
3
- use Monolog\Handler\AbstractHandler;
4
- use WPDesk\Logger\LoggerFacade;
5
- use WPDesk\Logger\WPDeskLoggerFactory;
6
-
7
- class TestLoggerFacade extends WP_UnitTestCase {
8
- public function tearDown()
9
- {
10
- parent::tearDown();
11
- WPDeskLoggerFactory::tearDown();
12
- }
13
-
14
- public function testCanCreateLogger() {
15
- $logger = LoggerFacade::getLogger();
16
- $this->assertSame($logger, LoggerFacade::get_logger(), "Should return same logger instance");
17
- }
18
-
19
- /**
20
- * @return void
21
- */
22
- private function expectThatLoggerGetsHit() {
23
- $logger = LoggerFacade::getLogger();
24
-
25
- $listenHandle = $this->createMock(AbstractHandler::class);
26
-
27
- $listenHandle
28
- ->expects($this->atLeastOnce())
29
- ->method('handle')
30
- ->willReturn(true);
31
-
32
- $listenHandle
33
- ->expects($this->atLeastOnce())
34
- ->method('isHandling')
35
- ->willReturn(true);
36
-
37
- $logger->pushHandler($listenHandle);
38
- }
39
-
40
- public function testWPError() {
41
- $this->expectThatLoggerGetsHit();
42
- LoggerFacade::log_wp_error(new \WP_Error(), debug_backtrace());
43
- }
44
-
45
- public function testLogException() {
46
- $this->expectThatLoggerGetsHit();
47
- LoggerFacade::log_exception(new RuntimeException());
48
- }
49
-
50
- public function testLogMessageBacktrace() {
51
- $this->expectThatLoggerGetsHit();
52
- LoggerFacade::log_message_backtrace('whatever', debug_backtrace());
53
- }
54
-
55
- public function testLogMessage() {
56
- $this->expectThatLoggerGetsHit();
57
- LoggerFacade::log_message('whatever');
58
- }
59
-
60
-
61
- }
62
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/wpdesk/wp-logs/tests/integration/TestWPDeskLoggerFactory.php DELETED
@@ -1,143 +0,0 @@
1
- <?php
2
-
3
- use Monolog\Handler\AbstractHandler;
4
- use Monolog\Logger;
5
- use PHPUnit\Framework\Error\Notice;
6
- use WPDesk\Logger\WC\WooCommerceMonologPlugin;
7
- use WPDesk\Logger\WPDeskLoggerFactory;
8
-
9
- class TestWPDeskLoggerFactory extends WP_UnitTestCase
10
- {
11
- const LOGGER_NAME = 'somerandomname';
12
-
13
- public function tearDown()
14
- {
15
- parent::tearDown();
16
- WPDeskLoggerFactory::tearDown(self::LOGGER_NAME);
17
- }
18
-
19
- public function testCanCreateLogger()
20
- {
21
- $factory = new WPDeskLoggerFactory();
22
- $this->assertInstanceOf(Logger::class, $factory->createWPDeskLogger(self::LOGGER_NAME), "Logger should be created");
23
- $this->assertTrue($factory->isLogWorking(self::LOGGER_NAME));
24
- }
25
-
26
- public function testWCIsNotCorruptedByOtherTests()
27
- {
28
- $this->assertInstanceOf(WC_Logger::class, wc_get_logger(), "Logger should be NOT captured by default.");
29
- }
30
-
31
- public function testWCLoggingIsCapturedByOurLogs()
32
- {
33
- (new WPDeskLoggerFactory())->createWPDeskLogger();
34
- $this->assertInstanceOf(WooCommerceMonologPlugin::class, wc_get_logger(), "Logger should be captured.");
35
- }
36
-
37
- public function testOurLogsGetAllErrors()
38
- {
39
- $someMessage = 'whatever';
40
- $errorType = E_USER_NOTICE;
41
-
42
- $logger = (new WPDeskLoggerFactory())->createWPDeskLogger(self::LOGGER_NAME);
43
- $logger->pushHandler($this->prepareListenHandleThatIsWaitingForMessage('E_USER_NOTICE: ' . $someMessage));
44
- $this->expectException(Notice::class);
45
- trigger_error($someMessage, $errorType);
46
- }
47
-
48
- /**
49
- * Prepares listener that check if logger gets sent message
50
- *
51
- * @param $message
52
- * @return AbstractHandler
53
- */
54
- private function prepareListenHandleThatIsWaitingForMessage($message)
55
- {
56
- $listenHandle = $this->createMock(AbstractHandler::class);
57
-
58
- $listenHandle
59
- ->expects($this->atLeastOnce())
60
- ->method('handle')
61
- ->with($this->callback(function ($record) use ($message) {
62
- $this->assertEquals($message, $record['message'], "Monolog should get message sent to logger");
63
- return $record['message'] === $message;
64
- }))
65
- ->willReturn(true);
66
-
67
- $listenHandle
68
- ->expects($this->atLeastOnce())
69
- ->method('isHandling')
70
- ->willReturn(true);
71
-
72
- /** @var $listenHandle AbstractHandler */
73
- return $listenHandle;
74
- }
75
-
76
- public function testOurLogsGetAllMessagesLoggedToWC()
77
- {
78
- $someMessage = 'whatever';
79
- $logger = (new WPDeskLoggerFactory())->createWPDeskLogger(self::LOGGER_NAME);
80
- $logger->pushHandler($this->prepareListenHandleThatIsWaitingForMessage($someMessage));
81
-
82
- wc_get_logger()->debug($someMessage);
83
- }
84
-
85
- public function testLoggerWorksAndCanLogInGeneral()
86
- {
87
- $someMessage = 'whatever';
88
- $logger = (new WPDeskLoggerFactory())->createWPDeskLogger(self::LOGGER_NAME);
89
- $logger->pushHandler($this->prepareListenHandleThatIsWaitingForMessage($someMessage));
90
-
91
- $logger->debug($someMessage);
92
- }
93
-
94
- public function testAllLoggedMessagesAreWrittenToWPDeskFile()
95
- {
96
- $someMessage = 'whatever';
97
-
98
- $factory = new WPDeskLoggerFactory();
99
- $logFilename = $factory->getFileName(self::LOGGER_NAME);
100
-
101
- @unlink($logFilename);
102
- $this->assertFileNotExists($logFilename);
103
-
104
- $logger = $factory->createWPDeskLogger(self::LOGGER_NAME);
105
- $logger->debug($someMessage);
106
- $this->assertFileExists($logFilename);
107
- }
108
-
109
- public function testAllLoggedMessagesAreWrittenToWC()
110
- {
111
- $mockWcLogger = $this->createMock(WC_Logger::class);
112
- $mockWcLogger
113
- ->expects($this->atLeastOnce())
114
- ->method('log')
115
- ->willReturn(true);
116
-
117
- add_filter('woocommerce_logging_class', function () use ($mockWcLogger) {
118
- return $mockWcLogger;
119
- }, 0, 100);
120
-
121
- $someMessage = 'whatever';
122
- $logger = (new WPDeskLoggerFactory())->createWPDeskLogger(self::LOGGER_NAME);
123
-
124
- $logger->debug($someMessage);
125
- }
126
-
127
- public function testDisable() {
128
- $factory = new WPDeskLoggerFactory();
129
- $logger = $factory->createWPDeskLogger(self::LOGGER_NAME);
130
- $factory->disableLog(self::LOGGER_NAME);
131
-
132
- $listenHandle = $this->createMock(AbstractHandler::class);
133
-
134
- $listenHandle
135
- ->expects($this->never())
136
- ->method('handle');
137
-
138
- $logger->pushHandler($listenHandle);
139
-
140
- $logger->debug('whatever');
141
- }
142
- }
143
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/wpdesk/wp-logs/tests/integration/WC/TestWooCommerceCapture.php DELETED
@@ -1,42 +0,0 @@
1
- <?php
2
-
3
- use Monolog\Logger;
4
- use WPDesk\Logger\WC\Exception\WCLoggerAlreadyCaptured;
5
- use WPDesk\Logger\WC\WooCommerceCapture;
6
- use WPDesk\Logger\WC\WooCommerceMonologPlugin;
7
-
8
- class TestWooCommerceCapture extends WP_UnitTestCase
9
- {
10
- public function testIfCanCaptureWcLogger()
11
- {
12
- $wcCapture = new WooCommerceCapture($this->createMock(Logger::class));
13
- $wcCapture->captureWcLogger();
14
-
15
- $this->assertInstanceOf(WooCommerceMonologPlugin::class, wc_get_logger(), "Logger should be captured.");
16
- }
17
-
18
- public function testIfCanFreeWcLogger()
19
- {
20
- $wcCapture = new WooCommerceCapture($this->createMock(Logger::class));
21
- $wcCapture->captureWcLogger();
22
- $wcCapture->freeWcLogger();
23
- $this->assertNotInstanceOf(WooCommerceMonologPlugin::class, wc_get_logger(),
24
- "Logger should be restored to original");
25
-
26
- $wcCapture->captureWcLogger();
27
- $this->assertInstanceOf(WooCommerceMonologPlugin::class, wc_get_logger(), "Logger should be captured.");
28
- $wcCapture->freeWcLogger();
29
- $this->assertNotInstanceOf(WooCommerceMonologPlugin::class, wc_get_logger(),
30
- "Logger should be restored to original - twice");
31
- }
32
-
33
- public function testIfCantCaptureTwice()
34
- {
35
- $this->expectException(WCLoggerAlreadyCaptured::class);
36
- $wcCapture = new WooCommerceCapture($this->createMock(Logger::class));
37
- $wcCapture->captureWcLogger();
38
- $wcCapture->captureWcLogger();
39
- }
40
-
41
- }
42
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/wpdesk/wp-logs/tests/integration/WC/TestWooCommerceHandler.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
-
3
- use Monolog\Logger;
4
- use WPDesk\Logger\WC\WooCommerceHandler;
5
-
6
- class TestWooCommerceHandler extends WP_UnitTestCase
7
- {
8
-
9
- public function testCanWriteToLogger()
10
- {
11
- $logRecord = [
12
- 'level' => Logger::DEBUG,
13
- 'message' => 'some message',
14
- 'context' => [],
15
- 'extra' => []
16
- ];
17
-
18
- $mockedLogger = $this->createMock(WC_Logger::class);
19
- $mockedLogger->expects($this->once())
20
- ->method('log');
21
-
22
- $handler = new WooCommerceHandler($mockedLogger);
23
- $handler->handle($logRecord);
24
- }
25
- }
26
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/wpdesk/wp-logs/tests/integration/bootstrap.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
-
3
- ini_set('error_reporting', E_ALL); // or error_reporting(E_ALL);
4
- ini_set('display_errors', '1');
5
- ini_set('display_startup_errors', '1');
6
-
7
- require_once __DIR__ . '/../../vendor/autoload.php';
8
-
9
- // disable xdebug backtrace
10
- if ( function_exists( 'xdebug_disable' ) ) {
11
- xdebug_disable();
12
- }
13
-
14
- if ( getenv( 'PLUGIN_PATH' ) !== false ) {
15
- define( 'PLUGIN_PATH', getenv( 'PLUGIN_PATH' ) );
16
- } else {
17
- define( 'PLUGIN_PATH', __DIR__ . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR );
18
- }
19
-
20
- require_once( getenv( 'WP_DEVELOP_DIR' ) . '/tests/phpunit/includes/functions.php' );
21
-
22
- tests_add_filter( 'muplugins_loaded', function () {
23
- }, 100 );
24
-
25
- putenv('WP_TESTS_DIR=' . getenv( 'WP_DEVELOP_DIR' ) . '/tests/phpunit');
26
- require_once( getenv( 'WC_DEVELOP_DIR' ) . '/tests/bootstrap.php' );
27
-
28
- do_action('plugins_loaded');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/wpdesk/wp-logs/tests/unit/bootstrap.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
- /**
3
- * PHPUnit bootstrap file
4
- */
5
-
6
- require_once __DIR__ . '/../../vendor/autoload.php';
 
 
 
 
 
 
vendor/wpdesk/wp-saas-platform-client/src/Response/Rate/PostRateResponse.php CHANGED
@@ -10,6 +10,8 @@ class PostRateResponse implements ApiResponse
10
  {
11
  use AuthApiResponseDecorator;
12
 
 
 
13
  /**
14
  * @return RateResponse
15
  */
@@ -17,4 +19,13 @@ class PostRateResponse implements ApiResponse
17
  {
18
  return new RateResponse($this->getResponseBody());
19
  }
 
 
 
 
 
 
 
 
 
20
  }
10
  {
11
  use AuthApiResponseDecorator;
12
 
13
+ const RESPONSE_CODE_RATE_FAILED = 274;
14
+
15
  /**
16
  * @return RateResponse
17
  */
19
  {
20
  return new RateResponse($this->getResponseBody());
21
  }
22
+
23
+ /**
24
+ * Platform can't respond in meaningful way about rates
25
+ *
26
+ * @return bool
27
+ */
28
+ public function isRateFailedError() {
29
+ return $this->rawResponse->getResponseCode() === self::RESPONSE_CODE_RATE_FAILED;
30
+ }
31
  }