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
sync-basalam / sync-basalam.php

sync-basalam.php in ووسلام – همگام سازی ووکامرس و باسلام 1.10.22, at sync-basalam.php

114 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use SyncBasalam\Plugin;
4 use SyncBasalam\Admin\Settings\SettingsContainer;
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;
11 use SyncBasalam\Services\ScheduledProductSync;
12
13 defined('ABSPATH') || exit;
14
15 /**
16 * Plugin Name: sync basalam | ووسلا�
17
18 * Description: با استفاده از پلاگین ووسلا�
19 �
20 یتوایند ت�
21 ا�
22 ی �
23 حصولات ووکا�
24 رس را با یک کلیک به غرفه باسلا�
25 ی خود اضافه کنید‌، ه�
26 چنین ت�
27 ا�
28 ی سفارش باسلا�
29 ی ش�
30 ا به سایت ش�
31 ا اضافه �
32 یگردد.
33 * Version: 1.10.22
34 * Author: Woosalam Dev
35 * Author URI: https://hamsalam.ir/wp
36 * Plugin URI: https://hamsalam.ir/wp
37 * Text Domain: sync-basalam
38 * WC requires at least: 10.0.0
39 * WC tested up to: 9.9.5
40 * Requires Plugins: woocommerce
41 * License: GPL-2.0-or-later
42 * License URI: https://www.gnu.org/licenses/gpl-2.0.html.
43 */
44
45 require_once __DIR__ . '/vendor/autoload.php';
46
47 register_activation_hook(__FILE__, 'syncBasalamActivatePlugin');
48 register_deactivation_hook(__FILE__, 'syncBasalamDeactivatePlugin');
49
50 add_action('before_woocommerce_init', function () {
51 if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) {
52 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true);
53 }
54 });
55
56 $forceUpdate = get_option('sync_basalam_force_update');
57 $installedVersion = (string) (get_option('sync_basalam_version') ?: '0.0.0');
58
59 if (ForceUpdateGate::shouldBlock($forceUpdate, $installedVersion, Plugin::VERSION)) {
60 add_action('admin_notices', function () {
61 $template = __DIR__ . '/templates/notifications/ForceUpdateAlert.php';
62 require_once $template;
63 });
64 return;
65 }
66
67 if ($forceUpdate) {
68 delete_option('sync_basalam_force_update');
69 }
70
71 add_action('init', 'syncBasalamPlugin');
72
73 function syncBasalamContainer()
74 {
75 static $container = null;
76
77 if ($container === null) {
78 $container = new Container();
79 $container->provider(new AppServiceProvider());
80 }
81
82 return $container;
83 }
84
85 // Singleton instance of the main plugin class.
86 function syncBasalamPlugin()
87 {
88 return syncBasalamContainer()->get(Plugin::class);
89 }
90
91 // Singleton instance of the woosalam Settings container.
92 function syncBasalamSettings()
93 {
94 return syncBasalamContainer()->get(SettingsContainer::class);
95 }
96
97 function syncBasalamActivatePlugin()
98 {
99 Activator::activate();
100 syncBasalamContainer()->get(VendorSyncPolicy::class)->ensureScheduled();
101 (new ScheduledProductSync())->ensureScheduled();
102 set_transient('sync_basalam_just_activated', true, 10);
103 }
104
105 function syncBasalamDeactivatePlugin()
106 {
107 VendorSyncPolicy::unschedule();
108 ScheduledProductSync::unschedule();
109 }
110
111 syncBasalamContainer()->get(JobsRunner::class);
112 syncBasalamContainer()->get(VendorSyncPolicy::class)->registerHooks();
113 (new ScheduledProductSync())->registerHooks();
114