Passed
Push — add/multiplan ( 7c1ede...fc334e )
by
unknown
04:55 queued 01:32
created
templates/single-plan.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 
12 12
 <?php
13 13
 $args = array(
14
-	'post_parent' => get_the_ID(),
15
-	'post_type'   => 'plan',
14
+     'post_parent' => get_the_ID(),
15
+     'post_type'   => 'plan',
16 16
 );
17 17
 
18 18
 $plan_id      = get_the_ID();
@@ -28,23 +28,23 @@  discard block
 block discarded – undo
28 28
 $connected_articles = get_post_meta( get_the_ID(), ( $plan . '_connected_articles' ), true );
29 29
 
30 30
 if ( ! empty( $has_sections ) ) {
31
-	$plan_type_class = 'parent-plan';
32
-	if ( 0 !== $has_parent ) {
33
-		$plan_type_class = 'parent-sub-plan';
34
-	}
31
+     $plan_type_class = 'parent-plan';
32
+     if ( 0 !== $has_parent ) {
33
+          $plan_type_class = 'parent-sub-plan';
34
+     }
35 35
 } else {
36
-	$plan_type_class = 'unique-plan';
37
-	if ( 0 !== $has_parent ) {
38
-		$plan_type_class = 'child-plan-' . $has_parent;
39
-	}
36
+     $plan_type_class = 'unique-plan';
37
+     if ( 0 !== $has_parent ) {
38
+          $plan_type_class = 'child-plan-' . $has_parent;
39
+     }
40 40
 }
41 41
 
42 42
 // Get the plan restrictions.
43 43
 if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) {
44
-	$restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() );
44
+     $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() );
45 45
 }
46 46
 if ( false === $restricted ) {
47
-	$round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 );
47
+     $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 );
48 48
 }
49 49
 ?>
50 50
 
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 		<?php lsx_content_top(); ?>
58 58
 
59 59
 		<?php
60
-		if ( ! empty( $has_sections ) && false === $is_section ) {
61
-			?>
60
+          if ( ! empty( $has_sections ) && false === $is_section ) {
61
+               ?>
62 62
 			<div class="post-wrapper">
63 63
 				<div class="plan-content">
64 64
 					<?php the_content(); ?>
@@ -73,29 +73,29 @@  discard block
 block discarded – undo
73 73
 							<div class="plan">
74 74
 								<?php
75 75
 								
76
-								// The top part
77
-								echo wp_kses_post( wp_kses_post( lsx_health_plan_main_content() ) );
76
+                                        // The top part
77
+                                        echo wp_kses_post( wp_kses_post( lsx_health_plan_main_content() ) );
78 78
 								
79
-								echo wp_kses_post( '<h3 class="my-plan-title">' . __( 'Your Game Plan', 'lsx-health-plan' ) . '</h3>' );
79
+                                        echo wp_kses_post( '<h3 class="my-plan-title">' . __( 'Your Game Plan', 'lsx-health-plan' ) . '</h3>' );
80 80
 
81
-								?>
81
+                                        ?>
82 82
 								<div class="the-plan-content">
83 83
 									<?php
84
-									if ( false === $restricted ) {
85
-										echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '" max="100"> ' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '% </progress><span>' . $round_progress . '%</span></span>' );
86
-									}
84
+                                             if ( false === $restricted ) {
85
+                                                  echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '" max="100"> ' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '% </progress><span>' . $round_progress . '%</span></span>' );
86
+                                             }
87 87
 									
88
-									echo do_shortcode( '[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]' );
88
+                                             echo do_shortcode( '[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]' );
89 89
 
90
-									?>
90
+                                             ?>
91 91
 									<div class="row status-plan-buttons main-plan-btn">
92 92
 										<?php
93
-										if ( function_exists( 'wc_get_page_id' ) ) {
94
-											?>
93
+                                                  if ( function_exists( 'wc_get_page_id' ) ) {
94
+                                                       ?>
95 95
 											<a class="btn border-btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a>
96 96
 											<?php
97
-										}
98
-										?>
97
+                                                  }
98
+                                                  ?>
99 99
 									</div>
100 100
 								</div>
101 101
 							</div>
@@ -107,25 +107,25 @@  discard block
 block discarded – undo
107 107
 			
108 108
 			<?php
109 109
 
110
-		} else {
110
+          } else {
111 111
 
112
-			lsx_health_plan_single_nav();
113
-			lsx_health_plan_single_tabs();
114
-			?>
112
+               lsx_health_plan_single_nav();
113
+               lsx_health_plan_single_tabs();
114
+               ?>
115 115
 			<div class="row status-plan-buttons">
116 116
 				<?php lsx_health_plan_day_button(); ?>
117 117
 			</div>
118 118
 			<?php
119
-		}
120
-		?>
119
+          }
120
+          ?>
121 121
 
122 122
 		<?php lsx_content_bottom(); ?>
123 123
 
124 124
 		<?php
125
-		if ( ! empty( $connected_articles ) ) {
126
-			lsx_hp_single_related( $connected_articles, __( 'Latest articles', 'lsx-health-plan' ) );
127
-		}
128
-		?>
125
+          if ( ! empty( $connected_articles ) ) {
126
+               lsx_hp_single_related( $connected_articles, __( 'Latest articles', 'lsx-health-plan' ) );
127
+          }
128
+          ?>
129 129
 
130 130
 
131 131
 	</main><!-- #main -->
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -17,47 +17,47 @@  discard block
 block discarded – undo
17 17
 
18 18
 $plan_id      = get_the_ID();
19 19
 $has_sections = \lsx_health_plan\functions\plan\has_sections();
20
-$has_parent   = wp_get_post_parent_id( $plan_id );
20
+$has_parent   = wp_get_post_parent_id($plan_id);
21 21
 $restricted   = false;
22
-$is_section   = get_query_var( 'section', false );
22
+$is_section   = get_query_var('section', false);
23 23
 
24 24
 // Getting translated endpoint.
25
-$plan = \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' );
25
+$plan = \lsx_health_plan\functions\get_option('endpoint_plan', 'plan');
26 26
 
27
-$connected_members  = get_post_meta( get_the_ID(), ( $plan . '_connected_team_member' ), true );
28
-$connected_articles = get_post_meta( get_the_ID(), ( $plan . '_connected_articles' ), true );
27
+$connected_members  = get_post_meta(get_the_ID(), ($plan . '_connected_team_member'), true);
28
+$connected_articles = get_post_meta(get_the_ID(), ($plan . '_connected_articles'), true);
29 29
 
