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