1
|
|
|
<?php |
|
|
|
|
2
|
|
|
namespace lsx_health_plan\classes; |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* This class loads the other classes and function files |
6
|
|
|
* |
7
|
|
|
* @package lsx-health-plan |
8
|
|
|
*/ |
9
|
|
|
class Core { |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Holds class instance |
13
|
|
|
* |
14
|
|
|
* @since 1.0.0 |
15
|
|
|
* |
16
|
|
|
* @var object \lsx_health_plan\classes\Core() |
17
|
|
|
*/ |
18
|
|
|
protected static $instance = null; |
19
|
|
|
|
20
|
|
|
/** |
|
|
|
|
21
|
|
|
* @var object \lsx_health_plan\classes\Setup(); |
22
|
|
|
*/ |
23
|
|
|
public $setup; |
24
|
|
|
|
25
|
|
|
/** |
|
|
|
|
26
|
|
|
* @var object \lsx_health_plan\classes\Admin(); |
27
|
|
|
*/ |
28
|
|
|
public $admin; |
29
|
|
|
|
30
|
|
|
/** |
|
|
|
|
31
|
|
|
* @var object \lsx_health_plan\classes\Frontend(); |
32
|
|
|
*/ |
33
|
|
|
public $frontend; |
34
|
|
|
|
35
|
|
|
/** |
|
|
|
|
36
|
|
|
* @var object \lsx_health_plan\classes\Integrations(); |
37
|
|
|
*/ |
38
|
|
|
public $integrations; |
39
|
|
|
|
40
|
|
|
/** |
|
|
|
|
41
|
|
|
* @var object \lsx_health_plan\classes\Integrations(); |
42
|
|
|
*/ |
43
|
|
|
public $scpo_engine; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Constructor |
47
|
|
|
*/ |
48
|
|
|
public function __construct() { |
|
|
|
|
49
|
|
|
$this->load_includes(); |
50
|
|
|
$this->load_classes(); |
51
|
|
|
} |
|
|
|
|
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Return an instance of this class. |
55
|
|
|
* |
56
|
|
|
* @since 1.0.0 |
57
|
|
|
* |
58
|
|
|
* @return object \lsx_health_plan\classes\Core() A single instance of this class. |
59
|
|
|
*/ |
60
|
|
|
public static function get_instance() { |
|
|
|
|
61
|
|
|
|
62
|
|
|
// If the single instance hasn't been set, set it now. |
63
|
|
|
if ( null === self::$instance ) { |
|
|
|
|
64
|
|
|
self::$instance = new self(); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
return self::$instance; |
68
|
|
|
|
69
|
|
|
} |
|
|
|
|
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Loads the variable classes and the static classes. |
73
|
|
|
*/ |
74
|
|
|
private function load_classes() { |
|
|
|
|
75
|
|
|
|
76
|
|
|
require_once LSX_HEALTH_PLAN_PATH . 'classes/class-setup.php'; |
77
|
|
|
$this->setup = Setup::get_instance(); |
78
|
|
|
|
79
|
|
|
require_once LSX_HEALTH_PLAN_PATH . 'classes/class-admin.php'; |
80
|
|
|
$this->admin = Admin::get_instance(); |
81
|
|
|
|
82
|
|
|
require_once LSX_HEALTH_PLAN_PATH . 'classes/class-frontend.php'; |
83
|
|
|
$this->frontend = Frontend::get_instance(); |
84
|
|
|
|
85
|
|
|
require_once LSX_HEALTH_PLAN_PATH . 'classes/class-integrations.php'; |
86
|
|
|
$this->integrations = Integrations::get_instance(); |
87
|
|
|
|
88
|
|
|
require_once LSX_HEALTH_PLAN_PATH . 'classes/class-scpo-engine.php'; |
89
|
|
|
$this->scpo_engine = SCPO_Engine::get_instance(); |
90
|
|
|
} |
|
|
|
|
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Loads the plugin functions. |
94
|
|
|
*/ |
95
|
|
|
private function load_includes() { |
96
|
|
|
require_once LSX_HEALTH_PLAN_PATH . '/includes/functions.php'; |
97
|
|
|
require_once LSX_HEALTH_PLAN_PATH . '/includes/functions/triggers.php'; |
98
|
|
|
require_once LSX_HEALTH_PLAN_PATH . '/includes/functions/recipes.php'; |
99
|
|
|
require_once LSX_HEALTH_PLAN_PATH . '/includes/functions/plan.php'; |
100
|
|
|
require_once LSX_HEALTH_PLAN_PATH . '/includes/conditionals.php'; |
101
|
|
|
require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags.php'; |
102
|
|
|
require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/exercise.php'; |
103
|
|
|
require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/gallery.php'; |
104
|
|
|
require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/plan.php'; |
105
|
|
|
require_once LSX_HEALTH_PLAN_PATH . '/includes/shortcodes.php'; |
106
|
|
|
} |
|
|
|
|
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Returns the post types currently active |
110
|
|
|
* |
111
|
|
|
* @return void |
|
|
|
|
112
|
|
|
*/ |
113
|
|
|
public function get_post_types() { |
114
|
|
|
$post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) ); |
115
|
|
|
foreach ( $post_types as $index => $post_type ) { |
|
|
|
|
116
|
|
|
$is_disabled = \cmb2_get_option( 'lsx_health_plan_options', $post_type . '_disabled', false ); |
117
|
|
|
if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
|
|
|
118
|
|
|
unset( $post_types[ $index ] ); |
119
|
|
|
} |
120
|
|
|
} |
|
|
|
|
121
|
|
|
return $post_types; |
122
|
|
|
} |
|
|
|
|
123
|
|
|
} |
124
|
|
|
|