30
-if ( ! empty( $has_sections ) ) {
30
+if ( ! empty($has_sections)) {
31 31
 	$plan_type_class = 'parent-plan';
32
-	if ( 0 !== $has_parent ) {
32
+	if (0 !== $has_parent) {
33 33
 		$plan_type_class = 'parent-sub-plan';
34 34
 	}
35 35
 } else {
36 36
 	$plan_type_class = 'unique-plan';
37
-	if ( 0 !== $has_parent ) {
37
+	if (0 !== $has_parent) {
38 38
 		$plan_type_class = 'child-plan-' . $has_parent;
39 39
 	}
40 40
 }
41 41
 
42 42
 // Get the plan restrictions.
43
-if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) {
44
-	$restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() );
43
+if (function_exists('wc_memberships_is_post_content_restricted') && wc_memberships_is_post_content_restricted(get_the_ID())) {
44
+	$restricted = ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID());
45 45
 }
46
-if ( false === $restricted ) {
47
-	$round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 );
46
+if (false === $restricted) {
47
+	$round_progress = round(\lsx_health_plan\functions\get_progress(get_the_ID()), 0);
48 48
 }
49 49
 ?>
50 50
 
51
-<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>">
51
+<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>">
52 52
 
53 53
 	<?php lsx_content_before(); ?>
54 54
 
55
-	<main id="main" class="site-main <?php echo esc_html( $plan_type_class ); ?>" role="main">
55
+	<main id="main" class="site-main <?php echo esc_html($plan_type_class); ?>" role="main">
56 56
 
57 57
 		<?php lsx_content_top(); ?>
58 58
 
59 59
 		<?php
60
-		if ( ! empty( $has_sections ) && false === $is_section ) {
60
+		if ( ! empty($has_sections) && false === $is_section) {
61 61
 			?>
62 62
 			<div class="post-wrapper">
63 63
 				<div class="plan-content">
@@ -67,32 +67,32 @@  discard block
 block discarded – undo
67 67
 					<div class="entry-content">
68 68
 						<div class="single-plan-inner main-plan-content">
69 69
 							<div class="single-plan-section-title title-lined">
70
-								<?php lsx_get_svg_icon( 'meal.svg' ); ?>
70
+								<?php lsx_get_svg_icon('meal.svg'); ?>
71 71
 								<h2><?php the_title(); ?></h2>
72 72
 							</div>
73 73
 							<div class="plan">
74 74
 								<?php
75 75
 								
76 76
 								// The top part
77
-								echo wp_kses_post( wp_kses_post( lsx_health_plan_main_content() ) );
77
+								echo wp_kses_post(wp_kses_post(lsx_health_plan_main_content()));
78 78
 								
79
-								echo wp_kses_post( '<h3 class="my-plan-title">' . __( 'Your Game Plan', 'lsx-health-plan' ) . '</h3>' );
79
+								echo wp_kses_post('<h3 class="my-plan-title">' . __('Your Game Plan', 'lsx-health-plan') . '</h3>');
80 80
 
81 81
 								?>
82 82
 								<div class="the-plan-content">
83 83
 									<?php
84
-									if ( false === $restricted ) {
85
-										echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '" max="100"> ' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '% </progress><span>' . $round_progress . '%</span></span>' );
84
+									if (false === $restricted) {
85
+										echo wp_kses_post('<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress(get_the_ID()) . '" max="100"> ' . \lsx_health_plan\functions\get_progress(get_the_ID()) . '% </progress><span>' . $round_progress . '%</span></span>');
86 86
 									}
87 87
 									
88
-									echo do_shortcode( '[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]' );
88
+									echo do_shortcode('[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]');
89 89
 
90 90
 									?>
91 91
 									<div class="row status-plan-buttons main-plan-btn">
92 92
 										<?php
93
-										if ( function_exists( 'wc_get_page_id' ) ) {
93
+										if (function_exists('wc_get_page_id')) {
94 94
 											?>
95
-											<a class="btn border-btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a>
95
+											<a class="btn border-btn" href="<?php echo wp_kses_post(get_permalink(wc_get_page_id('myaccount'))); ?>"><?php esc_html_e('My Plans', 'lsx-health-plan'); ?></a>
96 96
 											<?php
97 97
 										}
98 98
 										?>
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 		<?php lsx_content_bottom(); ?>
123 123
 
124 124
 		<?php
125
-		if ( ! empty( $connected_articles ) ) {
126
-			lsx_hp_single_related( $connected_articles, __( 'Latest articles', 'lsx-health-plan' ) );
125
+		if ( ! empty($connected_articles)) {
126
+			lsx_hp_single_related($connected_articles, __('Latest articles', 'lsx-health-plan'));
127 127
 		}
128 128
 		?>
129 129
 
Please login to merge, or discard this patch.
classes/post-types/class-meal.php 2 patches
Indentation   +351 added lines, -351 removed lines patch added patch discarded remove patch
@@ -8,371 +8,371 @@
 block discarded – undo
8 8
  */
9 9
 class Meal {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\Meal()
17
-	 */
18
-	protected static $instance = null;
11
+     /**
12
+      * Holds class instance
13
+      *
14
+      * @since 1.0.0
15
+      *
16
+      * @var      object \lsx_health_plan\classes\Meal()
17
+      */
18
+     protected static $instance = null;
19 19
 
20
-	/**
21
-	 * Holds post_type slug used as an index
22
-	 *
23
-	 * @since 1.0.0
24
-	 *
25
-	 * @var      string
26
-	 */
27
-	public $slug = 'meal';
20
+     /**
21
+      * Holds post_type slug used as an index
22
+      *
23
+      * @since 1.0.0
24
+      *
25
+      * @var      string
26
+      */
27
+     public $slug = 'meal';
28 28
 
29
-	/**
30
-	 * Contructor
31
-	 */
32
-	public function __construct() {
33
-		add_action( 'init', array( $this, 'register_post_type' ) );
34
-		add_action( 'init', array( $this, 'taxonomy_setup' ) );
35
-		add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
36
-		add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
37
-		add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 );
38
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
39
-	}
29
+     /**
30
+      * Contructor
31
+      */
32
+     public function __construct() {
33
+          add_action( 'init', array( $this, 'register_post_type' ) );
34
+          add_action( 'init', array( $this, 'taxonomy_setup' ) );
35
+          add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
36
+          add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
37
+          add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 );
38
+          add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
39
+     }
40 40
 
41
-	/**
42
-	 * Return an instance of this class.
43
-	 *
44
-	 * @since 1.0.0
45
-	 *
46
-	 * @return    object \lsx_health_plan\classes\Day()    A single instance of this class.
47
-	 */
48
-	public static function get_instance() {
49
-		// If the single instance hasn't been set, set it now.
50
-		if ( null === self::$instance ) {
51
-			self::$instance = new self();
52
-		}
53
-		return self::$instance;
54
-	}
55
-	/**
56
-	 * Register the post type.
57
-	 */
58
-	public function register_post_type() {
59
-		$labels = array(
60
-			'name'               => esc_html__( 'Meals', 'lsx-health-plan' ),
61
-			'singular_name'      => esc_html__( 'Meal', 'lsx-health-plan' ),
62
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
63
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
64
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
65
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
66
-			'all_items'          => esc_html__( 'All Meals', 'lsx-health-plan' ),
67
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
68
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
69
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
70
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
71
-			'parent_item_colon'  => '',
72
-			'menu_name'          => esc_html__( 'Meals', 'lsx-health-plan' ),
73
-		);
74
-		$args   = array(
75
-			'labels'             => $labels,
76
-			'public'             => true,
77
-			'publicly_queryable' => true,
78
-			'show_ui'            => true,
79
-			'show_in_menu'       => true,
80
-			'show_in_rest'       => true,
81
-			'menu_icon'          => 'dashicons-carrot',
82
-			'query_var'          => true,
83
-			'rewrite'            => array(
84
-				'slug' => \lsx_health_plan\functions\get_option( 'meal_single_slug', 'meal' ),
85
-			),
86
-			'capability_type'    => 'post',
87
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ),
88
-			'hierarchical'       => true,
89
-			'menu_position'      => null,
90
-			'supports'           => array(
91
-				'title',
92
-				'editor',
93
-				'thumbnail',
94
-				'page-attributes',
95
-				'custom-fields',
96
-			),
97
-		);
98
-		register_post_type( 'meal', $args );
99
-	}
41
+     /**
42
+      * Return an instance of this class.
43
+      *
44
+      * @since 1.0.0
45
+      *
46
+      * @return    object \lsx_health_plan\classes\Day()    A single instance of this class.
47
+      */
48
+     public static function get_instance() {
49
+          // If the single instance hasn't been set, set it now.
50
+          if ( null === self::$instance ) {
51
+               self::$instance = new self();
52
+          }
53
+          return self::$instance;
54
+     }
55
+     /**
56
+      * Register the post type.
57
+      */
58
+     public function register_post_type() {
59
+          $labels = array(
60
+               'name'               => esc_html__( 'Meals', 'lsx-health-plan' ),
61
+               'singular_name'      => esc_html__( 'Meal', 'lsx-health-plan' ),
62
+               'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
63
+               'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
64
+               'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
65
+               'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
66
+               'all_items'          => esc_html__( 'All Meals', 'lsx-health-plan' ),
67
+               'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
68
+               'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
69
+               'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
70
+               'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
71
+               'parent_item_colon'  => '',
72
+               'menu_name'          => esc_html__( 'Meals', 'lsx-health-plan' ),
73
+          );
74
+          $args   = array(
75
+               'labels'             => $labels,
76
+               'public'             => true,
77
+               'publicly_queryable' => true,
78
+               'show_ui'            => true,
79
+               'show_in_menu'       => true,
80
+               'show_in_rest'       => true,
81
+               'menu_icon'          => 'dashicons-carrot',
82
+               'query_var'          => true,
83
+               'rewrite'            => array(
84
+                    'slug' => \lsx_health_plan\functions\get_option( 'meal_single_slug', 'meal' ),
85
+               ),
86
+               'capability_type'    => 'post',
87
+               'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ),
88
+               'hierarchical'       => true,
89
+               'menu_position'      => null,
90
+               'supports'           => array(
91
+                    'title',
92
+                    'editor',
93
+                    'thumbnail',
94
+                    'page-attributes',
95
+                    'custom-fields',
96
+               ),
97
+          );
98
+          register_post_type( 'meal', $args );
99
+     }
100 100
 
101
-	/**
102
-	 * Register the Week taxonomy.
103
-	 */
104
-	public function taxonomy_setup() {
105
-		$labels = array(
106
-			'name'              => esc_html_x( 'Meal Type', 'taxonomy general name', 'lsx-health-plan' ),
107
-			'singular_name'     => esc_html_x( 'Meal Types', 'taxonomy singular name', 'lsx-health-plan' ),
108
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
109
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
110
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
111
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
112
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
113
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
114
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
115
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
116
-			'menu_name'         => esc_html__( 'Meal Types', 'lsx-health-plan' ),
117
-		);
118
-		$args   = array(
119
-			'hierarchical'      => true,
120
-			'labels'            => $labels,
121
-			'show_ui'           => true,
122
-			'show_in_menu'      => 'edit.php?post_type=meal',
123
-			'show_admin_column' => true,
124
-			'query_var'         => true,
125
-			'rewrite'           => array(
126
-				'slug' => 'meal-type',
127
-			),
128
-		);
129
-		register_taxonomy( 'meal-type', array( $this->slug ), $args );
130
-	}
101
+     /**
102
+      * Register the Week taxonomy.
103
+      */
104
+     public function taxonomy_setup() {
105
+          $labels = array(
106
+               'name'              => esc_html_x( 'Meal Type', 'taxonomy general name', 'lsx-health-plan' ),
107
+               'singular_name'     => esc_html_x( 'Meal Types', 'taxonomy singular name', 'lsx-health-plan' ),
108
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
109
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
110
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
111
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
112
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
113
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
114
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
115
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
116
+               'menu_name'         => esc_html__( 'Meal Types', 'lsx-health-plan' ),
117
+          );
118
+          $args   = array(
119
+               'hierarchical'      => true,
120
+               'labels'            => $labels,
121
+               'show_ui'           => true,
122
+               'show_in_menu'      => 'edit.php?post_type=meal',
123
+               'show_admin_column' => true,
124
+               'query_var'         => true,
125
+               'rewrite'           => array(
126
+                    'slug' => 'meal-type',
127
+               ),
128
+          );
129
+          register_taxonomy( 'meal-type', array( $this->slug ), $args );
130
+     }
131 131
 
132
-	/**
133
-	 * Adds the post type to the different arrays.
134
-	 *
135
-	 * @param array $post_types
136
-	 * @return array
137
-	 */
138
-	public function enable_post_type( $post_types = array() ) {
139
-		$post_types[] = $this->slug;
140
-		return $post_types;
141
-	}
132
+     /**
133
+      * Adds the post type to the different arrays.
134
+      *
135
+      * @param array $post_types
136
+      * @return array
137
+      */
138
+     public function enable_post_type( $post_types = array() ) {
139
+          $post_types[] = $this->slug;
140
+          return $post_types;
141
+     }
142 142
 
143
-	/**
144
-	 * Enables the Bi Directional relationships
145
-	 *
146
-	 * @param array $connections
147
-	 * @return void
148
-	 */
149
-	public function enable_connections( $connections = array() ) {
150
-		$connections['meal']['connected_plans'] = 'connected_meals';
151
-		$connections['plan']['connected_meals'] = 'connected_plans';
152
-		return $connections;
153
-	}
143
+     /**
144
+      * Enables the Bi Directional relationships
145
+      *
146
+      * @param array $connections
147
+      * @return void
148
+      */
149
+     public function enable_connections( $connections = array() ) {
150
+          $connections['meal']['connected_plans'] = 'connected_meals';
151
+          $connections['plan']['connected_meals'] = 'connected_plans';
152
+          return $connections;
153
+     }
154 154
 
155
-	/**
156
-	 * Define the metabox and field configurations.
157
-	 */
158
-	public function featured_metabox() {
159
-		$cmb = new_cmb2_box(
160
-			array(
161
-				'id'           => $this->slug . '_featured_metabox_meal',
162
-				'title'        => __( 'Featured Meal', 'lsx-health-plan' ),
163
-				'object_types' => array( $this->slug ), // Post type
164
-				'context'      => 'side',
165
-				'priority'     => 'high',
166
-				'show_names'   => true,
167
-			)
168
-		);
169
-		$cmb->add_field(
170
-			array(
171
-				'name'       => __( 'Featured Meal', 'lsx-health-plan' ),
172
-				'desc'       => __( 'Enable a featured meal' ),
173
-				'id'         => $this->slug . '_featured_meal',
174
-				'type'       => 'checkbox',
175
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
176
-			)
177
-		);
178
-	}
155
+     /**
156
+      * Define the metabox and field configurations.
157
+      */
158
+     public function featured_metabox() {
159
+          $cmb = new_cmb2_box(
160
+               array(
161
+                    'id'           => $this->slug . '_featured_metabox_meal',
162
+                    'title'        => __( 'Featured Meal', 'lsx-health-plan' ),
163
+                    'object_types' => array( $this->slug ), // Post type
164
+                    'context'      => 'side',
165
+                    'priority'     => 'high',
166
+                    'show_names'   => true,
167
+               )
168
+          );
169
+          $cmb->add_field(
170
+               array(
171
+                    'name'       => __( 'Featured Meal', 'lsx-health-plan' ),
172
+                    'desc'       => __( 'Enable a featured meal' ),
173
+                    'id'         => $this->slug . '_featured_meal',
174
+                    'type'       => 'checkbox',
175
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
176
+               )
177
+          );
178
+     }
179 179
 
180
-	/**
181
-	 * Define the metabox and field configurations.
182
-	 */
183
-	public function details_metaboxes() {
184
-		$cmb = new_cmb2_box( array(
185
-			'id'           => $this->slug . '_shopping_list_metabox',
186
-			'title'        => __( 'Shopping List', 'lsx-health-plan' ),
187
-			'object_types' => array( $this->slug ), // Post type
188
-			'context'      => 'normal',
189
-			'priority'     => 'high',
190
-			'show_names'   => true,
191
-		) );
192
-		$cmb->add_field( array(
193
-			'name'       => __( 'Shopping List', 'lsx-health-plan' ),
194
-			'desc'       => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ),
195
-			'id'         => $this->slug . '_shopping_list',
196
-			'type'       => 'post_search_ajax',
197
-			// Optional :
198
-			'limit'      => 1,  // Limit selection to X items only (default 1)
199
-			'sortable'   => true, // Allow selected items to be sortable (default false)
200
-			'query_args' => array(
201
-				'post_type'      => array( 'page' ),
202
-				'post_status'    => array( 'publish' ),
203
-				'posts_per_page' => -1,
204
-			),
205
-		) );
206
-		$cmb = new_cmb2_box( array(
207
-			'id'           => $this->slug . '_details_metabox',
208
-			'title'        => __( 'Meal Details', 'lsx-health-plan' ),
209
-			'object_types' => array( $this->slug ), // Post type
210
-			'context'      => 'normal',
211
-			'priority'     => 'high',
212
-			'show_names'   => true,
213
-		) );
180
+     /**
181
+      * Define the metabox and field configurations.
182
+      */
183
+     public function details_metaboxes() {
184
+          $cmb = new_cmb2_box( array(
185
+               'id'           => $this->slug . '_shopping_list_metabox',
186
+               'title'        => __( 'Shopping List', 'lsx-health-plan' ),
187
+               'object_types' => array( $this->slug ), // Post type
188
+               'context'      => 'normal',
189
+               'priority'     => 'high',
190
+               'show_names'   => true,
191
+          ) );
192
+          $cmb->add_field( array(
193
+               'name'       => __( 'Shopping List', 'lsx-health-plan' ),
194
+               'desc'       => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ),
195
+               'id'         => $this->slug . '_shopping_list',
196
+               'type'       => 'post_search_ajax',
197
+               // Optional :
198
+               'limit'      => 1,  // Limit selection to X items only (default 1)
199
+               'sortable'   => true, // Allow selected items to be sortable (default false)
200
+               'query_args' => array(
201
+                    'post_type'      => array( 'page' ),
202
+                    'post_status'    => array( 'publish' ),
203
+                    'posts_per_page' => -1,
204
+               ),
205
+          ) );
206
+          $cmb = new_cmb2_box( array(
207
+               'id'           => $this->slug . '_details_metabox',
208
+               'title'        => __( 'Meal Details', 'lsx-health-plan' ),
209
+               'object_types' => array( $this->slug ), // Post type
210
+               'context'      => 'normal',
211
+               'priority'     => 'high',
212
+               'show_names'   => true,
213
+          ) );
214 214
 
215
-		$cmb->add_field( array(
216
-			'name' => __( 'Meal Short Description', 'lsx-health-plan' ),
217
-			'id'   => $this->slug . '_short_description',
218
-			'type' => 'textarea_small',
219
-			'desc' => __( 'Add a small description for this meal (optional)', 'lsx-health-plan' ),
220
-		) );
215
+          $cmb->add_field( array(
216
+               'name' => __( 'Meal Short Description', 'lsx-health-plan' ),
217
+               'id'   => $this->slug . '_short_description',
218
+               'type' => 'textarea_small',
219
+               'desc' => __( 'Add a small description for this meal (optional)', 'lsx-health-plan' ),
220
+          ) );
221 221
 
222
-		$cmb->add_field( array(
223
-			'name'       => __( 'Pre Breakfast Snack', 'lsx-health-plan' ),
224
-			'id'         => $this->slug . '_pre_breakfast_snack',
225
-			'type'       => 'wysiwyg',
226
-			'show_on_cb' => 'cmb2_hide_if_no_cats',
227
-			'options'    => array(
228
-				'textarea_rows' => 5,
229
-			),
230
-		) );
231
-		$cmb->add_field( array(
232
-			'name'       => __( 'Breakfast', 'lsx-health-plan' ),
233
-			'id'         => $this->slug . '_breakfast',
234
-			'type'       => 'wysiwyg',
235
-			'show_on_cb' => 'cmb2_hide_if_no_cats',
236
-			'options'    => array(
237
-				'textarea_rows' => 5,
238
-			),
239
-		) );
222
+          $cmb->add_field( array(
223
+               'name'       => __( 'Pre Breakfast Snack', 'lsx-health-plan' ),
224
+               'id'         => $this->slug . '_pre_breakfast_snack',
225
+               'type'       => 'wysiwyg',
226
+               'show_on_cb' => 'cmb2_hide_if_no_cats',
227
+               'options'    => array(
228
+                    'textarea_rows' => 5,
229
+               ),
230
+          ) );
231
+          $cmb->add_field( array(
232
+               'name'       => __( 'Breakfast', 'lsx-health-plan' ),
233
+               'id'         => $this->slug . '_breakfast',
234
+               'type'       => 'wysiwyg',
235
+               'show_on_cb' => 'cmb2_hide_if_no_cats',
236
+               'options'    => array(
237
+                    'textarea_rows' => 5,
238
+               ),
239
+          ) );
240 240
 
241
-		$cmb->add_field(
242
-			array(
243
-				'name'       => __( 'Post Breakfast Snack', 'lsx-health-plan' ),
244
-				'id'         => $this->slug . '_breakfast_snack',
245
-				'type'       => 'wysiwyg',
246
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
247
-				'options'    => array(
248
-					'textarea_rows' => 5,
249
-				),
250
-			)
251
-		);
241
+          $cmb->add_field(
242
+               array(
243
+                    'name'       => __( 'Post Breakfast Snack', 'lsx-health-plan' ),
244
+                    'id'         => $this->slug . '_breakfast_snack',
245
+                    'type'       => 'wysiwyg',
246
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
247
+                    'options'    => array(
248
+                         'textarea_rows' => 5,
249
+                    ),
250
+               )
251
+          );
252 252
 
253
-		if ( post_type_exists( 'recipe' ) ) {
254
-			$cmb->add_field(
255
-				array(
256
-					'name'       => __( 'Breakfast Recipes', 'lsx-health-plan' ),
257
-					'desc'       => __( 'Connect additional recipes options for breakfast.', 'lsx-health-plan' ),
258
-					'id'         => 'breakfast_recipes',
259
-					'type'       => 'post_search_ajax',
260
-					// Optional :
261
-					'limit'      => 15,  // Limit selection to X items only (default 1)
262
-					'sortable'   => true, // Allow selected items to be sortable (default false)
263
-					'query_args' => array(
264
-						'post_type'      => array( 'recipe' ),
265
-						'post_status'    => array( 'publish' ),
266
-						'posts_per_page' => -1,
267
-					),
268
-				)
269
-			);
270
-		}
253
+          if ( post_type_exists( 'recipe' ) ) {
254
+               $cmb->add_field(
255
+                    array(
256
+                         'name'       => __( 'Breakfast Recipes', 'lsx-health-plan' ),
257
+                         'desc'       => __( 'Connect additional recipes options for breakfast.', 'lsx-health-plan' ),
258
+                         'id'         => 'breakfast_recipes',
259
+                         'type'       => 'post_search_ajax',
260
+                         // Optional :
261
+                         'limit'      => 15,  // Limit selection to X items only (default 1)
262
+                         'sortable'   => true, // Allow selected items to be sortable (default false)
263
+                         'query_args' => array(
264
+                              'post_type'      => array( 'recipe' ),
265
+                              'post_status'    => array( 'publish' ),
266
+                              'posts_per_page' => -1,
267
+                         ),
268
+                    )
269
+               );
270
+          }
271 271
 
272
-		$cmb->add_field(
273
-			array(
274
-				'name'       => __( 'Pre Lunch Snack', 'lsx-health-plan' ),
275
-				'id'         => $this->slug . '_pre_lunch_snack',
276
-				'type'       => 'wysiwyg',
277
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
278
-				'options'    => array(
279
-					'textarea_rows' => 5,
280
-				),
281
-			)
282
-		);
283
-		$cmb->add_field(
284
-			array(
285
-				'name'       => __( 'Lunch', 'lsx-health-plan' ),
286
-				'id'         => $this->slug . '_lunch',
287
-				'type'       => 'wysiwyg',
288
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
289
-				'options'    => array(
290
-					'textarea_rows' => 5,
291
-				),
292
-			)
293
-		);
294
-		$cmb->add_field(
295
-			array(
296
-				'name'       => __( 'Post Lunch Snack', 'lsx-health-plan' ),
297
-				'id'         => $this->slug . '_lunch_snack',
298
-				'type'       => 'wysiwyg',
299
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
300
-				'options'    => array(
301
-					'textarea_rows' => 5,
302
-				),
303
-			)
304
-		);
272
+          $cmb->add_field(
273
+               array(
274
+                    'name'       => __( 'Pre Lunch Snack', 'lsx-health-plan' ),
275
+                    'id'         => $this->slug . '_pre_lunch_snack',
276
+                    'type'       => 'wysiwyg',
277
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
278
+                    'options'    => array(
279
+                         'textarea_rows' => 5,
280
+                    ),
281
+               )
282
+          );
283
+          $cmb->add_field(
284
+               array(
285
+                    'name'       => __( 'Lunch', 'lsx-health-plan' ),
286
+                    'id'         => $this->slug . '_lunch',
287
+                    'type'       => 'wysiwyg',
288
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
289
+                    'options'    => array(
290
+                         'textarea_rows' => 5,
291
+                    ),
292
+               )
293
+          );
294
+          $cmb->add_field(
295
+               array(
296
+                    'name'       => __( 'Post Lunch Snack', 'lsx-health-plan' ),
297
+                    'id'         => $this->slug . '_lunch_snack',
298
+                    'type'       => 'wysiwyg',
299
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
300
+                    'options'    => array(
301
+                         'textarea_rows' => 5,
302
+                    ),
303
+               )
304
+          );
305 305
 
306
-		if ( post_type_exists( 'recipe' ) ) {
307
-			$cmb->add_field(
308
-				array(
309
-					'name'       => __( 'Lunch Recipes', 'lsx-health-plan' ),
310
-					'desc'       => __( 'Connect additional recipes options for lunch.', 'lsx-health-plan' ),
311
-					'id'         => 'lunch_recipes',
312
-					'type'       => 'post_search_ajax',
313
-					// Optional :
314
-					'limit'      => 15,  // Limit selection to X items only (default 1)
315
-					'sortable'   => true, // Allow selected items to be sortable (default false)
316
-					'query_args' => array(
317
-						'post_type'      => array( 'recipe' ),
318
-						'post_status'    => array( 'publish' ),
319
-						'posts_per_page' => -1,
320
-					),
321
-				)
322
-			);
323
-		}
306
+          if ( post_type_exists( 'recipe' ) ) {
307
+               $cmb->add_field(
308
+                    array(
309
+                         'name'       => __( 'Lunch Recipes', 'lsx-health-plan' ),
310
+                         'desc'       => __( 'Connect additional recipes options for lunch.', 'lsx-health-plan' ),
311
+                         'id'         => 'lunch_recipes',
312
+                         'type'       => 'post_search_ajax',
313
+                         // Optional :
314
+                         'limit'      => 15,  // Limit selection to X items only (default 1)
315
+                         'sortable'   => true, // Allow selected items to be sortable (default false)
316
+                         'query_args' => array(
317
+                              'post_type'      => array( 'recipe' ),
318
+                              'post_status'    => array( 'publish' ),
319
+                              'posts_per_page' => -1,
320
+                         ),
321
+                    )
322
+               );
323
+          }
324 324
 
325
-		$cmb->add_field(
326
-			array(
327
-				'name'       => __( 'Pre Dinner Snack', 'lsx-health-plan' ),
328
-				'id'         => $this->slug . '_pre_dinner_snack',
329
-				'type'       => 'wysiwyg',
330
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
331
-				'options'    => array(
332
-					'textarea_rows' => 5,
333
-				),
334
-			)
335
-		);
336
-		$cmb->add_field(
337
-			array(
338
-				'name'       => __( 'Dinner', 'lsx-health-plan' ),
339
-				'id'         => $this->slug . '_dinner',
340
-				'type'       => 'wysiwyg',
341
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
342
-				'options'    => array(
343
-					'textarea_rows' => 5,
344
-				),
345
-			)
346
-		);
347
-		$cmb->add_field(
348
-			array(
349
-				'name'       => __( 'Post Dinner Snack', 'lsx-health-plan' ),
350
-				'id'         => $this->slug . '_dinner_snack',
351
-				'type'       => 'wysiwyg',
352
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
353
-				'options'    => array(
354
-					'textarea_rows' => 5,
355
-				),
356
-			)
357
-		);
325
+          $cmb->add_field(
326
+               array(
327
+                    'name'       => __( 'Pre Dinner Snack', 'lsx-health-plan' ),
328
+                    'id'         => $this->slug . '_pre_dinner_snack',
329
+                    'type'       => 'wysiwyg',
330
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
331
+                    'options'    => array(
332
+                         'textarea_rows' => 5,
333
+                    ),
334
+               )
335
+          );
336
+          $cmb->add_field(
337
+               array(
338
+                    'name'       => __( 'Dinner', 'lsx-health-plan' ),
339
+                    'id'         => $this->slug . '_dinner',
340
+                    'type'       => 'wysiwyg',
341
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
342
+                    'options'    => array(
343
+                         'textarea_rows' => 5,
344
+                    ),
345
+               )
346
+          );
347
+          $cmb->add_field(
348
+               array(
349
+                    'name'       => __( 'Post Dinner Snack', 'lsx-health-plan' ),
350
+                    'id'         => $this->slug . '_dinner_snack',
351
+                    'type'       => 'wysiwyg',
352
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
353
+                    'options'    => array(
354
+                         'textarea_rows' => 5,
355
+                    ),
356
+               )
357
+          );
358 358
 
359
-		if ( post_type_exists( 'recipe' ) ) {
360
-			$cmb->add_field(
361
-				array(
362
-					'name'       => __( 'Dinner Recipes', 'lsx-health-plan' ),
363
-					'desc'       => __( 'Connect additional recipes options for dinner.', 'lsx-health-plan' ),
364
-					'id'         => 'dinner_recipes',
365
-					'type'       => 'post_search_ajax',
366
-					// Optional :
367
-					'limit'      => 15,  // Limit selection to X items only (default 1)
368
-					'sortable'   => true, // Allow selected items to be sortable (default false)
369
-					'query_args' => array(
370
-						'post_type'      => array( 'recipe' ),
371
-						'post_status'    => array( 'publish' ),
372
-						'posts_per_page' => -1,
373
-					),
374
-				)
375
-			);
376
-		}
377
-	}
359
+          if ( post_type_exists( 'recipe' ) ) {
360
+               $cmb->add_field(
361
+                    array(
362
+                         'name'       => __( 'Dinner Recipes', 'lsx-health-plan' ),
363
+                         'desc'       => __( 'Connect additional recipes options for dinner.', 'lsx-health-plan' ),
364
+                         'id'         => 'dinner_recipes',
365
+                         'type'       => 'post_search_ajax',
366
+                         // Optional :
367
+                         'limit'      => 15,  // Limit selection to X items only (default 1)
368
+                         'sortable'   => true, // Allow selected items to be sortable (default false)
369
+                         'query_args' => array(
370
+                              'post_type'      => array( 'recipe' ),
371
+                              'post_status'    => array( 'publish' ),
372
+                              'posts_per_page' => -1,
373
+                         ),
374
+                    )
375
+               );
376
+          }
377
+     }
378 378
 }
Please login to merge, or discard this patch.
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
 	 * Contructor
31 31
 	 */
32 32
 	public function __construct() {
33
-		add_action( 'init', array( $this, 'register_post_type' ) );
34
-		add_action( 'init', array( $this, 'taxonomy_setup' ) );
35
-		add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
36
-		add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
37
-		add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 );
38
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
33
+		add_action('init', array($this, 'register_post_type'));
34
+		add_action('init', array($this, 'taxonomy_setup'));
35
+		add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1);
36
+		add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1);
37
+		add_action('cmb2_admin_init', array($this, 'featured_metabox'), 5);
38
+		add_action('cmb2_admin_init', array($this, 'details_metaboxes'));
39 39
 	}
