|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* LSX Health Plan Template Tags. |
|
4
|
|
|
* |
|
5
|
|
|
* @package lsx-health-plan |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Outputs the exercise type. |
|
10
|
|
|
* |
|
11
|
|
|
* @return exercise_type |
|
|
|
|
|
|
12
|
|
|
*/ |
|
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 ) ) { |
|
|
|
|
|
|
16
|
|
|
return $term_obj_list; |
|
17
|
|
|
} |
|
18
|
|
|
} |
|
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Outputs the exercise Muscle Groups. |
|
22
|
|
|
* |
|
23
|
|
|
* @return muscle_group_equipment |
|
|
|
|
|
|
24
|
|
|
*/ |
|
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 ) ) { |
|
|
|
|
|
|
28
|
|
|
return $term_obj_list; |
|
29
|
|
|
} |
|
30
|
|
|
} |
|
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Outputs the exercise equipment. |
|
34
|
|
|
* |
|
35
|
|
|
* @return exercise_equipment |
|
|
|
|
|
|
36
|
|
|
*/ |
|
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 ) ) { |
|
|
|
|
|
|
40
|
|
|
return $term_obj_list; |
|
41
|
|
|
} |
|
42
|
|
|
} |
|
|
|
|
|
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Outputs the exercise info on a table. |
|
46
|
|
|
* |
|
47
|
|
|
* @return void |
|
48
|
|
|
*/ |
|
49
|
|
|
function lsx_health_plan_exercise_data() { |
|
50
|
|
|
include LSX_HEALTH_PLAN_PATH . '/templates/table-exercise-data.php'; |
|
51
|
|
|
} |
|
|
|
|
|
|
52
|
|
|
|
|
53
|
|
|
function lsx_health_plan_workout_exercise_alt_button( $m, $group, $echo = true, $args = array(), $alt_title, $alt_description, $alt_image ) { |
|
|
|
|
|
|
54
|
|
|
$defaults = array( |
|
55
|
|
|
'modal_trigger' => 'button', |
|
56
|
|
|
'modal_content' => 'excerpt', |
|
57
|
|
|
); |
|
58
|
|
|
$args = wp_parse_args( $args, $defaults ); |
|
59
|
|
|
|
|
60
|
|
|
$exercise_id = ''; |
|
61
|
|
|
if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
|
|
|
|
|
62
|
|
|
$exercise_id = esc_html( $group['connected_exercises'] ); |
|
63
|
|
|
$content = get_post_field( 'post_content', $exercise_id ); |
|
|
|
|
|
|
64
|
|
|
$url = get_permalink( $exercise_id ); |
|
|
|
|
|
|
65
|
|
|
$equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' ); |
|
|
|
|
|
|
66
|
|
|
$muscle_group = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' ); |
|
67
|
|
|
$lsx_hp = lsx_health_plan(); |
|
68
|
|
|
|
|
69
|
|
|
if ( 'excerpt' === $args['modal_content'] ) { |
|
|
|
|
|
|
70
|
|
|
$content = wp_trim_words( $content, 40 ); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
if ( 'link' ) { |
|
|
|
|
|
|
74
|
|
|
$play_button = '<a data-toggle="modal" href="#workout-alt-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
|
|
|
|
|
75
|
|
|
} else { |
|
76
|
|
|
$play_button = '<button data-toggle="alt-modal" data-target="#workout-alt-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
$modal_body = ''; |
|
|
|
|
|
|
80
|
|
|
|
|
81
|
|
|
if ( '' !== $alt_image && ! empty( $alt_image ) ) { |
|
|
|
|
|
|
82
|
|
|
$modal_body .= '<div class="modal-image"/><img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '"></div>'; |
|
83
|
|
|
} else { |
|
84
|
|
|
if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
|
|
|
|
|
85
|
|
|
$gallery_args = array( |
|
86
|
|
|
'css_class' => 'modal-slider', |
|
87
|
|
|
); |
|
88
|
|
|
$modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
|
|
|
|
|
89
|
|
|
} else { |
|
90
|
|
|
$modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
|
|
|
|
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
if ( '' !== $alt_title ) { |
|
|
|
|
|
|
95
|
|
|
$modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $alt_title . '</h5>'; |
|
96
|
|
|
} else { |
|
97
|
|
|
$modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
if ( ! empty( $equipment_group ) ) { |
|
|
|
|
|
|
101
|
|
|
$modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
|
|
|
|
|
102
|
|
|
} |
|
|
|
|
|
|
103
|
|
|
if ( ! empty( $muscle_group ) ) { |
|
|
|
|
|
|
104
|
|
|
$modal_body .= '<span class="muscle-terms">Muscle: ' . $muscle_group . '</span>'; |
|
|
|
|
|
|
105
|
|
|
} |
|
|
|
|
|
|
106
|
|
|
$modal_body .= '</div>'; |
|
107
|
|
|
if ( '' !== $args['modal_content'] ) { |
|
|
|
|
|
|
108
|
|
|
if ( '' !== $alt_description ) { |
|
|
|
|
|
|
109
|
|
|
$modal_body .= '<div class="modal-excerpt"/>' . $alt_description . '</div>'; |
|
110
|
|
|
} else { |
|
111
|
|
|
$modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
|
112
|
|
|
} |
|
113
|
|
|
} |
|
|
|
|
|
|
114
|
|
|
if ( 'excerpt' === $args['modal_content'] ) { |
|
|
|
|
|
|
115
|
|
|
$modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>'; |
|
|
|
|
|
|
116
|
|
|
} |
|
|
|
|
|
|
117
|
|
|
\lsx_health_plan\functions\register_modal( 'workout-alt-exercise-modal-' . $m, '', $modal_body ); |
|
118
|
|
|
|
|
119
|
|
|
if ( true === $echo ) { |
|
|
|
|
|
|
120
|
|
|
echo wp_kses_post( $play_button ); |
|
121
|
|
|
} else { |
|
122
|
|
|
return $play_button; |
|
123
|
|
|
} |
|
124
|
|
|
} |
|
125
|
|
|
} |
|
|
|
|
|
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* A function to call the play button |
|
129
|
|
|
* |
|
130
|
|
|
* @param string $m A unique ID for the modal. |
|
131
|
|
|
* @param array $group The current workout set being looped through. |
|
132
|
|
|
* @param boolean $echo |
|
|
|
|
|
|
133
|
|
|
* @param array $args |
|
|
|
|
|
|
134
|
|
|
* @return void |
|
|
|
|
|
|
135
|
|
|
*/ |
|
136
|
|
|
function lsx_health_plan_workout_exercise_button( $m, $group, $echo = true, $args = array() ) { |
|
137
|
|
|
$defaults = array( |
|
138
|
|
|
'modal_trigger' => 'button', |
|
139
|
|
|
'modal_content' => 'excerpt', |
|
140
|
|
|
); |
|
141
|
|
|
$args = wp_parse_args( $args, $defaults ); |
|
142
|
|
|
|
|
143
|
|
|
$exercise_id = ''; |
|
144
|
|
|
if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
|
|
|
|
|
145
|
|
|
$exercise_id = esc_html( $group['connected_exercises'] ); |
|
146
|
|
|
$content = get_post_field( 'post_content', $exercise_id ); |
|
|
|
|
|
|
147
|
|
|
$url = get_permalink( $exercise_id ); |
|
|
|
|
|
|
148
|
|
|
$equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' ); |
|
|
|
|
|
|
149
|
|
|
$muscle_group = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' ); |
|
150
|
|
|
$lsx_hp = lsx_health_plan(); |
|
151
|
|
|
|
|
152
|
|
|
if ( 'excerpt' === $args['modal_content'] ) { |
|
|
|
|
|
|
153
|
|
|
$content = wp_trim_words( $content, 40 ); |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
if ( 'link' ) { |
|
|
|
|
|
|
157
|
|
|
$play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
|
|
|
|
|
158
|
|
|
} else { |
|
159
|
|
|
$play_button = '<button data-toggle="modal" data-target="#workout-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
$modal_body = ''; |
|
|
|
|
|
|
163
|
|
|
|
|
164
|
|
|
if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
|
|
|
|
|
165
|
|
|
$gallery_args = array( |
|
166
|
|
|
'css_class' => 'modal-slider', |
|
167
|
|
|
); |
|
168
|
|
|
$modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
|
|
|
|
|
169
|
|
|
} else { |
|
170
|
|
|
$modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
|
|
|
|
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
$modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
174
|
|
|
|
|
175
|
|
|
if ( ! empty( $equipment_group ) ) { |
|
|
|
|
|
|
176
|
|
|
$modal_body .= '<span class="equipment-terms">' . __( 'Equipment', 'lsx-health-plan' ) . ': ' . $equipment_group . '</span>'; |
|
|
|
|
|
|
177
|
|
|
} |
|
|
|
|
|
|
178
|
|
|
if ( ! empty( $muscle_group ) ) { |
|
|
|
|
|
|
179
|
|
|
$modal_body .= '<span class="muscle-terms">' . __( 'Muscle', 'lsx-health-plan' ) . ': ' . $muscle_group . '</span>'; |
|
|
|
|
|
|
180
|
|
|
} |
|
|
|
|
|
|
181
|
|
|
$modal_body .= '</div>'; |
|
182
|
|
|
if ( '' !== $args['modal_content'] ) { |
|
|
|
|
|
|
183
|
|
|
$modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
|
184
|
|
|
} |
|
|
|
|
|
|
185
|
|
|
if ( 'excerpt' === $args['modal_content'] ) { |
|
|
|
|
|
|
186
|
|
|
$modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-health-plan' ) . '</a>'; |
|
|
|
|
|
|
187
|
|
|
} |
|
|
|
|
|
|
188
|
|
|
\lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body ); |
|
189
|
|
|
|
|
190
|
|
|
if ( true === $echo ) { |
|
|
|
|
|
|
191
|
|
|
echo wp_kses_post( $play_button ); |
|
192
|
|
|
} else { |
|
193
|
|
|
return $play_button; |
|
194
|
|
|
} |
|
195
|
|
|
} |
|
196
|
|
|
} |
|
|
|
|
|
|
197
|
|
|
|
|
198
|
|
|
/** |
|
|
|
|
|
|
199
|
|
|
* Outputs the modal button and registers the exercise modal to show. |
|
200
|
|
|
* |
|
201
|
|
|
* @param int $m |
|
|
|
|
|
|
202
|
|
|
* @param array $group |
|
|
|
|
|
|
203
|
|
|
* @return void |
|
|
|
|
|
|
204
|
|
|
*/ |
|
205
|
|
|
function lsx_health_plan_shortcode_exercise_button( $m, $content = true ) { |
|
206
|
|
|
$equipment_group = get_the_term_list( $m, 'equipment', '', ', ' ); |
|
207
|
|
|
$muscle_group = get_the_term_list( $m, 'muscle-group', '', ', ' ); |
|
208
|
|
|
$title = get_the_title(); |
|
209
|
|
|
$lsx_hp = lsx_health_plan(); |
|
210
|
|
|
$button = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>'; |
|
|
|
|
|
|
211
|
|
|
|
|
212
|
|
|
if ( true === $content ) { |
|
|
|
|
|
|
213
|
|
|
$content = get_the_content(); |
|
214
|
|
|
} |
|
215
|
|
|
|
|
216
|
|
|
$modal_body = ''; |
|
217
|
|
|
if ( $lsx_hp->frontend->gallery->has_gallery( $m ) ) { |
|
|
|
|
|
|
218
|
|
|
$gallery_args = array( |
|
219
|
|
|
'css_class' => 'modal-slider', |
|
220
|
|
|
); |
|
221
|
|
|
$modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
|
|
|
|
|
222
|
|
|
} else { |
|
223
|
|
|
$modal_body .= '<div class="modal-image">' . get_the_post_thumbnail( $m, 'large' ) . '</div>'; |
|
224
|
|
|
} |
|
|
|
|
|
|
225
|
|
|
$modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $title . '</h5>'; |
|
226
|
|
|
|
|
227
|
|
|
if ( ! empty( $equipment_group ) ) { |
|
|
|
|
|
|
228
|
|
|
$modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
|
|
|
|
|
229
|
|
|
} |
|
|
|
|
|
|
230
|
|
|
if ( ! empty( $muscle_group ) ) { |
|
|
|
|
|
|
231
|
|
|
$modal_body .= '<span class="muscle-terms">Muscle: ' . $muscle_group . '</span>'; |
|
|
|
|
|
|
232
|
|
|
} |
|
|
|
|
|
|
233
|
|
|
$modal_body .= '</div>'; |
|
234
|
|
|
$modal_body .= $content; |
|
235
|
|
|
\lsx_health_plan\functions\register_modal( 'exercise-modal-' . $m, '', $modal_body ); |
|
236
|
|
|
|
|
237
|
|
|
return ( $button ); |
|
238
|
|
|
} |
|
|
|
|
|
|
239
|
|
|
|
|
240
|
|
|
/** |
|
|
|
|
|
|
241
|
|
|
* Gets the exercise title along with the side its on. |
|
242
|
|
|
* |
|
243
|
|
|
* @param string $before |
|
|
|
|
|
|
244
|
|
|
* @param string $after |
|
|
|
|
|
|
245
|
|
|
* @param boolean $echo |
|
|
|
|
|
|
246
|
|
|
* @return string |
|
247
|
|
|
*/ |
|
248
|
|
|
function lsx_health_plan_exercise_title( $before = '', $after = '', $url = true, $echo = true, $exercise_id = false ) { |
|
249
|
|
|
if ( false === $exercise_id ) { |
|
|
|
|
|
|
250
|
|
|
$exercise_id = get_the_ID(); |
|
251
|
|
|
} |
|
|
|
|
|
|
252
|
|
|
$link = get_the_permalink( $exercise_id ); |
|
253
|
|
|
$title = get_the_title( $exercise_id ); |
|
254
|
|
|
$side = get_post_meta( $exercise_id, 'exercise_side', true ); |
|
255
|
|
|
if ( '' !== $side ) { |
|
|
|
|
|
|
256
|
|
|
$title .= ' - ' . ucwords( $side ); |
|
|
|
|
|
|
257
|
|
|
} |
|
|
|
|
|
|
258
|
|
|
$link_before = ''; |
|
259
|
|
|
$link_after = ''; |
|
260
|
|
|
if ( true === $url ) { |
|
|
|
|
|
|
261
|
|
|
$link_before = '<a href="' . $link . '">'; |
|
|
|
|
|
|
262
|
|
|
$link_after = '</a>'; |
|
263
|
|
|
} |
|
|
|
|
|
|
264
|
|
|
$title = apply_filters( 'lsx_health_plan_exercise_title', $before . $link_before . $title . $link_after . $after, $title, $before, $after, $exercise_id ); |
|
|
|
|
|
|
265
|
|
|
if ( true === $echo ) { |
|
|
|
|
|
|
266
|
|
|
echo wp_kses_post( $title ); |
|
267
|
|
|
} else { |
|
268
|
|
|
return $title; |
|
269
|
|
|
} |
|
270
|
|
|
} |
|
|
|
|
|
|
271
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths