-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwc1c-main.php
107 lines (93 loc) · 2.56 KB
/
wc1c-main.php
1
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/**
* Plugin Name: WC1C
* Plugin URI: https://wordpress.org/plugins/wc1c-main/
* Description: Implementing a flexible mechanism for exchanging various data between 1C Company products and the WooCommerce plugin.
* Version: 0.23.0
* WC requires at least: 4.3
* WC tested up to: 8.8
* Requires at least: 5.2
* Requires PHP: 7.0
* Requires Plugins: woocommerce
* Text Domain: wc1c-main
* Domain Path: /assets/languages
* Copyright: WC1C team © 2018-2024
* Author: WC1C team
* Author URI: https://wc1c.info
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
**/
namespace
{
defined('ABSPATH') || exit;
if(version_compare(PHP_VERSION, '7.0') < 0)
{
trigger_error('Minimal PHP version for used WC1C plugin: 7.0. Please update PHP version.');
return false;
}
if(false === defined('WC1C_PLUGIN_FILE'))
{
define('WC1C_PLUGIN_FILE', __FILE__);
$autoloader = __DIR__ . '/vendor/autoload.php';
if(!is_readable($autoloader))
{
trigger_error(sprintf('%s: %s','File is not found', $autoloader));
return false;
}
require_once $autoloader;
/**
* Adds an action to declare compatibility with High Performance Order Storage (HPOS) before WooCommerce initialization.
*/
add_action
(
'before_woocommerce_init',
function()
{
if(class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class))
{
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', WC1C_PLUGIN_FILE, true);
}
}
);
/**
* For external use
*
* @return Wc1c\Main\Core Main instance of core
*/
function wc1c(): Wc1c\Main\Core
{
return Wc1c\Main\Core();
}
}
}
/**
* @package Wc1c\Main
*/
namespace Wc1c\Main
{
/**
* For internal use
*
* @return Core Main instance of plugin core
*/
function core(): Core
{
return Core::instance();
}
$loader = new \Digiom\Woplucore\Loader();
$loader->addNamespace(__NAMESPACE__, plugin_dir_path(__FILE__) . 'src');
try
{
$loader->register(__FILE__);
$loader->registerActivation([Activation::class, 'instance']);
$loader->registerDeactivation([Deactivation::class, 'instance']);
$loader->registerUninstall([Uninstall::class, 'instance']);
}
catch(\Throwable $e)
{
trigger_error($e->getMessage());
return false;
}
$context = new Context(__FILE__, 'wc1c', $loader);
core()->register($context);
}