40 40
 
41 41
 	/**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public static function get_instance() {
49 49
 		// If the single instance hasn't been set, set it now.
50
-		if ( null === self::$instance ) {
50
+		if (null === self::$instance) {
51 51
 			self::$instance = new self();
52 52
 		}
53 53
 		return self::$instance;
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function register_post_type() {
59 59
 		$labels = array(
60
-			'name'               => esc_html__( 'Meals', 'lsx-health-plan' ),
61
-			'singular_name'      => esc_html__( 'Meal', 'lsx-health-plan' ),
62
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
63
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
64
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
65
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
66
-			'all_items'          => esc_html__( 'All Meals', 'lsx-health-plan' ),
67
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
68
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
69
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
70
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
60
+			'name'               => esc_html__('Meals', 'lsx-health-plan'),
61
+			'singular_name'      => esc_html__('Meal', 'lsx-health-plan'),
62
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'),
63
+			'add_new_item'       => esc_html__('Add New', 'lsx-health-plan'),
64
+			'edit_item'          => esc_html__('Edit', 'lsx-health-plan'),
65
+			'new_item'           => esc_html__('New', 'lsx-health-plan'),
66
+			'all_items'          => esc_html__('All Meals', 'lsx-health-plan'),
67
+			'view_item'          => esc_html__('View', 'lsx-health-plan'),
68
+			'search_items'       => esc_html__('Search', 'lsx-health-plan'),
69
+			'not_found'          => esc_html__('None found', 'lsx-health-plan'),
70
+			'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'),
71 71
 			'parent_item_colon'  => '',
72
-			'menu_name'          => esc_html__( 'Meals', 'lsx-health-plan' ),
72
+			'menu_name'          => esc_html__('Meals', 'lsx-health-plan'),
73 73
 		);
74
-		$args   = array(
74
+		$args = array(
75 75
 			'labels'             => $labels,
76 76
 			'public'             => true,
77 77
 			'publicly_queryable' => true,
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 			'menu_icon'          => 'dashicons-carrot',
82 82
 			'query_var'          => true,
83 83
 			'rewrite'            => array(
84
-				'slug' => \lsx_health_plan\functions\get_option( 'meal_single_slug', 'meal' ),
84
+				'slug' => \lsx_health_plan\functions\get_option('meal_single_slug', 'meal'),
85 85
 			),
86 86
 			'capability_type'    => 'post',
87
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ),
87
+			'has_archive'        => \lsx_health_plan\functions\get_option('endpoint_meal_archive', 'meals'),
88 88
 			'hierarchical'       => true,
89 89
 			'menu_position'      => null,
90 90
 			'supports'           => array(
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 				'custom-fields',
96 96
 			),
97 97
 		);
98
-		register_post_type( 'meal', $args );
98
+		register_post_type('meal', $args);
99 99
 	}
100 100
 
101 101
 	/**
@@ -103,19 +103,19 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function taxonomy_setup() {
105 105
 		$labels = array(
106
-			'name'              => esc_html_x( 'Meal Type', 'taxonomy general name', 'lsx-health-plan' ),
107
-			'singular_name'     => esc_html_x( 'Meal Types', 'taxonomy singular name', 'lsx-health-plan' ),
108
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
109
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
110
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
111
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
112
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
113
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
114
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
115
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
116
-			'menu_name'         => esc_html__( 'Meal Types', 'lsx-health-plan' ),
106
+			'name'              => esc_html_x('Meal Type', 'taxonomy general name', 'lsx-health-plan'),
107
+			'singular_name'     => esc_html_x('Meal Types', 'taxonomy singular name', 'lsx-health-plan'),
108
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
109
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
110
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
111
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
112
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
113
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
114
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
115
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
116
+			'menu_name'         => esc_html__('Meal Types', 'lsx-health-plan'),
117 117
 		);
118
-		$args   = array(
118
+		$args = array(
119 119
 			'hierarchical'      => true,
120 120
 			'labels'            => $labels,
121 121
 			'show_ui'           => true,
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 				'slug' => 'meal-type',
127 127
 			),
128 128
 		);
129
-		register_taxonomy( 'meal-type', array( $this->slug ), $args );
129
+		register_taxonomy('meal-type', array($this->slug), $args);
130 130
 	}
131 131
 
132 132
 	/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 * @param array $post_types
136 136
 	 * @return array
137 137
 	 */
