-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobi-woocommerce-countries.php
85 lines (59 loc) · 2.01 KB
/
obi-woocommerce-countries.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
<?php
/**
* Plugin Name: Obi WooCommerce Countries
* Description: Change the countries in WooCommerce checkout with the most popular countries.
* Version: 1.0.0
* Author: Obi Juan
* Author URI: https://obijuan.dev
* Plugin URI: https://obijuan.dev/obi-remove-post-types-from-search
* License: GPL2 or later
* Textdomain: obi-woocommerce-countries
* @since 1.0.0
*
*/
if (!defined('ABSPATH')) {
exit('Trying what?');
}
require_once plugin_dir_path(__FILE__) . 'vendor/autoload.php';
use ObiWooCommerceCountries\CountryOrder;
final class Obi_WooCommerce_Countries
{
private static $instance;
private function __construct()
{
self::define_constants();
}
public static function get_instance()
{
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
private static function define_constants()
{
define('OBI_WOOCOMMERCE_COUNTRIES_VERSION', '1.0.0');
define('OBI_WOOCOMMERCE_COUNTRIES__TEXTDOMAIN', 'obi-remove-post-types-from-search');
define('OBI_WOOCOMMERCE_COUNTRIES_DIRNAME', plugin_basename(dirname(__FILE__)));
define('OBI_WOOCOMMERCE_COUNTRIES_FILE', __FILE__);
define('OBI_WOOCOMMERCE_COUNTRIES_PREFIX', 'obi_woocommerce_countries');
define('OBI_WOOCOMMERCE_COUNTRIES_PATH', plugin_dir_path(OBI_WOOCOMMERCE_COUNTRIES_FILE));
define('OBI_WOOCOMMERCE_COUNTRIES_URL', plugin_dir_url(OBI_WOOCOMMERCE_COUNTRIES_FILE));
}
public static function load_obi_plugin()
{
// On plugins loaded...
CountryOrder::get_instance();
}
public static function activate()
{
// On plugin activation...
}
public static function deactivate()
{
// On plugin deactivation...
}
}
$obi_plugin = Obi_WooCommerce_Countries::get_instance();
register_activation_hook(OBI_WOOCOMMERCE_COUNTRIES_FILE, array($obi_plugin, 'activate'));
add_action('plugins_loaded', array($obi_plugin, 'load_obi_plugin'));