Issues (4138)

classes/class-setup.php (2 issues)

1
<?php
2
namespace lsx_health_plan\classes;
3
4
/**
5
 * LSX Health Plan Admin Class.
6
 *
7
 * @package lsx-health-plan
8
 */
9
class Setup {
10
11
	/**
12
	 * Holds class instance
13
	 *
14
	 * @since 1.0.0
15
	 *
16
	 * @var      object \lsx_health_plan\classes\Setup()
17
	 */
18
	protected static $instance = null;
19
20
	/**
21
	 * @var object \lsx_health_plan\classes\Post_Type();
22
	 */
23
	public $post_types;
24
25
	/**
26
	 * Constructor
27
	 */
28
	public function __construct() {
29
		add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
30
		add_action( 'wp_head', array( $this, 'load_shortcodes' ) );
31
		$this->load_classes();
32
	}
33
34
	/**
35
	 * Return an instance of this class.
36
	 *
37
	 * @since 1.0.0
38
	 *
39
	 * @return    object \lsx_health_plan\classes\Setup()    A single instance of this class.
40
	 */
41
	public static function get_instance() {
42
43
		// If the single instance hasn't been set, set it now.
44
		if ( null === self::$instance ) {
45
			self::$instance = new self();
46
		}
47
48
		return self::$instance;
49
50
	}
51
52
	/**
53
	 * Adds text domain.
54
	 */
55
	public function load_plugin_textdomain() {
56
		load_plugin_textdomain( 'lsx-health-plan', false, basename( LSX_HEALTH_PLAN_PATH ) . '/languages' );
57
	}
58
59
	/**
60
	 * Registers our shortcodes.
61
	 *
62
	 * @return void
63
	 */
64
	public function load_classes() {
65
		require_once LSX_HEALTH_PLAN_PATH . 'classes/class-post-type.php';
66
		$this->post_types = Post_Type::get_instance();
67
	}
68
69
	/**
70
	 * Registers our shortcodes.
71
	 *
72
	 * @return void
73
	 */
74
	public function load_shortcodes() {
75
		add_shortcode( 'lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content' );
76
		add_shortcode( 'lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs' );
77
		add_shortcode( 'lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box' );
78
		add_shortcode( 'lsx_health_plan_all_plans_block', '\lsx_health_plan\shortcodes\all_plans_box' );
79
		add_shortcode( 'lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box' );
80
		add_shortcode( 'lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices' );
81
82
		if ( post_type_exists( 'video' ) ) {
83
			add_shortcode( 'lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box' );
84
		}
85
		if ( post_type_exists( 'recipe' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
86
			add_shortcode( 'lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box' );
87
		}
88
		if ( post_type_exists( 'tip' ) ) {
89
			add_shortcode( 'lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box' );
90
		}
91
		add_shortcode( 'lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box' );
92
	}
93
}
94