138
-	public function enable_post_type( $post_types = array() ) {
138
+	public function enable_post_type($post_types = array()) {
139 139
 		$post_types[] = $this->slug;
140 140
 		return $post_types;
141 141
 	}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @param array $connections
147 147
 	 * @return void
148 148
 	 */
149
-	public function enable_connections( $connections = array() ) {
149
+	public function enable_connections($connections = array()) {
150 150
 		$connections['meal']['connected_plans'] = 'connected_meals';
151 151
 		$connections['plan']['connected_meals'] = 'connected_plans';
152 152
 		return $connections;
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 		$cmb = new_cmb2_box(
160 160
 			array(
161 161
 				'id'           => $this->slug . '_featured_metabox_meal',
162
-				'title'        => __( 'Featured Meal', 'lsx-health-plan' ),
163
-				'object_types' => array( $this->slug ), // Post type
162
+				'title'        => __('Featured Meal', 'lsx-health-plan'),
163
+				'object_types' => array($this->slug), // Post type
164 164
 				'context'      => 'side',
165 165
 				'priority'     => 'high',
166 166
 				'show_names'   => true,
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 		);
169 169
 		$cmb->add_field(
170 170
 			array(
171
-				'name'       => __( 'Featured Meal', 'lsx-health-plan' ),
172
-				'desc'       => __( 'Enable a featured meal' ),
171
+				'name'       => __('Featured Meal', 'lsx-health-plan'),
172
+				'desc'       => __('Enable a featured meal'),
173 173
 				'id'         => $this->slug . '_featured_meal',
174 174
 				'type'       => 'checkbox',
175 175
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -181,66 +181,66 @@  discard block
 block discarded – undo
181 181
 	 * Define the metabox and field configurations.
182 182
 	 */
183 183
 	public function details_metaboxes() {
184
-		$cmb = new_cmb2_box( array(
184
+		$cmb = new_cmb2_box(array(
185 185
 			'id'           => $this->slug . '_shopping_list_metabox',
186
-			'title'        => __( 'Shopping List', 'lsx-health-plan' ),
187
-			'object_types' => array( $this->slug ), // Post type
186
+			'title'        => __('Shopping List', 'lsx-health-plan'),
187
+			'object_types' => array($this->slug), // Post type
188 188
 			'context'      => 'normal',
189 189
 			'priority'     => 'high',
190 190
 			'show_names'   => true,
191
-		) );
192
-		$cmb->add_field( array(
193
-			'name'       => __( 'Shopping List', 'lsx-health-plan' ),
194
-			'desc'       => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ),
191
+		));
192
+		$cmb->add_field(array(
193
+			'name'       => __('Shopping List', 'lsx-health-plan'),
194
+			'desc'       => __('Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.'),
195 195
 			'id'         => $this->slug . '_shopping_list',
196 196
 			'type'       => 'post_search_ajax',
197 197
 			// Optional :
198
-			'limit'      => 1,  // Limit selection to X items only (default 1)
198
+			'limit'      => 1, // Limit selection to X items only (default 1)
199 199
 			'sortable'   => true, // Allow selected items to be sortable (default false)
200 200
 			'query_args' => array(
201
-				'post_type'      => array( 'page' ),
202
-				'post_status'    => array( 'publish' ),
201
+				'post_type'      => array('page'),
202
+				'post_status'    => array('publish'),
203 203
 				'posts_per_page' => -1,
204 204
 			),
205
-		) );
206
-		$cmb = new_cmb2_box( array(
205
+		));
206
+		$cmb = new_cmb2_box(array(
207 207
 			'id'           => $this->slug . '_details_metabox',
208
-			'title'        => __( 'Meal Details', 'lsx-health-plan' ),
209
-			'object_types' => array( $this->slug ), // Post type
208
+			'title'        => __('Meal Details', 'lsx-health-plan'),
209
+			'object_types' => array($this->slug), // Post type
210 210
 			'context'      => 'normal',
211 211
 			'priority'     => 'high',
212 212
 			'show_names'   => true,
213
-		) );
213
+		));
214 214
 
215
-		$cmb->add_field( array(
216
-			'name' => __( 'Meal Short Description', 'lsx-health-plan' ),
215
+		$cmb->add_field(array(
216
+			'name' => __('Meal Short Description', 'lsx-health-plan'),
217 217
 			'id'   => $this->slug . '_short_description',
218 218
 			'type' => 'textarea_small',
219
-			'desc' => __( 'Add a small description for this meal (optional)', 'lsx-health-plan' ),
220
-		) );
219
+			'desc' => __('Add a small description for this meal (optional)', 'lsx-health-plan'),
220
+		));
221 221
 
222
-		$cmb->add_field( array(
223
-			'name'       => __( 'Pre Breakfast Snack', 'lsx-health-plan' ),
222
+		$cmb->add_field(array(
223
+			'name'       => __('Pre Breakfast Snack', 'lsx-health-plan'),
224 224
 			'id'         => $this->slug . '_pre_breakfast_snack',
225 225
 			'type'       => 'wysiwyg',
226 226
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
227 227
 			'options'    => array(
228 228
 				'textarea_rows' => 5,
229 229
 			),
230
-		) );
231
-		$cmb->add_field( array(
232
-			'name'       => __( 'Breakfast', 'lsx-health-plan' ),
230
+		));
231
+		$cmb->add_field(array(
232
+			'name'       => __('Breakfast', 'lsx-health-plan'),
233 233
 			'id'         => $this->slug . '_breakfast',
234 234
 			'type'       => 'wysiwyg',
235 235
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
236 236
 			'options'    => array(
237 237
 				'textarea_rows' => 5,
238 238
 			),
239
-		) );
239
+		));
240 240
 
241 241
 		$cmb->add_field(
242 242
 			array(
243
-				'name'       => __( 'Post Breakfast Snack', 'lsx-health-plan' ),
243
+				'name'       => __('Post Breakfast Snack', 'lsx-health-plan'),
244 244
 				'id'         => $this->slug . '_breakfast_snack',
245 245
 				'type'       => 'wysiwyg',
246 246
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -250,19 +250,19 @@  discard block
 block discarded – undo
250 250
 			)
251 251
 		);
252 252
 
253
-		if ( post_type_exists( 'recipe' ) ) {
253
+		if (post_type_exists('recipe')) {
254 254
 			$cmb->add_field(
255 255
 				array(
256
-					'name'       => __( 'Breakfast Recipes', 'lsx-health-plan' ),
257
-					'desc'       => __( 'Connect additional recipes options for breakfast.', 'lsx-health-plan' ),
256
+					'name'       => __('Breakfast Recipes', 'lsx-health-plan'),
257
+					'desc'       => __('Connect additional recipes options for breakfast.', 'lsx-health-plan'),
258 258
 					'id'         => 'breakfast_recipes',
259 259
 					'type'       => 'post_search_ajax',
260 260
 					// Optional :
261
-					'limit'      => 15,  // Limit selection to X items only (default 1)
261
+					'limit'      => 15, // Limit selection to X items only (default 1)
262 262
 					'sortable'   => true, // Allow selected items to be sortable (default false)
263 263
 					'query_args' => array(
264
-						'post_type'      => array( 'recipe' ),
265
-						'post_status'    => array( 'publish' ),
264
+						'post_type'      => array('recipe'),
265
+						'post_status'    => array('publish'),
266 266
 						'posts_per_page' => -1,
267 267
 					),
268 268
 				)
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 
272 272
 		$cmb->add_field(
273 273
 			array(
274
-				'name'       => __( 'Pre Lunch Snack', 'lsx-health-plan' ),
274
+				'name'       => __('Pre Lunch Snack', 'lsx-health-plan'),
275 275
 				'id'         => $this->slug . '_pre_lunch_snack',
276 276
 				'type'       => 'wysiwyg',
277 277
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		);
283 283
 		$cmb->add_field(
284 284
 			array(
285
-				'name'       => __( 'Lunch', 'lsx-health-plan' ),
285
+				'name'       => __('Lunch', 'lsx-health-plan'),
286 286
 				'id'         => $this->slug . '_lunch',
287 287
 				'type'       => 'wysiwyg',
288 288
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 		);
294 294
 		$cmb->add_field(
295 295
 			array(
296
-				'name'       => __( 'Post Lunch Snack', 'lsx-health-plan' ),
296
+				'name'       => __('Post Lunch Snack', 'lsx-health-plan'),
297 297
 				'id'         => $this->slug . '_lunch_snack',
298 298
 				'type'       => 'wysiwyg',
299 299
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -303,19 +303,19 @@  discard block
 block discarded – undo
303 303
 			)
304 304
 		);
305 305
 
306
-		if ( post_type_exists( 'recipe' ) ) {
306
+		if (post_type_exists('recipe')) {
307 307
 			$cmb->add_field(
308 308
 				array(
309
-					'name'       => __( 'Lunch Recipes', 'lsx-health-plan' ),
310
-					'desc'       => __( 'Connect additional recipes options for lunch.', 'lsx-health-plan' ),
309
+					'name'       => __('Lunch Recipes', 'lsx-health-plan'),
310
+					'desc'       => __('Connect additional recipes options for lunch.', 'lsx-health-plan'),
311 311
 					'id'         => 'lunch_recipes',
312 312
 					'type'       => 'post_search_ajax',
313 313
 					// Optional :
314
-					'limit'      => 15,  // Limit selection to X items only (default 1)
314
+					'limit'      => 15, // Limit selection to X items only (default 1)
315 315
 					'sortable'   => true, // Allow selected items to be sortable (default false)
316 316
 					'query_args' => array(
317
-						'post_type'      => array( 'recipe' ),
318
-						'post_status'    => array( 'publish' ),
317
+						'post_type'      => array('recipe'),
318
+						'post_status'    => array('publish'),
319 319
 						'posts_per_page' => -1,
320 320
 					),
321 321
 				)
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 
325 325
 		$cmb->add_field(
326 326
 			array(
327
-				'name'       => __( 'Pre Dinner Snack', 'lsx-health-plan' ),
327
+				'name'       => __('Pre Dinner Snack', 'lsx-health-plan'),
328 328
 				'id'         => $this->slug . '_pre_dinner_snack',
329 329
 				'type'       => 'wysiwyg',
330 330
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 		);
336 336
 		$cmb->add_field(
337 337
 			array(
338
-				'name'       => __( 'Dinner', 'lsx-health-plan' ),
338
+				'name'       => __('Dinner', 'lsx-health-plan'),
339 339
 				'id'         => $this->slug . '_dinner',
340 340
 				'type'       => 'wysiwyg',
341 341
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 		);
347 347
 		$cmb->add_field(
348 348
 			array(
349
-				'name'       => __( 'Post Dinner Snack', 'lsx-health-plan' ),
349
+				'name'       => __('Post Dinner Snack', 'lsx-health-plan'),
350 350
 				'id'         => $this->slug . '_dinner_snack',
351 351
 				'type'       => 'wysiwyg',
352 352
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -356,19 +356,19 @@  discard block
 block discarded – undo
356 356
 			)
357 357
 		);
358 358
 
359
-		if ( post_type_exists( 'recipe' ) ) {
359
+		if (post_type_exists('recipe')) {
360 360
 			$cmb->add_field(
361 361
 				array(
362
-					'name'       => __( 'Dinner Recipes', 'lsx-health-plan' ),
363
-					'desc'       => __( 'Connect additional recipes options for dinner.', 'lsx-health-plan' ),
362
+					'name'       => __('Dinner Recipes', 'lsx-health-plan'),
363
+					'desc'       => __('Connect additional recipes options for dinner.', 'lsx-health-plan'),
364 364
 					'id'         => 'dinner_recipes',
365 365
 					'type'       => 'post_search_ajax',
366 366
 					// Optional :
367
-					'limit'      => 15,  // Limit selection to X items only (default 1)
367
+					'limit'      => 15, // Limit selection to X items only (default 1)
368 368
 					'sortable'   => true, // Allow selected items to be sortable (default false)
369 369
 					'query_args' => array(
370
-						'post_type'      => array( 'recipe' ),
371
-						'post_status'    => array( 'publish' ),
370
+						'post_type'      => array('recipe'),
371
+						'post_status'    => array('publish'),
372 372
 						'posts_per_page' => -1,
373 373
 					),
374 374
 				)
Please login to merge, or discard this patch.
classes/admin/class-settings.php 2 patches
Indentation   +696 added lines, -696 removed lines patch added patch discarded remove patch
@@ -12,700 +12,700 @@
 block discarded – undo
12 12
  */
13 13
 class Settings {
14 14
 
15
-	/**
16
-	 * Holds class instance
17
-	 *
18
-	 * @since 1.0.0
19
-	 *
20
-	 * @var      object \lsx_health_plan\classes\admin\Settings()
21
-	 */
22
-	protected static $instance = null;
23
-
24
-	/**
25
-	 * Option key, and option page slug
26
-	 *
27
-	 * @var string
28
-	 */
29
-	protected $screen_id = 'lsx_health_plan_settings';
30
-
31
-	/**
32
-	 * An array of the post types for the Global Downloads field.
33
-	 *
34
-	 * @var array
35
-	 */
36
-	public $download_types = array();
37
-
38
-	/**
39
-	 * An array of the post types for the Global Defaults field.
40
-	 *
41
-	 * @var array
42
-	 */
43
-	public $default_types = array();
44
-
45
-	/**
46
-	 * An array of the endpoints for the Endpoint Translation field.
47
-	 *
48
-	 * @var array
49
-	 */
50
-	public $endpoints = array();
51
-
52
-	/**
53
-	 * Constructor
54
-	 */
55
-	public function __construct() {
56
-		$this->load_classes();
57
-		add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) );
58
-		add_action( 'lsx_hp_settings_page', array( $this, 'generate_tabs' ), 1, 1 );
59
-
60
-		add_action( 'lsx_hp_settings_page_general_top', array( $this, 'general_settings' ), 1, 1 );
61
-		add_action( 'lsx_hp_settings_page', array( $this, 'global_defaults' ), 3, 1 );
62
-		add_action( 'lsx_hp_settings_page', array( $this, 'global_downloads' ), 5, 1 );
63
-		add_action( 'lsx_hp_settings_page', array( $this, 'stat_disable' ), 6, 1 );
64
-		add_action( 'lsx_hp_settings_page', array( $this, 'endpoint_translations' ), 7, 1 );
65
-		add_action( 'lsx_hp_settings_page', array( $this, 'exercise_translations' ), 7, 1 );
66
-		add_action( 'lsx_hp_settings_page', array( $this, 'post_type_toggles' ), 9, 1 );
67
-	}
68
-
69
-	/**
70
-	 * Return an instance of this class.
71
-	 *
72
-	 * @since 1.0.0
73
-	 *
74
-	 * @return    object \lsx_health_plan\classes\admin\Settings()    A single instance of this class.
75
-	 */
76
-	public static function get_instance() {
77
-		// If the single instance hasn't been set, set it now.
78
-		if ( null === self::$instance ) {
79
-			self::$instance = new self();
80
-		}
81
-		return self::$instance;
82
-	}
83
-
84
-	/**
85
-	 * Loads the variable classes and the static classes.
86
-	 */
87
-	private function load_classes() {
88
-
89
-		$this->post_types = array(
90
-			'plan',
91
-			'workout',
92
-			'exercise',
93
-			//'meal',
94
-			'recipe',
95
-			//'tip',
96
-		);
97
-
98
-		foreach ( $this->post_types as $post_type ) {
99
-			$this->$post_type = require_once LSX_HEALTH_PLAN_PATH . 'classes/admin/settings/class-' . $post_type . '.php';
100
-		}
101
-	}
102
-
103
-	/**
104
-	 * Sets the variables needed for the fields.
105
-	 *
106
-	 * @return void
107
-	 */
108
-	public function set_vars() {
109
-
110
-		$this->default_types  = array(
111
-			'page' => array(
112
-				'title'       => __( 'Warm Up', 'lsx-health-plan' ),
113
-				'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
114
-				'limit'       => 1,
115
-				'id'          => 'plan_warmup',
116
-			),
117
-		);
118
-		$this->download_types = array(
119
-			'page' => array(
120
-				'title'       => __( 'Warm Up', 'lsx-health-plan' ),
121
-				'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
122
-				'limit'       => 1,
123
-			),
124
-		);
125
-		$this->endpoints      = array(
126
-			'endpoint_warm_up' => array(
127
-				'title'       => __( 'Warm Up Endpoint', 'lsx-health-plan' ),
128
-				'default'     => 'warm-up',
129
-			),
130
-		);
131
-
132
-		if ( post_type_exists( 'meal' ) ) {
133
-			$this->download_types['meal']     = array(
134
-				'title'       => __( 'Meal Plan', 'lsx-health-plan' ),
135
-				'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ),
136
-			);
137
-			$this->default_types['meal']      = array(
138
-				'title'       => __( 'Meal Plan', 'lsx-health-plan' ),
139
-				'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ),
140
-				'id'          => 'connected_meals',
141
-			);
142
-			$this->endpoints['endpoint_meal'] = array(
143
-				'title'       => __( 'Meal Endpoint', 'lsx-health-plan' ),
144
-				'default'     => 'meal',
145
-				'description' => __( 'Define the tab slug which shows on the single plan page.', 'lsx-health-plan' ),
146
-			);
147
-			$this->endpoints['endpoint_meal_archive'] = array(
148
-				'title'   => __( 'Meals Archive Endpoint', 'lsx-health-plan' ),
149
-				'default' => 'meals',
150
-			);
151
-			$this->endpoints['meal_single_slug'] = array(
152
-				'title'   => __( 'Single Meal Slug', 'lsx-health-plan' ),
153
-				'default' => 'meal',
154
-			);
155
-		}
156
-		if ( post_type_exists( 'recipe' ) ) {
157
-			$this->download_types['recipe'] = array(
158
-				'title'       => __( 'Recipe', 'lsx-health-plan' ),
159
-				'description' => __( 'Set a default recipe.', 'lsx-health-plan' ),
160
-			);
161
-			$this->default_types['recipe'] = array(
162
-				'title'       => __( 'Recipe', 'lsx-health-plan' ),
163
-				'description' => __( 'Set a default recipe.', 'lsx-health-plan' ),
164
-				'id'          => 'connected_recipes',
165
-			);
166
-			$this->endpoints['endpoint_recipe'] = array(
167
-				'title'   => __( 'Recipes Endpoint', 'lsx-health-plan' ),
168
-				'default' => 'recipe',
169
-			);
170
-		}
171
-		if ( post_type_exists( 'workout' ) ) {
172
-			$this->download_types['workout'] = array(
173
-				'title'       => __( 'Workout', 'lsx-health-plan' ),
174
-				'description' => __( 'Set a default workout routine PDF.', 'lsx-health-plan' ),
175
-			);
176
-			$this->default_types['workout'] = array(
177
-				'title'       => __( 'Workout', 'lsx-health-plan' ),
178
-				'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ),
179
-				'id'          => 'connected_workouts',
180
-			);
181
-			$this->endpoints['endpoint_workout_archive'] = array(
182
-				'title'   => __( 'Workouts Archive Endpoint', 'lsx-health-plan' ),
183
-				'default' => '',
184
-			);
185
-			$this->endpoints['endpoint_workout'] = array(
186
-				'title'   => __( 'Single Workout Endpoint', 'lsx-health-plan' ),
187
-				'default' => 'workout',
188
-			);
189
-		}
190
-
191
-		$this->endpoints['login_slug'] = array(
192
-			'title'   => __( 'Login Slug', 'lsx-health-plan' ),
193
-			'default' => 'login',
194
-		);
195
-		$this->endpoints['my_plan_slug'] = array(
196
-			'title'   => __( 'My Plan Slug', 'lsx-health-plan' ),
197
-			'default' => 'my-plan',
198
-		);
199
-		$this->endpoints['plan_single_slug'] = array(
200
-			'title'   => __( 'Single Plan Slug', 'lsx-health-plan' ),
201
-			'default' => 'plan',
202
-		);
203
-		$this->endpoints['endpoint_plan_archive'] = array(
204
-			'title'   => __( 'Plans Archive Endpoint', 'lsx-health-plan' ),
205
-			'default' => 'plans',
206
-		);
207
-
208
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
209
-			$this->endpoints['exercise'] = array(
210
-				'exercise_single' => array(
211
-					'title'   => __( 'Single Exercise Slug', 'lsx-health-plan' ),
212
-					'default' => 'exercise',
213
-				),
214
-				'exercise_archive' => array(
215
-					'title'   => __( 'Archive Exercise Slug', 'lsx-health-plan' ),
216
-					'default' => 'exercises',
217
-				),
218
-				'exercise_type' => array(
219
-					'title'   => __( 'Exercise Type Slug', 'lsx-health-plan' ),
220
-					'default' => 'exercise-type',
221
-				),
222
-				'exercise_equipment' => array(
223
-					'title'   => __( 'Equipment Slug', 'lsx-health-plan' ),
224
-					'default' => 'equipment',
225
-				),
226
-				'exercise_musclegroup' => array(
227
-					'title'   => __( 'Muscle Group Slug', 'lsx-health-plan' ),
228
-					'default' => 'muscle-group',
229
-				),
230
-			);
231
-		}
232
-	}
233
-
234
-	/**
235
-	 * Hook in and register a submenu options page for the Page post-type menu.
236
-	 */
237
-	public function register_settings_page() {
238
-		$this->set_vars();
239
-		$cmb = new_cmb2_box(
240
-			array(
241
-				'id'           => $this->screen_id,
242
-				'title'        => esc_html__( 'Settings', 'lsx-health-plan' ),
243
-				'object_types' => array( 'options-page' ),
244
-				'option_key'   => 'lsx_health_plan_options', // The option key and admin menu page slug.
245
-				'parent_slug'  => 'edit.php?post_type=plan', // Make options page a submenu item of the themes menu.
246
-				'capability'   => 'manage_options', // Cap required to view options-page.
247
-			)
248
-		);
249
-		do_action( 'lsx_hp_settings_page', $cmb );
250
-	}
251
-
252
-	/**
253
-	 * Registers the general settings.
254
-	 *
255
-	 * @param object $cmb new_cmb2_box().
256
-	 * @return void
257
-	 */
258
-	public function general_settings( $cmb ) {
259
-		$cmb->add_field(
260
-			array(
261
-				'name'       => __( 'Membership Product', 'lsx-health-plan' ),
262
-				'id'         => 'membership_product',
263
-				'type'       => 'post_search_ajax',
264
-				'limit'      => 1,
265
-				'sortable'   => false,
266
-				'query_args' => array(
267
-					'post_type'      => array( 'product' ),
268
-					'post_status'    => array( 'publish' ),
269
-					'posts_per_page' => -1,
270
-				),
271
-			)
272
-		);
273
-
274
-		$cmb->add_field(
275
-			array(
276
-				'name'    => __( 'Your Warm-up Intro', 'lsx-health-plan' ),
277
-				'id'      => 'warmup_intro',
278
-				'type'    => 'textarea_small',
279
-				'value'   => '',
280
-				'default' => __( "Don't forget your warm-up! It's a vital part of your daily workout routine.", 'lsx-health-plan' ),
281
-			)
282
-		);
283
-		if ( post_type_exists( 'workout' ) ) {
284
-			$cmb->add_field(
285
-				array(
286
-					'name'    => __( 'Your Workout Intro', 'lsx-health-plan' ),
287
-					'id'      => 'workout_intro',
288
-					'type'    => 'textarea_small',
289
-					'value'   => '',
290
-					'default' => __( "Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan' ),
291
-				)
292
-			);
293
-		}
294
-		if ( post_type_exists( 'meal' ) ) {
295
-			$cmb->add_field(
296
-				array(
297
-					'name'    => __( 'Your Meal Plan Intro', 'lsx-health-plan' ),
298
-					'id'      => 'meal_plan_intro',
299
-					'type'    => 'textarea_small',
300
-					'value'   => '',
301
-					'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ),
302
-				)
303
-			);
304
-		}
305
-		if ( post_type_exists( 'recipe' ) ) {
306
-			$cmb->add_field(
307
-				array(
308
-					'name'    => __( 'Recipes Intro', 'lsx-health-plan' ),
309
-					'id'      => 'recipes_intro',
310
-					'type'    => 'textarea_small',
311
-					'value'   => '',
312
-					'default' => __( "Let's get cooking! Delicious and easy to follow recipes.", 'lsx-health-plan' ),
313
-				)
314
-			);
315
-		}
316
-	}
317
-
318
-	/**
319
-	 * Registers the global default settings.
320
-	 *
321
-	 * @param object $cmb new_cmb2_box().
322
-	 * @return void
323
-	 */
324
-	public function global_defaults( $cmb ) {
325
-		$cmb->add_field(
326
-			array(
327
-				'id'      => 'global_defaults_title',
328
-				'type'    => 'title',
329
-				'name'    => __( 'Global Defaults', 'lsx-health-plan' ),
330
-				'default' => __( 'Global Defaults', 'lsx-health-plan' ),
331
-				'description' => __( 'If you have not connected a specific post to your day plan, set a default option below.', 'lsx-health-plan' ),
332
-			)
333
-		);
334
-
335
-		foreach ( $this->default_types as $type => $default_type ) {
336
-			$limit    = 5;
337
-			$sortable = false;
338
-			if ( isset( $default_type['limit'] ) ) {
339
-				$limit    = $default_type['limit'];
340
-				$sortable = true;
341
-			}
342
-
343
-			if ( 'page' === $type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
344
-				$type = array( 'page', 'workout' );
345
-			}
346
-
347
-			$cmb->add_field(
348
-				array(
349
-					'name'       => $default_type['title'],
350
-					'desc'       => $default_type['description'],
351
-					'id'         => $default_type['id'],
352
-					'type'       => 'post_search_ajax',
353
-					'limit'      => $limit,
354
-					'sortable'   => $sortable,
355
-					'query_args' => array(
356
-						'post_type'      => $type,
357
-						'post_status'    => array( 'publish' ),
358
-						'posts_per_page' => -1,
359
-					),
360
-				)
361
-			);
362
-		}
363
-
364
-		$cmb->add_field(
365
-			array(
366
-				'id'   => 'settings_global_defaults_closing',
367
-				'type' => 'tab_closing',
368
-			)
369
-		);
370
-	}
371
-
372
-	/**
373
-	 * Registers the global dowloads settings
374
-	 *
375
-	 * @param object $cmb new_cmb2_box().
376
-	 * @return void
377
-	 */
378
-	public function global_downloads( $cmb ) {
379
-		$cmb->add_field(
380
-			array(
381
-				'id'          => 'global_downloads_title',
382
-				'type'        => 'title',
383
-				'name'        => __( 'Global Downloads', 'lsx-health-plan' ),
384
-				'default'     => __( 'Global Downloads', 'lsx-health-plan' ),
385
-				'description' => __( 'If you have not connected a specific download file to your plans, set a default option below', 'lsx-health-plan' ),
386
-			)
387
-		);
388
-
389
-		foreach ( $this->download_types as $type => $download_type ) {
390
-			$limit    = 5;
391
-			$sortable = false;
392
-			if ( isset( $download_type['limit'] ) ) {
393
-				$limit    = $download_type['limit'];
394
-				$sortable = true;
395
-			}
396
-
397
-			$cmb->add_field(
398
-				array(
399
-					'name'       => $download_type['title'],
400
-					'id'         => 'download_' . $type,
401
-					'type'       => 'post_search_ajax',
402
-					'limit'      => $limit,
403
-					'sortable'   => $sortable,
404
-					'query_args' => array(
405
-						'post_type'      => array( 'dlm_download' ),
406
-						'post_status'    => array( 'publish' ),
407
-						'posts_per_page' => -1,
408
-					),
409
-				)
410
-			);
411
-		}
412
-		$cmb->add_field(
413
-			array(
414
-				'id'   => 'settings_global_downloads_closing',
415
-				'type' => 'tab_closing',
416
-			)
417
-		);
418
-	}
419
-
420
-	/**
421
-	 * Registers the endpoint translation settings.
422
-	 *
423
-	 * @param object $cmb new_cmb2_box().
424
-	 * @return void
425
-	 */
426
-	public function endpoint_translations( $cmb ) {
427
-		$cmb->add_field(
428
-			array(
429
-				'id'          => 'endpoints_title',
430
-				'type'        => 'title',
431
-				'name'        => __( 'Set Endpoint Translations', 'lsx-health-plan' ),
432
-				'default'     => __( 'Set Endpoint Translations', 'lsx-health-plan' ),
433
-			)
434
-		);
435
-		foreach ( $this->endpoints as $slug => $endpoint_vars ) {
436
-			if ( 'exercise' === $slug ) {
437
-				continue;
438
-			}
439
-
440
-			$cmb->add_field(
441
-				array(
442
-					'name'    => $endpoint_vars['title'],
443
-					'id'      => $slug,
444
-					'type'    => 'input',
445
-					'value'   => '',
446
-					'default' => $endpoint_vars['default'],
447
-				)
448
-			);
449
-		}
450
-		$cmb->add_field(
451
-			array(
452
-				'id'   => 'settings_endpoints_closing',
453
-				'type' => 'tab_closing',
454
-				'before_row'    => '<p style="margin-top:20px; font-style: italic;">Endpoint is a web address (URL) at which the user can gain access to it. You need to resave your permalinks after changing the endpoint settings.</p>',
455
-			)
456
-		);
457
-	}
458
-
459
-	/**
460
-	 * Registers the endpoint translation settings.
461
-	 *
462
-	 * @param object $cmb new_cmb2_box().
463
-	 * @return void
464
-	 */
465
-	public function exercise_translations( $cmb ) {
466
-		if ( isset( $this->endpoints['exercise'] ) && '' !== $this->endpoints['exercise'] && ! empty( $this->endpoints['exercise'] ) ) {
467
-			$cmb->add_field(
468
-				array(
469
-					'id'          => 'exercise_endpoints_title',
470
-					'type'        => 'title',
471
-					'name'        => __( 'Set Exercise Translations', 'lsx-health-plan' ),
472
-					'default'     => __( 'Set Exercise Translations', 'lsx-health-plan' ),
473
-					'description' => __( 'Change the exercise endpoints.', 'lsx-health-plan' ),
474
-				)
475
-			);
476
-
477
-			foreach ( $this->endpoints['exercise'] as $slug => $endpoint_vars ) {
478
-				$cmb->add_field(
479
-					array(
480
-						'name'    => $endpoint_vars['title'],
481
-						'id'      => 'endpoint_' . $slug,
482
-						'type'    => 'input',
483
-						'value'   => '',
484
-						'default' => $endpoint_vars['default'],
485
-					)
486
-				);
487
-			}
488
-
489
-			$cmb->add_field(
490
-				array(
491
-					'id'   => 'settings_exercise_closing',
492
-					'type' => 'tab_closing',
493
-					'before_row'    => '<p style="margin-top:20px; font-style: italic;">If you need to translate the exercise URL endpoints, do so below.</p>',
494
-				)
495
-			);
496
-		}
497
-	}
498
-
499
-	/**
500
-	 * Registers the post type toggle settings
501
-	 *
502
-	 * @param object $cmb new_cmb2_box().
503
-	 * @return void
504
-	 */
505
-	public function post_type_toggles( $cmb ) {
506
-		$post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) );
507
-
508
-		$cmb->add_field(
509
-			array(
510
-				'id'          => 'post_type_toggles_title',
511
-				'type'        => 'title',
512
-				'name'        => __( 'Disable Post Types', 'lsx-health-plan' ),
513
-				'default'     => __( 'Disable Post Types', 'lsx-health-plan' ),
514
-				'description' => __( 'Disable post types if you are wanting a minimal site.', 'lsx-health-plan' ),
515
-			)
516
-		);
517
-
518
-		foreach ( $post_types as $post_type ) {
519
-			if ( 'plan' === $post_type || 'exercise' === $post_type || ( 'video' === $post_type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) ) {
520
-				continue;
521
-			}
522
-
523
-			$cmb->add_field(
524
-				array(
525
-					'name'    => ucwords( $post_type ),
526
-					'id'      => $post_type . '_disabled',
527
-					'type'    => 'checkbox',
528
-					'value'   => 1,
529
-					'default' => 0,
530
-				)
531
-			);
532
-		}
533
-
534
-		$cmb->add_field(
535
-			array(
536
-				'id'   => 'settings_post_type_toggles_closing',
537
-				'type' => 'tab_closing',
538
-			)
539
-		);
540
-
541
-		$cmb->add_field(
542
-			array(
543
-				'id'          => 'post_type_toggles_enable_title',
544
-				'type'        => 'title',
545
-				'name'        => __( 'Enable Post Types', 'lsx-health-plan' ),
546
-				'default'     => __( 'Enable Post Types', 'lsx-health-plan' ),
547
-				'description' => __( 'Enable new functionality like the "exercise" post type.', 'lsx-health-plan' ),
548
-			)
549
-		);
550
-		$cmb->add_field(
551
-			array(
552
-				'name'        => __( 'Exercises', 'lsx-health-plan' ),
553
-				'id'          => 'exercise_enabled',
554
-				'type'        => 'checkbox',
555
-				'value'       => 1,
556
-				'default'     => 0,
557
-				'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ),
558
-			)
559
-		);
560
-		$cmb->add_field(
561
-			array(
562
-				'id'   => 'settings_post_type_toggles_enable_closing',
563
-				'type' => 'tab_closing',
564
-			)
565
-		);
566
-	}
567
-	/**
568
-	 * Registers the Profile Stat Toggle settings
569
-	 *
570
-	 * @param object $cmb new_cmb2_box().
571
-	 * @return void
572
-	 */
573
-
574
-	public function stat_disable( $cmb ) {
575
-		$cmb->add_field(
576
-			array(
577
-				'id'      => 'stat_disable_title',
578
-				'type'    => 'title',
579
-				'name'    => __( 'Disable Profile Stats', 'lsx-health-plan' ),
580
-				'default' => __( 'Disable Profile Stats', 'lsx-health-plan' ),
581
-			)
582
-		);
583
-		$cmb->add_field(
584
-			array(
585
-				'name'    => __( 'Disable All Stats', 'lsx-health-plan' ),
586
-				'desc'    => 'Disable All Stats',
587
-				'id'      => 'disable_all_stats',
588
-				'type'    => 'checkbox',
589
-				'value'   => 1,
590
-				'default' => 0,
591
-			)
592
-		);
593
-		$cmb->add_field(
594
-			array(
595
-				'name'    => __( 'Disable Weight', 'lsx-health-plan' ),
596
-				'id'      => 'disable_weight_checkbox',
597
-				'type'    => 'checkbox',
598
-				'value'   => 1,
599
-				'default' => 0,
600
-			)
601
-		);
602
-		$cmb->add_field(
603
-			array(
604
-				'name'    => __( 'Disable Height', 'lsx-health-plan' ),
605
-				'id'      => 'disable_height_checkbox',
606
-				'type'    => 'checkbox',
607
-				'value'   => 1,
608
-				'default' => 0,
609
-			)
610
-		);
611
-		$cmb->add_field(
612
-			array(
613
-				'name'    => __( 'Disable Waist', 'lsx-health-plan' ),
614
-				'id'      => 'disable_waist_checkbox',
615
-				'type'    => 'checkbox',
616
-				'value'   => 1,
617
-				'default' => 0,
618
-			)
619
-		);
620
-		$cmb->add_field(
621
-			array(
622
-				'name'    => __( 'Disable BMI', 'lsx-health-plan' ),
623
-				'id'      => 'disable_bmi_checkbox',
624
-				'type'    => 'checkbox',
625
-				'value'   => 1,
626
-				'default' => 0,
627
-			)
628
-		);
629
-		$cmb->add_field(
630
-			array(
631
-				'id'   => 'settings_stat_disable_closing',
632
-				'type' => 'tab_closing',
633
-			)
634
-		);
635
-	}
636
-
637
-	/**
638
-	 * Enable Business Directory Search settings only if LSX Search plugin is enabled.
639
-	 *
640
-	 * @param object $cmb The CMB2() class.
641
-	 * @param string $section either engine,archive or single.
642
-	 * @return void
643
-	 */
644
-	public function generate_tabs( $cmb ) {
645
-		$tabs = $this->get_settings_tabs();
646
-
647
-		foreach ( $tabs as $tab_key => $tab ) {
648
-			$cmb->add_field(
649
-				array(
650
-					'id'          => 'settings_' . $tab_key . '_title',
651
-					'type'        => 'title',
652
-					'name'        => $tab['title'],
653
-					'default'     => $tab['title'],
654
-					'description' => $tab['desc'],
655
-				)
656
-			);
657
-			do_action( 'lsx_hp_settings_page_' . $tab_key . '_top', $cmb );
658
-
659
-			do_action( 'lsx_hp_settings_page_' . $tab_key . '_middle', $cmb );
660
-
661
-			do_action( 'lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb );
662
-
663
-			$cmb->add_field(
664
-				array(
665
-					'id'   => 'settings_' . $tab_key . '_closing',
666
-					'type' => 'tab_closing',
667
-				)
668
-			);
669
-		}
670
-	}
671
-
672
-
673
-	/**
674
-	 * Returns the tabs and their descriptions.
675
-	 *
676
-	 * @return array
677
-	 */
678
-	public function get_settings_tabs() {
679
-		$tabs = array(
680
-			'general' => array(
681
-				'title' => __( 'General', 'lsx-health-plan' ),
682
-				'desc'  => __( 'Control the sitewide settings for the LSX HP site.', 'lsx-health-plan' ),
683
-			),
684
-		);
685
-
686
-		foreach ( $this->post_types as $post_type ) {
687
-			switch ( $post_type ) {
688
-				default:
689
-					//if ( ! in_array( $post_type, \lsx\search\includes\get_restricted_post_types() ) ) {
690
-						$temp_post_type = get_post_type_object( $post_type );
691
-						if ( ! is_wp_error( $temp_post_type ) ) {
692
-							$page_url    = get_post_type_archive_link( $temp_post_type->name );
693
-							$description = sprintf(
694
-								/* translators: %s: The subscription info */
695
-								__( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ),
696
-								$page_url,
697
-								$temp_post_type->label
698
-							);
699
-
700
-							$tabs[ $post_type ] = array(
701
-								'title' => $temp_post_type->label,
702
-								'desc'  => $description,
703
-							);
704
-						}
705
-					//}
706
-					break;
707
-			}
708
-		}
709
-		return $tabs;
710
-	}
15
+     /**
16
+      * Holds class instance
17
+      *
18
+      * @since 1.0.0
19
+      *
20
+      * @var      object \lsx_health_plan\classes\admin\Settings()
21
+      */
22
+     protected static $instance = null;
23
+
24
+     /**
25
+      * Option key, and option page slug
26
+      *
27
+      * @var string
28
+      */
29
+     protected $screen_id = 'lsx_health_plan_settings';
30
+
31
+     /**
32
+      * An array of the post types for the Global Downloads field.
33
+      *
34
+      * @var array
35
+      */
36
+     public $download_types = array();
37
+
38
+     /**
39
+      * An array of the post types for the Global Defaults field.
40
+      *
41
+      * @var array
42
+      */
43
+     public $default_types = array();
44
+
45
+     /**
46
+      * An array of the endpoints for the Endpoint Translation field.
47
+      *
48
+      * @var array
49
+      */
50
+     public $endpoints = array();
51
+
52
+     /**
53
+      * Constructor
54
+      */
55
+     public function __construct() {
56
+          $this->load_classes();
57
+          add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) );
58
+          add_action( 'lsx_hp_settings_page', array( $this, 'generate_tabs' ), 1, 1 );
59
+
60
+          add_action( 'lsx_hp_settings_page_general_top', array( $this, 'general_settings' ), 1, 1 );
61
+          add_action( 'lsx_hp_settings_page', array( $this, 'global_defaults' ), 3, 1 );
62
+          add_action( 'lsx_hp_settings_page', array( $this, 'global_downloads' ), 5, 1 );
63
+          add_action( 'lsx_hp_settings_page', array( $this, 'stat_disable' ), 6, 1 );
64
+          add_action( 'lsx_hp_settings_page', array( $this, 'endpoint_translations' ), 7, 1 );
65
+          add_action( 'lsx_hp_settings_page', array( $this, 'exercise_translations' ), 7, 1 );
66
+          add_action( 'lsx_hp_settings_page', array( $this, 'post_type_toggles' ), 9, 1 );
67
+     }
68
+
69
+     /**
70
+      * Return an instance of this class.
71
+      *
72
+      * @since 1.0.0
73
+      *
74
+      * @return    object \lsx_health_plan\classes\admin\Settings()    A single instance of this class.
75
+      */
76
+     public static function get_instance() {
77
+          // If the single instance hasn't been set, set it now.
78
+          if ( null === self::$instance ) {
79
+               self::$instance = new self();
80
+          }
81
+          return self::$instance;
82
+     }
83
+
84
+     /**
85
+      * Loads the variable classes and the static classes.
86
+      */
87
+     private function load_classes() {
88
+
89
+          $this->post_types = array(
90
+               'plan',
91
+               'workout',
92
+               'exercise',
93
+               //'meal',
94
+               'recipe',
95
+               //'tip',
96
+          );
97
+
98
+          foreach ( $this->post_types as $post_type ) {
99
+               $this->$post_type = require_once LSX_HEALTH_PLAN_PATH . 'classes/admin/settings/class-' . $post_type . '.php';
100
+          }
101
+     }
102
+
103
+     /**
104
+      * Sets the variables needed for the fields.
105
+      *
106
+      * @return void
107
+      */
108
+     public function set_vars() {
109
+
110
+          $this->default_types  = array(
111
+               'page' => array(
112
+                    'title'       => __( 'Warm Up', 'lsx-health-plan' ),
113
+                    'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
114
+                    'limit'       => 1,
115
+                    'id'          => 'plan_warmup',
116
+               ),
117
+          );
118
+          $this->download_types = array(
119
+               'page' => array(
120
+                    'title'       => __( 'Warm Up', 'lsx-health-plan' ),
121
+                    'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
122
+                    'limit'       => 1,
123
+               ),
124
+          );
125
+          $this->endpoints      = array(
126
+               'endpoint_warm_up' => array(
127
+                    'title'       => __( 'Warm Up Endpoint', 'lsx-health-plan' ),
128
+                    'default'     => 'warm-up',
129
+               ),
130
+          );
131
+
132
+          if ( post_type_exists( 'meal' ) ) {
133
+               $this->download_types['meal']     = array(
134
+                    'title'       => __( 'Meal Plan', 'lsx-health-plan' ),
135
+                    'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ),
136
+               );
137
+               $this->default_types['meal']      = array(
138
+                    'title'       => __( 'Meal Plan', 'lsx-health-plan' ),
139
+                    'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ),
140
+                    'id'          => 'connected_meals',
141
+               );
142
+               $this->endpoints['endpoint_meal'] = array(
143
+                    'title'       => __( 'Meal Endpoint', 'lsx-health-plan' ),
144
+                    'default'     => 'meal',
145
+                    'description' => __( 'Define the tab slug which shows on the single plan page.', 'lsx-health-plan' ),
146
+               );
147
+               $this->endpoints['endpoint_meal_archive'] = array(
148
+                    'title'   => __( 'Meals Archive Endpoint', 'lsx-health-plan' ),
149
+                    'default' => 'meals',
150
+               );
151
+               $this->endpoints['meal_single_slug'] = array(
152
+                    'title'   => __( 'Single Meal Slug', 'lsx-health-plan' ),
153
+                    'default' => 'meal',
154
+               );
155
+          }
156
+          if ( post_type_exists( 'recipe' ) ) {
157
+               $this->download_types['recipe'] = array(
158
+                    'title'       => __( 'Recipe', 'lsx-health-plan' ),
159
+                    'description' => __( 'Set a default recipe.', 'lsx-health-plan' ),
160
+               );
161
+               $this->default_types['recipe'] = array(
162
+                    'title'       => __( 'Recipe', 'lsx-health-plan' ),
163
+                    'description' => __( 'Set a default recipe.', 'lsx-health-plan' ),
164
+                    'id'          => 'connected_recipes',
165
+               );
166
+               $this->endpoints['endpoint_recipe'] = array(
167
+                    'title'   => __( 'Recipes Endpoint', 'lsx-health-plan' ),
168
+                    'default' => 'recipe',
169
+               );
170
+          }
171
+          if ( post_type_exists( 'workout' ) ) {
172
+               $this->download_types['workout'] = array(
173
+                    'title'       => __( 'Workout', 'lsx-health-plan' ),
174
+                    'description' => __( 'Set a default workout routine PDF.', 'lsx-health-plan' ),
175
+               );
176
+               $this->default_types['workout'] = array(
177
+                    'title'       => __( 'Workout', 'lsx-health-plan' ),
178
+                    'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ),
179
+                    'id'          => 'connected_workouts',
180
+               );
181
+               $this->endpoints['endpoint_workout_archive'] = array(
182
+                    'title'   => __( 'Workouts Archive Endpoint', 'lsx-health-plan' ),
183
+                    'default' => '',
184
+               );
185
+               $this->endpoints['endpoint_workout'] = array(
186
+                    'title'   => __( 'Single Workout Endpoint', 'lsx-health-plan' ),
187
+                    'default' => 'workout',
188
+               );
189
+          }
190
+
191
+          $this->endpoints['login_slug'] = array(
192
+               'title'   => __( 'Login Slug', 'lsx-health-plan' ),
193
+               'default' => 'login',
194
+          );
195
+          $this->endpoints['my_plan_slug'] = array(
196
+               'title'   => __( 'My Plan Slug', 'lsx-health-plan' ),
197
+               'default' => 'my-plan',
198
+          );
199
+          $this->endpoints['plan_single_slug'] = array(
200
+               'title'   => __( 'Single Plan Slug', 'lsx-health-plan' ),
201
+               'default' => 'plan',
202
+          );
203
+          $this->endpoints['endpoint_plan_archive'] = array(
204
+               'title'   => __( 'Plans Archive Endpoint', 'lsx-health-plan' ),
205
+               'default' => 'plans',
206
+          );
207
+
208
+          if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
209
+               $this->endpoints['exercise'] = array(
210
+                    'exercise_single' => array(
211
+                         'title'   => __( 'Single Exercise Slug', 'lsx-health-plan' ),
212
+                         'default' => 'exercise',
213
+                    ),
214
+                    'exercise_archive' => array(
215
+                         'title'   => __( 'Archive Exercise Slug', 'lsx-health-plan' ),
216
+                         'default' => 'exercises',
217
+                    ),
218
+                    'exercise_type' => array(
219
+                         'title'   => __( 'Exercise Type Slug', 'lsx-health-plan' ),
220
+                         'default' => 'exercise-type',
221
+                    ),
222
+                    'exercise_equipment' => array(
223
+                         'title'   => __( 'Equipment Slug', 'lsx-health-plan' ),
224
+                         'default' => 'equipment',
225
+                    ),
226
+                    'exercise_musclegroup' => array(
227
+                         'title'   => __( 'Muscle Group Slug', 'lsx-health-plan' ),
228
+                         'default' => 'muscle-group',
229
+                    ),
230
+               );
231
+          }
232
+     }
233
+
234
+     /**
235
+      * Hook in and register a submenu options page for the Page post-type menu.
236
+      */
237
+     public function register_settings_page() {
238
+          $this->set_vars();
239
+          $cmb = new_cmb2_box(
240
+               array(
241
+                    'id'           => $this->screen_id,
242
+                    'title'        => esc_html__( 'Settings', 'lsx-health-plan' ),
243
+                    'object_types' => array( 'options-page' ),
244
+                    'option_key'   => 'lsx_health_plan_options', // The option key and admin menu page slug.
245
+                    'parent_slug'  => 'edit.php?post_type=plan', // Make options page a submenu item of the themes menu.
246
+                    'capability'   => 'manage_options', // Cap required to view options-page.
247
+               )
248
+          );
249
+          do_action( 'lsx_hp_settings_page', $cmb );
250
+     }
251
+
252
+     /**
253
+      * Registers the general settings.
254
+      *
255
+      * @param object $cmb new_cmb2_box().
256
+      * @return void
257
+      */
258
+     public function general_settings( $cmb ) {
259
+          $cmb->add_field(
260
+               array(
261
+                    'name'       => __( 'Membership Product', 'lsx-health-plan' ),
262
+                    'id'         => 'membership_product',
263
+                    'type'       => 'post_search_ajax',
264
+                    'limit'      => 1,
265
+                    'sortable'   => false,
266
+                    'query_args' => array(
267
+                         'post_type'      => array( 'product' ),
268
+                         'post_status'    => array( 'publish' ),
269
+                         'posts_per_page' => -1,
270
+                    ),
271
+               )
272
+          );
273
+
274
+          $cmb->add_field(
275
+               array(
276
+                    'name'    => __( 'Your Warm-up Intro', 'lsx-health-plan' ),
277
+                    'id'      => 'warmup_intro',
278
+                    'type'    => 'textarea_small',
279
+                    'value'   => '',
280
+                    'default' => __( "Don't forget your warm-up! It's a vital part of your daily workout routine.", 'lsx-health-plan' ),
281
+               )
282
+          );
283
+          if ( post_type_exists( 'workout' ) ) {
284
+               $cmb->add_field(
285
+                    array(
286
+                         'name'    => __( 'Your Workout Intro', 'lsx-health-plan' ),
287
+                         'id'      => 'workout_intro',
288
+                         'type'    => 'textarea_small',
289
+                         'value'   => '',
290
+                         'default' => __( "Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan' ),
291
+                    )
292
+               );
293
+          }
294
+          if ( post_type_exists( 'meal' ) ) {
295
+               $cmb->add_field(
296
+                    array(
297
+                         'name'    => __( 'Your Meal Plan Intro', 'lsx-health-plan' ),
298
+                         'id'      => 'meal_plan_intro',
299
+                         'type'    => 'textarea_small',
300
+                         'value'   => '',
301
+                         'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ),
302
+                    )
303
+               );
304
+          }
305
+          if ( post_type_exists( 'recipe' ) ) {
306
+               $cmb->add_field(
307
+                    array(
308
+                         'name'    => __( 'Recipes Intro', 'lsx-health-plan' ),
309
+                         'id'      => 'recipes_intro',
310
+                         'type'    => 'textarea_small',
311
+                         'value'   => '',
312
+                         'default' => __( "Let's get cooking! Delicious and easy to follow recipes.", 'lsx-health-plan' ),
313
+                    )
314
+               );
315
+          }
316
+     }
317
+
318
+     /**
319
+      * Registers the global default settings.
320
+      *
321
+      * @param object $cmb new_cmb2_box().
322
+      * @return void
323
+      */
324
+     public function global_defaults( $cmb ) {
325
+          $cmb->add_field(
326
+               array(
327
+                    'id'      => 'global_defaults_title',
328
+                    'type'    => 'title',
329
+                    'name'    => __( 'Global Defaults', 'lsx-health-plan' ),
330
+                    'default' => __( 'Global Defaults', 'lsx-health-plan' ),
331
+                    'description' => __( 'If you have not connected a specific post to your day plan, set a default option below.', 'lsx-health-plan' ),
332
+               )
333
+          );
334
+
335
+          foreach ( $this->default_types as $type => $default_type ) {
336
+               $limit    = 5;
337
+               $sortable = false;
338
+               if ( isset( $default_type['limit'] ) ) {
339
+                    $limit    = $default_type['limit'];
340
+                    $sortable = true;
341
+               }
342
+
343
+               if ( 'page' === $type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
344
+                    $type = array( 'page', 'workout' );
345
+               }
346
+
347
+               $cmb->add_field(
348
+                    array(
349
+                         'name'       => $default_type['title'],
350
+                         'desc'       => $default_type['description'],
351
+                         'id'         => $default_type['id'],
352
+                         'type'       => 'post_search_ajax',
353
+                         'limit'      => $limit,
354
+                         'sortable'   => $sortable,
355
+                         'query_args' => array(
356
+                              'post_type'      => $type,
357
+                              'post_status'    => array( 'publish' ),
358
+                              'posts_per_page' => -1,
359
+                         ),
360
+                    )
361
+               );
362
+          }
363
+
364
+          $cmb->add_field(
365
+               array(
366
+                    'id'   => 'settings_global_defaults_closing',
367
+                    'type' => 'tab_closing',
368
+               )
369
+          );
370
+     }
371
+
372
+     /**
373
+      * Registers the global dowloads settings
374
+      *
375
+      * @param object $cmb new_cmb2_box().
376
+      * @return void
377
+      */
378
+     public function global_downloads( $cmb ) {
379
+          $cmb->add_field(
380
+               array(
381
+                    'id'          => 'global_downloads_title',
382
+                    'type'        => 'title',
383
+                    'name'        => __( 'Global Downloads', 'lsx-health-plan' ),
384
+                    'default'     => __( 'Global Downloads', 'lsx-health-plan' ),
385
+                    'description' => __( 'If you have not connected a specific download file to your plans, set a default option below', 'lsx-health-plan' ),
386
+               )
387
+          );
388
+
389
+          foreach ( $this->download_types as $type => $download_type ) {
390
+               $limit    = 5;
391
+               $sortable = false;
392
+               if ( isset( $download_type['limit'] ) ) {
393
+                    $limit    = $download_type['limit'];
394
+                    $sortable = true;
395
+               }
396
+
397
+               $cmb->add_field(
398
+                    array(
399
+                         'name'       => $download_type['title'],
400
+                         'id'         => 'download_' . $type,
401
+                         'type'       => 'post_search_ajax',
402
+                         'limit'      => $limit,
403
+                         'sortable'   => $sortable,
404
+                         'query_args' => array(
405
+                              'post_type'      => array( 'dlm_download' ),
406
+                              'post_status'    => array( 'publish' ),
407
+                              'posts_per_page' => -1,
408
+                         ),
409
+                    )
410
+               );
411
+          }
412
+          $cmb->add_field(
413
+               array(
414
+                    'id'   => 'settings_global_downloads_closing',
415
+                    'type' => 'tab_closing',
416
+               )
417
+          );
418
+     }
419
+
420
+     /**
421
+      * Registers the endpoint translation settings.
422
+      *
423
+      * @param object $cmb new_cmb2_box().
424
+      * @return void
425
+      */
426
+     public function endpoint_translations( $cmb ) {
427
+          $cmb->add_field(
428
+               array(
429
+                    'id'          => 'endpoints_title',
430
+                    'type'        => 'title',
431
+                    'name'        => __( 'Set Endpoint Translations', 'lsx-health-plan' ),
432
+                    'default'     => __( 'Set Endpoint Translations', 'lsx-health-plan' ),
433
+               )
434
+          );
435
+          foreach ( $this->endpoints as $slug => $endpoint_vars ) {
436
+               if ( 'exercise' === $slug ) {
437
+                    continue;
438
+               }
439
+
440
+               $cmb->add_field(
441
+                    array(
442
+                         'name'    => $endpoint_vars['title'],
443
+                         'id'      => $slug,
444
+                         'type'    => 'input',
445
+                         'value'   => '',
446
+                         'default' => $endpoint_vars['default'],
447
+                    )
448
+               );
449
+          }
450
+          $cmb->add_field(
451
+               array(
452
+                    'id'   => 'settings_endpoints_closing',
453
+                    'type' => 'tab_closing',
454
+                    'before_row'    => '<p style="margin-top:20px; font-style: italic;">Endpoint is a web address (URL) at which the user can gain access to it. You need to resave your permalinks after changing the endpoint settings.</p>',
455
+               )
456
+          );
457
+     }
458
+
459
+     /**
460
+      * Registers the endpoint translation settings.
461
+      *
462
+      * @param object $cmb new_cmb2_box().
463
+      * @return void
464
+      */
465
+     public function exercise_translations( $cmb ) {
466
+          if ( isset( $this->endpoints['exercise'] ) && '' !== $this->endpoints['exercise'] && ! empty( $this->endpoints['exercise'] ) ) {
467
+               $cmb->add_field(
468
+                    array(
469
+                         'id'          => 'exercise_endpoints_title',
470
+                         'type'        => 'title',
471
+                         'name'        => __( 'Set Exercise Translations', 'lsx-health-plan' ),
472
+                         'default'     => __( 'Set Exercise Translations', 'lsx-health-plan' ),
473
+                         'description' => __( 'Change the exercise endpoints.', 'lsx-health-plan' ),
474
+                    )
475
+               );
476
+
477
+               foreach ( $this->endpoints['exercise'] as $slug => $endpoint_vars ) {
478
+                    $cmb->add_field(
479
+                         array(
480
+                              'name'    => $endpoint_vars['title'],
481
+                              'id'      => 'endpoint_' . $slug,
482
+                              'type'    => 'input',
483
+                              'value'   => '',
484
+                              'default' => $endpoint_vars['default'],
485
+                         )
486
+                    );
487
+               }
488
+
489
+               $cmb->add_field(
490
+                    array(
491
+                         'id'   => 'settings_exercise_closing',
492
+                         'type' => 'tab_closing',
493
+                         'before_row'    => '<p style="margin-top:20px; font-style: italic;">If you need to translate the exercise URL endpoints, do so below.</p>',
494
+                    )
495
+               );
496
+          }
497
+     }
498
+
499
+     /**
500
+      * Registers the post type toggle settings
501
+      *
502
+      * @param object $cmb new_cmb2_box().
503
+      * @return void
504
+      */
505
+     public function post_type_toggles( $cmb ) {
506
+          $post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) );
507
+
508
+          $cmb->add_field(
509
+               array(
510
+                    'id'          => 'post_type_toggles_title',
511
+                    'type'        => 'title',
512
+                    'name'        => __( 'Disable Post Types', 'lsx-health-plan' ),
513
+                    'default'     => __( 'Disable Post Types', 'lsx-health-plan' ),
514
+                    'description' => __( 'Disable post types if you are wanting a minimal site.', 'lsx-health-plan' ),
515
+               )
516
+          );
517
+
518
+          foreach ( $post_types as $post_type ) {
519
+               if ( 'plan' === $post_type || 'exercise' === $post_type || ( 'video' === $post_type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) ) {
520
+                    continue;
521
+               }
522
+
523
+               $cmb->add_field(
524
+                    array(
525
+                         'name'    => ucwords( $post_type ),
526
+                         'id'      => $post_type . '_disabled',
527
+                         'type'    => 'checkbox',
528
+                         'value'   => 1,
529
+                         'default' => 0,
530
+                    )
531
+               );
532
+          }
533
+
534
+          $cmb->add_field(
535
+               array(
536
+                    'id'   => 'settings_post_type_toggles_closing',
537
+                    'type' => 'tab_closing',
538
+               )
539
+          );
540
+
541
+          $cmb->add_field(
542
+               array(
543
+                    'id'          => 'post_type_toggles_enable_title',
544
+                    'type'        => 'title',
545
+                    'name'        => __( 'Enable Post Types', 'lsx-health-plan' ),
546
+                    'default'     => __( 'Enable Post Types', 'lsx-health-plan' ),
547
+                    'description' => __( 'Enable new functionality like the "exercise" post type.', 'lsx-health-plan' ),
548
+               )
549
+          );
550
+          $cmb->add_field(
551
+               array(
552
+                    'name'        => __( 'Exercises', 'lsx-health-plan' ),
553
+                    'id'          => 'exercise_enabled',
554
+                    'type'        => 'checkbox',
555
+                    'value'       => 1,
556
+                    'default'     => 0,
557
+                    'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ),
558
+               )
559
+          );
560
+          $cmb->add_field(
561
+               array(
562
+                    'id'   => 'settings_post_type_toggles_enable_closing',
563
+                    'type' => 'tab_closing',
564
+               )
565
+          );
566
+     }
567
+     /**
568
+      * Registers the Profile Stat Toggle settings
569
+      *
570
+      * @param object $cmb new_cmb2_box().
571
+      * @return void
572
+      */
573
+
574
+     public function stat_disable( $cmb ) {
575
+          $cmb->add_field(
576
+               array(
577
+                    'id'      => 'stat_disable_title',
578
+                    'type'    => 'title',
579
+                    'name'    => __( 'Disable Profile Stats', 'lsx-health-plan' ),
580
+                    'default' => __( 'Disable Profile Stats', 'lsx-health-plan' ),
581
+               )
582
+          );
583
+          $cmb->add_field(
584
+               array(
585
+                    'name'    => __( 'Disable All Stats', 'lsx-health-plan' ),
586
+                    'desc'    => 'Disable All Stats',
587
+                    'id'      => 'disable_all_stats',
588
+                    'type'    => 'checkbox',
589
+                    'value'   => 1,
590
+                    'default' => 0,
591
+               )
592
+          );
593
+          $cmb->add_field(
594
+               array(
595
+                    'name'    => __( 'Disable Weight', 'lsx-health-plan' ),
596
+                    'id'      => 'disable_weight_checkbox',
597
+                    'type'    => 'checkbox',
598
+                    'value'   => 1,
599
+                    'default' => 0,
600
+               )
601
+          );
602
+          $cmb->add_field(
603
+               array(
604
+                    'name'    => __( 'Disable Height', 'lsx-health-plan' ),
605
+                    'id'      => 'disable_height_checkbox',
606
+                    'type'    => 'checkbox',
607
+                    'value'   => 1,
608
+                    'default' => 0,
609
+               )
610
+          );
611
+          $cmb->add_field(
612
+               array(
613
+                    'name'    => __( 'Disable Waist', 'lsx-health-plan' ),
614
+                    'id'      => 'disable_waist_checkbox',
615
+                    'type'    => 'checkbox',
616
+                    'value'   => 1,
617
+                    'default' => 0,
618
+               )
619
+          );
620
+          $cmb->add_field(
621
+               array(
622
+                    'name'    => __( 'Disable BMI', 'lsx-health-plan' ),
623
+                    'id'      => 'disable_bmi_checkbox',
624
+                    'type'    => 'checkbox',
625
+                    'value'   => 1,
626
+                    'default' => 0,
627
+               )
628
+          );
629
+          $cmb->add_field(
630
+               array(
631
+                    'id'   => 'settings_stat_disable_closing',
632
+                    'type' => 'tab_closing',
633
+               )
634
+          );
635
+     }
636
+
637
+     /**
638
+      * Enable Business Directory Search settings only if LSX Search plugin is enabled.
639
+      *
640
+      * @param object $cmb The CMB2() class.
641
+      * @param string $section either engine,archive or single.
642
+      * @return void
643
+      */
644
+     public function generate_tabs( $cmb ) {
645
+          $tabs = $this->get_settings_tabs();
646
+
647
+          foreach ( $tabs as $tab_key => $tab ) {
648
+               $cmb->add_field(
649
+                    array(
650
+                         'id'          => 'settings_' . $tab_key . '_title',
651
+                         'type'        => 'title',
652
+                         'name'        => $tab['title'],
653
+                         'default'     => $tab['title'],
654
+                         'description' => $tab['desc'],
655
+                    )
656
+               );
657
+               do_action( 'lsx_hp_settings_page_' . $tab_key . '_top', $cmb );
658
+
659
+               do_action( 'lsx_hp_settings_page_' . $tab_key . '_middle', $cmb );
660
+
661
+               do_action( 'lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb );
662
+
663
+               $cmb->add_field(
664
+                    array(
665
+                         'id'   => 'settings_' . $tab_key . '_closing',
666
+                         'type' => 'tab_closing',
667
+                    )
668
+               );
669
+          }
670
+     }
671
+
672
+
673
+     /**
674
+      * Returns the tabs and their descriptions.
675
+      *
676
+      * @return array
677
+      */
678
+     public function get_settings_tabs() {
679
+          $tabs = array(
680
+               'general' => array(
681
+                    'title' => __( 'General', 'lsx-health-plan' ),
682
+                    'desc'  => __( 'Control the sitewide settings for the LSX HP site.', 'lsx-health-plan' ),
683
+               ),
684
+          );
685
+
686
+          foreach ( $this->post_types as $post_type ) {
687
+               switch ( $post_type ) {
688
+                    default:
689
+                         //if ( ! in_array( $post_type, \lsx\search\includes\get_restricted_post_types() ) ) {
690
+                              $temp_post_type = get_post_type_object( $post_type );
691
+                              if ( ! is_wp_error( $temp_post_type ) ) {
692
+                                   $page_url    = get_post_type_archive_link( $temp_post_type->name );
693
+                                   $description = sprintf(
694
+                                        /* translators: %s: The subscription info */
695
+                                        __( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ),
696
+                                        $page_url,
697
+                                        $temp_post_type->label
698
+                                   );
699
+
700
+                                   $tabs[ $post_type ] = array(
701
+                                        'title' => $temp_post_type->label,
702
+                                        'desc'  => $description,
703
+                                   );
704
+                              }
705
+                         //}
706
+                         break;
707
+               }
708
+          }
709
+          return $tabs;
710
+     }
711 711
 }
Please login to merge, or discard this patch.
Spacing   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function __construct() {
56 56
 		$this->load_classes();
57
-		add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) );
58
-		add_action( 'lsx_hp_settings_page', array( $this, 'generate_tabs' ), 1, 1 );
59
-
60
-		add_action( 'lsx_hp_settings_page_general_top', array( $this, 'general_settings' ), 1, 1 );
61
-		add_action( 'lsx_hp_settings_page', array( $this, 'global_defaults' ), 3, 1 );
62
-		add_action( 'lsx_hp_settings_page', array( $this, 'global_downloads' ), 5, 1 );
63
-		add_action( 'lsx_hp_settings_page', array( $this, 'stat_disable' ), 6, 1 );
64
-		add_action( 'lsx_hp_settings_page', array( $this, 'endpoint_translations' ), 7, 1 );
65
-		add_action( 'lsx_hp_settings_page', array( $this, 'exercise_translations' ), 7, 1 );
66
-		add_action( 'lsx_hp_settings_page', array( $this, 'post_type_toggles' ), 9, 1 );
57
+		add_action('cmb2_admin_init', array($this, 'register_settings_page'));
58
+		add_action('lsx_hp_settings_page', array($this, 'generate_tabs'), 1, 1);
59
+
60
+		add_action('lsx_hp_settings_page_general_top', array($this, 'general_settings'), 1, 1);
61
+		add_action('lsx_hp_settings_page', array($this, 'global_defaults'), 3, 1);
62
+		add_action('lsx_hp_settings_page', array($this, 'global_downloads'), 5, 1);
63
+		add_action('lsx_hp_settings_page', array($this, 'stat_disable'), 6, 1);
64
+		add_action('lsx_hp_settings_page', array($this, 'endpoint_translations'), 7, 1);
65
+		add_action('lsx_hp_settings_page', array($this, 'exercise_translations'), 7, 1);
66
+		add_action('lsx_hp_settings_page', array($this, 'post_type_toggles'), 9, 1);
67 67
 	}
68 68
 
69 69
 	/**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public static function get_instance() {
77 77
 		// If the single instance hasn't been set, set it now.
78
-		if ( null === self::$instance ) {
78
+		if (null === self::$instance) {
79 79
 			self::$instance = new self();
80 80
 		}
81 81
 		return self::$instance;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 			//'tip',
96 96
 		);
97 97
 
98
-		foreach ( $this->post_types as $post_type ) {
98
+		foreach ($this->post_types as $post_type) {
99 99
 			$this->$post_type = require_once LSX_HEALTH_PLAN_PATH . 'classes/admin/settings/class-' . $post_type . '.php';
100 100
 		}
101 101
 	}
@@ -107,124 +107,124 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function set_vars() {
109 109
 
110
-		$this->default_types  = array(
110
+		$this->default_types = array(
111 111
 			'page' => array(
112
-				'title'       => __( 'Warm Up', 'lsx-health-plan' ),
113
-				'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
112
+				'title'       => __('Warm Up', 'lsx-health-plan'),
113
+				'description' => __('Set a default warm up routine.', 'lsx-health-plan'),
114 114
 				'limit'       => 1,
115 115
 				'id'          => 'plan_warmup',
116 116
 			),
117 117
 		);
118 118
 		$this->download_types = array(
119 119
 			'page' => array(
120
-				'title'       => __( 'Warm Up', 'lsx-health-plan' ),
121
-				'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
120
+				'title'       => __('Warm Up', 'lsx-health-plan'),
121
+				'description' => __('Set a default warm up routine.', 'lsx-health-plan'),
122 122
 				'limit'       => 1,
123 123
 			),
124 124
 		);
125
-		$this->endpoints      = array(
125
+		$this->endpoints = array(
126 126
 			'endpoint_warm_up' => array(
127
-				'title'       => __( 'Warm Up Endpoint', 'lsx-health-plan' ),
127
+				'title'       => __('Warm Up Endpoint', 'lsx-health-plan'),
128 128
 				'default'     => 'warm-up',
129 129
 			),
130 130
 		);
131 131
 
132
-		if ( post_type_exists( 'meal' ) ) {
133
-			$this->download_types['meal']     = array(
134
-				'title'       => __( 'Meal Plan', 'lsx-health-plan' ),
135
-				'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ),
132
+		if (post_type_exists('meal')) {
133
+			$this->download_types['meal'] = array(
134
+				'title'       => __('Meal Plan', 'lsx-health-plan'),
135
+				'description' => __('Set a default meal plan.', 'lsx-health-plan'),
136 136
 			);
137
-			$this->default_types['meal']      = array(
138
-				'title'       => __( 'Meal Plan', 'lsx-health-plan' ),
139
-				'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ),
137
+			$this->default_types['meal'] = array(
138
+				'title'       => __('Meal Plan', 'lsx-health-plan'),
139
+				'description' => __('Set a default meal plan.', 'lsx-health-plan'),
140 140
 				'id'          => 'connected_meals',
141 141
 			);
142 142
 			$this->endpoints['endpoint_meal'] = array(
143
-				'title'       => __( 'Meal Endpoint', 'lsx-health-plan' ),
143
+				'title'       => __('Meal Endpoint', 'lsx-health-plan'),
144 144
 				'default'     => 'meal',
145
-				'description' => __( 'Define the tab slug which shows on the single plan page.', 'lsx-health-plan' ),
145
+				'description' => __('Define the tab slug which shows on the single plan page.', 'lsx-health-plan'),
146 146
 			);
147 147
 			$this->endpoints['endpoint_meal_archive'] = array(
148
-				'title'   => __( 'Meals Archive Endpoint', 'lsx-health-plan' ),
148
+				'title'   => __('Meals Archive Endpoint', 'lsx-health-plan'),
149 149
 				'default' => 'meals',
150 150
 			);
151 151
 			$this->endpoints['meal_single_slug'] = array(
152
-				'title'   => __( 'Single Meal Slug', 'lsx-health-plan' ),
152
+				'title'   => __('Single Meal Slug', 'lsx-health-plan'),
153 153
 				'default' => 'meal',
154 154
 			);
155 155
 		}
156
-		if ( post_type_exists( 'recipe' ) ) {
156
+		if (post_type_exists('recipe')) {
157 157
 			$this->download_types['recipe'] = array(
158
-				'title'       => __( 'Recipe', 'lsx-health-plan' ),
159
-				'description' => __( 'Set a default recipe.', 'lsx-health-plan' ),
158
+				'title'       => __('Recipe', 'lsx-health-plan'),
159
+				'description' => __('Set a default recipe.', 'lsx-health-plan'),
160 160
 			);
161 161
 			$this->default_types['recipe'] = array(
162
-				'title'       => __( 'Recipe', 'lsx-health-plan' ),
163
-				'description' => __( 'Set a default recipe.', 'lsx-health-plan' ),
162
+				'title'       => __('Recipe', 'lsx-health-plan'),
163
+				'description' => __('Set a default recipe.', 'lsx-health-plan'),
164 164
 				'id'          => 'connected_recipes',
165 165
 			);
166 166
 			$this->endpoints['endpoint_recipe'] = array(
167
-				'title'   => __( 'Recipes Endpoint', 'lsx-health-plan' ),
167
+				'title'   => __('Recipes Endpoint', 'lsx-health-plan'),
168 168
 				'default' => 'recipe',
169 169
 			);
170 170
 		}
171
-		if ( post_type_exists( 'workout' ) ) {
171
+		if (post_type_exists('workout')) {
172 172
 			$this->download_types['workout'] = array(
173
-				'title'       => __( 'Workout', 'lsx-health-plan' ),
174
-				'description' => __( 'Set a default workout routine PDF.', 'lsx-health-plan' ),
173
+				'title'       => __('Workout', 'lsx-health-plan'),
174
+				'description' => __('Set a default workout routine PDF.', 'lsx-health-plan'),
175 175
 			);
176 176
 			$this->default_types['workout'] = array(
177
-				'title'       => __( 'Workout', 'lsx-health-plan' ),
178
-				'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ),
177
+				'title'       => __('Workout', 'lsx-health-plan'),
178
+				'description' => __('Set a default workout routine.', 'lsx-health-plan'),
179 179
 				'id'          => 'connected_workouts',
180 180
 			);
181 181
 			$this->endpoints['endpoint_workout_archive'] = array(
182
-				'title'   => __( 'Workouts Archive Endpoint', 'lsx-health-plan' ),
182
+				'title'   => __('Workouts Archive Endpoint', 'lsx-health-plan'),
183 183
 				'default' => '',
184 184
 			);
185 185
 			$this->endpoints['endpoint_workout'] = array(
186
-				'title'   => __( 'Single Workout Endpoint', 'lsx-health-plan' ),
186
+				'title'   => __('Single Workout Endpoint', 'lsx-health-plan'),
187 187
 				'default' => 'workout',
188 188
 			);
189 189
 		}
190 190
 
191 191
 		$this->endpoints['login_slug'] = array(
192
-			'title'   => __( 'Login Slug', 'lsx-health-plan' ),
192
+			'title'   => __('Login Slug', 'lsx-health-plan'),
193 193
 			'default' => 'login',
194 194
 		);
195 195
 		$this->endpoints['my_plan_slug'] = array(
196
-			'title'   => __( 'My Plan Slug', 'lsx-health-plan' ),
196
+			'title'   => __('My Plan Slug', 'lsx-health-plan'),
197 197
 			'default' => 'my-plan',
198 198
 		);
199 199
 		$this->endpoints['plan_single_slug'] = array(
200
-			'title'   => __( 'Single Plan Slug', 'lsx-health-plan' ),
200
+			'title'   => __('Single Plan Slug', 'lsx-health-plan'),
201 201
 			'default' => 'plan',
202 202
 		);
203 203
 		$this->endpoints['endpoint_plan_archive'] = array(
204
-			'title'   => __( 'Plans Archive Endpoint', 'lsx-health-plan' ),
204
+			'title'   => __('Plans Archive Endpoint', 'lsx-health-plan'),
205 205
 			'default' => 'plans',
206 206
 		);
207 207
 
208
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
208
+		if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
209 209
 			$this->endpoints['exercise'] = array(
210 210
 				'exercise_single' => array(
211
-					'title'   => __( 'Single Exercise Slug', 'lsx-health-plan' ),
211
+					'title'   => __('Single Exercise Slug', 'lsx-health-plan'),
212 212
 					'default' => 'exercise',
213 213
 				),
214 214
 				'exercise_archive' => array(
215
-					'title'   => __( 'Archive Exercise Slug', 'lsx-health-plan' ),
215
+					'title'   => __('Archive Exercise Slug', 'lsx-health-plan'),
216 216
 					'default' => 'exercises',
217 217
 				),
218 218
 				'exercise_type' => array(
219
-					'title'   => __( 'Exercise Type Slug', 'lsx-health-plan' ),
219
+					'title'   => __('Exercise Type Slug', 'lsx-health-plan'),
220 220
 					'default' => 'exercise-type',
221 221
 				),
222 222
 				'exercise_equipment' => array(
223
-					'title'   => __( 'Equipment Slug', 'lsx-health-plan' ),
223
+					'title'   => __('Equipment Slug', 'lsx-health-plan'),
224 224
 					'default' => 'equipment',
225 225
 				),
226 226
 				'exercise_musclegroup' => array(
227
-					'title'   => __( 'Muscle Group Slug', 'lsx-health-plan' ),
227
+					'title'   => __('Muscle Group Slug', 'lsx-health-plan'),
228 228
 					'default' => 'muscle-group',
229 229
 				),
230 230
 			);
@@ -239,14 +239,14 @@  discard block
 block discarded – undo
239 239
 		$cmb = new_cmb2_box(
240 240
 			array(
241 241
 				'id'           => $this->screen_id,
242
-				'title'        => esc_html__( 'Settings', 'lsx-health-plan' ),
243
-				'object_types' => array( 'options-page' ),
242
+				'title'        => esc_html__('Settings', 'lsx-health-plan'),
243
+				'object_types' => array('options-page'),
244 244
 				'option_key'   => 'lsx_health_plan_options', // The option key and admin menu page slug.
245 245
 				'parent_slug'  => 'edit.php?post_type=plan', // Make options page a submenu item of the themes menu.
246 246
 				'capability'   => 'manage_options', // Cap required to view options-page.
247 247
 			)
248 248
 		);
249
-		do_action( 'lsx_hp_settings_page', $cmb );
249
+		do_action('lsx_hp_settings_page', $cmb);
250 250
 	}
251 251
 
252 252
 	/**
@@ -255,17 +255,17 @@  discard block
 block discarded – undo
255 255
 	 * @param object $cmb new_cmb2_box().
256 256
 	 * @return void
257 257
 	 */
258
-	public function general_settings( $cmb ) {
258
+	public function general_settings($cmb) {
259 259
 		$cmb->add_field(
260 260
 			array(
261
-				'name'       => __( 'Membership Product', 'lsx-health-plan' ),
261
+				'name'       => __('Membership Product', 'lsx-health-plan'),
262 262
 				'id'         => 'membership_product',
263 263
 				'type'       => 'post_search_ajax',
264 264
 				'limit'      => 1,
265 265
 				'sortable'   => false,
266 266
 				'query_args' => array(
267
-					'post_type'      => array( 'product' ),
268
-					'post_status'    => array( 'publish' ),
267
+					'post_type'      => array('product'),
268
+					'post_status'    => array('publish'),
269 269
 					'posts_per_page' => -1,
270 270
 				),
271 271
 			)
@@ -273,43 +273,43 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$cmb->add_field(
275 275
 			array(
276
-				'name'    => __( 'Your Warm-up Intro', 'lsx-health-plan' ),
276
+				'name'    => __('Your Warm-up Intro', 'lsx-health-plan'),
277 277
 				'id'      => 'warmup_intro',
278 278
 				'type'    => 'textarea_small',
279 279
 				'value'   => '',
280
-				'default' => __( "Don't forget your warm-up! It's a vital part of your daily workout routine.", 'lsx-health-plan' ),
280
+				'default' => __("Don't forget your warm-up! It's a vital part of your daily workout routine.", 'lsx-health-plan'),
281 281
 			)
282 282
 		);
283
-		if ( post_type_exists( 'workout' ) ) {
283
+		if (post_type_exists('workout')) {
284 284
 			$cmb->add_field(
285 285
 				array(
286
-					'name'    => __( 'Your Workout Intro', 'lsx-health-plan' ),
286
+					'name'    => __('Your Workout Intro', 'lsx-health-plan'),
287 287
 					'id'      => 'workout_intro',
288 288
 					'type'    => 'textarea_small',
289 289
 					'value'   => '',
290
-					'default' => __( "Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan' ),
290
+					'default' => __("Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan'),
291 291
 				)
292 292
 			);
293 293
 		}
294
-		if ( post_type_exists( 'meal' ) ) {
294
+		if (post_type_exists('meal')) {
295 295
 			$cmb->add_field(
296 296
 				array(
297
-					'name'    => __( 'Your Meal Plan Intro', 'lsx-health-plan' ),
297
+					'name'    => __('Your Meal Plan Intro', 'lsx-health-plan'),
298 298
 					'id'      => 'meal_plan_intro',
299 299
 					'type'    => 'textarea_small',
300 300
 					'value'   => '',
301
-					'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ),
301
+					'default' => __('Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan'),
302 302
 				)
303 303
 			);
304 304
 		}
305
-		if ( post_type_exists( 'recipe' ) ) {
305
+		if (post_type_exists('recipe')) {
306 306
 			$cmb->add_field(
307 307
 				array(
308
-					'name'    => __( 'Recipes Intro', 'lsx-health-plan' ),
308
+					'name'    => __('Recipes Intro', 'lsx-health-plan'),
309 309
 					'id'      => 'recipes_intro',
310 310
 					'type'    => 'textarea_small',
311 311
 					'value'   => '',
312
-					'default' => __( "Let's get cooking! Delicious and easy to follow recipes.", 'lsx-health-plan' ),
312
+					'default' => __("Let's get cooking! Delicious and easy to follow recipes.", 'lsx-health-plan'),
313 313
 				)
314 314
 			);
315 315
 		}
@@ -321,27 +321,27 @@  discard block
 block discarded – undo
321 321
 	 * @param object $cmb new_cmb2_box().
322 322
 	 * @return void
323 323
 	 */
324
-	public function global_defaults( $cmb ) {
324
+	public function global_defaults($cmb) {
325 325
 		$cmb->add_field(
326 326
 			array(
327 327
 				'id'      => 'global_defaults_title',
328 328
 				'type'    => 'title',
329
-				'name'    => __( 'Global Defaults', 'lsx-health-plan' ),
330
-				'default' => __( 'Global Defaults', 'lsx-health-plan' ),
331
-				'description' => __( 'If you have not connected a specific post to your day plan, set a default option below.', 'lsx-health-plan' ),
329
+				'name'    => __('Global Defaults', 'lsx-health-plan'),
330
+				'default' => __('Global Defaults', 'lsx-health-plan'),
331
+				'description' => __('If you have not connected a specific post to your day plan, set a default option below.', 'lsx-health-plan'),
332 332
 			)
333 333
 		);
334 334
 
335
-		foreach ( $this->default_types as $type => $default_type ) {
335
+		foreach ($this->default_types as $type => $default_type) {
336 336
 			$limit    = 5;
337 337
 			$sortable = false;
338
-			if ( isset( $default_type['limit'] ) ) {
338
+			if (isset($default_type['limit'])) {
339 339
 				$limit    = $default_type['limit'];
340 340
 				$sortable = true;
341 341
 			}
342 342
 
343
-			if ( 'page' === $type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
344
-				$type = array( 'page', 'workout' );
343
+			if ('page' === $type && false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
344
+				$type = array('page', 'workout');
345 345
 			}
346 346
 
347 347
 			$cmb->add_field(
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 					'sortable'   => $sortable,
355 355
 					'query_args' => array(
356 356
 						'post_type'      => $type,
357
-						'post_status'    => array( 'publish' ),
357
+						'post_status'    => array('publish'),
358 358
 						'posts_per_page' => -1,
359 359
 					),
360 360
 				)
@@ -375,21 +375,21 @@  discard block
 block discarded – undo
375 375
 	 * @param object $cmb new_cmb2_box().
376 376
 	 * @return void
377 377
 	 */
378
-	public function global_downloads( $cmb ) {
378
+	public function global_downloads($cmb) {
379 379
 		$cmb->add_field(
380 380
 			array(
381 381
 				'id'          => 'global_downloads_title',
382 382
 				'type'        => 'title',
383
-				'name'        => __( 'Global Downloads', 'lsx-health-plan' ),
384
-				'default'     => __( 'Global Downloads', 'lsx-health-plan' ),
385
-				'description' => __( 'If you have not connected a specific download file to your plans, set a default option below', 'lsx-health-plan' ),
383
+				'name'        => __('Global Downloads', 'lsx-health-plan'),
384
+				'default'     => __('Global Downloads', 'lsx-health-plan'),
385
+				'description' => __('If you have not connected a specific download file to your plans, set a default option below', 'lsx-health-plan'),
386 386
 			)
387 387
 		);
388 388
 
389
-		foreach ( $this->download_types as $type => $download_type ) {
389
+		foreach ($this->download_types as $type => $download_type) {
390 390
 			$limit    = 5;
391 391
 			$sortable = false;
392
-			if ( isset( $download_type['limit'] ) ) {
392
+			if (isset($download_type['limit'])) {
393 393
 				$limit    = $download_type['limit'];
394 394
 				$sortable = true;
395 395
 			}
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 					'limit'      => $limit,
403 403
 					'sortable'   => $sortable,
404 404
 					'query_args' => array(
405
-						'post_type'      => array( 'dlm_download' ),
406
-						'post_status'    => array( 'publish' ),
405
+						'post_type'      => array('dlm_download'),
406
+						'post_status'    => array('publish'),
407 407
 						'posts_per_page' => -1,
408 408
 					),
409 409
 				)
@@ -423,17 +423,17 @@  discard block
 block discarded – undo
423 423
 	 * @param object $cmb new_cmb2_box().
424 424
 	 * @return void
425 425
 	 */
426
-	public function endpoint_translations( $cmb ) {
426
+	public function endpoint_translations($cmb) {
427 427
 		$cmb->add_field(
428 428
 			array(
429 429
 				'id'          => 'endpoints_title',
430 430
 				'type'        => 'title',
431
-				'name'        => __( 'Set Endpoint Translations', 'lsx-health-plan' ),
432
-				'default'     => __( 'Set Endpoint Translations', 'lsx-health-plan' ),
431
+				'name'        => __('Set Endpoint Translations', 'lsx-health-plan'),
432
+				'default'     => __('Set Endpoint Translations', 'lsx-health-plan'),
433 433
 			)
434 434
 		);
435
-		foreach ( $this->endpoints as $slug => $endpoint_vars ) {
436
-			if ( 'exercise' === $slug ) {
435
+		foreach ($this->endpoints as $slug => $endpoint_vars) {
436
+			if ('exercise' === $slug) {
437 437
 				continue;
438 438
 			}
439 439
 
@@ -462,19 +462,19 @@  discard block
 block discarded – undo
462 462
 	 * @param object $cmb new_cmb2_box().
463 463
 	 * @return void
464 464
 	 */
465
-	public function exercise_translations( $cmb ) {
466
-		if ( isset( $this->endpoints['exercise'] ) && '' !== $this->endpoints['exercise'] && ! empty( $this->endpoints['exercise'] ) ) {
465
+	public function exercise_translations($cmb) {
466
+		if (isset($this->endpoints['exercise']) && '' !== $this->endpoints['exercise'] && ! empty($this->endpoints['exercise'])) {
467 467
 			$cmb->add_field(
468 468
 				array(
469 469
 					'id'          => 'exercise_endpoints_title',
470 470
 					'type'        => 'title',
471
-					'name'        => __( 'Set Exercise Translations', 'lsx-health-plan' ),
472
-					'default'     => __( 'Set Exercise Translations', 'lsx-health-plan' ),
473
-					'description' => __( 'Change the exercise endpoints.', 'lsx-health-plan' ),
471
+					'name'        => __('Set Exercise Translations', 'lsx-health-plan'),
472
+					'default'     => __('Set Exercise Translations', 'lsx-health-plan'),
473
+					'description' => __('Change the exercise endpoints.', 'lsx-health-plan'),
474 474
 				)
475 475
 			);
476 476
 
477
-			foreach ( $this->endpoints['exercise'] as $slug => $endpoint_vars ) {
477
+			foreach ($this->endpoints['exercise'] as $slug => $endpoint_vars) {
478 478
 				$cmb->add_field(
479 479
 					array(
480 480
 						'name'    => $endpoint_vars['title'],
@@ -502,27 +502,27 @@  discard block
 block discarded – undo
502 502
 	 * @param object $cmb new_cmb2_box().
503 503
 	 * @return void
504 504
 	 */
505
-	public function post_type_toggles( $cmb ) {
506
-		$post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) );
505
+	public function post_type_toggles($cmb) {
506
+		$post_types = apply_filters('lsx_health_plan_post_types', isset($this->post_types));
507 507
 
508 508
 		$cmb->add_field(
509 509
 			array(
510 510
 				'id'          => 'post_type_toggles_title',
511 511
 				'type'        => 'title',
512
-				'name'        => __( 'Disable Post Types', 'lsx-health-plan' ),
513
-				'default'     => __( 'Disable Post Types', 'lsx-health-plan' ),
514
-				'description' => __( 'Disable post types if you are wanting a minimal site.', 'lsx-health-plan' ),
512
+				'name'        => __('Disable Post Types', 'lsx-health-plan'),
513
+				'default'     => __('Disable Post Types', 'lsx-health-plan'),
514
+				'description' => __('Disable post types if you are wanting a minimal site.', 'lsx-health-plan'),
515 515
 			)
516 516
 		);
517 517
 
518
-		foreach ( $post_types as $post_type ) {
519
-			if ( 'plan' === $post_type || 'exercise' === $post_type || ( 'video' === $post_type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) ) {
518
+		foreach ($post_types as $post_type) {
519
+			if ('plan' === $post_type || 'exercise' === $post_type || ('video' === $post_type && false !== \lsx_health_plan\functions\get_option('exercise_enabled', false))) {
520 520
 				continue;
521 521
 			}
522 522
 
523 523
 			$cmb->add_field(
524 524
 				array(
525
-					'name'    => ucwords( $post_type ),
525
+					'name'    => ucwords($post_type),
526 526
 					'id'      => $post_type . '_disabled',
527 527
 					'type'    => 'checkbox',
528 528
 					'value'   => 1,
@@ -542,19 +542,19 @@  discard block
 block discarded – undo
542 542
 			array(
543 543
 				'id'          => 'post_type_toggles_enable_title',
544 544
 				'type'        => 'title',
545
-				'name'        => __( 'Enable Post Types', 'lsx-health-plan' ),
546
-				'default'     => __( 'Enable Post Types', 'lsx-health-plan' ),
547
-				'description' => __( 'Enable new functionality like the "exercise" post type.', 'lsx-health-plan' ),
545
+				'name'        => __('Enable Post Types', 'lsx-health-plan'),
546
+				'default'     => __('Enable Post Types', 'lsx-health-plan'),
547
+				'description' => __('Enable new functionality like the "exercise" post type.', 'lsx-health-plan'),
548 548
 			)
549 549
 		);
550 550
 		$cmb->add_field(
551 551
 			array(
552
-				'name'        => __( 'Exercises', 'lsx-health-plan' ),
552
+				'name'        => __('Exercises', 'lsx-health-plan'),
553 553
 				'id'          => 'exercise_enabled',
554 554
 				'type'        => 'checkbox',
555 555
 				'value'       => 1,
556 556
 				'default'     => 0,
557
-				'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ),
557
+				'description' => __('Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan'),
558 558
 			)
559 559
 		);
560 560
 		$cmb->add_field(
@@ -571,18 +571,18 @@  discard block
 block discarded – undo
571 571
 	 * @return void
572 572
 	 */
573 573
 
574
-	public function stat_disable( $cmb ) {
574
+	public function stat_disable($cmb) {
575 575
 		$cmb->add_field(
576 576
 			array(
577 577
 				'id'      => 'stat_disable_title',
578 578
 				'type'    => 'title',
579
-				'name'    => __( 'Disable Profile Stats', 'lsx-health-plan' ),
580
-				'default' => __( 'Disable Profile Stats', 'lsx-health-plan' ),
579
+				'name'    => __('Disable Profile Stats', 'lsx-health-plan'),
580
+				'default' => __('Disable Profile Stats', 'lsx-health-plan'),
581 581
 			)
582 582
 		);
583 583
 		$cmb->add_field(
584 584
 			array(
585
-				'name'    => __( 'Disable All Stats', 'lsx-health-plan' ),
585
+				'name'    => __('Disable All Stats', 'lsx-health-plan'),
586 586
 				'desc'    => 'Disable All Stats',
587 587
 				'id'      => 'disable_all_stats',
588 588
 				'type'    => 'checkbox',
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 		);
593 593
 		$cmb->add_field(
594 594
 			array(
595
-				'name'    => __( 'Disable Weight', 'lsx-health-plan' ),
595
+				'name'    => __('Disable Weight', 'lsx-health-plan'),
596 596
 				'id'      => 'disable_weight_checkbox',
597 597
 				'type'    => 'checkbox',
598 598
 				'value'   => 1,
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		);
602 602
 		$cmb->add_field(
603 603
 			array(
604
-				'name'    => __( 'Disable Height', 'lsx-health-plan' ),
604
+				'name'    => __('Disable Height', 'lsx-health-plan'),
605 605
 				'id'      => 'disable_height_checkbox',
606 606
 				'type'    => 'checkbox',
607 607
 				'value'   => 1,
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 		);
611 611
 		$cmb->add_field(
612 612
 			array(
613
-				'name'    => __( 'Disable Waist', 'lsx-health-plan' ),
613
+				'name'    => __('Disable Waist', 'lsx-health-plan'),
614 614
 				'id'      => 'disable_waist_checkbox',
615 615
 				'type'    => 'checkbox',
616 616
 				'value'   => 1,
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 		);
620 620
 		$cmb->add_field(
621 621
 			array(
622
-				'name'    => __( 'Disable BMI', 'lsx-health-plan' ),
622
+				'name'    => __('Disable BMI', 'lsx-health-plan'),
623 623
 				'id'      => 'disable_bmi_checkbox',
624 624
 				'type'    => 'checkbox',
625 625
 				'value'   => 1,
@@ -641,10 +641,10 @@  discard block
 block discarded – undo
641 641
 	 * @param string $section either engine,archive or single.
642 642
 	 * @return void
643 643
 	 */
644
-	public function generate_tabs( $cmb ) {
644
+	public function generate_tabs($cmb) {
645 645
 		$tabs = $this->get_settings_tabs();
646 646
 
647
-		foreach ( $tabs as $tab_key => $tab ) {
647
+		foreach ($tabs as $tab_key => $tab) {
648 648
 			$cmb->add_field(
649 649
 				array(
650 650
 					'id'          => 'settings_' . $tab_key . '_title',
@@ -654,11 +654,11 @@  discard block
 block discarded – undo
654 654
 					'description' => $tab['desc'],
655 655
 				)
656 656
 			);
657
-			do_action( 'lsx_hp_settings_page_' . $tab_key . '_top', $cmb );
657
+			do_action('lsx_hp_settings_page_' . $tab_key . '_top', $cmb);
658 658
 
659
-			do_action( 'lsx_hp_settings_page_' . $tab_key . '_middle', $cmb );
659
+			do_action('lsx_hp_settings_page_' . $tab_key . '_middle', $cmb);
660 660
 
661
-			do_action( 'lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb );
661
+			do_action('lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb);
662 662
 
663 663
 			$cmb->add_field(
664 664
 				array(
@@ -678,26 +678,26 @@  discard block
 block discarded – undo
678 678
 	public function get_settings_tabs() {
679 679
 		$tabs = array(
680 680
 			'general' => array(
681
-				'title' => __( 'General', 'lsx-health-plan' ),
682
-				'desc'  => __( 'Control the sitewide settings for the LSX HP site.', 'lsx-health-plan' ),
681
+				'title' => __('General', 'lsx-health-plan'),
682
+				'desc'  => __('Control the sitewide settings for the LSX HP site.', 'lsx-health-plan'),
683 683
 			),
684 684
 		);
685 685
 
686
-		foreach ( $this->post_types as $post_type ) {
687
-			switch ( $post_type ) {
686
+		foreach ($this->post_types as $post_type) {
687
+			switch ($post_type) {
688 688
 				default:
689 689
 					//if ( ! in_array( $post_type, \lsx\search\includes\get_restricted_post_types() ) ) {
690
-						$temp_post_type = get_post_type_object( $post_type );
691
-						if ( ! is_wp_error( $temp_post_type ) ) {
692
-							$page_url    = get_post_type_archive_link( $temp_post_type->name );
690
+						$temp_post_type = get_post_type_object($post_type);
691
+						if ( ! is_wp_error($temp_post_type)) {
692
+							$page_url    = get_post_type_archive_link($temp_post_type->name);
693 693
 							$description = sprintf(
694 694
 								/* translators: %s: The subscription info */
695
-								__( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ),
695
+								__('Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search'),
696 696
 								$page_url,
697 697
 								$temp_post_type->label
698 698
 							);
699 699
 
700
-							$tabs[ $post_type ] = array(
700
+							$tabs[$post_type] = array(
701 701
 								'title' => $temp_post_type->label,
702 702
 								'desc'  => $description,
703 703
 							);
Please login to merge, or discard this patch.