-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvta-wc-custom-order-status.php
108 lines (98 loc) · 4.07 KB
/
vta-wc-custom-order-status.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
108
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
* @link https://jamespham.io
* @since 1.1
* @package Vta_Wc_Custom_Order_Status
*
* @wordpress-plugin
* Plugin Name: VTA WooCommerce Custom Order Status
* Plugin URI: https://jamespham.io
* Description: This is a short description of what the plugin does. It's displayed in the WordPress admin area.
* Version: 1.1
* Author: James Pham
* Author URI: https://jamespham.io
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: vta-wc-custom-order-status
* Domain Path: /languages
*/
/** PLUGIN CONSTANTS **/
// Plugin
const VTA_WC_CUSTOM_ORDER_STATUS_VERSION = '1.1.1';
const VTA_WC_COS_PLUGIN_NAME = 'vta-wc-custom-order-status';
// Post
const VTA_COS_CPT = 'vta_order_status';
const META_COLOR_KEY = 'vta_cos_color';
const META_REORDERABLE_KEY = 'vta_cos_is_reorderable';
const META_HAS_REMINDER_KEY = 'vta_cos_has_reminder';
// Settings/Options
const VTA_COS_SETTINGS_NAME = 'vta_order_status_options';
const VTA_COS_SETTINGS_PAGE = 'vta_order_status_settings';
const VTA_COS_SETTINGS_FIELD = 'vta_order_status_settings_fields';
const ORDER_STATUS_DEFAULT_KEY = 'order_status_default';
const ORDER_STATUS_ARRANGEMENT_KEY = 'order_status_arrangement';
/** Global files for plugin and/or theme usage **/
require_once 'admin/class-vta-wc-custom-order-status-admin.php';
require_once 'utils/common.php';
// WC Dependencies (before plugins are loaded)
include_once ABSPATH . '/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php';
include_once ABSPATH . '/wp-content/plugins/woocommerce/includes/emails/class-wc-email.php';
include_once ABSPATH . '/wp-content/plugins/woocommerce/includes/class-wc-emails.php';
include_once ABSPATH . '/wp-content/plugins/woocommerce/woocommerce.php';
// Models
require_once 'models/VTACustomOrderStatus.php';
require_once 'models/VTACosSettings.php';
// Classes
require_once 'classes/VTACustomOrderStatuses.php';
require_once 'classes/VTACosSettingsManager.php';
require_once 'classes/VTAWooCommerce.php';
require_once 'classes/VTACustomEmail.php';
require_once 'classes/VTACosEmailManager.php';
// If this file is called directly, abort.
if ( !defined('WPINC') ) {
die;
}
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-vta-wc-custom-order-status-activator.php
*/
function activate_vta_wc_custom_order_status(): void {
require_once plugin_dir_path(__FILE__) . 'includes/class-vta-wc-custom-order-status-activator.php';
Vta_Wc_Custom_Order_Status_Activator::activate();
}
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-vta-wc-custom-order-status-deactivator.php
*/
function deactivate_vta_wc_custom_order_status(): void {
require_once plugin_dir_path(__FILE__) . 'includes/class-vta-wc-custom-order-status-deactivator.php';
Vta_Wc_Custom_Order_Status_Deactivator::deactivate();
}
register_activation_hook(__FILE__, 'activate_vta_wc_custom_order_status');
register_deactivation_hook(__FILE__, 'deactivate_vta_wc_custom_order_status');
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require plugin_dir_path(__FILE__) . 'includes/class-vta-wc-custom-order-status.php';
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 1.0.0
*/
function run_vta_wc_custom_order_status(): void {
$plugin = new Vta_Wc_Custom_Order_Status();
$plugin->run();
}
run_vta_wc_custom_order_status();