Test Setup Failed
Branch master (ac4436)
by Ashley
05:32
created
includes/template-tags.php 1 patch
Spacing   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -14,23 +14,23 @@  discard block
 block discarded – undo
14 14
 	?>
15 15
 	<div class="col-md-4" >
16 16
 		<div class="lsx-health-plan-box">
17
-			<h3 class="title warm-up-title title-lined"><?php esc_html_e( 'Your Warm-up', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'warm.svg' ); ?></h3>
17
+			<h3 class="title warm-up-title title-lined"><?php esc_html_e('Your Warm-up', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('warm.svg'); ?></h3>
18 18
 			<div class="spacer"></div>
19 19
 			<?php
20
-			$intro_text = \lsx_health_plan\functions\get_option( 'warmup_intro', false );
21
-			if ( false !== $intro_text ) {
20
+			$intro_text = \lsx_health_plan\functions\get_option('warmup_intro', false);
21
+			if (false !== $intro_text) {
22 22
 				?>
23 23
 				<div class="excerpt">
24
-					<p><?php echo wp_kses_post( $intro_text ); ?></p>
24
+					<p><?php echo wp_kses_post($intro_text); ?></p>
25 25
 				</div>
26 26
 				<?php
27 27
 			}
28
-			$warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false );
29
-			if ( false === $warm_up ) {
28
+			$warm_up = \lsx_health_plan\functions\get_option('endpoint_warm_up', false);
29
+			if (false === $warm_up) {
30 30
 				$warm_up = 'warm-up';
31 31
 			}
32 32
 			?>
33
-			<a href="<?php the_permalink(); ?><?php echo esc_attr( $warm_up ); ?>/" class="btn"><?php esc_html_e( 'Start your warm-up', 'lsx-health-plan' ); ?></a>
33
+			<a href="<?php the_permalink(); ?><?php echo esc_attr($warm_up); ?>/" class="btn"><?php esc_html_e('Start your warm-up', 'lsx-health-plan'); ?></a>
34 34
 		</div>
35 35
 	</div>
36 36
 <?php
@@ -42,29 +42,29 @@  discard block
 block discarded – undo
42 42
 * @return void
43 43
 */
44 44
 function lsx_health_plan_workout_box() {
45
-	if ( ! post_type_exists( 'workout' ) ) {
45
+	if ( ! post_type_exists('workout')) {
46 46
 		return;
47 47
 	}
48 48
 	?>
49 49
 	<div class="col-md-4" >
50 50
 		<div class="lsx-health-plan-box">
51
-			<h3 class="title work-out-title title-lined"><?php esc_html_e( 'Your Workout', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'work.svg' ); ?></h3>
51
+			<h3 class="title work-out-title title-lined"><?php esc_html_e('Your Workout', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('work.svg'); ?></h3>
52 52
 			<div class="spacer"></div>
53 53
 			<?php
54
-			$intro_text = \lsx_health_plan\functions\get_option( 'workout_intro', false );
55
-			if ( false !== $intro_text ) {
54
+			$intro_text = \lsx_health_plan\functions\get_option('workout_intro', false);
55
+			if (false !== $intro_text) {
56 56
 				?>
57 57
 				<div class="excerpt">
58
-					<p><?php echo wp_kses_post( $intro_text ); ?></p>
58
+					<p><?php echo wp_kses_post($intro_text); ?></p>
59 59
 				</div>
60 60
 				<?php
61 61
 			}
62
-			$workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false );
63
-			if ( false === $workout ) {
62
+			$workout = \lsx_health_plan\functions\get_option('endpoint_workout', false);
63
+			if (false === $workout) {
64 64
 				$workout = 'workout';
65 65
 			}
66 66
 			?>
67
-			<a href="<?php the_permalink(); ?><?php echo esc_attr( $workout ); ?>/" class="btn"><?php esc_html_e( 'Start your workout', 'lsx-health-plan' ); ?></a>
67
+			<a href="<?php the_permalink(); ?><?php echo esc_attr($workout); ?>/" class="btn"><?php esc_html_e('Start your workout', 'lsx-health-plan'); ?></a>
68 68
 		</div>
69 69
 	</div>
70 70
 <?php
@@ -76,29 +76,29 @@  discard block
 block discarded – undo
76 76
 * @return void
77 77
 */
78 78
 function lsx_health_plan_meal_box() {
79
-	if ( ! post_type_exists( 'meal' ) ) {
79
+	if ( ! post_type_exists('meal')) {
80 80
 		return;
81 81
 	}
82 82
 	?>
83 83
 	<div class="col-md-4" >
84 84
 		<div class="lsx-health-plan-box">
85
-			<h3 class="title meal-plan-title title-lined"><?php esc_html_e( 'Your Meal Plan', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'meal.svg' ); ?></h3>
85
+			<h3 class="title meal-plan-title title-lined"><?php esc_html_e('Your Meal Plan', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('meal.svg'); ?></h3>
86 86
 			<div class="spacer"></div>
87 87
 			<?php
88
-			$intro_text = \lsx_health_plan\functions\get_option( 'meal_plan_intro', false );
89
-			if ( false !== $intro_text ) {
88
+			$intro_text = \lsx_health_plan\functions\get_option('meal_plan_intro', false);
89
+			if (false !== $intro_text) {
90 90
 				?>
91 91
 				<div class="excerpt">
92
-					<p><?php echo wp_kses_post( $intro_text ); ?></p>
92
+					<p><?php echo wp_kses_post($intro_text); ?></p>
93 93
 				</div>
94 94
 				<?php
95 95
 			}
96
-			$meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false );
97
-			if ( false === $meal ) {
96
+			$meal = \lsx_health_plan\functions\get_option('endpoint_meal', false);
97
+			if (false === $meal) {
98 98
 				$meal = 'meal';
99 99
 			}
100 100
 			?>
101
-			<a href="<?php the_permalink(); ?><?php echo esc_attr( $meal ); ?>/" class="btn"><?php esc_html_e( 'View your meal plan', 'lsx-health-plan' ); ?></a>
101
+			<a href="<?php the_permalink(); ?><?php echo esc_attr($meal); ?>/" class="btn"><?php esc_html_e('View your meal plan', 'lsx-health-plan'); ?></a>
102 102
 		</div>
103 103
 	</div>
104 104
 <?php
@@ -110,29 +110,29 @@  discard block
 block discarded – undo
110 110
 * @return void
111 111
 */
112 112
 function lsx_health_plan_recipe_box() {
113
-	if ( ! post_type_exists( 'recipe' ) ) {
113
+	if ( ! post_type_exists('recipe')) {
114 114
 		return;
115 115
 	}
116 116
 	?>
117 117
 	<div class="col-md-4" >
118 118
 		<div class="lsx-health-plan-box">
119
-			<h3 class="title recipes-title title-lined"><?php esc_html_e( 'Recipes', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'recipes.svg' ); ?></h3>
119
+			<h3 class="title recipes-title title-lined"><?php esc_html_e('Recipes', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('recipes.svg'); ?></h3>
120 120
 			<div class="spacer"></div>
121 121
 			<?php
122
-			$intro_text = \lsx_health_plan\functions\get_option( 'recipes_intro', false );
123
-			if ( false !== $intro_text ) {
122
+			$intro_text = \lsx_health_plan\functions\get_option('recipes_intro', false);
123
+			if (false !== $intro_text) {
124 124
 				?>
125 125
 				<div class="excerpt">
126
-					<p><?php echo wp_kses_post( $intro_text ); ?></p>
126
+					<p><?php echo wp_kses_post($intro_text); ?></p>
127 127
 				</div>
128 128
 				<?php
129 129
 			}
130
-			$recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false );
131
-			if ( false === $recipes ) {
130
+			$recipes = \lsx_health_plan\functions\get_option('endpoint_recipe', false);
131
+			if (false === $recipes) {
132 132
 				$recipes = 'recipes';
133 133
 			}
134 134
 			?>
135
-			<a href="<?php the_permalink(); ?><?php echo esc_attr( $recipes ); ?>/" class="btn"><?php esc_html_e( 'View all recipes', 'lsx-health-plan' ); ?></a>
135
+			<a href="<?php the_permalink(); ?><?php echo esc_attr($recipes); ?>/" class="btn"><?php esc_html_e('View all recipes', 'lsx-health-plan'); ?></a>
136 136
 		</div>
137 137
 	</div>
138 138
 <?php
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
 	?>
149 149
 	<div class="col-md-4 day-download-box" >
150 150
 		<div class="lsx-health-plan-box">
151
-			<h3 class="title downloads-title title-lined"><?php esc_html_e( 'Downloads', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'download.svg' ); ?></h3>
151
+			<h3 class="title downloads-title title-lined"><?php esc_html_e('Downloads', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('download.svg'); ?></h3>
152 152
 			<div class="spacer"></div>
153 153
 			<div class="download-list">
154 154
 				<ul>
155 155
 					<?php
156 156
 					$downloads = \lsx_health_plan\functions\get_downloads();
157
-					if ( ! empty( $downloads ) ) {
158
-						foreach ( $downloads as $download ) {
159
-							echo wp_kses_post( '<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode( '[download id="' . $download . '"]' ) . '</a></li>' );
157
+					if ( ! empty($downloads)) {
158
+						foreach ($downloads as $download) {
159
+							echo wp_kses_post('<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode('[download id="' . $download . '"]') . '</a></li>');
160 160
 						}
161 161
 					}
162 162
 					?>
@@ -173,15 +173,15 @@  discard block
 block discarded – undo
173 173
  * @param string $tab
174 174
  * @return void
175 175
  */
176
-function lsx_health_plan_nav_class( $tab = '' ) {
176
+function lsx_health_plan_nav_class($tab = '') {
177 177
 	$nav_classes = array();
178
-	if ( function_exists( 'is_wc_endpoint_url' ) && 'edit-account' === $tab && is_wc_endpoint_url( 'edit-account' ) ) {
178
+	if (function_exists('is_wc_endpoint_url') && 'edit-account' === $tab && is_wc_endpoint_url('edit-account')) {
179 179
 		$nav_classes[] = 'active';
180
-	} elseif ( lsx_health_plan_is_current_tab( $tab ) ) {
180
+	} elseif (lsx_health_plan_is_current_tab($tab)) {
181 181
 		$nav_classes[] = 'active';
182 182
 	}
183
-	if ( ! empty( $nav_classes ) ) {
184
-		echo wp_kses_post( implode( ' ', $nav_classes ) );
183
+	if ( ! empty($nav_classes)) {
184
+		echo wp_kses_post(implode(' ', $nav_classes));
185 185
 	}
186 186
 }
187 187
 
@@ -196,19 +196,19 @@  discard block
 block discarded – undo
196 196
 		<ul class="nav nav-pills">
197 197
 			<li class="
198 198
 			<?php
199
-			if ( ( function_exists( 'is_wc_endpoint_url' ) && ! is_wc_endpoint_url( 'edit-account' ) ) || ! function_exists( 'is_wc_endpoint_url' ) ) {
200
-				echo esc_attr( 'active' );
199
+			if ((function_exists('is_wc_endpoint_url') && ! is_wc_endpoint_url('edit-account')) || ! function_exists('is_wc_endpoint_url')) {
200
+				echo esc_attr('active');
201 201
 			}
202 202
 			?>
203
-			"><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e( 'My Plan', 'lsx-health-plan' ); ?></a></li>
203
+			"><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e('My Plan', 'lsx-health-plan'); ?></a></li>
204 204
 			<li class="
205 205
 			<?php
206
-			if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) {
207
-				echo esc_attr( 'active' );
206
+			if (function_exists('is_wc_endpoint_url') && is_wc_endpoint_url('edit-account')) {
207
+				echo esc_attr('active');
208 208
 			}
209 209
 			?>
210
-			"><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e( 'Account Details', 'lsx-health-plan' ); ?></a></li>
211
-			<li class=""><a class="logout-tab" href="<?php echo esc_url( wp_logout_url( get_permalink() ) ); ?>"><?php esc_html_e( 'Logout', 'lsx-health-plan' ); ?></a></li>
210
+			"><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e('Account Details', 'lsx-health-plan'); ?></a></li>
211
+			<li class=""><a class="logout-tab" href="<?php echo esc_url(wp_logout_url(get_permalink())); ?>"><?php esc_html_e('Logout', 'lsx-health-plan'); ?></a></li>
212 212
 		</ul>
213 213
 	</div>
214 214
 	<?php
@@ -227,48 +227,48 @@  discard block
 block discarded – undo
227 227
 			<?php
228 228
 				global $current_user;
229 229
 				get_current_user();
230
-				echo get_avatar( $current_user->ID, 240 );
230
+				echo get_avatar($current_user->ID, 240);
231 231
 				?>
232 232
 			</div>
233 233
 			<div class="edit-profile">
234 234
 				<?php
235
-				if ( function_exists( 'wc_get_page_id' ) ) {
236
-					$url_id = wc_get_page_id( 'myaccount' );
235
+				if (function_exists('wc_get_page_id')) {
236
+					$url_id = wc_get_page_id('myaccount');
237 237
 				} else {
238 238
 					$url_id = '';
239 239
 				}
240 240
 				?>
241
-				<a class="btn btn-green" href="<?php echo esc_url( get_permalink( $url_id ) ); ?>edit-account/"><?php esc_html_e( 'Edit Profile', 'lsx-health-plan' ); ?></a>
241
+				<a class="btn btn-green" href="<?php echo esc_url(get_permalink($url_id)); ?>edit-account/"><?php esc_html_e('Edit Profile', 'lsx-health-plan'); ?></a>
242 242
 			</div>
243 243
 		</div>
244 244
 
245 245
 		<div class="profile-details">
246
-			<h1 class="title-lined"><?php echo esc_html( $current_user->display_name ); ?></h1>
246
+			<h1 class="title-lined"><?php echo esc_html($current_user->display_name); ?></h1>
247 247
 			<?php
248
-			$disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false );
249
-			if ( 'on' !== $disable_stats ) {
248
+			$disable_stats = \lsx_health_plan\functions\get_option('disable_all_stats', false);
249
+			if ('on' !== $disable_stats) {
250 250
 
251
-				$is_weight_disabled  = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false );
252
-				$is_waist_disabled   = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false );
253
-				$is_fitness_disabled = \lsx_health_plan\functions\get_option( 'disable_fitness_checkbox', false );
251
+				$is_weight_disabled  = \lsx_health_plan\functions\get_option('disable_weight_checkbox', false);
252
+				$is_waist_disabled   = \lsx_health_plan\functions\get_option('disable_waist_checkbox', false);
253
+				$is_fitness_disabled = \lsx_health_plan\functions\get_option('disable_fitness_checkbox', false);
254 254
 				?>
255 255
 				<table class="table personal-information">
256 256
 					<thead>
257 257
 					<tr>
258 258
 						<th scope="col"></th>
259
-						<th scope="col"><strong><?php esc_html_e( 'Start', 'lsx-health-plan' ); ?></strong></th>
260
-						<th scope="col"><strong><?php esc_html_e( 'Goal', 'lsx-health-plan' ); ?></strong></th>
261
-						<th scope="col"><strong><?php esc_html_e( 'Current', 'lsx-health-plan' ); ?></strong></th>
259
+						<th scope="col"><strong><?php esc_html_e('Start', 'lsx-health-plan'); ?></strong></th>
260
+						<th scope="col"><strong><?php esc_html_e('Goal', 'lsx-health-plan'); ?></strong></th>
261
+						<th scope="col"><strong><?php esc_html_e('Current', 'lsx-health-plan'); ?></strong></th>
262 262
 					</tr>
263 263
 					</thead>
264 264
 					<tbody>
265
-					<?php if ( 'on' !== $is_weight_disabled ) { ?>
265
+					<?php if ('on' !== $is_weight_disabled) { ?>
266 266
 						<tr>
267
-							<th scope="row"><strong><?php esc_html_e( 'Weight:', 'lsx-health-plan' ); ?></strong></th>
267
+							<th scope="row"><strong><?php esc_html_e('Weight:', 'lsx-health-plan'); ?></strong></th>
268 268
 							<td>
269 269
 								<?php
270
-								if ( '' !== get_user_meta( get_current_user_id(), 'weight_start', true ) ) {
271
-									echo wp_kses_post( get_user_meta( get_current_user_id(), 'weight_start', true ) . ' kg' );
270
+								if ('' !== get_user_meta(get_current_user_id(), 'weight_start', true)) {
271
+									echo wp_kses_post(get_user_meta(get_current_user_id(), 'weight_start', true) . ' kg');
272 272
 								} else {
273 273
 									echo '/';
274 274
 								}
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
 							</td>
277 277
 							<td>
278 278
 								<?php
279
-								if ( '' !== get_user_meta( get_current_user_id(), 'weight_goal', true ) ) {
280
-									echo wp_kses_post( get_user_meta( get_current_user_id(), 'weight_goal', true ) . ' kg' );
279
+								if ('' !== get_user_meta(get_current_user_id(), 'weight_goal', true)) {
280
+									echo wp_kses_post(get_user_meta(get_current_user_id(), 'weight_goal', true) . ' kg');
281 281
 								} else {
282 282
 									echo '/';
283 283
 								}
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 							</td>
286 286
 							<td>
287 287
 								<?php
288
-								if ( '' !== get_user_meta( get_current_user_id(), 'weight_end', true ) ) {
289
-									echo wp_kses_post( get_user_meta( get_current_user_id(), 'weight_end', true ) . ' kg' );
288
+								if ('' !== get_user_meta(get_current_user_id(), 'weight_end', true)) {
289
+									echo wp_kses_post(get_user_meta(get_current_user_id(), 'weight_end', true) . ' kg');
290 290
 								} else {
291 291
 									echo '/';
292 292
 								}
@@ -294,13 +294,13 @@  discard block
 block discarded – undo
294 294
 							</td>
295 295
 						</tr>
296 296
 					<?php } ?>
297
-					<?php if ( 'on' !== $is_waist_disabled ) { ?>
297
+					<?php if ('on' !== $is_waist_disabled) { ?>
298 298
 						<tr>
299
-							<th scope="row"><strong><?php esc_html_e( 'Waist:', 'lsx-health-plan' ); ?></strong></th>
299
+							<th scope="row"><strong><?php esc_html_e('Waist:', 'lsx-health-plan'); ?></strong></th>
300 300
 							<td>
301 301
 								<?php
302
-								if ( '' !== get_user_meta( get_current_user_id(), 'waist_start', true ) ) {
303
-									echo wp_kses_post( get_user_meta( get_current_user_id(), 'waist_start', true ) . ' cm' );
302
+								if ('' !== get_user_meta(get_current_user_id(), 'waist_start', true)) {
303
+									echo wp_kses_post(get_user_meta(get_current_user_id(), 'waist_start', true) . ' cm');
304 304
 								} else {
305 305
 									echo '/';
306 306
 								}
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
 							</td>
309 309
 							<td>
310 310
 								<?php
311
-								if ( '' !== get_user_meta( get_current_user_id(), 'waist_goal', true ) ) {
312
-									echo wp_kses_post( get_user_meta( get_current_user_id(), 'waist_goal', true ) . ' cm' );
311
+								if ('' !== get_user_meta(get_current_user_id(), 'waist_goal', true)) {
312
+									echo wp_kses_post(get_user_meta(get_current_user_id(), 'waist_goal', true) . ' cm');
313 313
 								} else {
314 314
 									echo '/';
315 315
 								}
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 							</td>
318 318
 							<td>
319 319
 								<?php
320
-								if ( '' !== get_user_meta( get_current_user_id(), 'waist_end', true ) ) {
321
-									echo wp_kses_post( get_user_meta( get_current_user_id(), 'waist_end', true ) . ' cm' );
320
+								if ('' !== get_user_meta(get_current_user_id(), 'waist_end', true)) {
321
+									echo wp_kses_post(get_user_meta(get_current_user_id(), 'waist_end', true) . ' cm');
322 322
 								} else {
323 323
 									echo '/';
324 324
 								}
@@ -326,13 +326,13 @@  discard block
 block discarded – undo
326 326
 							</td>
327 327
 						</tr>
328 328
 					<?php } ?>
329
-					<?php if ( 'on' !== $is_fitness_disabled ) { ?>
329
+					<?php if ('on' !== $is_fitness_disabled) { ?>
330 330
 						<tr>
331
-							<th scope="row"><strong><?php esc_html_e( 'Fitness:', 'lsx-health-plan' ); ?></strong></th>
331
+							<th scope="row"><strong><?php esc_html_e('Fitness:', 'lsx-health-plan'); ?></strong></th>
332 332
 							<td>
333 333
 								<?php
334
-								if ( '' !== get_user_meta( get_current_user_id(), 'fitness_start', true ) ) {
335
-									echo wp_kses_post( get_user_meta( get_current_user_id(), 'fitness_start', true ) );
334
+								if ('' !== get_user_meta(get_current_user_id(), 'fitness_start', true)) {
335
+									echo wp_kses_post(get_user_meta(get_current_user_id(), 'fitness_start', true));
336 336
 								} else {
337 337
 									echo '/';
338 338
 								}
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 							</td>
341 341
 							<td>
342 342
 								<?php
343
-								if ( '' !== get_user_meta( get_current_user_id(), 'fitness_goal', true ) ) {
344
-									echo wp_kses_post( get_user_meta( get_current_user_id(), 'fitness_goal', true ) );
343
+								if ('' !== get_user_meta(get_current_user_id(), 'fitness_goal', true)) {
344
+									echo wp_kses_post(get_user_meta(get_current_user_id(), 'fitness_goal', true));
345 345
 								} else {
346 346
 									echo '/';
347 347
 								}
@@ -349,8 +349,8 @@  discard block
 block discarded – undo
349 349
 							</td>
350 350
 							<td>
351 351
 								<?php
352
-								if ( '' !== get_user_meta( get_current_user_id(), 'fitness_end', true ) ) {
353
-									echo wp_kses_post( get_user_meta( get_current_user_id(), 'fitness_end', true ) );
352
+								if ('' !== get_user_meta(get_current_user_id(), 'fitness_end', true)) {
353
+									echo wp_kses_post(get_user_meta(get_current_user_id(), 'fitness_end', true));
354 354
 								} else {
355 355
 									echo '/';
356 356
 								}
@@ -374,26 +374,26 @@  discard block
 block discarded – undo
374 374
  * @return void
375 375
  */
376 376
 function lsx_health_plan_day_plan_block() {
377
-	$args      = array(
377
+	$args = array(
378 378
 		'orderby'        => 'menu_order',
379 379
 		'order'          => 'ASC',
380 380
 		'post_type'      => 'plan',
381 381
 		'posts_per_page' => -1,
382 382
 		'nopagin'        => true,
383 383
 	);
384
-	$the_query = new WP_Query( $args );
384
+	$the_query = new WP_Query($args);
385 385
 	?>
386 386
 	<div class="daily-plan-block day-grid">
387 387
 		<?php
388
-		if ( $the_query->have_posts() ) :
389
-			while ( $the_query->have_posts() ) :
388
+		if ($the_query->have_posts()) :
389
+			while ($the_query->have_posts()) :
390 390
 				$the_query->the_post();
391 391
 				$completed_class = '';
392
-				if ( lsx_health_plan_is_day_complete() ) {
392
+				if (lsx_health_plan_is_day_complete()) {
393 393
 					$completed_class = 'completed';
394 394
 				}
395 395
 				?>
396
-				<a href="<?php the_permalink(); ?>" class="day id-<?php the_ID(); ?> <?php echo esc_attr( $completed_class ); ?>">
396
+				<a href="<?php the_permalink(); ?>" class="day id-<?php the_ID(); ?> <?php echo esc_attr($completed_class); ?>">
397 397
 					<div class="plan-content"><?php the_title(); ?></div>
398 398
 				</a>
399 399
 			<?php endwhile; ?>
@@ -410,11 +410,11 @@  discard block
 block discarded – undo
410 410
  * @param  array $args An array of arguments.
411 411
  * @return void
412 412
  */
413
-function lsx_health_plan_week_plan_block( $args = array() ) {
413
+function lsx_health_plan_week_plan_block($args = array()) {
414 414
 	$defaults = array(
415 415
 		'show_downloads' => false,
416 416
 	);
417
-	$args     = wp_parse_args( $args, $defaults );
417
+	$args     = wp_parse_args($args, $defaults);
418 418
 	$weeks    = get_terms(
419 419
 		array(
420 420
 			'taxonomy' => 'week',
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
 			'order'    => 'ASC',
423 423
 		)
424 424
 	);
425
-	if ( ! empty( $weeks ) ) {
425
+	if ( ! empty($weeks)) {
426 426
 		$counter      = 1;
427 427
 		$section_open = false;
428 428
 
429
-		foreach ( $weeks as $week ) {
429
+		foreach ($weeks as $week) {
430 430
 			// Grab the days of the week.
431
-			$query_args      = array(
431
+			$query_args = array(
432 432
 				'orderby'        => 'menu_order',
433 433
 				'order'          => 'ASC',
434 434
 				'post_type'      => 'plan',
@@ -438,22 +438,22 @@  discard block
 block discarded – undo
438 438
 					array(
439 439
 						'taxonomy' => 'week',
440 440
 						'field'    => 'slug',
441
-						'terms'    => array( $week->slug ),
441
+						'terms'    => array($week->slug),
442 442
 					),
443 443
 				),
444 444
 			);
445
-			$the_query      = new WP_Query( $query_args );
445
+			$the_query      = new WP_Query($query_args);
446 446
 			$collapse_class = '';
447 447
 
448 448
 			// Determine if the current week is complete.
449
-			if ( $the_query->have_posts() ) {
450
-				$day_ids = wp_list_pluck( $the_query->posts, 'ID' );
449
+			if ($the_query->have_posts()) {
450
+				$day_ids = wp_list_pluck($the_query->posts, 'ID');
451 451
 
452
-				if ( false === $section_open ) {
453
-					if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids ) ) {
452
+				if (false === $section_open) {
453
+					if (1 === $counter && ! \lsx_health_plan\functions\is_week_complete(false, $day_ids)) {
454 454
 						$collapse_class = 'in';
455 455
 						$section_open   = true;
456
-					} elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids ) ) {
456
+					} elseif ( ! \lsx_health_plan\functions\is_week_complete(false, $day_ids)) {
457 457
 						$collapse_class = 'in';
458 458
 						$section_open   = true;
459 459
 					}
@@ -461,32 +461,32 @@  discard block
 block discarded – undo
461 461
 			}
462 462
 
463 463
 			// Determine if there are any weekly downloads.
464
-			if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) {
465
-				$weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $week->slug );
466
-				if ( ! empty( $weekly_downloads ) ) {
464
+			if (isset($args['show_downloads']) && false !== $args['show_downloads']) {
465
+				$weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads($week->slug);
466
+				if ( ! empty($weekly_downloads)) {
467 467
 					$week_downloads_view = 'week-downloads-view-on';
468 468
 				}
469 469
 			}
470 470
 			?>
471 471
 			<div class="daily-plan-block week-grid">
472
-				<a href="#week-<?php echo esc_attr( $week->slug ); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr( $week->name ); ?></a>
473
-				<div id="week-<?php echo esc_attr( $week->slug ); ?>" class="week-row collapse <?php echo esc_attr( $collapse_class ); ?>">
474
-					<div class="week-row-inner <?php echo esc_html( $week_downloads_view ); ?>">
472
+				<a href="#week-<?php echo esc_attr($week->slug); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr($week->name); ?></a>
473
+				<div id="week-<?php echo esc_attr($week->slug); ?>" class="week-row collapse <?php echo esc_attr($collapse_class); ?>">
474
+					<div class="week-row-inner <?php echo esc_html($week_downloads_view); ?>">
475 475
 						<div class="week-meals-recipes-box">
476
-							<?php if ( ! empty( $week_downloads_view ) ) { ?>
477
-								<h3 class="title"><?php lsx_get_svg_icon( 'daily-plan.svg' ); ?><?php echo esc_html_e( 'Daily Plan', 'lsx-health-plan' ); ?></h3>
476
+							<?php if ( ! empty($week_downloads_view)) { ?>
477
+								<h3 class="title"><?php lsx_get_svg_icon('daily-plan.svg'); ?><?php echo esc_html_e('Daily Plan', 'lsx-health-plan'); ?></h3>
478 478
 							<?php } ?>
479 479
 							<div class="week-meals-recipes-box-inner">
480 480
 							<?php
481
-							if ( $the_query->have_posts() ) :
482
-								while ( $the_query->have_posts() ) :
481
+							if ($the_query->have_posts()) :
482
+								while ($the_query->have_posts()) :
483 483
 									$the_query->the_post();
484 484
 									$completed_class = '';
485
-									if ( lsx_health_plan_is_day_complete() ) {
485
+									if (lsx_health_plan_is_day_complete()) {
486 486
 										$completed_class = 'completed';
487 487
 									}
488 488
 									?>
489
-									<a href="<?php the_permalink(); ?>" class="day id-<?php the_ID(); ?> <?php echo esc_attr( $completed_class ); ?>">
489
+									<a href="<?php the_permalink(); ?>" class="day id-<?php the_ID(); ?> <?php echo esc_attr($completed_class); ?>">
490 490
 										<div class="plan-content"><?php the_title(); ?></div>
491 491
 									</a>
492 492
 									<?php
@@ -497,8 +497,8 @@  discard block
 block discarded – undo
497 497
 							</div>
498 498
 						</div>
499 499
 						<?php
500
-						if ( ! empty( $week_downloads_view ) ) {
501
-							lsx_health_plan_weekly_downloads( $weekly_downloads );
500
+						if ( ! empty($week_downloads_view)) {
501
+							lsx_health_plan_weekly_downloads($weekly_downloads);
502 502
 						}
503 503
 						?>
504 504
 					</div>
@@ -516,16 +516,16 @@  discard block
 block discarded – undo
516 516
  * @param array $weekly_downloads An array of the download ids.
517 517
  * @return void
518 518
  */
519
-function lsx_health_plan_weekly_downloads( $weekly_downloads = array() ) {
520
-	if ( ! empty( $weekly_downloads ) ) {
519
+function lsx_health_plan_weekly_downloads($weekly_downloads = array()) {
520
+	if ( ! empty($weekly_downloads)) {
521 521
 		?>
522 522
 		<div class="week-download-box">
523
-			<h3 class="title"><?php lsx_get_svg_icon( 'download.svg' ); ?><?php echo esc_html_e( 'Downloads', 'lsx-health-plan' ); ?></h3>
523
+			<h3 class="title"><?php lsx_get_svg_icon('download.svg'); ?><?php echo esc_html_e('Downloads', 'lsx-health-plan'); ?></h3>
524 524
 			<ul class="week-download-box-list">
525 525
 				<?php
526
-				foreach ( $weekly_downloads as $weekly_download ) {
526
+				foreach ($weekly_downloads as $weekly_download) {
527 527
 					?>
528
-					<li><?php echo wp_kses_post( do_shortcode( '[download id="' . $weekly_download . '"]' ) ); ?></li>
528
+					<li><?php echo wp_kses_post(do_shortcode('[download id="' . $weekly_download . '"]')); ?></li>
529 529
 					<?php
530 530
 				}
531 531
 				?>
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
  *
541 541
  * @return void
542 542
  */
543
-function lsx_health_plan_items( $args = array() ) {
543
+function lsx_health_plan_items($args = array()) {
544 544
 	global $shortcode_args;
545 545
 	$shortcode_args = $args;
546 546
 	include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php';
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
  * @return void
553 553
  */
554 554
 function lsx_health_plan_featured_video_block() {
555
-	if ( ! post_type_exists( 'video' ) ) {
555
+	if ( ! post_type_exists('video')) {
556 556
 		return;
557 557
 	}
558 558
 	include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php';
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
  * @return void
565 565
  */
566 566
 function lsx_health_plan_featured_recipes_block() {
567
-	if ( ! post_type_exists( 'recipe' ) ) {
567
+	if ( ! post_type_exists('recipe')) {
568 568
 		return;
569 569
 	}
570 570
 	include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php';
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
  * @return void
577 577
  */
578 578
 function lsx_health_plan_featured_tips_block() {
579
-	if ( ! post_type_exists( 'tip' ) ) {
579
+	if ( ! post_type_exists('tip')) {
580 580
 		return;
581 581
 	}
582 582
 	include LSX_HEALTH_PLAN_PATH . '/templates/featured-tips.php';
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
  * @return void
590 590
  */
591 591
 function lsx_health_plan_day_button() {
592
-	if ( lsx_health_plan_is_day_complete() ) {
592
+	if (lsx_health_plan_is_day_complete()) {
593 593
 		lsx_health_plan_unlock_button();
594 594
 	} else {
595 595
 		lsx_health_plan_complete_button();
@@ -605,15 +605,15 @@  discard block
 block discarded – undo
605 605
 	?>
606 606
 	<div class="single-plan-inner-buttons">
607 607
 		<form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn">
608
-			<?php wp_nonce_field( 'complete', 'lsx-health-plan-actions' ); ?>
609
-			<input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr( get_the_ID() ); ?>" />
610
-			<button class="btn cta-btn" type="submit"><?php esc_html_e( 'Complete Day', 'lsx-health-plan' ); ?></button>
608
+			<?php wp_nonce_field('complete', 'lsx-health-plan-actions'); ?>
609
+			<input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr(get_the_ID()); ?>" />
610
+			<button class="btn cta-btn" type="submit"><?php esc_html_e('Complete Day', 'lsx-health-plan'); ?></button>
611 611
 		</form>
612 612
 		<div  class="back-plan-btn">
613 613
 			<?php
614
-			if ( function_exists( 'wc_get_page_id' ) ) {
614
+			if (function_exists('wc_get_page_id')) {
615 615
 				?>
616
-				<a class="btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'Back To My Plan', 'lsx-health-plan' ); ?></a>
616
+				<a class="btn" href="<?php echo wp_kses_post(get_permalink(wc_get_page_id('myaccount'))); ?>"><?php esc_html_e('Back To My Plan', 'lsx-health-plan'); ?></a>
617 617
 				<?php
618 618
 			}
619 619
 			?>
@@ -631,15 +631,15 @@  discard block
 block discarded – undo
631 631
 	?>
632 632
 	<div class="single-plan-inner-buttons">
633 633
 		<form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn">
634
-			<?php wp_nonce_field( 'unlock', 'lsx-health-plan-actions' ); ?>
635
-			<input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr( get_the_ID() ); ?>" />
636
-			<button class="btn secondary-btn" type="submit"><?php esc_html_e( 'Im not done!', 'lsx-health-plan' ); ?></button>
634
+			<?php wp_nonce_field('unlock', 'lsx-health-plan-actions'); ?>
635
+			<input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr(get_the_ID()); ?>" />
636
+			<button class="btn secondary-btn" type="submit"><?php esc_html_e('Im not done!', 'lsx-health-plan'); ?></button>
637 637
 		</form>
638 638
 		<div  class="back-plan-btn">
639 639
 		<?php
640
-		if ( function_exists( 'wc_get_page_id' ) ) {
640
+		if (function_exists('wc_get_page_id')) {
641 641
 			?>
642
-			<a class="btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'Back To My Plan', 'lsx-health-plan' ); ?></a>
642
+			<a class="btn" href="<?php echo wp_kses_post(get_permalink(wc_get_page_id('myaccount'))); ?>"><?php esc_html_e('Back To My Plan', 'lsx-health-plan'); ?></a>
643 643
 			<?php
644 644
 		}
645 645
 		?>
@@ -655,8 +655,8 @@  discard block
 block discarded – undo
655 655
  * @return void
656 656
  */
657 657
 function lsx_health_plan_single_nav() {
658
-	$tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' );
659
-	if ( '' !== $tab_template_path ) {
658
+	$tab_template_path = apply_filters('lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php');
659
+	if ('' !== $tab_template_path) {
660 660
 		require $tab_template_path;
661 661
 	}
662 662
 }
@@ -668,8 +668,8 @@  discard block
 block discarded – undo
668 668
  * @return void
669 669
  */
670 670
 function lsx_health_plan_single_tabs() {
671
-	$endpoint = get_query_var( 'endpoint' );
672
-	switch ( $endpoint ) {
671
+	$endpoint = get_query_var('endpoint');
672
+	switch ($endpoint) {
673 673
 		case 'meal':
674 674
 			$tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php';
675 675
 			break;
@@ -690,8 +690,8 @@  discard block
 block discarded – undo
690 690
 			$tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php';
691 691
 			break;
692 692
 	}
693
-	$tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path );
694
-	if ( '' !== $tab_template_path ) {
693
+	$tab_template_path = apply_filters('lsx_health_plan_single_tab_path', $tab_template_path);
694
+	if ('' !== $tab_template_path) {
695 695
 		include $tab_template_path;
696 696
 	}
697 697
 }
@@ -711,9 +711,9 @@  discard block
 block discarded – undo
711 711
  * @return recipe_type
712 712
  */
713 713
 function lsx_health_plan_recipe_type() {
714
-	$term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' );
714
+	$term_obj_list = get_the_terms(get_the_ID(), 'recipe-type');
715 715
 	$recipe_type   = $term_obj_list[0]->name;
716
-	if ( ! empty( $recipe_type ) ) {
716
+	if ( ! empty($recipe_type)) {
717 717
 		return $recipe_type;
718 718
 	}
719 719
 }
@@ -725,32 +725,32 @@  discard block
 block discarded – undo
725 725
  * @param array $group
726 726
  * @return void
727 727
  */
728
-function lsx_health_plan_workout_video_play_button( $m, $group, $echo = true ) {
728
+function lsx_health_plan_workout_video_play_button($m, $group, $echo = true) {
729 729
 	$workout_video = '';
730 730
 	$giphy         = '';
731 731
 	$youtube       = '';
732
-	if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) {
733
-		$workout_video = esc_html( $group['connected_videos'] );
734
-		$giphy         = get_post_meta( $workout_video, 'video_giphy_source', true );
735
-		$youtube       = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) );
736
-		$content       = get_post_field( 'post_content', $workout_video );
732
+	if (isset($group['connected_videos']) && '' !== $group['connected_videos']) {
733
+		$workout_video = esc_html($group['connected_videos']);
734
+		$giphy         = get_post_meta($workout_video, 'video_giphy_source', true);
735
+		$youtube       = esc_url(get_post_meta($workout_video, 'video_youtube_source', 1));
736
+		$content       = get_post_field('post_content', $workout_video);
737 737
 		$play_button   = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>';
738 738
 
739 739
 		$modal_body = '';
740
-		if ( ! empty( $giphy ) ) {
741
-			$giphy      = \lsx_health_plan\functions\get_video_url( $giphy );
740
+		if ( ! empty($giphy)) {
741
+			$giphy      = \lsx_health_plan\functions\get_video_url($giphy);
742 742
 			$modal_body = $giphy; // WPCS: XSS OK.
743
-		} elseif ( ! empty( $youtube ) ) {
744
-			$modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK.
743
+		} elseif ( ! empty($youtube)) {
744
+			$modal_body = wp_oembed_get($youtube, array( // WPCS: XSS OK.
745 745
 				'width' => 480,
746
-			) );
746
+			));
747 747
 		}
748 748
 		$modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>';
749 749
 		$modal_body .= $content;
750
-		\lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body );
750
+		\lsx_health_plan\functions\register_modal('workout-video-modal-' . $m, '', $modal_body);
751 751
 
752
-		if ( true === $echo ) {
753
-			echo wp_kses_post( $play_button );
752
+		if (true === $echo) {
753
+			echo wp_kses_post($play_button);
754 754
 		} else {
755 755
 			return $play_button;
756 756
 		}
@@ -764,17 +764,17 @@  discard block
 block discarded – undo
764 764
  */
765 765
 function lsx_health_plan_recipe_archive_description() {
766 766
 	$description = '';
767
-	if ( is_post_type_archive( 'recipe' ) ) {
768
-		$description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' );
769
-	} elseif ( is_post_type_archive( 'exercise' ) ) {
770
-		$description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' );
771
-	} elseif ( is_tax() ) {
767
+	if (is_post_type_archive('recipe')) {
768
+		$description = \lsx_health_plan\functions\get_option('recipe_archive_description', '');
769
+	} elseif (is_post_type_archive('exercise')) {
770
+		$description = \lsx_health_plan\functions\get_option('exercise_archive_description', '');
771
+	} elseif (is_tax()) {
772 772
 		$description = get_the_archive_description();
773 773
 	}
774
-	if ( '' !== $description ) {
774
+	if ('' !== $description) {
775 775
 		?>
776 776
 		<div class="lsx-hp-archive-description row">
777
-			<div class="col-xs-12 description-wrapper"><?php echo wp_kses_post( $description ); ?></div>
777
+			<div class="col-xs-12 description-wrapper"><?php echo wp_kses_post($description); ?></div>
778 778
 		</div>
779 779
 		<?php
780 780
 	}
@@ -786,21 +786,21 @@  discard block
 block discarded – undo
786 786
  * @param  string $index
787 787
  * @return void
788 788
  */
789
-function lsx_health_plan_workout_tab_content( $index = 1 ) {
790
-	global $group_name,$shortcode_args;
789
+function lsx_health_plan_workout_tab_content($index = 1) {
790
+	global $group_name, $shortcode_args;
791 791
 	$group_name = 'workout_section_' . $index;
792
-	if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
793
-		$layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) );
792
+	if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
793
+		$layout = strtolower(\lsx_health_plan\functions\get_option('workout_tab_layout', 'table'));
794 794
 
795 795
 		// Check for shortcode overrides.
796
-		if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) {
796
+		if (null !== $shortcode_args && isset($shortcode_args['layout'])) {
797 797
 			$layout = $shortcode_args['layout'];
798 798
 		}
799 799
 	} else {
800 800
 		$layout = 'table';
801 801
 	}
802 802
 
803
-	switch ( $layout ) {
803
+	switch ($layout) {
804 804
 		case 'list':
805 805
 			$tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php';
806 806
 			break;
@@ -813,8 +813,8 @@  discard block
 block discarded – undo
813 813
 			$tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php';
814 814
 			break;
815 815
 	}
816
-	$tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path );
817
-	if ( '' !== $tab_template_path ) {
816
+	$tab_template_path = apply_filters('lsx_health_plan_workout_tab_content_path', $tab_template_path);
817
+	if ('' !== $tab_template_path) {
818 818
 		include $tab_template_path;
819 819
 	}
820 820
 }
@@ -825,13 +825,13 @@  discard block
 block discarded – undo
825 825
  * @return void
826 826
  */
827 827
 function lsx_health_plan_workout_sets() {
828
-	if ( is_singular( 'workout' ) ) {
828
+	if (is_singular('workout')) {
829 829
 		global $connected_workouts;
830
-		$connected_workouts = array( get_the_ID() );
830
+		$connected_workouts = array(get_the_ID());
831 831
 	}
832 832
 	$template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php';
833
-	$template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path );
834
-	if ( '' !== $template_path && ! empty( $template_path ) ) {
833
+	$template_path = apply_filters('lsx_health_plan_workout_set_template_path', $template_path);
834
+	if ('' !== $template_path && ! empty($template_path)) {
835 835
 		include $template_path;
836 836
 	}
837 837
 }
Please login to merge, or discard this patch.
includes/template-tags/gallery.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,17 +14,17 @@
 block discarded – undo
14 14
  * @param  string  $item_id
15 15
  * @return string
16 16
  */
17
-function lsx_health_plan_gallery( $before = '', $after = '', $echo = true, $item_id = false ) {
17
+function lsx_health_plan_gallery($before = '', $after = '', $echo = true, $item_id = false) {
18 18
 	$gallery = '';
19 19
 	$lsx_hp  = lsx_health_plan();
20
-	if ( false === $item_id ) {
20
+	if (false === $item_id) {
21 21
 		$item_id = get_the_ID();
22 22
 	}
23
-	if ( $lsx_hp->frontend->gallery->has_gallery( $item_id ) ) {
23
+	if ($lsx_hp->frontend->gallery->has_gallery($item_id)) {
24 24
 		$gallery = $before . $lsx_hp->frontend->gallery->get_gallery() . $after;
25 25
 	}
26
-	if ( true === $echo ) {
27
-		echo wp_kses_post( $gallery );
26
+	if (true === $echo) {
27
+		echo wp_kses_post($gallery);
28 28
 	} else {
29 29
 		return $gallery;
30 30
 	}
Please login to merge, or discard this patch.
includes/template-tags/exercise.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
  * @return exercise_type
12 12
  */
13 13
 function lsx_health_plan_exercise_type() {
14
-	$term_obj_list = get_the_term_list( get_the_ID(), 'exercise-type', '', ', ' );
15
-	if ( ! empty( $term_obj_list ) ) {
14
+	$term_obj_list = get_the_term_list(get_the_ID(), 'exercise-type', '', ', ');
15
+	if ( ! empty($term_obj_list)) {
16 16
 		return $term_obj_list;
17 17
 	}
18 18
 }
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
  * @return muscle_group_equipment
24 24
  */
25 25
 function lsx_health_plan_muscle_group_equipment() {
26
-	$term_obj_list = get_the_term_list( get_the_ID(), 'muscle-group', '', ', ' );
27
-	if ( ! empty( $term_obj_list ) ) {
26
+	$term_obj_list = get_the_term_list(get_the_ID(), 'muscle-group', '', ', ');
27
+	if ( ! empty($term_obj_list)) {
28 28
 		return $term_obj_list;
29 29
 	}
30 30
 }
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
  * @return exercise_equipment
36 36
  */
37 37
 function lsx_health_plan_exercise_equipment() {
38
-	$term_obj_list = get_the_term_list( get_the_ID(), 'equipment', '', ', ' );
39
-	if ( ! empty( $term_obj_list ) ) {
38
+	$term_obj_list = get_the_term_list(get_the_ID(), 'equipment', '', ', ');
39
+	if ( ! empty($term_obj_list)) {
40 40
 		return $term_obj_list;
41 41
 	}
42 42
 }
@@ -59,61 +59,61 @@  discard block
 block discarded – undo
59 59
  * @param array   $args
60 60
  * @return void
61 61
  */
62
-function lsx_health_plan_workout_exercise_button( $m, $group, $echo = true, $args = array() ) {
62
+function lsx_health_plan_workout_exercise_button($m, $group, $echo = true, $args = array()) {
63 63
 	$defaults = array(
64 64
 		'modal_trigger' => 'button',
65 65
 		'modal_content' => 'excerpt',
66 66
 	);
67
-	$args     = wp_parse_args( $args, $defaults );
67
+	$args = wp_parse_args($args, $defaults);
68 68
 
69 69
 	$exercise_id = '';
70
-	if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) {
71
-		$exercise_id     = esc_html( $group['connected_exercises'] );
72
-		$content         = get_post_field( 'post_content', $exercise_id );
73
-		$url             = get_permalink( $exercise_id );
74
-		$equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' );
75
-		$muscle_group    = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' );
70
+	if (isset($group['connected_exercises']) && '' !== $group['connected_exercises']) {
71
+		$exercise_id     = esc_html($group['connected_exercises']);
72
+		$content         = get_post_field('post_content', $exercise_id);
73
+		$url             = get_permalink($exercise_id);
74
+		$equipment_group = get_the_term_list($exercise_id, 'equipment', '', ', ');
75
+		$muscle_group    = get_the_term_list($exercise_id, 'muscle-group', '', ', ');
76 76
 		$lsx_hp          = lsx_health_plan();
77 77
 
78
-		if ( 'excerpt' === $args['modal_content'] ) {
79
-			$content = wp_trim_words( $content, 40 );
78
+		if ('excerpt' === $args['modal_content']) {
79
+			$content = wp_trim_words($content, 40);
80 80
 		}
81 81
 
82
-		if ( 'link' ) {
83
-			$play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>';
82
+		if ('link') {
83
+			$play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title($exercise_id) . '</a>';
84 84
 		} else {
85 85
 			$play_button = '<button data-toggle="modal" data-target="#workout-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>';
86 86
 		}
87 87
 
88
-		$modal_body  = '';
89
-		if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) {
88
+		$modal_body = '';
89
+		if ($lsx_hp->frontend->gallery->has_gallery($exercise_id)) {
90 90
 			$gallery_args = array(
91 91
 				'css_class' => 'modal-slider',
92 92
 			);
93
-			$modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args );
93
+			$modal_body .= $lsx_hp->frontend->gallery->get_gallery('', '', $gallery_args);
94 94
 		} else {
95
-			$modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>';
95
+			$modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail($exercise_id, 'large') . '</div>';
96 96
 		}
97 97
 
98
-		$modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>';
98
+		$modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title($exercise_id) . '</h5>';
99 99
 
100
-		if ( ! empty( $equipment_group ) ) {
100
+		if ( ! empty($equipment_group)) {
101 101
 			$modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>';
102 102
 		}
103
-		if ( ! empty( $muscle_group ) ) {
103
+		if ( ! empty($muscle_group)) {
104 104
 			$modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>';
105 105
 		}
106 106
 		$modal_body .= '</div>';
107
-		if ( '' !== $args['modal_content'] ) {
107
+		if ('' !== $args['modal_content']) {
108 108
 			$modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>';
109 109
 		}
110
-		if ( 'excerpt' === $args['modal_content'] ) {
111
-			$modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>';
110
+		if ('excerpt' === $args['modal_content']) {
111
+			$modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __('Read More', 'lsx-heal-plan') . '</a>';
112 112
 		}
113
-		\lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body );
113
+		\lsx_health_plan\functions\register_modal('workout-exercise-modal-' . $m, '', $modal_body);
114 114
 
115
-		if ( true === $echo ) {
116
-			echo wp_kses_post( $play_button );
115
+		if (true === $echo) {
116
+			echo wp_kses_post($play_button);
117 117
 		} else {
118 118
 			return $play_button;
119 119
 		}
@@ -127,39 +127,39 @@  discard block
 block discarded – undo
127 127
  * @param array $group
128 128
  * @return void
129 129
  */
130
-function lsx_health_plan_shortcode_exercise_button( $m, $content = true ) {
131
-	$equipment_group = get_the_term_list( $m, 'equipment', '', ', ' );
132
-	$muscle_group    = get_the_term_list( $m, 'muscle-group', '', ', ' );
130
+function lsx_health_plan_shortcode_exercise_button($m, $content = true) {
131
+	$equipment_group = get_the_term_list($m, 'equipment', '', ', ');
132
+	$muscle_group    = get_the_term_list($m, 'muscle-group', '', ', ');
133 133
 	$title           = get_the_title();
134 134
 	$lsx_hp          = lsx_health_plan();
135
-	$button     = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>';
135
+	$button = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>';
136 136
 
137
-	if ( true === $content ) {
137
+	if (true === $content) {
138 138
 		$content = get_the_content();
139 139
 	}
140 140
 
141 141
 	$modal_body = '';
142
-	if ( $lsx_hp->frontend->gallery->has_gallery( $m ) ) {
142
+	if ($lsx_hp->frontend->gallery->has_gallery($m)) {
143 143
 		$gallery_args = array(
144 144
 			'css_class' => 'modal-slider',
145 145
 		);
146
-		$modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args );
146
+		$modal_body .= $lsx_hp->frontend->gallery->get_gallery('', '', $gallery_args);
147 147
 	} else {
148
-		$modal_body .= '<div class="modal-image">' . get_the_post_thumbnail( $m, 'large' ) . '</div>';
148
+		$modal_body .= '<div class="modal-image">' . get_the_post_thumbnail($m, 'large') . '</div>';
149 149
 	}
150 150
 	$modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $title . '</h5>';
151 151
 
152
-	if ( ! empty( $equipment_group ) ) {
152
+	if ( ! empty($equipment_group)) {
153 153
 		$modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>';
154 154
 	}
155
-	if ( ! empty( $muscle_group ) ) {
155
+	if ( ! empty($muscle_group)) {
156 156
 		$modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>';
157 157
 	}
158 158
 	$modal_body .= '</div>';
159 159
 	$modal_body .= $content;
160
-	\lsx_health_plan\functions\register_modal( 'exercise-modal-' . $m, '', $modal_body );
160
+	\lsx_health_plan\functions\register_modal('exercise-modal-' . $m, '', $modal_body);
161 161
 
162
-	return ( $button );
162
+	return ($button);
163 163
 }
164 164
 
165 165
 /**
@@ -170,18 +170,18 @@  discard block
 block discarded – undo
170 170
  * @param  boolean $echo
171 171
  * @return string
172 172
  */
173
-function lsx_health_plan_exercise_title( $before = '', $after = '', $echo = true, $exercise_id = false ) {
174
-	if ( false === $exercise_id ) {
173
+function lsx_health_plan_exercise_title($before = '', $after = '', $echo = true, $exercise_id = false) {
174
+	if (false === $exercise_id) {
175 175
 		$exercise_id = get_the_ID();
176 176
 	}
177
-	$title = get_the_title( $exercise_id );
178
-	$side  = get_post_meta( $exercise_id, 'exercise_side', true );
179
-	if ( '' !== $side ) {
180
-		$title .= ' - ' . ucwords( $side );
177
+	$title = get_the_title($exercise_id);
178
+	$side  = get_post_meta($exercise_id, 'exercise_side', true);
179
+	if ('' !== $side) {
180
+		$title .= ' - ' . ucwords($side);
181 181
 	}
182
-	$title = apply_filters( 'lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id );
183
-	if ( true === $echo ) {
184
-		echo wp_kses_post( $title );
182
+	$title = apply_filters('lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id);
183
+	if (true === $echo) {
184
+		echo wp_kses_post($title);
185 185
 	} else {
186 186
 		return $title;
187 187
 	}
Please login to merge, or discard this patch.
includes/functions.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -16,21 +16,21 @@  discard block
 block discarded – undo
16 16
  * @param boolean $single
17 17
  * @return boolean
18 18
  */
19
-function has_attached_post( $post_id = '', $meta_key = '', $single = true ) {
19
+function has_attached_post($post_id = '', $meta_key = '', $single = true) {
20 20
 	$has_post = false;
21
-	if ( '' === $post_id ) {
21
+	if ('' === $post_id) {
22 22
 		$post_id = get_the_ID();
23 23
 	}
24
-	$items = get_post_meta( $post_id, $meta_key, $single );
25
-	if ( '' !== $items && false !== $items && 0 !== $items ) {
26
-		$items = check_posts_exist( $items );
27
-		if ( ! empty( $items ) ) {
24
+	$items = get_post_meta($post_id, $meta_key, $single);
25
+	if ('' !== $items && false !== $items && 0 !== $items) {
26
+		$items = check_posts_exist($items);
27
+		if ( ! empty($items)) {
28 28
 			$has_post = true;
29 29
 		}
30 30
 	} else {
31 31
 		// Check for defaults.
32
-		$options = get_option( 'all' );
33
-		if ( isset( $options[ $meta_key ] ) && '' !== $options[ $meta_key ] && ! empty( $options[ $meta_key ] ) ) {
32
+		$options = get_option('all');
33
+		if (isset($options[$meta_key]) && '' !== $options[$meta_key] && ! empty($options[$meta_key])) {
34 34
 			$has_post = true;
35 35
 		}
36 36
 	}
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
  * @param  mixed  $default Optional default value
45 45
  * @return mixed           Option value
46 46
  */
47
-function get_option( $key = '', $default = false ) {
48
-	if ( function_exists( 'cmb2_get_option' ) ) {
49
-		return cmb2_get_option( 'lsx_health_plan_options', $key, $default );
47
+function get_option($key = '', $default = false) {
48
+	if (function_exists('cmb2_get_option')) {
49
+		return cmb2_get_option('lsx_health_plan_options', $key, $default);
50 50
 	}
51 51
 	// Fallback to get_option if CMB2 is not loaded yet.
52
-	$opts = \get_option( 'lsx_health_plan_options', $default );
52
+	$opts = \get_option('lsx_health_plan_options', $default);
53 53
 	$val  = $default;
54
-	if ( 'all' === $key ) {
54
+	if ('all' === $key) {
55 55
 		$val = $opts;
56
-	} elseif ( is_array( $opts ) && array_key_exists( $key, $opts ) && false !== $opts[ $key ] ) {
57
-		$val = $opts[ $key ];
56
+	} elseif (is_array($opts) && array_key_exists($key, $opts) && false !== $opts[$key]) {
57
+		$val = $opts[$key];
58 58
 	}
59 59
 	return $val;
60 60
 }
@@ -66,54 +66,54 @@  discard block
 block discarded – undo
66 66
  * @param  mixed  $default Optional default value
67 67
  * @return mixed           Option value
68 68
  */
69
-function get_downloads( $type = 'all', $post_id = '' ) {
69
+function get_downloads($type = 'all', $post_id = '') {
70 70
 	$lsx_health_plan = \lsx_health_plan();
71 71
 	$post_types      = $lsx_health_plan->get_post_types();
72
-	if ( '' === $post_id ) {
72
+	if ('' === $post_id) {
73 73
 		$post_id = get_the_ID();
74 74
 	}
75 75
 	$downloads = array();
76
-	$options   = get_option( 'all' );
76
+	$options   = get_option('all');
77 77
 
78
-	foreach ( $post_types as $post_type ) {
79
-		if ( 'all' === $type || in_array( $type, $post_types, true ) ) {
78
+	foreach ($post_types as $post_type) {
79
+		if ('all' === $type || in_array($type, $post_types, true)) {
80 80
 
81 81
 			// Get the default downloads for this post type.
82 82
 			$default_downloads = array();
83 83
 			$new_downloads     = array();
84
-			if ( isset( $options[ 'download_' . $post_type ] ) ) {
85
-				if ( is_array( $options[ 'download_' . $post_type ] ) ) {
86
-					$default_downloads = $options[ 'download_' . $post_type ];
84
+			if (isset($options['download_' . $post_type])) {
85
+				if (is_array($options['download_' . $post_type])) {
86
+					$default_downloads = $options['download_' . $post_type];
87 87
 				} else {
88
-					$default_downloads[] = $options[ 'download_' . $post_type ];
88
+					$default_downloads[] = $options['download_' . $post_type];
89 89
 				}
90 90
 			}
91 91
 
92
-			if ( 'page' === $post_type ) {
92
+			if ('page' === $post_type) {
93 93
 				$key = 'plan_warmup';
94 94
 			} else {
95 95
 				$key = 'connected_' . $post_type . 's';
96 96
 			}
97 97
 
98
-			$connected_items = get_post_meta( $post_id, $key, true );
99
-			if ( ! empty( $connected_items ) ) {
100
-				foreach ( $connected_items as $connected_item ) {
101
-					$current_downloads = get_post_meta( $connected_item, 'connected_downloads', true );
102
-					if ( false !== $current_downloads && ! empty( $current_downloads ) ) {
103
-						$new_downloads = array_merge( $new_downloads, $current_downloads );
98
+			$connected_items = get_post_meta($post_id, $key, true);
99
+			if ( ! empty($connected_items)) {
100
+				foreach ($connected_items as $connected_item) {
101
+					$current_downloads = get_post_meta($connected_item, 'connected_downloads', true);
102
+					if (false !== $current_downloads && ! empty($current_downloads)) {
103
+						$new_downloads = array_merge($new_downloads, $current_downloads);
104 104
 					}
105 105
 				}
106 106
 			}
107 107
 
108
-			if ( ! empty( $new_downloads ) ) {
109
-				$downloads = array_merge( $downloads, $new_downloads );
110
-			} elseif ( ! empty( $default_downloads ) ) {
111
-				$downloads = array_merge( $downloads, $default_downloads );
108
+			if ( ! empty($new_downloads)) {
109
+				$downloads = array_merge($downloads, $new_downloads);
110
+			} elseif ( ! empty($default_downloads)) {
111
+				$downloads = array_merge($downloads, $default_downloads);
112 112
 			}
113
-			$downloads = array_unique( $downloads );
113
+			$downloads = array_unique($downloads);
114 114
 		}
115 115
 	}
116
-	$downloads = check_posts_exist( $downloads );
116
+	$downloads = check_posts_exist($downloads);
117 117
 	return $downloads;
118 118
 }
119 119
 
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
  * @param  string $week    Week name 'week-1'.
124 124
  * @return array           an array of the downloads or empty.
125 125
  */
126
-function get_weekly_downloads( $week = '' ) {
126
+function get_weekly_downloads($week = '') {
127 127
 	$downloads = array();
128
-	if ( '' !== $week ) {
129
-		$saved_downloads = get_transient( 'lsx_hp_weekly_downloads_' . $week );
130
-		if ( false !== $saved_downloads && ! empty( $saved_downloads ) ) {
128
+	if ('' !== $week) {
129
+		$saved_downloads = get_transient('lsx_hp_weekly_downloads_' . $week);
130
+		if (false !== $saved_downloads && ! empty($saved_downloads)) {
131 131
 			$downloads = $saved_downloads;
132 132
 		} else {
133 133
 			$args = array(
@@ -141,17 +141,17 @@  discard block
 block discarded – undo
141 141
 					array(
142 142
 						'taxonomy' => 'dlm_download_category',
143 143
 						'field'    => 'slug',
144
-						'terms'    => array( $week ),
144
+						'terms'    => array($week),
145 145
 					),
146 146
 				),
147 147
 			);
148
-			$download_query = new \WP_Query( $args );
149
-			if ( $download_query->have_posts() ) {
148
+			$download_query = new \WP_Query($args);
149
+			if ($download_query->have_posts()) {
150 150
 				$downloads = $download_query->posts;
151 151
 			}
152 152
 		}
153 153
 	}
154
-	$downloads = check_posts_exist( $downloads );
154
+	$downloads = check_posts_exist($downloads);
155 155
 	return $downloads;
156 156
 }
157 157
 
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
  * @param array $post_ids
162 162
  * @return void
163 163
  */
164
-function check_posts_exist( $post_ids = array() ) {
164
+function check_posts_exist($post_ids = array()) {
165 165
 	$new_ids = array();
166 166
 	global $wpdb;
167
-	if ( is_array( $post_ids ) && ! empty( $post_ids ) ) {
168
-		$post_ids = "'" . implode( "','", $post_ids ) . "'";
167
+	if (is_array($post_ids) && ! empty($post_ids)) {
168
+		$post_ids = "'" . implode("','", $post_ids) . "'";
169 169
 		$query    = "
170 170
 			SELECT `ID` 
171 171
 			FROM `{$wpdb->posts}`
172 172
 			WHERE `ID` IN ({$post_ids})
173 173
 			AND `post_status` != 'trash'
174 174
 		";
175
-		$results = $wpdb->get_results( $query ); // WPCS: unprepared SQL
176
-		if ( ! empty( $results ) ) {
177
-			$new_ids = wp_list_pluck( $results, 'ID' );
175
+		$results = $wpdb->get_results($query); // WPCS: unprepared SQL
176
+		if ( ! empty($results)) {
177
+			$new_ids = wp_list_pluck($results, 'ID');
178 178
 		}
179 179
 	}
180 180
 	return $new_ids;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
  * @param string $body
189 189
  * @return void
190 190
  */
191
-function register_modal( $id = '', $title = '', $body = '' ) {
191
+function register_modal($id = '', $title = '', $body = '') {
192 192
 	lsx_health_plan()->frontend->modals->register_modal(
193 193
 		array(
194 194
 			'title' => $title,
@@ -204,36 +204,36 @@  discard block
 block discarded – undo
204 204
  * @param array $args
205 205
  * @return void
206 206
  */
207
-function output_modal( $args = array() ) {
207
+function output_modal($args = array()) {
208 208
 	$defaults = array(
209 209
 		'id'    => '',
210 210
 		'title' => '',
211 211
 		'body'  => '',
212 212
 	);
213
-	$args     = wp_parse_args( $args, $defaults );
213
+	$args = wp_parse_args($args, $defaults);
214 214
 	?>
215 215
 	<!-- Modal -->
216
-	<div class="modal fade lsx-health-plan-modal" id="<?php echo esc_html( $args['id'] ); ?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo esc_html( $args['id'] ); ?>"  aria-hidden="true">
216
+	<div class="modal fade lsx-health-plan-modal" id="<?php echo esc_html($args['id']); ?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo esc_html($args['id']); ?>"  aria-hidden="true">
217 217
 		<div class="modal-dialog" role="document">
218 218
 			<div class="modal-content">
219 219
 			<button type="button" class="close" data-dismiss="modal">&times;</button>			
220 220
 				<div class="modal-header">
221 221
 					<?php
222
-					if ( '' !== $args['title'] ) {
223
-						echo wp_kses_post( '<h2>' . $args['title'] . '</h2>' );
222
+					if ('' !== $args['title']) {
223
+						echo wp_kses_post('<h2>' . $args['title'] . '</h2>');
224 224
 					}
225 225
 					?>
226 226
 				</div>
227 227
 				<div class="modal-body">
228 228
 				<?php
229
-				if ( '' !== $args['body'] ) {
229
+				if ('' !== $args['body']) {
230 230
 					$allowed_html = array(
231 231
 						'iframe' => array(
232 232
 							'data-src'        => array(),
233 233
 							'src'             => array(),
234 234
 							'width'           => array(),
235 235
 							'height'          => array(),
236
-							'frameBorder'     => array( '0' ),
236
+							'frameBorder'     => array('0'),
237 237
 							'class'           => array(),
238 238
 							'allowFullScreen' => array(),
239 239
 							'style'           => array(),
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 							'class' => array(),
243 243
 						),
244 244
 					);
245
-					if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
246
-						echo wp_kses_post( $args['body'] );
245
+					if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
246
+						echo wp_kses_post($args['body']);
247 247
 					} else {
248
-						echo wp_kses( $args['body'], $allowed_html );
248
+						echo wp_kses($args['body'], $allowed_html);
249 249
 					}
250 250
 				}
251 251
 				?>
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
  * @param [type] $embed
264 264
  * @return void
265 265
  */
266
-function get_video_url( $embed ) {
266
+function get_video_url($embed) {
267 267
 	$url = '';
268
-	if ( false !== stripos( $embed, '<iframe' ) ) {
269
-		preg_match( '/src="([^"]+)"/', $embed, $match );
270
-		if ( is_array( $match ) && isset( $match[1] ) ) {
268
+	if (false !== stripos($embed, '<iframe')) {
269
+		preg_match('/src="([^"]+)"/', $embed, $match);
270
+		if (is_array($match) && isset($match[1])) {
271 271
 			$url = '<iframe data-src="' . $match[1] . '" style="border: 0;" frameBorder="0" class="giphy-embed" allowFullScreen height="300" width="100%"></iframe>';
272 272
 		} else {
273 273
 			$url = $embed;
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
  * @param array $post_ids
286 286
  * @return boolean
287 287
  */
288
-function is_week_complete( $term_id = false, $post_ids = array() ) {
288
+function is_week_complete($term_id = false, $post_ids = array()) {
289 289
 	$return = false;
290
-	if ( ! empty( $post_ids ) ) {
291
-		foreach ( $post_ids as &$pid ) {
290
+	if ( ! empty($post_ids)) {
291
+		foreach ($post_ids as &$pid) {
292 292
 			$pid = 'day_' . $pid . '_complete';
293 293
 		}
294
-		$days_complete = get_meta_amounts( $post_ids );
295
-		if ( 7 === $days_complete || '7' === $days_complete ) {
294
+		$days_complete = get_meta_amounts($post_ids);
295
+		if (7 === $days_complete || '7' === $days_complete) {
296 296
 			$return = true;
297 297
 		}
298 298
 	}
@@ -306,20 +306,20 @@  discard block
 block discarded – undo
306 306
  * @param string $key
307 307
  * @return void
308 308
  */
309
-function get_meta_amounts( $post_ids = array() ) {
309
+function get_meta_amounts($post_ids = array()) {
310 310
 	global $wpdb;
311 311
 	$amount       = 0;
312 312
 	$current_user = wp_get_current_user();
313
-	if ( false !== $current_user && ! empty( $post_ids ) ) {
314
-		$post_ids = "'" . implode( "','", $post_ids ) . "'";
313
+	if (false !== $current_user && ! empty($post_ids)) {
314
+		$post_ids = "'" . implode("','", $post_ids) . "'";
315 315
 		$query    = "
316 316
 			SELECT COUNT(`meta_value`) 
317 317
 			FROM `{$wpdb->usermeta}`
318 318
 			WHERE `meta_key` IN ({$post_ids})
319 319
 			AND `user_id` = '{$current_user->ID}'
320 320
 		";
321
-		$results  = $wpdb->get_var( $query ); // WPCS: unprepared SQL
322
-		if ( ! empty( $results ) ) {
321
+		$results = $wpdb->get_var($query); // WPCS: unprepared SQL
322
+		if ( ! empty($results)) {
323 323
 			$amount = $results;
324 324
 		}
325 325
 	}
@@ -329,14 +329,14 @@  discard block
 block discarded – undo
329 329
 /**
330 330
  * Limit media library access
331 331
  */
332
-function set_only_author( $wp_query ) {
332
+function set_only_author($wp_query) {
333 333
 	global $current_user;
334
-	if ( is_admin() && ! current_user_can( 'edit_others_posts' ) ) {
335
-		$wp_query->set( 'administrator', $current_user->ID );
336
-		add_filter( 'views_upload', 'fix_media_counts' );
334
+	if (is_admin() && ! current_user_can('edit_others_posts')) {
335
+		$wp_query->set('administrator', $current_user->ID);
336
+		add_filter('views_upload', 'fix_media_counts');
337 337
 	}
338 338
 }
339
-add_action( 'pre_get_posts', '\lsx_health_plan\functions\set_only_author' );
339
+add_action('pre_get_posts', '\lsx_health_plan\functions\set_only_author');
340 340
 
341 341
 /**
342 342
  * Outputs an excerpt even if there is not excerpt.
@@ -344,12 +344,12 @@  discard block
 block discarded – undo
344 344
  * @param [type] $post_id
345 345
  * @return void
346 346
  */
347
-function hp_excerpt( $post_id ) {
348
-	if ( ! has_excerpt( $post_id ) ) {
349
-		$content = wp_trim_words( get_the_content( $post_id ), 20 );
347
+function hp_excerpt($post_id) {
348
+	if ( ! has_excerpt($post_id)) {
349
+		$content = wp_trim_words(get_the_content($post_id), 20);
350 350
 		$content = '<p>' . $content . '</p>';
351 351
 	} else {
352
-		$content = get_the_excerpt( $post_id );
352
+		$content = get_the_excerpt($post_id);
353 353
 	}
354 354
 	return $content;
355 355
 }
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
  * @param string $columns
361 361
  * @return void
362 362
  */
363
-function column_class( $columns = '3' ) {
363
+function column_class($columns = '3') {
364 364
 	$cols .= '5' === $columns ? '15' : 12 / $columns;
365 365
 	return $cols;
366 366
 }
@@ -371,16 +371,16 @@  discard block
 block discarded – undo
371 371
  * @param string $workout
372 372
  * @return void
373 373
  */
374
-function get_exercises_by_workout( $workout = '' ) {
374
+function get_exercises_by_workout($workout = '') {
375 375
 	$exercises = array();
376 376
 	$i               = 1;
377 377
 	$section_counter = 6;
378
-	while ( $i <= $section_counter ) {
378
+	while ($i <= $section_counter) {
379 379
 		$group_name = 'workout_section_' . $i;
380
-		$groups     = get_post_meta( $workout, $group_name, true );
381
-		if ( ! empty( $groups ) ) {
382
-			foreach ( $groups as $group ) {
383
-				if ( isset( $group['connected_exercises'] ) ) {
380
+		$groups     = get_post_meta($workout, $group_name, true);
381
+		if ( ! empty($groups)) {
382
+			foreach ($groups as $group) {
383
+				if (isset($group['connected_exercises'])) {
384 384
 					$exercises[] = $group['connected_exercises'];
385 385
 				}
386 386
 			}
Please login to merge, or discard this patch.
includes/conditionals.php 1 patch
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.
classes/class-frontend.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * Contructor
32 32
 	 */
33 33
 	public function __construct() {
34
-		add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 );
34
+		add_action('wp_enqueue_scripts', array($this, 'assets'), 5);
35 35
 
36 36
 		require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php';
37 37
 		$this->endpoints = Endpoints::get_instance();
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
 		require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php';
43 43
 		$this->gallery = frontend\Gallery::get_instance();
44 44
 
45
-		if ( is_admin() ) {
46
-			add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 );
45
+		if (is_admin()) {
46
+			add_filter('lsx_customizer_colour_selectors_body', array($this, 'customizer_body_colours_handler'), 15, 2);
47 47
 		}
48 48
 
49 49
 		// Handle the template redirects.
50
-		add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 );
51
-		add_filter( 'template_include', array( $this, 'single_template_include' ), 99 );
52
-		add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 );
53
-		add_action( 'template_redirect', array( $this, 'redirect' ) );
50
+		add_filter('template_include', array($this, 'archive_template_include'), 99);
51
+		add_filter('template_include', array($this, 'single_template_include'), 99);
52
+		add_filter('template_include', array($this, 'taxonomy_template_include'), 99);
53
+		add_action('template_redirect', array($this, 'redirect'));
54 54
 
55
-		add_action( 'init', array( $this, 'handle_day_action' ), 100 );
56
-		add_filter( 'wp_kses_allowed_html', array( $this, 'wpkses_post_tags' ), 100, 2 );
55
+		add_action('init', array($this, 'handle_day_action'), 100);
56
+		add_filter('wp_kses_allowed_html', array($this, 'wpkses_post_tags'), 100, 2);
57 57
 	}
58 58
 
59 59
 	/**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public static function get_instance() {
67 67
 		// If the single instance hasn't been set, set it now.
68
-		if ( null === self::$instance ) {
68
+		if (null === self::$instance) {
69 69
 			self::$instance = new self();
70 70
 		}
71 71
 		return self::$instance;
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
 	 * @return void
78 78
 	 */
79 79
 	public function assets() {
80
-		wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER );
81
-		wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' );
82
-		wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) );
80
+		wp_enqueue_style('lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER);
81
+		wp_style_add_data('lsx-health-plan', 'rtl', 'replace');
82
+		wp_enqueue_script('lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array('jquery'));
83 83
 	}
84 84
 
85 85
 	/**
86 86
 	 * Handle body colours that might be change by LSX Customizer.
87 87
 	 */
88
-	public function customizer_body_colours_handler( $css, $colors ) {
88
+	public function customizer_body_colours_handler($css, $colors) {
89 89
 		$css .= '
90 90
 			@import "' . LSX_HEALTH_PLAN_PATH . '/assets/css/scss/partials/customizer-health-plan-body-colours";
91 91
 
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	/**
109 109
 	 * Archive template.
110 110
 	 */
111
-	public function archive_template_include( $template ) {
112
-		$applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() );
113
-		if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) {
111
+	public function archive_template_include($template) {
112
+		$applicable_post_types = apply_filters('lsx_health_plan_archive_template', array());
113
+		if ( ! empty($applicable_post_types) && is_main_query() && is_post_type_archive($applicable_post_types)) {
114 114
 			$post_type = get_post_type();
115
-			if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) {
115
+			if (empty(locate_template(array('archive-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php')) {
116 116
 				$template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php';
117 117
 			}
118 118
 		}
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 	/**
123 123
 	 * Single template.
124 124
 	 */
125
-	public function single_template_include( $template ) {
126
-		$applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() );
127
-		if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) {
125
+	public function single_template_include($template) {
126
+		$applicable_post_types = apply_filters('lsx_health_plan_single_template', array());
127
+		if ( ! empty($applicable_post_types) && is_main_query() && is_singular($applicable_post_types)) {
128 128
 			$post_type = get_post_type();
129
-			if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) {
129
+			if (empty(locate_template(array('single-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php')) {
130 130
 				$template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php';
131 131
 			}
132 132
 		}
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 	 * @param     $template string
140 140
 	 * @return    string
141 141
 	 */
142
-	public function taxonomy_template_include( $template ) {
143
-		$applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() );
144
-		if ( is_main_query() && is_tax( $applicable_taxonomies ) ) {
145
-			$current_taxonomy = get_query_var( 'taxonomy' );
146
-			if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) {
142
+	public function taxonomy_template_include($template) {
143
+		$applicable_taxonomies = apply_filters('lsx_health_plan_taxonomies_template', array());
144
+		if (is_main_query() && is_tax($applicable_taxonomies)) {
145
+			$current_taxonomy = get_query_var('taxonomy');
146
+			if ('' === locate_template(array('taxonomy-' . $current_taxonomy . '.php')) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php')) {
147 147
 				$template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php';
148 148
 			}
149 149
 		}
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 	 * @return void
157 157
 	 */
158 158
 	public function redirect() {
159
-		if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) {
159
+		if ( ! is_user_logged_in() || ! function_exists('wc_get_page_id') || is_home()) {
160 160
 			return;
161 161
 		}
162
-		if ( lsx_health_plan_user_has_purchase() && ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) ) ) {
163
-			wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) );
162
+		if (lsx_health_plan_user_has_purchase() && (is_page(wc_get_page_id('cart')) || is_page(wc_get_page_id('checkout')))) {
163
+			wp_redirect(get_permalink(wc_get_page_id('myaccount')));
164 164
 			die;
165 165
 		}
166 166
 
167
-		$product_id = \lsx_health_plan\functions\get_option( 'membership_product', false );
168
-		if ( false !== $product_id && is_single( $product_id ) ) {
169
-			wp_redirect( home_url() );
167
+		$product_id = \lsx_health_plan\functions\get_option('membership_product', false);
168
+		if (false !== $product_id && is_single($product_id)) {
169
+			wp_redirect(home_url());
170 170
 			die;
171 171
 		}
172 172
 	}
@@ -175,21 +175,21 @@  discard block
 block discarded – undo
175 175
 	 * Registers the rewrites.
176 176
 	 */
177 177
 	public function handle_day_action() {
178
-		if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) {
179
-			update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true );
180
-			wp_safe_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) );
178
+		if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'complete')) {
179
+			update_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete', true);
180
+			wp_safe_redirect(get_permalink(wc_get_page_id('myaccount')));
181 181
 		}
182 182
 
183
-		if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) {
184
-			delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' );
183
+		if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'unlock')) {
184
+			delete_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete');
185 185
 		}
186 186
 	}
187 187
 
188 188
 	/**
189 189
 	 * Registers the rewrites.
190 190
 	 */
191
-	public function wpkses_post_tags( $tags, $context ) {
192
-		if ( 'post' === $context ) {
191
+	public function wpkses_post_tags($tags, $context) {
192
+		if ('post' === $context) {
193 193
 			$tags['iframe'] = array(
194 194
 				'src'             => true,
195 195
 				'height'          => true,
Please login to merge, or discard this patch.
classes/class-core.php 1 patch
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.
classes/frontend/class-endpoints.php 1 patch
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.
classes/frontend/class-modals.php 1 patch
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.