1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Discontinued_Products Class. |
4
|
|
|
* |
5
|
|
|
* @package woocommerce |
6
|
|
|
* @since 1.1.7 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
if ( ! class_exists( 'Discontinued_Products' ) ) { |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* The main WooCommerce Discontinued Products Class. |
13
|
|
|
* Check if WooCommerce is active, load functions and other files. |
14
|
|
|
* |
15
|
|
|
* @since 1.0.0 |
16
|
|
|
*/ |
17
|
|
|
class Discontinued_Products { |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Inititiate the Discontinued_Products Class. |
21
|
|
|
* |
22
|
|
|
* @since 1.0.0 |
23
|
|
|
*/ |
24
|
|
|
public function __construct() { |
25
|
|
|
// Called only after woocommerce has finished loading. |
26
|
|
|
add_action( 'woocommerce_init', array( $this, 'woocommerce_loaded' ) ); |
27
|
|
|
// Called after all plugins have loaded. |
28
|
|
|
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) ); |
29
|
|
|
|
30
|
|
|
// Called just before the woocommerce template functions are included. |
31
|
|
|
add_action( 'init', array( $this, 'include_template_functions' ), 20 ); |
32
|
|
|
|
33
|
|
|
// Indicates we are running the admin. |
34
|
|
|
if ( is_admin() ) { |
35
|
|
|
is_admin(); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
// Indicates we are being served over ssl. |
39
|
|
|
if ( is_ssl() ) { |
40
|
|
|
is_ssl(); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
// Take care of anything else that needs to be done immediately upon plugin instantiation, here in the constructor. |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Take care of anything that needs woocommerce to be loaded. |
48
|
|
|
* For instance, if you need access to the $woocommerce global |
49
|
|
|
*/ |
50
|
|
|
public function woocommerce_loaded() { |
51
|
|
|
|
52
|
|
|
include DP_PATH . 'includes/class-dp-csv-import-export.php'; |
53
|
|
|
include DP_PATH . 'includes/class-dp-discontinued-product.php'; |
54
|
|
|
include DP_PATH . 'includes/class-dp-settings.php'; |
55
|
|
|
include DP_PATH . 'includes/class-dp-shortcode-discontinued.php'; |
56
|
|
|
include DP_PATH . 'includes/class-dp-taxonomy.php'; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Take care of anything that needs all plugins to be loaded |
61
|
|
|
*/ |
62
|
|
|
public function plugins_loaded() { |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Localisation |
66
|
|
|
*/ |
67
|
|
|
load_plugin_textdomain( 'discontinued-products', false, dirname( plugin_basename( __FILE__ ) ) . '/' ); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Override any of the template functions from woocommerce/woocommerce-template.php |
72
|
|
|
* with our own template functions file |
73
|
|
|
*/ |
74
|
|
|
public function include_template_functions() { |
75
|
|
|
|
76
|
|
|
include DP_PATH . 'woocommerce-template.php'; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|