Passed
Push — dependabot/github_actions/acti... ( 7e959c )
by
unknown
07:11
created
includes/conditionals.php 2 patches
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  * @param string $post_id
12 12
  * @return boolean
13 13
  */
14
-function lsx_health_plan_has_warmup( $post_id = '' ) {
15
-	if ( '' === $post_id ) {
14
+function lsx_health_plan_has_warmup($post_id = '') {
15
+	if ('' === $post_id) {
16 16
 		$post_id = get_the_ID();
17 17
 	}
18
-	return \lsx_health_plan\functions\has_attached_post( $post_id, 'plan_warmup' );
18
+	return \lsx_health_plan\functions\has_attached_post($post_id, 'plan_warmup');
19 19
 }
20 20
 
21 21
 /**
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
  * @param string $post_id
25 25
  * @return boolean
26 26
  */
27
-function lsx_health_plan_has_workout( $post_id = '' ) {
28
-	if ( ! post_type_exists( 'workout' ) ) {
27
+function lsx_health_plan_has_workout($post_id = '') {
28
+	if ( ! post_type_exists('workout')) {
29 29
 		return false;
30 30
 	}
31
-	if ( '' === $post_id ) {
31
+	if ('' === $post_id) {
32 32
 		$post_id = get_the_ID();
33 33
 	}
34
-	return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_workouts' );
34
+	return \lsx_health_plan\functions\has_attached_post($post_id, 'connected_workouts');
35 35
 }
36 36
 
37 37
 /**
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
  * @param string $post_id
41 41
  * @return boolean
42 42
  */
43
-function lsx_health_plan_has_meal( $post_id = '' ) {
44
-	if ( ! post_type_exists( 'meal' ) ) {
43
+function lsx_health_plan_has_meal($post_id = '') {
44
+	if ( ! post_type_exists('meal')) {
45 45
 		return false;
46 46
 	}
47
-	if ( '' === $post_id ) {
47
+	if ('' === $post_id) {
48 48
 		$post_id = get_the_ID();
49 49
 	}
50
-	return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_meals' );
50
+	return \lsx_health_plan\functions\has_attached_post($post_id, 'connected_meals');
51 51
 }
52 52
 
53 53
 /**
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
  * @param string $post_id
57 57
  * @return boolean
58 58
  */
59
-function lsx_health_plan_has_recipe( $post_id = '' ) {
60
-	if ( ! post_type_exists( 'recipe' ) ) {
59
+function lsx_health_plan_has_recipe($post_id = '') {
60
+	if ( ! post_type_exists('recipe')) {
61 61
 		return false;
62 62
 	}
63
-	if ( '' === $post_id ) {
63
+	if ('' === $post_id) {
64 64
 		$post_id = get_the_ID();
65 65
 	}
66
-	return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_recipes' );
66
+	return \lsx_health_plan\functions\has_attached_post($post_id, 'connected_recipes');
67 67
 }
68 68
 
69 69
 /**
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
  * @param string $post_id
73 73
  * @return boolean
74 74
  */
75
-function lsx_health_plan_has_downloads( $post_id = '' ) {
75
+function lsx_health_plan_has_downloads($post_id = '') {
76 76
 	$has_downloads = false;
77
-	if ( '' === $post_id ) {
77
+	if ('' === $post_id) {
78 78
 		$post_id = get_the_ID();
79 79
 	}
80
-	$downloads = \lsx_health_plan\functions\get_downloads( 'all', $post_id );
81
-	if ( ! empty( $downloads ) ) {
80
+	$downloads = \lsx_health_plan\functions\get_downloads('all', $post_id);
81
+	if ( ! empty($downloads)) {
82 82
 		$has_downloads = true;
83 83
 	}
84 84
 	return $has_downloads;
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
  * @param string $post_id
91 91
  * @return boolean
92 92
  */
93
-function lsx_health_plan_has_tip( $post_id = '' ) {
94
-	if ( ! post_type_exists( 'tip' ) ) {
93
+function lsx_health_plan_has_tip($post_id = '') {
94
+	if ( ! post_type_exists('tip')) {
95 95
 		return false;
96 96
 	}
97
-	if ( '' === $post_id ) {
97
+	if ('' === $post_id) {
98 98
 		$post_id = get_the_ID();
99 99
 	}
100
-	return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_tips' );
100
+	return \lsx_health_plan\functions\has_attached_post($post_id, 'connected_tips');
101 101
 }
102 102
 
103 103
 /**
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
  * @param string $post_id
107 107
  * @return boolean
108 108
  */
109
-function lsx_health_plan_has_video( $post_id = '' ) {
110
-	if ( ! post_type_exists( 'video' ) ) {
109
+function lsx_health_plan_has_video($post_id = '') {
110
+	if ( ! post_type_exists('video')) {
111 111
 		return false;
112 112
 	}
113
-	if ( '' === $post_id ) {
113
+	if ('' === $post_id) {
114 114
 		$post_id = get_the_ID();
115 115
 	}
116
-	return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_videos' );
116
+	return \lsx_health_plan\functions\has_attached_post($post_id, 'connected_videos');
117 117
 }
118 118
 
119 119
 /**
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
  */
124 124
 function lsx_health_plan_user_has_purchase() {
125 125
 	$valid_order = false;
126
-	$product_id  = \lsx_health_plan\functions\get_option( 'membership_product', false );
126
+	$product_id  = \lsx_health_plan\functions\get_option('membership_product', false);
127 127
 
128
-	if ( is_user_logged_in() && false !== $product_id ) {
128
+	if (is_user_logged_in() && false !== $product_id) {
129 129
 		$current_user = wp_get_current_user();
130
-		if ( wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product_id ) ) {
130
+		if (wc_customer_bought_product($current_user->user_email, $current_user->ID, $product_id)) {
131 131
 			$valid_order = true;
132 132
 		}
133 133
 	}
@@ -140,15 +140,15 @@  discard block
 block discarded – undo
140 140
  * @param string $post_id
141 141
  * @return boolean
142 142
  */
143
-function lsx_health_plan_is_current_tab( $needle = '' ) {
143
+function lsx_health_plan_is_current_tab($needle = '') {
144 144
 	$is_tab = false;
145
-	$plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false );
146
-	if ( false === $plan_slug ) {
145
+	$plan_slug = \lsx_health_plan\functions\get_option('my_plan_slug', false);
146
+	if (false === $plan_slug) {
147 147
 		$plan_slug = 'my-plan';
148 148
 	}
149
-	if ( is_singular( 'plan' ) || is_page( $plan_slug ) ) {
150
-		$endpoint = get_query_var( 'endpoint' );
151
-		if ( false !== $endpoint && $needle === $endpoint ) {
149
+	if (is_singular('plan') || is_page($plan_slug)) {
150
+		$endpoint = get_query_var('endpoint');
151
+		if (false !== $endpoint && $needle === $endpoint) {
152 152
 			$is_tab = true;
153 153
 		}
154 154
 	}
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
  * @param string $post_id
162 162
  * @return boolean
163 163
  */
164
-function lsx_health_plan_is_day_complete( $post_id = '' ) {
164
+function lsx_health_plan_is_day_complete($post_id = '') {
165 165
 	$is_complete = false;
166
-	if ( '' === $post_id ) {
166
+	if ('' === $post_id) {
167 167
 		$post_id = get_the_ID();
168 168
 	}
169
-	if ( is_user_logged_in() ) {
170
-		$is_day_complete = get_user_meta( get_current_user_id(), 'day_' . $post_id . '_complete', true );
171
-		if ( false !== $is_day_complete && '' !== $is_day_complete ) {
169
+	if (is_user_logged_in()) {
170
+		$is_day_complete = get_user_meta(get_current_user_id(), 'day_' . $post_id . '_complete', true);
171
+		if (false !== $is_day_complete && '' !== $is_day_complete) {
172 172
 			$is_complete = true;
173 173
 		}
174 174
 	}
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
  * @param string $week The week name 'week-1'.
182 182
  * @return boolean
183 183
  */
184
-function lsx_health_plan_week_has_downloads( $week = '' ) {
184
+function lsx_health_plan_week_has_downloads($week = '') {
185 185
 	$has_downloads = false;
186
-	if ( '' !== $week ) {
187
-		$downloads = \lsx_health_plan\functions\get_weekly_downloads( $week );
188
-		if ( ! empty( $downloads ) ) {
186
+	if ('' !== $week) {
187
+		$downloads = \lsx_health_plan\functions\get_weekly_downloads($week);
188
+		if ( ! empty($downloads)) {
189 189
 			$has_downloads = true;
190 190
 		}
191 191
 	}
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
  * @param string $post_id
199 199
  * @return boolean
200 200
  */
201
-function lsx_health_plan_has_tips( $post_id = '' ) {
201
+function lsx_health_plan_has_tips($post_id = '') {
202 202
 	$has_tips = false;
203
-	if ( '' === $post_id ) {
203
+	if ('' === $post_id) {
204 204
 		$post_id = get_the_ID();
205 205
 	}
206
-	$connected_tips = get_post_meta( get_the_ID(), 'connected_tips', true );
207
-	$connected_tips = \lsx_health_plan\functions\check_posts_exist( $connected_tips );
208
-	if ( ! empty( $connected_tips ) ) {
206
+	$connected_tips = get_post_meta(get_the_ID(), 'connected_tips', true);
207
+	$connected_tips = \lsx_health_plan\functions\check_posts_exist($connected_tips);
208
+	if ( ! empty($connected_tips)) {
209 209
 		$has_tips = true;
210 210
 	}
211 211
 	return $has_tips;
Please login to merge, or discard this patch.
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
  * @return boolean
13 13
  */
14 14
 function lsx_health_plan_has_warmup( $post_id = '' ) {
15
-	if ( '' === $post_id ) {
16
-		$post_id = get_the_ID();
17
-	}
18
-	return \lsx_health_plan\functions\has_attached_post( $post_id, 'plan_warmup' );
15
+     if ( '' === $post_id ) {
16
+          $post_id = get_the_ID();
17
+     }
18
+     return \lsx_health_plan\functions\has_attached_post( $post_id, 'plan_warmup' );
19 19
 }
20 20
 
21 21
 /**
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
  * @return boolean
26 26
  */
27 27
 function lsx_health_plan_has_workout( $post_id = '' ) {
28
-	if ( ! post_type_exists( 'workout' ) ) {
29
-		return false;
30
-	}
31
-	if ( '' === $post_id ) {
32
-		$post_id = get_the_ID();
33
-	}
34
-	return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_workouts' );
28
+     if ( ! post_type_exists( 'workout' ) ) {
29
+          return false;
30
+     }
31
+     if ( '' === $post_id ) {
32
+          $post_id = get_the_ID();
33
+     }
34
+     return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_workouts' );
35 35
 }
36 36
 
37 37
 /**
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
  * @return boolean
42 42
  */
43 43
 function lsx_health_plan_has_meal( $post_id = '' ) {
44
-	if ( ! post_type_exists( 'meal' ) ) {
45
-		return false;
46
-	}
47
-	if ( '' === $post_id ) {
48
-		$post_id = get_the_ID();
49
-	}
50
-	return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_meals' );
44
+     if ( ! post_type_exists( 'meal' ) ) {
45
+          return false;
46
+     }
47
+     if ( '' === $post_id ) {
48
+          $post_id = get_the_ID();
49
+     }
50
+     return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_meals' );
51 51
 }
52 52
 
53 53
 /**
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
  * @return boolean
58 58
  */
59 59
 function lsx_health_plan_has_recipe( $post_id = '' ) {
60
-	if ( ! post_type_exists( 'recipe' ) ) {
61
-		return false;
62
-	}
63
-	if ( '' === $post_id ) {
64
-		$post_id = get_the_ID();
65
-	}
66
-	return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_recipes' );
60
+     if ( ! post_type_exists( 'recipe' ) ) {
61
+          return false;
62
+     }
63
+     if ( '' === $post_id ) {
64
+          $post_id = get_the_ID();
65
+     }
66
+     return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_recipes' );
67 67
 }
68 68
 
69 69
 /**
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
  * @return boolean
74 74
  */
75 75
 function lsx_health_plan_has_downloads( $post_id = '' ) {
76
-	$has_downloads = false;
77
-	if ( '' === $post_id ) {
78
-		$post_id = get_the_ID();
79
-	}
80
-	$downloads = \lsx_health_plan\functions\get_downloads( 'all', $post_id );
81
-	if ( ! empty( $downloads ) ) {
82
-		$has_downloads = true;
83
-	}
84
-	return $has_downloads;
76
+     $has_downloads = false;
77
+     if ( '' === $post_id ) {
78
+          $post_id = get_the_ID();
79
+     }
80
+     $downloads = \lsx_health_plan\functions\get_downloads( 'all', $post_id );
81
+     if ( ! empty( $downloads ) ) {
82
+          $has_downloads = true;
83
+     }
84
+     return $has_downloads;
85 85
 }
86 86
 
87 87
 /**
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
  * @return boolean
92 92
  */
93 93
 function lsx_health_plan_has_tip( $post_id = '' ) {
94
-	if ( ! post_type_exists( 'tip' ) ) {
95
-		return false;
96
-	}
97
-	if ( '' === $post_id ) {
98
-		$post_id = get_the_ID();
99
-	}
100
-	return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_tips' );
94
+     if ( ! post_type_exists( 'tip' ) ) {
95
+          return false;
96
+     }
97
+     if ( '' === $post_id ) {
98
+          $post_id = get_the_ID();
99
+     }
100
+     return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_tips' );
101 101
 }
102 102
 
103 103
 /**
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
  * @return boolean
108 108
  */
109 109
 function lsx_health_plan_has_video( $post_id = '' ) {
110
-	if ( ! post_type_exists( 'video' ) ) {
111
-		return false;
112
-	}
113
-	if ( '' === $post_id ) {
114
-		$post_id = get_the_ID();
115
-	}
116
-	return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_videos' );
110
+     if ( ! post_type_exists( 'video' ) ) {
111
+          return false;
112
+     }
113
+     if ( '' === $post_id ) {
114
+          $post_id = get_the_ID();
115
+     }
116
+     return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_videos' );
117 117
 }
118 118
 
119 119
 /**
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
  * @return boolean
123 123
  */
124 124
 function lsx_health_plan_user_has_purchase() {
125
-	$valid_order = false;
126
-	$product_id  = \lsx_health_plan\functions\get_option( 'membership_product', false );
125
+     $valid_order = false;
126
+     $product_id  = \lsx_health_plan\functions\get_option( 'membership_product', false );
127 127
 
128
-	if ( is_user_logged_in() && false !== $product_id ) {
129
-		$current_user = wp_get_current_user();
130
-		if ( wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product_id ) ) {
131
-			$valid_order = true;
132
-		}
133
-	}
134
-	return $valid_order;
128
+     if ( is_user_logged_in() && false !== $product_id ) {
129
+          $current_user = wp_get_current_user();
130
+          if ( wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product_id ) ) {
131
+               $valid_order = true;
132
+          }
133
+     }
134
+     return $valid_order;
135 135
 }
136 136
 
137 137
 /**
@@ -141,18 +141,18 @@  discard block
 block discarded – undo
141 141
  * @return boolean
142 142
  */
143 143
 function lsx_health_plan_is_current_tab( $needle = '' ) {
144
-	$is_tab = false;
145
-	$plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false );
146
-	if ( false === $plan_slug ) {
147
-		$plan_slug = 'my-plan';
148
-	}
149
-	if ( is_singular( 'plan' ) || is_page( $plan_slug ) ) {
150
-		$endpoint = get_query_var( 'endpoint' );
151
-		if ( false !== $endpoint && $needle === $endpoint ) {
152
-			$is_tab = true;
153
-		}
154
-	}
155
-	return $is_tab;
144
+     $is_tab = false;
145
+     $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false );
146
+     if ( false === $plan_slug ) {
147
+          $plan_slug = 'my-plan';
148
+     }
149
+     if ( is_singular( 'plan' ) || is_page( $plan_slug ) ) {
150
+          $endpoint = get_query_var( 'endpoint' );
151
+          if ( false !== $endpoint && $needle === $endpoint ) {
152
+               $is_tab = true;
153
+          }
154
+     }
155
+     return $is_tab;
156 156
 }
157 157
 
158 158
 /**
@@ -162,17 +162,17 @@  discard block
 block discarded – undo
162 162
  * @return boolean
163 163
  */
164 164
 function lsx_health_plan_is_day_complete( $post_id = '' ) {
165
-	$is_complete = false;
166
-	if ( '' === $post_id ) {
167
-		$post_id = get_the_ID();
168
-	}
169
-	if ( is_user_logged_in() ) {
170
-		$is_day_complete = get_user_meta( get_current_user_id(), 'day_' . $post_id . '_complete', true );
171
-		if ( false !== $is_day_complete && '' !== $is_day_complete ) {
172
-			$is_complete = true;
173
-		}
174
-	}
175
-	return $is_complete;
165
+     $is_complete = false;
166
+     if ( '' === $post_id ) {
167
+          $post_id = get_the_ID();
168
+     }
169
+     if ( is_user_logged_in() ) {
170
+          $is_day_complete = get_user_meta( get_current_user_id(), 'day_' . $post_id . '_complete', true );
171
+          if ( false !== $is_day_complete && '' !== $is_day_complete ) {
172
+               $is_complete = true;
173
+          }
174
+     }
175
+     return $is_complete;
176 176
 }
177 177
 
178 178
 /**
@@ -182,14 +182,14 @@  discard block
 block discarded – undo
182 182
  * @return boolean
183 183
  */
184 184
 function lsx_health_plan_week_has_downloads( $week = '' ) {
185
-	$has_downloads = false;
186
-	if ( '' !== $week ) {
187
-		$downloads = \lsx_health_plan\functions\get_weekly_downloads( $week );
188
-		if ( ! empty( $downloads ) ) {
189
-			$has_downloads = true;
190
-		}
191
-	}
192
-	return $has_downloads;
185
+     $has_downloads = false;
186
+     if ( '' !== $week ) {
187
+          $downloads = \lsx_health_plan\functions\get_weekly_downloads( $week );
188
+          if ( ! empty( $downloads ) ) {
189
+               $has_downloads = true;
190
+          }
191
+     }
192
+     return $has_downloads;
193 193
 }
194 194
 
195 195
 /**
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
  * @return boolean
200 200
  */
201 201
 function lsx_health_plan_has_tips( $post_id = '' ) {
202
-	$has_tips = false;
203
-	if ( '' === $post_id ) {
204
-		$post_id = get_the_ID();
205
-	}
206
-	$connected_tips = get_post_meta( get_the_ID(), 'connected_tips', true );
207
-	$connected_tips = \lsx_health_plan\functions\check_posts_exist( $connected_tips );
208
-	if ( ! empty( $connected_tips ) ) {
209
-		$has_tips = true;
210
-	}
211
-	return $has_tips;
202
+     $has_tips = false;
203
+     if ( '' === $post_id ) {
204
+          $post_id = get_the_ID();
205
+     }
206
+     $connected_tips = get_post_meta( get_the_ID(), 'connected_tips', true );
207
+     $connected_tips = \lsx_health_plan\functions\check_posts_exist( $connected_tips );
208
+     if ( ! empty( $connected_tips ) ) {
209
+          $has_tips = true;
210
+     }
211
+     return $has_tips;
212 212
 }
Please login to merge, or discard this patch.
classes/class-core.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	public static function get_instance() {
61 61
 
62 62
 		// If the single instance hasn't been set, set it now.
63
-		if ( null === self::$instance ) {
63
+		if (null === self::$instance) {
64 64
 			self::$instance = new self();
65 65
 		}
66 66
 
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 	 * @return void
108 108
 	 */
109 109
 	public function get_post_types() {
110
-		$post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) );
111
-		foreach ( $post_types as $index => $post_type ) {
112
-			$is_disabled = \cmb2_get_option( 'lsx_health_plan_options', $post_type . '_disabled', false );
113
-			if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) {
114
-				unset( $post_types[ $index ] );
110
+		$post_types = apply_filters('lsx_health_plan_post_types', isset($this->post_types));
111
+		foreach ($post_types as $index => $post_type) {
112
+			$is_disabled = \cmb2_get_option('lsx_health_plan_options', $post_type . '_disabled', false);
113
+			if (true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled) {
114
+				unset($post_types[$index]);
115 115
 			}
116 116
 		}
117 117
 		return $post_types;
Please login to merge, or discard this patch.
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -8,112 +8,112 @@
 block discarded – undo
8 8
  */
9 9
 class Core {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\Core()
17
-	 */
18
-	protected static $instance = null;
19
-
20
-	/**
21
-	 * @var object \lsx_health_plan\classes\Setup();
22
-	 */
23
-	public $setup;
24
-
25
-	/**
26
-	 * @var object \lsx_health_plan\classes\Admin();
27
-	 */
28
-	public $admin;
29
-
30
-	/**
31
-	 * @var object \lsx_health_plan\classes\Frontend();
32
-	 */
33
-	public $frontend;
34
-
35
-	/**
36
-	 * @var object \lsx_health_plan\classes\Integrations();
37
-	 */
38
-	public $integrations;
39
-
40
-	/**
41
-	 * @var object \lsx_health_plan\classes\Integrations();
42
-	 */
43
-	public $scpo_engine;
44
-
45
-	/**
46
-	 * Contructor
47
-	 */
48
-	public function __construct() {
49
-		$this->load_includes();
50
-		$this->load_classes();
51
-	}
52
-
53
-	/**
54
-	 * Return an instance of this class.
55
-	 *
56
-	 * @since 1.0.0
57
-	 *
58
-	 * @return    object \lsx_health_plan\classes\Core()    A single instance of this class.
59
-	 */
60
-	public static function get_instance() {
61
-
62
-		// If the single instance hasn't been set, set it now.
63
-		if ( null === self::$instance ) {
64
-			self::$instance = new self();
65
-		}
66
-
67
-		return self::$instance;
68
-
69
-	}
70
-
71
-	/**
72
-	 * Loads the variable classes and the static classes.
73
-	 */
74
-	private function load_classes() {
75
-
76
-		require_once LSX_HEALTH_PLAN_PATH . 'classes/class-setup.php';
77
-		$this->setup = Setup::get_instance();
78
-
79
-		require_once LSX_HEALTH_PLAN_PATH . 'classes/class-admin.php';
80
-		$this->admin = Admin::get_instance();
81
-
82
-		require_once LSX_HEALTH_PLAN_PATH . 'classes/class-frontend.php';
83
-		$this->frontend = Frontend::get_instance();
84
-
85
-		require_once LSX_HEALTH_PLAN_PATH . 'classes/class-integrations.php';
86
-		$this->integrations = Integrations::get_instance();
87
-
88
-		require_once LSX_HEALTH_PLAN_PATH . 'classes/class-scpo-engine.php';
89
-		$this->scpo_engine = SCPO_Engine::get_instance();
90
-	}
91
-
92
-	/**
93
-	 * Loads the plugin functions.
94
-	 */
95
-	private function load_includes() {
96
-		require_once LSX_HEALTH_PLAN_PATH . '/includes/functions.php';
97
-		require_once LSX_HEALTH_PLAN_PATH . '/includes/conditionals.php';
98
-		require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags.php';
99
-		require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/exercise.php';
100
-		require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/gallery.php';
101
-		require_once LSX_HEALTH_PLAN_PATH . '/includes/shortcodes.php';
102
-	}
103
-
104
-	/**
105
-	 * Returns the post types currently active
106
-	 *
107
-	 * @return void
108
-	 */
109
-	public function get_post_types() {
110
-		$post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) );
111
-		foreach ( $post_types as $index => $post_type ) {
112
-			$is_disabled = \cmb2_get_option( 'lsx_health_plan_options', $post_type . '_disabled', false );
113
-			if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) {
114
-				unset( $post_types[ $index ] );
115
-			}
116
-		}
117
-		return $post_types;
118
-	}
11
+     /**
12
+      * Holds class instance
13
+      *
14
+      * @since 1.0.0
15
+      *
16
+      * @var      object \lsx_health_plan\classes\Core()
17
+      */
18
+     protected static $instance = null;
19
+
20
+     /**
21
+      * @var object \lsx_health_plan\classes\Setup();
22
+      */
23
+     public $setup;
24
+
25
+     /**
26
+      * @var object \lsx_health_plan\classes\Admin();
27
+      */
28
+     public $admin;
29
+
30
+     /**
31
+      * @var object \lsx_health_plan\classes\Frontend();
32
+      */
33
+     public $frontend;
34
+
35
+     /**
36
+      * @var object \lsx_health_plan\classes\Integrations();
37
+      */
38
+     public $integrations;
39
+
40
+     /**
41
+      * @var object \lsx_health_plan\classes\Integrations();
42
+      */
43
+     public $scpo_engine;
44
+
45
+     /**
46
+      * Contructor
47
+      */
48
+     public function __construct() {
49
+          $this->load_includes();
50
+          $this->load_classes();
51
+     }
52
+
53
+     /**
54
+      * Return an instance of this class.
55
+      *
56
+      * @since 1.0.0
57
+      *
58
+      * @return    object \lsx_health_plan\classes\Core()    A single instance of this class.
59
+      */
60
+     public static function get_instance() {
61
+
62
+          // If the single instance hasn't been set, set it now.
63
+          if ( null === self::$instance ) {
64
+               self::$instance = new self();
65
+          }
66
+
67
+          return self::$instance;
68
+
69
+     }
70
+
71
+     /**
72
+      * Loads the variable classes and the static classes.
73
+      */
74
+     private function load_classes() {
75
+
76
+          require_once LSX_HEALTH_PLAN_PATH . 'classes/class-setup.php';
77
+          $this->setup = Setup::get_instance();
78
+
79
+          require_once LSX_HEALTH_PLAN_PATH . 'classes/class-admin.php';
80
+          $this->admin = Admin::get_instance();
81
+
82
+          require_once LSX_HEALTH_PLAN_PATH . 'classes/class-frontend.php';
83
+          $this->frontend = Frontend::get_instance();
84
+
85
+          require_once LSX_HEALTH_PLAN_PATH . 'classes/class-integrations.php';
86
+          $this->integrations = Integrations::get_instance();
87
+
88
+          require_once LSX_HEALTH_PLAN_PATH . 'classes/class-scpo-engine.php';
89
+          $this->scpo_engine = SCPO_Engine::get_instance();
90
+     }
91
+
92
+     /**
93
+      * Loads the plugin functions.
94
+      */
95
+     private function load_includes() {
96
+          require_once LSX_HEALTH_PLAN_PATH . '/includes/functions.php';
97
+          require_once LSX_HEALTH_PLAN_PATH . '/includes/conditionals.php';
98
+          require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags.php';
99
+          require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/exercise.php';
100
+          require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/gallery.php';
101
+          require_once LSX_HEALTH_PLAN_PATH . '/includes/shortcodes.php';
102
+     }
103
+
104
+     /**
105
+      * Returns the post types currently active
106
+      *
107
+      * @return void
108
+      */
109
+     public function get_post_types() {
110
+          $post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) );
111
+          foreach ( $post_types as $index => $post_type ) {
112
+               $is_disabled = \cmb2_get_option( 'lsx_health_plan_options', $post_type . '_disabled', false );
113
+               if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) {
114
+                    unset( $post_types[ $index ] );
115
+               }
116
+          }
117
+          return $post_types;
118
+     }
119 119
 }
Please login to merge, or discard this patch.
classes/frontend/class-endpoints.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * Contructor
22 22
 	 */
23 23
 	public function __construct() {
24
-		add_action( 'init', array( $this, 'setup' ) );
24
+		add_action('init', array($this, 'setup'));
25 25
 	}
26 26
 
27 27
 	/**
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public static function get_instance() {
35 35
 		// If the single instance hasn't been set, set it now.
36
-		if ( null === self::$instance ) {
36
+		if (null === self::$instance) {
37 37
 			self::$instance = new self();
38 38
 		}
39 39
 		return self::$instance;
@@ -51,40 +51,40 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function add_rewrite_rules() {
53 53
 		// Here is where we add in the rewrite rules above the normal WP ones.
54
-		add_rewrite_tag( '%endpoint%', '([^&]+)' );
54
+		add_rewrite_tag('%endpoint%', '([^&]+)');
55 55
 
56 56
 		// Warm up.
57
-		$warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false );
58
-		if ( false === $warm_up ) {
57
+		$warm_up = \lsx_health_plan\functions\get_option('endpoint_warm_up', false);
58
+		if (false === $warm_up) {
59 59
 			$warm_up = 'warm-up';
60 60
 		}
61
-		add_rewrite_rule( 'plan/([^/]+)/' . $warm_up . '/?$', 'index.php?plan=$matches[1]&endpoint=warm-up', 'top' );
61
+		add_rewrite_rule('plan/([^/]+)/' . $warm_up . '/?$', 'index.php?plan=$matches[1]&endpoint=warm-up', 'top');
62 62
 
63 63
 		// Workout.
64
-		if ( post_type_exists( 'workout' ) ) {
65
-			$workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false );
66
-			if ( false === $workout ) {
64
+		if (post_type_exists('workout')) {
65
+			$workout = \lsx_health_plan\functions\get_option('endpoint_workout', false);
66
+			if (false === $workout) {
67 67
 				$workout = 'workout';
68 68
 			}
69 69
 		}
70
-		add_rewrite_rule( 'plan/([^/]+)/' . $workout . '/?$', 'index.php?plan=$matches[1]&endpoint=workout', 'top' );
70
+		add_rewrite_rule('plan/([^/]+)/' . $workout . '/?$', 'index.php?plan=$matches[1]&endpoint=workout', 'top');
71 71
 
72 72
 		// Meal.
73
-		if ( post_type_exists( 'meal' ) ) {
74
-			$meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false );
75
-			if ( false === $meal ) {
73
+		if (post_type_exists('meal')) {
74
+			$meal = \lsx_health_plan\functions\get_option('endpoint_meal', false);
75
+			if (false === $meal) {
76 76
 				$meal = 'meal';
77 77
 			}
78 78
 		}
79
-		add_rewrite_rule( 'plan/([^/]+)/' . $meal . '/?$', 'index.php?plan=$matches[1]&endpoint=meal', 'top' );
79
+		add_rewrite_rule('plan/([^/]+)/' . $meal . '/?$', 'index.php?plan=$matches[1]&endpoint=meal', 'top');
80 80
 
81 81
 		// Recipe.
82
-		if ( post_type_exists( 'recipe' ) ) {
83
-			$recipe = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false );
84
-			if ( false === $recipe ) {
82
+		if (post_type_exists('recipe')) {
83
+			$recipe = \lsx_health_plan\functions\get_option('endpoint_recipe', false);
84
+			if (false === $recipe) {
85 85
 				$recipe = 'recipes';
86 86
 			}
87 87
 		}
88
-		add_rewrite_rule( 'plan/([^/]+)/' . $recipe . '/?$', 'index.php?plan=$matches[1]&endpoint=recipes', 'top' );
88
+		add_rewrite_rule('plan/([^/]+)/' . $recipe . '/?$', 'index.php?plan=$matches[1]&endpoint=recipes', 'top');
89 89
 	}
90 90
 }
Please login to merge, or discard this patch.
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -8,83 +8,83 @@
 block discarded – undo
8 8
  */
9 9
 class Endpoints {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\Endpoints()
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\Endpoints()
17
+      */
18
+     protected static $instance = null;
19 19
 
20
-	/**
21
-	 * Contructor
22
-	 */
23
-	public function __construct() {
24
-		add_action( 'init', array( $this, 'setup' ) );
25
-	}
20
+     /**
21
+      * Contructor
22
+      */
23
+     public function __construct() {
24
+          add_action( 'init', array( $this, 'setup' ) );
25
+     }
26 26
 
27
-	/**
28
-	 * Return an instance of this class.
29
-	 *
30
-	 * @since 1.0.0
31
-	 *
32
-	 * @return    object \lsx_health_plan\classes\Endpoints()    A single instance of this class.
33
-	 */
34
-	public static function get_instance() {
35
-		// If the single instance hasn't been set, set it now.
36
-		if ( null === self::$instance ) {
37
-			self::$instance = new self();
38
-		}
39
-		return self::$instance;
40
-	}
27
+     /**
28
+      * Return an instance of this class.
29
+      *
30
+      * @since 1.0.0
31
+      *
32
+      * @return    object \lsx_health_plan\classes\Endpoints()    A single instance of this class.
33
+      */
34
+     public static function get_instance() {
35
+          // If the single instance hasn't been set, set it now.
36
+          if ( null === self::$instance ) {
37
+               self::$instance = new self();
38
+          }
39
+          return self::$instance;
40
+     }
41 41
 
42
-	/**
43
-	 * Runs on init
44
-	 */
45
-	public function setup() {
46
-		$this->add_rewrite_rules();
47
-	}
42
+     /**
43
+      * Runs on init
44
+      */
45
+     public function setup() {
46
+          $this->add_rewrite_rules();
47
+     }
48 48
 
49
-	/**
50
-	 * Registers the rewrites.
51
-	 */
52
-	public function add_rewrite_rules() {
53
-		// Here is where we add in the rewrite rules above the normal WP ones.
54
-		add_rewrite_tag( '%endpoint%', '([^&]+)' );
49
+     /**
50
+      * Registers the rewrites.
51
+      */
52
+     public function add_rewrite_rules() {
53
+          // Here is where we add in the rewrite rules above the normal WP ones.
54
+          add_rewrite_tag( '%endpoint%', '([^&]+)' );
55 55
 
56
-		// Warm up.
57
-		$warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false );
58
-		if ( false === $warm_up ) {
59
-			$warm_up = 'warm-up';
60
-		}
61
-		add_rewrite_rule( 'plan/([^/]+)/' . $warm_up . '/?$', 'index.php?plan=$matches[1]&endpoint=warm-up', 'top' );
56
+          // Warm up.
57
+          $warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false );
58
+          if ( false === $warm_up ) {
59
+               $warm_up = 'warm-up';
60
+          }
61
+          add_rewrite_rule( 'plan/([^/]+)/' . $warm_up . '/?$', 'index.php?plan=$matches[1]&endpoint=warm-up', 'top' );
62 62
 
63
-		// Workout.
64
-		if ( post_type_exists( 'workout' ) ) {
65
-			$workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false );
66
-			if ( false === $workout ) {
67
-				$workout = 'workout';
68
-			}
69
-		}
70
-		add_rewrite_rule( 'plan/([^/]+)/' . $workout . '/?$', 'index.php?plan=$matches[1]&endpoint=workout', 'top' );
63
+          // Workout.
64
+          if ( post_type_exists( 'workout' ) ) {
65
+               $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false );
66
+               if ( false === $workout ) {
67
+                    $workout = 'workout';
68
+               }
69
+          }
70
+          add_rewrite_rule( 'plan/([^/]+)/' . $workout . '/?$', 'index.php?plan=$matches[1]&endpoint=workout', 'top' );
71 71
 
72
-		// Meal.
73
-		if ( post_type_exists( 'meal' ) ) {
74
-			$meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false );
75
-			if ( false === $meal ) {
76
-				$meal = 'meal';
77
-			}
78
-		}
79
-		add_rewrite_rule( 'plan/([^/]+)/' . $meal . '/?$', 'index.php?plan=$matches[1]&endpoint=meal', 'top' );
72
+          // Meal.
73
+          if ( post_type_exists( 'meal' ) ) {
74
+               $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false );
75
+               if ( false === $meal ) {
76
+                    $meal = 'meal';
77
+               }
78
+          }
79
+          add_rewrite_rule( 'plan/([^/]+)/' . $meal . '/?$', 'index.php?plan=$matches[1]&endpoint=meal', 'top' );
80 80
 
81
-		// Recipe.
82
-		if ( post_type_exists( 'recipe' ) ) {
83
-			$recipe = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false );
84
-			if ( false === $recipe ) {
85
-				$recipe = 'recipes';
86
-			}
87
-		}
88
-		add_rewrite_rule( 'plan/([^/]+)/' . $recipe . '/?$', 'index.php?plan=$matches[1]&endpoint=recipes', 'top' );
89
-	}
81
+          // Recipe.
82
+          if ( post_type_exists( 'recipe' ) ) {
83
+               $recipe = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false );
84
+               if ( false === $recipe ) {
85
+                    $recipe = 'recipes';
86
+               }
87
+          }
88
+          add_rewrite_rule( 'plan/([^/]+)/' . $recipe . '/?$', 'index.php?plan=$matches[1]&endpoint=recipes', 'top' );
89
+     }
90 90
 }
Please login to merge, or discard this patch.
classes/frontend/class-modals.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * Contructor
29 29
 	 */
30 30
 	public function __construct() {
31
-		add_action( 'wp_footer', array( $this, 'output_modals' ) );
31
+		add_action('wp_footer', array($this, 'output_modals'));
32 32
 	}
33 33
 
34 34
 	/**
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public static function get_instance() {
42 42
 		// If the single instance hasn't been set, set it now.
43
-		if ( null === self::$instance ) {
43
+		if (null === self::$instance) {
44 44
 			self::$instance = new self();
45 45
 		}
46 46
 		return self::$instance;
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 	 * @param string $index
54 54
 	 * @return void
55 55
 	 */
56
-	public function register_modal( $modal = array(), $index = '' ) {
57
-		if ( '' !== $index && ! empty( $modal ) ) {
56
+	public function register_modal($modal = array(), $index = '') {
57
+		if ('' !== $index && ! empty($modal)) {
58 58
 			$modal['id'] = $index;
59
-			$this->modals[ $index ] = $modal;
59
+			$this->modals[$index] = $modal;
60 60
 		}
61 61
 	}
62 62
 
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 	 * Registers the rewrites.
65 65
 	 */
66 66
 	public function output_modals() {
67
-		if ( ! empty( $this->modals ) ) {
68
-			wp_enqueue_script( 'lsx-health-plan-modals', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-modals.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true );
67
+		if ( ! empty($this->modals)) {
68
+			wp_enqueue_script('lsx-health-plan-modals', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-modals.min.js', array('slick'), LSX_HEALTH_PLAN_VER, true);
69 69
 
70
-			foreach ( $this->modals as $index => $modal ) {
71
-				\lsx_health_plan\functions\output_modal( $modal );
70
+			foreach ($this->modals as $index => $modal) {
71
+				\lsx_health_plan\functions\output_modal($modal);
72 72
 			}
73 73
 		}
74 74
 	}
Please login to merge, or discard this patch.
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -8,68 +8,68 @@
 block discarded – undo
8 8
  */
9 9
 class Modals {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\Modals()
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\Modals()
17
+      */
18
+     protected static $instance = null;
19 19
 
20
-	/**
21
-	 * Holds the modals to be outputted
22
-	 *
23
-	 * @var array
24
-	 */
25
-	public $modals = array();
20
+     /**
21
+      * Holds the modals to be outputted
22
+      *
23
+      * @var array
24
+      */
25
+     public $modals = array();
26 26
 
27
-	/**
28
-	 * Contructor
29
-	 */
30
-	public function __construct() {
31
-		add_action( 'wp_footer', array( $this, 'output_modals' ) );
32
-	}
27
+     /**
28
+      * Contructor
29
+      */
30
+     public function __construct() {
31
+          add_action( 'wp_footer', array( $this, 'output_modals' ) );
32
+     }
33 33
 
34
-	/**
35
-	 * Return an instance of this class.
36
-	 *
37
-	 * @since 1.0.0
38
-	 *
39
-	 * @return    object \lsx_health_plan\classes\Endpoints()    A single instance of this class.
40
-	 */
41
-	public static function get_instance() {
42
-		// If the single instance hasn't been set, set it now.
43
-		if ( null === self::$instance ) {
44
-			self::$instance = new self();
45
-		}
46
-		return self::$instance;
47
-	}
34
+     /**
35
+      * Return an instance of this class.
36
+      *
37
+      * @since 1.0.0
38
+      *
39
+      * @return    object \lsx_health_plan\classes\Endpoints()    A single instance of this class.
40
+      */
41
+     public static function get_instance() {
42
+          // If the single instance hasn't been set, set it now.
43
+          if ( null === self::$instance ) {
44
+               self::$instance = new self();
45
+          }
46
+          return self::$instance;
47
+     }
48 48
 
49
-	/**
50
-	 * Registers a modal to be outputted
51
-	 *
52
-	 * @param array $modal
53
-	 * @param string $index
54
-	 * @return void
55
-	 */
56
-	public function register_modal( $modal = array(), $index = '' ) {
57
-		if ( '' !== $index && ! empty( $modal ) ) {
58
-			$modal['id'] = $index;
59
-			$this->modals[ $index ] = $modal;
60
-		}
61
-	}
49
+     /**
50
+      * Registers a modal to be outputted
51
+      *
52
+      * @param array $modal
53
+      * @param string $index
54
+      * @return void
55
+      */
56
+     public function register_modal( $modal = array(), $index = '' ) {
57
+          if ( '' !== $index && ! empty( $modal ) ) {
58
+               $modal['id'] = $index;
59
+               $this->modals[ $index ] = $modal;
60
+          }
61
+     }
62 62
 
63
-	/**
64
-	 * Registers the rewrites.
65
-	 */
66
-	public function output_modals() {
67
-		if ( ! empty( $this->modals ) ) {
68
-			wp_enqueue_script( 'lsx-health-plan-modals', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-modals.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true );
63
+     /**
64
+      * Registers the rewrites.
65
+      */
66
+     public function output_modals() {
67
+          if ( ! empty( $this->modals ) ) {
68
+               wp_enqueue_script( 'lsx-health-plan-modals', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-modals.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true );
69 69
 
70
-			foreach ( $this->modals as $index => $modal ) {
71
-				\lsx_health_plan\functions\output_modal( $modal );
72
-			}
73
-		}
74
-	}
70
+               foreach ( $this->modals as $index => $modal ) {
71
+                    \lsx_health_plan\functions\output_modal( $modal );
72
+               }
73
+          }
74
+     }
75 75
 }
Please login to merge, or discard this patch.
classes/post-types/class-meal.php 2 patches
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 	 * Contructor
31 31
 	 */
32 32
 	public function __construct() {
33
-		add_action( 'init', array( $this, 'register_post_type' ) );
33
+		add_action('init', array($this, 'register_post_type'));
34 34
 
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 );
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 37
 
38
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
39
-		add_action( 'cmb2_admin_init', array( $this, 'meal_connections' ), 15 );
38
+		add_action('cmb2_admin_init', array($this, 'details_metaboxes'));
39
+		add_action('cmb2_admin_init', array($this, 'meal_connections'), 15);
40 40
 	}
41 41
 
42 42
 	/**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public static function get_instance() {
50 50
 		// If the single instance hasn't been set, set it now.
51
-		if ( null === self::$instance ) {
51
+		if (null === self::$instance) {
52 52
 			self::$instance = new self();
53 53
 		}
54 54
 		return self::$instance;
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function register_post_type() {
60 60
 		$labels = array(
61
-			'name'               => esc_html__( 'Meals', 'lsx-health-plan' ),
62
-			'singular_name'      => esc_html__( 'Meal', 'lsx-health-plan' ),
63
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
64
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
65
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
66
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
67
-			'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
68
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
69
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
70
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
71
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
61
+			'name'               => esc_html__('Meals', 'lsx-health-plan'),
62
+			'singular_name'      => esc_html__('Meal', 'lsx-health-plan'),
63
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'),
64
+			'add_new_item'       => esc_html__('Add New', 'lsx-health-plan'),
65
+			'edit_item'          => esc_html__('Edit', 'lsx-health-plan'),
66
+			'new_item'           => esc_html__('New', 'lsx-health-plan'),
67
+			'all_items'          => esc_html__('All', 'lsx-health-plan'),
68
+			'view_item'          => esc_html__('View', 'lsx-health-plan'),
69
+			'search_items'       => esc_html__('Search', 'lsx-health-plan'),
70
+			'not_found'          => esc_html__('None found', 'lsx-health-plan'),
71
+			'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'),
72 72
 			'parent_item_colon'  => '',
73
-			'menu_name'          => esc_html__( 'Meals', 'lsx-health-plan' ),
73
+			'menu_name'          => esc_html__('Meals', 'lsx-health-plan'),
74 74
 		);
75
-		$args   = array(
75
+		$args = array(
76 76
 			'labels'             => $labels,
77 77
 			'public'             => true,
78 78
 			'publicly_queryable' => true,
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 				'title',
91 91
 			),
92 92
 		);
93
-		register_post_type( 'meal', $args );
93
+		register_post_type('meal', $args);
94 94
 	}
95 95
 
96 96
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @param array $post_types
100 100
 	 * @return array
101 101
 	 */
102
-	public function enable_post_type( $post_types = array() ) {
102
+	public function enable_post_type($post_types = array()) {
103 103
 		$post_types[] = $this->slug;
104 104
 		return $post_types;
105 105
 	}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param array $connections
111 111
 	 * @return void
112 112
 	 */
113
-	public function enable_connections( $connections = array() ) {
113
+	public function enable_connections($connections = array()) {
114 114
 		$connections['meal']['connected_plans'] = 'connected_meals';
115 115
 		$connections['plan']['connected_meals'] = 'connected_plans';
116 116
 		return $connections;
@@ -120,117 +120,117 @@  discard block
 block discarded – undo
120 120
 	 * Define the metabox and field configurations.
121 121
 	 */
122 122
 	public function details_metaboxes() {
123
-		$cmb = new_cmb2_box( array(
123
+		$cmb = new_cmb2_box(array(
124 124
 			'id'           => $this->slug . '_shopping_list_metabox',
125
-			'title'        => __( 'Shopping List', 'lsx-health-plan' ),
126
-			'object_types' => array( $this->slug ), // Post type
125
+			'title'        => __('Shopping List', 'lsx-health-plan'),
126
+			'object_types' => array($this->slug), // Post type
127 127
 			'context'      => 'normal',
128 128
 			'priority'     => 'high',
129 129
 			'show_names'   => true,
130
-		) );
131
-		$cmb->add_field( array(
132
-			'name'       => __( 'Shopping List', 'lsx-health-plan' ),
133
-			'desc'       => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ),
130
+		));
131
+		$cmb->add_field(array(
132
+			'name'       => __('Shopping List', 'lsx-health-plan'),
133
+			'desc'       => __('Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.'),
134 134
 			'id'         => $this->slug . '_shopping_list',
135 135
 			'type'       => 'post_search_ajax',
136 136
 			// Optional :
137
-			'limit'      => 1,  // Limit selection to X items only (default 1)
137
+			'limit'      => 1, // Limit selection to X items only (default 1)
138 138
 			'sortable'   => true, // Allow selected items to be sortable (default false)
139 139
 			'query_args' => array(
140
-				'post_type'      => array( 'page' ),
141
-				'post_status'    => array( 'publish' ),
140
+				'post_type'      => array('page'),
141
+				'post_status'    => array('publish'),
142 142
 				'posts_per_page' => -1,
143 143
 			),
144
-		) );
145
-		$cmb = new_cmb2_box( array(
144
+		));
145
+		$cmb = new_cmb2_box(array(
146 146
 			'id'           => $this->slug . '_details_metabox',
147
-			'title'        => __( 'Meal Details', 'lsx-health-plan' ),
148
-			'object_types' => array( $this->slug ), // Post type
147
+			'title'        => __('Meal Details', 'lsx-health-plan'),
148
+			'object_types' => array($this->slug), // Post type
149 149
 			'context'      => 'normal',
150 150
 			'priority'     => 'high',
151 151
 			'show_names'   => true,
152
-		) );
153
-		$cmb->add_field( array(
154
-			'name'       => __( 'Pre Breakfast Snack', 'lsx-health-plan' ),
152
+		));
153
+		$cmb->add_field(array(
154
+			'name'       => __('Pre Breakfast Snack', 'lsx-health-plan'),
155 155
 			'id'         => $this->slug . '_pre_breakfast_snack',
156 156
 			'type'       => 'wysiwyg',
157 157
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
158 158
 			'options'    => array(
159 159
 				'textarea_rows' => 5,
160 160
 			),
161
-		) );
162
-		$cmb->add_field( array(
163
-			'name'       => __( 'Breakfast', 'lsx-health-plan' ),
161
+		));
162
+		$cmb->add_field(array(
163
+			'name'       => __('Breakfast', 'lsx-health-plan'),
164 164
 			'id'         => $this->slug . '_breakfast',
165 165
 			'type'       => 'wysiwyg',
166 166
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
167 167
 			'options'    => array(
168 168
 				'textarea_rows' => 5,
169 169
 			),
170
-		) );
171
-		$cmb->add_field( array(
172
-			'name'       => __( 'Post Breakfast Snack', 'lsx-health-plan' ),
170
+		));
171
+		$cmb->add_field(array(
172
+			'name'       => __('Post Breakfast Snack', 'lsx-health-plan'),
173 173
 			'id'         => $this->slug . '_breakfast_snack',
174 174
 			'type'       => 'wysiwyg',
175 175
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
176 176
 			'options'    => array(
177 177
 				'textarea_rows' => 5,
178 178
 			),
179
-		) );
180
-		$cmb->add_field( array(
181
-			'name'       => __( 'Pre Lunch Snack', 'lsx-health-plan' ),
179
+		));
180
+		$cmb->add_field(array(
181
+			'name'       => __('Pre Lunch Snack', 'lsx-health-plan'),
182 182
 			'id'         => $this->slug . '_pre_lunch_snack',
183 183
 			'type'       => 'wysiwyg',
184 184
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
185 185
 			'options'    => array(
186 186
 				'textarea_rows' => 5,
187 187
 			),
188
-		) );
189
-		$cmb->add_field( array(
190
-			'name'       => __( 'Lunch', 'lsx-health-plan' ),
188
+		));
189
+		$cmb->add_field(array(
190
+			'name'       => __('Lunch', 'lsx-health-plan'),
191 191
 			'id'         => $this->slug . '_lunch',
192 192
 			'type'       => 'wysiwyg',
193 193
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
194 194
 			'options'    => array(
195 195
 				'textarea_rows' => 5,
196 196
 			),
197
-		) );
198
-		$cmb->add_field( array(
199
-			'name'       => __( 'Post Lunch Snack', 'lsx-health-plan' ),
197
+		));
198
+		$cmb->add_field(array(
199
+			'name'       => __('Post Lunch Snack', 'lsx-health-plan'),
200 200
 			'id'         => $this->slug . '_lunch_snack',
201 201
 			'type'       => 'wysiwyg',
202 202
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
203 203
 			'options'    => array(
204 204
 				'textarea_rows' => 5,
205 205
 			),
206
-		) );
207
-		$cmb->add_field( array(
208
-			'name'       => __( 'Pre Dinner Snack', 'lsx-health-plan' ),
206
+		));
207
+		$cmb->add_field(array(
208
+			'name'       => __('Pre Dinner Snack', 'lsx-health-plan'),
209 209
 			'id'         => $this->slug . '_pre_dinner_snack',
210 210
 			'type'       => 'wysiwyg',
211 211
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
212 212
 			'options'    => array(
213 213
 				'textarea_rows' => 5,
214 214
 			),
215
-		) );
216
-		$cmb->add_field( array(
217
-			'name'       => __( 'Dinner', 'lsx-health-plan' ),
215
+		));
216
+		$cmb->add_field(array(
217
+			'name'       => __('Dinner', 'lsx-health-plan'),
218 218
 			'id'         => $this->slug . '_dinner',
219 219
 			'type'       => 'wysiwyg',
220 220
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
221 221
 			'options'    => array(
222 222
 				'textarea_rows' => 5,
223 223
 			),
224
-		) );
225
-		$cmb->add_field( array(
226
-			'name'       => __( 'Post Dinner Snack', 'lsx-health-plan' ),
224
+		));
225
+		$cmb->add_field(array(
226
+			'name'       => __('Post Dinner Snack', 'lsx-health-plan'),
227 227
 			'id'         => $this->slug . '_dinner_snack',
228 228
 			'type'       => 'wysiwyg',
229 229
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
230 230
 			'options'    => array(
231 231
 				'textarea_rows' => 5,
232 232
 			),
233
-		) );
233
+		));
234 234
 	}
235 235
 
236 236
 	/**
@@ -239,14 +239,14 @@  discard block
 block discarded – undo
239 239
 	 * @return void
240 240
 	 */
241 241
 	public function meal_connections() {
242
-		$cmb = new_cmb2_box( array(
242
+		$cmb = new_cmb2_box(array(
243 243
 			'id'           => $this->slug . '_meals_connections_metabox',
244
-			'title'        => __( 'Meal Plan', 'lsx-health-plan' ),
245
-			'object_types' => array( 'plan' ), // Post type
244
+			'title'        => __('Meal Plan', 'lsx-health-plan'),
245
+			'object_types' => array('plan'), // Post type
246 246
 			'context'      => 'normal',
247 247
 			'priority'     => 'high',
248 248
 			'show_names'   => true,
249
-		) );
249
+		));
250 250
 		/*$cmb->add_field( array(
251 251
 			'name'       => __( 'Box Description', 'lsx-health-plan' ),
252 252
 			'id'         => $this->slug . '_box_description',
@@ -254,19 +254,19 @@  discard block
 block discarded – undo
254 254
 			'type'       => 'textarea_small',
255 255
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
256 256
 		) );*/
257
-		$cmb->add_field( array(
258
-			'name'       => __( 'Meals', 'lsx-health-plan' ),
259
-			'desc'       => __( 'Connect the meal that applies to this day plan using the field provided.', 'lsx-health-plan' ),
257
+		$cmb->add_field(array(
258
+			'name'       => __('Meals', 'lsx-health-plan'),
259
+			'desc'       => __('Connect the meal that applies to this day plan using the field provided.', 'lsx-health-plan'),
260 260
 			'id'         => 'connected_meals',
261 261
 			'type'       => 'post_search_ajax',
262 262
 			// Optional :
263 263
 			'limit'      => 15, // Limit selection to X items only (default 1)
264 264
 			'sortable'   => true, // Allow selected items to be sortable (default false)
265 265
 			'query_args' => array(
266
-				'post_type'      => array( $this->slug ),
267
-				'post_status'    => array( 'publish' ),
266
+				'post_type'      => array($this->slug),
267
+				'post_status'    => array('publish'),
268 268
 				'posts_per_page' => -1,
269 269
 			),
270
-		) );
270
+		));
271 271
 	}
272 272
 }
Please login to merge, or discard this patch.
Indentation   +246 added lines, -246 removed lines patch added patch discarded remove patch
@@ -8,265 +8,265 @@
 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' ) );
29
+     /**
30
+      * Contructor
31
+      */
32
+     public function __construct() {
33
+          add_action( 'init', array( $this, 'register_post_type' ) );
34 34
 
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 );
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 37
 
38
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
39
-		add_action( 'cmb2_admin_init', array( $this, 'meal_connections' ), 15 );
40
-	}
38
+          add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
39
+          add_action( 'cmb2_admin_init', array( $this, 'meal_connections' ), 15 );
40
+     }
41 41
 
42
-	/**
43
-	 * Return an instance of this class.
44
-	 *
45
-	 * @since 1.0.0
46
-	 *
47
-	 * @return    object \lsx_health_plan\classes\Day()    A single instance of this class.
48
-	 */
49
-	public static function get_instance() {
50
-		// If the single instance hasn't been set, set it now.
51
-		if ( null === self::$instance ) {
52
-			self::$instance = new self();
53
-		}
54
-		return self::$instance;
55
-	}
56
-	/**
57
-	 * Register the post type.
58
-	 */
59
-	public function register_post_type() {
60
-		$labels = array(
61
-			'name'               => esc_html__( 'Meals', 'lsx-health-plan' ),
62
-			'singular_name'      => esc_html__( 'Meal', 'lsx-health-plan' ),
63
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
64
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
65
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
66
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
67
-			'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
68
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
69
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
70
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
71
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
72
-			'parent_item_colon'  => '',
73
-			'menu_name'          => esc_html__( 'Meals', 'lsx-health-plan' ),
74
-		);
75
-		$args   = array(
76
-			'labels'             => $labels,
77
-			'public'             => true,
78
-			'publicly_queryable' => true,
79
-			'show_ui'            => true,
80
-			'show_in_menu'       => true,
81
-			'show_in_rest'       => true,
82
-			'menu_icon'          => 'dashicons-carrot',
83
-			'query_var'          => true,
84
-			'rewrite'            => false,
85
-			'capability_type'    => 'post',
86
-			'has_archive'        => false,
87
-			'hierarchical'       => false,
88
-			'menu_position'      => null,
89
-			'supports'           => array(
90
-				'title',
91
-			),
92
-		);
93
-		register_post_type( 'meal', $args );
94
-	}
42
+     /**
43
+      * Return an instance of this class.
44
+      *
45
+      * @since 1.0.0
46
+      *
47
+      * @return    object \lsx_health_plan\classes\Day()    A single instance of this class.
48
+      */
49
+     public static function get_instance() {
50
+          // If the single instance hasn't been set, set it now.
51
+          if ( null === self::$instance ) {
52
+               self::$instance = new self();
53
+          }
54
+          return self::$instance;
55
+     }
56
+     /**
57
+      * Register the post type.
58
+      */
59
+     public function register_post_type() {
60
+          $labels = array(
61
+               'name'               => esc_html__( 'Meals', 'lsx-health-plan' ),
62
+               'singular_name'      => esc_html__( 'Meal', 'lsx-health-plan' ),
63
+               'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
64
+               'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
65
+               'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
66
+               'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
67
+               'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
68
+               'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
69
+               'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
70
+               'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
71
+               'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
72
+               'parent_item_colon'  => '',
73
+               'menu_name'          => esc_html__( 'Meals', 'lsx-health-plan' ),
74
+          );
75
+          $args   = array(
76
+               'labels'             => $labels,
77
+               'public'             => true,
78
+               'publicly_queryable' => true,
79
+               'show_ui'            => true,
80
+               'show_in_menu'       => true,
81
+               'show_in_rest'       => true,
82
+               'menu_icon'          => 'dashicons-carrot',
83
+               'query_var'          => true,
84
+               'rewrite'            => false,
85
+               'capability_type'    => 'post',
86
+               'has_archive'        => false,
87
+               'hierarchical'       => false,
88
+               'menu_position'      => null,
89
+               'supports'           => array(
90
+                    'title',
91
+               ),
92
+          );
93
+          register_post_type( 'meal', $args );
94
+     }
95 95
 
96
-	/**
97
-	 * Adds the post type to the different arrays.
98
-	 *
99
-	 * @param array $post_types
100
-	 * @return array
101
-	 */
102
-	public function enable_post_type( $post_types = array() ) {
103
-		$post_types[] = $this->slug;
104
-		return $post_types;
105
-	}
96
+     /**
97
+      * Adds the post type to the different arrays.
98
+      *
99
+      * @param array $post_types
100
+      * @return array
101
+      */
102
+     public function enable_post_type( $post_types = array() ) {
103
+          $post_types[] = $this->slug;
104
+          return $post_types;
105
+     }
106 106
 
107
-	/**
108
-	 * Enables the Bi Directional relationships
109
-	 *
110
-	 * @param array $connections
111
-	 * @return void
112
-	 */
113
-	public function enable_connections( $connections = array() ) {
114
-		$connections['meal']['connected_plans'] = 'connected_meals';
115
-		$connections['plan']['connected_meals'] = 'connected_plans';
116
-		return $connections;
117
-	}
107
+     /**
108
+      * Enables the Bi Directional relationships
109
+      *
110
+      * @param array $connections
111
+      * @return void
112
+      */
113
+     public function enable_connections( $connections = array() ) {
114
+          $connections['meal']['connected_plans'] = 'connected_meals';
115
+          $connections['plan']['connected_meals'] = 'connected_plans';
116
+          return $connections;
117
+     }
118 118
 
119
-	/**
120
-	 * Define the metabox and field configurations.
121
-	 */
122
-	public function details_metaboxes() {
123
-		$cmb = new_cmb2_box( array(
124
-			'id'           => $this->slug . '_shopping_list_metabox',
125
-			'title'        => __( 'Shopping List', 'lsx-health-plan' ),
126
-			'object_types' => array( $this->slug ), // Post type
127
-			'context'      => 'normal',
128
-			'priority'     => 'high',
129
-			'show_names'   => true,
130
-		) );
131
-		$cmb->add_field( array(
132
-			'name'       => __( 'Shopping List', 'lsx-health-plan' ),
133
-			'desc'       => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ),
134
-			'id'         => $this->slug . '_shopping_list',
135
-			'type'       => 'post_search_ajax',
136
-			// Optional :
137
-			'limit'      => 1,  // Limit selection to X items only (default 1)
138
-			'sortable'   => true, // Allow selected items to be sortable (default false)
139
-			'query_args' => array(
140
-				'post_type'      => array( 'page' ),
141
-				'post_status'    => array( 'publish' ),
142
-				'posts_per_page' => -1,
143
-			),
144
-		) );
145
-		$cmb = new_cmb2_box( array(
146
-			'id'           => $this->slug . '_details_metabox',
147
-			'title'        => __( 'Meal Details', 'lsx-health-plan' ),
148
-			'object_types' => array( $this->slug ), // Post type
149
-			'context'      => 'normal',
150
-			'priority'     => 'high',
151
-			'show_names'   => true,
152
-		) );
153
-		$cmb->add_field( array(
154
-			'name'       => __( 'Pre Breakfast Snack', 'lsx-health-plan' ),
155
-			'id'         => $this->slug . '_pre_breakfast_snack',
156
-			'type'       => 'wysiwyg',
157
-			'show_on_cb' => 'cmb2_hide_if_no_cats',
158
-			'options'    => array(
159
-				'textarea_rows' => 5,
160
-			),
161
-		) );
162
-		$cmb->add_field( array(
163
-			'name'       => __( 'Breakfast', 'lsx-health-plan' ),
164
-			'id'         => $this->slug . '_breakfast',
165
-			'type'       => 'wysiwyg',
166
-			'show_on_cb' => 'cmb2_hide_if_no_cats',
167
-			'options'    => array(
168
-				'textarea_rows' => 5,
169
-			),
170
-		) );
171
-		$cmb->add_field( array(
172
-			'name'       => __( 'Post Breakfast Snack', 'lsx-health-plan' ),
173
-			'id'         => $this->slug . '_breakfast_snack',
174
-			'type'       => 'wysiwyg',
175
-			'show_on_cb' => 'cmb2_hide_if_no_cats',
176
-			'options'    => array(
177
-				'textarea_rows' => 5,
178
-			),
179
-		) );
180
-		$cmb->add_field( array(
181
-			'name'       => __( 'Pre Lunch Snack', 'lsx-health-plan' ),
182
-			'id'         => $this->slug . '_pre_lunch_snack',
183
-			'type'       => 'wysiwyg',
184
-			'show_on_cb' => 'cmb2_hide_if_no_cats',
185
-			'options'    => array(
186
-				'textarea_rows' => 5,
187
-			),
188
-		) );
189
-		$cmb->add_field( array(
190
-			'name'       => __( 'Lunch', 'lsx-health-plan' ),
191
-			'id'         => $this->slug . '_lunch',
192
-			'type'       => 'wysiwyg',
193
-			'show_on_cb' => 'cmb2_hide_if_no_cats',
194
-			'options'    => array(
195
-				'textarea_rows' => 5,
196
-			),
197
-		) );
198
-		$cmb->add_field( array(
199
-			'name'       => __( 'Post Lunch Snack', 'lsx-health-plan' ),
200
-			'id'         => $this->slug . '_lunch_snack',
201
-			'type'       => 'wysiwyg',
202
-			'show_on_cb' => 'cmb2_hide_if_no_cats',
203
-			'options'    => array(
204
-				'textarea_rows' => 5,
205
-			),
206
-		) );
207
-		$cmb->add_field( array(
208
-			'name'       => __( 'Pre Dinner Snack', 'lsx-health-plan' ),
209
-			'id'         => $this->slug . '_pre_dinner_snack',
210
-			'type'       => 'wysiwyg',
211
-			'show_on_cb' => 'cmb2_hide_if_no_cats',
212
-			'options'    => array(
213
-				'textarea_rows' => 5,
214
-			),
215
-		) );
216
-		$cmb->add_field( array(
217
-			'name'       => __( 'Dinner', 'lsx-health-plan' ),
218
-			'id'         => $this->slug . '_dinner',
219
-			'type'       => 'wysiwyg',
220
-			'show_on_cb' => 'cmb2_hide_if_no_cats',
221
-			'options'    => array(
222
-				'textarea_rows' => 5,
223
-			),
224
-		) );
225
-		$cmb->add_field( array(
226
-			'name'       => __( 'Post Dinner Snack', 'lsx-health-plan' ),
227
-			'id'         => $this->slug . '_dinner_snack',
228
-			'type'       => 'wysiwyg',
229
-			'show_on_cb' => 'cmb2_hide_if_no_cats',
230
-			'options'    => array(
231
-				'textarea_rows' => 5,
232
-			),
233
-		) );
234
-	}
119
+     /**
120
+      * Define the metabox and field configurations.
121
+      */
122
+     public function details_metaboxes() {
123
+          $cmb = new_cmb2_box( array(
124
+               'id'           => $this->slug . '_shopping_list_metabox',
125
+               'title'        => __( 'Shopping List', 'lsx-health-plan' ),
126
+               'object_types' => array( $this->slug ), // Post type
127
+               'context'      => 'normal',
128
+               'priority'     => 'high',
129
+               'show_names'   => true,
130
+          ) );
131
+          $cmb->add_field( array(
132
+               'name'       => __( 'Shopping List', 'lsx-health-plan' ),
133
+               'desc'       => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ),
134
+               'id'         => $this->slug . '_shopping_list',
135
+               'type'       => 'post_search_ajax',
136
+               // Optional :
137
+               'limit'      => 1,  // Limit selection to X items only (default 1)
138
+               'sortable'   => true, // Allow selected items to be sortable (default false)
139
+               'query_args' => array(
140
+                    'post_type'      => array( 'page' ),
141
+                    'post_status'    => array( 'publish' ),
142
+                    'posts_per_page' => -1,
143
+               ),
144
+          ) );
145
+          $cmb = new_cmb2_box( array(
146
+               'id'           => $this->slug . '_details_metabox',
147
+               'title'        => __( 'Meal Details', 'lsx-health-plan' ),
148
+               'object_types' => array( $this->slug ), // Post type
149
+               'context'      => 'normal',
150
+               'priority'     => 'high',
151
+               'show_names'   => true,
152
+          ) );
153
+          $cmb->add_field( array(
154
+               'name'       => __( 'Pre Breakfast Snack', 'lsx-health-plan' ),
155
+               'id'         => $this->slug . '_pre_breakfast_snack',
156
+               'type'       => 'wysiwyg',
157
+               'show_on_cb' => 'cmb2_hide_if_no_cats',
158
+               'options'    => array(
159
+                    'textarea_rows' => 5,
160
+               ),
161
+          ) );
162
+          $cmb->add_field( array(
163
+               'name'       => __( 'Breakfast', 'lsx-health-plan' ),
164
+               'id'         => $this->slug . '_breakfast',
165
+               'type'       => 'wysiwyg',
166
+               'show_on_cb' => 'cmb2_hide_if_no_cats',
167
+               'options'    => array(
168
+                    'textarea_rows' => 5,
169
+               ),
170
+          ) );
171
+          $cmb->add_field( array(
172
+               'name'       => __( 'Post Breakfast Snack', 'lsx-health-plan' ),
173
+               'id'         => $this->slug . '_breakfast_snack',
174
+               'type'       => 'wysiwyg',
175
+               'show_on_cb' => 'cmb2_hide_if_no_cats',
176
+               'options'    => array(
177
+                    'textarea_rows' => 5,
178
+               ),
179
+          ) );
180
+          $cmb->add_field( array(
181
+               'name'       => __( 'Pre Lunch Snack', 'lsx-health-plan' ),
182
+               'id'         => $this->slug . '_pre_lunch_snack',
183
+               'type'       => 'wysiwyg',
184
+               'show_on_cb' => 'cmb2_hide_if_no_cats',
185
+               'options'    => array(
186
+                    'textarea_rows' => 5,
187
+               ),
188
+          ) );
189
+          $cmb->add_field( array(
190
+               'name'       => __( 'Lunch', 'lsx-health-plan' ),
191
+               'id'         => $this->slug . '_lunch',
192
+               'type'       => 'wysiwyg',
193
+               'show_on_cb' => 'cmb2_hide_if_no_cats',
194
+               'options'    => array(
195
+                    'textarea_rows' => 5,
196
+               ),
197
+          ) );
198
+          $cmb->add_field( array(
199
+               'name'       => __( 'Post Lunch Snack', 'lsx-health-plan' ),
200
+               'id'         => $this->slug . '_lunch_snack',
201
+               'type'       => 'wysiwyg',
202
+               'show_on_cb' => 'cmb2_hide_if_no_cats',
203
+               'options'    => array(
204
+                    'textarea_rows' => 5,
205
+               ),
206
+          ) );
207
+          $cmb->add_field( array(
208
+               'name'       => __( 'Pre Dinner Snack', 'lsx-health-plan' ),
209
+               'id'         => $this->slug . '_pre_dinner_snack',
210
+               'type'       => 'wysiwyg',
211
+               'show_on_cb' => 'cmb2_hide_if_no_cats',
212
+               'options'    => array(
213
+                    'textarea_rows' => 5,
214
+               ),
215
+          ) );
216
+          $cmb->add_field( array(
217
+               'name'       => __( 'Dinner', 'lsx-health-plan' ),
218
+               'id'         => $this->slug . '_dinner',
219
+               'type'       => 'wysiwyg',
220
+               'show_on_cb' => 'cmb2_hide_if_no_cats',
221
+               'options'    => array(
222
+                    'textarea_rows' => 5,
223
+               ),
224
+          ) );
225
+          $cmb->add_field( array(
226
+               'name'       => __( 'Post Dinner Snack', 'lsx-health-plan' ),
227
+               'id'         => $this->slug . '_dinner_snack',
228
+               'type'       => 'wysiwyg',
229
+               'show_on_cb' => 'cmb2_hide_if_no_cats',
230
+               'options'    => array(
231
+                    'textarea_rows' => 5,
232
+               ),
233
+          ) );
234
+     }
235 235
 
236
-	/**
237
-	 * Registers the workout connections on the plan post type.
238
-	 *
239
-	 * @return void
240
-	 */
241
-	public function meal_connections() {
242
-		$cmb = new_cmb2_box( array(
243
-			'id'           => $this->slug . '_meals_connections_metabox',
244
-			'title'        => __( 'Meal Plan', 'lsx-health-plan' ),
245
-			'object_types' => array( 'plan' ), // Post type
246
-			'context'      => 'normal',
247
-			'priority'     => 'high',
248
-			'show_names'   => true,
249
-		) );
250
-		/*$cmb->add_field( array(
236
+     /**
237
+      * Registers the workout connections on the plan post type.
238
+      *
239
+      * @return void
240
+      */
241
+     public function meal_connections() {
242
+          $cmb = new_cmb2_box( array(
243
+               'id'           => $this->slug . '_meals_connections_metabox',
244
+               'title'        => __( 'Meal Plan', 'lsx-health-plan' ),
245
+               'object_types' => array( 'plan' ), // Post type
246
+               'context'      => 'normal',
247
+               'priority'     => 'high',
248
+               'show_names'   => true,
249
+          ) );
250
+          /*$cmb->add_field( array(
251 251
 			'name'       => __( 'Box Description', 'lsx-health-plan' ),
252 252
 			'id'         => $this->slug . '_box_description',
253 253
 			'desc'			=> __( 'This description displays on the single plan page.', 'lsx-health-plan' ),
254 254
 			'type'       => 'textarea_small',
255 255
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
256 256
 		) );*/
257
-		$cmb->add_field( array(
258
-			'name'       => __( 'Meals', 'lsx-health-plan' ),
259
-			'desc'       => __( 'Connect the meal that applies to this day plan using the field provided.', 'lsx-health-plan' ),
260
-			'id'         => 'connected_meals',
261
-			'type'       => 'post_search_ajax',
262
-			// Optional :
263
-			'limit'      => 15, // Limit selection to X items only (default 1)
264
-			'sortable'   => true, // Allow selected items to be sortable (default false)
265
-			'query_args' => array(
266
-				'post_type'      => array( $this->slug ),
267
-				'post_status'    => array( 'publish' ),
268
-				'posts_per_page' => -1,
269
-			),
270
-		) );
271
-	}
257
+          $cmb->add_field( array(
258
+               'name'       => __( 'Meals', 'lsx-health-plan' ),
259
+               'desc'       => __( 'Connect the meal that applies to this day plan using the field provided.', 'lsx-health-plan' ),
260
+               'id'         => 'connected_meals',
261
+               'type'       => 'post_search_ajax',
262
+               // Optional :
263
+               'limit'      => 15, // Limit selection to X items only (default 1)
264
+               'sortable'   => true, // Allow selected items to be sortable (default false)
265
+               'query_args' => array(
266
+                    'post_type'      => array( $this->slug ),
267
+                    'post_status'    => array( 'publish' ),
268
+                    'posts_per_page' => -1,
269
+               ),
270
+          ) );
271
+     }
272 272
 }
Please login to merge, or discard this patch.
classes/post-types/class-workout.php 2 patches
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -32,16 +32,16 @@  discard block
 block discarded – undo
32 32
 	 * Contructor
33 33
 	 */
34 34
 	public function __construct() {
35
-		add_action( 'init', array( $this, 'register_post_type' ) );
36
-		add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
37
-		add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
38
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
39
-		add_action( 'cmb2_admin_init', array( $this, 'workout_connections' ), 15 );
40
-		add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 8, 1 );
41
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
35
+		add_action('init', array($this, 'register_post_type'));
36
+		add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1);
37
+		add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1);
38
+		add_action('cmb2_admin_init', array($this, 'details_metaboxes'));
39
+		add_action('cmb2_admin_init', array($this, 'workout_connections'), 15);
40
+		add_action('lsx_hp_settings_page', array($this, 'register_settings'), 8, 1);
41
+		add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100);
42 42
 
43 43
 		// Template Redirects.
44
-		add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
44
+		add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1);
45 45
 	}
46 46
 
47 47
 	/**
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public static function get_instance() {
55 55
 		// If the single instance hasn't been set, set it now.
56
-		if ( null === self::$instance ) {
56
+		if (null === self::$instance) {
57 57
 			self::$instance = new self();
58 58
 		}
59 59
 		return self::$instance;
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function register_post_type() {
65 65
 		$labels = array(
66
-			'name'               => esc_html__( 'Workout', 'lsx-health-plan' ),
67
-			'singular_name'      => esc_html__( 'Workouts', 'lsx-health-plan' ),
68
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
69
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
70
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
71
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
72
-			'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
73
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
74
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
75
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
76
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
66
+			'name'               => esc_html__('Workout', 'lsx-health-plan'),
67
+			'singular_name'      => esc_html__('Workouts', 'lsx-health-plan'),
68
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'),
69
+			'add_new_item'       => esc_html__('Add New', 'lsx-health-plan'),
70
+			'edit_item'          => esc_html__('Edit', 'lsx-health-plan'),
71
+			'new_item'           => esc_html__('New', 'lsx-health-plan'),
72
+			'all_items'          => esc_html__('All', 'lsx-health-plan'),
73
+			'view_item'          => esc_html__('View', 'lsx-health-plan'),
74
+			'search_items'       => esc_html__('Search', 'lsx-health-plan'),
75
+			'not_found'          => esc_html__('None found', 'lsx-health-plan'),
76
+			'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'),
77 77
 			'parent_item_colon'  => '',
78
-			'menu_name'          => esc_html__( 'Workouts', 'lsx-health-plan' ),
78
+			'menu_name'          => esc_html__('Workouts', 'lsx-health-plan'),
79 79
 		);
80 80
 		$args = array(
81 81
 			'labels'             => $labels,
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 			'menu_icon'          => 'dashicons-universal-access',
88 88
 			'query_var'          => true,
89 89
 			'rewrite'            => array(
90
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ),
90
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'),
91 91
 			),
92 92
 			'capability_type'    => 'page',
93
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_workout_archive', false ),
93
+			'has_archive'        => \lsx_health_plan\functions\get_option('endpoint_workout_archive', false),
94 94
 			'hierarchical'       => true,
95 95
 			'menu_position'      => null,
96 96
 			'supports'           => array(
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 				'excerpt',
101 101
 			),
102 102
 		);
103
-		register_post_type( 'workout', $args );
103
+		register_post_type('workout', $args);
104 104
 	}
105 105
 
106 106
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @param array $post_types
110 110
 	 * @return array
111 111
 	 */
112
-	public function enable_post_type( $post_types = array() ) {
112
+	public function enable_post_type($post_types = array()) {
113 113
 		$post_types[] = $this->slug;
114 114
 		return $post_types;
115 115
 	}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 * @param array $connections
121 121
 	 * @return void
122 122
 	 */
123
-	public function enable_connections( $connections = array() ) {
123
+	public function enable_connections($connections = array()) {
124 124
 		$connections['workout']['connected_plans'] = 'connected_workouts';
125 125
 		$connections['plan']['connected_workouts'] = 'connected_plans';
126 126
 
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 	 * @param string $title the term title.
139 139
 	 * @return string
140 140
 	 */
141
-	public function get_the_archive_title( $title ) {
142
-		if ( is_post_type_archive( 'workout' ) ) {
143
-			$title = __( 'Workouts', 'lsx-health-plan' );
141
+	public function get_the_archive_title($title) {
142
+		if (is_post_type_archive('workout')) {
143
+			$title = __('Workouts', 'lsx-health-plan');
144 144
 		}
145 145
 		return $title;
146 146
 	}
@@ -149,27 +149,27 @@  discard block
 block discarded – undo
149 149
 	 * Define the metabox and field configurations.
150 150
 	 */
151 151
 	public function details_metaboxes() {
152
-		$workout_sections = apply_filters( 'lsx_health_plan_workout_sections_amount', 6 );
153
-		if ( false !== $workout_sections && null !== $workout_sections ) {
152
+		$workout_sections = apply_filters('lsx_health_plan_workout_sections_amount', 6);
153
+		if (false !== $workout_sections && null !== $workout_sections) {
154 154
 			$i = 1;
155
-			while ( $i <= $workout_sections ) {
155
+			while ($i <= $workout_sections) {
156 156
 
157
-				$cmb_group = new_cmb2_box( array(
157
+				$cmb_group = new_cmb2_box(array(
158 158
 					'id'           => $this->slug . '_section_' . $i . '_metabox',
159
-					'title'        => esc_html__( 'Exercise Group ', 'lsx-health-plan' ) . $i,
160
-					'object_types' => array( $this->slug ),
161
-				) );
159
+					'title'        => esc_html__('Exercise Group ', 'lsx-health-plan') . $i,
160
+					'object_types' => array($this->slug),
161
+				));
162 162
 
163
-				$cmb_group->add_field( array(
164
-					'name'       => __( 'Title', 'lsx-health-plan' ),
163
+				$cmb_group->add_field(array(
164
+					'name'       => __('Title', 'lsx-health-plan'),
165 165
 					'id'         => $this->slug . '_section_' . $i . '_title',
166 166
 					'type'       => 'text',
167 167
 					'show_on_cb' => 'cmb2_hide_if_no_cats',
168
-				) );
168
+				));
169 169
 
170 170
 				$cmb_group->add_field(
171 171
 					array(
172
-						'name'       => __( 'Description', 'lsx-health-plan' ),
172
+						'name'       => __('Description', 'lsx-health-plan'),
173 173
 						'id'         => $this->slug . '_section_' . $i . '_description',
174 174
 						'type'       => 'wysiwyg',
175 175
 						'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -188,27 +188,27 @@  discard block
 block discarded – undo
188 188
 						'id'      => $this->slug . '_section_' . $i,
189 189
 						'type'    => 'group',
190 190
 						'options' => array(
191
-							'group_title'   => esc_html__( 'Exercise {#}', 'lsx-health-plan' ), // {#} gets replaced by row number
192
-							'add_button'    => esc_html__( 'Add New', 'lsx-health-plan' ),
193
-							'remove_button' => esc_html__( 'Delete', 'lsx-health-plan' ),
191
+							'group_title'   => esc_html__('Exercise {#}', 'lsx-health-plan'), // {#} gets replaced by row number
192
+							'add_button'    => esc_html__('Add New', 'lsx-health-plan'),
193
+							'remove_button' => esc_html__('Delete', 'lsx-health-plan'),
194 194
 							'sortable'      => true,
195 195
 						),
196 196
 					)
197 197
 				);
198 198
 
199
-				if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
199
+				if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
200 200
 					$cmb_group->add_group_field(
201 201
 						$group_field_id,
202 202
 						array(
203
-							'name'       => __( 'Exercise related to this workout', 'lsx-health-plan' ),
203
+							'name'       => __('Exercise related to this workout', 'lsx-health-plan'),
204 204
 							'id'         => 'connected_exercises',
205 205
 							'type'       => 'post_search_ajax',
206 206
 							// Optional :
207 207
 							'limit'      => 1, // Limit selection to X items only (default 1)
208
-							'sortable'   => true,  // Allow selected items to be sortable (default false)
208
+							'sortable'   => true, // Allow selected items to be sortable (default false)
209 209
 							'query_args' => array(
210
-								'post_type'      => array( 'exercise' ),
211
-								'post_status'    => array( 'publish' ),
210
+								'post_type'      => array('exercise'),
211
+								'post_status'    => array('publish'),
212 212
 								'posts_per_page' => -1,
213 213
 							),
214 214
 						)
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
 					$cmb_group->add_group_field(
218 218
 						$group_field_id,
219 219
 						array(
220
-							'name'       => __( 'Video related to this workout', 'lsx-health-plan' ),
220
+							'name'       => __('Video related to this workout', 'lsx-health-plan'),
221 221
 							'id'         => 'connected_videos',
222 222
 							'type'       => 'post_search_ajax',
223 223
 							// Optional :
224 224
 							'limit'      => 1, // Limit selection to X items only (default 1)
225
-							'sortable'   => true,  // Allow selected items to be sortable (default false)
225
+							'sortable'   => true, // Allow selected items to be sortable (default false)
226 226
 							'query_args' => array(
227
-								'post_type'      => array( 'video' ),
228
-								'post_status'    => array( 'publish' ),
227
+								'post_type'      => array('video'),
228
+								'post_status'    => array('publish'),
229 229
 								'posts_per_page' => -1,
230 230
 							),
231 231
 						)
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 					$cmb_group->add_group_field(
234 234
 						$group_field_id,
235 235
 						array(
236
-							'name' => esc_html__( 'Workout Name', 'lsx-health-plan' ),
236
+							'name' => esc_html__('Workout Name', 'lsx-health-plan'),
237 237
 							'id'   => 'name',
238 238
 							'type' => 'text',
239 239
 							// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 					$cmb_group->add_group_field(
244 244
 						$group_field_id,
245 245
 						array(
246
-							'name'    => __( 'Description', 'lsx-health-plan' ),
246
+							'name'    => __('Description', 'lsx-health-plan'),
247 247
 							'id'      => 'description',
248 248
 							'type'    => 'wysiwyg',
249 249
 							'options' => array(
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 				$cmb_group->add_group_field(
257 257
 					$group_field_id,
258 258
 					array(
259
-						'name' => esc_html__( 'Reps / Time / Distance', 'lsx-health-plan' ),
259
+						'name' => esc_html__('Reps / Time / Distance', 'lsx-health-plan'),
260 260
 						'id'   => 'reps',
261 261
 						'type' => 'text',
262 262
 						// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 		$cmb = new_cmb2_box(
277 277
 			array(
278 278
 				'id'           => $this->slug . '_workout_connections_metabox',
279
-				'title'        => __( 'Workouts', 'lsx-health-plan' ),
280
-				'desc'         => __( 'Start typing to search for your workouts', 'lsx-health-plan' ),
281
-				'object_types' => array( 'plan' ),
279
+				'title'        => __('Workouts', 'lsx-health-plan'),
280
+				'desc'         => __('Start typing to search for your workouts', 'lsx-health-plan'),
281
+				'object_types' => array('plan'),
282 282
 				'context'      => 'normal',
283 283
 				'priority'     => 'high',
284 284
 				'show_names'   => true,
@@ -286,22 +286,22 @@  discard block
 block discarded – undo
286 286
 		);
287 287
 		$cmb->add_field(
288 288
 			array(
289
-				'name'       => __( 'Workouts', 'lsx-health-plan' ),
289
+				'name'       => __('Workouts', 'lsx-health-plan'),
290 290
 				'id'         => 'connected_workouts',
291
-				'desc'       => __( 'Connect the workout that applies to this day plan using the field provided.', 'lsx-health-plan' ),
291
+				'desc'       => __('Connect the workout that applies to this day plan using the field provided.', 'lsx-health-plan'),
292 292
 				'type'       => 'post_search_ajax',
293 293
 				'limit'      => 15,
294 294
 				'sortable'   => true,
295 295
 				'query_args' => array(
296
-					'post_type'      => array( 'workout' ),
297
-					'post_status'    => array( 'publish' ),
296
+					'post_type'      => array('workout'),
297
+					'post_status'    => array('publish'),
298 298
 					'posts_per_page' => -1,
299 299
 				),
300 300
 			)
301 301
 		);
302 302
 		$cmb->add_field(
303 303
 			array(
304
-				'name'       => __( 'Pre Workout Snack', 'lsx-health-plan' ),
304
+				'name'       => __('Pre Workout Snack', 'lsx-health-plan'),
305 305
 				'id'         => 'pre_workout_snack',
306 306
 				'type'       => 'wysiwyg',
307 307
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		);
313 313
 		$cmb->add_field(
314 314
 			array(
315
-				'name'       => __( 'Post Workout Snack', 'lsx-health-plan' ),
315
+				'name'       => __('Post Workout Snack', 'lsx-health-plan'),
316 316
 				'id'         => 'post_workout_snack',
317 317
 				'type'       => 'wysiwyg',
318 318
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -329,14 +329,14 @@  discard block
 block discarded – undo
329 329
 	 * @param object $cmb new_cmb2_box().
330 330
 	 * @return void
331 331
 	 */
332
-	public function register_settings( $cmb ) {
333
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
332
+	public function register_settings($cmb) {
333
+		if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
334 334
 			$cmb->add_field(
335 335
 				array(
336 336
 					'id'          => 'workout_settings_title',
337 337
 					'type'        => 'title',
338
-					'name'        => __( 'Workout Settings', 'lsx-health-plan' ),
339
-					'description' => __( 'Choose the layout, content and link settings for your exercises.', 'lsx-health-plan' ),
338
+					'name'        => __('Workout Settings', 'lsx-health-plan'),
339
+					'description' => __('Choose the layout, content and link settings for your exercises.', 'lsx-health-plan'),
340 340
 				)
341 341
 			);
342 342
 
@@ -344,12 +344,12 @@  discard block
 block discarded – undo
344 344
 				array(
345 345
 					'id'          => 'workout_tab_layout',
346 346
 					'type'        => 'select',
347
-					'name'        => __( 'Workout Tab Layout', 'lsx-health-plan' ),
348
-					'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ),
347
+					'name'        => __('Workout Tab Layout', 'lsx-health-plan'),
348
+					'description' => __('Choose the layout for the workouts.', 'lsx-health-plan'),
349 349
 					'options'     => array(
350
-						'table' => __( 'Table', 'lsx-health-plan' ),
351
-						'list'  => __( 'List', 'lsx-health-plan' ),
352
-						'grid'  => __( 'Grid', 'lsx-health-plan' ),
350
+						'table' => __('Table', 'lsx-health-plan'),
351
+						'list'  => __('List', 'lsx-health-plan'),
352
+						'grid'  => __('Grid', 'lsx-health-plan'),
353 353
 					),
354 354
 				)
355 355
 			);
@@ -357,12 +357,12 @@  discard block
 block discarded – undo
357 357
 				array(
358 358
 					'id'          => 'workout_tab_link',
359 359
 					'type'        => 'select',
360
-					'name'        => __( 'Workout Tab Link', 'lsx-health-plan' ),
361
-					'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ),
360
+					'name'        => __('Workout Tab Link', 'lsx-health-plan'),
361
+					'description' => __('Choose to show the excerpt, full content or nothing.', 'lsx-health-plan'),
362 362
 					'options'     => array(
363
-						''       => __( 'None', 'lsx-health-plan' ),
364
-						'single' => __( 'Single', 'lsx-health-plan' ),
365
-						'modal'  => __( 'Modal', 'lsx-health-plan' ),
363
+						''       => __('None', 'lsx-health-plan'),
364
+						'single' => __('Single', 'lsx-health-plan'),
365
+						'modal'  => __('Modal', 'lsx-health-plan'),
366 366
 					),
367 367
 					'default' => 'modal',
368 368
 				)
@@ -371,12 +371,12 @@  discard block
 block discarded – undo
371 371
 				array(
372 372
 					'id'          => 'workout_tab_modal_content',
373 373
 					'type'        => 'select',
374
-					'name'        => __( 'Modal Content', 'lsx-health-plan' ),
375
-					'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ),
374
+					'name'        => __('Modal Content', 'lsx-health-plan'),
375
+					'description' => __('Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan'),
376 376
 					'options'     => array(
377
-						''        => __( 'None', 'lsx-health-plan' ),
378
-						'excerpt' => __( 'Excerpt', 'lsx-health-plan' ),
379
-						'full'    => __( 'Full Content', 'lsx-health-plan' ),
377
+						''        => __('None', 'lsx-health-plan'),
378
+						'excerpt' => __('Excerpt', 'lsx-health-plan'),
379
+						'full'    => __('Full Content', 'lsx-health-plan'),
380 380
 					),
381 381
 					'default' => '',
382 382
 				)
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
 				array(
386 386
 					'id'          => 'workout_tab_columns',
387 387
 					'type'        => 'select',
388
-					'name'        => __( 'Grid Columns', 'lsx-health-plan' ),
389
-					'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ),
388
+					'name'        => __('Grid Columns', 'lsx-health-plan'),
389
+					'description' => __('If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan'),
390 390
 					'options'     => array(
391
-						'12' => __( '1', 'lsx-health-plan' ),
392
-						'6'  => __( '2', 'lsx-health-plan' ),
393
-						'4'  => __( '3', 'lsx-health-plan' ),
394
-						'3'  => __( '4', 'lsx-health-plan' ),
395
-						'2'  => __( '6', 'lsx-health-plan' ),
391
+						'12' => __('1', 'lsx-health-plan'),
392
+						'6'  => __('2', 'lsx-health-plan'),
393
+						'4'  => __('3', 'lsx-health-plan'),
394
+						'3'  => __('4', 'lsx-health-plan'),
395
+						'2'  => __('6', 'lsx-health-plan'),
396 396
 					),
397 397
 					'default' => '4',
398 398
 				)
@@ -401,18 +401,18 @@  discard block
 block discarded – undo
401 401
 				array(
402 402
 					'id'          => 'workout_tab_content',
403 403
 					'type'        => 'select',
404
-					'name'        => __( 'Grid Content', 'lsx-health-plan' ),
405
-					'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ),
404
+					'name'        => __('Grid Content', 'lsx-health-plan'),
405
+					'description' => __('Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan'),
406 406
 					'options'     => array(
407
-						''        => __( 'None', 'lsx-health-plan' ),
408
-						'excerpt' => __( 'Excerpt', 'lsx-health-plan' ),
409
-						'full'    => __( 'Full Content', 'lsx-health-plan' ),
407
+						''        => __('None', 'lsx-health-plan'),
408
+						'excerpt' => __('Excerpt', 'lsx-health-plan'),
409
+						'full'    => __('Full Content', 'lsx-health-plan'),
410 410
 					),
411 411
 					'default' => '',
412 412
 				)
413 413
 			);
414 414
 
415
-			do_action( 'lsx_hp_workout_settings_page', $cmb );
415
+			do_action('lsx_hp_workout_settings_page', $cmb);
416 416
 
417 417
 			$cmb->add_field(
418 418
 				array(
Please login to merge, or discard this patch.
Indentation   +390 added lines, -390 removed lines patch added patch discarded remove patch
@@ -10,416 +10,416 @@
 block discarded – undo
10 10
  */
11 11
 class Workout {
12 12
 
13
-	/**
14
-	 * Holds class instance
15
-	 *
16
-	 * @since 1.0.0
17
-	 *
18
-	 * @var      object \lsx_health_plan\classes\Workout()
19
-	 */
20
-	protected static $instance = null;
13
+     /**
14
+      * Holds class instance
15
+      *
16
+      * @since 1.0.0
17
+      *
18
+      * @var      object \lsx_health_plan\classes\Workout()
19
+      */
20
+     protected static $instance = null;
21 21
 
22
-	/**
23
-	 * Holds post_type slug used as an index
24
-	 *
25
-	 * @since 1.0.0
26
-	 *
27
-	 * @var      string
28
-	 */
29
-	public $slug = 'workout';
22
+     /**
23
+      * Holds post_type slug used as an index
24
+      *
25
+      * @since 1.0.0
26
+      *
27
+      * @var      string
28
+      */
29
+     public $slug = 'workout';
30 30
 
31
-	/**
32
-	 * Contructor
33
-	 */
34
-	public function __construct() {
35
-		add_action( 'init', array( $this, 'register_post_type' ) );
36
-		add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
37
-		add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
38
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
39
-		add_action( 'cmb2_admin_init', array( $this, 'workout_connections' ), 15 );
40
-		add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 8, 1 );
41
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
31
+     /**
32
+      * Contructor
33
+      */
34
+     public function __construct() {
35
+          add_action( 'init', array( $this, 'register_post_type' ) );
36
+          add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
37
+          add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
38
+          add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
39
+          add_action( 'cmb2_admin_init', array( $this, 'workout_connections' ), 15 );
40
+          add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 8, 1 );
41
+          add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
42 42
 
43
-		// Template Redirects.
44
-		add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
45
-	}
43
+          // Template Redirects.
44
+          add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
45
+     }
46 46
 
47
-	/**
48
-	 * Return an instance of this class.
49
-	 *
50
-	 * @since 1.0.0
51
-	 *
52
-	 * @return    object \lsx_health_plan\classes\Workout()    A single instance of this class.
53
-	 */
54
-	public static function get_instance() {
55
-		// If the single instance hasn't been set, set it now.
56
-		if ( null === self::$instance ) {
57
-			self::$instance = new self();
58
-		}
59
-		return self::$instance;
60
-	}
61
-	/**
62
-	 * Register the post type.
63
-	 */
64
-	public function register_post_type() {
65
-		$labels = array(
66
-			'name'               => esc_html__( 'Workout', 'lsx-health-plan' ),
67
-			'singular_name'      => esc_html__( 'Workouts', 'lsx-health-plan' ),
68
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
69
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
70
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
71
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
72
-			'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
73
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
74
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
75
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
76
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
77
-			'parent_item_colon'  => '',
78
-			'menu_name'          => esc_html__( 'Workouts', 'lsx-health-plan' ),
79
-		);
80
-		$args = array(
81
-			'labels'             => $labels,
82
-			'public'             => true,
83
-			'publicly_queryable' => true,
84
-			'show_ui'            => true,
85
-			'show_in_menu'       => true,
86
-			'show_in_rest'       => true,
87
-			'menu_icon'          => 'dashicons-universal-access',
88
-			'query_var'          => true,
89
-			'rewrite'            => array(
90
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ),
91
-			),
92
-			'capability_type'    => 'page',
93
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_workout_archive', false ),
94
-			'hierarchical'       => true,
95
-			'menu_position'      => null,
96
-			'supports'           => array(
97
-				'title',
98
-				'thumbnail',
99
-				'editor',
100
-				'excerpt',
101
-			),
102
-		);
103
-		register_post_type( 'workout', $args );
104
-	}
47
+     /**
48
+      * Return an instance of this class.
49
+      *
50
+      * @since 1.0.0
51
+      *
52
+      * @return    object \lsx_health_plan\classes\Workout()    A single instance of this class.
53
+      */
54
+     public static function get_instance() {
55
+          // If the single instance hasn't been set, set it now.
56
+          if ( null === self::$instance ) {
57
+               self::$instance = new self();
58
+          }
59
+          return self::$instance;
60
+     }
61
+     /**
62
+      * Register the post type.
63
+      */
64
+     public function register_post_type() {
65
+          $labels = array(
66
+               'name'               => esc_html__( 'Workout', 'lsx-health-plan' ),
67
+               'singular_name'      => esc_html__( 'Workouts', 'lsx-health-plan' ),
68
+               'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
69
+               'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
70
+               'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
71
+               'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
72
+               'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
73
+               'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
74
+               'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
75
+               'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
76
+               'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
77
+               'parent_item_colon'  => '',
78
+               'menu_name'          => esc_html__( 'Workouts', 'lsx-health-plan' ),
79
+          );
80
+          $args = array(
81
+               'labels'             => $labels,
82
+               'public'             => true,
83
+               'publicly_queryable' => true,
84
+               'show_ui'            => true,
85
+               'show_in_menu'       => true,
86
+               'show_in_rest'       => true,
87
+               'menu_icon'          => 'dashicons-universal-access',
88
+               'query_var'          => true,
89
+               'rewrite'            => array(
90
+                    'slug' => \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ),
91
+               ),
92
+               'capability_type'    => 'page',
93
+               'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_workout_archive', false ),
94
+               'hierarchical'       => true,
95
+               'menu_position'      => null,
96
+               'supports'           => array(
97
+                    'title',
98
+                    'thumbnail',
99
+                    'editor',
100
+                    'excerpt',
101
+               ),
102
+          );
103
+          register_post_type( 'workout', $args );
104
+     }
105 105
 
106
-	/**
107
-	 * Adds the post type to the different arrays.
108
-	 *
109
-	 * @param array $post_types
110
-	 * @return array
111
-	 */
112
-	public function enable_post_type( $post_types = array() ) {
113
-		$post_types[] = $this->slug;
114
-		return $post_types;
115
-	}
106
+     /**
107
+      * Adds the post type to the different arrays.
108
+      *
109
+      * @param array $post_types
110
+      * @return array
111
+      */
112
+     public function enable_post_type( $post_types = array() ) {
113
+          $post_types[] = $this->slug;
114
+          return $post_types;
115
+     }
116 116
 
117
-	/**
118
-	 * Enables the Bi Directional relationships
119
-	 *
120
-	 * @param array $connections
121
-	 * @return void
122
-	 */
123
-	public function enable_connections( $connections = array() ) {
124
-		$connections['workout']['connected_plans'] = 'connected_workouts';
125
-		$connections['plan']['connected_workouts'] = 'connected_plans';
117
+     /**
118
+      * Enables the Bi Directional relationships
119
+      *
120
+      * @param array $connections
121
+      * @return void
122
+      */
123
+     public function enable_connections( $connections = array() ) {
124
+          $connections['workout']['connected_plans'] = 'connected_workouts';
125
+          $connections['plan']['connected_workouts'] = 'connected_plans';
126 126
 
127
-		$connections['workout']['connected_videos'] = 'connected_workouts';
128
-		$connections['video']['connected_workouts'] = 'connected_videos';
127
+          $connections['workout']['connected_videos'] = 'connected_workouts';
128
+          $connections['video']['connected_workouts'] = 'connected_videos';
129 129
 
130
-		$connections['workout']['connected_posts'] = 'connected_workouts';
131
-		$connections['post']['connected_workouts'] = 'connected_posts';
132
-		return $connections;
133
-	}
130
+          $connections['workout']['connected_posts'] = 'connected_workouts';
131
+          $connections['post']['connected_workouts'] = 'connected_posts';
132
+          return $connections;
133
+     }
134 134
 
135
-	/**
136
-	 * Remove the "Archives:" from the post type workouts.
137
-	 *
138
-	 * @param string $title the term title.
139
-	 * @return string
140
-	 */
141
-	public function get_the_archive_title( $title ) {
142
-		if ( is_post_type_archive( 'workout' ) ) {
143
-			$title = __( 'Workouts', 'lsx-health-plan' );
144
-		}
145
-		return $title;
146
-	}
135
+     /**
136
+      * Remove the "Archives:" from the post type workouts.
137
+      *
138
+      * @param string $title the term title.
139
+      * @return string
140
+      */
141
+     public function get_the_archive_title( $title ) {
142
+          if ( is_post_type_archive( 'workout' ) ) {
143
+               $title = __( 'Workouts', 'lsx-health-plan' );
144
+          }
145
+          return $title;
146
+     }
147 147
 
148
-	/**
149
-	 * Define the metabox and field configurations.
150
-	 */
151
-	public function details_metaboxes() {
152
-		$workout_sections = apply_filters( 'lsx_health_plan_workout_sections_amount', 6 );
153
-		if ( false !== $workout_sections && null !== $workout_sections ) {
154
-			$i = 1;
155
-			while ( $i <= $workout_sections ) {
148
+     /**
149
+      * Define the metabox and field configurations.
150
+      */
151
+     public function details_metaboxes() {
152
+          $workout_sections = apply_filters( 'lsx_health_plan_workout_sections_amount', 6 );
153
+          if ( false !== $workout_sections && null !== $workout_sections ) {
154
+               $i = 1;
155
+               while ( $i <= $workout_sections ) {
156 156
 
157
-				$cmb_group = new_cmb2_box( array(
158
-					'id'           => $this->slug . '_section_' . $i . '_metabox',
159
-					'title'        => esc_html__( 'Exercise Group ', 'lsx-health-plan' ) . $i,
160
-					'object_types' => array( $this->slug ),
161
-				) );
157
+                    $cmb_group = new_cmb2_box( array(
158
+                         'id'           => $this->slug . '_section_' . $i . '_metabox',
159
+                         'title'        => esc_html__( 'Exercise Group ', 'lsx-health-plan' ) . $i,
160
+                         'object_types' => array( $this->slug ),
161
+                    ) );
162 162
 
163
-				$cmb_group->add_field( array(
164
-					'name'       => __( 'Title', 'lsx-health-plan' ),
165
-					'id'         => $this->slug . '_section_' . $i . '_title',
166
-					'type'       => 'text',
167
-					'show_on_cb' => 'cmb2_hide_if_no_cats',
168
-				) );
163
+                    $cmb_group->add_field( array(
164
+                         'name'       => __( 'Title', 'lsx-health-plan' ),
165
+                         'id'         => $this->slug . '_section_' . $i . '_title',
166
+                         'type'       => 'text',
167
+                         'show_on_cb' => 'cmb2_hide_if_no_cats',
168
+                    ) );
169 169
 
170
-				$cmb_group->add_field(
171
-					array(
172
-						'name'       => __( 'Description', 'lsx-health-plan' ),
173
-						'id'         => $this->slug . '_section_' . $i . '_description',
174
-						'type'       => 'wysiwyg',
175
-						'show_on_cb' => 'cmb2_hide_if_no_cats',
176
-						'options'    => array(
177
-							'textarea_rows' => 5,
178
-						),
179
-					)
180
-				);
170
+                    $cmb_group->add_field(
171
+                         array(
172
+                              'name'       => __( 'Description', 'lsx-health-plan' ),
173
+                              'id'         => $this->slug . '_section_' . $i . '_description',
174
+                              'type'       => 'wysiwyg',
175
+                              'show_on_cb' => 'cmb2_hide_if_no_cats',
176
+                              'options'    => array(
177
+                                   'textarea_rows' => 5,
178
+                              ),
179
+                         )
180
+                    );
181 181
 
182
-				/**
183
-				 * Repeatable Field Groups
184
-				 */
185
-				// $group_field_id is the field id string, so in this case: $prefix . 'demo'
186
-				$group_field_id = $cmb_group->add_field(
187
-					array(
188
-						'id'      => $this->slug . '_section_' . $i,
189
-						'type'    => 'group',
190
-						'options' => array(
191
-							'group_title'   => esc_html__( 'Exercise {#}', 'lsx-health-plan' ), // {#} gets replaced by row number
192
-							'add_button'    => esc_html__( 'Add New', 'lsx-health-plan' ),
193
-							'remove_button' => esc_html__( 'Delete', 'lsx-health-plan' ),
194
-							'sortable'      => true,
195
-						),
196
-					)
197
-				);
182
+                    /**
183
+                     * Repeatable Field Groups
184
+                     */
185
+                    // $group_field_id is the field id string, so in this case: $prefix . 'demo'
186
+                    $group_field_id = $cmb_group->add_field(
187
+                         array(
188
+                              'id'      => $this->slug . '_section_' . $i,
189
+                              'type'    => 'group',
190
+                              'options' => array(
191
+                                   'group_title'   => esc_html__( 'Exercise {#}', 'lsx-health-plan' ), // {#} gets replaced by row number
192
+                                   'add_button'    => esc_html__( 'Add New', 'lsx-health-plan' ),
193
+                                   'remove_button' => esc_html__( 'Delete', 'lsx-health-plan' ),
194
+                                   'sortable'      => true,
195
+                              ),
196
+                         )
197
+                    );
198 198
 
199
-				if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
200
-					$cmb_group->add_group_field(
201
-						$group_field_id,
202
-						array(
203
-							'name'       => __( 'Exercise related to this workout', 'lsx-health-plan' ),
204
-							'id'         => 'connected_exercises',
205
-							'type'       => 'post_search_ajax',
206
-							// Optional :
207
-							'limit'      => 1, // Limit selection to X items only (default 1)
208
-							'sortable'   => true,  // Allow selected items to be sortable (default false)
209
-							'query_args' => array(
210
-								'post_type'      => array( 'exercise' ),
211
-								'post_status'    => array( 'publish' ),
212
-								'posts_per_page' => -1,
213
-							),
214
-						)
215
-					);
216
-				} else {
217
-					$cmb_group->add_group_field(
218
-						$group_field_id,
219
-						array(
220
-							'name'       => __( 'Video related to this workout', 'lsx-health-plan' ),
221
-							'id'         => 'connected_videos',
222
-							'type'       => 'post_search_ajax',
223
-							// Optional :
224
-							'limit'      => 1, // Limit selection to X items only (default 1)
225
-							'sortable'   => true,  // Allow selected items to be sortable (default false)
226
-							'query_args' => array(
227
-								'post_type'      => array( 'video' ),
228
-								'post_status'    => array( 'publish' ),
229
-								'posts_per_page' => -1,
230
-							),
231
-						)
232
-					);
233
-					$cmb_group->add_group_field(
234
-						$group_field_id,
235
-						array(
236
-							'name' => esc_html__( 'Workout Name', 'lsx-health-plan' ),
237
-							'id'   => 'name',
238
-							'type' => 'text',
239
-							// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
240
-						)
241
-					);
199
+                    if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
200
+                         $cmb_group->add_group_field(
201
+                              $group_field_id,
202
+                              array(
203
+                                   'name'       => __( 'Exercise related to this workout', 'lsx-health-plan' ),
204
+                                   'id'         => 'connected_exercises',
205
+                                   'type'       => 'post_search_ajax',
206
+                                   // Optional :
207
+                                   'limit'      => 1, // Limit selection to X items only (default 1)
208
+                                   'sortable'   => true,  // Allow selected items to be sortable (default false)
209
+                                   'query_args' => array(
210
+                                        'post_type'      => array( 'exercise' ),
211
+                                        'post_status'    => array( 'publish' ),
212
+                                        'posts_per_page' => -1,
213
+                                   ),
214
+                              )
215
+                         );
216
+                    } else {
217
+                         $cmb_group->add_group_field(
218
+                              $group_field_id,
219
+                              array(
220
+                                   'name'       => __( 'Video related to this workout', 'lsx-health-plan' ),
221
+                                   'id'         => 'connected_videos',
222
+                                   'type'       => 'post_search_ajax',
223
+                                   // Optional :
224
+                                   'limit'      => 1, // Limit selection to X items only (default 1)
225
+                                   'sortable'   => true,  // Allow selected items to be sortable (default false)
226
+                                   'query_args' => array(
227
+                                        'post_type'      => array( 'video' ),
228
+                                        'post_status'    => array( 'publish' ),
229
+                                        'posts_per_page' => -1,
230
+                                   ),
231
+                              )
232
+                         );
233
+                         $cmb_group->add_group_field(
234
+                              $group_field_id,
235
+                              array(
236
+                                   'name' => esc_html__( 'Workout Name', 'lsx-health-plan' ),
237
+                                   'id'   => 'name',
238
+                                   'type' => 'text',
239
+                                   // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
240
+                              )
241
+                         );
242 242
 
243
-					$cmb_group->add_group_field(
244
-						$group_field_id,
245
-						array(
246
-							'name'    => __( 'Description', 'lsx-health-plan' ),
247
-							'id'      => 'description',
248
-							'type'    => 'wysiwyg',
249
-							'options' => array(
250
-								'textarea_rows' => 2,
251
-							),
252
-						)
253
-					);
254
-				}
243
+                         $cmb_group->add_group_field(
244
+                              $group_field_id,
245
+                              array(
246
+                                   'name'    => __( 'Description', 'lsx-health-plan' ),
247
+                                   'id'      => 'description',
248
+                                   'type'    => 'wysiwyg',
249
+                                   'options' => array(
250
+                                        'textarea_rows' => 2,
251
+                                   ),
252
+                              )
253
+                         );
254
+                    }
255 255
 
256
-				$cmb_group->add_group_field(
257
-					$group_field_id,
258
-					array(
259
-						'name' => esc_html__( 'Reps / Time / Distance', 'lsx-health-plan' ),
260
-						'id'   => 'reps',
261
-						'type' => 'text',
262
-						// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
263
-					)
264
-				);
265
-				$i++;
266
-			};
267
-		}
268
-	}
256
+                    $cmb_group->add_group_field(
257
+                         $group_field_id,
258
+                         array(
259
+                              'name' => esc_html__( 'Reps / Time / Distance', 'lsx-health-plan' ),
260
+                              'id'   => 'reps',
261
+                              'type' => 'text',
262
+                              // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
263
+                         )
264
+                    );
265
+                    $i++;
266
+               };
267
+          }
268
+     }
269 269
 
270
-	/**
271
-	 * Registers the workout connections on the plan post type.
272
-	 *
273
-	 * @return void
274
-	 */
275
-	public function workout_connections() {
276
-		$cmb = new_cmb2_box(
277
-			array(
278
-				'id'           => $this->slug . '_workout_connections_metabox',
279
-				'title'        => __( 'Workouts', 'lsx-health-plan' ),
280
-				'desc'         => __( 'Start typing to search for your workouts', 'lsx-health-plan' ),
281
-				'object_types' => array( 'plan' ),
282
-				'context'      => 'normal',
283
-				'priority'     => 'high',
284
-				'show_names'   => true,
285
-			)
286
-		);
287
-		$cmb->add_field(
288
-			array(
289
-				'name'       => __( 'Workouts', 'lsx-health-plan' ),
290
-				'id'         => 'connected_workouts',
291
-				'desc'       => __( 'Connect the workout that applies to this day plan using the field provided.', 'lsx-health-plan' ),
292
-				'type'       => 'post_search_ajax',
293
-				'limit'      => 15,
294
-				'sortable'   => true,
295
-				'query_args' => array(
296
-					'post_type'      => array( 'workout' ),
297
-					'post_status'    => array( 'publish' ),
298
-					'posts_per_page' => -1,
299
-				),
300
-			)
301
-		);
302
-		$cmb->add_field(
303
-			array(
304
-				'name'       => __( 'Pre Workout Snack', 'lsx-health-plan' ),
305
-				'id'         => 'pre_workout_snack',
306
-				'type'       => 'wysiwyg',
307
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
308
-				'options'    => array(
309
-					'textarea_rows' => 5,
310
-				),
311
-			)
312
-		);
313
-		$cmb->add_field(
314
-			array(
315
-				'name'       => __( 'Post Workout Snack', 'lsx-health-plan' ),
316
-				'id'         => 'post_workout_snack',
317
-				'type'       => 'wysiwyg',
318
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
319
-				'options'    => array(
320
-					'textarea_rows' => 5,
321
-				),
322
-			)
323
-		);
324
-	}
270
+     /**
271
+      * Registers the workout connections on the plan post type.
272
+      *
273
+      * @return void
274
+      */
275
+     public function workout_connections() {
276
+          $cmb = new_cmb2_box(
277
+               array(
278
+                    'id'           => $this->slug . '_workout_connections_metabox',
279
+                    'title'        => __( 'Workouts', 'lsx-health-plan' ),
280
+                    'desc'         => __( 'Start typing to search for your workouts', 'lsx-health-plan' ),
281
+                    'object_types' => array( 'plan' ),
282
+                    'context'      => 'normal',
283
+                    'priority'     => 'high',
284
+                    'show_names'   => true,
285
+               )
286
+          );
287
+          $cmb->add_field(
288
+               array(
289
+                    'name'       => __( 'Workouts', 'lsx-health-plan' ),
290
+                    'id'         => 'connected_workouts',
291
+                    'desc'       => __( 'Connect the workout that applies to this day plan using the field provided.', 'lsx-health-plan' ),
292
+                    'type'       => 'post_search_ajax',
293
+                    'limit'      => 15,
294
+                    'sortable'   => true,
295
+                    'query_args' => array(
296
+                         'post_type'      => array( 'workout' ),
297
+                         'post_status'    => array( 'publish' ),
298
+                         'posts_per_page' => -1,
299
+                    ),
300
+               )
301
+          );
302
+          $cmb->add_field(
303
+               array(
304
+                    'name'       => __( 'Pre Workout Snack', 'lsx-health-plan' ),
305
+                    'id'         => 'pre_workout_snack',
306
+                    'type'       => 'wysiwyg',
307
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
308
+                    'options'    => array(
309
+                         'textarea_rows' => 5,
310
+                    ),
311
+               )
312
+          );
313
+          $cmb->add_field(
314
+               array(
315
+                    'name'       => __( 'Post Workout Snack', 'lsx-health-plan' ),
316
+                    'id'         => 'post_workout_snack',
317
+                    'type'       => 'wysiwyg',
318
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
319
+                    'options'    => array(
320
+                         'textarea_rows' => 5,
321
+                    ),
322
+               )
323
+          );
324
+     }
325 325
 
326
-	/**
327
-	 * Registers the lsx_search_settings
328
-	 *
329
-	 * @param object $cmb new_cmb2_box().
330
-	 * @return void
331
-	 */
332
-	public function register_settings( $cmb ) {
333
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
334
-			$cmb->add_field(
335
-				array(
336
-					'id'          => 'workout_settings_title',
337
-					'type'        => 'title',
338
-					'name'        => __( 'Workout Settings', 'lsx-health-plan' ),
339
-					'description' => __( 'Choose the layout, content and link settings for your exercises.', 'lsx-health-plan' ),
340
-				)
341
-			);
326
+     /**
327
+      * Registers the lsx_search_settings
328
+      *
329
+      * @param object $cmb new_cmb2_box().
330
+      * @return void
331
+      */
332
+     public function register_settings( $cmb ) {
333
+          if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
334
+               $cmb->add_field(
335
+                    array(
336
+                         'id'          => 'workout_settings_title',
337
+                         'type'        => 'title',
338
+                         'name'        => __( 'Workout Settings', 'lsx-health-plan' ),
339
+                         'description' => __( 'Choose the layout, content and link settings for your exercises.', 'lsx-health-plan' ),
340
+                    )
341
+               );
342 342
 
343
-			$cmb->add_field(
344
-				array(
345
-					'id'          => 'workout_tab_layout',
346
-					'type'        => 'select',
347
-					'name'        => __( 'Workout Tab Layout', 'lsx-health-plan' ),
348
-					'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ),
349
-					'options'     => array(
350
-						'table' => __( 'Table', 'lsx-health-plan' ),
351
-						'list'  => __( 'List', 'lsx-health-plan' ),
352
-						'grid'  => __( 'Grid', 'lsx-health-plan' ),
353
-					),
354
-				)
355
-			);
356
-			$cmb->add_field(
357
-				array(
358
-					'id'          => 'workout_tab_link',
359
-					'type'        => 'select',
360
-					'name'        => __( 'Workout Tab Link', 'lsx-health-plan' ),
361
-					'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ),
362
-					'options'     => array(
363
-						''       => __( 'None', 'lsx-health-plan' ),
364
-						'single' => __( 'Single', 'lsx-health-plan' ),
365
-						'modal'  => __( 'Modal', 'lsx-health-plan' ),
366
-					),
367
-					'default' => 'modal',
368
-				)
369
-			);
370
-			$cmb->add_field(
371
-				array(
372
-					'id'          => 'workout_tab_modal_content',
373
-					'type'        => 'select',
374
-					'name'        => __( 'Modal Content', 'lsx-health-plan' ),
375
-					'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ),
376
-					'options'     => array(
377
-						''        => __( 'None', 'lsx-health-plan' ),
378
-						'excerpt' => __( 'Excerpt', 'lsx-health-plan' ),
379
-						'full'    => __( 'Full Content', 'lsx-health-plan' ),
380
-					),
381
-					'default' => '',
382
-				)
383
-			);
384
-			$cmb->add_field(
385
-				array(
386
-					'id'          => 'workout_tab_columns',
387
-					'type'        => 'select',
388
-					'name'        => __( 'Grid Columns', 'lsx-health-plan' ),
389
-					'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ),
390
-					'options'     => array(
391
-						'12' => __( '1', 'lsx-health-plan' ),
392
-						'6'  => __( '2', 'lsx-health-plan' ),
393
-						'4'  => __( '3', 'lsx-health-plan' ),
394
-						'3'  => __( '4', 'lsx-health-plan' ),
395
-						'2'  => __( '6', 'lsx-health-plan' ),
396
-					),
397
-					'default' => '4',
398
-				)
399
-			);
400
-			$cmb->add_field(
401
-				array(
402
-					'id'          => 'workout_tab_content',
403
-					'type'        => 'select',
404
-					'name'        => __( 'Grid Content', 'lsx-health-plan' ),
405
-					'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ),
406
-					'options'     => array(
407
-						''        => __( 'None', 'lsx-health-plan' ),
408
-						'excerpt' => __( 'Excerpt', 'lsx-health-plan' ),
409
-						'full'    => __( 'Full Content', 'lsx-health-plan' ),
410
-					),
411
-					'default' => '',
412
-				)
413
-			);
343
+               $cmb->add_field(
344
+                    array(
345
+                         'id'          => 'workout_tab_layout',
346
+                         'type'        => 'select',
347
+                         'name'        => __( 'Workout Tab Layout', 'lsx-health-plan' ),
348
+                         'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ),
349
+                         'options'     => array(
350
+                              'table' => __( 'Table', 'lsx-health-plan' ),
351
+                              'list'  => __( 'List', 'lsx-health-plan' ),
352
+                              'grid'  => __( 'Grid', 'lsx-health-plan' ),
353
+                         ),
354
+                    )
355
+               );
356
+               $cmb->add_field(
357
+                    array(
358
+                         'id'          => 'workout_tab_link',
359
+                         'type'        => 'select',
360
+                         'name'        => __( 'Workout Tab Link', 'lsx-health-plan' ),
361
+                         'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ),
362
+                         'options'     => array(
363
+                              ''       => __( 'None', 'lsx-health-plan' ),
364
+                              'single' => __( 'Single', 'lsx-health-plan' ),
365
+                              'modal'  => __( 'Modal', 'lsx-health-plan' ),
366
+                         ),
367
+                         'default' => 'modal',
368
+                    )
369
+               );
370
+               $cmb->add_field(
371
+                    array(
372
+                         'id'          => 'workout_tab_modal_content',
373
+                         'type'        => 'select',
374
+                         'name'        => __( 'Modal Content', 'lsx-health-plan' ),
375
+                         'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ),
376
+                         'options'     => array(
377
+                              ''        => __( 'None', 'lsx-health-plan' ),
378
+                              'excerpt' => __( 'Excerpt', 'lsx-health-plan' ),
379
+                              'full'    => __( 'Full Content', 'lsx-health-plan' ),
380
+                         ),
381
+                         'default' => '',
382
+                    )
383
+               );
384
+               $cmb->add_field(
385
+                    array(
386
+                         'id'          => 'workout_tab_columns',
387
+                         'type'        => 'select',
388
+                         'name'        => __( 'Grid Columns', 'lsx-health-plan' ),
389
+                         'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ),
390
+                         'options'     => array(
391
+                              '12' => __( '1', 'lsx-health-plan' ),
392
+                              '6'  => __( '2', 'lsx-health-plan' ),
393
+                              '4'  => __( '3', 'lsx-health-plan' ),
394
+                              '3'  => __( '4', 'lsx-health-plan' ),
395
+                              '2'  => __( '6', 'lsx-health-plan' ),
396
+                         ),
397
+                         'default' => '4',
398
+                    )
399
+               );
400
+               $cmb->add_field(
401
+                    array(
402
+                         'id'          => 'workout_tab_content',
403
+                         'type'        => 'select',
404
+                         'name'        => __( 'Grid Content', 'lsx-health-plan' ),
405
+                         'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ),
406
+                         'options'     => array(
407
+                              ''        => __( 'None', 'lsx-health-plan' ),
408
+                              'excerpt' => __( 'Excerpt', 'lsx-health-plan' ),
409
+                              'full'    => __( 'Full Content', 'lsx-health-plan' ),
410
+                         ),
411
+                         'default' => '',
412
+                    )
413
+               );
414 414
 
415
-			do_action( 'lsx_hp_workout_settings_page', $cmb );
415
+               do_action( 'lsx_hp_workout_settings_page', $cmb );
416 416
 
417
-			$cmb->add_field(
418
-				array(
419
-					'id'   => 'settings_workouts_closing',
420
-					'type' => 'tab_closing',
421
-				)
422
-			);
423
-		}
424
-	}
417
+               $cmb->add_field(
418
+                    array(
419
+                         'id'   => 'settings_workouts_closing',
420
+                         'type' => 'tab_closing',
421
+                    )
422
+               );
423
+          }
424
+     }
425 425
 }
Please login to merge, or discard this patch.
classes/post-types/class-recipe.php 2 patches
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -39,24 +39,24 @@  discard block
 block discarded – undo
39 39
 	 * Contructor
40 40
 	 */
41 41
 	public function __construct() {
42
-		add_action( 'init', array( $this, 'register_post_type' ) );
43
-		add_action( 'init', array( $this, 'taxonomy_setup' ) );
44
-		add_action( 'admin_menu', array( $this, 'register_menus' ) );
42
+		add_action('init', array($this, 'register_post_type'));
43
+		add_action('init', array($this, 'taxonomy_setup'));
44
+		add_action('admin_menu', array($this, 'register_menus'));
45 45
 
46 46
 		// Frontend Actions and Filters.
47
-		add_action( 'lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11 );
48
-		add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
49
-		add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
50
-		add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
51
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
52
-		add_filter( 'lsx_display_global_header_description', array( $this, 'disable_global_header_description' ), 100 );
53
-		add_filter( 'woocommerce_get_breadcrumb', array( $this, 'recipes_breadcrumb_filter' ), 30, 1 );
47
+		add_action('lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11);
48
+		add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1);
49
+		add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1);
50
+		add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1);
51
+		add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100);
52
+		add_filter('lsx_display_global_header_description', array($this, 'disable_global_header_description'), 100);
53
+		add_filter('woocommerce_get_breadcrumb', array($this, 'recipes_breadcrumb_filter'), 30, 1);
54 54
 
55 55
 		// Backend Actions and Filters.
56
-		add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) );
57
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
58
-		add_action( 'cmb2_admin_init', array( $this, 'recipes_connections' ), 5 );
59
-		add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 9, 1 );
56
+		add_action('cmb2_admin_init', array($this, 'featured_metabox'));
57
+		add_action('cmb2_admin_init', array($this, 'details_metaboxes'));
58
+		add_action('cmb2_admin_init', array($this, 'recipes_connections'), 5);
59
+		add_action('lsx_hp_settings_page', array($this, 'register_settings'), 9, 1);
60 60
 	}
61 61
 
62 62
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	public static function get_instance() {
70 70
 
71 71
 		// If the single instance hasn't been set, set it now.
72
-		if ( null === self::$instance ) {
72
+		if (null === self::$instance) {
73 73
 			self::$instance = new self();
74 74
 		}
75 75
 
@@ -82,21 +82,21 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function register_post_type() {
84 84
 		$this->labels = array(
85
-			'name'               => esc_html__( 'Recipe', 'lsx-health-plan' ),
86
-			'singular_name'      => esc_html__( 'Recipes', 'lsx-health-plan' ),
87
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
88
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
89
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
90
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
91
-			'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
92
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
93
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
94
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
95
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
85
+			'name'               => esc_html__('Recipe', 'lsx-health-plan'),
86
+			'singular_name'      => esc_html__('Recipes', 'lsx-health-plan'),
87
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'),
88
+			'add_new_item'       => esc_html__('Add New', 'lsx-health-plan'),
89
+			'edit_item'          => esc_html__('Edit', 'lsx-health-plan'),
90
+			'new_item'           => esc_html__('New', 'lsx-health-plan'),
91
+			'all_items'          => esc_html__('All', 'lsx-health-plan'),
92
+			'view_item'          => esc_html__('View', 'lsx-health-plan'),
93
+			'search_items'       => esc_html__('Search', 'lsx-health-plan'),
94
+			'not_found'          => esc_html__('None found', 'lsx-health-plan'),
95
+			'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'),
96 96
 			'parent_item_colon'  => '',
97
-			'menu_name'          => esc_html__( 'Recipes', 'lsx-health-plan' ),
97
+			'menu_name'          => esc_html__('Recipes', 'lsx-health-plan'),
98 98
 		);
99
-		$args         = array(
99
+		$args = array(
100 100
 			'labels'             => $this->labels,
101 101
 			'public'             => true,
102 102
 			'publicly_queryable' => true,
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 				'thumbnail',
119 119
 			),
120 120
 		);
121
-		register_post_type( 'recipe', $args );
121
+		register_post_type('recipe', $args);
122 122
 	}
123 123
 
124 124
 	/**
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	 * @return void
128 128
 	 */
129 129
 	public function register_menus() {
130
-		add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipes', 'lsx-health-plan' ), esc_html__( 'Recipes', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=recipe' );
131
-		add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Types', 'lsx-health-plan' ), esc_html__( 'Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe' );
132
-		add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Cuisines', 'lsx-health-plan' ), esc_html__( 'Cuisines', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe' );
130
+		add_submenu_page('edit.php?post_type=meal', esc_html__('Recipes', 'lsx-health-plan'), esc_html__('Recipes', 'lsx-health-plan'), 'edit_posts', 'edit.php?post_type=recipe');
131
+		add_submenu_page('edit.php?post_type=meal', esc_html__('Types', 'lsx-health-plan'), esc_html__('Types', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe');
132
+		add_submenu_page('edit.php?post_type=meal', esc_html__('Cuisines', 'lsx-health-plan'), esc_html__('Cuisines', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe');
133 133
 	}
134 134
 
135 135
 	/**
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	public function taxonomy_setup() {
139 139
 		$labels = array(
140
-			'name'              => esc_html_x( 'Cuisine', 'taxonomy general name', 'lsx-health-plan' ),
141
-			'singular_name'     => esc_html_x( 'Cuisines', 'taxonomy singular name', 'lsx-health-plan' ),
142
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
143
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
144
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
145
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
146
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
147
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
148
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
149
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
150
-			'menu_name'         => esc_html__( 'Cuisines', 'lsx-health-plan' ),
140
+			'name'              => esc_html_x('Cuisine', 'taxonomy general name', 'lsx-health-plan'),
141
+			'singular_name'     => esc_html_x('Cuisines', 'taxonomy singular name', 'lsx-health-plan'),
142
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
143
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
144
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
145
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
146
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
147
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
148
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
149
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
150
+			'menu_name'         => esc_html__('Cuisines', 'lsx-health-plan'),
151 151
 		);
152
-		$args   = array(
152
+		$args = array(
153 153
 			'hierarchical'      => true,
154 154
 			'labels'            => $labels,
155 155
 			'show_ui'           => true,
@@ -160,22 +160,22 @@  discard block
 block discarded – undo
160 160
 				'slug' => 'recipe-cuisine',
161 161
 			),
162 162
 		);
163
-		register_taxonomy( 'recipe-cuisine', array( $this->slug ), $args );
163
+		register_taxonomy('recipe-cuisine', array($this->slug), $args);
164 164
 
165 165
 		$labels = array(
166
-			'name'              => esc_html_x( 'Type', 'taxonomy general name', 'lsx-health-plan' ),
167
-			'singular_name'     => esc_html_x( 'Types', 'taxonomy singular name', 'lsx-health-plan' ),
168
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
169
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
170
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
171
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
172
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
173
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
174
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
175
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
176
-			'menu_name'         => esc_html__( 'Types', 'lsx-health-plan' ),
166
+			'name'              => esc_html_x('Type', 'taxonomy general name', 'lsx-health-plan'),
167
+			'singular_name'     => esc_html_x('Types', 'taxonomy singular name', 'lsx-health-plan'),
168
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
169
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
170
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
171
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
172
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
173
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
174
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
175
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
176
+			'menu_name'         => esc_html__('Types', 'lsx-health-plan'),
177 177
 		);
178
-		$args   = array(
178
+		$args = array(
179 179
 			'hierarchical'      => true,
180 180
 			'labels'            => $labels,
181 181
 			'show_ui'           => true,
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 				'slug' => 'recipe-type',
187 187
 			),
188 188
 		);
189
-		register_taxonomy( 'recipe-type', array( $this->slug ), $args );
189
+		register_taxonomy('recipe-type', array($this->slug), $args);
190 190
 	}
191 191
 
192 192
 	/**
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @param array $post_types
196 196
 	 * @return array
197 197
 	 */
198
-	public function enable_post_type( $post_types = array() ) {
198
+	public function enable_post_type($post_types = array()) {
199 199
 		$post_types[] = $this->slug;
200 200
 		return $post_types;
201 201
 	}
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 * @param array $connections
207 207
 	 * @return void
208 208
 	 */
209
-	public function enable_connections( $connections = array() ) {
209
+	public function enable_connections($connections = array()) {
210 210
 		$connections['recipe']['connected_plans'] = 'connected_recipes';
211 211
 		$connections['plan']['connected_recipes'] = 'connected_plans';
212 212
 		return $connections;
@@ -218,17 +218,17 @@  discard block
 block discarded – undo
218 218
 	 * @param string $title the term title.
219 219
 	 * @return string
220 220
 	 */
221
-	public function get_the_archive_title( $title ) {
222
-		if ( is_post_type_archive( 'recipe' ) ) {
223
-			$title = __( 'Recipes', 'lsx-health-plan' );
221
+	public function get_the_archive_title($title) {
222
+		if (is_post_type_archive('recipe')) {
223
+			$title = __('Recipes', 'lsx-health-plan');
224 224
 		}
225
-		if ( is_post_type_archive( 'exercise' ) ) {
226
-			$title = __( 'Exercises', 'lsx-health-plan' );
225
+		if (is_post_type_archive('exercise')) {
226
+			$title = __('Exercises', 'lsx-health-plan');
227 227
 		}
228
-		if ( is_tax( 'recipe-type' ) ) {
228
+		if (is_tax('recipe-type')) {
229 229
 			$queried_object = get_queried_object();
230
-			if ( isset( $queried_object->name ) ) {
231
-				$title = $queried_object->name . ' ' . __( 'Recipes', 'lsx-health-plan' );
230
+			if (isset($queried_object->name)) {
231
+				$title = $queried_object->name . ' ' . __('Recipes', 'lsx-health-plan');
232 232
 			}
233 233
 		}
234 234
 		return $title;
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 * @param boolean $disable
241 241
 	 * @return boolean
242 242
 	 */
243
-	public function disable_global_header_description( $disable ) {
244
-		if ( is_tax( 'recipe-type' ) ) {
243
+	public function disable_global_header_description($disable) {
244
+		if (is_tax('recipe-type')) {
245 245
 			$disable = true;
246 246
 		}
247 247
 		return $disable;
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
 	 * @var array $crumbs
254 254
 	 * @return array
255 255
 	 */
256
-	public function recipes_breadcrumb_filter( $crumbs ) {
257
-		if ( is_tax( 'recipe-type' ) ) {
256
+	public function recipes_breadcrumb_filter($crumbs) {
257
+		if (is_tax('recipe-type')) {
258 258
 			$text = $this->labels['singular_name'];
259
-			$url  = get_post_type_archive_link( 'recipe' );
260
-			if ( function_exists( 'woocommerce_breadcrumb' ) ) {
259
+			$url  = get_post_type_archive_link('recipe');
260
+			if (function_exists('woocommerce_breadcrumb')) {
261 261
 				$crumbs[1] = array(
262 262
 					0 => $text,
263 263
 					1 => $url,
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
 		$cmb = new_cmb2_box(
280 280
 			array(
281 281
 				'id'           => $this->slug . '_featured_metabox',
282
-				'title'        => __( 'Featured', 'lsx-health-plan' ),
283
-				'object_types' => array( $this->slug ),
282
+				'title'        => __('Featured', 'lsx-health-plan'),
283
+				'object_types' => array($this->slug),
284 284
 				'context'      => 'side',
285 285
 				'priority'     => 'high',
286 286
 				'show_names'   => true,
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 		);
289 289
 		$cmb->add_field(
290 290
 			array(
291
-				'name'       => __( 'Featured', 'lsx-health-plan' ),
292
-				'desc'       => __( 'Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan' ),
291
+				'name'       => __('Featured', 'lsx-health-plan'),
292
+				'desc'       => __('Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan'),
293 293
 				'id'         => $this->slug . '_featured',
294 294
 				'type'       => 'checkbox',
295 295
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 		$cmb = new_cmb2_box(
305 305
 			array(
306 306
 				'id'           => $this->slug . '_details_metabox',
307
-				'title'        => __( 'Cooking Info', 'lsx-health-plan' ),
308
-				'object_types' => array( $this->slug ), // Post type
307
+				'title'        => __('Cooking Info', 'lsx-health-plan'),
308
+				'object_types' => array($this->slug), // Post type
309 309
 				'context'      => 'normal',
310 310
 				'priority'     => 'high',
311 311
 				'show_names'   => true,
@@ -313,27 +313,27 @@  discard block
 block discarded – undo
313 313
 		);
314 314
 		$cmb->add_field(
315 315
 			array(
316
-				'name'       => __( 'Prep Time', 'lsx-health-plan' ),
316
+				'name'       => __('Prep Time', 'lsx-health-plan'),
317 317
 				'id'         => $this->slug . '_prep_time',
318
-				'desc'       => __( 'Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan' ),
318
+				'desc'       => __('Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan'),
319 319
 				'type'       => 'text',
320 320
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
321 321
 			)
322 322
 		);
323 323
 		$cmb->add_field(
324 324
 			array(
325
-				'name'       => __( 'Cooking Time', 'lsx-health-plan' ),
325
+				'name'       => __('Cooking Time', 'lsx-health-plan'),
326 326
 				'id'         => $this->slug . '_cooking_time',
327
-				'desc'       => __( 'Add the cooking time i.e: 15 mins', 'lsx-health-plan' ),
327
+				'desc'       => __('Add the cooking time i.e: 15 mins', 'lsx-health-plan'),
328 328
 				'type'       => 'text',
329 329
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
330 330
 			)
331 331
 		);
332 332
 		$cmb->add_field(
333 333
 			array(
334
-				'name'       => __( 'Serves', 'lsx-health-plan' ),
334
+				'name'       => __('Serves', 'lsx-health-plan'),
335 335
 				'id'         => $this->slug . '_serves',
336
-				'desc'       => __( 'Add the recommended serving size i.e: 6', 'lsx-health-plan' ),
336
+				'desc'       => __('Add the recommended serving size i.e: 6', 'lsx-health-plan'),
337 337
 				'type'       => 'text',
338 338
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
339 339
 				'attributes' => array(
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 		);
345 345
 		$cmb->add_field(
346 346
 			array(
347
-				'name'       => __( 'Portion', 'lsx-health-plan' ),
348
-				'desc'       => __( 'Add the recommended portion size i.e: 200mg', 'lsx-health-plan' ),
347
+				'name'       => __('Portion', 'lsx-health-plan'),
348
+				'desc'       => __('Add the recommended portion size i.e: 200mg', 'lsx-health-plan'),
349 349
 				'id'         => $this->slug . '_portion',
350 350
 				'type'       => 'text',
351 351
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 		$cmb = new_cmb2_box(
355 355
 			array(
356 356
 				'id'           => $this->slug . '_nutritional_metabox',
357
-				'title'        => __( 'Nutritional Info', 'lsx-health-plan' ),
358
-				'object_types' => array( $this->slug ), // Post type
357
+				'title'        => __('Nutritional Info', 'lsx-health-plan'),
358
+				'object_types' => array($this->slug), // Post type
359 359
 				'context'      => 'normal',
360 360
 				'priority'     => 'high',
361 361
 				'show_names'   => true,
@@ -363,45 +363,45 @@  discard block
 block discarded – undo
363 363
 		);
364 364
 		$cmb->add_field(
365 365
 			array(
366
-				'name'       => __( 'Energy', 'lsx-health-plan' ),
366
+				'name'       => __('Energy', 'lsx-health-plan'),
367 367
 				'id'         => $this->slug . '_energy',
368
-				'desc'       => __( 'Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan' ),
368
+				'desc'       => __('Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan'),
369 369
 				'type'       => 'text',
370 370
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
371 371
 			)
372 372
 		);
373 373
 		$cmb->add_field(
374 374
 			array(
375
-				'name'       => __( 'Protein', 'lsx-health-plan' ),
375
+				'name'       => __('Protein', 'lsx-health-plan'),
376 376
 				'id'         => $this->slug . '_protein',
377
-				'desc'       => __( 'Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan' ),
377
+				'desc'       => __('Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan'),
378 378
 				'type'       => 'text',
379 379
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
380 380
 			)
381 381
 		);
382 382
 		$cmb->add_field(
383 383
 			array(
384
-				'name'       => __( 'Carbohydrates', 'lsx-health-plan' ),
384
+				'name'       => __('Carbohydrates', 'lsx-health-plan'),
385 385
 				'id'         => $this->slug . '_carbohydrates',
386
-				'desc'       => __( 'Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
386
+				'desc'       => __('Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan'),
387 387
 				'type'       => 'text',
388 388
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
389 389
 			)
390 390
 		);
391 391
 		$cmb->add_field(
392 392
 			array(
393
-				'name'       => __( 'Fibre', 'lsx-health-plan' ),
393
+				'name'       => __('Fibre', 'lsx-health-plan'),
394 394
 				'id'         => $this->slug . '_fibre',
395
-				'desc'       => __( 'Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
395
+				'desc'       => __('Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan'),
396 396
 				'type'       => 'text',
397 397
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
398 398
 			)
399 399
 		);
400 400
 		$cmb->add_field(
401 401
 			array(
402
-				'name'       => __( 'Fat', 'lsx-health-plan' ),
402
+				'name'       => __('Fat', 'lsx-health-plan'),
403 403
 				'id'         => $this->slug . '_fat',
404
-				'desc'       => __( 'Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan' ),
404
+				'desc'       => __('Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan'),
405 405
 				'type'       => 'text',
406 406
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
407 407
 			)
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 		$cmb = new_cmb2_box(
418 418
 			array(
419 419
 				'id'           => $this->slug . '_recipes_connections_metabox',
420
-				'title'        => __( 'Recipes', 'lsx-health-plan' ),
421
-				'object_types' => array( 'plan' ), // Post type
420
+				'title'        => __('Recipes', 'lsx-health-plan'),
421
+				'object_types' => array('plan'), // Post type
422 422
 				'context'      => 'normal',
423 423
 				'priority'     => 'high',
424 424
 				'show_names'   => true,
@@ -426,16 +426,16 @@  discard block
 block discarded – undo
426 426
 		);
427 427
 		$cmb->add_field(
428 428
 			array(
429
-				'name'       => __( 'Recipes', 'lsx-health-plan' ),
430
-				'desc'       => __( 'Connect the recipes that apply to this day plan using the field provided.', 'lsx-health-plan' ),
429
+				'name'       => __('Recipes', 'lsx-health-plan'),
430
+				'desc'       => __('Connect the recipes that apply to this day plan using the field provided.', 'lsx-health-plan'),
431 431
 				'id'         => 'connected_recipes',
432 432
 				'type'       => 'post_search_ajax',
433 433
 				// Optional :
434
-				'limit'      => 15,  // Limit selection to X items only (default 1)
434
+				'limit'      => 15, // Limit selection to X items only (default 1)
435 435
 				'sortable'   => true, // Allow selected items to be sortable (default false)
436 436
 				'query_args' => array(
437
-					'post_type'      => array( $this->slug ),
438
-					'post_status'    => array( 'publish' ),
437
+					'post_type'      => array($this->slug),
438
+					'post_status'    => array('publish'),
439 439
 					'posts_per_page' => -1,
440 440
 				),
441 441
 			)
@@ -448,24 +448,24 @@  discard block
 block discarded – undo
448 448
 	 * @param object $cmb new_cmb2_box().
449 449
 	 * @return void
450 450
 	 */
451
-	public function register_settings( $cmb ) {
451
+	public function register_settings($cmb) {
452 452
 		$cmb->add_field(
453 453
 			array(
454 454
 				'id'          => 'recipe_archive_settings_title',
455 455
 				'type'        => 'title',
456
-				'name'        => __( 'Recipes Archive', 'lsx-health-plan' ),
457
-				'description' => __( 'All of the settings relating to the recipes post type archive.', 'lsx-health-plan' ),
456
+				'name'        => __('Recipes Archive', 'lsx-health-plan'),
457
+				'description' => __('All of the settings relating to the recipes post type archive.', 'lsx-health-plan'),
458 458
 			)
459 459
 		);
460 460
 		$cmb->add_field(
461 461
 			array(
462 462
 				'id'          => 'recipe_archive_description',
463 463
 				'type'        => 'wysiwyg',
464
-				'name'        => __( 'Archive Description', 'lsx-health-plan' ),
465
-				'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ),
464
+				'name'        => __('Archive Description', 'lsx-health-plan'),
465
+				'description' => __('This will show up on the post type archive.', 'lsx-health-plan'),
466 466
 			)
467 467
 		);
468
-		do_action( 'lsx_hp_recipe_settings_page', $cmb );
468
+		do_action('lsx_hp_recipe_settings_page', $cmb);
469 469
 		$cmb->add_field(
470 470
 			array(
471 471
 				'id'   => 'settings_recipe_archive_closing',
Please login to merge, or discard this patch.
Indentation   +443 added lines, -443 removed lines patch added patch discarded remove patch
@@ -8,469 +8,469 @@
 block discarded – undo
8 8
  */
9 9
 class Recipe {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\Recipe()
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\Recipe()
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 = 'recipe';
20
+     /**
21
+      * Holds post_type slug used as an index
22
+      *
23
+      * @since 1.0.0
24
+      *
25
+      * @var      string
26
+      */
27
+     public $slug = 'recipe';
28 28
 
29
-	/**
30
-	 * Holds post_type labels
31
-	 *
32
-	 * @since 1.0.0
33
-	 *
34
-	 * @var      string
35
-	 */
36
-	public $labels = array();
29
+     /**
30
+      * Holds post_type labels
31
+      *
32
+      * @since 1.0.0
33
+      *
34
+      * @var      string
35
+      */
36
+     public $labels = array();
37 37
 
38
-	/**
39
-	 * Contructor
40
-	 */
41
-	public function __construct() {
42
-		add_action( 'init', array( $this, 'register_post_type' ) );
43
-		add_action( 'init', array( $this, 'taxonomy_setup' ) );
44
-		add_action( 'admin_menu', array( $this, 'register_menus' ) );
38
+     /**
39
+      * Contructor
40
+      */
41
+     public function __construct() {
42
+          add_action( 'init', array( $this, 'register_post_type' ) );
43
+          add_action( 'init', array( $this, 'taxonomy_setup' ) );
44
+          add_action( 'admin_menu', array( $this, 'register_menus' ) );
45 45
 
46
-		// Frontend Actions and Filters.
47
-		add_action( 'lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11 );
48
-		add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
49
-		add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
50
-		add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
51
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
52
-		add_filter( 'lsx_display_global_header_description', array( $this, 'disable_global_header_description' ), 100 );
53
-		add_filter( 'woocommerce_get_breadcrumb', array( $this, 'recipes_breadcrumb_filter' ), 30, 1 );
46
+          // Frontend Actions and Filters.
47
+          add_action( 'lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11 );
48
+          add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
49
+          add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
50
+          add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
51
+          add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
52
+          add_filter( 'lsx_display_global_header_description', array( $this, 'disable_global_header_description' ), 100 );
53
+          add_filter( 'woocommerce_get_breadcrumb', array( $this, 'recipes_breadcrumb_filter' ), 30, 1 );
54 54
 
55
-		// Backend Actions and Filters.
56
-		add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) );
57
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
58
-		add_action( 'cmb2_admin_init', array( $this, 'recipes_connections' ), 5 );
59
-		add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 9, 1 );
60
-	}
55
+          // Backend Actions and Filters.
56
+          add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) );
57
+          add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
58
+          add_action( 'cmb2_admin_init', array( $this, 'recipes_connections' ), 5 );
59
+          add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 9, 1 );
60
+     }
61 61
 
62
-	/**
63
-	 * Return an instance of this class.
64
-	 *
65
-	 * @since 1.0.0
66
-	 *
67
-	 * @return    object \lsx_health_plan\classes\Recipe()    A single instance of this class.
68
-	 */
69
-	public static function get_instance() {
62
+     /**
63
+      * Return an instance of this class.
64
+      *
65
+      * @since 1.0.0
66
+      *
67
+      * @return    object \lsx_health_plan\classes\Recipe()    A single instance of this class.
68
+      */
69
+     public static function get_instance() {
70 70
 
71
-		// If the single instance hasn't been set, set it now.
72
-		if ( null === self::$instance ) {
73
-			self::$instance = new self();
74
-		}
71
+          // If the single instance hasn't been set, set it now.
72
+          if ( null === self::$instance ) {
73
+               self::$instance = new self();
74
+          }
75 75
 
76
-		return self::$instance;
76
+          return self::$instance;
77 77
 
78
-	}
78
+     }
79 79
 
80
-	/**
81
-	 * Register the post type.
82
-	 */
83
-	public function register_post_type() {
84
-		$this->labels = array(
85
-			'name'               => esc_html__( 'Recipe', 'lsx-health-plan' ),
86
-			'singular_name'      => esc_html__( 'Recipes', 'lsx-health-plan' ),
87
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
88
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
89
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
90
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
91
-			'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
92
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
93
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
94
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
95
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
96
-			'parent_item_colon'  => '',
97
-			'menu_name'          => esc_html__( 'Recipes', 'lsx-health-plan' ),
98
-		);
99
-		$args         = array(
100
-			'labels'             => $this->labels,
101
-			'public'             => true,
102
-			'publicly_queryable' => true,
103
-			'show_ui'            => true,
104
-			'show_in_menu'       => false,
105
-			'show_in_rest'       => true,
106
-			'menu_icon'          => 'dashicons-editor-ul',
107
-			'query_var'          => true,
108
-			'rewrite'            => array(
109
-				'slug' => 'recipe',
110
-			),
111
-			'capability_type'    => 'post',
112
-			'has_archive'        => 'recipes',
113
-			'hierarchical'       => false,
114
-			'menu_position'      => null,
115
-			'supports'           => array(
116
-				'title',
117
-				'editor',
118
-				'thumbnail',
119
-			),
120
-		);
121
-		register_post_type( 'recipe', $args );
122
-	}
80
+     /**
81
+      * Register the post type.
82
+      */
83
+     public function register_post_type() {
84
+          $this->labels = array(
85
+               'name'               => esc_html__( 'Recipe', 'lsx-health-plan' ),
86
+               'singular_name'      => esc_html__( 'Recipes', 'lsx-health-plan' ),
87
+               'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
88
+               'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
89
+               'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
90
+               'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
91
+               'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
92
+               'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
93
+               'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
94
+               'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
95
+               'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
96
+               'parent_item_colon'  => '',
97
+               'menu_name'          => esc_html__( 'Recipes', 'lsx-health-plan' ),
98
+          );
99
+          $args         = array(
100
+               'labels'             => $this->labels,
101
+               'public'             => true,
102
+               'publicly_queryable' => true,
103
+               'show_ui'            => true,
104
+               'show_in_menu'       => false,
105
+               'show_in_rest'       => true,
106
+               'menu_icon'          => 'dashicons-editor-ul',
107
+               'query_var'          => true,
108
+               'rewrite'            => array(
109
+                    'slug' => 'recipe',
110
+               ),
111
+               'capability_type'    => 'post',
112
+               'has_archive'        => 'recipes',
113
+               'hierarchical'       => false,
114
+               'menu_position'      => null,
115
+               'supports'           => array(
116
+                    'title',
117
+                    'editor',
118
+                    'thumbnail',
119
+               ),
120
+          );
121
+          register_post_type( 'recipe', $args );
122
+     }
123 123
 
124
-	/**
125
-	 * Registers the Recipes under the Meals Post type menu.
126
-	 *
127
-	 * @return void
128
-	 */
129
-	public function register_menus() {
130
-		add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipes', 'lsx-health-plan' ), esc_html__( 'Recipes', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=recipe' );
131
-		add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Types', 'lsx-health-plan' ), esc_html__( 'Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe' );
132
-		add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Cuisines', 'lsx-health-plan' ), esc_html__( 'Cuisines', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe' );
133
-	}
124
+     /**
125
+      * Registers the Recipes under the Meals Post type menu.
126
+      *
127
+      * @return void
128
+      */
129
+     public function register_menus() {
130
+          add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipes', 'lsx-health-plan' ), esc_html__( 'Recipes', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=recipe' );
131
+          add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Types', 'lsx-health-plan' ), esc_html__( 'Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe' );
132
+          add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Cuisines', 'lsx-health-plan' ), esc_html__( 'Cuisines', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe' );
133
+     }
134 134
 
135
-	/**
136
-	 * Register the Week taxonomy.
137
-	 */
138
-	public function taxonomy_setup() {
139
-		$labels = array(
140
-			'name'              => esc_html_x( 'Cuisine', 'taxonomy general name', 'lsx-health-plan' ),
141
-			'singular_name'     => esc_html_x( 'Cuisines', 'taxonomy singular name', 'lsx-health-plan' ),
142
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
143
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
144
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
145
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
146
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
147
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
148
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
149
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
150
-			'menu_name'         => esc_html__( 'Cuisines', 'lsx-health-plan' ),
151
-		);
152
-		$args   = array(
153
-			'hierarchical'      => true,
154
-			'labels'            => $labels,
155
-			'show_ui'           => true,
156
-			'show_admin_column' => true,
157
-			'show_in_menu'      => 'edit.php?post_type=meal',
158
-			'query_var'         => true,
159
-			'rewrite'           => array(
160
-				'slug' => 'recipe-cuisine',
161
-			),
162
-		);
163
-		register_taxonomy( 'recipe-cuisine', array( $this->slug ), $args );
135
+     /**
136
+      * Register the Week taxonomy.
137
+      */
138
+     public function taxonomy_setup() {
139
+          $labels = array(
140
+               'name'              => esc_html_x( 'Cuisine', 'taxonomy general name', 'lsx-health-plan' ),
141
+               'singular_name'     => esc_html_x( 'Cuisines', 'taxonomy singular name', 'lsx-health-plan' ),
142
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
143
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
144
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
145
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
146
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
147
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
148
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
149
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
150
+               'menu_name'         => esc_html__( 'Cuisines', 'lsx-health-plan' ),
151
+          );
152
+          $args   = array(
153
+               'hierarchical'      => true,
154
+               'labels'            => $labels,
155
+               'show_ui'           => true,
156
+               'show_admin_column' => true,
157
+               'show_in_menu'      => 'edit.php?post_type=meal',
158
+               'query_var'         => true,
159
+               'rewrite'           => array(
160
+                    'slug' => 'recipe-cuisine',
161
+               ),
162
+          );
163
+          register_taxonomy( 'recipe-cuisine', array( $this->slug ), $args );
164 164
 
165
-		$labels = array(
166
-			'name'              => esc_html_x( 'Type', 'taxonomy general name', 'lsx-health-plan' ),
167
-			'singular_name'     => esc_html_x( 'Types', 'taxonomy singular name', 'lsx-health-plan' ),
168
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
169
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
170
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
171
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
172
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
173
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
174
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
175
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
176
-			'menu_name'         => esc_html__( 'Types', 'lsx-health-plan' ),
177
-		);
178
-		$args   = array(
179
-			'hierarchical'      => true,
180
-			'labels'            => $labels,
181
-			'show_ui'           => true,
182
-			'show_in_menu'      => 'edit.php?post_type=meal',
183
-			'show_admin_column' => true,
184
-			'query_var'         => true,
185
-			'rewrite'           => array(
186
-				'slug' => 'recipe-type',
187
-			),
188
-		);
189
-		register_taxonomy( 'recipe-type', array( $this->slug ), $args );
190
-	}
165
+          $labels = array(
166
+               'name'              => esc_html_x( 'Type', 'taxonomy general name', 'lsx-health-plan' ),
167
+               'singular_name'     => esc_html_x( 'Types', 'taxonomy singular name', 'lsx-health-plan' ),
168
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
169
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
170
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
171
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
172
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
173
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
174
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
175
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
176
+               'menu_name'         => esc_html__( 'Types', 'lsx-health-plan' ),
177
+          );
178
+          $args   = array(
179
+               'hierarchical'      => true,
180
+               'labels'            => $labels,
181
+               'show_ui'           => true,
182
+               'show_in_menu'      => 'edit.php?post_type=meal',
183
+               'show_admin_column' => true,
184
+               'query_var'         => true,
185
+               'rewrite'           => array(
186
+                    'slug' => 'recipe-type',
187
+               ),
188
+          );
189
+          register_taxonomy( 'recipe-type', array( $this->slug ), $args );
190
+     }
191 191
 
192
-	/**
193
-	 * Adds the post type to the different arrays.
194
-	 *
195
-	 * @param array $post_types
196
-	 * @return array
197
-	 */
198
-	public function enable_post_type( $post_types = array() ) {
199
-		$post_types[] = $this->slug;
200
-		return $post_types;
201
-	}
192
+     /**
193
+      * Adds the post type to the different arrays.
194
+      *
195
+      * @param array $post_types
196
+      * @return array
197
+      */
198
+     public function enable_post_type( $post_types = array() ) {
199
+          $post_types[] = $this->slug;
200
+          return $post_types;
201
+     }
202 202
 
203
-	/**
204
-	 * Enables the Bi Directional relationships
205
-	 *
206
-	 * @param array $connections
207
-	 * @return void
208
-	 */
209
-	public function enable_connections( $connections = array() ) {
210
-		$connections['recipe']['connected_plans'] = 'connected_recipes';
211
-		$connections['plan']['connected_recipes'] = 'connected_plans';
212
-		return $connections;
213
-	}
203
+     /**
204
+      * Enables the Bi Directional relationships
205
+      *
206
+      * @param array $connections
207
+      * @return void
208
+      */
209
+     public function enable_connections( $connections = array() ) {
210
+          $connections['recipe']['connected_plans'] = 'connected_recipes';
211
+          $connections['plan']['connected_recipes'] = 'connected_plans';
212
+          return $connections;
213
+     }
214 214
 
215
-	/**
216
-	 * Remove the "Archives:" from the post type recipes.
217
-	 *
218
-	 * @param string $title the term title.
219
-	 * @return string
220
-	 */
221
-	public function get_the_archive_title( $title ) {
222
-		if ( is_post_type_archive( 'recipe' ) ) {
223
-			$title = __( 'Recipes', 'lsx-health-plan' );
224
-		}
225
-		if ( is_post_type_archive( 'exercise' ) ) {
226
-			$title = __( 'Exercises', 'lsx-health-plan' );
227
-		}
228
-		if ( is_tax( 'recipe-type' ) ) {
229
-			$queried_object = get_queried_object();
230
-			if ( isset( $queried_object->name ) ) {
231
-				$title = $queried_object->name . ' ' . __( 'Recipes', 'lsx-health-plan' );
232
-			}
233
-		}
234
-		return $title;
235
-	}
215
+     /**
216
+      * Remove the "Archives:" from the post type recipes.
217
+      *
218
+      * @param string $title the term title.
219
+      * @return string
220
+      */
221
+     public function get_the_archive_title( $title ) {
222
+          if ( is_post_type_archive( 'recipe' ) ) {
223
+               $title = __( 'Recipes', 'lsx-health-plan' );
224
+          }
225
+          if ( is_post_type_archive( 'exercise' ) ) {
226
+               $title = __( 'Exercises', 'lsx-health-plan' );
227
+          }
228
+          if ( is_tax( 'recipe-type' ) ) {
229
+               $queried_object = get_queried_object();
230
+               if ( isset( $queried_object->name ) ) {
231
+                    $title = $queried_object->name . ' ' . __( 'Recipes', 'lsx-health-plan' );
232
+               }
233
+          }
234
+          return $title;
235
+     }
236 236
 
237
-	/**
238
-	 * Disables the global header description
239
-	 *
240
-	 * @param boolean $disable
241
-	 * @return boolean
242
-	 */
243
-	public function disable_global_header_description( $disable ) {
244
-		if ( is_tax( 'recipe-type' ) ) {
245
-			$disable = true;
246
-		}
247
-		return $disable;
248
-	}
237
+     /**
238
+      * Disables the global header description
239
+      *
240
+      * @param boolean $disable
241
+      * @return boolean
242
+      */
243
+     public function disable_global_header_description( $disable ) {
244
+          if ( is_tax( 'recipe-type' ) ) {
245
+               $disable = true;
246
+          }
247
+          return $disable;
248
+     }
249 249
 
250
-	/**
251
-	 * Holds the array for the breadcrumbs.
252
-	 *
253
-	 * @var array $crumbs
254
-	 * @return array
255
-	 */
256
-	public function recipes_breadcrumb_filter( $crumbs ) {
257
-		if ( is_tax( 'recipe-type' ) ) {
258
-			$text = $this->labels['singular_name'];
259
-			$url  = get_post_type_archive_link( 'recipe' );
260
-			if ( function_exists( 'woocommerce_breadcrumb' ) ) {
261
-				$crumbs[1] = array(
262
-					0 => $text,
263
-					1 => $url,
264
-				);
265
-			} else {
266
-				$crumbs[1] = array(
267
-					'text' => $text,
268
-					'url'  => $url,
269
-				);
270
-			}
271
-		}
272
-		return $crumbs;
273
-	}
250
+     /**
251
+      * Holds the array for the breadcrumbs.
252
+      *
253
+      * @var array $crumbs
254
+      * @return array
255
+      */
256
+     public function recipes_breadcrumb_filter( $crumbs ) {
257
+          if ( is_tax( 'recipe-type' ) ) {
258
+               $text = $this->labels['singular_name'];
259
+               $url  = get_post_type_archive_link( 'recipe' );
260
+               if ( function_exists( 'woocommerce_breadcrumb' ) ) {
261
+                    $crumbs[1] = array(
262
+                         0 => $text,
263
+                         1 => $url,
264
+                    );
265
+               } else {
266
+                    $crumbs[1] = array(
267
+                         'text' => $text,
268
+                         'url'  => $url,
269
+                    );
270
+               }
271
+          }
272
+          return $crumbs;
273
+     }
274 274
 
275
-	/**
276
-	 * Define the metabox and field configurations.
277
-	 */
278
-	public function featured_metabox() {
279
-		$cmb = new_cmb2_box(
280
-			array(
281
-				'id'           => $this->slug . '_featured_metabox',
282
-				'title'        => __( 'Featured', 'lsx-health-plan' ),
283
-				'object_types' => array( $this->slug ),
284
-				'context'      => 'side',
285
-				'priority'     => 'high',
286
-				'show_names'   => true,
287
-			)
288
-		);
289
-		$cmb->add_field(
290
-			array(
291
-				'name'       => __( 'Featured', 'lsx-health-plan' ),
292
-				'desc'       => __( 'Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan' ),
293
-				'id'         => $this->slug . '_featured',
294
-				'type'       => 'checkbox',
295
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
296
-			)
297
-		);
298
-	}
275
+     /**
276
+      * Define the metabox and field configurations.
277
+      */
278
+     public function featured_metabox() {
279
+          $cmb = new_cmb2_box(
280
+               array(
281
+                    'id'           => $this->slug . '_featured_metabox',
282
+                    'title'        => __( 'Featured', 'lsx-health-plan' ),
283
+                    'object_types' => array( $this->slug ),
284
+                    'context'      => 'side',
285
+                    'priority'     => 'high',
286
+                    'show_names'   => true,
287
+               )
288
+          );
289
+          $cmb->add_field(
290
+               array(
291
+                    'name'       => __( 'Featured', 'lsx-health-plan' ),
292
+                    'desc'       => __( 'Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan' ),
293
+                    'id'         => $this->slug . '_featured',
294
+                    'type'       => 'checkbox',
295
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
296
+               )
297
+          );
298
+     }
299 299
 
300
-	/**
301
-	 * Define the metabox and field configurations.
302
-	 */
303
-	public function details_metaboxes() {
304
-		$cmb = new_cmb2_box(
305
-			array(
306
-				'id'           => $this->slug . '_details_metabox',
307
-				'title'        => __( 'Cooking Info', 'lsx-health-plan' ),
308
-				'object_types' => array( $this->slug ), // Post type
309
-				'context'      => 'normal',
310
-				'priority'     => 'high',
311
-				'show_names'   => true,
312
-			)
313
-		);
314
-		$cmb->add_field(
315
-			array(
316
-				'name'       => __( 'Prep Time', 'lsx-health-plan' ),
317
-				'id'         => $this->slug . '_prep_time',
318
-				'desc'       => __( 'Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan' ),
319
-				'type'       => 'text',
320
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
321
-			)
322
-		);
323
-		$cmb->add_field(
324
-			array(
325
-				'name'       => __( 'Cooking Time', 'lsx-health-plan' ),
326
-				'id'         => $this->slug . '_cooking_time',
327
-				'desc'       => __( 'Add the cooking time i.e: 15 mins', 'lsx-health-plan' ),
328
-				'type'       => 'text',
329
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
330
-			)
331
-		);
332
-		$cmb->add_field(
333
-			array(
334
-				'name'       => __( 'Serves', 'lsx-health-plan' ),
335
-				'id'         => $this->slug . '_serves',
336
-				'desc'       => __( 'Add the recommended serving size i.e: 6', 'lsx-health-plan' ),
337
-				'type'       => 'text',
338
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
339
-				'attributes' => array(
340
-					'type'    => 'number',
341
-					'pattern' => '\d*',
342
-				),
343
-			)
344
-		);
345
-		$cmb->add_field(
346
-			array(
347
-				'name'       => __( 'Portion', 'lsx-health-plan' ),
348
-				'desc'       => __( 'Add the recommended portion size i.e: 200mg', 'lsx-health-plan' ),
349
-				'id'         => $this->slug . '_portion',
350
-				'type'       => 'text',
351
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
352
-			)
353
-		);
354
-		$cmb = new_cmb2_box(
355
-			array(
356
-				'id'           => $this->slug . '_nutritional_metabox',
357
-				'title'        => __( 'Nutritional Info', 'lsx-health-plan' ),
358
-				'object_types' => array( $this->slug ), // Post type
359
-				'context'      => 'normal',
360
-				'priority'     => 'high',
361
-				'show_names'   => true,
362
-			)
363
-		);
364
-		$cmb->add_field(
365
-			array(
366
-				'name'       => __( 'Energy', 'lsx-health-plan' ),
367
-				'id'         => $this->slug . '_energy',
368
-				'desc'       => __( 'Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan' ),
369
-				'type'       => 'text',
370
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
371
-			)
372
-		);
373
-		$cmb->add_field(
374
-			array(
375
-				'name'       => __( 'Protein', 'lsx-health-plan' ),
376
-				'id'         => $this->slug . '_protein',
377
-				'desc'       => __( 'Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan' ),
378
-				'type'       => 'text',
379
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
380
-			)
381
-		);
382
-		$cmb->add_field(
383
-			array(
384
-				'name'       => __( 'Carbohydrates', 'lsx-health-plan' ),
385
-				'id'         => $this->slug . '_carbohydrates',
386
-				'desc'       => __( 'Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
387
-				'type'       => 'text',
388
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
389
-			)
390
-		);
391
-		$cmb->add_field(
392
-			array(
393
-				'name'       => __( 'Fibre', 'lsx-health-plan' ),
394
-				'id'         => $this->slug . '_fibre',
395
-				'desc'       => __( 'Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
396
-				'type'       => 'text',
397
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
398
-			)
399
-		);
400
-		$cmb->add_field(
401
-			array(
402
-				'name'       => __( 'Fat', 'lsx-health-plan' ),
403
-				'id'         => $this->slug . '_fat',
404
-				'desc'       => __( 'Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan' ),
405
-				'type'       => 'text',
406
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
407
-			)
408
-		);
409
-	}
300
+     /**
301
+      * Define the metabox and field configurations.
302
+      */
303
+     public function details_metaboxes() {
304
+          $cmb = new_cmb2_box(
305
+               array(
306
+                    'id'           => $this->slug . '_details_metabox',
307
+                    'title'        => __( 'Cooking Info', 'lsx-health-plan' ),
308
+                    'object_types' => array( $this->slug ), // Post type
309
+                    'context'      => 'normal',
310
+                    'priority'     => 'high',
311
+                    'show_names'   => true,
312
+               )
313
+          );
314
+          $cmb->add_field(
315
+               array(
316
+                    'name'       => __( 'Prep Time', 'lsx-health-plan' ),
317
+                    'id'         => $this->slug . '_prep_time',
318
+                    'desc'       => __( 'Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan' ),
319
+                    'type'       => 'text',
320
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
321
+               )
322
+          );
323
+          $cmb->add_field(
324
+               array(
325
+                    'name'       => __( 'Cooking Time', 'lsx-health-plan' ),
326
+                    'id'         => $this->slug . '_cooking_time',
327
+                    'desc'       => __( 'Add the cooking time i.e: 15 mins', 'lsx-health-plan' ),
328
+                    'type'       => 'text',
329
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
330
+               )
331
+          );
332
+          $cmb->add_field(
333
+               array(
334
+                    'name'       => __( 'Serves', 'lsx-health-plan' ),
335
+                    'id'         => $this->slug . '_serves',
336
+                    'desc'       => __( 'Add the recommended serving size i.e: 6', 'lsx-health-plan' ),
337
+                    'type'       => 'text',
338
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
339
+                    'attributes' => array(
340
+                         'type'    => 'number',
341
+                         'pattern' => '\d*',
342
+                    ),
343
+               )
344
+          );
345
+          $cmb->add_field(
346
+               array(
347
+                    'name'       => __( 'Portion', 'lsx-health-plan' ),
348
+                    'desc'       => __( 'Add the recommended portion size i.e: 200mg', 'lsx-health-plan' ),
349
+                    'id'         => $this->slug . '_portion',
350
+                    'type'       => 'text',
351
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
352
+               )
353
+          );
354
+          $cmb = new_cmb2_box(
355
+               array(
356
+                    'id'           => $this->slug . '_nutritional_metabox',
357
+                    'title'        => __( 'Nutritional Info', 'lsx-health-plan' ),
358
+                    'object_types' => array( $this->slug ), // Post type
359
+                    'context'      => 'normal',
360
+                    'priority'     => 'high',
361
+                    'show_names'   => true,
362
+               )
363
+          );
364
+          $cmb->add_field(
365
+               array(
366
+                    'name'       => __( 'Energy', 'lsx-health-plan' ),
367
+                    'id'         => $this->slug . '_energy',
368
+                    'desc'       => __( 'Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan' ),
369
+                    'type'       => 'text',
370
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
371
+               )
372
+          );
373
+          $cmb->add_field(
374
+               array(
375
+                    'name'       => __( 'Protein', 'lsx-health-plan' ),
376
+                    'id'         => $this->slug . '_protein',
377
+                    'desc'       => __( 'Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan' ),
378
+                    'type'       => 'text',
379
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
380
+               )
381
+          );
382
+          $cmb->add_field(
383
+               array(
384
+                    'name'       => __( 'Carbohydrates', 'lsx-health-plan' ),
385
+                    'id'         => $this->slug . '_carbohydrates',
386
+                    'desc'       => __( 'Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
387
+                    'type'       => 'text',
388
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
389
+               )
390
+          );
391
+          $cmb->add_field(
392
+               array(
393
+                    'name'       => __( 'Fibre', 'lsx-health-plan' ),
394
+                    'id'         => $this->slug . '_fibre',
395
+                    'desc'       => __( 'Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
396
+                    'type'       => 'text',
397
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
398
+               )
399
+          );
400
+          $cmb->add_field(
401
+               array(
402
+                    'name'       => __( 'Fat', 'lsx-health-plan' ),
403
+                    'id'         => $this->slug . '_fat',
404
+                    'desc'       => __( 'Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan' ),
405
+                    'type'       => 'text',
406
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
407
+               )
408
+          );
409
+     }
410 410
 
411
-	/**
412
-	 * Registers the workout connections on the plan post type.
413
-	 *
414
-	 * @return void
415
-	 */
416
-	public function recipes_connections() {
417
-		$cmb = new_cmb2_box(
418
-			array(
419
-				'id'           => $this->slug . '_recipes_connections_metabox',
420
-				'title'        => __( 'Recipes', 'lsx-health-plan' ),
421
-				'object_types' => array( 'plan' ), // Post type
422
-				'context'      => 'normal',
423
-				'priority'     => 'high',
424
-				'show_names'   => true,
425
-			)
426
-		);
427
-		$cmb->add_field(
428
-			array(
429
-				'name'       => __( 'Recipes', 'lsx-health-plan' ),
430
-				'desc'       => __( 'Connect the recipes that apply to this day plan using the field provided.', 'lsx-health-plan' ),
431
-				'id'         => 'connected_recipes',
432
-				'type'       => 'post_search_ajax',
433
-				// Optional :
434
-				'limit'      => 15,  // Limit selection to X items only (default 1)
435
-				'sortable'   => true, // Allow selected items to be sortable (default false)
436
-				'query_args' => array(
437
-					'post_type'      => array( $this->slug ),
438
-					'post_status'    => array( 'publish' ),
439
-					'posts_per_page' => -1,
440
-				),
441
-			)
442
-		);
443
-	}
411
+     /**
412
+      * Registers the workout connections on the plan post type.
413
+      *
414
+      * @return void
415
+      */
416
+     public function recipes_connections() {
417
+          $cmb = new_cmb2_box(
418
+               array(
419
+                    'id'           => $this->slug . '_recipes_connections_metabox',
420
+                    'title'        => __( 'Recipes', 'lsx-health-plan' ),
421
+                    'object_types' => array( 'plan' ), // Post type
422
+                    'context'      => 'normal',
423
+                    'priority'     => 'high',
424
+                    'show_names'   => true,
425
+               )
426
+          );
427
+          $cmb->add_field(
428
+               array(
429
+                    'name'       => __( 'Recipes', 'lsx-health-plan' ),
430
+                    'desc'       => __( 'Connect the recipes that apply to this day plan using the field provided.', 'lsx-health-plan' ),
431
+                    'id'         => 'connected_recipes',
432
+                    'type'       => 'post_search_ajax',
433
+                    // Optional :
434
+                    'limit'      => 15,  // Limit selection to X items only (default 1)
435
+                    'sortable'   => true, // Allow selected items to be sortable (default false)
436
+                    'query_args' => array(
437
+                         'post_type'      => array( $this->slug ),
438
+                         'post_status'    => array( 'publish' ),
439
+                         'posts_per_page' => -1,
440
+                    ),
441
+               )
442
+          );
443
+     }
444 444
 
445
-	/**
446
-	 * Registers the lsx_search_settings
447
-	 *
448
-	 * @param object $cmb new_cmb2_box().
449
-	 * @return void
450
-	 */
451
-	public function register_settings( $cmb ) {
452
-		$cmb->add_field(
453
-			array(
454
-				'id'          => 'recipe_archive_settings_title',
455
-				'type'        => 'title',
456
-				'name'        => __( 'Recipes Archive', 'lsx-health-plan' ),
457
-				'description' => __( 'All of the settings relating to the recipes post type archive.', 'lsx-health-plan' ),
458
-			)
459
-		);
460
-		$cmb->add_field(
461
-			array(
462
-				'id'          => 'recipe_archive_description',
463
-				'type'        => 'wysiwyg',
464
-				'name'        => __( 'Archive Description', 'lsx-health-plan' ),
465
-				'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ),
466
-			)
467
-		);
468
-		do_action( 'lsx_hp_recipe_settings_page', $cmb );
469
-		$cmb->add_field(
470
-			array(
471
-				'id'   => 'settings_recipe_archive_closing',
472
-				'type' => 'tab_closing',
473
-			)
474
-		);
475
-	}
445
+     /**
446
+      * Registers the lsx_search_settings
447
+      *
448
+      * @param object $cmb new_cmb2_box().
449
+      * @return void
450
+      */
451
+     public function register_settings( $cmb ) {
452
+          $cmb->add_field(
453
+               array(
454
+                    'id'          => 'recipe_archive_settings_title',
455
+                    'type'        => 'title',
456
+                    'name'        => __( 'Recipes Archive', 'lsx-health-plan' ),
457
+                    'description' => __( 'All of the settings relating to the recipes post type archive.', 'lsx-health-plan' ),
458
+               )
459
+          );
460
+          $cmb->add_field(
461
+               array(
462
+                    'id'          => 'recipe_archive_description',
463
+                    'type'        => 'wysiwyg',
464
+                    'name'        => __( 'Archive Description', 'lsx-health-plan' ),
465
+                    'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ),
466
+               )
467
+          );
468
+          do_action( 'lsx_hp_recipe_settings_page', $cmb );
469
+          $cmb->add_field(
470
+               array(
471
+                    'id'   => 'settings_recipe_archive_closing',
472
+                    'type' => 'tab_closing',
473
+               )
474
+          );
475
+     }
476 476
 }
Please login to merge, or discard this patch.
classes/post-types/class-tip.php 2 patches
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  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( 'admin_menu', array( $this, 'register_menus' ) );
35
-		add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
36
-		add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) );
37
-		add_action( 'cmb2_admin_init', array( $this, 'tips_connections' ), 15 );
33
+		add_action('init', array($this, 'register_post_type'));
34
+		add_action('admin_menu', array($this, 'register_menus'));
35
+		add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1);
36
+		add_action('cmb2_admin_init', array($this, 'featured_metabox'));
37
+		add_action('cmb2_admin_init', array($this, 'tips_connections'), 15);
38 38
 	}
39 39
 
40 40
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public static function get_instance() {
48 48
 		// If the single instance hasn't been set, set it now.
49
-		if ( null === self::$instance ) {
49
+		if (null === self::$instance) {
50 50
 			self::$instance = new self();
51 51
 		}
52 52
 		return self::$instance;
@@ -56,21 +56,21 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public function register_post_type() {
58 58
 		$labels = array(
59
-			'name'               => esc_html__( 'Tip', 'lsx-health-plan' ),
60
-			'singular_name'      => esc_html__( 'Tips', 'lsx-health-plan' ),
61
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
62
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
63
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
64
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
65
-			'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
66
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
67
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
68
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
69
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
59
+			'name'               => esc_html__('Tip', 'lsx-health-plan'),
60
+			'singular_name'      => esc_html__('Tips', 'lsx-health-plan'),
61
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'),
62
+			'add_new_item'       => esc_html__('Add New', 'lsx-health-plan'),
63
+			'edit_item'          => esc_html__('Edit', 'lsx-health-plan'),
64
+			'new_item'           => esc_html__('New', 'lsx-health-plan'),
65
+			'all_items'          => esc_html__('All', 'lsx-health-plan'),
66
+			'view_item'          => esc_html__('View', 'lsx-health-plan'),
67
+			'search_items'       => esc_html__('Search', 'lsx-health-plan'),
68
+			'not_found'          => esc_html__('None found', 'lsx-health-plan'),
69
+			'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'),
70 70
 			'parent_item_colon'  => '',
71
-			'menu_name'          => esc_html__( 'Tips', 'lsx-health-plan' ),
71
+			'menu_name'          => esc_html__('Tips', 'lsx-health-plan'),
72 72
 		);
73
-		$args   = array(
73
+		$args = array(
74 74
 			'labels'             => $labels,
75 75
 			'public'             => true,
76 76
 			'publicly_queryable' => false,
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 				'thumbnail',
91 91
 			),
92 92
 		);
93
-		register_post_type( 'tip', $args );
93
+		register_post_type('tip', $args);
94 94
 	}
95 95
 
96 96
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return void
100 100
 	 */
101 101
 	public function register_menus() {
102
-		add_submenu_page( 'edit.php?post_type=plan', esc_html__( 'Tips', 'lsx-health-plan' ), esc_html__( 'Tips', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=tip' );
102
+		add_submenu_page('edit.php?post_type=plan', esc_html__('Tips', 'lsx-health-plan'), esc_html__('Tips', 'lsx-health-plan'), 'edit_posts', 'edit.php?post_type=tip');
103 103
 	}
104 104
 
105 105
 	/**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @param array $connections
109 109
 	 * @return void
110 110
 	 */
111
-	public function enable_connections( $connections = array() ) {
111
+	public function enable_connections($connections = array()) {
112 112
 		$connections['tip']['connected_plans'] = 'connected_tips';
113 113
 		$connections['plan']['connected_tips'] = 'connected_plans';
114 114
 		return $connections;
@@ -120,49 +120,49 @@  discard block
 block discarded – undo
120 120
 	 * @return void
121 121
 	 */
122 122
 	public function tips_connections() {
123
-		$cmb = new_cmb2_box( array(
123
+		$cmb = new_cmb2_box(array(
124 124
 			'id'           => $this->slug . '_tips_connections_metabox',
125
-			'title'        => __( 'Tips', 'lsx-health-plan' ),
126
-			'object_types' => array( 'plan' ), // Post type
125
+			'title'        => __('Tips', 'lsx-health-plan'),
126
+			'object_types' => array('plan'), // Post type
127 127
 			'context'      => 'normal',
128 128
 			'priority'     => 'high',
129 129
 			'show_names'   => false,
130
-		) );
131
-		$cmb->add_field( array(
132
-			'name'       => __( 'Tips', 'lsx-health-plan' ),
130
+		));
131
+		$cmb->add_field(array(
132
+			'name'       => __('Tips', 'lsx-health-plan'),
133 133
 			'id'         => 'connected_tips',
134
-			'desc'       => __( 'Connect the tips that apply to this day plan using the field provided.', 'lsx-health-plan' ),
134
+			'desc'       => __('Connect the tips that apply to this day plan using the field provided.', 'lsx-health-plan'),
135 135
 			'type'       => 'post_search_ajax',
136 136
 			// Optional :
137
-			'limit'      => 15,  // Limit selection to X items only (default 1)
138
-			'sortable'   => true,  // Allow selected items to be sortable (default false)
137
+			'limit'      => 15, // Limit selection to X items only (default 1)
138
+			'sortable'   => true, // Allow selected items to be sortable (default false)
139 139
 			'query_args' => array(
140
-				'post_type'      => array( 'tip' ),
141
-				'post_status'    => array( 'publish' ),
140
+				'post_type'      => array('tip'),
141
+				'post_status'    => array('publish'),
142 142
 				'posts_per_page' => -1,
143 143
 			),
144
-		) );
144
+		));
145 145
 	}
146 146
 
147 147
 	/**
148 148
 	 * Define the metabox and field configurations.
149 149
 	 */
150 150
 	public function featured_metabox() {
151
-		$cmb = new_cmb2_box( array(
151
+		$cmb = new_cmb2_box(array(
152 152
 			'id'           => $this->slug . '_featured_metabox_tip',
153
-			'title'        => __( 'Featured', 'lsx-health-plan' ),
154
-			'object_types' => array( $this->slug ), // Post type
153
+			'title'        => __('Featured', 'lsx-health-plan'),
154
+			'object_types' => array($this->slug), // Post type
155 155
 			'context'      => 'side',
156 156
 			'priority'     => 'high',
157 157
 			'show_names'   => true,
158
-		) );
159
-		$cmb->add_field( array(
160
-			'name'       => __( 'Featured', 'lsx-health-plan' ),
161
-			'desc'       => __( 'Enable the checkbox to feature this tip, featured tips display in any page that has the tip shortcode: [lsx_health_plan_featured_tips_block]' ),
158
+		));
159
+		$cmb->add_field(array(
160
+			'name'       => __('Featured', 'lsx-health-plan'),
161
+			'desc'       => __('Enable the checkbox to feature this tip, featured tips display in any page that has the tip shortcode: [lsx_health_plan_featured_tips_block]'),
162 162
 			'id'         => $this->slug . '_featured_tip',
163 163
 			'type'       => 'checkbox',
164 164
 			'show_on_cb' => 'cmb2_hide_if_no_cats',
165
-		) );
165
+		));
166 166
 	}
167 167
 
168 168
 }
Please login to merge, or discard this patch.
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -8,161 +8,161 @@
 block discarded – undo
8 8
  */
9 9
 class Tip {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\Tip()
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\Tip()
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 = 'tip';
20
+     /**
21
+      * Holds post_type slug used as an index
22
+      *
23
+      * @since 1.0.0
24
+      *
25
+      * @var      string
26
+      */
27
+     public $slug = 'tip';
28 28
 
29
-	/**
30
-	 * Contructor
31
-	 */
32
-	public function __construct() {
33
-		add_action( 'init', array( $this, 'register_post_type' ) );
34
-		add_action( 'admin_menu', array( $this, 'register_menus' ) );
35
-		add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
36
-		add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) );
37
-		add_action( 'cmb2_admin_init', array( $this, 'tips_connections' ), 15 );
38
-	}
29
+     /**
30
+      * Contructor
31
+      */
32
+     public function __construct() {
33
+          add_action( 'init', array( $this, 'register_post_type' ) );
34
+          add_action( 'admin_menu', array( $this, 'register_menus' ) );
35
+          add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
36
+          add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) );
37
+          add_action( 'cmb2_admin_init', array( $this, 'tips_connections' ), 15 );
38
+     }
39 39
 
40
-	/**
41
-	 * Return an instance of this class.
42
-	 *
43
-	 * @since 1.0.0
44
-	 *
45
-	 * @return    object \lsx_health_plan\classes\Tip()    A single instance of this class.
46
-	 */
47
-	public static function get_instance() {
48
-		// If the single instance hasn't been set, set it now.
49
-		if ( null === self::$instance ) {
50
-			self::$instance = new self();
51
-		}
52
-		return self::$instance;
53
-	}
54
-	/**
55
-	 * Register the post type.
56
-	 */
57
-	public function register_post_type() {
58
-		$labels = array(
59
-			'name'               => esc_html__( 'Tip', 'lsx-health-plan' ),
60
-			'singular_name'      => esc_html__( 'Tips', 'lsx-health-plan' ),
61
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
62
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
63
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
64
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
65
-			'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
66
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
67
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
68
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
69
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
70
-			'parent_item_colon'  => '',
71
-			'menu_name'          => esc_html__( 'Tips', 'lsx-health-plan' ),
72
-		);
73
-		$args   = array(
74
-			'labels'             => $labels,
75
-			'public'             => true,
76
-			'publicly_queryable' => false,
77
-			'show_ui'            => true,
78
-			'show_in_menu'       => false,
79
-			'show_in_rest'       => true,
80
-			'menu_icon'          => 'dashicons-admin-post',
81
-			'query_var'          => true,
82
-			'rewrite'            => false,
83
-			'capability_type'    => 'post',
84
-			'has_archive'        => false,
85
-			'hierarchical'       => false,
86
-			'menu_position'      => null,
87
-			'supports'           => array(
88
-				'title',
89
-				'editor',
90
-				'thumbnail',
91
-			),
92
-		);
93
-		register_post_type( 'tip', $args );
94
-	}
40
+     /**
41
+      * Return an instance of this class.
42
+      *
43
+      * @since 1.0.0
44
+      *
45
+      * @return    object \lsx_health_plan\classes\Tip()    A single instance of this class.
46
+      */
47
+     public static function get_instance() {
48
+          // If the single instance hasn't been set, set it now.
49
+          if ( null === self::$instance ) {
50
+               self::$instance = new self();
51
+          }
52
+          return self::$instance;
53
+     }
54
+     /**
55
+      * Register the post type.
56
+      */
57
+     public function register_post_type() {
58
+          $labels = array(
59
+               'name'               => esc_html__( 'Tip', 'lsx-health-plan' ),
60
+               'singular_name'      => esc_html__( 'Tips', 'lsx-health-plan' ),
61
+               'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
62
+               'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
63
+               'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
64
+               'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
65
+               'all_items'          => esc_html__( 'All', 'lsx-health-plan' ),
66
+               'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
67
+               'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
68
+               'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
69
+               'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
70
+               'parent_item_colon'  => '',
71
+               'menu_name'          => esc_html__( 'Tips', 'lsx-health-plan' ),
72
+          );
73
+          $args   = array(
74
+               'labels'             => $labels,
75
+               'public'             => true,
76
+               'publicly_queryable' => false,
77
+               'show_ui'            => true,
78
+               'show_in_menu'       => false,
79
+               'show_in_rest'       => true,
80
+               'menu_icon'          => 'dashicons-admin-post',
81
+               'query_var'          => true,
82
+               'rewrite'            => false,
83
+               'capability_type'    => 'post',
84
+               'has_archive'        => false,
85
+               'hierarchical'       => false,
86
+               'menu_position'      => null,
87
+               'supports'           => array(
88
+                    'title',
89
+                    'editor',
90
+                    'thumbnail',
91
+               ),
92
+          );
93
+          register_post_type( 'tip', $args );
94
+     }
95 95
 
96
-	/**
97
-	 * Registers the Recipes under the Meals Post type menu.
98
-	 *
99
-	 * @return void
100
-	 */
101
-	public function register_menus() {
102
-		add_submenu_page( 'edit.php?post_type=plan', esc_html__( 'Tips', 'lsx-health-plan' ), esc_html__( 'Tips', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=tip' );
103
-	}
96
+     /**
97
+      * Registers the Recipes under the Meals Post type menu.
98
+      *
99
+      * @return void
100
+      */
101
+     public function register_menus() {
102
+          add_submenu_page( 'edit.php?post_type=plan', esc_html__( 'Tips', 'lsx-health-plan' ), esc_html__( 'Tips', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=tip' );
103
+     }
104 104
 
105
-	/**
106
-	 * Enables the Bi Directional relationships
107
-	 *
108
-	 * @param array $connections
109
-	 * @return void
110
-	 */
111
-	public function enable_connections( $connections = array() ) {
112
-		$connections['tip']['connected_plans'] = 'connected_tips';
113
-		$connections['plan']['connected_tips'] = 'connected_plans';
114
-		return $connections;
115
-	}
105
+     /**
106
+      * Enables the Bi Directional relationships
107
+      *
108
+      * @param array $connections
109
+      * @return void
110
+      */
111
+     public function enable_connections( $connections = array() ) {
112
+          $connections['tip']['connected_plans'] = 'connected_tips';
113
+          $connections['plan']['connected_tips'] = 'connected_plans';
114
+          return $connections;
115
+     }
116 116
 
117
-	/**
118
-	 * Registers the workout connections on the plan post type.
119
-	 *
120
-	 * @return void
121
-	 */
122
-	public function tips_connections() {
123
-		$cmb = new_cmb2_box( array(
124
-			'id'           => $this->slug . '_tips_connections_metabox',
125
-			'title'        => __( 'Tips', 'lsx-health-plan' ),
126
-			'object_types' => array( 'plan' ), // Post type
127
-			'context'      => 'normal',
128
-			'priority'     => 'high',
129
-			'show_names'   => false,
130
-		) );
131
-		$cmb->add_field( array(
132
-			'name'       => __( 'Tips', 'lsx-health-plan' ),
133
-			'id'         => 'connected_tips',
134
-			'desc'       => __( 'Connect the tips that apply to this day plan using the field provided.', 'lsx-health-plan' ),
135
-			'type'       => 'post_search_ajax',
136
-			// Optional :
137
-			'limit'      => 15,  // Limit selection to X items only (default 1)
138
-			'sortable'   => true,  // Allow selected items to be sortable (default false)
139
-			'query_args' => array(
140
-				'post_type'      => array( 'tip' ),
141
-				'post_status'    => array( 'publish' ),
142
-				'posts_per_page' => -1,
143
-			),
144
-		) );
145
-	}
117
+     /**
118
+      * Registers the workout connections on the plan post type.
119
+      *
120
+      * @return void
121
+      */
122
+     public function tips_connections() {
123
+          $cmb = new_cmb2_box( array(
124
+               'id'           => $this->slug . '_tips_connections_metabox',
125
+               'title'        => __( 'Tips', 'lsx-health-plan' ),
126
+               'object_types' => array( 'plan' ), // Post type
127
+               'context'      => 'normal',
128
+               'priority'     => 'high',
129
+               'show_names'   => false,
130
+          ) );
131
+          $cmb->add_field( array(
132
+               'name'       => __( 'Tips', 'lsx-health-plan' ),
133
+               'id'         => 'connected_tips',
134
+               'desc'       => __( 'Connect the tips that apply to this day plan using the field provided.', 'lsx-health-plan' ),
135
+               'type'       => 'post_search_ajax',
136
+               // Optional :
137
+               'limit'      => 15,  // Limit selection to X items only (default 1)
138
+               'sortable'   => true,  // Allow selected items to be sortable (default false)
139
+               'query_args' => array(
140
+                    'post_type'      => array( 'tip' ),
141
+                    'post_status'    => array( 'publish' ),
142
+                    'posts_per_page' => -1,
143
+               ),
144
+          ) );
145
+     }
146 146
 
147
-	/**
148
-	 * Define the metabox and field configurations.
149
-	 */
150
-	public function featured_metabox() {
151
-		$cmb = new_cmb2_box( array(
152
-			'id'           => $this->slug . '_featured_metabox_tip',
153
-			'title'        => __( 'Featured', 'lsx-health-plan' ),
154
-			'object_types' => array( $this->slug ), // Post type
155
-			'context'      => 'side',
156
-			'priority'     => 'high',
157
-			'show_names'   => true,
158
-		) );
159
-		$cmb->add_field( array(
160
-			'name'       => __( 'Featured', 'lsx-health-plan' ),
161
-			'desc'       => __( 'Enable the checkbox to feature this tip, featured tips display in any page that has the tip shortcode: [lsx_health_plan_featured_tips_block]' ),
162
-			'id'         => $this->slug . '_featured_tip',
163
-			'type'       => 'checkbox',
164
-			'show_on_cb' => 'cmb2_hide_if_no_cats',
165
-		) );
166
-	}
147
+     /**
148
+      * Define the metabox and field configurations.
149
+      */
150
+     public function featured_metabox() {
151
+          $cmb = new_cmb2_box( array(
152
+               'id'           => $this->slug . '_featured_metabox_tip',
153
+               'title'        => __( 'Featured', 'lsx-health-plan' ),
154
+               'object_types' => array( $this->slug ), // Post type
155
+               'context'      => 'side',
156
+               'priority'     => 'high',
157
+               'show_names'   => true,
158
+          ) );
159
+          $cmb->add_field( array(
160
+               'name'       => __( 'Featured', 'lsx-health-plan' ),
161
+               'desc'       => __( 'Enable the checkbox to feature this tip, featured tips display in any page that has the tip shortcode: [lsx_health_plan_featured_tips_block]' ),
162
+               'id'         => $this->slug . '_featured_tip',
163
+               'type'       => 'checkbox',
164
+               'show_on_cb' => 'cmb2_hide_if_no_cats',
165
+          ) );
166
+     }
167 167
 
168 168
 }
Please login to merge, or discard this patch.
classes/post-types/class-plan.php 2 patches
Spacing   +57 added lines, -57 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_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ), 5 );
37
-		add_action( 'cmb2_admin_init', array( $this, 'plan_connections' ), 5 );
38
-		add_filter( 'pre_get_posts', array( $this, 'set_parent_only' ), 10, 1 );
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_action('cmb2_admin_init', array($this, 'details_metaboxes'), 5);
37
+		add_action('cmb2_admin_init', array($this, 'plan_connections'), 5);
38
+		add_filter('pre_get_posts', array($this, 'set_parent_only'), 10, 1);
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__( 'Plan', 'lsx-health-plan' ),
61
-			'singular_name'      => esc_html__( 'Plans', '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', '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__('Plan', 'lsx-health-plan'),
61
+			'singular_name'      => esc_html__('Plans', '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', '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__( 'Plans', 'lsx-health-plan' ),
72
+			'menu_name'          => esc_html__('Plans', '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-welcome-write-blog',
82 82
 			'query_var'          => true,
83 83
 			'rewrite'            => array(
84
-				'slug' => \lsx_health_plan\functions\get_option( 'plan_single_slug', 'plan' ),
84
+				'slug' => \lsx_health_plan\functions\get_option('plan_single_slug', 'plan'),
85 85
 			),
86 86
 			'capability_type'    => 'page',
87
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_plan_archive', 'plans' ),
87
+			'has_archive'        => \lsx_health_plan\functions\get_option('endpoint_plan_archive', 'plans'),
88 88
 			'hierarchical'       => true,
89 89
 			'menu_position'      => null,
90 90
 			'supports'           => array(
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 				'page-attributes',
95 95
 			),
96 96
 		);
97
-		register_post_type( 'plan', $args );
97
+		register_post_type('plan', $args);
98 98
 	}
99 99
 
100 100
 	/**
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function taxonomy_setup() {
104 104
 		$labels = array(
105
-			'name'              => esc_html_x( 'Week', 'taxonomy general name', 'lsx-health-plan' ),
106
-			'singular_name'     => esc_html_x( 'Week', 'taxonomy singular name', 'lsx-health-plan' ),
107
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
108
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
109
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
110
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
111
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
112
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
113
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
114
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
115
-			'menu_name'         => esc_html__( 'Weeks', 'lsx-health-plan' ),
105
+			'name'              => esc_html_x('Week', 'taxonomy general name', 'lsx-health-plan'),
106
+			'singular_name'     => esc_html_x('Week', 'taxonomy singular name', 'lsx-health-plan'),
107
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
108
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
109
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
110
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
111
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
112
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
113
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
114
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
115
+			'menu_name'         => esc_html__('Weeks', 'lsx-health-plan'),
116 116
 		);
117 117
 
118 118
 		$args = array(
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			),
127 127
 		);
128 128
 
129
-		register_taxonomy( 'week', array( 'plan' ), $args );
129
+		register_taxonomy('week', array('plan'), $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
 	}
@@ -144,33 +144,33 @@  discard block
 block discarded – undo
144 144
 	 * Define the metabox and field configurations.
145 145
 	 */
146 146
 	public function details_metaboxes() {
147
-		$cmb = new_cmb2_box( array(
147
+		$cmb = new_cmb2_box(array(
148 148
 			'id'           => $this->slug . '_details_metabox',
149
-			'title'        => __( 'Details', 'lsx-health-plan' ),
150
-			'object_types' => array( $this->slug ), // Post type
149
+			'title'        => __('Details', 'lsx-health-plan'),
150
+			'object_types' => array($this->slug), // Post type
151 151
 			'context'      => 'normal',
152 152
 			'priority'     => 'high',
153 153
 			'show_names'   => true,
154
-		) );
154
+		));
155 155
 
156 156
 		$warmup_type = 'page';
157
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
158
-			$warmup_type = array( 'page', 'workout' );
157
+		if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
158
+			$warmup_type = array('page', 'workout');
159 159
 		}
160
-		$cmb->add_field( array(
161
-			'name'       => __( 'Warmup', 'lsx-health-plan' ),
162
-			'desc'       => __( 'Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan' ),
160
+		$cmb->add_field(array(
161
+			'name'       => __('Warmup', 'lsx-health-plan'),
162
+			'desc'       => __('Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan'),
163 163
 			'id'         => $this->slug . '_warmup',
164 164
 			'type'       => 'post_search_ajax',
165 165
 			// Optional :
166
-			'limit'      => 3,  // Limit selection to X items only (default 1)
166
+			'limit'      => 3, // Limit selection to X items only (default 1)
167 167
 			'sortable'   => true, // Allow selected items to be sortable (default false)
168 168
 			'query_args' => array(
169 169
 				'post_type'      => $warmup_type,
170
-				'post_status'    => array( 'publish' ),
170
+				'post_status'    => array('publish'),
171 171
 				'posts_per_page' => -1,
172 172
 			),
173
-		) );
173
+		));
174 174
 	}
175 175
 
176 176
 	/**
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 		$cmb = new_cmb2_box(
183 183
 			array(
184 184
 				'id'           => $this->slug . '_connections_metabox',
185
-				'title'        => __( 'Plans', 'lsx-health-plan' ),
186
-				'object_types' => array( 'workout', 'meal', 'tip', 'recipe' ),
185
+				'title'        => __('Plans', 'lsx-health-plan'),
186
+				'object_types' => array('workout', 'meal', 'tip', 'recipe'),
187 187
 				'context'      => 'normal',
188 188
 				'priority'     => 'high',
189 189
 				'show_names'   => true,
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
 		);
192 192
 		$cmb->add_field(
193 193
 			array(
194
-				'name'       => __( 'Plan', 'lsx-health-plan' ),
194
+				'name'       => __('Plan', 'lsx-health-plan'),
195 195
 				'id'         => 'connected_plans',
196
-				'desc'       => __( 'Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan' ),
196
+				'desc'       => __('Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan'),
197 197
 				'type'       => 'post_search_ajax',
198 198
 				'limit'      => 15,
199 199
 				'sortable'   => true,
200 200
 				'query_args' => array(
201
-					'post_type'      => array( 'plan' ),
202
-					'post_status'    => array( 'publish' ),
201
+					'post_type'      => array('plan'),
202
+					'post_status'    => array('publish'),
203 203
 					'posts_per_page' => -1,
204 204
 				),
205 205
 			)
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 	 * @param object $wp_query
213 213
 	 * @return array
214 214
 	 */
215
-	public function set_parent_only( $wp_query ) {
216
-		if ( ! is_admin() && $wp_query->is_main_query() && $wp_query->is_post_type_archive() && 'plan' === $wp_query->get_query_var( 'post_type' ) ) {
217
-			$wp_query->set( 'parent', '0' );
215
+	public function set_parent_only($wp_query) {
216
+		if ( ! is_admin() && $wp_query->is_main_query() && $wp_query->is_post_type_archive() && 'plan' === $wp_query->get_query_var('post_type')) {
217
+			$wp_query->set('parent', '0');
218 218
 		}
219 219
 		return $wp_query;
220 220
 	}
Please login to merge, or discard this patch.
Indentation   +199 added lines, -199 removed lines patch added patch discarded remove patch
@@ -8,214 +8,214 @@
 block discarded – undo
8 8
  */
9 9
 class Plan {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\Plan()
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\Plan()
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 = 'plan';
20
+     /**
21
+      * Holds post_type slug used as an index
22
+      *
23
+      * @since 1.0.0
24
+      *
25
+      * @var      string
26
+      */
27
+     public $slug = 'plan';
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_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ), 5 );
37
-		add_action( 'cmb2_admin_init', array( $this, 'plan_connections' ), 5 );
38
-		add_filter( 'pre_get_posts', array( $this, 'set_parent_only' ), 10, 1 );
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_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ), 5 );
37
+          add_action( 'cmb2_admin_init', array( $this, 'plan_connections' ), 5 );
38
+          add_filter( 'pre_get_posts', array( $this, 'set_parent_only' ), 10, 1 );
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\Meal_Plan()    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__( 'Plan', 'lsx-health-plan' ),
61
-			'singular_name'      => esc_html__( 'Plans', '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', '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__( 'Plans', '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-welcome-write-blog',
82
-			'query_var'          => true,
83
-			'rewrite'            => array(
84
-				'slug' => \lsx_health_plan\functions\get_option( 'plan_single_slug', 'plan' ),
85
-			),
86
-			'capability_type'    => 'page',
87
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_plan_archive', 'plans' ),
88
-			'hierarchical'       => true,
89
-			'menu_position'      => null,
90
-			'supports'           => array(
91
-				'title',
92
-				'editor',
93
-				'thumbnail',
94
-				'page-attributes',
95
-			),
96
-		);
97
-		register_post_type( 'plan', $args );
98
-	}
41
+     /**
42
+      * Return an instance of this class.
43
+      *
44
+      * @since 1.0.0
45
+      *
46
+      * @return    object \lsx_health_plan\classes\Meal_Plan()    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__( 'Plan', 'lsx-health-plan' ),
61
+               'singular_name'      => esc_html__( 'Plans', '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', '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__( 'Plans', '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-welcome-write-blog',
82
+               'query_var'          => true,
83
+               'rewrite'            => array(
84
+                    'slug' => \lsx_health_plan\functions\get_option( 'plan_single_slug', 'plan' ),
85
+               ),
86
+               'capability_type'    => 'page',
87
+               'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_plan_archive', 'plans' ),
88
+               'hierarchical'       => true,
89
+               'menu_position'      => null,
90
+               'supports'           => array(
91
+                    'title',
92
+                    'editor',
93
+                    'thumbnail',
94
+                    'page-attributes',
95
+               ),
96
+          );
97
+          register_post_type( 'plan', $args );
98
+     }
99 99
 
100
-	/**
101
-	 * Register the Week taxonomy.
102
-	 */
103
-	public function taxonomy_setup() {
104
-		$labels = array(
105
-			'name'              => esc_html_x( 'Week', 'taxonomy general name', 'lsx-health-plan' ),
106
-			'singular_name'     => esc_html_x( 'Week', 'taxonomy singular name', 'lsx-health-plan' ),
107
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
108
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
109
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
110
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
111
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
112
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
113
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
114
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
115
-			'menu_name'         => esc_html__( 'Weeks', 'lsx-health-plan' ),
116
-		);
100
+     /**
101
+      * Register the Week taxonomy.
102
+      */
103
+     public function taxonomy_setup() {
104
+          $labels = array(
105
+               'name'              => esc_html_x( 'Week', 'taxonomy general name', 'lsx-health-plan' ),
106
+               'singular_name'     => esc_html_x( 'Week', 'taxonomy singular name', 'lsx-health-plan' ),
107
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
108
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
109
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
110
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
111
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
112
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
113
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
114
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
115
+               'menu_name'         => esc_html__( 'Weeks', 'lsx-health-plan' ),
116
+          );
117 117
 
118
-		$args = array(
119
-			'hierarchical'      => true,
120
-			'labels'            => $labels,
121
-			'show_ui'           => true,
122
-			'show_admin_column' => true,
123
-			'query_var'         => true,
124
-			'rewrite'           => array(
125
-				'slug' => 'week',
126
-			),
127
-		);
118
+          $args = array(
119
+               'hierarchical'      => true,
120
+               'labels'            => $labels,
121
+               'show_ui'           => true,
122
+               'show_admin_column' => true,
123
+               'query_var'         => true,
124
+               'rewrite'           => array(
125
+                    'slug' => 'week',
126
+               ),
127
+          );
128 128
 
129
-		register_taxonomy( 'week', array( 'plan' ), $args );
130
-	}
129
+          register_taxonomy( 'week', array( 'plan' ), $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
-	 * Define the metabox and field configurations.
145
-	 */
146
-	public function details_metaboxes() {
147
-		$cmb = new_cmb2_box( array(
148
-			'id'           => $this->slug . '_details_metabox',
149
-			'title'        => __( 'Details', 'lsx-health-plan' ),
150
-			'object_types' => array( $this->slug ), // Post type
151
-			'context'      => 'normal',
152
-			'priority'     => 'high',
153
-			'show_names'   => true,
154
-		) );
143
+     /**
144
+      * Define the metabox and field configurations.
145
+      */
146
+     public function details_metaboxes() {
147
+          $cmb = new_cmb2_box( array(
148
+               'id'           => $this->slug . '_details_metabox',
149
+               'title'        => __( 'Details', 'lsx-health-plan' ),
150
+               'object_types' => array( $this->slug ), // Post type
151
+               'context'      => 'normal',
152
+               'priority'     => 'high',
153
+               'show_names'   => true,
154
+          ) );
155 155
 
156
-		$warmup_type = 'page';
157
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
158
-			$warmup_type = array( 'page', 'workout' );
159
-		}
160
-		$cmb->add_field( array(
161
-			'name'       => __( 'Warmup', 'lsx-health-plan' ),
162
-			'desc'       => __( 'Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan' ),
163
-			'id'         => $this->slug . '_warmup',
164
-			'type'       => 'post_search_ajax',
165
-			// Optional :
166
-			'limit'      => 3,  // Limit selection to X items only (default 1)
167
-			'sortable'   => true, // Allow selected items to be sortable (default false)
168
-			'query_args' => array(
169
-				'post_type'      => $warmup_type,
170
-				'post_status'    => array( 'publish' ),
171
-				'posts_per_page' => -1,
172
-			),
173
-		) );
174
-	}
156
+          $warmup_type = 'page';
157
+          if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
158
+               $warmup_type = array( 'page', 'workout' );
159
+          }
160
+          $cmb->add_field( array(
161
+               'name'       => __( 'Warmup', 'lsx-health-plan' ),
162
+               'desc'       => __( 'Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan' ),
163
+               'id'         => $this->slug . '_warmup',
164
+               'type'       => 'post_search_ajax',
165
+               // Optional :
166
+               'limit'      => 3,  // Limit selection to X items only (default 1)
167
+               'sortable'   => true, // Allow selected items to be sortable (default false)
168
+               'query_args' => array(
169
+                    'post_type'      => $warmup_type,
170
+                    'post_status'    => array( 'publish' ),
171
+                    'posts_per_page' => -1,
172
+               ),
173
+          ) );
174
+     }
175 175
 
176
-	/**
177
-	 * Registers the workout connections on the plan post type.
178
-	 *
179
-	 * @return void
180
-	 */
181
-	public function plan_connections() {
182
-		$cmb = new_cmb2_box(
183
-			array(
184
-				'id'           => $this->slug . '_connections_metabox',
185
-				'title'        => __( 'Plans', 'lsx-health-plan' ),
186
-				'object_types' => array( 'workout', 'meal', 'tip', 'recipe' ),
187
-				'context'      => 'normal',
188
-				'priority'     => 'high',
189
-				'show_names'   => true,
190
-			)
191
-		);
192
-		$cmb->add_field(
193
-			array(
194
-				'name'       => __( 'Plan', 'lsx-health-plan' ),
195
-				'id'         => 'connected_plans',
196
-				'desc'       => __( 'Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan' ),
197
-				'type'       => 'post_search_ajax',
198
-				'limit'      => 15,
199
-				'sortable'   => true,
200
-				'query_args' => array(
201
-					'post_type'      => array( 'plan' ),
202
-					'post_status'    => array( 'publish' ),
203
-					'posts_per_page' => -1,
204
-				),
205
-			)
206
-		);
207
-	}
176
+     /**
177
+      * Registers the workout connections on the plan post type.
178
+      *
179
+      * @return void
180
+      */
181
+     public function plan_connections() {
182
+          $cmb = new_cmb2_box(
183
+               array(
184
+                    'id'           => $this->slug . '_connections_metabox',
185
+                    'title'        => __( 'Plans', 'lsx-health-plan' ),
186
+                    'object_types' => array( 'workout', 'meal', 'tip', 'recipe' ),
187
+                    'context'      => 'normal',
188
+                    'priority'     => 'high',
189
+                    'show_names'   => true,
190
+               )
191
+          );
192
+          $cmb->add_field(
193
+               array(
194
+                    'name'       => __( 'Plan', 'lsx-health-plan' ),
195
+                    'id'         => 'connected_plans',
196
+                    'desc'       => __( 'Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan' ),
197
+                    'type'       => 'post_search_ajax',
198
+                    'limit'      => 15,
199
+                    'sortable'   => true,
200
+                    'query_args' => array(
201
+                         'post_type'      => array( 'plan' ),
202
+                         'post_status'    => array( 'publish' ),
203
+                         'posts_per_page' => -1,
204
+                    ),
205
+               )
206
+          );
207
+     }
208 208
 
209
-	/**
210
-	 * Set the post type archive to show the parent plans only.
211
-	 *
212
-	 * @param object $wp_query
213
-	 * @return array
214
-	 */
215
-	public function set_parent_only( $wp_query ) {
216
-		if ( ! is_admin() && $wp_query->is_main_query() && $wp_query->is_post_type_archive() && 'plan' === $wp_query->get_query_var( 'post_type' ) ) {
217
-			$wp_query->set( 'parent', '0' );
218
-		}
219
-		return $wp_query;
220
-	}
209
+     /**
210
+      * Set the post type archive to show the parent plans only.
211
+      *
212
+      * @param object $wp_query
213
+      * @return array
214
+      */
215
+     public function set_parent_only( $wp_query ) {
216
+          if ( ! is_admin() && $wp_query->is_main_query() && $wp_query->is_post_type_archive() && 'plan' === $wp_query->get_query_var( 'post_type' ) ) {
217
+               $wp_query->set( 'parent', '0' );
218
+          }
219
+          return $wp_query;
220
+     }
221 221
 }
Please login to merge, or discard this patch.