Issues (4138)

classes/class-frontend.php (28 issues)

1
<?php
0 ignored issues
show
This file is missing a doc comment.
Loading history...
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
	/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
21
	 * @var object \lsx_health_plan\classes\frontend\Endpoints();
22
	 */
23
	public $endpoints;
24
25
	/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
26
	 * @var object \lsx_health_plan\classes\frontend\Modals();
27
	 */
28
	public $modals;
29
30
	/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
31
	 * @var object \lsx_health_plan\classes\frontend\Gallery();
32
	 */
33
	public $gallery;
34
35
	/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
36
	 * @var object \lsx_health_plan\classes\frontend\Plan_Status();
37
	 */
38
	public $plan_status;
39
40
	/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
41
	 * @var object \lsx_health_plan\classes\frontend\Plan_Query();
42
	 */
43
	public $plan_query;
44
45
	/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
46
	 * @var object \lsx_health_plan\classes\frontend\General();
47
	 */
48
	public $general;
49
50
	/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
51
	 * @var object \lsx_health_plan\classes\frontend\Template_Redirects();
52
	 */
53
	public $template_redirects;
54
55
	/**
56
	 * Constructor
57
	 */
58
	public function __construct() {
0 ignored issues
show
Expected 2 blank lines before function; 1 found
Loading history...
59
		if ( ! is_admin() ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
60
			$this->load_classes();
61
		}	
0 ignored issues
show
Spaces must be used for mid-line alignment; tabs are not allowed
Loading history...
62
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
74
			self::$instance = new self();
75
		}
0 ignored issues
show
No blank line found after control structure
Loading history...
76
		return self::$instance;
77
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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() ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
113
			$queried_object = get_queried_object();
114
			if ( isset( $queried_object->name ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
115
				$title = $queried_object->name;
116
			}
117
		}
0 ignored issues
show
No blank line found after control structure
Loading history...
118
		return $title;
119
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 0 found
Loading history...
120
}
121