PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.22
ووسلام – همگام سازی ووکامرس و باسلام v1.10.22
1.10.22 1.10.21 1.10.19 1.10.20 1.10.18 1.10.17 1.10.15 1.10.14 1.10.13 1.10.12 1.10.10 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.2 1.9.1 1.9.0 1.8.8 All 55 releases
← All changes | sync-basalam.php +42 -38 1.10.19 → 1.10.22 View file →
@@ -2,13 +2,14 @@
2 2
3 3 use SyncBasalam\Plugin;
4 4 use SyncBasalam\Admin\Settings\SettingsContainer;
5 5 use SyncBasalam\Activator;
6 -use SyncBasalam\JobsRunner;
7 -use SyncBasalam\Infrastructure\Container\AppServiceProvider;
8 -use SyncBasalam\Infrastructure\Container\Container;
9 -use SyncBasalam\Services\ForceUpdateGate;
10 -use SyncBasalam\Services\VendorSyncPolicy;
6 +use SyncBasalam\JobsRunner;
7 +use SyncBasalam\Infrastructure\Container\AppServiceProvider;
8 +use SyncBasalam\Infrastructure\Container\Container;
9 +use SyncBasalam\Services\ForceUpdateGate;
10 +use SyncBasalam\Services\VendorSyncPolicy;
11 +use SyncBasalam\Services\ScheduledProductSync;
11 12
12 13 defined('ABSPATH') || exit;
13 14
14 15 /**
@@ -13,12 +14,12 @@
13 14
14 15 /**
15 16 * Plugin Name: sync basalam | ووسلام
16 17 * Description: با استفاده از پلاگین ووسلام میتوایند تمامی محصولات ووکامرس را با یک کلیک به غرفه باسلامی خود اضافه کنید‌، همچنین تمامی سفارش باسلامی شما به سایت شما اضافه میگردد.
17 - * Version: 1.10.19
18 + * Version: 1.10.22
18 19 * Author: Woosalam Dev
19 - * Author URI: https://hamsalam.ir/wp
20 - * Plugin URI: https://hamsalam.ir/wp
20 + * Author URI: https://hamsalam.ir/wp
21 + * Plugin URI: https://hamsalam.ir/wp
21 22 * Text Domain: sync-basalam
22 23 * WC requires at least: 10.0.0
23 24 * WC tested up to: 9.9.5
24 25 * Requires Plugins: woocommerce
@@ -27,10 +28,10 @@
27 28 */
28 29
29 30 require_once __DIR__ . '/vendor/autoload.php';
30 31
31 -register_activation_hook(__FILE__, 'syncBasalamActivatePlugin');
32 -register_deactivation_hook(__FILE__, 'syncBasalamDeactivatePlugin');
32 +register_activation_hook(__FILE__, 'syncBasalamActivatePlugin');
33 +register_deactivation_hook(__FILE__, 'syncBasalamDeactivatePlugin');
33 34
34 35 add_action('before_woocommerce_init', function () {
35 36 if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) {
36 37 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true);
@@ -36,23 +37,23 @@
36 37 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true);
37 38 }
38 39 });
39 40
40 -$forceUpdate = get_option('sync_basalam_force_update');
41 -$installedVersion = (string) (get_option('sync_basalam_version') ?: '0.0.0');
42 -
43 -if (ForceUpdateGate::shouldBlock($forceUpdate, $installedVersion, Plugin::VERSION)) {
44 - add_action('admin_notices', function () {
45 - $template = __DIR__ . '/templates/notifications/ForceUpdateAlert.php';
46 - require_once $template;
47 - });
48 - return;
49 -}
50 -
51 -if ($forceUpdate) {
52 - delete_option('sync_basalam_force_update');
53 -}
41 +$forceUpdate = get_option('sync_basalam_force_update');
42 +$installedVersion = (string) (get_option('sync_basalam_version') ?: '0.0.0');
54 43
44 +if (ForceUpdateGate::shouldBlock($forceUpdate, $installedVersion, Plugin::VERSION)) {
45 + add_action('admin_notices', function () {
46 + $template = __DIR__ . '/templates/notifications/ForceUpdateAlert.php';
47 + require_once $template;
48 + });
49 + return;
50 +}
51 +
52 +if ($forceUpdate) {
53 + delete_option('sync_basalam_force_update');
54 +}
55 +
55 56 add_action('init', 'syncBasalamPlugin');
56 57
57 58 function syncBasalamContainer()
58 59 {
@@ -77,18 +78,21 @@
77 78 {
78 79 return syncBasalamContainer()->get(SettingsContainer::class);
79 80 }
80 81
81 -function syncBasalamActivatePlugin()
82 -{
83 - Activator::activate();
84 - syncBasalamContainer()->get(VendorSyncPolicy::class)->ensureScheduled();
85 - set_transient('sync_basalam_just_activated', true, 10);
86 -}
87 -
88 -function syncBasalamDeactivatePlugin()
89 -{
90 - VendorSyncPolicy::unschedule();
91 -}
92 -
93 -syncBasalamContainer()->get(JobsRunner::class);
94 -syncBasalamContainer()->get(VendorSyncPolicy::class)->registerHooks();
82 +function syncBasalamActivatePlugin()
83 +{
84 + Activator::activate();
85 + syncBasalamContainer()->get(VendorSyncPolicy::class)->ensureScheduled();
86 + (new ScheduledProductSync())->ensureScheduled();
87 + set_transient('sync_basalam_just_activated', true, 10);
88 +}
89 +
90 +function syncBasalamDeactivatePlugin()
91 +{
92 + VendorSyncPolicy::unschedule();
93 + ScheduledProductSync::unschedule();
94 +}
95 +
96 +syncBasalamContainer()->get(JobsRunner::class);
97 +syncBasalamContainer()->get(VendorSyncPolicy::class)->registerHooks();
98 +(new ScheduledProductSync())->registerHooks();