Passed
Push — add/multiplan ( 15cba9...22afe1 )
by Virginia
04:24
created
classes/integrations/class-articles.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function __construct() {
29 29
 		$this->default_types = array(
30
-			\lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ),
31
-			\lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ),
32
-			\lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ),
33
-			\lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ),
34
-			\lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ),
30
+			\lsx_health_plan\functions\get_option('endpoint_meal', 'meal'),
31
+			\lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'),
32
+			\lsx_health_plan\functions\get_option('endpoint_recipe_single', 'recipe'),
33
+			\lsx_health_plan\functions\get_option('endpoint_workout', 'workout'),
34
+			\lsx_health_plan\functions\get_option('endpoint_plan', 'plan'),
35 35
 		);
36
-		add_action( 'cmb2_admin_init', array( $this, 'related_articles_metabox' ) );
36
+		add_action('cmb2_admin_init', array($this, 'related_articles_metabox'));
37 37
 	}
38 38
 
39 39
 	/**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public static function get_instance() {
47 47
 		// If the single instance hasn't been set, set it now.
48
-		if ( null === self::$instance ) {
48
+		if (null === self::$instance) {
49 49
 			self::$instance = new self();
50 50
 		}
51 51
 		return self::$instance;
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
 	 * Define the related articles member metabox and field configurations.
56 56
 	 */
