Version Description
- 2018-12-13 =
- Added Cache settings in FS Connect Advanced settings
- Added info and link to planned integrations
- Added support for not allowed demo domain
- Fixed missing tracker message
- Fixed typo in Connect notices
- Fixed COD Enable for shipping methods functionality
- Fixed UK counties
- Fixed for free shipping zero value in settings
Download this release
Release Info
Developer | jablonowski |
Plugin | Flexible Shipping for WooCommerce |
Version | 3.1 |
Comparing to | |
See all releases |
Code changes from version 3.0.7 to 3.1
- README.md +5 -10
- classes/class-flexible-shipping-plugin.php +0 -2
- classes/logger/class-saas-logger-settings.php +0 -4
- classes/saas/class-saas-cache-settings.php +75 -0
- classes/saas/class-saas-new-courier-settings-section.php +55 -0
- classes/saas/class-saas-platform-factory.php +44 -38
- classes/saas/class-saas-platform-links.php +11 -0
- classes/saas/class-saas-settings.php +61 -3
- classes/saas/class-saas-shipping-services-manager.php +6 -3
- classes/saas/class-saas-user-registration.php +23 -0
- classes/saas/views/html-flexible-shipping-connect-second-notice.php +7 -1
- classes/saas/views/html-settings-long-row.php +6 -0
- classes/shipping-method.php +9 -4
- classes/tracker.php +225 -186
- flexible-shipping.php +7 -5
- lang/flexible-shipping-pl_PL.mo +0 -0
- lang/flexible-shipping-pl_PL.po +206 -228
- plugin-create.php +0 -3
- readme.txt +12 -2
- vendor/autoload.php +1 -1
- vendor/composer/autoload_classmap.php +2 -0
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +6 -4
- vendor/composer/installed.json +14 -14
- vendor/wpdesk/wp-basic-requirements/.gitignore +2 -1
- vendor/wpdesk/wp-basic-requirements/.gitlab-ci.yml +2 -158
- vendor/wpdesk/wp-basic-requirements/.gitlab/issue_templates/Bug.md +0 -32
- vendor/wpdesk/wp-basic-requirements/README.md +12 -0
- vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php +50 -17
- vendor/wpdesk/wp-basic-requirements/src/Plugin/Has_Plugin_Info.php +3 -3
- vendor/wpdesk/wp-basic-requirements/src/Plugin/Plugin_Info.php +4 -4
- vendor/wpdesk/wp-basic-requirements/src/Translable.php +1 -3
- vendor/wpdesk/wp-basic-requirements/src/Translatable.php +15 -0
- vendor/wpdesk/wp-basic-requirements/tests/unit/Test_Basic_Requirement_Checker.php +2 -11
- vendor/wpdesk/wp-saas-platform-client/README.md +6 -0
- vendor/wpdesk/wp-saas-platform-client/changelog.txt +5 -0
- vendor/wpdesk/wp-saas-platform-client/composer.json +2 -2
- vendor/wpdesk/wp-saas-platform-client/src/ApiClient/CachedClient.php +2 -54
- vendor/wpdesk/wp-saas-platform-client/src/ApiClient/ClientFactory.php +1 -1
- vendor/wpdesk/wp-saas-platform-client/src/ApiClient/ClientImplementation.php +3 -2
- vendor/wpdesk/wp-saas-platform-client/src/ApiClient/RequestCacheInfoResolver.php +48 -35
- vendor/wpdesk/wp-saas-platform-client/src/Cache/CacheDispatcher.php +9 -6
- vendor/wpdesk/wp-saas-platform-client/src/Cache/CacheInfoResolver.php +5 -3
- vendor/wpdesk/wp-saas-platform-client/src/Cache/CacheItemCreator.php +2 -0
- vendor/wpdesk/wp-saas-platform-client/src/Cache/CacheItemVerifier.php +2 -0
- vendor/wpdesk/wp-saas-platform-client/src/Cache/HowToCache.php +6 -0
- vendor/wpdesk/wp-saas-platform-client/src/HttpClient/HttpClientResponse.php +7 -1
- vendor/wpdesk/wp-saas-platform-client/src/Response/RawResponse.php +32 -1
- vendor/wpdesk/wp-saas-platform-client/src/Response/Response.php +10 -0
- vendor/wpdesk/wp-saas-platform-client/src/Response/Traits/ApiResponseDecorator.php +31 -1
- vendor/wpdesk/wp-saas-platform-client/tests/unit/ApiCLient/TestRequestCacheInfoResolver.php +217 -0
- vendor/wpdesk/wp-saas-platform-client/tests/unit/Response/TestMaintenanceResponseContext.php +1 -1
- vendor/wpdesk/wp-saas-platform-client/tests/unit/Response/TestRate.php +1 -1
- vendor/wpdesk/wp-saas-platform-client/tests/unit/bootstrap.php +3 -0
README.md
CHANGED
@@ -1,11 +1,6 @@
|
|
1 |
-
|
2 |
-
|
|
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
[![coverage report](https://gitlab.com/wpdesk/flexible-shipping/badges/feature/saas/coverage.svg?job=integration+test+lastest+coverage)](https://gitlab.com/wpdesk/flexible-shipping/commits/feature/saas) Integration
|
7 |
-
|
8 |
-
[![coverage report](https://gitlab.com/wpdesk/flexible-shipping/badges/feature/saas/coverage.svg?job=unit+test+lastest+coverage)](https://gitlab.com/wpdesk/flexible-shipping/commits/feature/saas) Unit
|
9 |
-
|
10 |
-
Flexibe Shipping Plugin
|
11 |
-
=======================
|
1 |
+
[![pipeline status](https://gitlab.com/wpdesk/flexible-shipping/badges/master/pipeline.svg)](https://gitlab.com/wpdesk/flexible-shipping/commits/master)
|
2 |
+
Integration: [![coverage report](https://gitlab.com/wpdesk/flexible-shipping/badges/master/coverage.svg?job=integration+test+lastest+coverage)](https://gitlab.com/wpdesk/flexible-shipping/commits/master)
|
3 |
+
Unit [![coverage report](https://gitlab.com/wpdesk/flexible-shipping/badges/master/coverage.svg?job=unit+test+lastest+coverage)](https://gitlab.com/wpdesk/flexible-shipping/commits/master)
|
4 |
|
5 |
+
Flexible Shipping Plugin
|
6 |
+
========================
|
|
|
|
|
|
|
|
|
|
|
|
classes/class-flexible-shipping-plugin.php
CHANGED
@@ -100,8 +100,6 @@ class Flexible_Shipping_Plugin
|
|
100 |
|
101 |
$this->add_hookable( new WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax( $connection ) );
|
102 |
|
103 |
-
$this->add_hookable( new WPDesk_Flexible_Shipping_Tracker() );
|
104 |
-
|
105 |
$this->add_hookable( new WPDesk_Flexible_Shipping_Shorcode_Unit_Weight() );
|
106 |
$this->add_hookable( new WPDesk_Flexible_Shipping_Shorcode_Unit_Dimension() );
|
107 |
|
100 |
|
101 |
$this->add_hookable( new WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax( $connection ) );
|
102 |
|
|
|
|
|
103 |
$this->add_hookable( new WPDesk_Flexible_Shipping_Shorcode_Unit_Weight() );
|
104 |
$this->add_hookable( new WPDesk_Flexible_Shipping_Shorcode_Unit_Dimension() );
|
105 |
|
classes/logger/class-saas-logger-settings.php
CHANGED
@@ -90,10 +90,6 @@ class WPDesk_Flexible_Shipping_SaaS_Logger_Settings {
|
|
90 |
* @return array
|
91 |
*/
|
92 |
public function add_fields_to_settings( array $settings ) {
|
93 |
-
$settings[] = array(
|
94 |
-
'type' => 'title',
|
95 |
-
'title' => __( 'Advanced settings', 'flexible-shipping' ),
|
96 |
-
);
|
97 |
$settings[ self::DEBUG_LOG_OPTION ] = array(
|
98 |
'type' => 'checkbox',
|
99 |
'label' => __( 'Enable Debug Mode', 'flexible-shipping' ),
|
90 |
* @return array
|
91 |
*/
|
92 |
public function add_fields_to_settings( array $settings ) {
|
|
|
|
|
|
|
|
|
93 |
$settings[ self::DEBUG_LOG_OPTION ] = array(
|
94 |
'type' => 'checkbox',
|
95 |
'label' => __( 'Enable Debug Mode', 'flexible-shipping' ),
|
classes/saas/class-saas-cache-settings.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Handles cache settings
|
5 |
+
*
|
6 |
+
* Class WPDesk_Flexible_Shipping_SaaS_Cache_Settings
|
7 |
+
*/
|
8 |
+
class WPDesk_Flexible_Shipping_SaaS_Cache_Settings {
|
9 |
+
|
10 |
+
const SETTINGS_OPTION_NAME = 'disable_cache';
|
11 |
+
|
12 |
+
const OPTION_NAME = 'fs_disable_cache';
|
13 |
+
|
14 |
+
const OPTION_VALUE_DISABLED = '0';
|
15 |
+
const OPTION_VALUE_ENABLED = '1';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Enabled.
|
19 |
+
*
|
20 |
+
* @var bool
|
21 |
+
*/
|
22 |
+
private $enabled = false;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* WPDesk_Flexible_Shipping_SaaS_Logger_Settings constructor.
|
26 |
+
*/
|
27 |
+
public function __construct() {
|
28 |
+
$option_value = get_option( self::OPTION_NAME, self::OPTION_VALUE_ENABLED );
|
29 |
+
$this->enabled = self::OPTION_VALUE_ENABLED === $option_value;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Is enabled.
|
34 |
+
*
|
35 |
+
* @return bool
|
36 |
+
*/
|
37 |
+
public function is_enabled() {
|
38 |
+
return $this->enabled;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Update option from saas settings.
|
43 |
+
*
|
44 |
+
* @param WPDesk_Flexible_Shipping_SaaS_Settings $saas_settings Saas settings.
|
45 |
+
*/
|
46 |
+
public function update_option_from_saas_settings( WPDesk_Flexible_Shipping_SaaS_Settings $saas_settings ) {
|
47 |
+
$saas_settings_value = $saas_settings->get_option( self::SETTINGS_OPTION_NAME );
|
48 |
+
if ( ! empty( $saas_settings_value ) && 'yes' === $saas_settings_value ) {
|
49 |
+
$option_value = self::OPTION_VALUE_ENABLED;
|
50 |
+
} else {
|
51 |
+
$option_value = self::OPTION_VALUE_DISABLED;
|
52 |
+
}
|
53 |
+
update_option( self::OPTION_NAME, $option_value );
|
54 |
+
$this->enabled = self::OPTION_VALUE_ENABLED === $option_value;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Add fields to settings.
|
59 |
+
*
|
60 |
+
* @param array $settings Settings.
|
61 |
+
*
|
62 |
+
* @return array
|
63 |
+
*/
|
64 |
+
public function add_fields_to_settings( array $settings ) {
|
65 |
+
$settings[ self::SETTINGS_OPTION_NAME ] = array(
|
66 |
+
'type' => 'checkbox',
|
67 |
+
'label' => __( 'Enable', 'flexible-shipping' ),
|
68 |
+
'title' => __( 'Cache', 'flexible-shipping' ),
|
69 |
+
'description' => __( 'Enables Flexible Shipping Connect cache. Disable only for debugging.', 'flexible-shipping' ),
|
70 |
+
'default' => 'yes',
|
71 |
+
);
|
72 |
+
return $settings;
|
73 |
+
}
|
74 |
+
|
75 |
+
}
|
classes/saas/class-saas-new-courier-settings-section.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Adds planned integrations section in settings.
|
5 |
+
*
|
6 |
+
* Class WPDesk_Flexible_Shipping_SaaS_New_Courier_Settings_Section
|
7 |
+
*/
|
8 |
+
class WPDesk_Flexible_Shipping_SaaS_New_Courier_Settings_Section {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Platform links.
|
12 |
+
*
|
13 |
+
* @var WPDesk_Flexible_Shipping_SaaS_Platform_Links
|
14 |
+
*/
|
15 |
+
private $saas_platform_links;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* WPDesk_Flexible_Shipping_SaaS_New_Courier_Settings_Section constructor.
|
19 |
+
*
|
20 |
+
* @param WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links Platform links.
|
21 |
+
*/
|
22 |
+
public function __construct( WPDesk_Flexible_Shipping_SaaS_Platform_Links $saas_platform_links ) {
|
23 |
+
$this->saas_platform_links = $saas_platform_links;
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Add fields to settings.
|
29 |
+
*
|
30 |
+
* @param array $settings Settings.
|
31 |
+
*
|
32 |
+
* @return array
|
33 |
+
*/
|
34 |
+
public function add_fields_to_settings( array $settings ) {
|
35 |
+
$url = $this->saas_platform_links->add_utm(
|
36 |
+
$this->saas_platform_links->get_planned(),
|
37 |
+
'fs-configuration-flexibleshippingtablerate',
|
38 |
+
'flexible-shipping',
|
39 |
+
'link',
|
40 |
+
'user-site',
|
41 |
+
'planned-integrations'
|
42 |
+
);
|
43 |
+
$settings[] = array(
|
44 |
+
'type' => 'long_row',
|
45 |
+
'class' => 'fs-connect-new-courier',
|
46 |
+
'content' => sprintf( // Translators: URL.
|
47 |
+
__( 'Do not you see your courier? %1$sCheck planned integrations →%2$s', 'flexible-shipping' ),
|
48 |
+
'<a target="_blank" href="' . $url . '">',
|
49 |
+
'</a>'
|
50 |
+
),
|
51 |
+
);
|
52 |
+
return $settings;
|
53 |
+
}
|
54 |
+
|
55 |
+
}
|
classes/saas/class-saas-platform-factory.php
CHANGED
@@ -1,49 +1,55 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
/**
|
10 |
-
*
|
|
|
|
|
11 |
*/
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
self::SAAS_PLATFORM_LOGGER_SOURCE
|
29 |
-
);
|
30 |
}
|
|
|
|
|
|
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
* @return \WPDesk\SaasPlatformClient\Platform
|
36 |
-
*/
|
37 |
-
public function get_platform() {
|
38 |
-
$platform_options = new \WPDesk\SaasPlatformClient\PlatformFactoryWordpressOptions();
|
39 |
-
$platform_options->setLogger( $this->logger );
|
40 |
-
// TODO: enable when ready
|
41 |
-
//$platform_options->setCachedClient( true );
|
42 |
-
$platform_options->setCacheTtl( self::ONE_HOUR );
|
43 |
-
$platform = \WPDesk\SaasPlatformClient\PlatformFactory::createPlatformApi( $platform_options );
|
44 |
-
|
45 |
-
return $platform;
|
46 |
}
|
47 |
-
|
|
|
48 |
|
|
|
|
|
49 |
}
|
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Class WPDesk_Flexible_Shipping_SaaS_Auth_Platform_Factory
|
5 |
+
*/
|
6 |
+
class WPDesk_Flexible_Shipping_SaaS_Auth_Platform_Factory {
|
7 |
|
8 |
+
const SAAS_PLATFORM_LOGGER_SOURCE = 'saas-platform';
|
9 |
+
|
10 |
+
const ONE_HOUR = 3600;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Logger.
|
14 |
+
*
|
15 |
+
* @var \Psr\Log\LoggerInterface
|
16 |
+
*/
|
17 |
+
private $logger;
|
18 |
|
19 |
/**
|
20 |
+
* WPDesk_Flexible_Shipping_SaaS_Auth_Platform_Factory constructor.
|
21 |
+
*
|
22 |
+
* @param \Psr\Log\LoggerInterface $logger Logger.
|
23 |
*/
|
24 |
+
public function __construct( \Psr\Log\LoggerInterface $logger ) {
|
25 |
+
$this->logger = new WPDesk_Flexible_Shipping_WooCommerce_Context_Logger(
|
26 |
+
$logger,
|
27 |
+
self::SAAS_PLATFORM_LOGGER_SOURCE
|
28 |
+
);
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Get platform.
|
33 |
+
*
|
34 |
+
* @return \WPDesk\SaasPlatformClient\Platform
|
35 |
+
*/
|
36 |
+
public function get_platform() {
|
37 |
+
$default_headers = array();
|
38 |
+
if ( defined( 'FLEXIBLE_SHIPPING_VERSION' ) ) {
|
39 |
+
$default_headers['X-Plugin-Version'] = FLEXIBLE_SHIPPING_VERSION;
|
|
|
|
|
40 |
}
|
41 |
+
$platform_options = new \WPDesk\SaasPlatformClient\PlatformFactoryWordpressOptions();
|
42 |
+
$platform_options->setLogger( $this->logger );
|
43 |
+
$platform_options->setDefaultRequestHeaders( $default_headers );
|
44 |
|
45 |
+
$cache_settings = new WPDesk_Flexible_Shipping_SaaS_Cache_Settings();
|
46 |
+
if ( $cache_settings->is_enabled() ) {
|
47 |
+
$platform_options->setCachedClient( true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
+
$platform_options->setCacheTtl( self::ONE_HOUR );
|
50 |
+
$platform = \WPDesk\SaasPlatformClient\PlatformFactory::createPlatformApi( $platform_options );
|
51 |
|
52 |
+
return $platform;
|
53 |
+
}
|
54 |
}
|
55 |
+
|
classes/saas/class-saas-platform-links.php
CHANGED
@@ -11,6 +11,7 @@ class WPDesk_Flexible_Shipping_SaaS_Platform_Links {
|
|
11 |
const PRIVACY = 'terms/privacy/';
|
12 |
const UPGRADE_PLAN = 'my-account/';
|
13 |
const CONNECT = 'connect/';
|
|
|
14 |
|
15 |
const DOCS = 'https://docs.flexibleshipping.com/category/81-getting-started';
|
16 |
const STATUS = 'https://status.flexibleshipping.com/';
|
@@ -122,6 +123,15 @@ class WPDesk_Flexible_Shipping_SaaS_Platform_Links {
|
|
122 |
return $this->base_url . self::CONNECT;
|
123 |
}
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
/**
|
126 |
* Add UTM to URL.
|
127 |
*
|
@@ -130,6 +140,7 @@ class WPDesk_Flexible_Shipping_SaaS_Platform_Links {
|
|
130 |
* @param string $utm_campaign Parameter utm_campaign.
|
131 |
* @param string $utm_medium Parameter utm_medium.
|
132 |
* @param string $utm_source Parameter utm_source.
|
|
|
133 |
*
|
134 |
* @return string
|
135 |
*/
|
11 |
const PRIVACY = 'terms/privacy/';
|
12 |
const UPGRADE_PLAN = 'my-account/';
|
13 |
const CONNECT = 'connect/';
|
14 |
+
const PLANNED = 'product-category/integrations/';
|
15 |
|
16 |
const DOCS = 'https://docs.flexibleshipping.com/category/81-getting-started';
|
17 |
const STATUS = 'https://status.flexibleshipping.com/';
|
123 |
return $this->base_url . self::CONNECT;
|
124 |
}
|
125 |
|
126 |
+
/**
|
127 |
+
* Get planned integrations URL.
|
128 |
+
*
|
129 |
+
* @return string
|
130 |
+
*/
|
131 |
+
public function get_planned() {
|
132 |
+
return $this->base_url . self::PLANNED;
|
133 |
+
}
|
134 |
+
|
135 |
/**
|
136 |
* Add UTM to URL.
|
137 |
*
|
140 |
* @param string $utm_campaign Parameter utm_campaign.
|
141 |
* @param string $utm_medium Parameter utm_medium.
|
142 |
* @param string $utm_source Parameter utm_source.
|
143 |
+
* @param string $utm_term Parameter utm_term.
|
144 |
*
|
145 |
* @return string
|
146 |
*/
|
classes/saas/class-saas-settings.php
CHANGED
@@ -43,6 +43,20 @@ class WPDesk_Flexible_Shipping_SaaS_Settings extends WC_Shipping_Method implemen
|
|
43 |
*/
|
44 |
private $logger_settings;
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
/**
|
47 |
* WPDesk_Flexible_Shipping_Connect constructor.
|
48 |
*
|
@@ -76,6 +90,10 @@ class WPDesk_Flexible_Shipping_SaaS_Settings extends WC_Shipping_Method implemen
|
|
76 |
|
77 |
$this->logger_settings = new WPDesk_Flexible_Shipping_SaaS_Logger_Settings( $this );
|
78 |
|
|
|
|
|
|
|
|
|
79 |
$this->init_form_fields();
|
80 |
|
81 |
add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
|
@@ -116,6 +134,13 @@ class WPDesk_Flexible_Shipping_SaaS_Settings extends WC_Shipping_Method implemen
|
|
116 |
$this->logger_settings->update_option_from_saas_settings( $this );
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
/**
|
120 |
* Process admin options.
|
121 |
*/
|
@@ -140,6 +165,7 @@ class WPDesk_Flexible_Shipping_SaaS_Settings extends WC_Shipping_Method implemen
|
|
140 |
}
|
141 |
}
|
142 |
$this->update_debug_mode();
|
|
|
143 |
$this->shipping_methods_manager->update_enabled_shipping_services( $enabled_shipping_services );
|
144 |
$url = admin_url( self::WOOCOMMERCE_SETTINGS_SHIPPING_URL );
|
145 |
$url = add_query_arg( 'section', $this->id, $url );
|
@@ -165,6 +191,7 @@ class WPDesk_Flexible_Shipping_SaaS_Settings extends WC_Shipping_Method implemen
|
|
165 |
return true;
|
166 |
}
|
167 |
}
|
|
|
168 |
return false;
|
169 |
}
|
170 |
|
@@ -181,6 +208,7 @@ class WPDesk_Flexible_Shipping_SaaS_Settings extends WC_Shipping_Method implemen
|
|
181 |
} catch ( WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception $e ) {
|
182 |
$shipping_services_from_platform = array();
|
183 |
}
|
|
|
184 |
return $shipping_services_from_platform;
|
185 |
}
|
186 |
|
@@ -188,11 +216,11 @@ class WPDesk_Flexible_Shipping_SaaS_Settings extends WC_Shipping_Method implemen
|
|
188 |
* Maybe update integration checkbox.
|
189 |
*
|
190 |
* @param string|null $required_plugin_version Required plugin version.
|
191 |
-
* @param string
|
192 |
*/
|
193 |
private function maybe_update_integration_checkbox( $required_plugin_version, $integration_id ) {
|
194 |
if ( empty( $required_plugin_version )
|
195 |
-
|
196 |
) {
|
197 |
$this->update_option( $integration_id, 'no' );
|
198 |
}
|
@@ -237,6 +265,7 @@ class WPDesk_Flexible_Shipping_SaaS_Settings extends WC_Shipping_Method implemen
|
|
237 |
$settings[ $integration_id ] = $service_checkbox->prepare_checkbox();
|
238 |
}
|
239 |
}
|
|
|
240 |
return $settings;
|
241 |
}
|
242 |
|
@@ -255,8 +284,14 @@ class WPDesk_Flexible_Shipping_SaaS_Settings extends WC_Shipping_Method implemen
|
|
255 |
if ( count( $shipping_providers_from_platform ) ) {
|
256 |
$this->form_fields = $this->add_shipping_services_checkboxes_to_settings( $this->form_fields, $shipping_providers_from_platform );
|
257 |
}
|
|
|
258 |
}
|
259 |
-
$this->form_fields =
|
|
|
|
|
|
|
|
|
|
|
260 |
}
|
261 |
}
|
262 |
|
@@ -290,6 +325,7 @@ class WPDesk_Flexible_Shipping_SaaS_Settings extends WC_Shipping_Method implemen
|
|
290 |
);
|
291 |
$saas_connected = $this->saas_connection->is_connected();
|
292 |
include 'views/html-field-saas-connection.php';
|
|
|
293 |
return ob_get_clean();
|
294 |
}
|
295 |
|
@@ -324,4 +360,26 @@ class WPDesk_Flexible_Shipping_SaaS_Settings extends WC_Shipping_Method implemen
|
|
324 |
}
|
325 |
}
|
326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
}
|
43 |
*/
|
44 |
private $logger_settings;
|
45 |
|
46 |
+
/**
|
47 |
+
* Cache settings.
|
48 |
+
*
|
49 |
+
* @var WPDesk_Flexible_Shipping_SaaS_Logger_Settings
|
50 |
+
*/
|
51 |
+
private $cache_settings;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* New courier settings section.
|
55 |
+
*
|
56 |
+
* @var WPDesk_Flexible_Shipping_SaaS_New_Courier_Settings_Section
|
57 |
+
*/
|
58 |
+
private $new_courier_settings_section;
|
59 |
+
|
60 |
/**
|
61 |
* WPDesk_Flexible_Shipping_Connect constructor.
|
62 |
*
|
90 |
|
91 |
$this->logger_settings = new WPDesk_Flexible_Shipping_SaaS_Logger_Settings( $this );
|
92 |
|
93 |
+
$this->cache_settings = new WPDesk_Flexible_Shipping_SaaS_Cache_Settings();
|
94 |
+
|
95 |
+
$this->new_courier_settings_section = new WPDesk_Flexible_Shipping_SaaS_New_Courier_Settings_Section( $this->saas_platform_links );
|
96 |
+
|
97 |
$this->init_form_fields();
|
98 |
|
99 |
add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
|
134 |
$this->logger_settings->update_option_from_saas_settings( $this );
|
135 |
}
|
136 |
|
137 |
+
/**
|
138 |
+
* Update cache settings.
|
139 |
+
*/
|
140 |
+
private function update_cache_settings() {
|
141 |
+
$this->cache_settings->update_option_from_saas_settings( $this );
|
142 |
+
}
|
143 |
+
|
144 |
/**
|
145 |
* Process admin options.
|
146 |
*/
|
165 |
}
|
166 |
}
|
167 |
$this->update_debug_mode();
|
168 |
+
$this->update_cache_settings();
|
169 |
$this->shipping_methods_manager->update_enabled_shipping_services( $enabled_shipping_services );
|
170 |
$url = admin_url( self::WOOCOMMERCE_SETTINGS_SHIPPING_URL );
|
171 |
$url = add_query_arg( 'section', $this->id, $url );
|
191 |
return true;
|
192 |
}
|
193 |
}
|
194 |
+
|
195 |
return false;
|
196 |
}
|
197 |
|
208 |
} catch ( WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception $e ) {
|
209 |
$shipping_services_from_platform = array();
|
210 |
}
|
211 |
+
|
212 |
return $shipping_services_from_platform;
|
213 |
}
|
214 |
|
216 |
* Maybe update integration checkbox.
|
217 |
*
|
218 |
* @param string|null $required_plugin_version Required plugin version.
|
219 |
+
* @param string $integration_id Integration ID.
|
220 |
*/
|
221 |
private function maybe_update_integration_checkbox( $required_plugin_version, $integration_id ) {
|
222 |
if ( empty( $required_plugin_version )
|
223 |
+
|| version_compare( $required_plugin_version, FLEXIBLE_SHIPPING_VERSION ) > 0
|
224 |
) {
|
225 |
$this->update_option( $integration_id, 'no' );
|
226 |
}
|
265 |
$settings[ $integration_id ] = $service_checkbox->prepare_checkbox();
|
266 |
}
|
267 |
}
|
268 |
+
|
269 |
return $settings;
|
270 |
}
|
271 |
|
284 |
if ( count( $shipping_providers_from_platform ) ) {
|
285 |
$this->form_fields = $this->add_shipping_services_checkboxes_to_settings( $this->form_fields, $shipping_providers_from_platform );
|
286 |
}
|
287 |
+
$this->form_fields = $this->new_courier_settings_section->add_fields_to_settings( $this->form_fields );
|
288 |
}
|
289 |
+
$this->form_fields[] = array(
|
290 |
+
'type' => 'title',
|
291 |
+
'title' => __( 'Advanced settings', 'flexible-shipping' ),
|
292 |
+
);
|
293 |
+
$this->form_fields = $this->logger_settings->add_fields_to_settings( $this->form_fields );
|
294 |
+
$this->form_fields = $this->cache_settings->add_fields_to_settings( $this->form_fields );
|
295 |
}
|
296 |
}
|
297 |
|
325 |
);
|
326 |
$saas_connected = $this->saas_connection->is_connected();
|
327 |
include 'views/html-field-saas-connection.php';
|
328 |
+
|
329 |
return ob_get_clean();
|
330 |
}
|
331 |
|
360 |
}
|
361 |
}
|
362 |
|
363 |
+
/**
|
364 |
+
* Generate Text Input HTML.
|
365 |
+
*
|
366 |
+
* @param string $key Field key.
|
367 |
+
* @param array $data Field data.
|
368 |
+
*
|
369 |
+
* @since 1.0.0
|
370 |
+
* @return string
|
371 |
+
*/
|
372 |
+
public function generate_long_row_html( $key, $data ) {
|
373 |
+
$field_key = $this->get_field_key( $key );
|
374 |
+
$defaults = array(
|
375 |
+
'content' => '',
|
376 |
+
'class' => '',
|
377 |
+
);
|
378 |
+
$data = wp_parse_args( $data, $defaults );
|
379 |
+
ob_start();
|
380 |
+
include 'views/html-settings-long-row.php';
|
381 |
+
|
382 |
+
return ob_get_clean();
|
383 |
+
}
|
384 |
+
|
385 |
}
|
classes/saas/class-saas-shipping-services-manager.php
CHANGED
@@ -17,6 +17,8 @@ class WPDesk_Flexible_Shipping_SaaS_Services_Manager
|
|
17 |
|
18 |
const LOGGER_SOURCE = 'saas-methods-manager';
|
19 |
|
|
|
|
|
20 |
|
21 |
/**
|
22 |
* SaaS connection.
|
@@ -88,6 +90,8 @@ class WPDesk_Flexible_Shipping_SaaS_Services_Manager
|
|
88 |
|
89 |
$this->saas_platform_links = $saas_platform_links;
|
90 |
|
|
|
|
|
91 |
}
|
92 |
|
93 |
/**
|
@@ -95,10 +99,9 @@ class WPDesk_Flexible_Shipping_SaaS_Services_Manager
|
|
95 |
*/
|
96 |
public function hooks() {
|
97 |
|
98 |
-
|
99 |
-
|
100 |
add_filter( 'woocommerce_shipping_methods',
|
101 |
-
array( $this, 'add_flexible_shipping_connect_shipping_method' )
|
102 |
);
|
103 |
add_filter( 'woocommerce_shipping_methods', array( $this, 'add_shipping_methods_for_shipping_services' ) );
|
104 |
|
17 |
|
18 |
const LOGGER_SOURCE = 'saas-methods-manager';
|
19 |
|
20 |
+
const PRIORITY_FIRST = 1;
|
21 |
+
|
22 |
|
23 |
/**
|
24 |
* SaaS connection.
|
90 |
|
91 |
$this->saas_platform_links = $saas_platform_links;
|
92 |
|
93 |
+
$this->create_saas_shipping_methods();
|
94 |
+
|
95 |
}
|
96 |
|
97 |
/**
|
99 |
*/
|
100 |
public function hooks() {
|
101 |
|
102 |
+
/** Important! Must be added before regular FS shipping method because of COD `Enable for shipping methods` functionality. */
|
|
|
103 |
add_filter( 'woocommerce_shipping_methods',
|
104 |
+
array( $this, 'add_flexible_shipping_connect_shipping_method' ), self::PRIORITY_FIRST
|
105 |
);
|
106 |
add_filter( 'woocommerce_shipping_methods', array( $this, 'add_shipping_methods_for_shipping_services' ) );
|
107 |
|
classes/saas/class-saas-user-registration.php
CHANGED
@@ -261,6 +261,27 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_SaaS_User_Registration' ) ) {
|
|
261 |
add_settings_error( self::SETTINGS_ERROR_SETTING, self::SETTINGS_ERROR_CODE_SUCCESS, $notice_content, $notice_type );
|
262 |
}
|
263 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
/**
|
265 |
* Add notice user already exists.
|
266 |
*
|
@@ -342,6 +363,8 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping_SaaS_User_Registration' ) ) {
|
|
342 |
$this->add_notice_connecton_problem();
|
343 |
} elseif ( $register_response->isServerFatalError() ) {
|
344 |
$this->add_notice_connecton_problem();
|
|
|
|
|
345 |
} else {
|
346 |
$this->add_notice_from_response( $register_response->getResponseCode() );
|
347 |
}
|
261 |
add_settings_error( self::SETTINGS_ERROR_SETTING, self::SETTINGS_ERROR_CODE_SUCCESS, $notice_content, $notice_type );
|
262 |
}
|
263 |
|
264 |
+
/**
|
265 |
+
* Add notice domain not allowed.
|
266 |
+
*/
|
267 |
+
private function add_notice_domain_not_allowed() {
|
268 |
+
$notice_type = WPDesk\Notice\Notice::NOTICE_TYPE_ERROR;
|
269 |
+
$notice_content = sprintf(
|
270 |
+
/* Translators: email and url */
|
271 |
+
__( 'Our demo does not support Flexible Shipping Connect registration. Try FS Connect for free. %1$sCheck now →%2$s', 'flexible-shipping' ),
|
272 |
+
'<a target="_blank" href=' . $this->saas_platform_links->add_utm(
|
273 |
+
$this->saas_platform_links->get_connect(),
|
274 |
+
'fs-demo-doesnt-support',
|
275 |
+
'flexible-shipping',
|
276 |
+
'link',
|
277 |
+
'demo',
|
278 |
+
'check-now'
|
279 |
+
) . ' tagret="_blank">',
|
280 |
+
'</a>'
|
281 |
+
);
|
282 |
+
add_settings_error( self::SETTINGS_ERROR_SETTING, self::SETTINGS_ERROR_CODE_SUCCESS, $notice_content, $notice_type );
|
283 |
+
}
|
284 |
+
|
285 |
/**
|
286 |
* Add notice user already exists.
|
287 |
*
|
363 |
$this->add_notice_connecton_problem();
|
364 |
} elseif ( $register_response->isServerFatalError() ) {
|
365 |
$this->add_notice_connecton_problem();
|
366 |
+
} elseif ( $register_response->isDomainNotAllowed() ) {
|
367 |
+
$this->add_notice_domain_not_allowed();
|
368 |
} else {
|
369 |
$this->add_notice_from_response( $register_response->getResponseCode() );
|
370 |
}
|
classes/saas/views/html-flexible-shipping-connect-second-notice.php
CHANGED
@@ -1 +1,7 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
echo sprintf(
|
3 |
+
__( 'You never sign up to Flexible Shipping Connect. You may finish the registration process here %1$sSign up for Connect%2$s', 'flexible-shipping' ),
|
4 |
+
'<a href="' . $link . '" class="button button-primary">',
|
5 |
+
'</a>'
|
6 |
+
);
|
7 |
+
?>
|
classes/saas/views/html-settings-long-row.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php /** @var $data array */ ?>
|
2 |
+
<tr valign="top" class="<?php echo esc_attr( $data['class'] ); ?>">
|
3 |
+
<td scope="row" class="titledesc" colspan="2">
|
4 |
+
<div><?php echo $data['content']; ?></div>
|
5 |
+
</td>
|
6 |
+
</tr>
|
classes/shipping-method.php
CHANGED
@@ -5,6 +5,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
5 |
if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
|
6 |
class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
|
7 |
|
|
|
|
|
8 |
private $default_method = false;
|
9 |
|
10 |
private $message_added = false;
|
@@ -15,7 +17,7 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
|
|
15 |
* @access public
|
16 |
* @return void
|
17 |
*/
|
18 |
-
|
19 |
$this->instance_id = absint( $instance_id );
|
20 |
$this->id = 'flexible_shipping';
|
21 |
$this->shipping_methods_option = 'flexible_shipping_methods_' . $this->instance_id;
|
@@ -789,9 +791,12 @@ if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
|
|
789 |
*/
|
790 |
public function is_free_shipping( array $shipping_method_settings, $cart_contents_cost ) {
|
791 |
if ( isset( $shipping_method_settings[ self::FIELD_METHOD_FREE_SHIPPING ] ) && '' !== $shipping_method_settings[ self::FIELD_METHOD_FREE_SHIPPING ] ) {
|
792 |
-
|
793 |
-
|
794 |
-
|
|
|
|
|
|
|
795 |
}
|
796 |
return false;
|
797 |
}
|
5 |
if ( ! class_exists( 'WPDesk_Flexible_Shipping' ) ) {
|
6 |
class WPDesk_Flexible_Shipping extends WC_Shipping_Method {
|
7 |
|
8 |
+
const FIELD_METHOD_FREE_SHIPPING='method_free_shipping';
|
9 |
+
|
10 |
private $default_method = false;
|
11 |
|
12 |
private $message_added = false;
|
17 |
* @access public
|
18 |
* @return void
|
19 |
*/
|
20 |
+
public function __construct( $instance_id = 0 ) {
|
21 |
$this->instance_id = absint( $instance_id );
|
22 |
$this->id = 'flexible_shipping';
|
23 |
$this->shipping_methods_option = 'flexible_shipping_methods_' . $this->instance_id;
|
791 |
*/
|
792 |
public function is_free_shipping( array $shipping_method_settings, $cart_contents_cost ) {
|
793 |
if ( isset( $shipping_method_settings[ self::FIELD_METHOD_FREE_SHIPPING ] ) && '' !== $shipping_method_settings[ self::FIELD_METHOD_FREE_SHIPPING ] ) {
|
794 |
+
$shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] = trim( $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] );
|
795 |
+
if ( '0' !== $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] && is_numeric( $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] ) ) {
|
796 |
+
if ( apply_filters( 'flexible_shipping_value_in_currency', floatval( $shipping_method_settings[self::FIELD_METHOD_FREE_SHIPPING] ) ) <= floatval( $cart_contents_cost ) ) {
|
797 |
+
return true;
|
798 |
+
}
|
799 |
+
}
|
800 |
}
|
801 |
return false;
|
802 |
}
|
classes/tracker.php
CHANGED
@@ -1,253 +1,292 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
add_filter( self::PLUGIN_ACTION_LINKS_FILTER_NAME, array( $this, 'plugin_action_links' ) );
|
24 |
-
add_action( 'activated_plugin', array( $this, 'activated_plugin' ), 10, 2 );
|
25 |
-
}
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
$data['flexible_shipping']['free_shipping_requires'] = array();
|
44 |
-
$data['flexible_shipping']['calculation_methods'] = array();
|
45 |
-
$data['flexible_shipping']['based_on'] = array();
|
46 |
-
$data['flexible_shipping']['shipping_class_option'] = array();
|
47 |
-
$data['flexible_shipping']['method_description_count'] = 0;
|
48 |
-
$data['flexible_shipping']['free_shipping_label_count'] = 0;
|
49 |
-
$data['flexible_shipping']['max_cost_count'] = 0;
|
50 |
-
$data['flexible_shipping']['visibility_count'] = 0;
|
51 |
-
$data['flexible_shipping']['default_count'] = 0;
|
52 |
|
53 |
-
$data['flexible_shipping']['
|
|
|
|
|
|
|
54 |
|
55 |
-
$
|
56 |
-
|
|
|
57 |
|
58 |
-
$
|
59 |
-
|
60 |
-
|
61 |
-
foreach ( $flexible_shipping_rates as $flexible_shipping_rate ) {
|
62 |
|
63 |
-
|
|
|
|
|
64 |
|
65 |
-
|
|
|
|
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
|
71 |
-
|
72 |
-
|
|
|
73 |
}
|
74 |
-
|
75 |
-
$data['flexible_shipping']['integrations'][$flexible_shipping_rate['method_integration']] = 0;
|
76 |
-
}
|
77 |
-
$data['flexible_shipping']['integrations'][$flexible_shipping_rate['method_integration']]++;
|
78 |
|
79 |
-
if ( !empty( $
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
82 |
}
|
83 |
-
$data['flexible_shipping']['
|
84 |
}
|
85 |
|
86 |
-
if ( empty( $
|
87 |
-
$data['flexible_shipping']['
|
88 |
}
|
89 |
-
$data['flexible_shipping']['calculation_methods'][$flexible_shipping_rate['method_calculation_method']]++;
|
90 |
|
91 |
-
if ( !empty( $
|
92 |
-
$data['flexible_shipping']['
|
93 |
}
|
94 |
|
95 |
-
if ( !empty( $
|
96 |
-
$data['flexible_shipping']['
|
97 |
}
|
98 |
|
99 |
-
if ( !empty( $
|
100 |
-
$data['flexible_shipping']['
|
101 |
}
|
102 |
|
103 |
-
if ( !empty( $
|
104 |
-
$data['flexible_shipping']['
|
105 |
}
|
106 |
|
107 |
-
if ( !empty( $
|
108 |
-
$data['flexible_shipping']['
|
109 |
}
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
$data['flexible_shipping']['based_on'][$method_rule['based_on']] = 0;
|
114 |
-
}
|
115 |
-
$data['flexible_shipping']['based_on'][$method_rule['based_on']]++;
|
116 |
-
|
117 |
-
if ( !empty( $method_rule['shipping_class'] ) ) {
|
118 |
-
$shipping_class = $method_rule['shipping_class'];
|
119 |
-
if ( !in_array( $shipping_class, array( 'all', 'any', 'none' ) ) ) {
|
120 |
-
$shipping_class = 'shipping_class';
|
121 |
-
}
|
122 |
-
if ( empty( $data['flexible_shipping']['shipping_class_option'][$shipping_class] ) ) {
|
123 |
-
$data['flexible_shipping']['shipping_class_option'][$shipping_class] = 0;
|
124 |
-
}
|
125 |
-
$data['flexible_shipping']['shipping_class_option'][$shipping_class]++;
|
126 |
-
}
|
127 |
-
|
128 |
-
if ( !empty( $method_rule['cost_additional'] ) ) {
|
129 |
-
$data['flexible_shipping']['additional_cost_count']++;
|
130 |
-
}
|
131 |
-
|
132 |
-
if ( !empty( $method_rule['min'] ) ) {
|
133 |
-
$data['flexible_shipping']['min_count']++;
|
134 |
-
}
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
-
|
141 |
-
|
142 |
-
}
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
-
|
149 |
-
|
150 |
-
}
|
151 |
|
152 |
-
}
|
153 |
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
|
|
|
|
|
|
|
|
159 |
}
|
160 |
-
|
161 |
-
|
162 |
-
$current_screen = get_current_screen();
|
163 |
-
if ( $current_screen->id == 'woocommerce_page_wc-settings' ) {
|
164 |
-
if ( isset( $_GET['tab'] ) && $_GET['tab'] == 'shipping' ) {
|
165 |
-
$screens[] = $current_screen->id;
|
166 |
-
}
|
167 |
-
}
|
168 |
-
return $screens;
|
169 |
}
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
if ( !is_array( $options ) ) {
|
177 |
$options = array();
|
178 |
}
|
179 |
if ( empty( $options['wpdesk_tracker_agree'] ) ) {
|
180 |
$options['wpdesk_tracker_agree'] = '0';
|
181 |
}
|
182 |
-
$
|
183 |
-
if ( $options['wpdesk_tracker_agree']
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
$plugin_links[] = '<a href="' . $opt_in_link . '">' . __( 'Opt-out', 'flexible-shipping' ) . '</a>';
|
190 |
-
}
|
191 |
-
return array_merge( $plugin_links, $links );
|
192 |
-
}
|
193 |
-
|
194 |
-
|
195 |
-
public function activated_plugin( $plugin, $network_wide ) {
|
196 |
-
if ( $network_wide ) {
|
197 |
-
return;
|
198 |
-
}
|
199 |
-
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
200 |
-
return;
|
201 |
-
}
|
202 |
-
if ( !wpdesk_tracker_enabled() ) {
|
203 |
-
return;
|
204 |
-
}
|
205 |
-
if ( $plugin == 'flexible-shipping/flexible-shipping.php' ) {
|
206 |
-
$options = get_option('wpdesk_helper_options', array() );
|
207 |
-
if ( empty( $options ) ) {
|
208 |
-
$options = array();
|
209 |
-
}
|
210 |
-
if ( empty( $options['wpdesk_tracker_agree'] ) ) {
|
211 |
-
$options['wpdesk_tracker_agree'] = '0';
|
212 |
-
}
|
213 |
-
$wpdesk_tracker_skip_plugin = get_option( 'wpdesk_tracker_skip_flexible_shipping', '0' );
|
214 |
-
if ( $options['wpdesk_tracker_agree'] == '0' && $wpdesk_tracker_skip_plugin == '0' ) {
|
215 |
-
update_option( 'wpdesk_tracker_notice', '1' );
|
216 |
-
update_option( 'wpdesk_tracker_skip_flexible_shipping', '1' );
|
217 |
-
if ( !apply_filters( 'wpdesk_tracker_do_not_ask', false ) ) {
|
218 |
-
wp_redirect( admin_url( 'admin.php?page=wpdesk_tracker&plugin=flexible-shipping/flexible-shipping.php' ) );
|
219 |
-
exit;
|
220 |
-
}
|
221 |
}
|
222 |
}
|
223 |
}
|
224 |
-
|
225 |
-
|
226 |
}
|
227 |
|
228 |
}
|
229 |
|
230 |
-
if ( !function_exists( 'wpdesk_activated_plugin_activation_date' ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
function wpdesk_activated_plugin_activation_date( $plugin, $network_wide ) {
|
232 |
-
$option_name
|
233 |
$activation_date = get_option( $option_name, '' );
|
234 |
-
if ( $activation_date
|
235 |
$activation_date = current_time( 'mysql' );
|
236 |
update_option( $option_name, $activation_date );
|
237 |
}
|
238 |
}
|
|
|
239 |
add_action( 'activated_plugin', 'wpdesk_activated_plugin_activation_date', 10, 2 );
|
240 |
}
|
241 |
|
242 |
-
if ( !function_exists( 'wpdesk_tracker_enabled' ) ) {
|
|
|
|
|
|
|
|
|
|
|
243 |
function wpdesk_tracker_enabled() {
|
244 |
$tracker_enabled = true;
|
245 |
-
if ( !empty( $_SERVER['SERVER_ADDR'] ) &&
|
246 |
$tracker_enabled = false;
|
247 |
}
|
248 |
return apply_filters( 'wpdesk_tracker_enabled', $tracker_enabled );
|
249 |
-
// add_filter( 'wpdesk_tracker_enabled', '__return_true' );
|
250 |
-
// add_filter( 'wpdesk_tracker_do_not_ask', '__return_true' );
|
251 |
}
|
252 |
}
|
253 |
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Handle Tracker actions and filrers.
|
5 |
+
*
|
6 |
+
* Class WPDesk_Flexible_Shipping_Tracker
|
7 |
+
*/
|
8 |
+
class WPDesk_Flexible_Shipping_Tracker {
|
9 |
+
|
10 |
+
const PLUGIN_ACTION_LINKS_FILTER_NAME = 'plugin_action_links_flexible-shipping/flexible-shipping.php';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Hooks.
|
14 |
+
*/
|
15 |
+
public function hooks() {
|
16 |
+
add_filter( 'wpdesk_tracker_data', array( $this, 'wpdesk_tracker_data_flexible_shipping' ), 11 );
|
17 |
+
add_filter( 'wpdesk_tracker_notice_screens', array( $this, 'wpdesk_tracker_notice_screens' ) );
|
18 |
+
add_filter( 'wpdesk_track_plugin_deactivation', array( $this, 'wpdesk_track_plugin_deactivation' ) );
|
19 |
+
|
20 |
+
add_filter( self::PLUGIN_ACTION_LINKS_FILTER_NAME, array( $this, 'plugin_action_links' ) );
|
21 |
+
add_action( 'activated_plugin', array( $this, 'activated_plugin' ), 10, 2 );
|
22 |
+
}
|
|
|
|
|
|
|
23 |
|
24 |
+
/**
|
25 |
+
* Track plugin deactivation.
|
26 |
+
*
|
27 |
+
* @param array $plugins Plugins.
|
28 |
+
*
|
29 |
+
* @return mixed
|
30 |
+
*/
|
31 |
+
public function wpdesk_track_plugin_deactivation( $plugins ) {
|
32 |
+
$plugins['flexible-shipping/flexible-shipping.php'] = 'flexible-shipping/flexible-shipping.php';
|
33 |
+
|
34 |
+
return $plugins;
|
35 |
+
}
|
36 |
|
37 |
+
/**
|
38 |
+
* Append data.
|
39 |
+
*
|
40 |
+
* @param array $data Data.
|
41 |
+
*
|
42 |
+
* @return array
|
43 |
+
*/
|
44 |
+
public function wpdesk_tracker_data_flexible_shipping( $data ) {
|
45 |
+
$all_shipping_methods = flexible_shipping_get_all_shipping_methods();
|
46 |
+
|
47 |
+
$flexible_shipping = $all_shipping_methods['flexible_shipping'];
|
48 |
+
|
49 |
+
$flexible_shipping_rates = $flexible_shipping->get_all_rates();
|
50 |
+
$data['flexible_shipping'] = array();
|
51 |
+
$data['flexible_shipping']['total_shipping_methods'] = 0;
|
52 |
+
$data['flexible_shipping']['avg_rules'] = 0;
|
53 |
+
$data['flexible_shipping']['max_rules'] = 0;
|
54 |
+
$data['flexible_shipping']['integrations'] = array();
|
55 |
+
$data['flexible_shipping']['free_shipping_requires'] = array();
|
56 |
+
$data['flexible_shipping']['calculation_methods'] = array();
|
57 |
+
$data['flexible_shipping']['based_on'] = array();
|
58 |
+
$data['flexible_shipping']['shipping_class_option'] = array();
|
59 |
+
$data['flexible_shipping']['method_description_count'] = 0;
|
60 |
+
$data['flexible_shipping']['free_shipping_label_count'] = 0;
|
61 |
+
$data['flexible_shipping']['max_cost_count'] = 0;
|
62 |
+
$data['flexible_shipping']['visibility_count'] = 0;
|
63 |
+
$data['flexible_shipping']['default_count'] = 0;
|
64 |
+
|
65 |
+
$data['flexible_shipping']['additional_cost_count'] = 0;
|
66 |
+
|
67 |
+
$data['flexible_shipping']['min_count'] = 0;
|
68 |
+
$data['flexible_shipping']['max_count'] = 0;
|
69 |
+
|
70 |
+
$data['flexible_shipping']['cost_per_order_count'] = 0;
|
71 |
+
$data['flexible_shipping']['stop_count'] = 0;
|
72 |
+
$data['flexible_shipping']['cancel_count'] = 0;
|
73 |
+
foreach ( $flexible_shipping_rates as $flexible_shipping_rate ) {
|
74 |
+
|
75 |
+
$data['flexible_shipping']['total_shipping_methods'] ++;
|
76 |
+
|
77 |
+
$data['flexible_shipping']['avg_rules'] += count( $flexible_shipping_rate['method_rules'] );
|
78 |
+
|
79 |
+
if ( count( $flexible_shipping_rate['method_rules'] ) > $data['flexible_shipping']['max_rules'] ) {
|
80 |
+
$data['flexible_shipping']['max_rules'] = count( $flexible_shipping_rate['method_rules'] );
|
81 |
+
}
|
82 |
|
83 |
+
if ( empty( $flexible_shipping_rate['method_integration'] ) ) {
|
84 |
+
$flexible_shipping_rate['method_integration'] = 'none';
|
85 |
+
}
|
86 |
+
if ( empty( $data['flexible_shipping']['integrations'][ $flexible_shipping_rate['method_integration'] ] ) ) {
|
87 |
+
$data['flexible_shipping']['integrations'][ $flexible_shipping_rate['method_integration'] ] = 0;
|
88 |
+
}
|
89 |
+
$data['flexible_shipping']['integrations'][ $flexible_shipping_rate['method_integration'] ] ++;
|
90 |
|
91 |
+
if ( ! empty( $flexible_shipping_rate['method_free_shipping_requires'] ) ) {
|
92 |
+
if ( empty( $data['flexible_shipping']['free_shipping_requires'][ $flexible_shipping_rate['method_free_shipping_requires'] ] ) ) {
|
93 |
+
$data['flexible_shipping']['free_shipping_requires'][ $flexible_shipping_rate['method_free_shipping_requires'] ] = 0;
|
94 |
+
}
|
95 |
+
$data['flexible_shipping']['free_shipping_requires'][ $flexible_shipping_rate['method_free_shipping_requires'] ] ++;
|
96 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
+
if ( empty( $data['flexible_shipping']['calculation_methods'][ $flexible_shipping_rate['method_calculation_method'] ] ) ) {
|
99 |
+
$data['flexible_shipping']['calculation_methods'][ $flexible_shipping_rate['method_calculation_method'] ] = 0;
|
100 |
+
}
|
101 |
+
$data['flexible_shipping']['calculation_methods'][ $flexible_shipping_rate['method_calculation_method'] ] ++;
|
102 |
|
103 |
+
if ( ! empty( $flexible_shipping_rate['method_description'] ) ) {
|
104 |
+
$data['flexible_shipping']['method_description_count'] ++;
|
105 |
+
}
|
106 |
|
107 |
+
if ( ! empty( $flexible_shipping_rate['method_free_shipping_label'] ) ) {
|
108 |
+
$data['flexible_shipping']['free_shipping_label_count'] ++;
|
109 |
+
}
|
|
|
110 |
|
111 |
+
if ( ! empty( $flexible_shipping_rate['method_max_cost'] ) ) {
|
112 |
+
$data['flexible_shipping']['max_cost_count'] ++;
|
113 |
+
}
|
114 |
|
115 |
+
if ( ! empty( $flexible_shipping_rate['method_visibility'] ) && 'no' !== $flexible_shipping_rate['method_visibility'] ) {
|
116 |
+
$data['flexible_shipping']['visibility_count'] ++;
|
117 |
+
}
|
118 |
|
119 |
+
if ( ! empty( $flexible_shipping_rate['method_default'] ) && 'no' !== $flexible_shipping_rate['method_default'] ) {
|
120 |
+
$data['flexible_shipping']['default_count'] ++;
|
121 |
+
}
|
122 |
|
123 |
+
foreach ( $flexible_shipping_rate['method_rules'] as $method_rule ) {
|
124 |
+
if ( empty( $data['flexible_shipping']['based_on'][ $method_rule['based_on'] ] ) ) {
|
125 |
+
$data['flexible_shipping']['based_on'][ $method_rule['based_on'] ] = 0;
|
126 |
}
|
127 |
+
$data['flexible_shipping']['based_on'][ $method_rule['based_on'] ] ++;
|
|
|
|
|
|
|
128 |
|
129 |
+
if ( ! empty( $method_rule['shipping_class'] ) ) {
|
130 |
+
$shipping_class = $method_rule['shipping_class'];
|
131 |
+
if ( ! in_array( $shipping_class, array( 'all', 'any', 'none' ), true ) ) {
|
132 |
+
$shipping_class = 'shipping_class';
|
133 |
+
}
|
134 |
+
if ( empty( $data['flexible_shipping']['shipping_class_option'][ $shipping_class ] ) ) {
|
135 |
+
$data['flexible_shipping']['shipping_class_option'][ $shipping_class ] = 0;
|
136 |
}
|
137 |
+
$data['flexible_shipping']['shipping_class_option'][ $shipping_class ] ++;
|
138 |
}
|
139 |
|
140 |
+
if ( ! empty( $method_rule['cost_additional'] ) ) {
|
141 |
+
$data['flexible_shipping']['additional_cost_count'] ++;
|
142 |
}
|
|
|
143 |
|
144 |
+
if ( ! empty( $method_rule['min'] ) ) {
|
145 |
+
$data['flexible_shipping']['min_count'] ++;
|
146 |
}
|
147 |
|
148 |
+
if ( ! empty( $method_rule['max'] ) ) {
|
149 |
+
$data['flexible_shipping']['max_count'] ++;
|
150 |
}
|
151 |
|
152 |
+
if ( ! empty( $method_rule['cost_per_order'] ) ) {
|
153 |
+
$data['flexible_shipping']['cost_per_order_count'] ++;
|
154 |
}
|
155 |
|
156 |
+
if ( ! empty( $method_rule['stop'] ) ) {
|
157 |
+
$data['flexible_shipping']['stop_count'] ++;
|
158 |
}
|
159 |
|
160 |
+
if ( ! empty( $method_rule['cancel'] ) ) {
|
161 |
+
$data['flexible_shipping']['cancel_count'] ++;
|
162 |
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
if ( 0 !== intval( $data['flexible_shipping']['total_shipping_methods'] ) ) {
|
166 |
+
$data['flexible_shipping']['avg_rules'] = $data['flexible_shipping']['avg_rules'] / $data['flexible_shipping']['total_shipping_methods'];
|
167 |
+
}
|
168 |
|
169 |
+
return $data;
|
170 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
|
172 |
+
/**
|
173 |
+
* Tracker notice screens.
|
174 |
+
*
|
175 |
+
* @param array $screens Screens.
|
176 |
+
*
|
177 |
+
* @return array
|
178 |
+
*/
|
179 |
+
public function wpdesk_tracker_notice_screens( $screens ) {
|
180 |
+
$current_screen = get_current_screen();
|
181 |
+
if ( 'woocommerce_page_wc-settings' === $current_screen->id ) {
|
182 |
+
if ( isset( $_GET['tab'] ) && 'shipping' === $_GET['tab'] ) {
|
183 |
+
$screens[] = $current_screen->id;
|
184 |
+
}
|
185 |
+
}
|
186 |
|
187 |
+
return $screens;
|
188 |
+
}
|
|
|
189 |
|
190 |
+
/**
|
191 |
+
* Add action links.
|
192 |
+
*
|
193 |
+
* @param array $links Links.
|
194 |
+
*
|
195 |
+
* @return array
|
196 |
+
*/
|
197 |
+
public function plugin_action_links( $links ) {
|
198 |
+
if ( ! wpdesk_tracker_enabled() || apply_filters( 'wpdesk_tracker_do_not_ask', false ) ) {
|
199 |
+
return $links;
|
200 |
+
}
|
201 |
+
$options = get_option( 'wpdesk_helper_options', array() );
|
202 |
+
if ( ! is_array( $options ) ) {
|
203 |
+
$options = array();
|
204 |
+
}
|
205 |
+
if ( empty( $options['wpdesk_tracker_agree'] ) ) {
|
206 |
+
$options['wpdesk_tracker_agree'] = '0';
|
207 |
+
}
|
208 |
+
$plugin_links = array();
|
209 |
+
if ( '0' === $options['wpdesk_tracker_agree'] ) {
|
210 |
+
$opt_in_link = admin_url( 'admin.php?page=wpdesk_tracker&plugin=flexible-shipping/flexible-shipping.php' );
|
211 |
+
$plugin_links[] = '<a href="' . $opt_in_link . '">' . __( 'Opt-in', 'flexible-shipping' ) . '</a>';
|
212 |
+
} else {
|
213 |
+
$opt_in_link = admin_url( 'plugins.php?wpdesk_tracker_opt_out=1&plugin=flexible-shipping/flexible-shipping.php' );
|
214 |
+
$plugin_links[] = '<a href="' . $opt_in_link . '">' . __( 'Opt-out', 'flexible-shipping' ) . '</a>';
|
215 |
+
}
|
216 |
|
217 |
+
return array_merge( $plugin_links, $links );
|
218 |
+
}
|
|
|
219 |
|
|
|
220 |
|
221 |
+
/**
|
222 |
+
* Show tracker message after plugin activation.
|
223 |
+
*
|
224 |
+
* @param string $plugin Plugin name.
|
225 |
+
* @param bool $network_wide Network wide.
|
226 |
+
*/
|
227 |
+
public function activated_plugin( $plugin, $network_wide ) {
|
228 |
+
if ( $network_wide ) {
|
229 |
+
return;
|
230 |
}
|
231 |
+
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
232 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
}
|
234 |
+
if ( ! wpdesk_tracker_enabled() ) {
|
235 |
+
return;
|
236 |
+
}
|
237 |
+
if ( 'flexible-shipping/flexible-shipping.php' === $plugin ) {
|
238 |
+
$options = get_option( 'wpdesk_helper_options', array() );
|
239 |
+
if ( empty( $options ) ) {
|
|
|
240 |
$options = array();
|
241 |
}
|
242 |
if ( empty( $options['wpdesk_tracker_agree'] ) ) {
|
243 |
$options['wpdesk_tracker_agree'] = '0';
|
244 |
}
|
245 |
+
$wpdesk_tracker_skip_plugin = get_option( 'wpdesk_tracker_skip_flexible_shipping', '0' );
|
246 |
+
if ( '0' === $options['wpdesk_tracker_agree'] && '0' === $wpdesk_tracker_skip_plugin ) {
|
247 |
+
update_option( 'wpdesk_tracker_notice', '1' );
|
248 |
+
update_option( 'wpdesk_tracker_skip_flexible_shipping', '1' );
|
249 |
+
if ( ! apply_filters( 'wpdesk_tracker_do_not_ask', false ) ) {
|
250 |
+
wp_safe_redirect( admin_url( 'admin.php?page=wpdesk_tracker&plugin=flexible-shipping/flexible-shipping.php' ) );
|
251 |
+
exit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
}
|
253 |
}
|
254 |
}
|
|
|
|
|
255 |
}
|
256 |
|
257 |
}
|
258 |
|
259 |
+
if ( ! function_exists( 'wpdesk_activated_plugin_activation_date' ) ) {
|
260 |
+
/**
|
261 |
+
* Track plugin activation date.
|
262 |
+
*
|
263 |
+
* @param string $plugin Plugin name.
|
264 |
+
* @param bool $network_wide Network wide.
|
265 |
+
*/
|
266 |
function wpdesk_activated_plugin_activation_date( $plugin, $network_wide ) {
|
267 |
+
$option_name = 'plugin_activation_' . $plugin;
|
268 |
$activation_date = get_option( $option_name, '' );
|
269 |
+
if ( '' === $activation_date ) {
|
270 |
$activation_date = current_time( 'mysql' );
|
271 |
update_option( $option_name, $activation_date );
|
272 |
}
|
273 |
}
|
274 |
+
|
275 |
add_action( 'activated_plugin', 'wpdesk_activated_plugin_activation_date', 10, 2 );
|
276 |
}
|
277 |
|
278 |
+
if ( ! function_exists( 'wpdesk_tracker_enabled' ) ) {
|
279 |
+
/**
|
280 |
+
* Disable tracker on localhost.
|
281 |
+
*
|
282 |
+
* @return bool
|
283 |
+
*/
|
284 |
function wpdesk_tracker_enabled() {
|
285 |
$tracker_enabled = true;
|
286 |
+
if ( ! empty( $_SERVER['SERVER_ADDR'] ) && '127.0.0.1' === $_SERVER['SERVER_ADDR'] ) {
|
287 |
$tracker_enabled = false;
|
288 |
}
|
289 |
return apply_filters( 'wpdesk_tracker_enabled', $tracker_enabled );
|
|
|
|
|
290 |
}
|
291 |
}
|
292 |
|
flexible-shipping.php
CHANGED
@@ -3,13 +3,13 @@
|
|
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.
|
7 |
Author: WP Desk
|
8 |
Author URI: https://www.wpdesk.net/
|
9 |
Text Domain: flexible-shipping
|
10 |
Domain Path: /lang/
|
11 |
Requires at least: 4.5
|
12 |
-
Tested up to: 5.0.
|
13 |
WC requires at least: 3.0.0
|
14 |
WC tested up to: 3.5.2
|
15 |
|
@@ -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.
|
47 |
$plugin_release_timestamp = '2018-11-28';
|
48 |
|
49 |
$plugin_name = 'Flexible Shipping';
|
@@ -61,8 +61,6 @@ $requirements_checker = new WPDesk_Basic_Requirement_Checker(
|
|
61 |
'4.5'
|
62 |
);
|
63 |
$requirements_checker->add_plugin_require( 'woocommerce/woocommerce.php', 'Woocommerce' );
|
64 |
-
//$requirements_checker->add_php_module_require( 'intl', 'Internationalization Functions (intl)' );
|
65 |
-
|
66 |
|
67 |
if ( $requirements_checker->are_requirements_met() ) {
|
68 |
if ( ! class_exists( 'WPDesk_Plugin_Info' ) ) {
|
@@ -84,3 +82,7 @@ if ( $requirements_checker->are_requirements_met() ) {
|
|
84 |
} else {
|
85 |
$requirements_checker->disable_plugin_render_notice();
|
86 |
}
|
|
|
|
|
|
|
|
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
|
7 |
Author: WP Desk
|
8 |
Author URI: https://www.wpdesk.net/
|
9 |
Text Domain: flexible-shipping
|
10 |
Domain Path: /lang/
|
11 |
Requires at least: 4.5
|
12 |
+
Tested up to: 5.0.1
|
13 |
WC requires at least: 3.0.0
|
14 |
WC tested up to: 3.5.2
|
15 |
|
43 |
|
44 |
|
45 |
/* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */
|
46 |
+
$plugin_version = '3.1';
|
47 |
$plugin_release_timestamp = '2018-11-28';
|
48 |
|
49 |
$plugin_name = 'Flexible Shipping';
|
61 |
'4.5'
|
62 |
);
|
63 |
$requirements_checker->add_plugin_require( 'woocommerce/woocommerce.php', 'Woocommerce' );
|
|
|
|
|
64 |
|
65 |
if ( $requirements_checker->are_requirements_met() ) {
|
66 |
if ( ! class_exists( 'WPDesk_Plugin_Info' ) ) {
|
82 |
} else {
|
83 |
$requirements_checker->disable_plugin_render_notice();
|
84 |
}
|
85 |
+
|
86 |
+
require_once 'classes/tracker.php';
|
87 |
+
$tracker = new WPDesk_Flexible_Shipping_Tracker();
|
88 |
+
$tracker->hooks();
|
lang/flexible-shipping-pl_PL.mo
CHANGED
Binary file
|
lang/flexible-shipping-pl_PL.po
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Flexible Shipping\n"
|
4 |
-
"POT-Creation-Date: 2018-12-
|
5 |
-
"PO-Revision-Date: 2018-12-
|
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"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 2.
|
13 |
"X-Poedit-Basepath: ..\n"
|
14 |
"X-Poedit-WPHeader: flexible-shipping.php\n"
|
15 |
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
|
@@ -20,7 +20,7 @@ msgstr ""
|
|
20 |
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
21 |
"X-Poedit-SearchPath-0: .\n"
|
22 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
23 |
-
"X-Poedit-SearchPathExcluded-1:
|
24 |
|
25 |
#: classes/admin-notices.php:164
|
26 |
#, php-format
|
@@ -84,9 +84,6 @@ msgid "Failed"
|
|
84 |
msgstr "Błąd"
|
85 |
|
86 |
#: classes/bulk-actions.php:196 classes/bulk-actions.php:226
|
87 |
-
#: vendor/wpdesk/wp-settings/source/modules/licensing/S214_Plugin_Updater.php:340
|
88 |
-
#: vendor/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php:197
|
89 |
-
#: vendor/wpdesk/wp-settings/source/modules/licensing/class.s214-license.php:270
|
90 |
msgid "Error"
|
91 |
msgstr "Błąd"
|
92 |
|
@@ -178,22 +175,19 @@ msgstr ""
|
|
178 |
msgid "Bulk shipping manifest - processed orders: %d"
|
179 |
msgstr "Zbiorcze tworzenie protokołów nadania - przetworzone zamówienia: %d"
|
180 |
|
181 |
-
#: classes/class-flexible-shipping-plugin.php:
|
182 |
-
#: vendor/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php:147
|
183 |
msgid "Settings"
|
184 |
msgstr "Ustawienia"
|
185 |
|
186 |
-
#: classes/class-flexible-shipping-plugin.php:
|
187 |
-
#: vendor/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php:140
|
188 |
msgid "Docs"
|
189 |
msgstr "Docs"
|
190 |
|
191 |
-
#: classes/class-flexible-shipping-plugin.php:
|
192 |
-
#: vendor/wpdesk/wp-builder/src/Plugin/AbstractPlugin.php:134
|
193 |
msgid "Support"
|
194 |
msgstr "Wsparcie"
|
195 |
|
196 |
-
#: classes/class-flexible-shipping-plugin.php:
|
197 |
msgid "Upgrade"
|
198 |
msgstr "Kup PRO"
|
199 |
|
@@ -224,18 +218,14 @@ msgid "Insufficient privileges!"
|
|
224 |
msgstr "Niewystarczające uprawnienia!"
|
225 |
|
226 |
#: classes/logger/class-saas-logger-settings.php:95
|
227 |
-
msgid "Advanced settings"
|
228 |
-
msgstr "Ustawienia zaawansowane"
|
229 |
-
|
230 |
-
#: classes/logger/class-saas-logger-settings.php:99
|
231 |
msgid "Enable Debug Mode"
|
232 |
msgstr "Włącz tryb debug"
|
233 |
|
234 |
-
#: classes/logger/class-saas-logger-settings.php:
|
235 |
msgid "Debug mode"
|
236 |
msgstr "Tryb debug"
|
237 |
|
238 |
-
#: classes/logger/class-saas-logger-settings.php:
|
239 |
#, php-format
|
240 |
msgid "%1$sDownload debug.log file%2$s"
|
241 |
msgstr "%1$sPobierz plik debug.log%2$s"
|
@@ -357,11 +347,11 @@ msgstr "Zamówienie"
|
|
357 |
|
358 |
#. Plugin Name of the plugin/theme
|
359 |
#: classes/multilingual.php:44 classes/multilingual.php:47
|
360 |
-
#: classes/multilingual.php:50 classes/saas/class-saas-settings.php:
|
361 |
#: classes/settings/flexible-shipping.php:16
|
362 |
#: classes/settings/flexible-shipping.php:30
|
363 |
-
#: classes/settings/shipping-method-form.php:79 classes/shipping-method.php:
|
364 |
-
#: classes/shipping-method.php:
|
365 |
msgid "Flexible Shipping"
|
366 |
msgstr "Flexible Shipping"
|
367 |
|
@@ -374,6 +364,19 @@ msgstr ""
|
|
374 |
"Wprowadzony klucz Connect jest nieprawidłowy. Proszę wprowadzić prawidłowy "
|
375 |
"klucz. %1$sPobierz swój klucz Connect →%2$s"
|
376 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
#: classes/saas/class-saas-connection-status-ajax.php:55
|
378 |
msgid "Something go wrong!"
|
379 |
msgstr "Coś poszło nie tak!"
|
@@ -499,6 +502,11 @@ msgstr "%1$s (stawka awaryjna)"
|
|
499 |
msgid "Flexible Shipping Fallback: %1$s"
|
500 |
msgstr "Stawka awaryjna Flexible Shipping: %1$s"
|
501 |
|
|
|
|
|
|
|
|
|
|
|
502 |
#: classes/saas/class-saas-settings-service-checkbox.php:78
|
503 |
msgid "Invalid requireWordpressPluginVersion capability!"
|
504 |
msgstr "Invalid requireWordpressPluginVersion capability!"
|
@@ -520,15 +528,11 @@ msgstr "Przejdź do ustawień %s</a>"
|
|
520 |
msgid "%1$s%2$s (new)%3$s"
|
521 |
msgstr "%1$s%2$s (nowość)%3$s"
|
522 |
|
523 |
-
#: classes/saas/class-saas-settings
|
524 |
-
msgid "Enable"
|
525 |
-
msgstr "Włącz"
|
526 |
-
|
527 |
-
#: classes/saas/class-saas-settings.php:213
|
528 |
msgid "Connect Services"
|
529 |
msgstr "Usługi Connect"
|
530 |
|
531 |
-
#: classes/saas/class-saas-settings.php:
|
532 |
msgid ""
|
533 |
"Enable services to automate shipping and print labels with Flexible Shipping "
|
534 |
"Connect."
|
@@ -536,6 +540,10 @@ msgstr ""
|
|
536 |
"Włącz usługi, aby automatyzować wysyłkę i pobierać etykiety dzięki Flexible "
|
537 |
"Shipping Connect."
|
538 |
|
|
|
|
|
|
|
|
|
539 |
#: classes/saas/class-saas-shipment-order-auto-complete.php:59
|
540 |
msgid "Order status changed automatically by Flexible Shipping Plugin."
|
541 |
msgstr ""
|
@@ -645,7 +653,7 @@ msgstr ""
|
|
645 |
msgid "You need to configure the service. %1$sGo to %2$s settings.%3$s"
|
646 |
msgstr "Musisz skonfigurować usługę. %1$sPrzejdź do %2$s ustawień.%3$s"
|
647 |
|
648 |
-
#: classes/saas/class-saas-shipping-services-manager.php:
|
649 |
#, php-format
|
650 |
msgid "%1$sYour settings have been saved.%2$s"
|
651 |
msgstr "%1$sUstawienia zostały zapisane.%2$s"
|
@@ -691,7 +699,16 @@ msgstr ""
|
|
691 |
"zarejestrować swoją domenę za pomocą jednego konta. Jeśli masz pytania, "
|
692 |
"%2$sskontaktuj się z nami%3$s."
|
693 |
|
694 |
-
#: classes/saas/class-saas-user-registration.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
695 |
#, php-format
|
696 |
msgid ""
|
697 |
"Account with this email is already registered! We emailed your Connect Key "
|
@@ -702,7 +719,7 @@ msgstr ""
|
|
702 |
"kluczem Connect do %1$s.<br>Wpisz klucz %2$stutaj%4$s. Możesz również "
|
703 |
"uzyskać klucz logując się na %3$sswoje konto%4$s."
|
704 |
|
705 |
-
#: classes/saas/class-saas-user-registration.php:
|
706 |
#, php-format
|
707 |
msgid "Unknown response code from Flexible Shipping Connect API (%s)."
|
708 |
msgstr "Nieznany kod odpowiedzi z API Flexible Shipping Connect (%s)."
|
@@ -900,6 +917,15 @@ msgstr "Rozpocznij przewodnik"
|
|
900 |
msgid "Next feature"
|
901 |
msgstr "Następna funkcja"
|
902 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
903 |
#: classes/saas/views/html-order-fallback-message.php:1
|
904 |
msgid "Fallback:"
|
905 |
msgstr "Stawka awaryjna:"
|
@@ -1006,7 +1032,7 @@ msgid "See how to %sconfigure Flexible Shipping%s."
|
|
1006 |
msgstr "Zobacz jak %sskonfigurować Flexible Shipping%s."
|
1007 |
|
1008 |
#: classes/settings/flexible-shipping.php:21
|
1009 |
-
#: classes/settings/shipping-method-form.php:70 classes/shipping-method.php:
|
1010 |
msgid "Enable/Disable"
|
1011 |
msgstr "Włącz/Wyłącz"
|
1012 |
|
@@ -1072,11 +1098,11 @@ msgstr ""
|
|
1072 |
"Wysyłaj zamówienia szybciej z %1$sFlexible Shipping Connect%2$s%3$s"
|
1073 |
"%4$sZarejestruj się teraz!%5$s"
|
1074 |
|
1075 |
-
#: classes/settings/shipping-method-form.php:54 classes/shipping-method.php:
|
1076 |
msgid "Free"
|
1077 |
msgstr "Bezpłatnie"
|
1078 |
|
1079 |
-
#: classes/settings/shipping-method-form.php:73 classes/shipping-method.php:
|
1080 |
msgid "Enable this shipment method"
|
1081 |
msgstr "Włącz tę metodę wysyłki"
|
1082 |
|
@@ -1084,7 +1110,7 @@ msgstr "Włącz tę metodę wysyłki"
|
|
1084 |
msgid "Method Title"
|
1085 |
msgstr "Tytuł metody"
|
1086 |
|
1087 |
-
#: classes/settings/shipping-method-form.php:78 classes/shipping-method.php:
|
1088 |
msgid "This controls the title which the user sees during checkout."
|
1089 |
msgstr "Tytuł, który widzi użytkownik podczas składania zamówienia."
|
1090 |
|
@@ -1378,108 +1404,108 @@ msgstr "%1$sKoszt przesyłki:%2$s %3$s"
|
|
1378 |
msgid "%1$sShipment status:%2$s %3$s"
|
1379 |
msgstr "%1$s Status przesyłki: %2$s %3$s"
|
1380 |
|
1381 |
-
#: classes/shipping-method.php:
|
1382 |
msgid "Shipping Title"
|
1383 |
msgstr "Tytuł"
|
1384 |
|
1385 |
-
#: classes/shipping-method.php:
|
1386 |
#: classes/views/html-shipping-method-rules.php:240
|
1387 |
msgid "Add New"
|
1388 |
msgstr "Dodaj nową"
|
1389 |
|
1390 |
-
#: classes/shipping-method.php:
|
1391 |
msgid ""
|
1392 |
"Sorry, there has been an error. The CSV is invalid or incorrect file type."
|
1393 |
msgstr ""
|
1394 |
"Przepraszamy, wystąpił błąd. Plik CSV jest niepoprawny lub typ pliku jest "
|
1395 |
"nieprawidłowy."
|
1396 |
|
1397 |
-
#: classes/shipping-method.php:
|
1398 |
msgid "import"
|
1399 |
msgstr "import"
|
1400 |
|
1401 |
-
#: classes/shipping-method.php:
|
1402 |
#, php-format
|
1403 |
msgid "Free Shipping value %s is not valid number. Row number %d."
|
1404 |
msgstr "Wartość darmowej wysyłki %s jest niepoprawna. Numer wiersza %d."
|
1405 |
|
1406 |
-
#: classes/shipping-method.php:
|
1407 |
#, php-format
|
1408 |
msgid "Maximum Cost value %s is not valid number. Row number %d."
|
1409 |
msgstr "Maksymalny koszt %s jest niepoprawny. Numer wiersza %d."
|
1410 |
|
1411 |
-
#: classes/shipping-method.php:
|
1412 |
#, php-format
|
1413 |
msgid "Invalid value for Calculation Method in row number %d."
|
1414 |
msgstr "Nieprawidłowa wartość dla Metody obliczania w wierszu %d."
|
1415 |
|
1416 |
-
#: classes/shipping-method.php:
|
1417 |
#, php-format
|
1418 |
msgid "Invalid value for Based On in row number %d."
|
1419 |
msgstr "Nieprawidłowa wartość dla Oparte na w wierszu %d."
|
1420 |
|
1421 |
-
#: classes/shipping-method.php:
|
1422 |
#, php-format
|
1423 |
msgid "Min value %s is not valid number. Row number %d."
|
1424 |
msgstr "Wartość Min %s jest niepoprawna. Numer wiersza %d."
|
1425 |
|
1426 |
-
#: classes/shipping-method.php:
|
1427 |
#, php-format
|
1428 |
msgid "Max value %s is not valid number. Row number %d."
|
1429 |
msgstr "Wartość Maks %s jest niepoprawna. Numer wiersza %d."
|
1430 |
|
1431 |
-
#: classes/shipping-method.php:
|
1432 |
#, php-format
|
1433 |
msgid "Cost per order value %s is not valid number. Row number %d."
|
1434 |
msgstr "Wartość Koszt na zamówienie %s jest niepoprawna. Numer wiersza %d."
|
1435 |
|
1436 |
-
#: classes/shipping-method.php:
|
1437 |
#, php-format
|
1438 |
msgid "Additional cost value %s is not valid number. Row number %d."
|
1439 |
msgstr "Wartość Dodatkowy koszt %s jest niepoprawna. Numer wiersza %d."
|
1440 |
|
1441 |
-
#: classes/shipping-method.php:
|
1442 |
#, php-format
|
1443 |
msgid "Value value %s is not valid number. Row number %d."
|
1444 |
msgstr "Wartość w polu Wartość %s jest niepoprawna. Numer wiersza %d."
|
1445 |
|
1446 |
-
#: classes/shipping-method.php:
|
1447 |
#, php-format
|
1448 |
msgid "Shipping method %s imported as %s."
|
1449 |
msgstr "Metoda wysyłki %s została zaimportowana jako %s."
|
1450 |
|
1451 |
-
#: classes/shipping-method.php:
|
1452 |
msgid "New Shipping Method"
|
1453 |
msgstr "Nowa metoda wysyłki"
|
1454 |
|
1455 |
-
#: classes/shipping-method.php:
|
1456 |
msgid "Edit Shipping Method"
|
1457 |
msgstr "Edytuj metodę wysyłki"
|
1458 |
|
1459 |
-
#: classes/shipping-method.php:
|
1460 |
#, php-format
|
1461 |
msgid "Shipping method %s added."
|
1462 |
msgstr "Metoda wysyłki dodana: %s."
|
1463 |
|
1464 |
-
#: classes/shipping-method.php:
|
1465 |
#, php-format
|
1466 |
msgid "Shipping method %s deleted."
|
1467 |
msgstr "Metoda wysyłki usunięta: %s."
|
1468 |
|
1469 |
-
#: classes/shipping-method.php:
|
1470 |
msgid "Shipping method not found."
|
1471 |
msgstr "Metoda wysyłki nie znaleziona."
|
1472 |
|
1473 |
-
#: classes/shipping-method.php:
|
1474 |
#, php-format
|
1475 |
msgid "Shipping method %s updated."
|
1476 |
msgstr "Metoda wysyłki zaktualizowana: %s."
|
1477 |
|
1478 |
-
#: classes/tracker.php:
|
1479 |
msgid "Opt-in"
|
1480 |
msgstr "Opt-in"
|
1481 |
|
1482 |
-
#: classes/tracker.php:
|
1483 |
msgid "Opt-out"
|
1484 |
msgstr "Opt-out"
|
1485 |
|
@@ -1831,209 +1857,161 @@ msgstr ""
|
|
1831 |
msgid "Track shipment: "
|
1832 |
msgstr "Śledź przesyłkę: "
|
1833 |
|
1834 |
-
|
1835 |
-
msgid "
|
1836 |
-
msgstr "
|
1837 |
-
|
1838 |
-
#: vendor/10up/wp_mock/tests/FunctionMocksTest.php:75
|
1839 |
-
#: vendor/10up/wp_mock/tests/FunctionMocksTest.php:77
|
1840 |
-
msgid "Input"
|
1841 |
-
msgstr "Input"
|
1842 |
|
1843 |
-
|
1844 |
-
#, php-format
|
1845 |
msgid ""
|
1846 |
-
"
|
1847 |
-
"
|
1848 |
msgstr ""
|
1849 |
-
"
|
1850 |
-
"
|
1851 |
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
"The “%s” plugin cannot run on WordPress versions older than %s. "
|
1856 |
-
"Please update WordPress."
|
1857 |
-
msgstr ""
|
1858 |
-
"Wtyczka “%s” nie może działać w wersjach WordPress starszych niż "
|
1859 |
-
"%s. Prosimy o aktualizację WordPress."
|
1860 |
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
"The “%s” plugin cannot run on WooCommerce versions older than "
|
1865 |
-
"%s. Please update WooCommerce."
|
1866 |
-
msgstr ""
|
1867 |
-
"Wtyczka “%s” nie może działać w wersjach WooCommerce starszych "
|
1868 |
-
"niż %s. Prosimy o aktualizację WooCommerce."
|
1869 |
|
1870 |
-
|
1871 |
-
|
1872 |
-
msgid ""
|
1873 |
-
"The “%s” plugin cannot run without OpenSSL module version at "
|
1874 |
-
"least %s. Please update OpenSSL module."
|
1875 |
-
msgstr ""
|
1876 |
-
"Wtyczka “%s” nie może działać bez aktywacji OpenSSL co najmniej "
|
1877 |
-
"w wersji %s. Zaktualizuj wersję OpenSSL."
|
1878 |
|
1879 |
-
|
1880 |
-
|
1881 |
-
msgid ""
|
1882 |
-
"The “%s” plugin cannot run without %s active. Please install and "
|
1883 |
-
"activate %s plugin."
|
1884 |
-
msgstr ""
|
1885 |
-
"Wtyczka “%s” nie może działać bez aktywacji %s. Zainstaluj i "
|
1886 |
-
"aktywuj wtyczkę %s."
|
1887 |
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
"
|
1893 |
-
|
1894 |
-
"Wtyczka “%s” nie może działać bez modułu php: %s. Skontaktuj się "
|
1895 |
-
"z administratorem hostingu i poproś o instalację %s."
|
1896 |
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
"
|
1902 |
-
|
1903 |
-
"Wtyczka “%s” nie może działać bez ustawienia php %s ustawionego "
|
1904 |
-
"na %s. Skontaktuj się z administratorem hostingu i poproś o ustawienie %s."
|
1905 |
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
|
|
|
|
|
|
1916 |
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
"
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
|
|
|
|
|
|
|
|
|
|
1925 |
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
msgstr "
|
|
|
|
|
|
|
1930 |
|
1931 |
-
|
1932 |
-
|
1933 |
-
msgid "Upload File"
|
1934 |
-
msgstr "Dodaj plik"
|
1935 |
|
1936 |
-
|
1937 |
-
|
1938 |
-
msgid "Deactivate License"
|
1939 |
-
msgstr "Dezaktywuj licencję"
|
1940 |
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
"
|
1947 |
|
1948 |
-
|
1949 |
-
|
1950 |
-
msgid "Insert Image"
|
1951 |
-
msgstr "Wstaw obrazek"
|
1952 |
|
1953 |
-
|
1954 |
-
|
1955 |
-
msgid "Select Image"
|
1956 |
-
msgstr "Wybierz obrazek"
|
1957 |
|
1958 |
-
|
1959 |
-
|
1960 |
-
msgid ""
|
1961 |
-
"There is a new version of %1$s available. %2$sView version %3$s details%4$s."
|
1962 |
-
msgstr "Dostępna jest nowa wersja %1$s. %2$s Pokaż %3$s szczegóły wersji %4$s."
|
1963 |
|
1964 |
-
|
1965 |
-
|
1966 |
-
|
1967 |
-
"
|
1968 |
-
"or %5$supdate now%6$s."
|
1969 |
-
msgstr ""
|
1970 |
-
"Jest dostępna nowa wersja %1$s. %2$s Zobacz szczegóły wersji %3$s %4$s lub "
|
1971 |
-
"%5$s zaktualizuj %6$s."
|
1972 |
|
1973 |
-
|
1974 |
-
|
1975 |
-
msgstr "Nie masz uprawnień do instalacji aktualizacji wtyczki"
|
1976 |
|
1977 |
-
|
1978 |
-
|
1979 |
-
msgstr "Licencje"
|
1980 |
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
msgstr "
|
|
|
1985 |
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
"
|
|
|
1991 |
|
1992 |
-
|
1993 |
-
|
1994 |
-
msgid "Nonce verification failed"
|
1995 |
-
msgstr "Błąd zabepieczeń (nonce)"
|
1996 |
|
1997 |
-
|
1998 |
-
|
1999 |
-
msgstr "Klucz licencyjny który wpisałeś nie należy do tego produktu."
|
2000 |
|
2001 |
-
|
2002 |
-
|
2003 |
-
msgstr "Licencja nie posiada już wolnych aktywacji"
|
2004 |
|
2005 |
-
|
2006 |
-
|
2007 |
-
msgstr "
|
|
|
|
|
2008 |
|
2009 |
-
|
2010 |
-
|
2011 |
-
msgid ""
|
2012 |
-
"There was a problem activating your license key, please try again or contact "
|
2013 |
-
"support. Error code: %s"
|
2014 |
-
msgstr ""
|
2015 |
-
"Pojawił się problem z aktywacją klucza licencyjnego. Proszę spróbuj ponownie "
|
2016 |
-
"lub skontaktuj się z naszym wsparciem. Kod błędu: %s"
|
2017 |
|
2018 |
-
|
2019 |
-
|
2020 |
-
msgstr "https://pl.wordpress.org/plugins/flexible-shipping/"
|
2021 |
|
2022 |
-
|
2023 |
-
|
2024 |
-
"Create additional shipment methods in WooCommerce and enable pricing based "
|
2025 |
-
"on cart weight or total."
|
2026 |
-
msgstr ""
|
2027 |
-
"Stwórz dodatkowe metody wysyłki w WooCommerce i włącz obliczanie kosztów w "
|
2028 |
-
"oparciu o wagę lub wartość zamówienia."
|
2029 |
|
2030 |
-
|
2031 |
-
|
2032 |
-
msgstr "WP Desk"
|
2033 |
|
2034 |
-
|
2035 |
-
|
2036 |
-
|
|
|
|
|
|
|
2037 |
|
2038 |
#~ msgid ""
|
2039 |
#~ "The %s%s%s License Key has not been activated, so the plugin is inactive! "
|
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"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 2.2\n"
|
13 |
"X-Poedit-Basepath: ..\n"
|
14 |
"X-Poedit-WPHeader: flexible-shipping.php\n"
|
15 |
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
|
20 |
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
21 |
"X-Poedit-SearchPath-0: .\n"
|
22 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
23 |
+
"X-Poedit-SearchPathExcluded-1: vendor\n"
|
24 |
|
25 |
#: classes/admin-notices.php:164
|
26 |
#, php-format
|
84 |
msgstr "Błąd"
|
85 |
|
86 |
#: classes/bulk-actions.php:196 classes/bulk-actions.php:226
|
|
|
|
|
|
|
87 |
msgid "Error"
|
88 |
msgstr "Błąd"
|
89 |
|
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 |
|
218 |
msgstr "Niewystarczające uprawnienia!"
|
219 |
|
220 |
#: classes/logger/class-saas-logger-settings.php:95
|
|
|
|
|
|
|
|
|
221 |
msgid "Enable Debug Mode"
|
222 |
msgstr "Włącz tryb debug"
|
223 |
|
224 |
+
#: classes/logger/class-saas-logger-settings.php:96
|
225 |
msgid "Debug mode"
|
226 |
msgstr "Tryb debug"
|
227 |
|
228 |
+
#: classes/logger/class-saas-logger-settings.php:103
|
229 |
#, php-format
|
230 |
msgid "%1$sDownload debug.log file%2$s"
|
231 |
msgstr "%1$sPobierz plik debug.log%2$s"
|
347 |
|
348 |
#. Plugin Name of the plugin/theme
|
349 |
#: classes/multilingual.php:44 classes/multilingual.php:47
|
350 |
+
#: classes/multilingual.php:50 classes/saas/class-saas-settings.php:77
|
351 |
#: classes/settings/flexible-shipping.php:16
|
352 |
#: classes/settings/flexible-shipping.php:30
|
353 |
+
#: classes/settings/shipping-method-form.php:79 classes/shipping-method.php:26
|
354 |
+
#: classes/shipping-method.php:27 classes/shipping-method.php:45
|
355 |
msgid "Flexible Shipping"
|
356 |
msgstr "Flexible Shipping"
|
357 |
|
364 |
"Wprowadzony klucz Connect jest nieprawidłowy. Proszę wprowadzić prawidłowy "
|
365 |
"klucz. %1$sPobierz swój klucz Connect →%2$s"
|
366 |
|
367 |
+
#: classes/saas/class-saas-cache-settings.php:67
|
368 |
+
#: classes/saas/class-saas-settings-service-checkbox.php:127
|
369 |
+
msgid "Enable"
|
370 |
+
msgstr "Włącz"
|
371 |
+
|
372 |
+
#: classes/saas/class-saas-cache-settings.php:68
|
373 |
+
msgid "Cache"
|
374 |
+
msgstr "Cache"
|
375 |
+
|
376 |
+
#: classes/saas/class-saas-cache-settings.php:69
|
377 |
+
msgid "Enables Flexible Shipping Connect cache. Disable only for debugging."
|
378 |
+
msgstr "Włącza cache Flexible Shipping Connect. Wyłącz tylko do debugowania."
|
379 |
+
|
380 |
#: classes/saas/class-saas-connection-status-ajax.php:55
|
381 |
msgid "Something go wrong!"
|
382 |
msgstr "Coś poszło nie tak!"
|
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!"
|
512 |
msgstr "Invalid requireWordpressPluginVersion capability!"
|
528 |
msgid "%1$s%2$s (new)%3$s"
|
529 |
msgstr "%1$s%2$s (nowość)%3$s"
|
530 |
|
531 |
+
#: classes/saas/class-saas-settings.php:241
|
|
|
|
|
|
|
|
|
532 |
msgid "Connect Services"
|
533 |
msgstr "Usługi Connect"
|
534 |
|
535 |
+
#: classes/saas/class-saas-settings.php:242
|
536 |
msgid ""
|
537 |
"Enable services to automate shipping and print labels with Flexible Shipping "
|
538 |
"Connect."
|
540 |
"Włącz usługi, aby automatyzować wysyłkę i pobierać etykiety dzięki Flexible "
|
541 |
"Shipping Connect."
|
542 |
|
543 |
+
#: classes/saas/class-saas-settings.php:291
|
544 |
+
msgid "Advanced settings"
|
545 |
+
msgstr "Ustawienia zaawansowane"
|
546 |
+
|
547 |
#: classes/saas/class-saas-shipment-order-auto-complete.php:59
|
548 |
msgid "Order status changed automatically by Flexible Shipping Plugin."
|
549 |
msgstr ""
|
653 |
msgid "You need to configure the service. %1$sGo to %2$s settings.%3$s"
|
654 |
msgstr "Musisz skonfigurować usługę. %1$sPrzejdź do %2$s ustawień.%3$s"
|
655 |
|
656 |
+
#: classes/saas/class-saas-shipping-services-manager.php:152
|
657 |
#, php-format
|
658 |
msgid "%1$sYour settings have been saved.%2$s"
|
659 |
msgstr "%1$sUstawienia zostały zapisane.%2$s"
|
699 |
"zarejestrować swoją domenę za pomocą jednego konta. Jeśli masz pytania, "
|
700 |
"%2$sskontaktuj się z nami%3$s."
|
701 |
|
702 |
+
#: classes/saas/class-saas-user-registration.php:271
|
703 |
+
#, php-format
|
704 |
+
msgid ""
|
705 |
+
"Our demo does not support Flexible Shipping Connect registration. Try FS "
|
706 |
+
"Connect for free. %1$sCheck now →%2$s"
|
707 |
+
msgstr ""
|
708 |
+
"Nasze demo nie obsługuje rejestracji Flexible Shipping Connect. Wypróbuj FS "
|
709 |
+
"Connect za darmo. %1$sSprawdź teraz →%2$s"
|
710 |
+
|
711 |
+
#: classes/saas/class-saas-user-registration.php:298
|
712 |
#, php-format
|
713 |
msgid ""
|
714 |
"Account with this email is already registered! We emailed your Connect Key "
|
719 |
"kluczem Connect do %1$s.<br>Wpisz klucz %2$stutaj%4$s. Możesz również "
|
720 |
"uzyskać klucz logując się na %3$sswoje konto%4$s."
|
721 |
|
722 |
+
#: classes/saas/class-saas-user-registration.php:316
|
723 |
#, php-format
|
724 |
msgid "Unknown response code from Flexible Shipping Connect API (%s)."
|
725 |
msgstr "Nieznany kod odpowiedzi z API Flexible Shipping Connect (%s)."
|
917 |
msgid "Next feature"
|
918 |
msgstr "Następna funkcja"
|
919 |
|
920 |
+
#: classes/saas/views/html-flexible-shipping-connect-second-notice.php:3
|
921 |
+
#, php-format
|
922 |
+
msgid ""
|
923 |
+
"You never sign up to Flexible Shipping Connect. You may finish the "
|
924 |
+
"registration process here %1$sSign up for Connect%2$s"
|
925 |
+
msgstr ""
|
926 |
+
"Nie zarejestrowałeś się w Flexible Shipping Connect. Możesz dokończyć proces "
|
927 |
+
"rejestracji tutaj %1$sZarejestruj się w Connect%2$s"
|
928 |
+
|
929 |
#: classes/saas/views/html-order-fallback-message.php:1
|
930 |
msgid "Fallback:"
|
931 |
msgstr "Stawka awaryjna:"
|
1032 |
msgstr "Zobacz jak %sskonfigurować Flexible Shipping%s."
|
1033 |
|
1034 |
#: classes/settings/flexible-shipping.php:21
|
1035 |
+
#: classes/settings/shipping-method-form.php:70 classes/shipping-method.php:36
|
1036 |
msgid "Enable/Disable"
|
1037 |
msgstr "Włącz/Wyłącz"
|
1038 |
|
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 |
|
1105 |
+
#: classes/settings/shipping-method-form.php:73 classes/shipping-method.php:38
|
1106 |
msgid "Enable this shipment method"
|
1107 |
msgstr "Włącz tę metodę wysyłki"
|
1108 |
|
1110 |
msgid "Method Title"
|
1111 |
msgstr "Tytuł metody"
|
1112 |
|
1113 |
+
#: classes/settings/shipping-method-form.php:78 classes/shipping-method.php:44
|
1114 |
msgid "This controls the title which the user sees during checkout."
|
1115 |
msgstr "Tytuł, który widzi użytkownik podczas składania zamówienia."
|
1116 |
|
1404 |
msgid "%1$sShipment status:%2$s %3$s"
|
1405 |
msgstr "%1$s Status przesyłki: %2$s %3$s"
|
1406 |
|
1407 |
+
#: classes/shipping-method.php:42
|
1408 |
msgid "Shipping Title"
|
1409 |
msgstr "Tytuł"
|
1410 |
|
1411 |
+
#: classes/shipping-method.php:114
|
1412 |
#: classes/views/html-shipping-method-rules.php:240
|
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."
|
1503 |
|
1504 |
+
#: classes/tracker.php:211
|
1505 |
msgid "Opt-in"
|
1506 |
msgstr "Opt-in"
|
1507 |
|
1508 |
+
#: classes/tracker.php:214
|
1509 |
msgid "Opt-out"
|
1510 |
msgstr "Opt-out"
|
1511 |
|
1857 |
msgid "Track shipment: "
|
1858 |
msgstr "Śledź przesyłkę: "
|
1859 |
|
1860 |
+
#. Plugin URI of the plugin/theme
|
1861 |
+
msgid "https://wordpress.org/plugins/flexible-shipping/"
|
1862 |
+
msgstr "https://pl.wordpress.org/plugins/flexible-shipping/"
|
|
|
|
|
|
|
|
|
|
|
1863 |
|
1864 |
+
#. Description of the plugin/theme
|
|
|
1865 |
msgid ""
|
1866 |
+
"Create additional shipment methods in WooCommerce and enable pricing based "
|
1867 |
+
"on cart weight or total."
|
1868 |
msgstr ""
|
1869 |
+
"Stwórz dodatkowe metody wysyłki w WooCommerce i włącz obliczanie kosztów w "
|
1870 |
+
"oparciu o wagę lub wartość zamówienia."
|
1871 |
|
1872 |
+
#. Author of the plugin/theme
|
1873 |
+
msgid "WP Desk"
|
1874 |
+
msgstr "WP Desk"
|
|
|
|
|
|
|
|
|
|
|
1875 |
|
1876 |
+
#. Author URI of the plugin/theme
|
1877 |
+
msgid "https://www.wpdesk.net/"
|
1878 |
+
msgstr "https://www.wpdesk.pl/"
|
|
|
|
|
|
|
|
|
|
|
1879 |
|
1880 |
+
#~ msgid "Test"
|
1881 |
+
#~ msgstr "Test"
|
|
|
|
|
|
|
|
|
|
|
|
|
1882 |
|
1883 |
+
#~ msgid "Input"
|
1884 |
+
#~ msgstr "Input"
|
|
|
|
|
|
|
|
|
|
|
|
|
1885 |
|
1886 |
+
#~ msgid ""
|
1887 |
+
#~ "The “%s” plugin cannot run on PHP versions older than %s. "
|
1888 |
+
#~ "Please contact your host and ask them to upgrade."
|
1889 |
+
#~ msgstr ""
|
1890 |
+
#~ "Wtyczka “%s” nie może działać w wersjach PHP starszych niż "
|
1891 |
+
#~ "%s. Skontaktuj się z administratorem hostingu i poproś o aktualizację."
|
|
|
|
|
1892 |
|
1893 |
+
#~ msgid ""
|
1894 |
+
#~ "The “%s” plugin cannot run on WordPress versions older than "
|
1895 |
+
#~ "%s. Please update WordPress."
|
1896 |
+
#~ msgstr ""
|
1897 |
+
#~ "Wtyczka “%s” nie może działać w wersjach WordPress starszych "
|
1898 |
+
#~ "niż %s. Prosimy o aktualizację WordPress."
|
|
|
|
|
1899 |
|
1900 |
+
#~ msgid ""
|
1901 |
+
#~ "The “%s” plugin cannot run on WooCommerce versions older than "
|
1902 |
+
#~ "%s. Please update WooCommerce."
|
1903 |
+
#~ msgstr ""
|
1904 |
+
#~ "Wtyczka “%s” nie może działać w wersjach WooCommerce "
|
1905 |
+
#~ "starszych niż %s. Prosimy o aktualizację WooCommerce."
|
1906 |
|
1907 |
+
#~ msgid ""
|
1908 |
+
#~ "The “%s” plugin cannot run without OpenSSL module version at "
|
1909 |
+
#~ "least %s. Please update OpenSSL module."
|
1910 |
+
#~ msgstr ""
|
1911 |
+
#~ "Wtyczka “%s” nie może działać bez aktywacji OpenSSL co "
|
1912 |
+
#~ "najmniej w wersji %s. Zaktualizuj wersję OpenSSL."
|
1913 |
|
1914 |
+
#~ msgid ""
|
1915 |
+
#~ "The “%s” plugin cannot run without %s active. Please install "
|
1916 |
+
#~ "and activate %s plugin."
|
1917 |
+
#~ msgstr ""
|
1918 |
+
#~ "Wtyczka “%s” nie może działać bez aktywacji %s. Zainstaluj i "
|
1919 |
+
#~ "aktywuj wtyczkę %s."
|
1920 |
+
|
1921 |
+
#~ msgid ""
|
1922 |
+
#~ "The “%s” plugin cannot run without %s php module installed. "
|
1923 |
+
#~ "Please contact your host and ask them to install %s."
|
1924 |
+
#~ msgstr ""
|
1925 |
+
#~ "Wtyczka “%s” nie może działać bez modułu php: %s. Skontaktuj "
|
1926 |
+
#~ "się z administratorem hostingu i poproś o instalację %s."
|
1927 |
|
1928 |
+
#~ msgid ""
|
1929 |
+
#~ "The “%s” plugin cannot run without %s php setting set to %s. "
|
1930 |
+
#~ "Please contact your host and ask them to set %s."
|
1931 |
+
#~ msgstr ""
|
1932 |
+
#~ "Wtyczka “%s” nie może działać bez ustawienia php %s "
|
1933 |
+
#~ "ustawionego na %s. Skontaktuj się z administratorem hostingu i poproś o "
|
1934 |
+
#~ "ustawienie %s."
|
1935 |
|
1936 |
+
#~ msgid "Section214 Settings"
|
1937 |
+
#~ msgstr "Section214 Settings"
|
|
|
|
|
1938 |
|
1939 |
+
#~ msgid "Your settings have been saved."
|
1940 |
+
#~ msgstr "Twoje ustawienia zostały zapisane."
|
|
|
|
|
1941 |
|
1942 |
+
#~ msgid ""
|
1943 |
+
#~ "To copy the system info, click below then press Ctrl + C (PC) or Cmd + C "
|
1944 |
+
#~ "(Mac)."
|
1945 |
+
#~ msgstr ""
|
1946 |
+
#~ "Kliknij poniżej i naciśnij CTRL + C (Windows) lub Cmd + C (Mac) by "
|
1947 |
+
#~ "skopiować informacje systemowe."
|
1948 |
|
1949 |
+
#~ msgid "Download System Info File"
|
1950 |
+
#~ msgstr "Pobierz plik informacji systemowych"
|
|
|
|
|
1951 |
|
1952 |
+
#~ msgid "Upload File"
|
1953 |
+
#~ msgstr "Dodaj plik"
|
|
|
|
|
1954 |
|
1955 |
+
#~ msgid "Deactivate License"
|
1956 |
+
#~ msgstr "Dezaktywuj licencję"
|
|
|
|
|
|
|
1957 |
|
1958 |
+
#~ msgid ""
|
1959 |
+
#~ "The callback function used for the <strong>%s</strong> setting is missing."
|
1960 |
+
#~ msgstr ""
|
1961 |
+
#~ "The callback function used for the <strong>%s</strong> setting is missing."
|
|
|
|
|
|
|
|
|
1962 |
|
1963 |
+
#~ msgid "Insert Image"
|
1964 |
+
#~ msgstr "Wstaw obrazek"
|
|
|
1965 |
|
1966 |
+
#~ msgid "Select Image"
|
1967 |
+
#~ msgstr "Wybierz obrazek"
|
|
|
1968 |
|
1969 |
+
#~ msgid ""
|
1970 |
+
#~ "There is a new version of %1$s available. %2$sView version %3$s details"
|
1971 |
+
#~ "%4$s."
|
1972 |
+
#~ msgstr ""
|
1973 |
+
#~ "Dostępna jest nowa wersja %1$s. %2$s Pokaż %3$s szczegóły wersji %4$s."
|
1974 |
|
1975 |
+
#~ msgid ""
|
1976 |
+
#~ "There is a new version of %1$s available. %2$sView version %3$s details"
|
1977 |
+
#~ "%4$s or %5$supdate now%6$s."
|
1978 |
+
#~ msgstr ""
|
1979 |
+
#~ "Jest dostępna nowa wersja %1$s. %2$s Zobacz szczegóły wersji %3$s %4$s "
|
1980 |
+
#~ "lub %5$s zaktualizuj %6$s."
|
1981 |
|
1982 |
+
#~ msgid "You do not have permission to install plugin updates"
|
1983 |
+
#~ msgstr "Nie masz uprawnień do instalacji aktualizacji wtyczki"
|
|
|
|
|
1984 |
|
1985 |
+
#~ msgid "Licensing"
|
1986 |
+
#~ msgstr "Licencje"
|
|
|
1987 |
|
1988 |
+
#~ msgid "%1$s License Key"
|
1989 |
+
#~ msgstr "Klucz licencyjny %1$s"
|
|
|
1990 |
|
1991 |
+
#~ msgid ""
|
1992 |
+
#~ "Please enter your license key to enable automatic updates and support."
|
1993 |
+
#~ msgstr ""
|
1994 |
+
#~ "Wpisz swój klucz licencyjny, aby włączyć automatyczne aktualizacje i "
|
1995 |
+
#~ "wsparcie."
|
1996 |
|
1997 |
+
#~ msgid "Nonce verification failed"
|
1998 |
+
#~ msgstr "Błąd zabepieczeń (nonce)"
|
|
|
|
|
|
|
|
|
|
|
|
|
1999 |
|
2000 |
+
#~ msgid "This license does not belong to the product you have entered it for."
|
2001 |
+
#~ msgstr "Klucz licencyjny który wpisałeś nie należy do tego produktu."
|
|
|
2002 |
|
2003 |
+
#~ msgid "This license does not have any activations left"
|
2004 |
+
#~ msgstr "Licencja nie posiada już wolnych aktywacji"
|
|
|
|
|
|
|
|
|
|
|
2005 |
|
2006 |
+
#~ msgid "This license key is expired. Please renew it."
|
2007 |
+
#~ msgstr "Ten klucz licencyjny wygasł. Proszę odnów go."
|
|
|
2008 |
|
2009 |
+
#~ msgid ""
|
2010 |
+
#~ "There was a problem activating your license key, please try again or "
|
2011 |
+
#~ "contact support. Error code: %s"
|
2012 |
+
#~ msgstr ""
|
2013 |
+
#~ "Pojawił się problem z aktywacją klucza licencyjnego. Proszę spróbuj "
|
2014 |
+
#~ "ponownie lub skontaktuj się z naszym wsparciem. Kod błędu: %s"
|
2015 |
|
2016 |
#~ msgid ""
|
2017 |
#~ "The %s%s%s License Key has not been activated, so the plugin is inactive! "
|
plugin-create.php
CHANGED
@@ -47,6 +47,3 @@ if ( !function_exists( 'wpdesk_is_plugin_active' ) ) {
|
|
47 |
return in_array( $plugin_file, $active_plugins ) || array_key_exists( $plugin_file, $active_plugins );
|
48 |
}
|
49 |
}
|
50 |
-
|
51 |
-
$tracker_factory = new WPDesk_Tracker_Factory();
|
52 |
-
$tracker_factory->create_tracker( basename( dirname( __FILE__ ) ) );
|
47 |
return in_array( $plugin_file, $active_plugins ) || array_key_exists( $plugin_file, $active_plugins );
|
48 |
}
|
49 |
}
|
|
|
|
|
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: wpdesk, swoboda
|
|
3 |
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.
|
7 |
-
Stable tag: 3.
|
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,16 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
|
|
175 |
|
176 |
== Changelog ==
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
= 3.0.7 - 2018-12-07 =
|
179 |
* Added define to change shop saas domain using SAAS_FLEXIBLESHIPPING_URL_SHOP_DOMAIN
|
180 |
* Added filter to change shop saas domain flexible_shipping_saas_domain
|
3 |
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.1
|
7 |
+
Stable tag: 3.1
|
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 - 2018-12-13 =
|
179 |
+
* Added Cache settings in FS Connect Advanced settings
|
180 |
+
* Added info and link to planned integrations
|
181 |
+
* Added support for not allowed demo domain
|
182 |
+
* Fixed missing tracker message
|
183 |
+
* Fixed typo in Connect notices
|
184 |
+
* Fixed COD Enable for shipping methods functionality
|
185 |
+
* Fixed UK counties
|
186 |
+
* Fixed for free shipping zero value in settings
|
187 |
+
|
188 |
= 3.0.7 - 2018-12-07 =
|
189 |
* Added define to change shop saas domain using SAAS_FLEXIBLESHIPPING_URL_SHOP_DOMAIN
|
190 |
* Added filter to change shop saas domain flexible_shipping_saas_domain
|
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 ComposerAutoloaderInit553a045e35fb2cbc9536124a2ef6cfaf::getLoader();
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -430,6 +430,7 @@ return array(
|
|
430 |
'WPDesk_Flexible_Shipping_SaaS_Auth_Params' => $baseDir . '/classes/saas/class-saas-auth-params.php',
|
431 |
'WPDesk_Flexible_Shipping_SaaS_Auth_Platform_Factory' => $baseDir . '/classes/saas/class-saas-platform-factory.php',
|
432 |
'WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception' => $baseDir . '/classes/saas/class-saas-bad-credentials-exception.php',
|
|
|
433 |
'WPDesk_Flexible_Shipping_SaaS_Connection' => $baseDir . '/classes/saas/class-saas-connection.php',
|
434 |
'WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax' => $baseDir . '/classes/saas/class-saas-connection-status-ajax.php',
|
435 |
'WPDesk_Flexible_Shipping_SaaS_Connection_Status_Field' => $baseDir . '/classes/saas/class-saas-connection-status-field.php',
|
@@ -442,6 +443,7 @@ return array(
|
|
442 |
'WPDesk_Flexible_Shipping_SaaS_Logger_Downloader' => $baseDir . '/classes/logger/class-saas-logger-downloader.php',
|
443 |
'WPDesk_Flexible_Shipping_SaaS_Logger_Settings' => $baseDir . '/classes/logger/class-saas-logger-settings.php',
|
444 |
'WPDesk_Flexible_Shipping_SaaS_Maintenance_Mode_Exception' => $baseDir . '/classes/saas/class-saas-maintenance-mode-exception.php',
|
|
|
445 |
'WPDesk_Flexible_Shipping_SaaS_Platform_Links' => $baseDir . '/classes/saas/class-saas-platform-links.php',
|
446 |
'WPDesk_Flexible_Shipping_SaaS_Registration_Second_Notice' => $baseDir . '/classes/saas/class-saas-registration-second-notice.php',
|
447 |
'WPDesk_Flexible_Shipping_SaaS_Service_Settings_Not_Found' => $baseDir . '/classes/saas/class-saas-service-settings-not-found-exception.php',
|
430 |
'WPDesk_Flexible_Shipping_SaaS_Auth_Params' => $baseDir . '/classes/saas/class-saas-auth-params.php',
|
431 |
'WPDesk_Flexible_Shipping_SaaS_Auth_Platform_Factory' => $baseDir . '/classes/saas/class-saas-platform-factory.php',
|
432 |
'WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception' => $baseDir . '/classes/saas/class-saas-bad-credentials-exception.php',
|
433 |
+
'WPDesk_Flexible_Shipping_SaaS_Cache_Settings' => $baseDir . '/classes/saas/class-saas-cache-settings.php',
|
434 |
'WPDesk_Flexible_Shipping_SaaS_Connection' => $baseDir . '/classes/saas/class-saas-connection.php',
|
435 |
'WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax' => $baseDir . '/classes/saas/class-saas-connection-status-ajax.php',
|
436 |
'WPDesk_Flexible_Shipping_SaaS_Connection_Status_Field' => $baseDir . '/classes/saas/class-saas-connection-status-field.php',
|
443 |
'WPDesk_Flexible_Shipping_SaaS_Logger_Downloader' => $baseDir . '/classes/logger/class-saas-logger-downloader.php',
|
444 |
'WPDesk_Flexible_Shipping_SaaS_Logger_Settings' => $baseDir . '/classes/logger/class-saas-logger-settings.php',
|
445 |
'WPDesk_Flexible_Shipping_SaaS_Maintenance_Mode_Exception' => $baseDir . '/classes/saas/class-saas-maintenance-mode-exception.php',
|
446 |
+
'WPDesk_Flexible_Shipping_SaaS_New_Courier_Settings_Section' => $baseDir . '/classes/saas/class-saas-new-courier-settings-section.php',
|
447 |
'WPDesk_Flexible_Shipping_SaaS_Platform_Links' => $baseDir . '/classes/saas/class-saas-platform-links.php',
|
448 |
'WPDesk_Flexible_Shipping_SaaS_Registration_Second_Notice' => $baseDir . '/classes/saas/class-saas-registration-second-notice.php',
|
449 |
'WPDesk_Flexible_Shipping_SaaS_Service_Settings_Not_Found' => $baseDir . '/classes/saas/class-saas-service-settings-not-found-exception.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 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInita220145be0a1484399e73611cd5b9445
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
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\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInita220145be0a1484399e73611cd5b9445
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit553a045e35fb2cbc9536124a2ef6cfaf
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit553a045e35fb2cbc9536124a2ef6cfaf', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit553a045e35fb2cbc9536124a2ef6cfaf', '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\ComposerStaticInit553a045e35fb2cbc9536124a2ef6cfaf::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\ComposerStaticInit553a045e35fb2cbc9536124a2ef6cfaf::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequire553a045e35fb2cbc9536124a2ef6cfaf($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequire553a045e35fb2cbc9536124a2ef6cfaf($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
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'46ae4ad8c3479aabff48f598a0e4b93f' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/functions.php',
|
@@ -509,6 +509,7 @@ class ComposerStaticInita220145be0a1484399e73611cd5b9445
|
|
509 |
'WPDesk_Flexible_Shipping_SaaS_Auth_Params' => __DIR__ . '/../..' . '/classes/saas/class-saas-auth-params.php',
|
510 |
'WPDesk_Flexible_Shipping_SaaS_Auth_Platform_Factory' => __DIR__ . '/../..' . '/classes/saas/class-saas-platform-factory.php',
|
511 |
'WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception' => __DIR__ . '/../..' . '/classes/saas/class-saas-bad-credentials-exception.php',
|
|
|
512 |
'WPDesk_Flexible_Shipping_SaaS_Connection' => __DIR__ . '/../..' . '/classes/saas/class-saas-connection.php',
|
513 |
'WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax' => __DIR__ . '/../..' . '/classes/saas/class-saas-connection-status-ajax.php',
|
514 |
'WPDesk_Flexible_Shipping_SaaS_Connection_Status_Field' => __DIR__ . '/../..' . '/classes/saas/class-saas-connection-status-field.php',
|
@@ -521,6 +522,7 @@ class ComposerStaticInita220145be0a1484399e73611cd5b9445
|
|
521 |
'WPDesk_Flexible_Shipping_SaaS_Logger_Downloader' => __DIR__ . '/../..' . '/classes/logger/class-saas-logger-downloader.php',
|
522 |
'WPDesk_Flexible_Shipping_SaaS_Logger_Settings' => __DIR__ . '/../..' . '/classes/logger/class-saas-logger-settings.php',
|
523 |
'WPDesk_Flexible_Shipping_SaaS_Maintenance_Mode_Exception' => __DIR__ . '/../..' . '/classes/saas/class-saas-maintenance-mode-exception.php',
|
|
|
524 |
'WPDesk_Flexible_Shipping_SaaS_Platform_Links' => __DIR__ . '/../..' . '/classes/saas/class-saas-platform-links.php',
|
525 |
'WPDesk_Flexible_Shipping_SaaS_Registration_Second_Notice' => __DIR__ . '/../..' . '/classes/saas/class-saas-registration-second-notice.php',
|
526 |
'WPDesk_Flexible_Shipping_SaaS_Service_Settings_Not_Found' => __DIR__ . '/../..' . '/classes/saas/class-saas-service-settings-not-found-exception.php',
|
@@ -592,9 +594,9 @@ class ComposerStaticInita220145be0a1484399e73611cd5b9445
|
|
592 |
public static function getInitializer(ClassLoader $loader)
|
593 |
{
|
594 |
return \Closure::bind(function () use ($loader) {
|
595 |
-
$loader->prefixLengthsPsr4 =
|
596 |
-
$loader->prefixDirsPsr4 =
|
597 |
-
$loader->classMap =
|
598 |
|
599 |
}, null, ClassLoader::class);
|
600 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit553a045e35fb2cbc9536124a2ef6cfaf
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'46ae4ad8c3479aabff48f598a0e4b93f' => __DIR__ . '/..' . '/wpdesk/wp-mutex/src/WPDesk/functions.php',
|
509 |
'WPDesk_Flexible_Shipping_SaaS_Auth_Params' => __DIR__ . '/../..' . '/classes/saas/class-saas-auth-params.php',
|
510 |
'WPDesk_Flexible_Shipping_SaaS_Auth_Platform_Factory' => __DIR__ . '/../..' . '/classes/saas/class-saas-platform-factory.php',
|
511 |
'WPDesk_Flexible_Shipping_SaaS_Bad_Credentials_Exception' => __DIR__ . '/../..' . '/classes/saas/class-saas-bad-credentials-exception.php',
|
512 |
+
'WPDesk_Flexible_Shipping_SaaS_Cache_Settings' => __DIR__ . '/../..' . '/classes/saas/class-saas-cache-settings.php',
|
513 |
'WPDesk_Flexible_Shipping_SaaS_Connection' => __DIR__ . '/../..' . '/classes/saas/class-saas-connection.php',
|
514 |
'WPDesk_Flexible_Shipping_SaaS_Connection_Status_Ajax' => __DIR__ . '/../..' . '/classes/saas/class-saas-connection-status-ajax.php',
|
515 |
'WPDesk_Flexible_Shipping_SaaS_Connection_Status_Field' => __DIR__ . '/../..' . '/classes/saas/class-saas-connection-status-field.php',
|
522 |
'WPDesk_Flexible_Shipping_SaaS_Logger_Downloader' => __DIR__ . '/../..' . '/classes/logger/class-saas-logger-downloader.php',
|
523 |
'WPDesk_Flexible_Shipping_SaaS_Logger_Settings' => __DIR__ . '/../..' . '/classes/logger/class-saas-logger-settings.php',
|
524 |
'WPDesk_Flexible_Shipping_SaaS_Maintenance_Mode_Exception' => __DIR__ . '/../..' . '/classes/saas/class-saas-maintenance-mode-exception.php',
|
525 |
+
'WPDesk_Flexible_Shipping_SaaS_New_Courier_Settings_Section' => __DIR__ . '/../..' . '/classes/saas/class-saas-new-courier-settings-section.php',
|
526 |
'WPDesk_Flexible_Shipping_SaaS_Platform_Links' => __DIR__ . '/../..' . '/classes/saas/class-saas-platform-links.php',
|
527 |
'WPDesk_Flexible_Shipping_SaaS_Registration_Second_Notice' => __DIR__ . '/../..' . '/classes/saas/class-saas-registration-second-notice.php',
|
528 |
'WPDesk_Flexible_Shipping_SaaS_Service_Settings_Not_Found' => __DIR__ . '/../..' . '/classes/saas/class-saas-service-settings-not-found-exception.php',
|
594 |
public static function getInitializer(ClassLoader $loader)
|
595 |
{
|
596 |
return \Closure::bind(function () use ($loader) {
|
597 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit553a045e35fb2cbc9536124a2ef6cfaf::$prefixLengthsPsr4;
|
598 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit553a045e35fb2cbc9536124a2ef6cfaf::$prefixDirsPsr4;
|
599 |
+
$loader->classMap = ComposerStaticInit553a045e35fb2cbc9536124a2ef6cfaf::$classMap;
|
600 |
|
601 |
}, null, ClassLoader::class);
|
602 |
}
|
vendor/composer/installed.json
CHANGED
@@ -424,17 +424,17 @@
|
|
424 |
},
|
425 |
{
|
426 |
"name": "wpdesk/wp-basic-requirements",
|
427 |
-
"version": "2.
|
428 |
-
"version_normalized": "2.
|
429 |
"source": {
|
430 |
"type": "git",
|
431 |
"url": "https://gitlab.com/wpdesk/wp-basic-requirements.git",
|
432 |
-
"reference": "
|
433 |
},
|
434 |
"dist": {
|
435 |
"type": "zip",
|
436 |
-
"url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-basic-requirements/repository/archive.zip?sha=
|
437 |
-
"reference": "
|
438 |
"shasum": ""
|
439 |
},
|
440 |
"require": {
|
@@ -449,7 +449,7 @@
|
|
449 |
"wimg/php-compatibility": "^8",
|
450 |
"wp-coding-standards/wpcs": "^0.14.1"
|
451 |
},
|
452 |
-
"time": "2018-
|
453 |
"type": "library",
|
454 |
"installation-source": "dist",
|
455 |
"notification-url": "https://packagist.org/downloads/",
|
@@ -664,17 +664,17 @@
|
|
664 |
},
|
665 |
{
|
666 |
"name": "wpdesk/wp-saas-platform-client",
|
667 |
-
"version": "1.6",
|
668 |
-
"version_normalized": "1.6.
|
669 |
"source": {
|
670 |
"type": "git",
|
671 |
"url": "https://gitlab.com/wpdesk/wp-saas-platform-client.git",
|
672 |
-
"reference": "
|
673 |
},
|
674 |
"dist": {
|
675 |
"type": "zip",
|
676 |
-
"url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-saas-platform-client/repository/archive.zip?sha=
|
677 |
-
"reference": "
|
678 |
"shasum": ""
|
679 |
},
|
680 |
"require": {
|
@@ -685,13 +685,13 @@
|
|
685 |
"psr/simple-cache": "^1.0"
|
686 |
},
|
687 |
"require-dev": {
|
688 |
-
"
|
|
|
689 |
"phpunit/phpunit": "<7",
|
690 |
"squizlabs/php_codesniffer": "^3.0.2",
|
691 |
-
"wimg/php-compatibility": "^8",
|
692 |
"wp-coding-standards/wpcs": "^0.14.1"
|
693 |
},
|
694 |
-
"time": "2018-12-
|
695 |
"type": "library",
|
696 |
"installation-source": "dist",
|
697 |
"autoload": {
|
424 |
},
|
425 |
{
|
426 |
"name": "wpdesk/wp-basic-requirements",
|
427 |
+
"version": "2.2",
|
428 |
+
"version_normalized": "2.2.0.0",
|
429 |
"source": {
|
430 |
"type": "git",
|
431 |
"url": "https://gitlab.com/wpdesk/wp-basic-requirements.git",
|
432 |
+
"reference": "5cd4ac45986f3919bd63e2c4517dafe12fea5e97"
|
433 |
},
|
434 |
"dist": {
|
435 |
"type": "zip",
|
436 |
+
"url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-basic-requirements/repository/archive.zip?sha=5cd4ac45986f3919bd63e2c4517dafe12fea5e97",
|
437 |
+
"reference": "5cd4ac45986f3919bd63e2c4517dafe12fea5e97",
|
438 |
"shasum": ""
|
439 |
},
|
440 |
"require": {
|
449 |
"wimg/php-compatibility": "^8",
|
450 |
"wp-coding-standards/wpcs": "^0.14.1"
|
451 |
},
|
452 |
+
"time": "2018-12-07T16:19:23+00:00",
|
453 |
"type": "library",
|
454 |
"installation-source": "dist",
|
455 |
"notification-url": "https://packagist.org/downloads/",
|
664 |
},
|
665 |
{
|
666 |
"name": "wpdesk/wp-saas-platform-client",
|
667 |
+
"version": "1.6.3",
|
668 |
+
"version_normalized": "1.6.3.0",
|
669 |
"source": {
|
670 |
"type": "git",
|
671 |
"url": "https://gitlab.com/wpdesk/wp-saas-platform-client.git",
|
672 |
+
"reference": "8d3229d078a75c2611fc3e78f24b82b6c39dc2e2"
|
673 |
},
|
674 |
"dist": {
|
675 |
"type": "zip",
|
676 |
+
"url": "https://gitlab.com/api/v4/projects/wpdesk%2Fwp-saas-platform-client/repository/archive.zip?sha=8d3229d078a75c2611fc3e78f24b82b6c39dc2e2",
|
677 |
+
"reference": "8d3229d078a75c2611fc3e78f24b82b6c39dc2e2",
|
678 |
"shasum": ""
|
679 |
},
|
680 |
"require": {
|
685 |
"psr/simple-cache": "^1.0"
|
686 |
},
|
687 |
"require-dev": {
|
688 |
+
"10up/wp_mock": "*",
|
689 |
+
"mockery/mockery": "*",
|
690 |
"phpunit/phpunit": "<7",
|
691 |
"squizlabs/php_codesniffer": "^3.0.2",
|
|
|
692 |
"wp-coding-standards/wpcs": "^0.14.1"
|
693 |
},
|
694 |
+
"time": "2018-12-10T14:00:04+00:00",
|
695 |
"type": "library",
|
696 |
"installation-source": "dist",
|
697 |
"autoload": {
|
vendor/wpdesk/wp-basic-requirements/.gitignore
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
/vendor/
|
2 |
.idea
|
3 |
-
composer.lock
|
|
1 |
/vendor/
|
2 |
.idea
|
3 |
+
composer.lock
|
4 |
+
build-coverage
|
vendor/wpdesk/wp-basic-requirements/.gitlab-ci.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
variables:
|
2 |
-
WPDESK_CI_VERSION: 1.10.19
|
3 |
MYSQL_ROOT_PASSWORD: mysql
|
4 |
MYSQL_DATABASE: wptest
|
5 |
MYSQL_USER: mysql
|
@@ -13,8 +13,6 @@ variables:
|
|
13 |
stages:
|
14 |
- tools
|
15 |
- tests
|
16 |
-
- pre-deploy
|
17 |
-
- deploy
|
18 |
|
19 |
.template: &job-test-template
|
20 |
stage: tests
|
@@ -78,18 +76,6 @@ stages:
|
|
78 |
- tags
|
79 |
only:
|
80 |
|
81 |
-
.template: &job-deploy-template
|
82 |
-
image: wpdesknet/amazon-svn-deploy
|
83 |
-
stage: deploy
|
84 |
-
dependencies:
|
85 |
-
- build to deploy
|
86 |
-
- unit test lastest coverage
|
87 |
-
- integration test lastest coverage
|
88 |
-
retry: 2
|
89 |
-
when: manual
|
90 |
-
only:
|
91 |
-
- tags
|
92 |
-
|
93 |
before_script:
|
94 |
- cd ${CI_PROJECT_DIR}
|
95 |
|
@@ -119,16 +105,7 @@ churn metrics:
|
|
119 |
- echo ${WPDESK_CI_VERSION}
|
120 |
- composer require bmitch/churn-php
|
121 |
- composer update --no-progress
|
122 |
-
- vendor/bin/churn run
|
123 |
-
|
124 |
-
#code style test:
|
125 |
-
# stage: tests
|
126 |
-
# image: wpdesknet/phpunit-woocommerce:0-0
|
127 |
-
# allow_failure: true
|
128 |
-
# script:
|
129 |
-
# - echo ${WPDESK_CI_VERSION}
|
130 |
-
# - composer update --no-progress
|
131 |
-
# - vendor/bin/phpcs
|
132 |
|
133 |
unit test lastest:
|
134 |
<<: *job-test-unit-template-fast
|
@@ -175,136 +152,3 @@ integration test current woocommerce:
|
|
175 |
- rm -rf woocommerce
|
176 |
- git clone https://github.com/woocommerce/woocommerce.git
|
177 |
- cd ${CI_PROJECT_DIR}
|
178 |
-
|
179 |
-
acceptance test:
|
180 |
-
image: wpdesknet/node
|
181 |
-
variables:
|
182 |
-
CI_DEBUG_SERVICES: trace
|
183 |
-
services:
|
184 |
-
- name: mysql:5.6
|
185 |
-
alias: mysqltests
|
186 |
-
- name: wpdesknet/apache-woocommerce:latest
|
187 |
-
alias: wootests
|
188 |
-
- name: selenium/standalone-chrome
|
189 |
-
alias: selenium
|
190 |
-
artifacts:
|
191 |
-
when: always
|
192 |
-
expire_in: 1 day
|
193 |
-
name: "error logs"
|
194 |
-
paths:
|
195 |
-
- ${CI_PROJECT_DIR}/acceptance
|
196 |
-
stage: tests
|
197 |
-
allow_failure: true
|
198 |
-
script:
|
199 |
-
- cd ${CI_PROJECT_DIR}
|
200 |
-
- composer update --no-progress --no-dev
|
201 |
-
- if [[ -f ${CI_PROJECT_DIR}/tests/acceptance/prepare.sh ]]; then sh ${CI_PROJECT_DIR}/tests/acceptance/prepare.sh; fi
|
202 |
-
|
203 |
-
- export MYSQL_IP=$(awk '/^[[:space:]]*($|#)/{next} /mysqltests/{print $1; exit}' /etc/hosts)
|
204 |
-
- export WOOTESTS_IP=$(awk '/^[[:space:]]*($|#)/{next} /wootests/{print $1; exit}' /etc/hosts)
|
205 |
-
- echo "http://wootests/wpdesk_init.php?mysql_ip=${MYSQL_IP}&wootests_ip=${WOOTESTS_IP}"
|
206 |
-
- wget -O /tmp/wpdesk_init.txt "http://wootests/wpdesk_init.php?mysql_ip=${MYSQL_IP}&wootests_ip=${WOOTESTS_IP}"
|
207 |
-
- tail -50 /tmp/wpdesk_init.txt
|
208 |
-
|
209 |
-
- sh /tmp/clone.sh git@gitlab.com:wpdesk/plugins-tests.git /tmp/tests headless
|
210 |
-
- cd /tmp/tests
|
211 |
-
- npm install
|
212 |
-
- npm install -g grunt-cli
|
213 |
-
- cd node_modules/.bin
|
214 |
-
- ./webdriver-manager update
|
215 |
-
- cd ../
|
216 |
-
- mkdir -p ${CI_PROJECT_DIR}/acceptance/reports/html/screenshot
|
217 |
-
- grunt chrome-${CI_PROJECT_NAME}
|
218 |
-
|
219 |
-
|
220 |
-
apigen docs:
|
221 |
-
image:
|
222 |
-
name: wpdesknet/apigen
|
223 |
-
stage: pre-deploy
|
224 |
-
artifacts:
|
225 |
-
expire_in: 1 day
|
226 |
-
name: "docs"
|
227 |
-
paths:
|
228 |
-
- docs/
|
229 |
-
script:
|
230 |
-
- echo ${WPDESK_CI_VERSION}
|
231 |
-
- ls -l
|
232 |
-
- /app/vendor/bin/apigen generate
|
233 |
-
- php /app/hooks-docs.php ${CI_PROJECT_DIR}
|
234 |
-
only:
|
235 |
-
- tags
|
236 |
-
|
237 |
-
pages:
|
238 |
-
stage: deploy
|
239 |
-
dependencies:
|
240 |
-
- apigen docs
|
241 |
-
script:
|
242 |
-
- rm -rf public
|
243 |
-
- mv docs/ public/
|
244 |
-
- 'curl -X POST --data-urlencode "payload={\"text\": \"Dokumentacja projektu ${CI_PROJECT_NAME} w wersji ${CI_COMMIT_REF_NAME} umieszczona w <https://gitlab.com/wpdesk/${CI_PROJECT_NAME}/pages|pages> \", }" https://hooks.slack.com/services/${SLACK_AUTH}'
|
245 |
-
artifacts:
|
246 |
-
expire_in: 1 day
|
247 |
-
paths:
|
248 |
-
- public
|
249 |
-
only:
|
250 |
-
- tags
|
251 |
-
|
252 |
-
build to deploy:
|
253 |
-
image: wpdesknet/phpunit-woocommerce:4-0
|
254 |
-
stage: pre-deploy
|
255 |
-
artifacts:
|
256 |
-
expire_in: 1 month
|
257 |
-
name: "production release"
|
258 |
-
paths:
|
259 |
-
- release
|
260 |
-
- release.zip
|
261 |
-
script:
|
262 |
-
- echo ${WPDESK_CI_VERSION}
|
263 |
-
- php --version
|
264 |
-
- ls -l
|
265 |
-
- /tmp/set_version.sh ${CI_COMMIT_REF_NAME}
|
266 |
-
- rm -rf ${CI_PROJECT_DIR}/release ${CI_PROJECT_DIR}/release.zip /tmp/release
|
267 |
-
- mkdir /tmp/release
|
268 |
-
- mkdir -p ${CI_PROJECT_DIR}/release/${CI_PROJECT_NAME}
|
269 |
-
- cp -rf ${CI_PROJECT_DIR}/* /tmp/release
|
270 |
-
- cp -rf /tmp/release/* ${CI_PROJECT_DIR}/release/${CI_PROJECT_NAME}
|
271 |
-
- cd ${CI_PROJECT_DIR}/release/${CI_PROJECT_NAME}
|
272 |
-
- composer install --no-dev --no-progress --optimize-autoloader
|
273 |
-
- rm -rf build-coverage release tests docs .git .editorconfig .gitignore .gitlab-ci.yml apigen.neon phpunit.xml acceptance test_soap.php .gitlab
|
274 |
-
- rm -rf composer.json composer.lock phpcs.xml.dist phpunit-integration.xml phpunit-unit.xml composer.phar wp-cli.phar
|
275 |
-
- cd ../
|
276 |
-
- zip -r -q ../release.zip ./
|
277 |
-
only:
|
278 |
-
- tags
|
279 |
-
|
280 |
-
deploy to shop:
|
281 |
-
<<: *job-deploy-template
|
282 |
-
script:
|
283 |
-
- echo ${WPDESK_CI_VERSION}
|
284 |
-
- /tmp/deploy_shop.sh ${CI_PROJECT_NAME} release.zip ${CI_PROJECT_NAME}.zip
|
285 |
-
- 'curl -X POST --data-urlencode "payload={\"text\": \"Projekt <https://gitlab.com/wpdesk/${CI_PROJECT_NAME}|${CI_PROJECT_NAME}> zdeployowany do sklepu w wersji ${CI_COMMIT_REF_NAME}\", }" https://hooks.slack.com/services/${SLACK_AUTH}'
|
286 |
-
environment:
|
287 |
-
name: wpdesk shop
|
288 |
-
url: https://wpdeskplugin.s3.amazonaws.com/${CI_PROJECT_NAME}.zip
|
289 |
-
|
290 |
-
deploy to demo:
|
291 |
-
<<: *job-deploy-template
|
292 |
-
script:
|
293 |
-
- echo ${WPDESK_CI_VERSION}
|
294 |
-
- /tmp/deploy_demo.sh release/${CI_PROJECT_NAME} ${CI_PROJECT_NAME}
|
295 |
-
- 'curl -X POST --data-urlencode "payload={\"text\": \"Projekt <https://gitlab.com/wpdesk/${CI_PROJECT_NAME}|${CI_PROJECT_NAME}> zdeployowany do demo w wersji ${CI_COMMIT_REF_NAME}\", }" https://hooks.slack.com/services/${SLACK_AUTH}'
|
296 |
-
environment:
|
297 |
-
name: wpdesk demo
|
298 |
-
url: https://demo.wpdesk.org
|
299 |
-
|
300 |
-
deploy to repository:
|
301 |
-
<<: *job-deploy-template
|
302 |
-
script:
|
303 |
-
- echo ${WPDESK_CI_VERSION}
|
304 |
-
- rm -rf /tmp/svn-repository
|
305 |
-
- mkdir /tmp/svn-repository
|
306 |
-
- /tmp/deploy_repository.sh ${CI_PROJECT_NAME} ${CI_PROJECT_DIR}/release/${CI_PROJECT_NAME} /tmp/svn-repository
|
307 |
-
- 'curl -X POST --data-urlencode "payload={\"text\": \"Projekt <https://gitlab.com/wpdesk/${CI_PROJECT_NAME}|${CI_PROJECT_NAME}> zdeployowany do repozytorium WP w wersji ${CI_COMMIT_REF_NAME}\", }" https://hooks.slack.com/services/${SLACK_AUTH}'
|
308 |
-
environment:
|
309 |
-
name: wordpress repository
|
310 |
-
url: https://downloads.wordpress.org/plugin/${CI_PROJECT_NAME}.${CI_COMMIT_REF_NAME}.zip
|
1 |
variables:
|
2 |
+
WPDESK_CI_VERSION: 1.10.19-library
|
3 |
MYSQL_ROOT_PASSWORD: mysql
|
4 |
MYSQL_DATABASE: wptest
|
5 |
MYSQL_USER: mysql
|
13 |
stages:
|
14 |
- tools
|
15 |
- tests
|
|
|
|
|
16 |
|
17 |
.template: &job-test-template
|
18 |
stage: tests
|
76 |
- tags
|
77 |
only:
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
before_script:
|
80 |
- cd ${CI_PROJECT_DIR}
|
81 |
|
105 |
- echo ${WPDESK_CI_VERSION}
|
106 |
- composer require bmitch/churn-php
|
107 |
- composer update --no-progress
|
108 |
+
- vendor/bin/churn run src
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
unit test lastest:
|
111 |
<<: *job-test-unit-template-fast
|
152 |
- rm -rf woocommerce
|
153 |
- git clone https://github.com/woocommerce/woocommerce.git
|
154 |
- cd ${CI_PROJECT_DIR}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/wpdesk/wp-basic-requirements/.gitlab/issue_templates/Bug.md
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
### Select WooCommerce version e.g: [x] 2.6
|
2 |
-
<!--- Select the WooCommerce version on which the error occurred -->
|
3 |
-
|
4 |
-
- [ ] [2.6](http://woo26.tests.wpdesk.org)
|
5 |
-
- [ ] [2.7](http://woo27.tests.wpdesk.org)
|
6 |
-
- [ ] [3.0](http://woo30.tests.wpdesk.org)
|
7 |
-
- [ ] [3.1](http://woo31.tests.wpdesk.org)
|
8 |
-
- [ ] [3.2](http://woo32.tests.wpdesk.org)
|
9 |
-
- [ ] [3.3](http://woo33.tests.wpdesk.org)
|
10 |
-
- [ ] [3.4](http://woo34.tests.wpdesk.org)
|
11 |
-
- [ ] [Stable](https://stable.wpdesk.org/)
|
12 |
-
|
13 |
-
### Select PHP version e.g: [x] 5.6
|
14 |
-
<!--- Select the PHP version on which the error occurred -->
|
15 |
-
|
16 |
-
- [ ] 5.3
|
17 |
-
- [ ] 5.5
|
18 |
-
- [ ] 5.6
|
19 |
-
- [ ] 7.1
|
20 |
-
- [ ] 7.2
|
21 |
-
|
22 |
-
## Steps to Reproduce
|
23 |
-
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
24 |
-
|
25 |
-
1.
|
26 |
-
2.
|
27 |
-
|
28 |
-
|
29 |
-
## Expected Behavior
|
30 |
-
<!--- Tell what should happen -->
|
31 |
-
|
32 |
-
1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/wpdesk/wp-basic-requirements/README.md
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Wp-basic-requirements is a simple library for WordPress plugins to check if the environment meets the requirements
|
2 |
+
and if the requirements are not met shows proper notice to user.
|
3 |
+
|
4 |
+
Library have to be compatible with PHP 5.2.x as it's the lowest possible version for WordPress.
|
5 |
+
|
6 |
+
Requirements may be:
|
7 |
+
- Minimal PHP version
|
8 |
+
- Minimal WordPress version
|
9 |
+
- Minimal WooCommerce version
|
10 |
+
- Required PHP module
|
11 |
+
- Required PHP setting
|
12 |
+
- OpenSSL version
|
vendor/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if ( ! interface_exists( '
|
4 |
-
require_once '
|
5 |
}
|
6 |
|
7 |
/**
|
8 |
* Checks requirements for plugin
|
9 |
* have to be compatible with PHP 5.2.x
|
10 |
*/
|
11 |
-
class WPDesk_Basic_Requirement_Checker implements
|
12 |
const EXTENSION_NAME_OPENSSL = 'openssl';
|
13 |
const HOOK_ADMIN_NOTICES_ACTION = 'admin_notices';
|
14 |
|
15 |
/** @var string */
|
16 |
-
private $plugin_name
|
17 |
/** @var string */
|
18 |
-
private $plugin_file
|
19 |
/** @var string */
|
20 |
private $min_php_version;
|
21 |
/** @var string */
|
@@ -107,7 +107,7 @@ class WPDesk_Basic_Requirement_Checker implements WPDesk_Translable {
|
|
107 |
* @return $this
|
108 |
*/
|
109 |
public function add_plugin_require( $plugin_name, $nice_plugin_name = null ) {
|
110 |
-
if (
|
111 |
$this->plugin_require[ $plugin_name ] = $plugin_name;
|
112 |
} else {
|
113 |
$this->plugin_require[ $plugin_name ] = $nice_plugin_name;
|
@@ -123,7 +123,7 @@ class WPDesk_Basic_Requirement_Checker implements WPDesk_Translable {
|
|
123 |
* @return $this
|
124 |
*/
|
125 |
public function add_php_module_require( $module_name, $nice_name = null ) {
|
126 |
-
if (
|
127 |
$this->module_require[ $module_name ] = $module_name;
|
128 |
} else {
|
129 |
$this->module_require[ $module_name ] = $nice_name;
|
@@ -158,19 +158,19 @@ class WPDesk_Basic_Requirement_Checker implements WPDesk_Translable {
|
|
158 |
*/
|
159 |
private function prepare_requirement_notices() {
|
160 |
$notices = array();
|
161 |
-
if ( !
|
162 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run on PHP versions older than %s. Please contact your host and ask them to upgrade.',
|
163 |
$this->get_text_domain() ), esc_html( $this->plugin_name ), $this->min_php_version ) );
|
164 |
}
|
165 |
-
if ( !
|
166 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run on WordPress versions older than %s. Please update WordPress.',
|
167 |
$this->get_text_domain() ), esc_html( $this->plugin_name ), $this->min_wp_version ) );
|
168 |
}
|
169 |
-
if (
|
170 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run on WooCommerce versions older than %s. Please update WooCommerce.',
|
171 |
$this->get_text_domain() ), esc_html( $this->plugin_name ), $this->min_wc_version ) );
|
172 |
}
|
173 |
-
if (
|
174 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run without OpenSSL module version at least %s. Please update OpenSSL module.',
|
175 |
$this->get_text_domain() ), esc_html( $this->plugin_name ),
|
176 |
'0x' . dechex( $this->min_openssl_version ) ) );
|
@@ -189,7 +189,7 @@ class WPDesk_Basic_Requirement_Checker implements WPDesk_Translable {
|
|
189 |
* @return mixed
|
190 |
*/
|
191 |
public static function is_php_at_least( $min_version ) {
|
192 |
-
return version_compare(
|
193 |
}
|
194 |
|
195 |
/**
|
@@ -258,7 +258,7 @@ class WPDesk_Basic_Requirement_Checker implements WPDesk_Translable {
|
|
258 |
private function append_plugin_require_notices( $notices ) {
|
259 |
if ( count( $this->plugin_require ) > 0 ) {
|
260 |
foreach ( $this->plugin_require as $plugin_name => $nice_plugin_name ) {
|
261 |
-
if ( !
|
262 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run without %s active. Please install and activate %s plugin.',
|
263 |
$this->get_text_domain() ), esc_html( $this->plugin_name ),
|
264 |
esc_html( basename( $nice_plugin_name ) ), esc_html( basename( $nice_plugin_name ) ) ) );
|
@@ -294,7 +294,7 @@ class WPDesk_Basic_Requirement_Checker implements WPDesk_Translable {
|
|
294 |
private function append_module_require_notices( $notices ) {
|
295 |
if ( count( $this->module_require ) > 0 ) {
|
296 |
foreach ( $this->module_require as $module_name => $nice_module_name ) {
|
297 |
-
if ( !
|
298 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run without %s php module installed. Please contact your host and ask them to install %s.',
|
299 |
$this->get_text_domain() ), esc_html( $this->plugin_name ),
|
300 |
esc_html( basename( $nice_module_name ) ), esc_html( basename( $nice_module_name ) ) ) );
|
@@ -322,7 +322,7 @@ class WPDesk_Basic_Requirement_Checker implements WPDesk_Translable {
|
|
322 |
private function append_settings_require_notices( $notices ) {
|
323 |
if ( count( $this->setting_require ) > 0 ) {
|
324 |
foreach ( $this->setting_require as $setting => $value ) {
|
325 |
-
if ( !
|
326 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run without %s php setting set to %s. Please contact your host and ask them to set %s.',
|
327 |
$this->get_text_domain() ), esc_html( $this->plugin_name ), esc_html( basename( $setting ) ),
|
328 |
esc_html( basename( $value ) ), esc_html( basename( $setting ) ) ) );
|
@@ -340,19 +340,52 @@ class WPDesk_Basic_Requirement_Checker implements WPDesk_Translable {
|
|
340 |
* @return bool
|
341 |
*/
|
342 |
public static function is_setting_set( $name, $value ) {
|
343 |
-
return ini_get( $name ) ===
|
344 |
}
|
345 |
|
346 |
/**
|
347 |
* @return void
|
|
|
|
|
348 |
*/
|
349 |
public function disable_plugin_render_notice() {
|
350 |
add_action( self::HOOK_ADMIN_NOTICES_ACTION, array( $this, 'render_notices_action' ) );
|
351 |
}
|
352 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
/**
|
354 |
-
*
|
355 |
*
|
|
|
|
|
356 |
* @return void
|
357 |
*/
|
358 |
public function render_notices_action() {
|
1 |
<?php
|
2 |
|
3 |
+
if ( ! interface_exists( 'WPDesk_Translatable' ) ) {
|
4 |
+
require_once 'Translatable.php';
|
5 |
}
|
6 |
|
7 |
/**
|
8 |
* Checks requirements for plugin
|
9 |
* have to be compatible with PHP 5.2.x
|
10 |
*/
|
11 |
+
class WPDesk_Basic_Requirement_Checker implements WPDesk_Translatable {
|
12 |
const EXTENSION_NAME_OPENSSL = 'openssl';
|
13 |
const HOOK_ADMIN_NOTICES_ACTION = 'admin_notices';
|
14 |
|
15 |
/** @var string */
|
16 |
+
private $plugin_name;
|
17 |
/** @var string */
|
18 |
+
private $plugin_file;
|
19 |
/** @var string */
|
20 |
private $min_php_version;
|
21 |
/** @var string */
|
107 |
* @return $this
|
108 |
*/
|
109 |
public function add_plugin_require( $plugin_name, $nice_plugin_name = null ) {
|
110 |
+
if ( $nice_plugin_name === null ) {
|
111 |
$this->plugin_require[ $plugin_name ] = $plugin_name;
|
112 |
} else {
|
113 |
$this->plugin_require[ $plugin_name ] = $nice_plugin_name;
|
123 |
* @return $this
|
124 |
*/
|
125 |
public function add_php_module_require( $module_name, $nice_name = null ) {
|
126 |
+
if ( $nice_name === null ) {
|
127 |
$this->module_require[ $module_name ] = $module_name;
|
128 |
} else {
|
129 |
$this->module_require[ $module_name ] = $nice_name;
|
158 |
*/
|
159 |
private function prepare_requirement_notices() {
|
160 |
$notices = array();
|
161 |
+
if ( ! self::is_php_at_least( $this->min_php_version ) ) {
|
162 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run on PHP versions older than %s. Please contact your host and ask them to upgrade.',
|
163 |
$this->get_text_domain() ), esc_html( $this->plugin_name ), $this->min_php_version ) );
|
164 |
}
|
165 |
+
if ( ! self::is_wp_at_least( $this->min_wp_version ) ) {
|
166 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run on WordPress versions older than %s. Please update WordPress.',
|
167 |
$this->get_text_domain() ), esc_html( $this->plugin_name ), $this->min_wp_version ) );
|
168 |
}
|
169 |
+
if ( $this->min_wc_version !== null && $this->can_check_plugin_version() && ! self::is_wc_at_least( $this->min_wc_version ) ) {
|
170 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run on WooCommerce versions older than %s. Please update WooCommerce.',
|
171 |
$this->get_text_domain() ), esc_html( $this->plugin_name ), $this->min_wc_version ) );
|
172 |
}
|
173 |
+
if ( $this->min_openssl_version !== null && ! self::is_open_ssl_at_least( $this->min_openssl_version ) ) {
|
174 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run without OpenSSL module version at least %s. Please update OpenSSL module.',
|
175 |
$this->get_text_domain() ), esc_html( $this->plugin_name ),
|
176 |
'0x' . dechex( $this->min_openssl_version ) ) );
|
189 |
* @return mixed
|
190 |
*/
|
191 |
public static function is_php_at_least( $min_version ) {
|
192 |
+
return version_compare( PHP_VERSION, $min_version, '>=' );
|
193 |
}
|
194 |
|
195 |
/**
|
258 |
private function append_plugin_require_notices( $notices ) {
|
259 |
if ( count( $this->plugin_require ) > 0 ) {
|
260 |
foreach ( $this->plugin_require as $plugin_name => $nice_plugin_name ) {
|
261 |
+
if ( ! self::is_wp_plugin_active( $plugin_name ) ) {
|
262 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run without %s active. Please install and activate %s plugin.',
|
263 |
$this->get_text_domain() ), esc_html( $this->plugin_name ),
|
264 |
esc_html( basename( $nice_plugin_name ) ), esc_html( basename( $nice_plugin_name ) ) ) );
|
294 |
private function append_module_require_notices( $notices ) {
|
295 |
if ( count( $this->module_require ) > 0 ) {
|
296 |
foreach ( $this->module_require as $module_name => $nice_module_name ) {
|
297 |
+
if ( ! self::is_module_active( $module_name ) ) {
|
298 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run without %s php module installed. Please contact your host and ask them to install %s.',
|
299 |
$this->get_text_domain() ), esc_html( $this->plugin_name ),
|
300 |
esc_html( basename( $nice_module_name ) ), esc_html( basename( $nice_module_name ) ) ) );
|
322 |
private function append_settings_require_notices( $notices ) {
|
323 |
if ( count( $this->setting_require ) > 0 ) {
|
324 |
foreach ( $this->setting_require as $setting => $value ) {
|
325 |
+
if ( ! self::is_setting_set( $setting, $value ) ) {
|
326 |
$notices[] = $this->prepare_notice_message( sprintf( __( 'The “%s” plugin cannot run without %s php setting set to %s. Please contact your host and ask them to set %s.',
|
327 |
$this->get_text_domain() ), esc_html( $this->plugin_name ), esc_html( basename( $setting ) ),
|
328 |
esc_html( basename( $value ) ), esc_html( basename( $setting ) ) ) );
|
340 |
* @return bool
|
341 |
*/
|
342 |
public static function is_setting_set( $name, $value ) {
|
343 |
+
return ini_get( $name ) === (string) $value;
|
344 |
}
|
345 |
|
346 |
/**
|
347 |
* @return void
|
348 |
+
*
|
349 |
+
* @deprecated use render_notices or disable_plugin
|
350 |
*/
|
351 |
public function disable_plugin_render_notice() {
|
352 |
add_action( self::HOOK_ADMIN_NOTICES_ACTION, array( $this, 'render_notices_action' ) );
|
353 |
}
|
354 |
|
355 |
+
/**
|
356 |
+
* Renders requirement notices in admin panel
|
357 |
+
*
|
358 |
+
* @return void
|
359 |
+
*/
|
360 |
+
public function render_notices() {
|
361 |
+
add_action( self::HOOK_ADMIN_NOTICES_ACTION, array( $this, 'render_notices_action' ) );
|
362 |
+
}
|
363 |
+
|
364 |
+
/**
|
365 |
+
* Renders requirement notices in admin panel
|
366 |
+
*
|
367 |
+
* @return void
|
368 |
+
*/
|
369 |
+
public function disable_plugin() {
|
370 |
+
add_action( self::HOOK_ADMIN_NOTICES_ACTION, array( $this, 'deactivate_action' ) );
|
371 |
+
}
|
372 |
+
|
373 |
+
/**
|
374 |
+
* @internal Do not use as public. Public only for wp action.
|
375 |
+
*
|
376 |
+
* @return void
|
377 |
+
*/
|
378 |
+
public function deactivate_action() {
|
379 |
+
if ( isset( $this->plugin_file ) ) {
|
380 |
+
deactivate_plugins( plugin_basename( $this->plugin_file ) );
|
381 |
+
}
|
382 |
+
}
|
383 |
+
|
384 |
/**
|
385 |
+
* Should be called as WordPress action
|
386 |
*
|
387 |
+
* @internal Do not use as public. Public only for wp action.
|
388 |
+
*
|
389 |
* @return void
|
390 |
*/
|
391 |
public function render_notices_action() {
|
vendor/wpdesk/wp-basic-requirements/src/Plugin/Has_Plugin_Info.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if ( ! interface_exists( '
|
4 |
-
require_once
|
5 |
}
|
6 |
|
7 |
|
@@ -10,7 +10,7 @@ if ( ! interface_exists( 'WPDesk_Translable' ) ) {
|
|
10 |
*
|
11 |
* have to be compatible with PHP 5.2.x
|
12 |
*/
|
13 |
-
interface WPDesk_Has_Plugin_Info extends
|
14 |
/**
|
15 |
* @return string
|
16 |
*/
|
1 |
<?php
|
2 |
|
3 |
+
if ( ! interface_exists( 'WPDesk_Translatable' ) ) {
|
4 |
+
require_once __DIR__ . '/../Translatable.php';
|
5 |
}
|
6 |
|
7 |
|
10 |
*
|
11 |
* have to be compatible with PHP 5.2.x
|
12 |
*/
|
13 |
+
interface WPDesk_Has_Plugin_Info extends WPDesk_Translatable {
|
14 |
/**
|
15 |
* @return string
|
16 |
*/
|
vendor/wpdesk/wp-basic-requirements/src/Plugin/Plugin_Info.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if ( ! interface_exists( '
|
4 |
-
require_once
|
5 |
}
|
6 |
if ( ! class_exists( 'WPDesk_Buildable' ) ) {
|
7 |
-
require_once
|
8 |
}
|
9 |
if ( ! class_exists( 'WPDesk_Has_Plugin_Info' ) ) {
|
10 |
require_once 'Has_Plugin_Info.php';
|
@@ -15,7 +15,7 @@ if ( ! class_exists( 'WPDesk_Has_Plugin_Info' ) ) {
|
|
15 |
*
|
16 |
* have to be compatible with PHP 5.2.x
|
17 |
*/
|
18 |
-
class WPDesk_Plugin_Info implements
|
19 |
/** @var string */
|
20 |
private $plugin_file_name;
|
21 |
|
1 |
<?php
|
2 |
|
3 |
+
if ( ! interface_exists( 'WPDesk_Translatable' ) ) {
|
4 |
+
require_once __DIR__ . '/../Translatable.php';
|
5 |
}
|
6 |
if ( ! class_exists( 'WPDesk_Buildable' ) ) {
|
7 |
+
require_once __DIR__ . '/../Buildable.php';
|
8 |
}
|
9 |
if ( ! class_exists( 'WPDesk_Has_Plugin_Info' ) ) {
|
10 |
require_once 'Has_Plugin_Info.php';
|
15 |
*
|
16 |
* have to be compatible with PHP 5.2.x
|
17 |
*/
|
18 |
+
class WPDesk_Plugin_Info implements WPDesk_Translatable, WPDesk_Buildable, WPDesk_Has_Plugin_Info {
|
19 |
/** @var string */
|
20 |
private $plugin_file_name;
|
21 |
|
vendor/wpdesk/wp-basic-requirements/src/Translable.php
CHANGED
@@ -1,9 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* Have
|
5 |
-
*
|
6 |
-
* have to be compatible with PHP 5.2.x
|
7 |
*/
|
8 |
interface WPDesk_Translable {
|
9 |
/** @return string */
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* @deprecated Have typo so better use WPDesk_Translatable
|
|
|
|
|
5 |
*/
|
6 |
interface WPDesk_Translable {
|
7 |
/** @return string */
|
vendor/wpdesk/wp-basic-requirements/src/Translatable.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! interface_exists( 'WPDesk_Translable' ) ) {
|
4 |
+
require_once 'Translable.php';
|
5 |
+
}
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Have info about textdomain - how to translate texts
|
9 |
+
*
|
10 |
+
* have to be compatible with PHP 5.2.x
|
11 |
+
*/
|
12 |
+
interface WPDesk_Translatable extends WPDesk_Translable {
|
13 |
+
/** @return string */
|
14 |
+
public function get_text_domain();
|
15 |
+
}
|
vendor/wpdesk/wp-basic-requirements/tests/unit/Test_Basic_Requirement_Checker.php
CHANGED
@@ -154,23 +154,14 @@ class Test_Basic_Requirement_Checker extends PHPUnit\Framework\TestCase {
|
|
154 |
$requirements = $this->create_requirements_for_php_wp( self::ALWAYS_NOT_VALID_PHP_VERSION,
|
155 |
self::ALWAYS_VALID_WP_VERSION );
|
156 |
|
157 |
-
WP_Mock::expectActionAdded( WPDesk_Basic_Requirement_Checker::HOOK_ADMIN_NOTICES_ACTION,
|
158 |
-
[ $requirements, 'deactivate_action' ] );
|
159 |
WP_Mock::expectActionAdded( WPDesk_Basic_Requirement_Checker::HOOK_ADMIN_NOTICES_ACTION,
|
160 |
[ $requirements, 'render_notices_action' ] );
|
161 |
|
162 |
$this->assertFalse( $requirements->are_requirements_met() );
|
163 |
-
$requirements->
|
164 |
-
|
165 |
-
WP_Mock::wpFunction( 'deactivate_plugins' )
|
166 |
-
->once();
|
167 |
-
|
168 |
-
WP_Mock::wpFunction( 'plugin_basename' )
|
169 |
-
->once()
|
170 |
-
->andReturn( 'whatever' );
|
171 |
|
172 |
$this->expectOutputRegex( '/cannot run on PHP/' );
|
173 |
-
$requirements->deactivate_action();
|
174 |
$requirements->render_notices_action();
|
175 |
}
|
176 |
}
|
154 |
$requirements = $this->create_requirements_for_php_wp( self::ALWAYS_NOT_VALID_PHP_VERSION,
|
155 |
self::ALWAYS_VALID_WP_VERSION );
|
156 |
|
|
|
|
|
157 |
WP_Mock::expectActionAdded( WPDesk_Basic_Requirement_Checker::HOOK_ADMIN_NOTICES_ACTION,
|
158 |
[ $requirements, 'render_notices_action' ] );
|
159 |
|
160 |
$this->assertFalse( $requirements->are_requirements_met() );
|
161 |
+
$requirements->disable_plugin();
|
162 |
+
$requirements->render_notices();
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
$this->expectOutputRegex( '/cannot run on PHP/' );
|
|
|
165 |
$requirements->render_notices_action();
|
166 |
}
|
167 |
}
|
vendor/wpdesk/wp-saas-platform-client/README.md
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[![pipeline status](https://gitlab.com/wpdesk/wp-saas-platform-client/badges/master/pipeline.svg)](https://gitlab.com/wpdesk/wp-saas-platform-client/commits/master)
|
2 |
+
Integration: [![coverage report](https://gitlab.com/wpdesk/wp-saas-platform-client/badges/master/coverage.svg?job=integration+test+lastest+coverage)](https://gitlab.com/wpdesk/wp-saas-platform-client/commits/master)
|
3 |
+
Unit: [![coverage report](https://gitlab.com/wpdesk/wp-saas-platform-client/badges/master/coverage.svg?job=unit+test+lastest+coverage)](https://gitlab.com/wpdesk/wp-saas-platform-client/commits/master)
|
4 |
+
|
5 |
+
SaaS Platform Client
|
6 |
+
====================
|
vendor/wpdesk/wp-saas-platform-client/changelog.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
= 1.6 - 2018-12-06 =
|
3 |
* Added default request headers
|
1 |
+
= 1.6.3 - 2018-12-10 =
|
2 |
+
* Added support for domain not allowed response code: 462
|
3 |
+
|
4 |
+
= 1.6.2 - 2018-12-06 =
|
5 |
+
* Added support for platform version hash in response headers
|
6 |
|
7 |
= 1.6 - 2018-12-06 =
|
8 |
* Added default request headers
|
vendor/wpdesk/wp-saas-platform-client/composer.json
CHANGED
@@ -17,8 +17,8 @@
|
|
17 |
"phpunit/phpunit": "<7",
|
18 |
"wp-coding-standards/wpcs": "^0.14.1",
|
19 |
"squizlabs/php_codesniffer": "^3.0.2",
|
20 |
-
"
|
21 |
-
"
|
22 |
},
|
23 |
"autoload": {
|
24 |
"psr-4": {
|
17 |
"phpunit/phpunit": "<7",
|
18 |
"wp-coding-standards/wpcs": "^0.14.1",
|
19 |
"squizlabs/php_codesniffer": "^3.0.2",
|
20 |
+
"mockery/mockery": "*",
|
21 |
+
"10up/wp_mock": "*"
|
22 |
},
|
23 |
"autoload": {
|
24 |
"psr-4": {
|
vendor/wpdesk/wp-saas-platform-client/src/ApiClient/CachedClient.php
CHANGED
@@ -24,8 +24,6 @@ use WPDesk\SaasPlatformClient\Serializer\Serializer;
|
|
24 |
class CachedClient implements Client, CacheItemCreator, CacheItemVerifier
|
25 |
{
|
26 |
|
27 |
-
const OPTION_FS_SAAS_PLATFORM_VERSION = 'fs-saas-platform-version';
|
28 |
-
|
29 |
/** @var Client */
|
30 |
private $client;
|
31 |
|
@@ -83,58 +81,8 @@ class CachedClient implements Client, CacheItemCreator, CacheItemVerifier
|
|
83 |
*/
|
84 |
public function sendRequest(Request $request)
|
85 |
{
|
86 |
-
$this->
|
87 |
-
return $
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Maybe clear cache before request.
|
92 |
-
*
|
93 |
-
* @param Request $request
|
94 |
-
*
|
95 |
-
* @return bool
|
96 |
-
* @throws \Psr\SimpleCache\InvalidArgumentException
|
97 |
-
*/
|
98 |
-
private function maybeClearCacheBeforeRequest(Request $request)
|
99 |
-
{
|
100 |
-
if (! $request instanceof GetStatusRequest) {
|
101 |
-
try {
|
102 |
-
$statusResponse = $this->sendStatusRequest();
|
103 |
-
$status = $statusResponse->getStatus();
|
104 |
-
if (!$this->isLocalPlatformVersionCurrent($status)) {
|
105 |
-
$this->cache->clear();
|
106 |
-
update_option(self::OPTION_FS_SAAS_PLATFORM_VERSION, $status->getPlatformVersion());
|
107 |
-
}
|
108 |
-
} catch (\Exception $e) {
|
109 |
-
$this->cache->clear();
|
110 |
-
}
|
111 |
-
}
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Send status request.
|
116 |
-
*
|
117 |
-
* @return GetStatusResponse
|
118 |
-
* @throws \Psr\SimpleCache\InvalidArgumentException
|
119 |
-
*/
|
120 |
-
private function sendStatusRequest()
|
121 |
-
{
|
122 |
-
return new GetStatusResponse(new ProtectedResponse($this->sendRequest(new GetStatusRequest())));
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Is local platform version current?
|
127 |
-
*
|
128 |
-
* @param Status $status
|
129 |
-
*
|
130 |
-
* @return bool
|
131 |
-
*/
|
132 |
-
private function isLocalPlatformVersionCurrent(Status $status)
|
133 |
-
{
|
134 |
-
if ($status->getPlatformVersion() === get_option(self::OPTION_FS_SAAS_PLATFORM_VERSION, '-1')) {
|
135 |
-
return true;
|
136 |
-
}
|
137 |
-
return false;
|
138 |
}
|
139 |
|
140 |
/**
|
24 |
class CachedClient implements Client, CacheItemCreator, CacheItemVerifier
|
25 |
{
|
26 |
|
|
|
|
|
27 |
/** @var Client */
|
28 |
private $client;
|
29 |
|
81 |
*/
|
82 |
public function sendRequest(Request $request)
|
83 |
{
|
84 |
+
$response = $this->cacheDispatcher->dispatch($request, $this, $this);
|
85 |
+
return $response;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
|
88 |
/**
|
vendor/wpdesk/wp-saas-platform-client/src/ApiClient/ClientFactory.php
CHANGED
@@ -27,7 +27,7 @@ class ClientFactory
|
|
27 |
);
|
28 |
|
29 |
if ($options->isCachedClient()) {
|
30 |
-
$client = new CachedClient($client, new WordpressCache()
|
31 |
}
|
32 |
|
33 |
return $client;
|
27 |
);
|
28 |
|
29 |
if ($options->isCachedClient()) {
|
30 |
+
$client = new CachedClient($client, new WordpressCache());
|
31 |
}
|
32 |
|
33 |
return $client;
|
vendor/wpdesk/wp-saas-platform-client/src/ApiClient/ClientImplementation.php
CHANGED
@@ -15,7 +15,7 @@ use WPDesk\SaasPlatformClient\Serializer\Serializer;
|
|
15 |
|
16 |
class ClientImplementation implements Client, LoggerAwareInterface
|
17 |
{
|
18 |
-
const CLIENT_VERSION = '1.6';
|
19 |
|
20 |
const DEFAULT_TIMEOUT = 10;
|
21 |
|
@@ -113,7 +113,8 @@ class ClientImplementation implements Client, LoggerAwareInterface
|
|
113 |
{
|
114 |
$apiResponse = new RawResponse(
|
115 |
$this->serializer->unserialize($response->getBody()),
|
116 |
-
$response->getResponseCode()
|
|
|
117 |
);
|
118 |
|
119 |
return $apiResponse;
|
15 |
|
16 |
class ClientImplementation implements Client, LoggerAwareInterface
|
17 |
{
|
18 |
+
const CLIENT_VERSION = '1.6.2';
|
19 |
|
20 |
const DEFAULT_TIMEOUT = 10;
|
21 |
|
113 |
{
|
114 |
$apiResponse = new RawResponse(
|
115 |
$this->serializer->unserialize($response->getBody()),
|
116 |
+
$response->getResponseCode(),
|
117 |
+
$response->getHeaders()
|
118 |
);
|
119 |
|
120 |
return $apiResponse;
|
vendor/wpdesk/wp-saas-platform-client/src/ApiClient/RequestCacheInfoResolver.php
CHANGED
@@ -4,13 +4,13 @@ namespace WPDesk\SaasPlatformClient\ApiClient;
|
|
4 |
|
5 |
use WPDesk\SaasPlatformClient\Cache\CacheInfoResolver;
|
6 |
use WPDesk\SaasPlatformClient\Cache\HowToCache;
|
7 |
-
use WPDesk\SaasPlatformClient\Request\
|
|
|
8 |
use WPDesk\SaasPlatformClient\Request\Request;
|
9 |
-
use WPDesk\SaasPlatformClient\Request\ShippingServices\GetListRequest;
|
10 |
-
use WPDesk\SaasPlatformClient\Request\ShippingServices\GetServiceRequest;
|
11 |
-
use WPDesk\SaasPlatformClient\Request\ShippingServicesSettings\GetSettingsRequest;
|
12 |
use WPDesk\SaasPlatformClient\Request\ShippingServicesSettings\PutSettingsRequest;
|
13 |
use WPDesk\SaasPlatformClient\Request\Status\GetStatusRequest;
|
|
|
|
|
14 |
|
15 |
class RequestCacheInfoResolver implements CacheInfoResolver
|
16 |
{
|
@@ -18,15 +18,10 @@ class RequestCacheInfoResolver implements CacheInfoResolver
|
|
18 |
const DEFAULT_CACHE_TTL = 86400; //24 hours
|
19 |
const CACHE_TTL_ONE_MINUTE = 60;
|
20 |
|
21 |
-
|
22 |
-
* RequestCacheInfoResolver constructor.
|
23 |
-
*
|
24 |
-
*/
|
25 |
-
public function __construct()
|
26 |
-
{
|
27 |
-
}
|
28 |
|
29 |
/**
|
|
|
30 |
* @param Request $request
|
31 |
*
|
32 |
* @return bool
|
@@ -44,22 +39,7 @@ class RequestCacheInfoResolver implements CacheInfoResolver
|
|
44 |
*/
|
45 |
public function isSupported($request)
|
46 |
{
|
47 |
-
if ($request instanceof
|
48 |
-
return true;
|
49 |
-
}
|
50 |
-
if ($request instanceof GetFieldsRequest) {
|
51 |
-
return true;
|
52 |
-
}
|
53 |
-
if ($request instanceof GetListRequest) {
|
54 |
-
return true;
|
55 |
-
}
|
56 |
-
if ($request instanceof GetServiceRequest) {
|
57 |
-
return true;
|
58 |
-
}
|
59 |
-
if ($request instanceof GetSettingsRequest) {
|
60 |
-
return true;
|
61 |
-
}
|
62 |
-
if ($request instanceof PutSettingsRequest) {
|
63 |
return true;
|
64 |
}
|
65 |
return false;
|
@@ -73,8 +53,16 @@ class RequestCacheInfoResolver implements CacheInfoResolver
|
|
73 |
*/
|
74 |
public function shouldCache($request)
|
75 |
{
|
76 |
-
if (
|
77 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
return false;
|
80 |
}
|
@@ -85,36 +73,61 @@ class RequestCacheInfoResolver implements CacheInfoResolver
|
|
85 |
*
|
86 |
* @return HowToCache
|
87 |
*/
|
88 |
-
public function
|
89 |
{
|
90 |
$howToCache = new HowToCache($this->prepareCacheKey($request), self::DEFAULT_CACHE_TTL);
|
91 |
-
if ($request instanceof GetStatusRequest) {
|
92 |
-
$howToCache->setCacheTtl(self::CACHE_TTL_ONE_MINUTE);
|
93 |
-
}
|
94 |
return $howToCache;
|
95 |
}
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
/**
|
98 |
*
|
99 |
* @param Request $request
|
|
|
100 |
*
|
101 |
* @return bool
|
102 |
*/
|
103 |
-
public function shouldClearCache($request)
|
104 |
{
|
105 |
if ($request instanceof PutSettingsRequest) {
|
106 |
return true;
|
107 |
}
|
|
|
|
|
|
|
|
|
108 |
return false;
|
109 |
}
|
110 |
|
111 |
/**
|
112 |
*
|
113 |
* @param Request $request
|
|
|
114 |
*
|
115 |
* @return string[]
|
116 |
*/
|
117 |
-
public function shouldClearKeys($request)
|
118 |
{
|
119 |
if ('GET' !== $request->getMethod()) {
|
120 |
return [$this->prepareCacheKey($request)];
|
4 |
|
5 |
use WPDesk\SaasPlatformClient\Cache\CacheInfoResolver;
|
6 |
use WPDesk\SaasPlatformClient\Cache\HowToCache;
|
7 |
+
use WPDesk\SaasPlatformClient\Request\AuthRequest;
|
8 |
+
use WPDesk\SaasPlatformClient\Request\BasicRequest;
|
9 |
use WPDesk\SaasPlatformClient\Request\Request;
|
|
|
|
|
|
|
10 |
use WPDesk\SaasPlatformClient\Request\ShippingServicesSettings\PutSettingsRequest;
|
11 |
use WPDesk\SaasPlatformClient\Request\Status\GetStatusRequest;
|
12 |
+
use WPDesk\SaasPlatformClient\Response\ApiResponse;
|
13 |
+
use WPDesk\SaasPlatformClient\Response\RawResponse;
|
14 |
|
15 |
class RequestCacheInfoResolver implements CacheInfoResolver
|
16 |
{
|
18 |
const DEFAULT_CACHE_TTL = 86400; //24 hours
|
19 |
const CACHE_TTL_ONE_MINUTE = 60;
|
20 |
|
21 |
+
const OPTION_FS_SAAS_PLATFORM_VERSION_HASH = 'fs-saas-platform-version-hash';
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
/**
|
24 |
+
*
|
25 |
* @param Request $request
|
26 |
*
|
27 |
* @return bool
|
39 |
*/
|
40 |
public function isSupported($request)
|
41 |
{
|
42 |
+
if ($request instanceof BasicRequest) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
return true;
|
44 |
}
|
45 |
return false;
|
53 |
*/
|
54 |
public function shouldCache($request)
|
55 |
{
|
56 |
+
if ($request instanceof ConnectKeyInfoRequest) {
|
57 |
+
return false;
|
58 |
+
}
|
59 |
+
if ($request instanceof GetStatusRequest) {
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
if ($request instanceof BasicRequest) {
|
63 |
+
if ('GET' === $request->getMethod()) {
|
64 |
+
return true;
|
65 |
+
}
|
66 |
}
|
67 |
return false;
|
68 |
}
|
73 |
*
|
74 |
* @return HowToCache
|
75 |
*/
|
76 |
+
public function prepareHowToCache($request)
|
77 |
{
|
78 |
$howToCache = new HowToCache($this->prepareCacheKey($request), self::DEFAULT_CACHE_TTL);
|
|
|
|
|
|
|
79 |
return $howToCache;
|
80 |
}
|
81 |
|
82 |
+
/**
|
83 |
+
* @param ApiResponse $response
|
84 |
+
*
|
85 |
+
* @return bool
|
86 |
+
*/
|
87 |
+
private function isPlatformVersionFromResponseChanged(ApiResponse $response)
|
88 |
+
{
|
89 |
+
$stored_hash = get_option(self::OPTION_FS_SAAS_PLATFORM_VERSION_HASH, '');
|
90 |
+
if ($stored_hash !== $response->getPlatformVersionHash()) {
|
91 |
+
return true;
|
92 |
+
}
|
93 |
+
return false;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* @param ApiResponse $response
|
98 |
+
*/
|
99 |
+
private function storePlatformVersionHashFromResponse(ApiResponse $response)
|
100 |
+
{
|
101 |
+
update_option(self::OPTION_FS_SAAS_PLATFORM_VERSION_HASH, $response->getPlatformVersionHash());
|
102 |
+
}
|
103 |
+
|
104 |
/**
|
105 |
*
|
106 |
* @param Request $request
|
107 |
+
* @param mixed $item
|
108 |
*
|
109 |
* @return bool
|
110 |
*/
|
111 |
+
public function shouldClearCache($request, $item)
|
112 |
{
|
113 |
if ($request instanceof PutSettingsRequest) {
|
114 |
return true;
|
115 |
}
|
116 |
+
if ($item instanceof ApiResponse && $this->isPlatformVersionFromResponseChanged($item)) {
|
117 |
+
$this->storePlatformVersionHashFromResponse($item);
|
118 |
+
return true;
|
119 |
+
}
|
120 |
return false;
|
121 |
}
|
122 |
|
123 |
/**
|
124 |
*
|
125 |
* @param Request $request
|
126 |
+
* @param mixed $item
|
127 |
*
|
128 |
* @return string[]
|
129 |
*/
|
130 |
+
public function shouldClearKeys($request, $item)
|
131 |
{
|
132 |
if ('GET' !== $request->getMethod()) {
|
133 |
return [$this->prepareCacheKey($request)];
|
vendor/wpdesk/wp-saas-platform-client/src/Cache/CacheDispatcher.php
CHANGED
@@ -91,10 +91,13 @@ class CacheDispatcher
|
|
91 |
*/
|
92 |
private function getOrCreateItem($resolver, $object, $cacheItemCreator, $cacheItemVerifier)
|
93 |
{
|
94 |
-
$howToCache = $resolver->
|
95 |
-
|
96 |
-
if (
|
97 |
-
|
|
|
|
|
|
|
98 |
}
|
99 |
|
100 |
$item = $cacheItemCreator->createCacheItem($object);
|
@@ -102,10 +105,10 @@ class CacheDispatcher
|
|
102 |
if ($resolver->shouldCache($object)) {
|
103 |
$this->cache->set($howToCache->getCacheKey(), serialize($item), $howToCache->getCacheTtl());
|
104 |
}
|
105 |
-
if ($resolver->shouldClearCache($object)) {
|
106 |
$this->cache->clear();
|
107 |
} else {
|
108 |
-
$this->cache->deleteMultiple($resolver->shouldClearKeys($object));
|
109 |
}
|
110 |
return $item;
|
111 |
}
|
91 |
*/
|
92 |
private function getOrCreateItem($resolver, $object, $cacheItemCreator, $cacheItemVerifier)
|
93 |
{
|
94 |
+
$howToCache = $resolver->prepareHowToCache($object);
|
95 |
+
|
96 |
+
if ($resolver->shouldCache($object)) {
|
97 |
+
$item = $this->getItemFromCache($howToCache->getCacheKey(), $cacheItemVerifier);
|
98 |
+
if (null != $item) {
|
99 |
+
return $item;
|
100 |
+
}
|
101 |
}
|
102 |
|
103 |
$item = $cacheItemCreator->createCacheItem($object);
|
105 |
if ($resolver->shouldCache($object)) {
|
106 |
$this->cache->set($howToCache->getCacheKey(), serialize($item), $howToCache->getCacheTtl());
|
107 |
}
|
108 |
+
if ($resolver->shouldClearCache($object, $item)) {
|
109 |
$this->cache->clear();
|
110 |
} else {
|
111 |
+
$this->cache->deleteMultiple($resolver->shouldClearKeys($object, $item));
|
112 |
}
|
113 |
return $item;
|
114 |
}
|
vendor/wpdesk/wp-saas-platform-client/src/Cache/CacheInfoResolver.php
CHANGED
@@ -30,24 +30,26 @@ interface CacheInfoResolver
|
|
30 |
*
|
31 |
* @return HowToCache
|
32 |
*/
|
33 |
-
public function
|
34 |
|
35 |
/**
|
36 |
* Should clear cache.
|
37 |
*
|
38 |
* @param object $object
|
|
|
39 |
*
|
40 |
* @return bool
|
41 |
*/
|
42 |
-
public function shouldClearCache($object);
|
43 |
|
44 |
/**
|
45 |
* Should clear keys.
|
46 |
*
|
47 |
* @param object $object
|
|
|
48 |
*
|
49 |
* @return string[]
|
50 |
*/
|
51 |
-
public function shouldClearKeys($object);
|
52 |
|
53 |
}
|
30 |
*
|
31 |
* @return HowToCache
|
32 |
*/
|
33 |
+
public function prepareHowToCache($object);
|
34 |
|
35 |
/**
|
36 |
* Should clear cache.
|
37 |
*
|
38 |
* @param object $object
|
39 |
+
* @param mixed $item
|
40 |
*
|
41 |
* @return bool
|
42 |
*/
|
43 |
+
public function shouldClearCache($object, $item);
|
44 |
|
45 |
/**
|
46 |
* Should clear keys.
|
47 |
*
|
48 |
* @param object $object
|
49 |
+
* @param mixed $item
|
50 |
*
|
51 |
* @return string[]
|
52 |
*/
|
53 |
+
public function shouldClearKeys($object, $item);
|
54 |
|
55 |
}
|
vendor/wpdesk/wp-saas-platform-client/src/Cache/CacheItemCreator.php
CHANGED
@@ -3,6 +3,8 @@
|
|
3 |
namespace WPDesk\SaasPlatformClient\Cache;
|
4 |
|
5 |
/**
|
|
|
|
|
6 |
* Interface CacheItemCreator
|
7 |
* @package WPDesk\SaasPlatformClient\Cache
|
8 |
*/
|
3 |
namespace WPDesk\SaasPlatformClient\Cache;
|
4 |
|
5 |
/**
|
6 |
+
* Cache item creator.
|
7 |
+
*
|
8 |
* Interface CacheItemCreator
|
9 |
* @package WPDesk\SaasPlatformClient\Cache
|
10 |
*/
|
vendor/wpdesk/wp-saas-platform-client/src/Cache/CacheItemVerifier.php
CHANGED
@@ -3,6 +3,8 @@
|
|
3 |
namespace WPDesk\SaasPlatformClient\Cache;
|
4 |
|
5 |
/**
|
|
|
|
|
6 |
* Interface CacheItemVerifier
|
7 |
* @package WPDesk\SaasPlatformClient\Cache
|
8 |
*/
|
3 |
namespace WPDesk\SaasPlatformClient\Cache;
|
4 |
|
5 |
/**
|
6 |
+
* Cache item verifier.
|
7 |
+
*
|
8 |
* Interface CacheItemVerifier
|
9 |
* @package WPDesk\SaasPlatformClient\Cache
|
10 |
*/
|
vendor/wpdesk/wp-saas-platform-client/src/Cache/HowToCache.php
CHANGED
@@ -2,6 +2,12 @@
|
|
2 |
|
3 |
namespace WPDesk\SaasPlatformClient\Cache;
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
class HowToCache
|
6 |
{
|
7 |
|
2 |
|
3 |
namespace WPDesk\SaasPlatformClient\Cache;
|
4 |
|
5 |
+
/**
|
6 |
+
* How to cache item.
|
7 |
+
*
|
8 |
+
* Class HowToCache
|
9 |
+
* @package WPDesk\SaasPlatformClient\Cache
|
10 |
+
*/
|
11 |
class HowToCache
|
12 |
{
|
13 |
|
vendor/wpdesk/wp-saas-platform-client/src/HttpClient/HttpClientResponse.php
CHANGED
@@ -32,7 +32,13 @@ class HttpClientResponse
|
|
32 |
*/
|
33 |
public function getHeaders()
|
34 |
{
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
|
38 |
/**
|
32 |
*/
|
33 |
public function getHeaders()
|
34 |
{
|
35 |
+
$headers = array();
|
36 |
+
$headers_rows = explode("\r\n", $this->headers);
|
37 |
+
foreach ($headers_rows as $headers_row) {
|
38 |
+
$header = explode(": ", $headers_row);
|
39 |
+
$headers[$header[0]] = isset($header[1])?$header[1]:$header[0];
|
40 |
+
}
|
41 |
+
return $headers;
|
42 |
}
|
43 |
|
44 |
/**
|
vendor/wpdesk/wp-saas-platform-client/src/Response/RawResponse.php
CHANGED
@@ -7,8 +7,10 @@ class RawResponse implements Response
|
|
7 |
const RESPONSE_CODE_SUCCESS = 200;
|
8 |
const RESPONSE_CODE_CREATED = 201;
|
9 |
const RESPONSE_CODE_ERROR_BAD_REQUEST = 400;
|
|
|
10 |
const RESPONSE_CODE_ERROR_FATAL = 500;
|
11 |
const RESPONSE_CODE_MAINTENANCE = 503;
|
|
|
12 |
|
13 |
/** @var array */
|
14 |
private $data;
|
@@ -16,15 +18,20 @@ class RawResponse implements Response
|
|
16 |
/** @var int */
|
17 |
private $code;
|
18 |
|
|
|
|
|
|
|
19 |
/**
|
20 |
* RawResponse constructor.
|
21 |
* @param array $body
|
22 |
* @param int $code
|
|
|
23 |
*/
|
24 |
-
public function __construct(array $body, $code)
|
25 |
{
|
26 |
$this->data = $body;
|
27 |
$this->code = (int)$code;
|
|
|
28 |
}
|
29 |
|
30 |
/**
|
@@ -57,6 +64,16 @@ class RawResponse implements Response
|
|
57 |
return $this->data;
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
/**
|
61 |
* Is any error occured
|
62 |
*
|
@@ -79,4 +96,18 @@ class RawResponse implements Response
|
|
79 |
return self::RESPONSE_CODE_MAINTENANCE === $code;
|
80 |
}
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
}
|
7 |
const RESPONSE_CODE_SUCCESS = 200;
|
8 |
const RESPONSE_CODE_CREATED = 201;
|
9 |
const RESPONSE_CODE_ERROR_BAD_REQUEST = 400;
|
10 |
+
const RESPONSE_CODE_DOMAIN_NOT_ALLOWED = 462;
|
11 |
const RESPONSE_CODE_ERROR_FATAL = 500;
|
12 |
const RESPONSE_CODE_MAINTENANCE = 503;
|
13 |
+
const HEADER_X_PLATFORM_VERSION_HASH = 'X-Platform-Version-Hash';
|
14 |
|
15 |
/** @var array */
|
16 |
private $data;
|
18 |
/** @var int */
|
19 |
private $code;
|
20 |
|
21 |
+
/** @var array */
|
22 |
+
private $headers;
|
23 |
+
|
24 |
/**
|
25 |
* RawResponse constructor.
|
26 |
* @param array $body
|
27 |
* @param int $code
|
28 |
+
* @param array $headers
|
29 |
*/
|
30 |
+
public function __construct(array $body, $code, array $headers)
|
31 |
{
|
32 |
$this->data = $body;
|
33 |
$this->code = (int)$code;
|
34 |
+
$this->headers = $headers;
|
35 |
}
|
36 |
|
37 |
/**
|
64 |
return $this->data;
|
65 |
}
|
66 |
|
67 |
+
/**
|
68 |
+
* Returns response body as array
|
69 |
+
*
|
70 |
+
* @return array
|
71 |
+
*/
|
72 |
+
public function getResponseHeaders()
|
73 |
+
{
|
74 |
+
return $this->headers;
|
75 |
+
}
|
76 |
+
|
77 |
/**
|
78 |
* Is any error occured
|
79 |
*
|
96 |
return self::RESPONSE_CODE_MAINTENANCE === $code;
|
97 |
}
|
98 |
|
99 |
+
/**
|
100 |
+
* Get platform version hash string.
|
101 |
+
*
|
102 |
+
* @return bool|string
|
103 |
+
*/
|
104 |
+
public function getPlatformVersionHash()
|
105 |
+
{
|
106 |
+
if (isset($this->headers[self::HEADER_X_PLATFORM_VERSION_HASH])) {
|
107 |
+
return $this->headers[self::HEADER_X_PLATFORM_VERSION_HASH];
|
108 |
+
}
|
109 |
+
return false;
|
110 |
+
}
|
111 |
+
|
112 |
+
|
113 |
}
|
vendor/wpdesk/wp-saas-platform-client/src/Response/Response.php
CHANGED
@@ -13,6 +13,9 @@ interface Response
|
|
13 |
/** @return array */
|
14 |
public function getResponseBody();
|
15 |
|
|
|
|
|
|
|
16 |
/** @return array */
|
17 |
public function getResponseErrorBody();
|
18 |
|
@@ -30,4 +33,11 @@ interface Response
|
|
30 |
*/
|
31 |
public function isMaintenance();
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
13 |
/** @return array */
|
14 |
public function getResponseBody();
|
15 |
|
16 |
+
/** @return array */
|
17 |
+
public function getResponseHeaders();
|
18 |
+
|
19 |
/** @return array */
|
20 |
public function getResponseErrorBody();
|
21 |
|
33 |
*/
|
34 |
public function isMaintenance();
|
35 |
|
36 |
+
/**
|
37 |
+
* Get platform version hash string.
|
38 |
+
*
|
39 |
+
* @return bool|string
|
40 |
+
*/
|
41 |
+
public function getPlatformVersionHash();
|
42 |
+
|
43 |
}
|
vendor/wpdesk/wp-saas-platform-client/src/Response/Traits/ApiResponseDecorator.php
CHANGED
@@ -51,6 +51,16 @@ trait ApiResponseDecorator
|
|
51 |
return $this->rawResponse->getResponseErrorBody();
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
/**
|
55 |
* Get links structure to the other request
|
56 |
*
|
@@ -72,6 +82,16 @@ trait ApiResponseDecorator
|
|
72 |
return $this->getResponseCode() === RawResponse::RESPONSE_CODE_ERROR_BAD_REQUEST;
|
73 |
}
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
/**
|
76 |
* Is it a FATAL ERROR response
|
77 |
*
|
@@ -112,4 +132,14 @@ trait ApiResponseDecorator
|
|
112 |
return $this->rawResponse->isMaintenance();
|
113 |
}
|
114 |
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
return $this->rawResponse->getResponseErrorBody();
|
52 |
}
|
53 |
|
54 |
+
/**
|
55 |
+
* Returns response body as array
|
56 |
+
*
|
57 |
+
* @return array
|
58 |
+
*/
|
59 |
+
public function getResponseHeaders()
|
60 |
+
{
|
61 |
+
return $this->rawResponse->getResponseHeaders();
|
62 |
+
}
|
63 |
+
|
64 |
/**
|
65 |
* Get links structure to the other request
|
66 |
*
|
82 |
return $this->getResponseCode() === RawResponse::RESPONSE_CODE_ERROR_BAD_REQUEST;
|
83 |
}
|
84 |
|
85 |
+
/**
|
86 |
+
* Is it a DOMAIN NOT ALLOWED response
|
87 |
+
*
|
88 |
+
* @return bool
|
89 |
+
*/
|
90 |
+
public function isDomainNotAllowed()
|
91 |
+
{
|
92 |
+
return $this->getResponseCode() === RawResponse::RESPONSE_CODE_DOMAIN_NOT_ALLOWED;
|
93 |
+
}
|
94 |
+
|
95 |
/**
|
96 |
* Is it a FATAL ERROR response
|
97 |
*
|
132 |
return $this->rawResponse->isMaintenance();
|
133 |
}
|
134 |
|
135 |
+
/**
|
136 |
+
* Get platform version hash string.
|
137 |
+
*
|
138 |
+
* @return bool|string
|
139 |
+
*/
|
140 |
+
public function getPlatformVersionHash()
|
141 |
+
{
|
142 |
+
return $this->rawResponse->getPlatformVersionHash();
|
143 |
+
}
|
144 |
+
|
145 |
+
}
|
vendor/wpdesk/wp-saas-platform-client/tests/unit/ApiCLient/TestRequestCacheInfoResolver.php
ADDED
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use WPDesk\SaasPlatformClient\Authentication\Token;
|
4 |
+
use WPDesk\SaasPlatformClient\Request\ShippingServices\GetServiceRequest;
|
5 |
+
use WPDesk\SaasPlatformClient\Cache\HowToCache;
|
6 |
+
use WPDesk\SaasPlatformClient\Request\ShippingServicesSettings\PutSettingsRequest;
|
7 |
+
use WPDesk\SaasPlatformClient\Model\ShippingServiceSetting;
|
8 |
+
|
9 |
+
class TestRequestCacheInfoResolver extends \WP_Mock\Tools\TestCase
|
10 |
+
{
|
11 |
+
|
12 |
+
/** @var \WPDesk\SaasPlatformClient\Cache\CacheInfoResolver */
|
13 |
+
private $cacheInfoResolver;
|
14 |
+
|
15 |
+
public function setUp()
|
16 |
+
{
|
17 |
+
$this->cacheInfoResolver = new \WPDesk\SaasPlatformClient\ApiClient\RequestCacheInfoResolver();
|
18 |
+
\WP_Mock::setUp();
|
19 |
+
}
|
20 |
+
|
21 |
+
public function tearDown()
|
22 |
+
{
|
23 |
+
\WP_Mock::tearDown();
|
24 |
+
}
|
25 |
+
|
26 |
+
public function testIsSupported()
|
27 |
+
{
|
28 |
+
$token = $this->createMock(Token::class);
|
29 |
+
|
30 |
+
$request = new GetServiceRequest($token, 1);
|
31 |
+
|
32 |
+
$this->assertTrue($this->cacheInfoResolver->isSupported($request), 'GetServiceRequest should be supported.');
|
33 |
+
|
34 |
+
$this->assertFalse($this->cacheInfoResolver->isSupported(new stdClass()), 'stdClass is not supported.');
|
35 |
+
}
|
36 |
+
|
37 |
+
public function testShouldCache()
|
38 |
+
{
|
39 |
+
$token = $this->createMock(Token::class);
|
40 |
+
|
41 |
+
$request = new GetServiceRequest($token, 1);
|
42 |
+
|
43 |
+
$this->assertTrue($this->cacheInfoResolver->shouldCache($request), 'GetServiceRequest should be cached.');
|
44 |
+
|
45 |
+
$this->assertFalse($this->cacheInfoResolver->shouldCache(new stdClass()), 'stdClass should not be supported.');
|
46 |
+
|
47 |
+
$tokenRequest = new \WPDesk\SaasPlatformClient\Request\Authentication\TokenRequest('', '', '');
|
48 |
+
|
49 |
+
$this->assertFalse(
|
50 |
+
$this->cacheInfoResolver->shouldCache($tokenRequest),
|
51 |
+
'POST requests should not be supported.'
|
52 |
+
);
|
53 |
+
}
|
54 |
+
|
55 |
+
public function testPrepareHowToCache()
|
56 |
+
{
|
57 |
+
$token = $this->createMock(Token::class);
|
58 |
+
|
59 |
+
$request = new GetServiceRequest($token, 1);
|
60 |
+
|
61 |
+
$this->assertInstanceOf(
|
62 |
+
HowToCache::class,
|
63 |
+
$this->cacheInfoResolver->prepareHowToCache($request)
|
64 |
+
);
|
65 |
+
}
|
66 |
+
|
67 |
+
public function testShouldClearCache()
|
68 |
+
{
|
69 |
+
|
70 |
+
$token = $this->createMock(Token::class);
|
71 |
+
|
72 |
+
$request = new GetServiceRequest($token, 1);
|
73 |
+
|
74 |
+
$jsonValue = '{
|
75 |
+
"account_number": "x",
|
76 |
+
"username": "ya",
|
77 |
+
"password": "z",
|
78 |
+
"key": "aa"
|
79 |
+
}';
|
80 |
+
|
81 |
+
$rawResponse = new \WPDesk\SaasPlatformClient\Response\RawResponse(
|
82 |
+
json_decode($jsonValue, true),
|
83 |
+
200,
|
84 |
+
array( \WPDesk\SaasPlatformClient\Response\RawResponse::HEADER_X_PLATFORM_VERSION_HASH => 'A' )
|
85 |
+
);
|
86 |
+
|
87 |
+
$item = new \WPDesk\SaasPlatformClient\Response\ShippingServices\GetShippingServiceResponse($rawResponse);
|
88 |
+
|
89 |
+
\WP_Mock::userFunction(
|
90 |
+
'get_option',
|
91 |
+
array(
|
92 |
+
'times' => 1,
|
93 |
+
'return' => 'A',
|
94 |
+
)
|
95 |
+
);
|
96 |
+
|
97 |
+
$this->assertFalse(
|
98 |
+
$this->cacheInfoResolver->shouldClearCache($request, $item),
|
99 |
+
'GetServiceRequest should not clear cache.'
|
100 |
+
);
|
101 |
+
|
102 |
+
$shippingServiceSetting = $this->createMock(
|
103 |
+
\WPDesk\SaasPlatformClient\Model\ShippingServiceSetting::class
|
104 |
+
);
|
105 |
+
|
106 |
+
$request = new PutSettingsRequest($token, $shippingServiceSetting);
|
107 |
+
|
108 |
+
$this->assertTrue(
|
109 |
+
$this->cacheInfoResolver->shouldClearCache($request, $item),
|
110 |
+
'PutSettingsRequest should clear cache.'
|
111 |
+
);
|
112 |
+
}
|
113 |
+
|
114 |
+
public function testShouldClearCacheWithPlatformVersion()
|
115 |
+
{
|
116 |
+
|
117 |
+
$token = $this->createMock(Token::class);
|
118 |
+
|
119 |
+
$request = new GetServiceRequest($token, 1);
|
120 |
+
|
121 |
+
$jsonValue = '{
|
122 |
+
"account_number": "x",
|
123 |
+
"username": "ya",
|
124 |
+
"password": "z",
|
125 |
+
"key": "aa"
|
126 |
+
}';
|
127 |
+
|
128 |
+
$rawResponse = new \WPDesk\SaasPlatformClient\Response\RawResponse(
|
129 |
+
json_decode($jsonValue, true),
|
130 |
+
200,
|
131 |
+
array(\WPDesk\SaasPlatformClient\Response\RawResponse::HEADER_X_PLATFORM_VERSION_HASH => 'A')
|
132 |
+
);
|
133 |
+
|
134 |
+
\WP_Mock::userFunction(
|
135 |
+
'get_option',
|
136 |
+
array(
|
137 |
+
'times' => 1,
|
138 |
+
'return' => 'A',
|
139 |
+
)
|
140 |
+
);
|
141 |
+
|
142 |
+
$item = new \WPDesk\SaasPlatformClient\Response\ShippingServices\GetShippingServiceResponse($rawResponse);
|
143 |
+
|
144 |
+
$this->assertFalse(
|
145 |
+
$this->cacheInfoResolver->shouldClearCache($request, $item),
|
146 |
+
'Should be cached - platform version is same as stored!'
|
147 |
+
);
|
148 |
+
|
149 |
+
\WP_Mock::userFunction(
|
150 |
+
'get_option',
|
151 |
+
array(
|
152 |
+
'times' => 1,
|
153 |
+
'return' => 'B',
|
154 |
+
)
|
155 |
+
);
|
156 |
+
|
157 |
+
\WP_Mock::userFunction(
|
158 |
+
'update_option',
|
159 |
+
array(
|
160 |
+
'times' => 1,
|
161 |
+
'return' => true,
|
162 |
+
)
|
163 |
+
);
|
164 |
+
|
165 |
+
$item = new \WPDesk\SaasPlatformClient\Response\ShippingServices\GetShippingServiceResponse($rawResponse);
|
166 |
+
|
167 |
+
$this->assertTrue(
|
168 |
+
$this->cacheInfoResolver->shouldClearCache($request, $item),
|
169 |
+
'Should not be cached - platform version is not same as stored!'
|
170 |
+
);
|
171 |
+
}
|
172 |
+
|
173 |
+
public function testShouldClearKeys()
|
174 |
+
{
|
175 |
+
$token = $this->createMock(Token::class);
|
176 |
+
|
177 |
+
$request = new GetServiceRequest($token, 1);
|
178 |
+
|
179 |
+
$jsonValue = '{
|
180 |
+
"account_number": "x",
|
181 |
+
"username": "ya",
|
182 |
+
"password": "z",
|
183 |
+
"key": "aa"
|
184 |
+
}';
|
185 |
+
|
186 |
+
$rawResponse = new \WPDesk\SaasPlatformClient\Response\RawResponse(
|
187 |
+
json_decode($jsonValue, true),
|
188 |
+
200,
|
189 |
+
array( \WPDesk\SaasPlatformClient\Response\RawResponse::HEADER_X_PLATFORM_VERSION_HASH => 'A' )
|
190 |
+
);
|
191 |
+
|
192 |
+
$item = new \WPDesk\SaasPlatformClient\Response\ShippingServices\GetShippingServiceResponse($rawResponse);
|
193 |
+
|
194 |
+
\WP_Mock::userFunction(
|
195 |
+
'get_option',
|
196 |
+
array(
|
197 |
+
'times' => 1,
|
198 |
+
'return' => 'A',
|
199 |
+
)
|
200 |
+
);
|
201 |
+
|
202 |
+
$this->assertFalse(
|
203 |
+
$this->cacheInfoResolver->shouldClearCache($request, $item),
|
204 |
+
'GetServiceRequest should not clear cache.'
|
205 |
+
);
|
206 |
+
|
207 |
+
$shippingServiceSetting = new ShippingServiceSetting(array('shipping_service' => '1', 'shop' => '1'));
|
208 |
+
|
209 |
+
$request = new PutSettingsRequest($token, $shippingServiceSetting);
|
210 |
+
|
211 |
+
$this->assertEquals(
|
212 |
+
array(md5($request->getEndpoint())),
|
213 |
+
$this->cacheInfoResolver->shouldClearKeys($request, $item)
|
214 |
+
);
|
215 |
+
}
|
216 |
+
|
217 |
+
}
|
vendor/wpdesk/wp-saas-platform-client/tests/unit/Response/TestMaintenanceResponseContext.php
CHANGED
@@ -10,7 +10,7 @@ class TestMaintenanceResponseContext extends \PHPUnit\Framework\TestCase
|
|
10 |
$rawRawResponse =
|
11 |
'{"maintenance_till":1577833200,"message":"Please update your UPS plugin to the newest version."}';
|
12 |
|
13 |
-
$rawResponse = new RawResponse(json_decode($rawRawResponse, true), 503);
|
14 |
|
15 |
$maintenanceResponseContext = new MaintenanceResponseContext($rawResponse);
|
16 |
|
10 |
$rawRawResponse =
|
11 |
'{"maintenance_till":1577833200,"message":"Please update your UPS plugin to the newest version."}';
|
12 |
|
13 |
+
$rawResponse = new RawResponse(json_decode($rawRawResponse, true), 503, array());
|
14 |
|
15 |
$maintenanceResponseContext = new MaintenanceResponseContext($rawResponse);
|
16 |
|
vendor/wpdesk/wp-saas-platform-client/tests/unit/Response/TestRate.php
CHANGED
@@ -29,7 +29,7 @@ class TestRate extends \PHPUnit\Framework\TestCase
|
|
29 |
]
|
30 |
}';
|
31 |
|
32 |
-
$rateResponse = new PostRateResponse(new RawResponse(json_decode($rawRateResponse, true), 200));
|
33 |
|
34 |
$rate = $rateResponse->getRate();
|
35 |
$this->assertAttributeCount(1, 'rates', $rate, "That response should have one rate");
|
29 |
]
|
30 |
}';
|
31 |
|
32 |
+
$rateResponse = new PostRateResponse(new RawResponse(json_decode($rawRateResponse, true), 200, array()));
|
33 |
|
34 |
$rate = $rateResponse->getRate();
|
35 |
$this->assertAttributeCount(1, 'rates', $rate, "That response should have one rate");
|
vendor/wpdesk/wp-saas-platform-client/tests/unit/bootstrap.php
CHANGED
@@ -4,3 +4,6 @@
|
|
4 |
*/
|
5 |
|
6 |
require_once __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
|
|
4 |
*/
|
5 |
|
6 |
require_once __DIR__ . '/../../vendor/autoload.php';
|
7 |
+
|
8 |
+
WP_Mock::setUsePatchwork( true );
|
9 |
+
WP_Mock::bootstrap();
|