Passed
Push — add/multiplan ( 44137b...c28099 )
by Virginia
05:31
created
templates/partials/workout-grid.php 1 patch
Spacing   +61 added lines, -61 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,59 +108,59 @@  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
-								<?php echo wp_kses_post( $link_html ); ?>
114
+								<?php echo wp_kses_post($link_html); ?>
115 115
 									<?php
116 116
 									$thumbnail_args = array(
117 117
 										'class' => 'aligncenter',
118 118
 									);
119
-									$featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args );
120
-									if ( $alt_image ) {
119
+									$featured_image = get_the_post_thumbnail($group['connected_exercises'], 'medium', $thumbnail_args);
120
+									if ($alt_image) {
121 121
 										$featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">';
122 122
 									}
123
-									if ( ! empty( $featured_image ) && '' !== $featured_image ) {
124
-										echo wp_kses_post( $featured_image );
123
+									if ( ! empty($featured_image) && '' !== $featured_image) {
124
+										echo wp_kses_post($featured_image);
125 125
 									} else {
126 126
 										?>
127
-										<img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' ); ?>">
127
+										<img loading="lazy" src="<?php echo esc_attr(plugin_dir_url(__DIR__) . '../assets/images/placeholder.jpg'); ?>">
128 128
 										<?php
129 129
 									}
130 130
 									?>
131
-								<?php echo wp_kses_post( $link_close ); ?>
131
+								<?php echo wp_kses_post($link_close); ?>
132 132
 							</div>
133 133
 							<div class="content-box exercise-content-box white-bg">
134
-								<h3 class="content-box-title <?php echo esc_html( $class_excerpt ); ?>">
135
-									<?php echo wp_kses_post( $link_html ); ?>
134
+								<h3 class="content-box-title <?php echo esc_html($class_excerpt); ?>">
135
+									<?php echo wp_kses_post($link_html); ?>
136 136
 											<?php
137
-											$exercise_title = lsx_health_plan_exercise_title( '', '', false, $group['connected_exercises'] );
137
+											$exercise_title = lsx_health_plan_exercise_title('', '', false, $group['connected_exercises']);
138 138
 											
139
-											if ( '' !== $alt_title ) {
139
+											if ('' !== $alt_title) {
140 140
 												$exercise_title = '<span class="exercise-counter">' . $counter . '.</span>' . $alt_title;
141 141
 											} else {
142 142
 												$exercise_title = '<span class="exercise-counter">' . $counter . '.</span>' . $exercise_title;
143 143
 											}
144
-											echo wp_kses_post( $exercise_title );
144
+											echo wp_kses_post($exercise_title);
145 145
 											?>
146 146
 										</a>
147
-									<?php echo wp_kses_post( $link_close ); ?>
147
+									<?php echo wp_kses_post($link_close); ?>
148 148
 								</h3>
149 149
 								<?php
150
-								if ( '' !== $content_setting ) {
150
+								if ('' !== $content_setting) {
151 151
 									?>
152 152
 									<p class="lsx-exercises-excerpt">
153 153
 										<?php
154
-										if ( 'excerpt' === $content_setting ) {
155
-											$excerpt = \lsx_health_plan\functions\hp_excerpt( $group['connected_exercises'] );
154
+										if ('excerpt' === $content_setting) {
155
+											$excerpt = \lsx_health_plan\functions\hp_excerpt($group['connected_exercises']);
156 156
 
157
-											if ( '' !== $alt_description ) {
157
+											if ('' !== $alt_description) {
158 158
 												$excerpt = $alt_description;
159 159
 											}
160
-											echo wp_kses_post( $excerpt );
160
+											echo wp_kses_post($excerpt);
161 161
 										}
162
-										if ( 'full' === $content_setting ) {
163
-											echo wp_kses_post( get_the_content( null, null, $group['connected_exercises'] ) );
162
+										if ('full' === $content_setting) {
163
+											echo wp_kses_post(get_the_content(null, null, $group['connected_exercises']));
164 164
 										}
165 165
 										?>
166 166
 									</p>
@@ -169,28 +169,28 @@  discard block
 block discarded – undo
169 169
 								?>
170 170
 								<?php
171 171
 								$repsclass = '';
172
-								if ( '' !== $reps ) {
172
+								if ('' !== $reps) {
173 173
 									$repsclass = 'have-reps';
174 174
 								}
175 175
 								?>
176
-								<div class="reps-container <?php echo esc_html( $repsclass ); ?>">
176
+								<div class="reps-container <?php echo esc_html($repsclass); ?>">
177 177
 									<?php
178
-									if ( '' !== $reps ) {
178
+									if ('' !== $reps) {
179 179
 									?>
180
-										<?php echo wp_kses_post( $reps ); ?>
180
+										<?php echo wp_kses_post($reps); ?>
181 181
 									<?php
182 182
 									}
183 183
 									?>
184
-									<?php if ( ( '' !== $link_html ) && ( $connected_exercise ) ) { ?>
185
-										<?php echo wp_kses_post( str_replace( '<a', '<a class="btn-simple" ', $link_html ) ); ?>
186
-										<?php echo wp_kses_post( $link_close ); ?>
184
+									<?php if (('' !== $link_html) && ($connected_exercise)) { ?>
185
+										<?php echo wp_kses_post(str_replace('<a', '<a class="btn-simple" ', $link_html)); ?>
186
+										<?php echo wp_kses_post($link_close); ?>
187 187
 									<?php } ?>
188 188
 								</div>
189 189
 							</div>
190 190
 						</article>
191 191
 					</div>
192 192
 					<?php
193
-					$counter ++;
193
+					$counter++;
194 194
 				}
195 195
 			}
196 196
 			?>
Please login to merge, or discard this patch.