57 57
 	public function related_articles_metabox() {
58
-		foreach ( $this->default_types as $type => $default_type ) {
58
+		foreach ($this->default_types as $type => $default_type) {
59 59
 			$cmb = new_cmb2_box(
60 60
 				array(
61 61
 					'id'           => $default_type . '_related_articles_metabox',
62
-					'title'        => __( 'Related Articles', 'lsx-health-plan' ),
63
-					'object_types' => array( $default_type ), // Post type.
62
+					'title'        => __('Related Articles', 'lsx-health-plan'),
63
+					'object_types' => array($default_type), // Post type.
64 64
 					'context'      => 'normal',
65 65
 					'priority'     => 'low',
66 66
 					'show_names'   => true,
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 
70 70
 			$cmb->add_field(
71 71
 				array(
72
-					'name'       => __( 'Related Articles', 'lsx-health-plan' ),
73
-					'desc'       => __( 'Connect the related articles that applies to this ', 'lsx-health-plan' ) . $default_type,
72
+					'name'       => __('Related Articles', 'lsx-health-plan'),
73
+					'desc'       => __('Connect the related articles that applies to this ', 'lsx-health-plan') . $default_type,
74 74
 					'id'         => $default_type . '_connected_articles',
75 75
 					'type'       => 'post_search_ajax',
76 76
 					'limit'      => 3,
77 77
 					'sortable'   => true,
78 78
 					'query_args' => array(
79
-						'post_type'      => array( 'post' ),
80
-						'post_status'    => array( 'publish' ),
79
+						'post_type'      => array('post'),
80
+						'post_status'    => array('publish'),
81 81
 						'posts_per_page' => 3,
82 82
 					),
83 83
 				)
Please login to merge, or discard this patch.
includes/functions.php 1 patch
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -16,24 +16,24 @@  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
-		if ( ! is_array( $items ) ) {
27
-			$items = array( $items );
24
+	$items = get_post_meta($post_id, $meta_key, $single);
25
+	if ('' !== $items && false !== $items && 0 !== $items) {
26
+		if ( ! is_array($items)) {
27
+			$items = array($items);
28 28
 		}
29
-		$items = check_posts_exist( $items );
30
-		if ( ! empty( $items ) ) {
29
+		$items = check_posts_exist($items);
30
+		if ( ! empty($items)) {
31 31
 			$has_post = true;
32 32
 		}
33 33
 	} else {
34 34
 		// Check for defaults.
35
-		$options = get_option( 'all' );
36
-		if ( isset( $options[ $meta_key ] ) && '' !== $options[ $meta_key ] && ! empty( $options[ $meta_key ] ) ) {
35
+		$options = get_option('all');
36
+		if (isset($options[$meta_key]) && '' !== $options[$meta_key] && ! empty($options[$meta_key])) {
37 37
 			$has_post = true;
38 38
 		}
39 39
 	}
@@ -47,17 +47,17 @@  discard block
 block discarded – undo
47 47
  * @param  mixed  $default Optional default value
48 48
  * @return mixed           Option value
49 49
  */
50
-function get_option( $key = '', $default = false ) {
51
-	if ( function_exists( 'cmb2_get_option' ) ) {
52
-		return cmb2_get_option( 'lsx_health_plan_options', $key, $default );
50
+function get_option($key = '', $default = false) {
51
+	if (function_exists('cmb2_get_option')) {
52
+		return cmb2_get_option('lsx_health_plan_options', $key, $default);
53 53
 	}
54 54
 	// Fallback to get_option if CMB2 is not loaded yet.
55
-	$opts = \get_option( 'lsx_health_plan_options', $default );
55
+	$opts = \get_option('lsx_health_plan_options', $default);
56 56
 	$val  = $default;
57
-	if ( 'all' === $key ) {
57
+	if ('all' === $key) {
58 58
 		$val = $opts;
59
-	} elseif ( is_array( $opts ) && array_key_exists( $key, $opts ) && false !== $opts[ $key ] ) {
60
-		$val = $opts[ $key ];
59
+	} elseif (is_array($opts) && array_key_exists($key, $opts) && false !== $opts[$key]) {
60
+		$val = $opts[$key];
61 61
 	}
62 62
 	return $val;
63 63
 }
@@ -69,54 +69,54 @@  discard block
 block discarded – undo
69 69
  * @param  mixed  $default Optional default value
70 70
  * @return mixed           Option value
71 71
  */
72
-function get_downloads( $type = 'all', $post_id = '' ) {
72
+function get_downloads($type = 'all', $post_id = '') {
73 73
 	$lsx_health_plan = \lsx_health_plan();
74 74
 	$post_types      = $lsx_health_plan->get_post_types();
75
-	if ( '' === $post_id ) {
75
+	if ('' === $post_id) {
76 76
 		$post_id = get_the_ID();
77 77
 	}
78 78
 	$downloads = array();
79
-	$options   = get_option( 'all' );
79
+	$options   = get_option('all');
80 80
 
81
-	foreach ( $post_types as $post_type ) {
82
-		if ( 'all' === $type || in_array( $type, $post_types, true ) ) {
81
+	foreach ($post_types as $post_type) {
82
+		if ('all' === $type || in_array($type, $post_types, true)) {
83 83
 
84 84
 			// Get the default downloads for this post type.
85 85
 			$default_downloads = array();
86 86
 			$new_downloads     = array();
87
-			if ( isset( $options[ 'download_' . $post_type ] ) ) {
88
-				if ( is_array( $options[ 'download_' . $post_type ] ) ) {
89
-					$default_downloads = $options[ 'download_' . $post_type ];
87
+			if (isset($options['download_' . $post_type])) {
88
+				if (is_array($options['download_' . $post_type])) {
89
+					$default_downloads = $options['download_' . $post_type];
90 90
 				} else {
91
-					$default_downloads[] = $options[ 'download_' . $post_type ];
91
+					$default_downloads[] = $options['download_' . $post_type];
92 92
 				}
93 93
 			}
94 94
 
95
-			if ( 'page' === $post_type ) {
95
+			if ('page' === $post_type) {
96 96
 				$key = 'plan_warmup';
97 97
 			} else {
98 98
 				$key = 'connected_' . $post_type . 's';
99 99
 			}
100 100
 
101
-			$connected_items = get_post_meta( $post_id, $key, true );
102
-			if ( ! empty( $connected_items ) ) {
103
-				foreach ( $connected_items as $connected_item ) {
104
-					$current_downloads = get_post_meta( $connected_item, 'connected_downloads', true );
105
-					if ( false !== $current_downloads && ! empty( $current_downloads ) ) {
106
-						$new_downloads = array_merge( $new_downloads, $current_downloads );
101
+			$connected_items = get_post_meta($post_id, $key, true);
102
+			if ( ! empty($connected_items)) {
103
+				foreach ($connected_items as $connected_item) {
104
+					$current_downloads = get_post_meta($connected_item, 'connected_downloads', true);
105
+					if (false !== $current_downloads && ! empty($current_downloads)) {
106
+						$new_downloads = array_merge($new_downloads, $current_downloads);
107 107
 					}
108 108
 				}
109 109
 			}
110 110
 
111
-			if ( ! empty( $new_downloads ) ) {
112
-				$downloads = array_merge( $downloads, $new_downloads );
113
-			} elseif ( ! empty( $default_downloads ) ) {
114
-				$downloads = array_merge( $downloads, $default_downloads );
111
+			if ( ! empty($new_downloads)) {
112
+				$downloads = array_merge($downloads, $new_downloads);
113
+			} elseif ( ! empty($default_downloads)) {
114
+				$downloads = array_merge($downloads, $default_downloads);
115 115
 			}
116
-			$downloads = array_unique( $downloads );
116
+			$downloads = array_unique($downloads);
117 117
 		}
118 118
 	}
119
-	$downloads = check_posts_exist( $downloads );
119
+	$downloads = check_posts_exist($downloads);
120 120
 	return $downloads;
121 121
 }
122 122
 
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
  * @param  string $week    Week name 'week-1'.
127 127
  * @return array           an array of the downloads or empty.
128 128
  */
129
-function get_weekly_downloads( $week = '' ) {
129
+function get_weekly_downloads($week = '') {
130 130
 	$downloads = array();
131
-	if ( '' !== $week ) {
132
-		$saved_downloads = get_transient( 'lsx_hp_weekly_downloads_' . $week );
133
-		if ( false !== $saved_downloads && ! empty( $saved_downloads ) ) {
131
+	if ('' !== $week) {
132
+		$saved_downloads = get_transient('lsx_hp_weekly_downloads_' . $week);
133
+		if (false !== $saved_downloads && ! empty($saved_downloads)) {
134 134
 			$downloads = $saved_downloads;
135 135
 		} else {
136 136
 			$args = array(
@@ -144,17 +144,17 @@  discard block
 block discarded – undo
144 144
 					array(
145 145
 						'taxonomy' => 'dlm_download_category',
146 146
 						'field'    => 'slug',
147
-						'terms'    => array( $week ),
147
+						'terms'    => array($week),
148 148
 					),
149 149
 				),
150 150
 			);
151
-			$download_query = new \WP_Query( $args );
152
-			if ( $download_query->have_posts() ) {
151
+			$download_query = new \WP_Query($args);
152
+			if ($download_query->have_posts()) {
153 153
 				$downloads = $download_query->posts;
154 154
 			}
155 155
 		}
156 156
 	}
157
-	$downloads = check_posts_exist( $downloads );
157
+	$downloads = check_posts_exist($downloads);
158 158
 	return $downloads;
159 159
 }
160 160
 
@@ -164,20 +164,20 @@  discard block
 block discarded – undo
164 164
  * @param array $post_ids
165 165
  * @return void
166 166
  */
167
-function check_posts_exist( $post_ids = array() ) {
167
+function check_posts_exist($post_ids = array()) {
168 168
 	$new_ids = array();
169 169
 	global $wpdb;
170
-	if ( is_array( $post_ids ) && ! empty( $post_ids ) ) {
171
-		$post_ids = "'" . implode( "','", $post_ids ) . "'";
170
+	if (is_array($post_ids) && ! empty($post_ids)) {
171
+		$post_ids = "'" . implode("','", $post_ids) . "'";
172 172
 		$query    = "
173 173
 			SELECT `ID` 
174 174
 			FROM `{$wpdb->posts}`
175 175
 			WHERE `ID` IN ({$post_ids})
176 176
 			AND `post_status` != 'trash'
177 177
 		";
178
-		$results = $wpdb->get_results( $query ); // WPCS: unprepared SQL
179
-		if ( ! empty( $results ) ) {
180
-			$new_ids = wp_list_pluck( $results, 'ID' );
178
+		$results = $wpdb->get_results($query); // WPCS: unprepared SQL
179
+		if ( ! empty($results)) {
180
+			$new_ids = wp_list_pluck($results, 'ID');
181 181
 		}
182 182
 	}
183 183
 	return $new_ids;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
  * @param string $body
192 192
  * @return void
193 193
  */
194
-function register_modal( $id = '', $title = '', $body = '' ) {
194
+function register_modal($id = '', $title = '', $body = '') {
195 195
 	lsx_health_plan()->frontend->modals->register_modal(
196 196
 		array(
197 197
 			'title' => $title,
@@ -207,36 +207,36 @@  discard block
 block discarded – undo
207 207
  * @param array $args
208 208
  * @return void
209 209
  */
210
-function output_modal( $args = array() ) {
210
+function output_modal($args = array()) {
211 211
 	$defaults = array(
212 212
 		'id'    => '',
213 213
 		'title' => '',
214 214
 		'body'  => '',
215 215
 	);
216
-	$args     = wp_parse_args( $args, $defaults );
216
+	$args = wp_parse_args($args, $defaults);
217 217
 	?>
218 218
 	<!-- Modal -->
219
-	<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">
219
+	<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">
220 220
 		<div class="modal-dialog" role="document">
221 221
 			<div class="modal-content">
222 222
 			<button type="button" class="close" data-dismiss="modal">&times;</button>			
223 223
 				<div class="modal-header">
224 224
 					<?php
225
-					if ( '' !== $args['title'] ) {
226
-						echo wp_kses_post( '<h2>' . $args['title'] . '</h2>' );
225
+					if ('' !== $args['title']) {
226
+						echo wp_kses_post('<h2>' . $args['title'] . '</h2>');
227 227
 					}
228 228
 					?>
229 229
 				</div>
230 230
 				<div class="modal-body">
231 231
 				<?php
232
-				if ( '' !== $args['body'] ) {
232
+				if ('' !== $args['body']) {
233 233
 					$allowed_html = array(
234 234
 						'iframe' => array(
235 235
 							'data-src'        => array(),
236 236
 							'src'             => array(),
237 237
 							'width'           => array(),
238 238
 							'height'          => array(),
239
-							'frameBorder'     => array( '0' ),
239
+							'frameBorder'     => array('0'),
240 240
 							'class'           => array(),
241 241
 							'allowFullScreen' => array(),
242 242
 							'style'           => array(),
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 							'class' => array(),
246 246
 						),
247 247
 					);
248
-					if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
249
-						echo wp_kses_post( $args['body'] );
248
+					if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
249
+						echo wp_kses_post($args['body']);
250 250
 					} else {
251
-						echo wp_kses( $args['body'], $allowed_html );
251
+						echo wp_kses($args['body'], $allowed_html);
252 252
 					}
253 253
 				}
254 254
 				?>
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
  * @param [type] $embed
267 267
  * @return void
268 268
  */
269
-function get_video_url( $embed ) {
269
+function get_video_url($embed) {
270 270
 	$url = '';
271
-	if ( false !== stripos( $embed, '<iframe' ) ) {
272
-		preg_match( '/src="([^"]+)"/', $embed, $match );
273
-		if ( is_array( $match ) && isset( $match[1] ) ) {
271
+	if (false !== stripos($embed, '<iframe')) {
272
+		preg_match('/src="([^"]+)"/', $embed, $match);
273
+		if (is_array($match) && isset($match[1])) {
274 274
 			$url = '<iframe data-src="' . $match[1] . '" style="border: 0;" frameBorder="0" class="giphy-embed" allowFullScreen height="300" width="100%"></iframe>';
275 275
 		} else {
276 276
 			$url = $embed;
@@ -288,15 +288,15 @@  discard block
 block discarded – undo
288 288
  * @param array $post_ids
289 289
  * @return boolean
290 290
  */
291
-function is_week_complete( $term_id = false, $section_keys = array(), $group_title = '' ) {
291
+function is_week_complete($term_id = false, $section_keys = array(), $group_title = '') {
292 292
 	$return = false;
293
-	if ( ! empty( $section_keys ) ) {
294
-		$group_count = count( $section_keys );
295
-		foreach ( $section_keys as &$pid ) {
296
-			$pid = 'day_' . \lsx_health_plan\functions\plan\generate_section_id( $pid ) . '_complete';
293
+	if ( ! empty($section_keys)) {
294
+		$group_count = count($section_keys);
295
+		foreach ($section_keys as &$pid) {
296
+			$pid = 'day_' . \lsx_health_plan\functions\plan\generate_section_id($pid) . '_complete';
297 297
 		}
298
-		$days_complete = get_meta_amounts( $section_keys );
299
-		if ( (int) $group_count === (int) $days_complete ) {
298
+		$days_complete = get_meta_amounts($section_keys);
299
+		if ((int) $group_count === (int) $days_complete) {
300 300
 			$return = true;
301 301
 		}
302 302
 	}
@@ -310,20 +310,20 @@  discard block
 block discarded – undo
310 310
  * @param string $key
311 311
  * @return void
312 312
  */
313
-function get_meta_amounts( $post_ids = array() ) {
313
+function get_meta_amounts($post_ids = array()) {
314 314
 	global $wpdb;
315 315
 	$amount       = 0;
316 316
 	$current_user = wp_get_current_user();
317
-	if ( false !== $current_user && ! empty( $post_ids ) ) {
318
-		$post_ids = "'" . implode( "','", $post_ids ) . "'";
317
+	if (false !== $current_user && ! empty($post_ids)) {
318
+		$post_ids = "'" . implode("','", $post_ids) . "'";
319 319
 		$query    = "
320 320
 			SELECT COUNT(`meta_value`) 
321 321
 			FROM `{$wpdb->usermeta}`
322 322
 			WHERE `meta_key` IN ({$post_ids})
323 323
 			AND `user_id` = '{$current_user->ID}'
324 324
 		";
325
-		$results  = $wpdb->get_var( $query ); // WPCS: unprepared SQL
326
-		if ( ! empty( $results ) ) {
325
+		$results = $wpdb->get_var($query); // WPCS: unprepared SQL
326
+		if ( ! empty($results)) {
327 327
 			$amount = $results;
328 328
 		}
329 329
 	}
@@ -336,20 +336,20 @@  discard block
 block discarded – undo
336 336
  * @param [type] $post
337 337
  * @return void
338 338
  */
339
-function hp_get_plan_type_meta( $post ) {
339
+function hp_get_plan_type_meta($post) {
340 340
 	$plan_meta = '';
341 341
 
342
-	$term_obj_list = get_the_terms( $post->ID, 'plan-type' );
343
-	if ( false !== $term_obj_list ) {
344
-		$terms_string  = join( ' & ', wp_list_pluck( $term_obj_list, 'name' ) );
345
-		$terms_ids     = wp_list_pluck( $term_obj_list, 'term_id' );
342
+	$term_obj_list = get_the_terms($post->ID, 'plan-type');
343
+	if (false !== $term_obj_list) {
344
+		$terms_string  = join(' & ', wp_list_pluck($term_obj_list, 'name'));
345
+		$terms_ids     = wp_list_pluck($term_obj_list, 'term_id');
346 346
 
347
-		foreach ( $terms_ids as $terms_id ) {
348
-			$term_thumbnail_id = get_term_meta( $terms_id, 'thumbnail', true );
349
-			$img               = wp_get_attachment_image_src( $term_thumbnail_id, 'thumbnail' );
350
-			if ( ! empty( $img ) ) {
347
+		foreach ($terms_ids as $terms_id) {
348
+			$term_thumbnail_id = get_term_meta($terms_id, 'thumbnail', true);
349
+			$img               = wp_get_attachment_image_src($term_thumbnail_id, 'thumbnail');
350
+			if ( ! empty($img)) {
351 351
 				$image_url         = $img[0];
352
-				$img               = '<img loading="lazy" alt="thumbnail" style="width:24px; height: auto;" class="attachment-responsive wp-post-image lsx-responsive" src="' . esc_url( $image_url ) . '" />';
352
+				$img               = '<img loading="lazy" alt="thumbnail" style="width:24px; height: auto;" class="attachment-responsive wp-post-image lsx-responsive" src="' . esc_url($image_url) . '" />';
353 353
 			}
354 354
 
355 355
 			$plan_meta .= $img;
@@ -364,14 +364,14 @@  discard block
 block discarded – undo
364 364
 /**
365 365
  * Limit media library access
366 366
  */
367
-function set_only_author( $wp_query ) {
367
+function set_only_author($wp_query) {
368 368
 	global $current_user;
369
-	if ( is_admin() && ! current_user_can( 'edit_others_posts' ) ) {
370
-		$wp_query->set( 'administrator', $current_user->ID );
371
-		add_filter( 'views_upload', 'fix_media_counts' );
369
+	if (is_admin() && ! current_user_can('edit_others_posts')) {
370
+		$wp_query->set('administrator', $current_user->ID);
371
+		add_filter('views_upload', 'fix_media_counts');
372 372
 	}
373 373
 }
374
-add_action( 'pre_get_posts', '\lsx_health_plan\functions\set_only_author' );
374
+add_action('pre_get_posts', '\lsx_health_plan\functions\set_only_author');
375 375
 
376 376
 /**
377 377
  * Outputs an excerpt even if there is not excerpt.
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
  * @param [type] $post_id
380 380
  * @return void
381 381
  */
382
-function hp_excerpt( $post_id ) {
383
-	if ( ! has_excerpt( $post_id ) ) {
384
-		$content = wp_trim_words( get_post_field( 'post_content', $post_id ), 10 );
382
+function hp_excerpt($post_id) {
383
+	if ( ! has_excerpt($post_id)) {
384
+		$content = wp_trim_words(get_post_field('post_content', $post_id), 10);
385 385
 	} else {
386
-		$content = get_the_excerpt( $post_id );
386
+		$content = get_the_excerpt($post_id);
387 387
 	}
388 388
 	return $content;
389 389
 }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
  * @param string $columns
395 395
  * @return void
396 396
  */
397
-function column_class( $columns = '3' ) {
397
+function column_class($columns = '3') {
398 398
 	$cols  = '';
399 399
 	$cols .= '5' === $columns ? '15' : 12 / $columns;
400 400
 	return $cols;
@@ -406,16 +406,16 @@  discard block
 block discarded – undo
406 406
  * @param string $workout
407 407
  * @return void
408 408
  */
409
-function get_exercises_by_workout( $workout = '' ) {
409
+function get_exercises_by_workout($workout = '') {
410 410
 	$exercises = array();
411 411
 	$i               = 1;
412 412
 	$section_counter = 6;
413
-	while ( $i <= $section_counter ) {
413
+	while ($i <= $section_counter) {
414 414
 		$group_name = 'workout_section_' . $i;
415
-		$groups     = get_post_meta( $workout, $group_name, true );
416
-		if ( ! empty( $groups ) ) {
417
-			foreach ( $groups as $group ) {
418
-				if ( isset( $group['connected_exercises'] ) ) {
415
+		$groups     = get_post_meta($workout, $group_name, true);
416
+		if ( ! empty($groups)) {
417
+			foreach ($groups as $group) {
418
+				if (isset($group['connected_exercises'])) {
419 419
 					$exercises[] = $group['connected_exercises'];
420 420
 				}
421 421
 			}
@@ -432,19 +432,19 @@  discard block
 block discarded – undo
432 432
  * @param  int $plan_id
433 433
  * @return int
434 434
  */
435
-function get_progress( $plan_id = false ) {
435
+function get_progress($plan_id = false) {
436 436
 	$progress = 0;
437 437
 	$complete = array();
438 438
 	$count    = 0;
439
-	if ( false !== $plan_id &&  \lsx_health_plan\functions\plan\has_sections( $plan_id ) ) {
439
+	if (false !== $plan_id && \lsx_health_plan\functions\plan\has_sections($plan_id)) {
440 440
 		$sections = \lsx_health_plan\functions\plan\get_sections();
441
-		$all_count = count( $sections );
442
-		foreach ( $sections as $section_key => $section_values ) {
443
-			if ( lsx_health_plan_is_day_complete( $plan_id, $section_values['title'] ) ) {
441
+		$all_count = count($sections);
442
+		foreach ($sections as $section_key => $section_values) {
443
+			if (lsx_health_plan_is_day_complete($plan_id, $section_values['title'])) {
444 444
 				$complete[] = true;
445 445
 			}
446 446
 		}
447
-		$progress = (int) count( $complete ) / (int) $all_count * 100;
447
+		$progress = (int) count($complete) / (int) $all_count * 100;
448 448
 	}
449 449
 	return $progress;
450 450
 }
@@ -459,19 +459,19 @@  discard block
 block discarded – undo
459 459
 function hp_back_archive_link() {
460 460
 
461 461
 	$post_type = 'exercise';
462
-	if ( is_tax( 'recipe-cuisine' ) || is_tax( 'recipe-type' ) ) {
462
+	if (is_tax('recipe-cuisine') || is_tax('recipe-type')) {
463 463
 		$post_type = 'recipe';
464 464
 	}
465 465
 
466
-	if ( is_tax() ) {
466
+	if (is_tax()) {
467 467
 		?>
468 468
 		<div class="archive-category-title hp-archive-category-title">
469
-			<a class="back-to-blog" href="<?php echo ( esc_url( get_post_type_archive_link( $post_type ) ) ); ?>"><?php echo esc_html__( 'Back To ', 'lsx' ) . esc_html( $post_type ) . 's'; ?></a>
469
+			<a class="back-to-blog" href="<?php echo (esc_url(get_post_type_archive_link($post_type))); ?>"><?php echo esc_html__('Back To ', 'lsx') . esc_html($post_type) . 's'; ?></a>
470 470
 		</div>
471 471
 		<?php
472 472
 	}
473 473
 }
474
-add_action( 'lsx_content_wrap_before', '\lsx_health_plan\functions\hp_back_archive_link', 20 );
474
+add_action('lsx_content_wrap_before', '\lsx_health_plan\functions\hp_back_archive_link', 20);
475 475
 
476 476
 /**
477 477
  * Returns an array.
@@ -479,11 +479,11 @@  discard block
 block discarded – undo
479 479
  * @param  mixed $item
480 480
  * @return array
481 481
  */
482
-function prep_array( $item ) {
483
-	if ( ! is_array( $item ) ) {
484
-		$item = explode( ',', $item );
485
-		if ( ! is_array( $item ) ) {
486
-			$item = array( $item );
482
+function prep_array($item) {
483
+	if ( ! is_array($item)) {
484
+		$item = explode(',', $item);
485
+		if ( ! is_array($item)) {
486
+			$item = array($item);
487 487
 		}
488 488
 	}
489 489
 	return $item;
Please login to merge, or discard this patch.
templates/table-exercise-data.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,17 +5,17 @@  discard block
 block discarded – undo
5 5
 $muscle_group = lsx_health_plan_muscle_group_equipment();
6 6
 
7 7
 ?>
8
-<?php if ( ( ! empty( $type ) ) || ( ! empty( $equipment ) ) || ( ! empty( $muscle_group ) ) ) { ?>
8
+<?php if (( ! empty($type)) || ( ! empty($equipment)) || ( ! empty($muscle_group))) { ?>
9 9
 <table class="exercise-table">
10 10
 	<tbody>
11 11
 		<?php
12
-		if ( ! empty( $type ) ) {
12
+		if ( ! empty($type)) {
13 13
 		?>
14 14
 			<tr class="types">
15
-				<td><?php esc_html_e( 'Type:', 'lsx-health-plan' ); ?>&nbsp;</td>
15
+				<td><?php esc_html_e('Type:', 'lsx-health-plan'); ?>&nbsp;</td>
16 16
 				<td>
17 17
 				<?php
18
-					echo wp_kses_post( $type );
18
+					echo wp_kses_post($type);
19 19
 				?>
20 20
 				</td>
21 21
 			</tr>
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 		}
24 24
 		?>
25 25
 		<?php
26
-		if ( ! empty( $muscle_group ) ) {
26
+		if ( ! empty($muscle_group)) {
27 27
 		?>
28 28
 			<tr class="muscle-group">
29
-				<td><?php esc_html_e( 'Muscle Group:', 'lsx-health-plan' ); ?>&nbsp;</td>
29
+				<td><?php esc_html_e('Muscle Group:', 'lsx-health-plan'); ?>&nbsp;</td>
30 30
 				<td>
31 31
 				<?php
32
-					echo wp_kses_post( $muscle_group );
32
+					echo wp_kses_post($muscle_group);
33 33
 				?>
34 34
 				</td>
35 35
 			</tr>
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 		}
38 38
 		?>
39 39
 		<?php
40
-		if ( ! empty( $equipment ) ) {
40
+		if ( ! empty($equipment)) {
41 41
 		?>
42 42
 			<tr class="equipment">
43
-				<td><?php esc_html_e( 'Equipment:', 'lsx-health-plan' ); ?>&nbsp;</td>
43
+				<td><?php esc_html_e('Equipment:', 'lsx-health-plan'); ?>&nbsp;</td>
44 44
 				<td>
45 45
 				<?php
46
-					echo wp_kses_post( $equipment );
46
+					echo wp_kses_post($equipment);
47 47
 				?>
48 48
 				</td>
49 49
 			</tr>
Please login to merge, or discard this patch.
templates/content-archive-exercise.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -17,29 +17,29 @@  discard block
 block discarded – undo
17 17
 $link_close      = '';
18 18
 
19 19
 // Check for shortcode overrides.
20
-if ( null !== $shortcode_args ) {
21
-	if ( isset( $shortcode_args['columns'] ) ) {
20
+if (null !== $shortcode_args) {
21
+	if (isset($shortcode_args['columns'])) {
22 22
 		$column_class = $shortcode_args['columns'];
23
-		$column_class = \lsx_health_plan\functions\column_class( $column_class );
23
+		$column_class = \lsx_health_plan\functions\column_class($column_class);
24 24
 	}
25
-	if ( isset( $shortcode_args['link'] ) ) {
25
+	if (isset($shortcode_args['link'])) {
26 26
 		$link_setting = $shortcode_args['link'];
27 27
 		// Setup our link and content.
28
-		switch ( $link_setting ) {
28
+		switch ($link_setting) {
29 29
 			case 'single':
30
-				$link_html  = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">';
30
+				$link_html  = '<a href="' . get_permalink($group['connected_exercises']) . '">';
31 31
 				$link_close = '</a>';
32 32
 				break;
33 33
 
34 34
 			case 'modal':
35 35
 				$link_html  = '<a class="btn border-btn" data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">';
36 36
 				$link_close = '</a>';
37
-				$modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' );
37
+				$modal_content_setting = \lsx_health_plan\functions\get_option('workout_tab_modal_content', 'excerpt');
38 38
 				$modal_args = array(
39 39
 					'modal_content' => $modal_content_setting,
40 40
 				);
41 41
 				// We call the button to register the modal, but we do not output it.
42
-				lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args );
42
+				lsx_health_plan_workout_exercise_button($group['connected_exercises'], $group, false, $modal_args);
43 43
 				break;
44 44
 
45 45
 			case 'none':
@@ -49,28 +49,28 @@  discard block
 block discarded – undo
49 49
 				break;
50 50
 		}
51 51
 	}
52
-	if ( isset( $shortcode_args['description'] ) ) {
52
+	if (isset($shortcode_args['description'])) {
53 53
 		$content_setting = $shortcode_args['description'];
54 54
 	}
55 55
 }
56 56
 
57 57
 ?>
58 58
 
59
-<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr( $column_class ); ?> has-content-<?php echo esc_attr( $content_setting ); ?>">
59
+<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr($column_class); ?> has-content-<?php echo esc_attr($content_setting); ?>">
60 60
 	<article class="lsx-slot box-shadow">
61 61
 		<?php lsx_entry_top(); ?>
62 62
 
63 63
 		<div class="exercise-feature-img">
64
-			<a href="<?php echo esc_url( get_permalink() ); ?>">
64
+			<a href="<?php echo esc_url(get_permalink()); ?>">
65 65
 			<?php
66 66
 			$featured_image = get_the_post_thumbnail();
67
-			if ( ! empty( $featured_image ) && '' !== $featured_image ) {
68
-				the_post_thumbnail( 'lsx-thumbnail-square', array(
67
+			if ( ! empty($featured_image) && '' !== $featured_image) {
68
+				the_post_thumbnail('lsx-thumbnail-square', array(
69 69
 					'class' => 'aligncenter',
70
-				) );
70
+				));
71 71
 			} else {
72 72
 				?>
73
-				<img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>">
73
+				<img loading="lazy" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>">
74 74
 				<?php
75 75
 			}
76 76
 			?>
@@ -78,24 +78,24 @@  discard block
 block discarded – undo
78 78
 		</div>
79 79
 		<div class="content-box exercise-content-box white-bg">
80 80
 			<div class="title-lined">
81
-				<?php lsx_health_plan_exercise_title( '<h3 class="exercise-title">', '</h3>' ); ?>
81
+				<?php lsx_health_plan_exercise_title('<h3 class="exercise-title">', '</h3>'); ?>
82 82
 				<?php lsx_health_plan_exercise_data(); ?>
83 83
 			</div>
84 84
 			<?php
85
-			if ( '' !== $content_setting && 'excerpt' === $content_setting ) {
86
-				if ( ! has_excerpt() ) {
87
-					$content = wp_trim_words( get_the_content(), 20 );
85
+			if ('' !== $content_setting && 'excerpt' === $content_setting) {
86
+				if ( ! has_excerpt()) {
87
+					$content = wp_trim_words(get_the_content(), 20);
88 88
 					$content = '<p>' . $content . '</p>';
89 89
 				} else {
90
-					$content = apply_filters( 'the_excerpt', get_the_excerpt() );
90
+					$content = apply_filters('the_excerpt', get_the_excerpt());
91 91
 				}
92
-				echo wp_kses_post( $content );
92
+				echo wp_kses_post($content);
93 93
 			}
94
-			if ( '' !== $content_setting && 'full' === $content_setting ) {
94
+			if ('' !== $content_setting && 'full' === $content_setting) {
95 95
 				the_content();
96 96
 			}
97 97
 			?>
98
-			<a href="<?php echo esc_url( get_permalink() ); ?>" class="btn border-btn"><?php esc_html_e( 'See exercise', 'lsx-health-plan' ); ?></a>
98
+			<a href="<?php echo esc_url(get_permalink()); ?>" class="btn border-btn"><?php esc_html_e('See exercise', 'lsx-health-plan'); ?></a>
99 99
 		</div>
100 100
 		<?php lsx_entry_bottom(); ?>
101 101
 	</article>
Please login to merge, or discard this patch.
templates/featured-tips.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,29 +6,29 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 
9
-$this_post_type = get_post_type( get_the_ID() );
9
+$this_post_type = get_post_type(get_the_ID());
10 10
 
11
-$connected_tips = get_post_meta( get_the_ID(), ( $this_post_type . '_connected_tips' ), true );
11
+$connected_tips = get_post_meta(get_the_ID(), ($this_post_type . '_connected_tips'), true);
12 12
 
13 13
 ?>
14 14
 <div id="lsx-tips-shortcode" class="daily-plan-block">
15 15
 	<div class="lsx-tips-shortcode lsx-tips-slider slick-slider slick-dotted"  >
16 16
 	<?php
17 17
 	if (is_array($connected_tips) || is_object($connected_tips)) {
18
-		foreach ( $connected_tips as $tip ) {
19
-			$tip_link    = get_permalink( $tip );
20
-			$tip_name    = get_the_title( $tip );
21
-			$tip_content = get_post_field( 'post_content', $tip );
18
+		foreach ($connected_tips as $tip) {
19
+			$tip_link    = get_permalink($tip);
20
+			$tip_name    = get_the_title($tip);
21
+			$tip_content = get_post_field('post_content', $tip);
22 22
 			$icon = LSX_HEALTH_PLAN_URL . 'assets/images/tips-icon.svg';
23 23
 			?>
24 24
 			<div class="content-box diet-tip-wrapper quick-tip">
25 25
 				<div class="row">
26 26
 					<div class="col-xs-2">
27
-						<img loading="lazy" src="<?php echo esc_url( $icon ); ?>" alt="tip"/>
27
+						<img loading="lazy" src="<?php echo esc_url($icon); ?>" alt="tip"/>
28 28
 					</div>
29 29
 					<div class="col-xs-10">
30
-						<h3 class="tip-title"><?php echo esc_html( $tip_name ); ?></h3>
31
-						<?php echo wp_kses_post( $tip_content ); ?>
30
+						<h3 class="tip-title"><?php echo esc_html($tip_name); ?></h3>
31
+						<?php echo wp_kses_post($tip_content); ?>
32 32
 					</div> 
33 33
 				</div>
34 34
 			</div>
Please login to merge, or discard this patch.
templates/taxonomy-plan-type.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 	$redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id;
15 15
 ?>
16 16
 
17
-	<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>">
17
+	<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>">
18 18
 
19 19
 		<?php lsx_content_before(); ?>
20 20
 
21 21
 		<!-- Begining restricted content -->
22 22
 		<?php
23
-		if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) {
23
+		if (current_user_can('wc_memberships_view_restricted_post_content', $post_id)) {
24 24
 			?>
25 25
 			<main id="main" role="main">
26 26
 
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 
29 29
 				<div class="post-wrapper archive-plan">
30 30
 					<div class="row">
31
-						<?php if ( have_posts() ) : ?>
31
+						<?php if (have_posts()) : ?>
32 32
 							<?php
33
-							while ( have_posts() ) :
33
+							while (have_posts()) :
34 34
 								the_post();
35 35
 								?>
36 36
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 						<?php else : ?>
42 42
 
43
-							<?php get_template_part( 'partials/content', 'none' ); ?>
43
+							<?php get_template_part('partials/content', 'none'); ?>
44 44
 
45 45
 						<?php endif; ?>
46 46
 					</div>
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 			<?php
54 54
 		} else {
55
-			wp_redirect( $redirect );
55
+			wp_redirect($redirect);
56 56
 			exit;
57 57
 		}
58 58
 		?>
Please login to merge, or discard this patch.
templates/partials/workout-grid.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -5,30 +5,30 @@  discard block
 block discarded – undo
5 5
  * @package lsx-health-plan
6 6
  */
7 7
 
8
-global $group_name,$shortcode_args;
9
-$groups = get_post_meta( get_the_ID(), $group_name, true );
10
-if ( is_singular( 'workout' ) ) {
11
-	$groups = get_post_meta( get_queried_object_id(), $group_name, true );
8
+global $group_name, $shortcode_args;
9
+$groups = get_post_meta(get_the_ID(), $group_name, true);
10
+if (is_singular('workout')) {
11
+	$groups = get_post_meta(get_queried_object_id(), $group_name, true);
12 12
 }
13 13
 
14
-$link_setting          = \lsx_health_plan\functions\get_option( 'workout_tab_link', 'single' );
15
-$modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' );
16
-$content_setting       = \lsx_health_plan\functions\get_option( 'workout_tab_content', '' );
17
-$column_setting        = \lsx_health_plan\functions\get_option( 'workout_tab_columns', '4' );
14
+$link_setting          = \lsx_health_plan\functions\get_option('workout_tab_link', 'single');
15
+$modal_content_setting = \lsx_health_plan\functions\get_option('workout_tab_modal_content', 'excerpt');
16
+$content_setting       = \lsx_health_plan\functions\get_option('workout_tab_content', '');
17
+$column_setting        = \lsx_health_plan\functions\get_option('workout_tab_columns', '4');
18 18
 
19 19
 // Check for shortcode overrides.
20
-if ( null !== $shortcode_args ) {
21
-	if ( isset( $shortcode_args['link'] ) ) {
20
+if (null !== $shortcode_args) {
21
+	if (isset($shortcode_args['link'])) {
22 22
 		$link_setting = $shortcode_args['link'];
23 23
 	}
24
-	if ( isset( $shortcode_args['description'] ) ) {
24
+	if (isset($shortcode_args['description'])) {
25 25
 		$content_setting = $shortcode_args['description'];
26 26
 	}
27
-	if ( isset( $shortcode_args['columns'] ) ) {
27
+	if (isset($shortcode_args['columns'])) {
28 28
 		$column_setting = $shortcode_args['columns'];
29
-		$column_setting = \lsx_health_plan\functions\column_class( $column_setting );
29
+		$column_setting = \lsx_health_plan\functions\column_class($column_setting);
30 30
 	}
31
-	if ( isset( $shortcode_args['modal_content'] ) ) {
31
+	if (isset($shortcode_args['modal_content'])) {
32 32
 		$modal_content_setting = $shortcode_args['modal_content'];
33 33
 	}
34 34
 }
@@ -39,64 +39,64 @@  discard block
 block discarded – undo
39 39
 
40 40
 $counter = 1;
41 41
 
42
-if ( ! empty( $groups ) ) {
42
+if ( ! empty($groups)) {
43 43
 	?>
44 44
 	<div class="set-grid">
45 45
 		<div class="workout-grid row">
46 46
 			<?php
47
-			foreach ( $groups as $group ) {
47
+			foreach ($groups as $group) {
48 48
 				$connected_exercise = false;
49
-				if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) {
49
+				if (isset($group['connected_exercises']) && '' !== $group['connected_exercises']) {
50 50
 					$connected_exercise = true;
51 51
 				}
52 52
 
53
-				if ( ! $connected_exercise ) {
53
+				if ( ! $connected_exercise) {
54 54
 					$group['connected_exercises'] = '';
55 55
 				}
56 56
 				$alt_title_value = $group['alt_title'] ?? '';
57
-				if ( ( $connected_exercise ) || ( ( ! $connected_exercise ) && $alt_title_value ) ) {
57
+				if (($connected_exercise) || (( ! $connected_exercise) && $alt_title_value)) {
58 58
 
59 59
 					$alt_title = '';
60
-					if ( isset( $group['alt_title'] ) && '' !== $group['alt_title'] ) {
61
-						$alt_title = '<span class="alt-title">' . esc_html( $group['alt_title'] ) . '</span>';
60
+					if (isset($group['alt_title']) && '' !== $group['alt_title']) {
61
+						$alt_title = '<span class="alt-title">' . esc_html($group['alt_title']) . '</span>';
62 62
 					}
63 63
 
64 64
 					$alt_description = '';
65
-					if ( isset( $group['alt_description'] ) && '' !== $group['alt_description'] ) {
66
-						$alt_description = '<span class="alt-description">' . esc_html( $group['alt_description'] ) . '</span>';
65
+					if (isset($group['alt_description']) && '' !== $group['alt_description']) {
66
+						$alt_description = '<span class="alt-description">' . esc_html($group['alt_description']) . '</span>';
67 67
 					}
68 68
 
69 69
 					$alt_image = '';
70
-					if ( isset( $group['exercise_alt_thumbnail'] ) && '' !== $group['exercise_alt_thumbnail'] ) {
70
+					if (isset($group['exercise_alt_thumbnail']) && '' !== $group['exercise_alt_thumbnail']) {
71 71
 						$alt_image = $group['exercise_alt_thumbnail'];
72 72
 					}
73 73
 
74 74
 					$reps = '';
75
-					if ( isset( $group['reps'] ) && '' !== $group['reps'] ) {
76
-						$reps = '<span class="reps">' . esc_html( $group['reps'] ) . '</span>';
75
+					if (isset($group['reps']) && '' !== $group['reps']) {
76
+						$reps = '<span class="reps">' . esc_html($group['reps']) . '</span>';
77 77
 					}
78 78
 					$class_excerpt = 'no-excerpt';
79
-					if ( 'excerpt' === $content_setting ) {
79
+					if ('excerpt' === $content_setting) {
80 80
 						$class_excerpt = 'has-excerpt';
81 81
 					}
82 82
 					// Setup our link and content.
83
-					switch ( $link_setting ) {
83
+					switch ($link_setting) {
84 84
 						case 'single':
85
-							$link_html  = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">';
85
+							$link_html  = '<a href="' . get_permalink($group['connected_exercises']) . '">';
86 86
 							$link_close = '</a>';
87 87
 							break;
88 88
 
89 89
 						case 'modal':
90
-							if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) {
90
+							if (('' !== $alt_title) || ('' !== $alt_description) || ('' !== $alt_image)) {
91 91
 								$link_html  = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">';
92 92
 								$link_close = '</a>';
93 93
 								// We call the button to register the alt modal, but we do not output it.
94
-								lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image );
94
+								lsx_health_plan_workout_exercise_alt_button($group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image);
95 95
 							} else {
96 96
 								$link_html  = '<a data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">';
97 97
 								$link_close = '</a>';
98 98
 								// We call the button to register the modal, but we do not output it.
99
-								lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args );
99
+								lsx_health_plan_workout_exercise_button($group['connected_exercises'], $group, false, $modal_args);
100 100
 							}
101 101
 
102 102
 							break;
@@ -108,57 +108,57 @@  discard block
 block discarded – undo
108 108
 							break;
109 109
 					}
110 110
 					?>
111
-					<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr( $column_setting ); ?>">
111
+					<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr($column_setting); ?>">
112 112
 						<article class="lsx-slot box-shadow">
113 113
 							<div class="exercise-feature-img">
114
-								<span class="exercise-counter"><?php echo esc_html( $counter ); ?>.</span>
115
-								<?php echo wp_kses_post( $link_html ); ?>
114
+								<span class="exercise-counter"><?php echo esc_html($counter); ?>.</span>
115
+								<?php echo wp_kses_post($link_html); ?>
116 116
 									<?php
117 117
 									$thumbnail_args = array(
118 118
 										'class' => 'aligncenter',
119 119
 									);
120
-									$featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args );
121
-									if ( $alt_image ) {
120
+									$featured_image = get_the_post_thumbnail($group['connected_exercises'], 'medium', $thumbnail_args);
121
+									if ($alt_image) {
122 122
 										$featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">';
123 123
 									}
124
-									if ( ! empty( $featured_image ) && '' !== $featured_image ) {
125
-										echo wp_kses_post( $featured_image );
124
+									if ( ! empty($featured_image) && '' !== $featured_image) {
125
+										echo wp_kses_post($featured_image);
126 126
 									} else {
127 127
 										?>
128
-										<img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' ); ?>">
128
+										<img loading="lazy" src="<?php echo esc_attr(plugin_dir_url(__DIR__) . '../assets/images/placeholder.jpg'); ?>">
129 129
 										<?php
130 130
 									}
131 131
 									?>
132
-								<?php echo wp_kses_post( $link_close ); ?>
132
+								<?php echo wp_kses_post($link_close); ?>
133 133
 							</div>
134 134
 							<div class="content-box exercise-content-box white-bg">
135
-								<h3 class="content-box-title <?php echo esc_html( $class_excerpt ); ?>">
136
-									<?php echo wp_kses_post( $link_html ); ?>
135
+								<h3 class="content-box-title <?php echo esc_html($class_excerpt); ?>">
136
+									<?php echo wp_kses_post($link_html); ?>
137 137
 											<?php
138
-											$exercise_title = lsx_health_plan_exercise_title( '', '', false, $group['connected_exercises'] );
139
-											if ( '' !== $alt_title ) {
138
+											$exercise_title = lsx_health_plan_exercise_title('', '', false, $group['connected_exercises']);
139
+											if ('' !== $alt_title) {
140 140
 												$exercise_title = $alt_title;
141 141
 											}
142
-											echo wp_kses_post( $exercise_title );
142
+											echo wp_kses_post($exercise_title);
143 143
 											?>
144 144
 										</a>
145
-									<?php echo wp_kses_post( $link_close ); ?>
145
+									<?php echo wp_kses_post($link_close); ?>
146 146
 								</h3>
147 147
 								<?php
148
-								if ( '' !== $content_setting ) {
148
+								if ('' !== $content_setting) {
149 149
 									?>
150 150
 									<p class="lsx-exercises-excerpt">
151 151
 										<?php
152
-										if ( 'excerpt' === $content_setting ) {
153
-											$excerpt = \lsx_health_plan\functions\hp_excerpt( $group['connected_exercises'] );
152
+										if ('excerpt' === $content_setting) {
153
+											$excerpt = \lsx_health_plan\functions\hp_excerpt($group['connected_exercises']);
154 154
 
155
-											if ( '' !== $alt_description ) {
155
+											if ('' !== $alt_description) {
156 156
 												$excerpt = $alt_description;
157 157
 											}
158
-											echo wp_kses_post( $excerpt );
158
+											echo wp_kses_post($excerpt);
159 159
 										}
160
-										if ( 'full' === $content_setting ) {
161
-											echo wp_kses_post( get_the_content( null, null, $group['connected_exercises'] ) );
160
+										if ('full' === $content_setting) {
161
+											echo wp_kses_post(get_the_content(null, null, $group['connected_exercises']));
162 162
 										}
163 163
 										?>
164 164
 									</p>
@@ -167,28 +167,28 @@  discard block
 block discarded – undo
167 167
 								?>
168 168
 								<?php
169 169
 								$repsclass = '';
170
-								if ( '' !== $reps ) {
170
+								if ('' !== $reps) {
171 171
 									$repsclass = 'have-reps';
172 172
 								}
173 173
 								?>
174
-								<div class="reps-container <?php echo esc_html( $repsclass ); ?>">
174
+								<div class="reps-container <?php echo esc_html($repsclass); ?>">
175 175
 									<?php
176
-									if ( '' !== $reps ) {
176
+									if ('' !== $reps) {
177 177
 									?>
178
-										<?php echo wp_kses_post( $reps ); ?>
178
+										<?php echo wp_kses_post($reps); ?>
179 179
 									<?php
180 180
 									}
181 181
 									?>
182
-									<?php if ( ( '' !== $link_html ) && ( $connected_exercise ) ) { ?>
183
-										<?php echo wp_kses_post( str_replace( '<a', '<a class="btn-simple" ', $link_html ) ); ?>
184
-										<?php echo wp_kses_post( $link_close ); ?>
182
+									<?php if (('' !== $link_html) && ($connected_exercise)) { ?>
183
+										<?php echo wp_kses_post(str_replace('<a', '<a class="btn-simple" ', $link_html)); ?>
184
+										<?php echo wp_kses_post($link_close); ?>
185 185
 									<?php } ?>
186 186
 								</div>
187 187
 							</div>
188 188
 						</article>
189 189
 					</div>
190 190
 					<?php
191
-					$counter ++;
191
+					$counter++;
192 192
 				}
193 193
 			}
194 194
 			?>
Please login to merge, or discard this patch.
templates/partials/shortcode-loop.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -23,26 +23,26 @@  discard block
 block discarded – undo
23 23
 );
24 24
 
25 25
 // If we are calling the exercises with the parent workout.
26
-if ( false !== 'parent' && 'exercise' === $args['post_type'] ) {
27
-	$items = \lsx_health_plan\functions\get_exercises_by_workout( $args['parent'] );
28
-	if ( ! empty( $items ) ) {
26
+if (false !== 'parent' && 'exercise' === $args['post_type']) {
27
+	$items = \lsx_health_plan\functions\get_exercises_by_workout($args['parent']);
28
+	if ( ! empty($items)) {
29 29
 		$args['include'] = $items;
30 30
 	}
31 31
 }
32 32
 
33
-if ( isset( $args['include'] ) && ( '' !== $args['include'] ) ) {
34
-	if ( is_array( $args['include'] ) ) {
33
+if (isset($args['include']) && ('' !== $args['include'])) {
34
+	if (is_array($args['include'])) {
35 35
 		$include = $args['include'];
36 36
 	} else {
37
-		$include = explode( ',', $args['include'] );
37
+		$include = explode(',', $args['include']);
38 38
 	}
39 39
 	$include_filter          = $include;
40 40
 	$query_array['post__in'] = $include_filter;
41 41
 	$query_array['orderby']  = 'post__in';
42 42
 }
43 43
 
44
-if ( isset( $taxonomy ) && ( '' !== $taxonomy ) && isset( $term ) && ( '' !== $term ) ) {
45
-	$taxonomy_filter          = array(
44
+if (isset($taxonomy) && ('' !== $taxonomy) && isset($term) && ('' !== $term)) {
45
+	$taxonomy_filter = array(
46 46
 		array(
47 47
 			'taxonomy' => $taxonomy,
48 48
 			'field'    => 'slug',
@@ -52,16 +52,16 @@  discard block
 block discarded – undo
52 52
 	$query_array['tax_query'] = $taxonomy_filter;
53 53
 }
54 54
 
55
-$exercises = new WP_Query( $query_array );
55
+$exercises = new WP_Query($query_array);
56 56
 ?>
57 57
 
58
-<div id="lsx-exercises-shortcode" class="daily-plan-block layout-<?php echo esc_html( $args['layout'] ); ?> columns-<?php echo esc_html( $args['columns'] ); ?> shortcode-type-<?php echo esc_html( $args['post_type'] ); ?>">
58
+<div id="lsx-exercises-shortcode" class="daily-plan-block layout-<?php echo esc_html($args['layout']); ?> columns-<?php echo esc_html($args['columns']); ?> shortcode-type-<?php echo esc_html($args['post_type']); ?>">
59 59
 	<div class="lsx-exercises-shortcode" >
60 60
 		<?php
61
-		if ( $exercises->have_posts() ) {
62
-			while ( $exercises->have_posts() ) {
61
+		if ($exercises->have_posts()) {
62
+			while ($exercises->have_posts()) {
63 63
 				$exercises->the_post();
64
-				switch ( $args['post_type'] ) {
64
+				switch ($args['post_type']) {
65 65
 					case 'workout':
66 66
 						include LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php';
67 67
 						break;
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 		?>
91 91
 	</div>
92 92
 	<?php
93
-	if ( isset( $args['view_more'] ) && false !== $args['view_more'] ) {
93
+	if (isset($args['view_more']) && false !== $args['view_more']) {
94 94
 		?>
95 95
 			<div class="col-md-12">
96
-				<a class="<?php echo esc_html( $link_class ); ?>" href="<?php echo esc_url( get_post_type_archive_link( $args['post_type'] ) ); ?>"><?php echo esc_html_e( 'Show More', 'lsx-health-plan' ); ?></a>
96
+				<a class="<?php echo esc_html($link_class); ?>" href="<?php echo esc_url(get_post_type_archive_link($args['post_type'])); ?>"><?php echo esc_html_e('Show More', 'lsx-health-plan'); ?></a>
97 97
 			</div>
98 98
 		<?php
99 99
 	}
Please login to merge, or discard this patch.
templates/table-recipe-data.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@  discard block
 block discarded – undo
1 1
 <?php
2
-$prep_time     = get_post_meta( get_the_ID(), 'recipe_prep_time', true );
3
-$cooking_time  = get_post_meta( get_the_ID(), 'recipe_cooking_time', true );
4
-$serves        = get_post_meta( get_the_ID(), 'recipe_serves', true );
5
-$portion       = get_post_meta( get_the_ID(), 'recipe_portion', true );
6
-$energy        = get_post_meta( get_the_ID(), 'recipe_energy', true );
7
-$protein       = get_post_meta( get_the_ID(), 'recipe_protein', true );
8
-$carbohydrates = get_post_meta( get_the_ID(), 'recipe_carbohydrates', true );
9
-$fibre         = get_post_meta( get_the_ID(), 'recipe_fibre', true );
10
-$fat           = get_post_meta( get_the_ID(), 'recipe_fat', true );
2
+$prep_time     = get_post_meta(get_the_ID(), 'recipe_prep_time', true);
3
+$cooking_time  = get_post_meta(get_the_ID(), 'recipe_cooking_time', true);
4
+$serves        = get_post_meta(get_the_ID(), 'recipe_serves', true);
5
+$portion       = get_post_meta(get_the_ID(), 'recipe_portion', true);
6
+$energy        = get_post_meta(get_the_ID(), 'recipe_energy', true);
7
+$protein       = get_post_meta(get_the_ID(), 'recipe_protein', true);
8
+$carbohydrates = get_post_meta(get_the_ID(), 'recipe_carbohydrates', true);
9
+$fibre         = get_post_meta(get_the_ID(), 'recipe_fibre', true);
10
+$fat           = get_post_meta(get_the_ID(), 'recipe_fat', true);
11 11
 ?>
12
-<?php if ( ( ! empty( $prep_time ) ) || ( ! empty( $cooking_time ) ) || ( ! empty( $serves ) ) || ( ! empty( $portion ) ) ) { ?>
12
+<?php if (( ! empty($prep_time)) || ( ! empty($cooking_time)) || ( ! empty($serves)) || ( ! empty($portion))) { ?>
13 13
 <table class="recipe-table cooking-info-table">
14
-	<?php if ( is_single() && is_singular( 'recipe' ) ) { ?>
14
+	<?php if (is_single() && is_singular('recipe')) { ?>
15 15
 		<thead>
16 16
 			<tr>
17 17
 				<th>Cooking Info</th>
@@ -20,29 +20,29 @@  discard block
 block discarded – undo
20 20
 	<?php } ?>
21 21
 	<tbody>
22 22
 		<?php
23
-		if ( 1 >= (int) $serves ) {
23
+		if (1 >= (int) $serves) {
24 24
 			$serves       = '1';
25
-			$serves_label = __( 'Person', 'lsx-health-plan' );
25
+			$serves_label = __('Person', 'lsx-health-plan');
26 26
 		} else {
27
-			$serves_label = __( 'People', 'lsx-health-plan' );
27
+			$serves_label = __('People', 'lsx-health-plan');
28 28
 		}
29 29
 		?>
30 30
 		<tr class="serves">
31
-			<td><?php esc_html_e( 'Serves:', 'lsx-health-plan' ); ?>&nbsp;</td>
31
+			<td><?php esc_html_e('Serves:', 'lsx-health-plan'); ?>&nbsp;</td>
32 32
 			<td>
33 33
 			<?php
34
-				echo wp_kses_post( $serves ) . ' ' . esc_html( $serves_label );
34
+				echo wp_kses_post($serves) . ' ' . esc_html($serves_label);
35 35
 			?>
36 36
 			</td>
37 37
 		</tr>
38 38
 		<?php
39
-		if ( ! empty( $prep_time ) ) {
39
+		if ( ! empty($prep_time)) {
40 40
 		?>
41 41
 		<tr class="prep-time">
42
-		<td><?php esc_html_e( 'Prep time: ', 'lsx-health-plan' ); ?>&nbsp;</td>
42
+		<td><?php esc_html_e('Prep time: ', 'lsx-health-plan'); ?>&nbsp;</td>
43 43
 			<td>
44 44
 			<?php
45
-				echo wp_kses_post( $prep_time );
45
+				echo wp_kses_post($prep_time);
46 46
 			?>
47 47
 			</td>
48 48
 		</tr>
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 		}
51 51
 		?>
52 52
 		<?php
53
-		if ( ! empty( $cooking_time ) ) {
53
+		if ( ! empty($cooking_time)) {
54 54
 		?>
55 55
 		<tr class="cooking-time">
56
-			<td><?php esc_html_e( 'Cooking time: ', 'lsx-health-plan' ); ?>&nbsp;</td>
56
+			<td><?php esc_html_e('Cooking time: ', 'lsx-health-plan'); ?>&nbsp;</td>
57 57
 			<td>
58 58
 			<?php
59
-				echo wp_kses_post( $cooking_time );
59
+				echo wp_kses_post($cooking_time);
60 60
 			?>
61 61
 			</td>
62 62
 		</tr>
@@ -64,13 +64,13 @@  discard block
 block discarded – undo
64 64
 		}
65 65
 		?>
66 66
 		<?php
67
-		if ( ! empty( $portion ) ) {
67
+		if ( ! empty($portion)) {
68 68
 		?>
69 69
 		<tr class="portion-size">
70
-			<td><?php esc_html_e( 'Portion size: ', 'lsx-health-plan' ); ?>&nbsp;</td>
70
+			<td><?php esc_html_e('Portion size: ', 'lsx-health-plan'); ?>&nbsp;</td>
71 71
 			<td>
72 72
 			<?php
73
-				echo wp_kses_post( $portion );
73
+				echo wp_kses_post($portion);
74 74
 			?>
75 75
 			</td>
76 76
 		</tr>
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	</tbody>
81 81
 </table>
82 82
 <?php } ?>
83
-<?php if ( is_single() && is_singular( 'recipe' ) && ( ( ! empty( $energy ) ) || ( ! empty( $protein ) ) || ( ! empty( $carbohydrates ) ) || ( ! empty( $fibre ) ) || ( ! empty( $fat ) ) ) ) { ?>
83
+<?php if (is_single() && is_singular('recipe') && (( ! empty($energy)) || ( ! empty($protein)) || ( ! empty($carbohydrates)) || ( ! empty($fibre)) || ( ! empty($fat)))) { ?>
84 84
 	<table class="recipe-table nutritional-info-table">
85 85
 		<thead>
86 86
 			<tr>
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 		</thead>
90 90
 		<tbody>
91 91
 			<?php
92
-			if ( ! empty( $energy ) ) {
92
+			if ( ! empty($energy)) {
93 93
 			?>
94 94
 			<tr class="energy">
95
-			<td><?php esc_html_e( 'Energy: ', 'lsx-health-plan' ); ?>&nbsp;</td>
95
+			<td><?php esc_html_e('Energy: ', 'lsx-health-plan'); ?>&nbsp;</td>
96 96
 				<td>
97 97
 				<?php
98
-					echo wp_kses_post( $energy );
98
+					echo wp_kses_post($energy);
99 99
 				?>
100 100
 				</td>
101 101
 			</tr>
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 			}
104 104
 			?>
105 105
 			<?php
106
-			if ( ! empty( $protein ) ) {
106
+			if ( ! empty($protein)) {
107 107
 			?>
108 108
 			<tr class="protein">
109
-			<td><?php esc_html_e( 'Protein: ', 'lsx-health-plan' ); ?>&nbsp;</td>
109
+			<td><?php esc_html_e('Protein: ', 'lsx-health-plan'); ?>&nbsp;</td>
110 110
 				<td>
111 111
 				<?php
112
-					echo wp_kses_post( $protein );
112
+					echo wp_kses_post($protein);
113 113
 				?>
114 114
 				</td>
115 115
 			</tr>
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
 			}
118 118
 			?>
119 119
 			<?php
120
-			if ( ! empty( $carbohydrates ) ) {
120
+			if ( ! empty($carbohydrates)) {
121 121
 			?>
122 122
 			<tr class="carbohydrates">
123
-			<td><?php esc_html_e( 'Carbohydrates: ', 'lsx-health-plan' ); ?>&nbsp;</td>
123
+			<td><?php esc_html_e('Carbohydrates: ', 'lsx-health-plan'); ?>&nbsp;</td>
124 124
 				<td>
125 125
 				<?php
126
-					echo wp_kses_post( $carbohydrates );
126
+					echo wp_kses_post($carbohydrates);
127 127
 				?>
128 128
 				</td>
129 129
 			</tr>
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 			}
132 132
 			?>
133 133
 			<?php
134
-			if ( ! empty( $fibre ) ) {
134
+			if ( ! empty($fibre)) {
135 135
 			?>
136 136
 			<tr class="fibre">
137
-			<td><?php esc_html_e( 'Fibre: ', 'lsx-health-plan' ); ?>&nbsp;</td>
137
+			<td><?php esc_html_e('Fibre: ', 'lsx-health-plan'); ?>&nbsp;</td>
138 138
 				<td>
139 139
 				<?php
140
-					echo wp_kses_post( $fibre );
140
+					echo wp_kses_post($fibre);
141 141
 				?>
142 142
 				</td>
143 143
 			</tr>
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 			}
146 146
 			?>
147 147
 			<?php
148
-			if ( ! empty( $fat ) ) {
148
+			if ( ! empty($fat)) {
149 149
 			?>
150 150
 			<tr class="fat">
151
-			<td><?php esc_html_e( 'Fat: ', 'lsx-health-plan' ); ?>&nbsp;</td>
151
+			<td><?php esc_html_e('Fat: ', 'lsx-health-plan'); ?>&nbsp;</td>
152 152
 				<td>
153 153
 				<?php
154
-					echo wp_kses_post( $fat );
154
+					echo wp_kses_post($fat);
155 155
 				?>
156 156
 				</td>
157 157
 			</tr>
Please login to merge, or discard this patch.