PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.15
ووسلام – همگام سازی ووکامرس و باسلام v1.10.15
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 1.8.5 1.8.6 1.8.7 1.8.4 1.7.6 1.7.7 All 49 releases
sync-basalam / sync-basalam.php

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

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