1 | <?php |
||
2 | namespace lsx_health_plan\classes; |
||
3 | |||
4 | /** |
||
5 | * LSX Health Plan Frontend Class. |
||
6 | * |
||
7 | * @package lsx-health-plan |
||
8 | */ |
||
9 | class Frontend { |
||
10 | |||
11 | /** |
||
12 | * Holds class instance |
||
13 | * |
||
14 | * @since 1.0.0 |
||
15 | * |
||
16 | * @var object \lsx_health_plan\classes\Frontend() |
||
17 | */ |
||
18 | protected static $instance = null; |
||
19 | |||
20 | /** |
||
21 | * @var object \lsx_health_plan\classes\frontend\Endpoints(); |
||
22 | */ |
||
23 | public $endpoints; |
||
24 | |||
25 | /** |
||
26 | * @var object \lsx_health_plan\classes\frontend\Modals(); |
||
27 | */ |
||
28 | public $modals; |
||
29 | |||
30 | /** |
||
31 | * @var object \lsx_health_plan\classes\frontend\Gallery(); |
||
32 | */ |
||
33 | public $gallery; |
||
34 | |||
35 | /** |
||
36 | * @var object \lsx_health_plan\classes\frontend\Plan_Status(); |
||
37 | */ |
||
38 | public $plan_status; |
||
39 | |||
40 | /** |
||
41 | * @var object \lsx_health_plan\classes\frontend\Plan_Query(); |
||
42 | */ |
||
43 | public $plan_query; |
||
44 | |||
45 | /** |
||
46 | * @var object \lsx_health_plan\classes\frontend\General(); |
||
47 | */ |
||
48 | public $general; |
||
49 | |||
50 | /** |
||
51 | * @var object \lsx_health_plan\classes\frontend\Template_Redirects(); |
||
52 | */ |
||
53 | public $template_redirects; |
||
54 | |||
55 | /** |
||
56 | * Constructor |
||
57 | */ |
||
58 | public function __construct() { |
||
59 | if ( ! is_admin() ) { |
||
60 | $this->load_classes(); |
||
61 | } |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * Return an instance of this class. |
||
66 | * |
||
67 | * @since 1.0.0 |
||
68 | * |
||
69 | * @return object \lsx_health_plan\classes\Frontend() A single instance of this class. |
||
70 | */ |
||
71 | public static function get_instance() { |
||
72 | // If the single instance hasn't been set, set it now. |
||
73 | if ( null === self::$instance ) { |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
74 | self::$instance = new self(); |
||
75 | } |
||
76 | return self::$instance; |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * Loads the variable classes and the static classes. |
||
81 | */ |
||
82 | private function load_classes() { |
||
83 | require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php'; |
||
84 | $this->endpoints = frontend\Endpoints::get_instance(); |
||
85 | |||
86 | require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-modals.php'; |
||
87 | $this->modals = Modals::get_instance(); |
||
88 | |||
89 | require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php'; |
||
90 | $this->gallery = frontend\Gallery::get_instance(); |
||
91 | |||
92 | require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-status.php'; |
||
93 | $this->plan_status = frontend\Plan_Status::get_instance(); |
||
94 | |||
95 | require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-query.php'; |
||
96 | $this->plan_query = frontend\Plan_Query::get_instance(); |
||
97 | |||
98 | require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-general.php'; |
||
99 | $this->general = frontend\General::get_instance(); |
||
100 | |||
101 | require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-template-redirects.php'; |
||
102 | $this->template_redirects = frontend\Template_Redirects::get_instance(); |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * Remove the "Archives:" from the post type recipes. |
||
107 | * |
||
108 | * @param string $title the term title. |
||
109 | * @return string |
||
110 | */ |
||
111 | public function get_the_archive_title( $title ) { |
||
112 | if ( is_tax() ) { |
||
113 | $queried_object = get_queried_object(); |
||
114 | if ( isset( $queried_object->name ) ) { |
||
115 | $title = $queried_object->name; |
||
116 | } |
||
117 | } |
||
118 | return $title; |
||
119 | } |
||
120 | } |
||
121 |