@@ -11,10 +11,10 @@ discard block |
||
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 ) ) { |
|
16 | - return $term_obj_list; |
|
17 | - } |
|
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 | 18 | } |
19 | 19 | |
20 | 20 | /** |
@@ -23,10 +23,10 @@ discard block |
||
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 ) ) { |
|
28 | - return $term_obj_list; |
|
29 | - } |
|
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 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -35,10 +35,10 @@ discard block |
||
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 ) ) { |
|
40 | - return $term_obj_list; |
|
41 | - } |
|
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 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -47,81 +47,81 @@ discard block |
||
47 | 47 | * @return void |
48 | 48 | */ |
49 | 49 | function lsx_health_plan_exercise_data() { |
50 | - include LSX_HEALTH_PLAN_PATH . '/templates/table-exercise-data.php'; |
|
50 | + include LSX_HEALTH_PLAN_PATH . '/templates/table-exercise-data.php'; |
|
51 | 51 | } |
52 | 52 | |
53 | 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 ); |
|
54 | + $defaults = array( |
|
55 | + 'modal_trigger' => 'button', |
|
56 | + 'modal_content' => 'excerpt', |
|
57 | + ); |
|
58 | + $args = wp_parse_args( $args, $defaults ); |
|
59 | 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(); |
|
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 | 68 | |
69 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
70 | - $content = wp_trim_words( $content, 40 ); |
|
71 | - } |
|
69 | + if ( 'excerpt' === $args['modal_content'] ) { |
|
70 | + $content = wp_trim_words( $content, 40 ); |
|
71 | + } |
|
72 | 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 | - } |
|
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 | 78 | |
79 | - $modal_body = ''; |
|
79 | + $modal_body = ''; |
|
80 | 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 | - } |
|
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 | 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 | - } |
|
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 | 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 Group: ' . $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 ); |
|
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 Group: ' . $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 | 118 | |
119 | - if ( true === $echo ) { |
|
120 | - echo wp_kses_post( $play_button ); |
|
121 | - } else { |
|
122 | - return $play_button; |
|
123 | - } |
|
124 | - } |
|
119 | + if ( true === $echo ) { |
|
120 | + echo wp_kses_post( $play_button ); |
|
121 | + } else { |
|
122 | + return $play_button; |
|
123 | + } |
|
124 | + } |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -134,65 +134,65 @@ discard block |
||
134 | 134 | * @return void |
135 | 135 | */ |
136 | 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 ); |
|
137 | + $defaults = array( |
|
138 | + 'modal_trigger' => 'button', |
|
139 | + 'modal_content' => 'excerpt', |
|
140 | + ); |
|
141 | + $args = wp_parse_args( $args, $defaults ); |
|
142 | 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(); |
|
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 | 151 | |
152 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
153 | - $content = wp_trim_words( $content, 40 ); |
|
154 | - } |
|
152 | + if ( 'excerpt' === $args['modal_content'] ) { |
|
153 | + $content = wp_trim_words( $content, 40 ); |
|
154 | + } |
|
155 | 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 | - } |
|
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 | 161 | |
162 | - $modal_body = ''; |
|
162 | + $modal_body = ''; |
|
163 | 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 | - } |
|
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 | 172 | |
173 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
173 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
174 | 174 | |
175 | - if ( ! empty( $equipment_group ) ) { |
|
176 | - $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
177 | - } |
|
178 | - if ( ! empty( $muscle_group ) ) { |
|
179 | - $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $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-heal-plan' ) . '</a>'; |
|
187 | - } |
|
188 | - \lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body ); |
|
175 | + if ( ! empty( $equipment_group ) ) { |
|
176 | + $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
177 | + } |
|
178 | + if ( ! empty( $muscle_group ) ) { |
|
179 | + $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $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-heal-plan' ) . '</a>'; |
|
187 | + } |
|
188 | + \lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body ); |
|
189 | 189 | |
190 | - if ( true === $echo ) { |
|
191 | - echo wp_kses_post( $play_button ); |
|
192 | - } else { |
|
193 | - return $play_button; |
|
194 | - } |
|
195 | - } |
|
190 | + if ( true === $echo ) { |
|
191 | + echo wp_kses_post( $play_button ); |
|
192 | + } else { |
|
193 | + return $play_button; |
|
194 | + } |
|
195 | + } |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -203,38 +203,38 @@ discard block |
||
203 | 203 | * @return void |
204 | 204 | */ |
205 | 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>'; |
|
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 | 211 | |
212 | - if ( true === $content ) { |
|
213 | - $content = get_the_content(); |
|
214 | - } |
|
212 | + if ( true === $content ) { |
|
213 | + $content = get_the_content(); |
|
214 | + } |
|
215 | 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>'; |
|
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 | 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 Group: ' . $muscle_group . '</span>'; |
|
232 | - } |
|
233 | - $modal_body .= '</div>'; |
|
234 | - $modal_body .= $content; |
|
235 | - \lsx_health_plan\functions\register_modal( 'exercise-modal-' . $m, '', $modal_body ); |
|
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 Group: ' . $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 | 236 | |
237 | - return ( $button ); |
|
237 | + return ( $button ); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -246,18 +246,18 @@ discard block |
||
246 | 246 | * @return string |
247 | 247 | */ |
248 | 248 | function lsx_health_plan_exercise_title( $before = '', $after = '', $echo = true, $exercise_id = false ) { |
249 | - if ( false === $exercise_id ) { |
|
250 | - $exercise_id = get_the_ID(); |
|
251 | - } |
|
252 | - $title = get_the_title( $exercise_id ); |
|
253 | - $side = get_post_meta( $exercise_id, 'exercise_side', true ); |
|
254 | - if ( '' !== $side ) { |
|
255 | - $title .= ' - ' . ucwords( $side ); |
|
256 | - } |
|
257 | - $title = apply_filters( 'lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id ); |
|
258 | - if ( true === $echo ) { |
|
259 | - echo wp_kses_post( $title ); |
|
260 | - } else { |
|
261 | - return $title; |
|
262 | - } |
|
249 | + if ( false === $exercise_id ) { |
|
250 | + $exercise_id = get_the_ID(); |
|
251 | + } |
|
252 | + $title = get_the_title( $exercise_id ); |
|
253 | + $side = get_post_meta( $exercise_id, 'exercise_side', true ); |
|
254 | + if ( '' !== $side ) { |
|
255 | + $title .= ' - ' . ucwords( $side ); |
|
256 | + } |
|
257 | + $title = apply_filters( 'lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id ); |
|
258 | + if ( true === $echo ) { |
|
259 | + echo wp_kses_post( $title ); |
|
260 | + } else { |
|
261 | + return $title; |
|
262 | + } |
|
263 | 263 | } |
@@ -11,8 +11,8 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -50,74 +50,74 @@ discard block |
||
50 | 50 | include LSX_HEALTH_PLAN_PATH . '/templates/table-exercise-data.php'; |
51 | 51 | } |
52 | 52 | |
53 | -function lsx_health_plan_workout_exercise_alt_button( $m, $group, $echo = true, $args = array(), $alt_title, $alt_description, $alt_image ) { |
|
53 | +function lsx_health_plan_workout_exercise_alt_button($m, $group, $echo = true, $args = array(), $alt_title, $alt_description, $alt_image) { |
|
54 | 54 | $defaults = array( |
55 | 55 | 'modal_trigger' => 'button', |
56 | 56 | 'modal_content' => 'excerpt', |
57 | 57 | ); |
58 | - $args = wp_parse_args( $args, $defaults ); |
|
58 | + $args = wp_parse_args($args, $defaults); |
|
59 | 59 | |
60 | 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', '', ', ' ); |
|
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 | 67 | $lsx_hp = lsx_health_plan(); |
68 | 68 | |
69 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
70 | - $content = wp_trim_words( $content, 40 ); |
|
69 | + if ('excerpt' === $args['modal_content']) { |
|
70 | + $content = wp_trim_words($content, 40); |
|
71 | 71 | } |
72 | 72 | |
73 | - if ( 'link' ) { |
|
74 | - $play_button = '<a data-toggle="modal" href="#workout-alt-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
73 | + if ('link') { |
|
74 | + $play_button = '<a data-toggle="modal" href="#workout-alt-exercise-modal-' . $m . '">' . get_the_title($exercise_id) . '</a>'; |
|
75 | 75 | } else { |
76 | 76 | $play_button = '<button data-toggle="alt-modal" data-target="#workout-alt-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
77 | 77 | } |
78 | 78 | |
79 | - $modal_body = ''; |
|
79 | + $modal_body = ''; |
|
80 | 80 | |
81 | - if ( '' !== $alt_image && ! empty( $alt_image ) ) { |
|
81 | + if ('' !== $alt_image && ! empty($alt_image)) { |
|
82 | 82 | $modal_body .= '<div class="modal-image"/><img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '"></div>'; |
83 | 83 | } else { |
84 | - if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
84 | + if ($lsx_hp->frontend->gallery->has_gallery($exercise_id)) { |
|
85 | 85 | $gallery_args = array( |
86 | 86 | 'css_class' => 'modal-slider', |
87 | 87 | ); |
88 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
88 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery('', '', $gallery_args); |
|
89 | 89 | } else { |
90 | - $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
90 | + $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail($exercise_id, 'large') . '</div>'; |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - if ( '' !== $alt_title ) { |
|
94 | + if ('' !== $alt_title) { |
|
95 | 95 | $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $alt_title . '</h5>'; |
96 | 96 | } else { |
97 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
97 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title($exercise_id) . '</h5>'; |
|
98 | 98 | } |
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'] ) { |
|
108 | - if ( '' !== $alt_description ) { |
|
107 | + if ('' !== $args['modal_content']) { |
|
108 | + if ('' !== $alt_description) { |
|
109 | 109 | $modal_body .= '<div class="modal-excerpt"/>' . $alt_description . '</div>'; |
110 | 110 | } else { |
111 | 111 | $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
112 | 112 | } |
113 | 113 | } |
114 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
115 | - $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>'; |
|
114 | + if ('excerpt' === $args['modal_content']) { |
|
115 | + $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __('Read More', 'lsx-heal-plan') . '</a>'; |
|
116 | 116 | } |
117 | - \lsx_health_plan\functions\register_modal( 'workout-alt-exercise-modal-' . $m, '', $modal_body ); |
|
117 | + \lsx_health_plan\functions\register_modal('workout-alt-exercise-modal-' . $m, '', $modal_body); |
|
118 | 118 | |
119 | - if ( true === $echo ) { |
|
120 | - echo wp_kses_post( $play_button ); |
|
119 | + if (true === $echo) { |
|
120 | + echo wp_kses_post($play_button); |
|
121 | 121 | } else { |
122 | 122 | return $play_button; |
123 | 123 | } |
@@ -133,62 +133,62 @@ discard block |
||
133 | 133 | * @param array $args |
134 | 134 | * @return void |
135 | 135 | */ |
136 | -function lsx_health_plan_workout_exercise_button( $m, $group, $echo = true, $args = array() ) { |
|
136 | +function lsx_health_plan_workout_exercise_button($m, $group, $echo = true, $args = array()) { |
|
137 | 137 | $defaults = array( |
138 | 138 | 'modal_trigger' => 'button', |
139 | 139 | 'modal_content' => 'excerpt', |
140 | 140 | ); |
141 | - $args = wp_parse_args( $args, $defaults ); |
|
141 | + $args = wp_parse_args($args, $defaults); |
|
142 | 142 | |
143 | 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', '', ', ' ); |
|
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 | 150 | $lsx_hp = lsx_health_plan(); |
151 | 151 | |
152 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
153 | - $content = wp_trim_words( $content, 40 ); |
|
152 | + if ('excerpt' === $args['modal_content']) { |
|
153 | + $content = wp_trim_words($content, 40); |
|
154 | 154 | } |
155 | 155 | |
156 | - if ( 'link' ) { |
|
157 | - $play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
156 | + if ('link') { |
|
157 | + $play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title($exercise_id) . '</a>'; |
|
158 | 158 | } else { |
159 | 159 | $play_button = '<button data-toggle="modal" data-target="#workout-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
160 | 160 | } |
161 | 161 | |
162 | - $modal_body = ''; |
|
162 | + $modal_body = ''; |
|
163 | 163 | |
164 | - if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
164 | + if ($lsx_hp->frontend->gallery->has_gallery($exercise_id)) { |
|
165 | 165 | $gallery_args = array( |
166 | 166 | 'css_class' => 'modal-slider', |
167 | 167 | ); |
168 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
168 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery('', '', $gallery_args); |
|
169 | 169 | } else { |
170 | - $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
170 | + $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail($exercise_id, 'large') . '</div>'; |
|
171 | 171 | } |
172 | 172 | |
173 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
173 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title($exercise_id) . '</h5>'; |
|
174 | 174 | |
175 | - if ( ! empty( $equipment_group ) ) { |
|
175 | + if ( ! empty($equipment_group)) { |
|
176 | 176 | $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
177 | 177 | } |
178 | - if ( ! empty( $muscle_group ) ) { |
|
178 | + if ( ! empty($muscle_group)) { |
|
179 | 179 | $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
180 | 180 | } |
181 | 181 | $modal_body .= '</div>'; |
182 | - if ( '' !== $args['modal_content'] ) { |
|
182 | + if ('' !== $args['modal_content']) { |
|
183 | 183 | $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
184 | 184 | } |
185 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
186 | - $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>'; |
|
185 | + if ('excerpt' === $args['modal_content']) { |
|
186 | + $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __('Read More', 'lsx-heal-plan') . '</a>'; |
|
187 | 187 | } |
188 | - \lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body ); |
|
188 | + \lsx_health_plan\functions\register_modal('workout-exercise-modal-' . $m, '', $modal_body); |
|
189 | 189 | |
190 | - if ( true === $echo ) { |
|
191 | - echo wp_kses_post( $play_button ); |
|
190 | + if (true === $echo) { |
|
191 | + echo wp_kses_post($play_button); |
|
192 | 192 | } else { |
193 | 193 | return $play_button; |
194 | 194 | } |
@@ -202,39 +202,39 @@ discard block |
||
202 | 202 | * @param array $group |
203 | 203 | * @return void |
204 | 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', '', ', ' ); |
|
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 | 208 | $title = get_the_title(); |
209 | 209 | $lsx_hp = lsx_health_plan(); |
210 | - $button = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>'; |
|
210 | + $button = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>'; |
|
211 | 211 | |
212 | - if ( true === $content ) { |
|
212 | + if (true === $content) { |
|
213 | 213 | $content = get_the_content(); |
214 | 214 | } |
215 | 215 | |
216 | 216 | $modal_body = ''; |
217 | - if ( $lsx_hp->frontend->gallery->has_gallery( $m ) ) { |
|
217 | + if ($lsx_hp->frontend->gallery->has_gallery($m)) { |
|
218 | 218 | $gallery_args = array( |
219 | 219 | 'css_class' => 'modal-slider', |
220 | 220 | ); |
221 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
221 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery('', '', $gallery_args); |
|
222 | 222 | } else { |
223 | - $modal_body .= '<div class="modal-image">' . get_the_post_thumbnail( $m, 'large' ) . '</div>'; |
|
223 | + $modal_body .= '<div class="modal-image">' . get_the_post_thumbnail($m, 'large') . '</div>'; |
|
224 | 224 | } |
225 | 225 | $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $title . '</h5>'; |
226 | 226 | |
227 | - if ( ! empty( $equipment_group ) ) { |
|
227 | + if ( ! empty($equipment_group)) { |
|
228 | 228 | $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
229 | 229 | } |
230 | - if ( ! empty( $muscle_group ) ) { |
|
230 | + if ( ! empty($muscle_group)) { |
|
231 | 231 | $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
232 | 232 | } |
233 | 233 | $modal_body .= '</div>'; |
234 | 234 | $modal_body .= $content; |
235 | - \lsx_health_plan\functions\register_modal( 'exercise-modal-' . $m, '', $modal_body ); |
|
235 | + \lsx_health_plan\functions\register_modal('exercise-modal-' . $m, '', $modal_body); |
|
236 | 236 | |
237 | - return ( $button ); |
|
237 | + return ($button); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -245,18 +245,18 @@ discard block |
||
245 | 245 | * @param boolean $echo |
246 | 246 | * @return string |
247 | 247 | */ |
248 | -function lsx_health_plan_exercise_title( $before = '', $after = '', $echo = true, $exercise_id = false ) { |
|
249 | - if ( false === $exercise_id ) { |
|
248 | +function lsx_health_plan_exercise_title($before = '', $after = '', $echo = true, $exercise_id = false) { |
|
249 | + if (false === $exercise_id) { |
|
250 | 250 | $exercise_id = get_the_ID(); |
251 | 251 | } |
252 | - $title = get_the_title( $exercise_id ); |
|
253 | - $side = get_post_meta( $exercise_id, 'exercise_side', true ); |
|
254 | - if ( '' !== $side ) { |
|
255 | - $title .= ' - ' . ucwords( $side ); |
|
252 | + $title = get_the_title($exercise_id); |
|
253 | + $side = get_post_meta($exercise_id, 'exercise_side', true); |
|
254 | + if ('' !== $side) { |
|
255 | + $title .= ' - ' . ucwords($side); |
|
256 | 256 | } |
257 | - $title = apply_filters( 'lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id ); |
|
258 | - if ( true === $echo ) { |
|
259 | - echo wp_kses_post( $title ); |
|
257 | + $title = apply_filters('lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id); |
|
258 | + if (true === $echo) { |
|
259 | + echo wp_kses_post($title); |
|
260 | 260 | } else { |
261 | 261 | return $title; |
262 | 262 | } |
@@ -8,148 +8,148 @@ |
||
8 | 8 | */ |
9 | 9 | class LSX_Team { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @var object \lsx_health_plan\classes\LSX_Team() |
|
15 | - */ |
|
16 | - protected static $instance = null; |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @var object \lsx_health_plan\classes\LSX_Team() |
|
15 | + */ |
|
16 | + protected static $instance = null; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Constructor. |
|
20 | - */ |
|
21 | - public function __construct() { |
|
22 | - $this->default_types = array( |
|
23 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
24 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
25 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
26 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
27 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
28 | - ); |
|
29 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
30 | - add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
31 | - add_action( 'cmb2_admin_init', array( $this, 'additional_single_team_metabox' ) ); |
|
32 | - add_action( 'lsx_entry_bottom', array( $this, 'hp_team_member_tabs' ) ); |
|
33 | - add_action( 'wp_head', array( $this, 'remove_archive_original_team_header' ), 99 ); |
|
34 | - } |
|
18 | + /** |
|
19 | + * Constructor. |
|
20 | + */ |
|
21 | + public function __construct() { |
|
22 | + $this->default_types = array( |
|
23 | + \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
24 | + \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
25 | + \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
26 | + \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
27 | + \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
28 | + ); |
|
29 | + add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
30 | + add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
31 | + add_action( 'cmb2_admin_init', array( $this, 'additional_single_team_metabox' ) ); |
|
32 | + add_action( 'lsx_entry_bottom', array( $this, 'hp_team_member_tabs' ) ); |
|
33 | + add_action( 'wp_head', array( $this, 'remove_archive_original_team_header' ), 99 ); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Return an instance of this class. |
|
38 | - * |
|
39 | - * @since 1.0.0 |
|
40 | - * |
|
41 | - * @return object \lsx_health_plan\classes\LSX_Team() A single instance of this class. |
|
42 | - */ |
|
43 | - public static function get_instance() { |
|
44 | - // If the single instance hasn't been set, set it now. |
|
45 | - if ( null === self::$instance ) { |
|
46 | - self::$instance = new self(); |
|
47 | - } |
|
48 | - return self::$instance; |
|
49 | - } |
|
36 | + /** |
|
37 | + * Return an instance of this class. |
|
38 | + * |
|
39 | + * @since 1.0.0 |
|
40 | + * |
|
41 | + * @return object \lsx_health_plan\classes\LSX_Team() A single instance of this class. |
|
42 | + */ |
|
43 | + public static function get_instance() { |
|
44 | + // If the single instance hasn't been set, set it now. |
|
45 | + if ( null === self::$instance ) { |
|
46 | + self::$instance = new self(); |
|
47 | + } |
|
48 | + return self::$instance; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Load lsx team related css. |
|
53 | - * |
|
54 | - * @package lsx |
|
55 | - * @subpackage lsx-health-plan |
|
56 | - * |
|
57 | - */ |
|
58 | - public function assets() { |
|
59 | - wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
60 | - } |
|
51 | + /** |
|
52 | + * Load lsx team related css. |
|
53 | + * |
|
54 | + * @package lsx |
|
55 | + * @subpackage lsx-health-plan |
|
56 | + * |
|
57 | + */ |
|
58 | + public function assets() { |
|
59 | + wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Define the related team member metabox and field configurations. |
|
64 | - */ |
|
65 | - public function related_team_metabox() { |
|
66 | - foreach ( $this->default_types as $type => $default_type ) { |
|
67 | - $cmb = new_cmb2_box( |
|
68 | - array( |
|
69 | - 'id' => $default_type . '_related_team_member__metabox', |
|
70 | - 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
71 | - 'object_types' => array( $default_type ), // Post type. |
|
72 | - 'context' => 'normal', |
|
73 | - 'priority' => 'low', |
|
74 | - 'show_names' => true, |
|
75 | - ) |
|
76 | - ); |
|
62 | + /** |
|
63 | + * Define the related team member metabox and field configurations. |
|
64 | + */ |
|
65 | + public function related_team_metabox() { |
|
66 | + foreach ( $this->default_types as $type => $default_type ) { |
|
67 | + $cmb = new_cmb2_box( |
|
68 | + array( |
|
69 | + 'id' => $default_type . '_related_team_member__metabox', |
|
70 | + 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
71 | + 'object_types' => array( $default_type ), // Post type. |
|
72 | + 'context' => 'normal', |
|
73 | + 'priority' => 'low', |
|
74 | + 'show_names' => true, |
|
75 | + ) |
|
76 | + ); |
|
77 | 77 | |
78 | - $cmb->add_field( |
|
79 | - array( |
|
80 | - 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
81 | - 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
82 | - 'id' => $default_type . '_connected_team_member', |
|
83 | - 'type' => 'post_search_ajax', |
|
84 | - 'limit' => 4, // Limit selection to X items only (default 1). |
|
85 | - 'sortable' => true, // Allow selected items to be sortable (default false). |
|
86 | - 'query_args' => array( |
|
87 | - 'post_type' => array( 'team' ), |
|
88 | - 'post_status' => array( 'publish' ), |
|
89 | - 'posts_per_page' => -1, |
|
90 | - ), |
|
91 | - ) |
|
92 | - ); |
|
93 | - } |
|
78 | + $cmb->add_field( |
|
79 | + array( |
|
80 | + 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
81 | + 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
82 | + 'id' => $default_type . '_connected_team_member', |
|
83 | + 'type' => 'post_search_ajax', |
|
84 | + 'limit' => 4, // Limit selection to X items only (default 1). |
|
85 | + 'sortable' => true, // Allow selected items to be sortable (default false). |
|
86 | + 'query_args' => array( |
|
87 | + 'post_type' => array( 'team' ), |
|
88 | + 'post_status' => array( 'publish' ), |
|
89 | + 'posts_per_page' => -1, |
|
90 | + ), |
|
91 | + ) |
|
92 | + ); |
|
93 | + } |
|
94 | 94 | |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * Adding additional custom fields to the single members, related with Health Plan. |
|
99 | - */ |
|
100 | - public function additional_single_team_metabox() { |
|
101 | - $cmb = new_cmb2_box( |
|
102 | - array( |
|
103 | - 'id' => 'lsx__team', |
|
104 | - 'title' => '', |
|
105 | - 'object_types' => array( 'team' ), // Post type. |
|
106 | - 'context' => 'normal', |
|
107 | - 'priority' => 'high', |
|
108 | - 'show_names' => true, |
|
109 | - ) |
|
110 | - ); |
|
97 | + /** |
|
98 | + * Adding additional custom fields to the single members, related with Health Plan. |
|
99 | + */ |
|
100 | + public function additional_single_team_metabox() { |
|
101 | + $cmb = new_cmb2_box( |
|
102 | + array( |
|
103 | + 'id' => 'lsx__team', |
|
104 | + 'title' => '', |
|
105 | + 'object_types' => array( 'team' ), // Post type. |
|
106 | + 'context' => 'normal', |
|
107 | + 'priority' => 'high', |
|
108 | + 'show_names' => true, |
|
109 | + ) |
|
110 | + ); |
|
111 | 111 | |
112 | - $cmb->add_field( |
|
113 | - array( |
|
114 | - 'name' => __( 'Team Member Experience', 'lsx-health-plan' ), |
|
115 | - 'desc' => __( 'Add additional experience to this team member', 'lsx-health-plan' ), |
|
116 | - 'id' => 'team_member_experience', |
|
117 | - 'type' => 'wysiwyg', |
|
118 | - ) |
|
119 | - ); |
|
112 | + $cmb->add_field( |
|
113 | + array( |
|
114 | + 'name' => __( 'Team Member Experience', 'lsx-health-plan' ), |
|
115 | + 'desc' => __( 'Add additional experience to this team member', 'lsx-health-plan' ), |
|
116 | + 'id' => 'team_member_experience', |
|
117 | + 'type' => 'wysiwyg', |
|
118 | + ) |
|
119 | + ); |
|
120 | 120 | |
121 | - $cmb->add_field( |
|
122 | - array( |
|
123 | - 'name' => __( 'Featured Plans', 'lsx-health-plan' ), |
|
124 | - 'desc' => __( 'Connect the related plans to this team member', 'lsx-health-plan' ), |
|
125 | - 'id' => 'connected_team_member_plan', |
|
126 | - 'type' => 'post_search_ajax', |
|
127 | - 'limit' => 3, |
|
128 | - 'sortable' => true, |
|
129 | - 'query_args' => array( |
|
130 | - 'post_type' => array( 'plan' ), |
|
131 | - 'post_status' => array( 'publish' ), |
|
132 | - 'posts_per_page' => -1, |
|
133 | - ), |
|
134 | - ) |
|
135 | - ); |
|
121 | + $cmb->add_field( |
|
122 | + array( |
|
123 | + 'name' => __( 'Featured Plans', 'lsx-health-plan' ), |
|
124 | + 'desc' => __( 'Connect the related plans to this team member', 'lsx-health-plan' ), |
|
125 | + 'id' => 'connected_team_member_plan', |
|
126 | + 'type' => 'post_search_ajax', |
|
127 | + 'limit' => 3, |
|
128 | + 'sortable' => true, |
|
129 | + 'query_args' => array( |
|
130 | + 'post_type' => array( 'plan' ), |
|
131 | + 'post_status' => array( 'publish' ), |
|
132 | + 'posts_per_page' => -1, |
|
133 | + ), |
|
134 | + ) |
|
135 | + ); |
|
136 | 136 | |
137 | - } |
|
137 | + } |
|
138 | 138 | |
139 | - /** |
|
140 | - * Adds custom tabs to the team member single pages. |
|
141 | - * |
|
142 | - * @return void |
|
143 | - */ |
|
144 | - public function hp_team_member_tabs() { |
|
145 | - if ( is_single() && is_singular( 'team' ) ) { |
|
146 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/team.php'; |
|
147 | - } |
|
148 | - } |
|
139 | + /** |
|
140 | + * Adds custom tabs to the team member single pages. |
|
141 | + * |
|
142 | + * @return void |
|
143 | + */ |
|
144 | + public function hp_team_member_tabs() { |
|
145 | + if ( is_single() && is_singular( 'team' ) ) { |
|
146 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/team.php'; |
|
147 | + } |
|
148 | + } |
|
149 | 149 | |
150 | - public function remove_archive_original_team_header() { |
|
151 | - if ( is_single() && is_singular( 'team' ) ) { |
|
152 | - remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
153 | - } |
|
154 | - } |
|
150 | + public function remove_archive_original_team_header() { |
|
151 | + if ( is_single() && is_singular( 'team' ) ) { |
|
152 | + remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
153 | + } |
|
154 | + } |
|
155 | 155 | } |
@@ -20,17 +20,17 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function __construct() { |
22 | 22 | $this->default_types = array( |
23 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
24 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
25 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
26 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
27 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
23 | + \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'), |
|
24 | + \lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'), |
|
25 | + \lsx_health_plan\functions\get_option('endpoint_recipe_single', 'recipe'), |
|
26 | + \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'), |
|
27 | + \lsx_health_plan\functions\get_option('endpoint_plan', 'plan'), |
|
28 | 28 | ); |
29 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
30 | - add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
31 | - add_action( 'cmb2_admin_init', array( $this, 'additional_single_team_metabox' ) ); |
|
32 | - add_action( 'lsx_entry_bottom', array( $this, 'hp_team_member_tabs' ) ); |
|
33 | - add_action( 'wp_head', array( $this, 'remove_archive_original_team_header' ), 99 ); |
|
29 | + add_action('wp_enqueue_scripts', array($this, 'assets'), 5); |
|
30 | + add_action('cmb2_admin_init', array($this, 'related_team_metabox')); |
|
31 | + add_action('cmb2_admin_init', array($this, 'additional_single_team_metabox')); |
|
32 | + add_action('lsx_entry_bottom', array($this, 'hp_team_member_tabs')); |
|
33 | + add_action('wp_head', array($this, 'remove_archive_original_team_header'), 99); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public static function get_instance() { |
44 | 44 | // If the single instance hasn't been set, set it now. |
45 | - if ( null === self::$instance ) { |
|
45 | + if (null === self::$instance) { |
|
46 | 46 | self::$instance = new self(); |
47 | 47 | } |
48 | 48 | return self::$instance; |
@@ -56,19 +56,19 @@ discard block |
||
56 | 56 | * |
57 | 57 | */ |
58 | 58 | public function assets() { |
59 | - wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
59 | + wp_enqueue_style('lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * Define the related team member metabox and field configurations. |
64 | 64 | */ |
65 | 65 | public function related_team_metabox() { |
66 | - foreach ( $this->default_types as $type => $default_type ) { |
|
66 | + foreach ($this->default_types as $type => $default_type) { |
|
67 | 67 | $cmb = new_cmb2_box( |
68 | 68 | array( |
69 | 69 | 'id' => $default_type . '_related_team_member__metabox', |
70 | - 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
71 | - 'object_types' => array( $default_type ), // Post type. |
|
70 | + 'title' => __('Related Team Member', 'lsx-health-plan'), |
|
71 | + 'object_types' => array($default_type), // Post type. |
|
72 | 72 | 'context' => 'normal', |
73 | 73 | 'priority' => 'low', |
74 | 74 | 'show_names' => true, |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | |
78 | 78 | $cmb->add_field( |
79 | 79 | array( |
80 | - 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
81 | - 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
80 | + 'name' => __('Related Team Member', 'lsx-health-plan'), |
|
81 | + 'desc' => __('Connect the related team member that applies to this ', 'lsx-health-plan') . $default_type, |
|
82 | 82 | 'id' => $default_type . '_connected_team_member', |
83 | 83 | 'type' => 'post_search_ajax', |
84 | - 'limit' => 4, // Limit selection to X items only (default 1). |
|
84 | + 'limit' => 4, // Limit selection to X items only (default 1). |
|
85 | 85 | 'sortable' => true, // Allow selected items to be sortable (default false). |
86 | 86 | 'query_args' => array( |
87 | - 'post_type' => array( 'team' ), |
|
88 | - 'post_status' => array( 'publish' ), |
|
87 | + 'post_type' => array('team'), |
|
88 | + 'post_status' => array('publish'), |
|
89 | 89 | 'posts_per_page' => -1, |
90 | 90 | ), |
91 | 91 | ) |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | array( |
103 | 103 | 'id' => 'lsx__team', |
104 | 104 | 'title' => '', |
105 | - 'object_types' => array( 'team' ), // Post type. |
|
105 | + 'object_types' => array('team'), // Post type. |
|
106 | 106 | 'context' => 'normal', |
107 | 107 | 'priority' => 'high', |
108 | 108 | 'show_names' => true, |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | |
112 | 112 | $cmb->add_field( |
113 | 113 | array( |
114 | - 'name' => __( 'Team Member Experience', 'lsx-health-plan' ), |
|
115 | - 'desc' => __( 'Add additional experience to this team member', 'lsx-health-plan' ), |
|
114 | + 'name' => __('Team Member Experience', 'lsx-health-plan'), |
|
115 | + 'desc' => __('Add additional experience to this team member', 'lsx-health-plan'), |
|
116 | 116 | 'id' => 'team_member_experience', |
117 | 117 | 'type' => 'wysiwyg', |
118 | 118 | ) |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | |
121 | 121 | $cmb->add_field( |
122 | 122 | array( |
123 | - 'name' => __( 'Featured Plans', 'lsx-health-plan' ), |
|
124 | - 'desc' => __( 'Connect the related plans to this team member', 'lsx-health-plan' ), |
|
123 | + 'name' => __('Featured Plans', 'lsx-health-plan'), |
|
124 | + 'desc' => __('Connect the related plans to this team member', 'lsx-health-plan'), |
|
125 | 125 | 'id' => 'connected_team_member_plan', |
126 | 126 | 'type' => 'post_search_ajax', |
127 | 127 | 'limit' => 3, |
128 | 128 | 'sortable' => true, |
129 | 129 | 'query_args' => array( |
130 | - 'post_type' => array( 'plan' ), |
|
131 | - 'post_status' => array( 'publish' ), |
|
130 | + 'post_type' => array('plan'), |
|
131 | + 'post_status' => array('publish'), |
|
132 | 132 | 'posts_per_page' => -1, |
133 | 133 | ), |
134 | 134 | ) |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | * @return void |
143 | 143 | */ |
144 | 144 | public function hp_team_member_tabs() { |
145 | - if ( is_single() && is_singular( 'team' ) ) { |
|
145 | + if (is_single() && is_singular('team')) { |
|
146 | 146 | require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/team.php'; |
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | 150 | public function remove_archive_original_team_header() { |
151 | - if ( is_single() && is_singular( 'team' ) ) { |
|
152 | - remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
151 | + if (is_single() && is_singular('team')) { |
|
152 | + remove_action('lsx_content_wrap_before', 'lsx_global_header'); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | } |
@@ -12,147 +12,147 @@ |
||
12 | 12 | */ |
13 | 13 | class Meal { |
14 | 14 | |
15 | - /** |
|
16 | - * Holds class instance |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - * |
|
20 | - * @var object \lsx_health_plan\classes\admin\Meal() |
|
21 | - */ |
|
22 | - protected static $instance = null; |
|
15 | + /** |
|
16 | + * Holds class instance |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + * |
|
20 | + * @var object \lsx_health_plan\classes\admin\Meal() |
|
21 | + */ |
|
22 | + protected static $instance = null; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Constructor |
|
26 | - */ |
|
27 | - public function __construct() { |
|
28 | - add_action( 'lsx_hp_settings_page_meal_top', array( $this, 'settings' ), 1, 1 ); |
|
29 | - } |
|
24 | + /** |
|
25 | + * Constructor |
|
26 | + */ |
|
27 | + public function __construct() { |
|
28 | + add_action( 'lsx_hp_settings_page_meal_top', array( $this, 'settings' ), 1, 1 ); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Return an instance of this class. |
|
33 | - * |
|
34 | - * @since 1.0.0 |
|
35 | - * |
|
36 | - * @return object \lsx_health_plan\classes\admin\Meal() A single instance of this class. |
|
37 | - */ |
|
38 | - public static function get_instance() { |
|
39 | - // If the single instance hasn't been set, set it now. |
|
40 | - if ( null === self::$instance ) { |
|
41 | - self::$instance = new self(); |
|
42 | - } |
|
43 | - return self::$instance; |
|
44 | - } |
|
31 | + /** |
|
32 | + * Return an instance of this class. |
|
33 | + * |
|
34 | + * @since 1.0.0 |
|
35 | + * |
|
36 | + * @return object \lsx_health_plan\classes\admin\Meal() A single instance of this class. |
|
37 | + */ |
|
38 | + public static function get_instance() { |
|
39 | + // If the single instance hasn't been set, set it now. |
|
40 | + if ( null === self::$instance ) { |
|
41 | + self::$instance = new self(); |
|
42 | + } |
|
43 | + return self::$instance; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Registers the general settings. |
|
48 | - * |
|
49 | - * @param object $cmb new_cmb2_box(). |
|
50 | - * @return void |
|
51 | - */ |
|
52 | - public function settings( $cmb ) { |
|
53 | - $cmb->add_field( |
|
54 | - array( |
|
55 | - 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
56 | - 'id' => 'meal_disabled', |
|
57 | - 'type' => 'checkbox', |
|
58 | - 'value' => 1, |
|
59 | - 'default' => 0, |
|
60 | - 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
61 | - ) |
|
62 | - ); |
|
46 | + /** |
|
47 | + * Registers the general settings. |
|
48 | + * |
|
49 | + * @param object $cmb new_cmb2_box(). |
|
50 | + * @return void |
|
51 | + */ |
|
52 | + public function settings( $cmb ) { |
|
53 | + $cmb->add_field( |
|
54 | + array( |
|
55 | + 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
56 | + 'id' => 'meal_disabled', |
|
57 | + 'type' => 'checkbox', |
|
58 | + 'value' => 1, |
|
59 | + 'default' => 0, |
|
60 | + 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
61 | + ) |
|
62 | + ); |
|
63 | 63 | |
64 | - $cmb->add_field( |
|
65 | - array( |
|
66 | - 'id' => 'meal_archive_description', |
|
67 | - 'type' => 'wysiwyg', |
|
68 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
69 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
70 | - 'options' => array( |
|
71 | - 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
72 | - ), |
|
73 | - ) |
|
74 | - ); |
|
64 | + $cmb->add_field( |
|
65 | + array( |
|
66 | + 'id' => 'meal_archive_description', |
|
67 | + 'type' => 'wysiwyg', |
|
68 | + 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
69 | + 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
70 | + 'options' => array( |
|
71 | + 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
72 | + ), |
|
73 | + ) |
|
74 | + ); |
|
75 | 75 | |
76 | - $cmb->add_field( |
|
77 | - array( |
|
78 | - 'name' => __( 'Your Meal Plan Intro', 'lsx-health-plan' ), |
|
79 | - 'id' => 'meal_plan_intro', |
|
80 | - 'type' => 'textarea_small', |
|
81 | - 'value' => '', |
|
82 | - 'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ), |
|
83 | - ) |
|
84 | - ); |
|
76 | + $cmb->add_field( |
|
77 | + array( |
|
78 | + 'name' => __( 'Your Meal Plan Intro', 'lsx-health-plan' ), |
|
79 | + 'id' => 'meal_plan_intro', |
|
80 | + 'type' => 'textarea_small', |
|
81 | + 'value' => '', |
|
82 | + 'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ), |
|
83 | + ) |
|
84 | + ); |
|
85 | 85 | |
86 | - $cmb->add_field( |
|
87 | - array( |
|
88 | - 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
89 | - 'name' => __( 'Meal Slug', 'lsx-health-plan' ), |
|
90 | - 'id' => 'endpoint_meal', |
|
91 | - 'type' => 'input', |
|
92 | - 'value' => '', |
|
93 | - 'default' => 'meal', |
|
94 | - ) |
|
95 | - ); |
|
96 | - $cmb->add_field( |
|
97 | - array( |
|
98 | - 'name' => __( 'Meals Archive Slug', 'lsx-health-plan' ), |
|
99 | - 'id' => 'endpoint_meal_archive', |
|
100 | - 'type' => 'input', |
|
101 | - 'value' => '', |
|
102 | - 'default' => 'meals', |
|
103 | - ) |
|
104 | - ); |
|
105 | - $cmb->add_field( |
|
106 | - array( |
|
107 | - 'name' => __( 'Single Meal Slug', 'lsx-health-plan' ), |
|
108 | - 'id' => 'meal_single_slug', |
|
109 | - 'type' => 'input', |
|
110 | - 'value' => '', |
|
111 | - 'default' => 'meal', |
|
112 | - ) |
|
113 | - ); |
|
86 | + $cmb->add_field( |
|
87 | + array( |
|
88 | + 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
89 | + 'name' => __( 'Meal Slug', 'lsx-health-plan' ), |
|
90 | + 'id' => 'endpoint_meal', |
|
91 | + 'type' => 'input', |
|
92 | + 'value' => '', |
|
93 | + 'default' => 'meal', |
|
94 | + ) |
|
95 | + ); |
|
96 | + $cmb->add_field( |
|
97 | + array( |
|
98 | + 'name' => __( 'Meals Archive Slug', 'lsx-health-plan' ), |
|
99 | + 'id' => 'endpoint_meal_archive', |
|
100 | + 'type' => 'input', |
|
101 | + 'value' => '', |
|
102 | + 'default' => 'meals', |
|
103 | + ) |
|
104 | + ); |
|
105 | + $cmb->add_field( |
|
106 | + array( |
|
107 | + 'name' => __( 'Single Meal Slug', 'lsx-health-plan' ), |
|
108 | + 'id' => 'meal_single_slug', |
|
109 | + 'type' => 'input', |
|
110 | + 'value' => '', |
|
111 | + 'default' => 'meal', |
|
112 | + ) |
|
113 | + ); |
|
114 | 114 | |
115 | - $cmb->add_field( |
|
116 | - array( |
|
117 | - 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
118 | - 'name' => __( 'Default Meal Plan', 'lsx-health-plan' ), |
|
119 | - 'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ), |
|
120 | - 'limit' => 1, |
|
121 | - 'id' => 'connected_meals', |
|
122 | - 'type' => 'post_search_ajax', |
|
123 | - 'query_args' => array( |
|
124 | - 'post_type' => 'meal', |
|
125 | - 'post_status' => array( 'publish' ), |
|
126 | - 'posts_per_page' => -1, |
|
127 | - ), |
|
128 | - ) |
|
129 | - ); |
|
130 | - if ( function_exists( 'download_monitor' ) ) { |
|
131 | - $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
132 | - $plugin_name = 'Download Monitor'; |
|
133 | - $description = sprintf( |
|
134 | - /* translators: %s: The subscription info */ |
|
135 | - __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
136 | - $page_url, |
|
137 | - $plugin_name |
|
138 | - ); |
|
139 | - $cmb->add_field( |
|
140 | - array( |
|
141 | - 'name' => __( 'Default Meal Plan PDF', 'lsx-health-plan' ), |
|
142 | - 'description' => $description, |
|
143 | - 'id' => 'download_meal', |
|
144 | - 'type' => 'post_search_ajax', |
|
145 | - 'limit' => 1, |
|
146 | - 'query_args' => array( |
|
147 | - 'post_type' => array( 'dlm_download' ), |
|
148 | - 'post_status' => array( 'publish' ), |
|
149 | - 'posts_per_page' => -1, |
|
150 | - ), |
|
151 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
152 | - ) |
|
153 | - ); |
|
154 | - } |
|
115 | + $cmb->add_field( |
|
116 | + array( |
|
117 | + 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
118 | + 'name' => __( 'Default Meal Plan', 'lsx-health-plan' ), |
|
119 | + 'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ), |
|
120 | + 'limit' => 1, |
|
121 | + 'id' => 'connected_meals', |
|
122 | + 'type' => 'post_search_ajax', |
|
123 | + 'query_args' => array( |
|
124 | + 'post_type' => 'meal', |
|
125 | + 'post_status' => array( 'publish' ), |
|
126 | + 'posts_per_page' => -1, |
|
127 | + ), |
|
128 | + ) |
|
129 | + ); |
|
130 | + if ( function_exists( 'download_monitor' ) ) { |
|
131 | + $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
132 | + $plugin_name = 'Download Monitor'; |
|
133 | + $description = sprintf( |
|
134 | + /* translators: %s: The subscription info */ |
|
135 | + __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
136 | + $page_url, |
|
137 | + $plugin_name |
|
138 | + ); |
|
139 | + $cmb->add_field( |
|
140 | + array( |
|
141 | + 'name' => __( 'Default Meal Plan PDF', 'lsx-health-plan' ), |
|
142 | + 'description' => $description, |
|
143 | + 'id' => 'download_meal', |
|
144 | + 'type' => 'post_search_ajax', |
|
145 | + 'limit' => 1, |
|
146 | + 'query_args' => array( |
|
147 | + 'post_type' => array( 'dlm_download' ), |
|
148 | + 'post_status' => array( 'publish' ), |
|
149 | + 'posts_per_page' => -1, |
|
150 | + ), |
|
151 | + 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
152 | + ) |
|
153 | + ); |
|
154 | + } |
|
155 | 155 | |
156 | - } |
|
156 | + } |
|
157 | 157 | } |
158 | 158 | Meal::get_instance(); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * Constructor |
26 | 26 | */ |
27 | 27 | public function __construct() { |
28 | - add_action( 'lsx_hp_settings_page_meal_top', array( $this, 'settings' ), 1, 1 ); |
|
28 | + add_action('lsx_hp_settings_page_meal_top', array($this, 'settings'), 1, 1); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function get_instance() { |
39 | 39 | // If the single instance hasn't been set, set it now. |
40 | - if ( null === self::$instance ) { |
|
40 | + if (null === self::$instance) { |
|
41 | 41 | self::$instance = new self(); |
42 | 42 | } |
43 | 43 | return self::$instance; |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | * @param object $cmb new_cmb2_box(). |
50 | 50 | * @return void |
51 | 51 | */ |
52 | - public function settings( $cmb ) { |
|
52 | + public function settings($cmb) { |
|
53 | 53 | $cmb->add_field( |
54 | 54 | array( |
55 | - 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
55 | + 'name' => __('Disable Meals', 'lsx-health-plan'), |
|
56 | 56 | 'id' => 'meal_disabled', |
57 | 57 | 'type' => 'checkbox', |
58 | 58 | 'value' => 1, |
59 | 59 | 'default' => 0, |
60 | - 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
60 | + 'description' => __('Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan'), |
|
61 | 61 | ) |
62 | 62 | ); |
63 | 63 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | array( |
66 | 66 | 'id' => 'meal_archive_description', |
67 | 67 | 'type' => 'wysiwyg', |
68 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
69 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
68 | + 'name' => __('Archive Description', 'lsx-health-plan'), |
|
69 | + 'description' => __('This will show up on the post type archive.', 'lsx-health-plan'), |
|
70 | 70 | 'options' => array( |
71 | 71 | 'textarea_rows' => get_option('default_post_edit_rows', 6), |
72 | 72 | ), |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | |
76 | 76 | $cmb->add_field( |
77 | 77 | array( |
78 | - 'name' => __( 'Your Meal Plan Intro', 'lsx-health-plan' ), |
|
78 | + 'name' => __('Your Meal Plan Intro', 'lsx-health-plan'), |
|
79 | 79 | 'id' => 'meal_plan_intro', |
80 | 80 | 'type' => 'textarea_small', |
81 | 81 | 'value' => '', |
82 | - 'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ), |
|
82 | + 'default' => __('Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan'), |
|
83 | 83 | ) |
84 | 84 | ); |
85 | 85 | |
86 | 86 | $cmb->add_field( |
87 | 87 | array( |
88 | 88 | 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
89 | - 'name' => __( 'Meal Slug', 'lsx-health-plan' ), |
|
89 | + 'name' => __('Meal Slug', 'lsx-health-plan'), |
|
90 | 90 | 'id' => 'endpoint_meal', |
91 | 91 | 'type' => 'input', |
92 | 92 | 'value' => '', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ); |
96 | 96 | $cmb->add_field( |
97 | 97 | array( |
98 | - 'name' => __( 'Meals Archive Slug', 'lsx-health-plan' ), |
|
98 | + 'name' => __('Meals Archive Slug', 'lsx-health-plan'), |
|
99 | 99 | 'id' => 'endpoint_meal_archive', |
100 | 100 | 'type' => 'input', |
101 | 101 | 'value' => '', |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | ); |
105 | 105 | $cmb->add_field( |
106 | 106 | array( |
107 | - 'name' => __( 'Single Meal Slug', 'lsx-health-plan' ), |
|
107 | + 'name' => __('Single Meal Slug', 'lsx-health-plan'), |
|
108 | 108 | 'id' => 'meal_single_slug', |
109 | 109 | 'type' => 'input', |
110 | 110 | 'value' => '', |
@@ -115,40 +115,40 @@ discard block |
||
115 | 115 | $cmb->add_field( |
116 | 116 | array( |
117 | 117 | 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
118 | - 'name' => __( 'Default Meal Plan', 'lsx-health-plan' ), |
|
119 | - 'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ), |
|
118 | + 'name' => __('Default Meal Plan', 'lsx-health-plan'), |
|
119 | + 'description' => __('Set a default meal plan.', 'lsx-health-plan'), |
|
120 | 120 | 'limit' => 1, |
121 | 121 | 'id' => 'connected_meals', |
122 | 122 | 'type' => 'post_search_ajax', |
123 | 123 | 'query_args' => array( |
124 | 124 | 'post_type' => 'meal', |
125 | - 'post_status' => array( 'publish' ), |
|
125 | + 'post_status' => array('publish'), |
|
126 | 126 | 'posts_per_page' => -1, |
127 | 127 | ), |
128 | 128 | ) |
129 | 129 | ); |
130 | - if ( function_exists( 'download_monitor' ) ) { |
|
130 | + if (function_exists('download_monitor')) { |
|
131 | 131 | $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
132 | 132 | $plugin_name = 'Download Monitor'; |
133 | 133 | $description = sprintf( |
134 | 134 | /* translators: %s: The subscription info */ |
135 | - __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
135 | + __('If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search'), |
|
136 | 136 | $page_url, |
137 | 137 | $plugin_name |
138 | 138 | ); |
139 | 139 | $cmb->add_field( |
140 | 140 | array( |
141 | - 'name' => __( 'Default Meal Plan PDF', 'lsx-health-plan' ), |
|
141 | + 'name' => __('Default Meal Plan PDF', 'lsx-health-plan'), |
|
142 | 142 | 'description' => $description, |
143 | 143 | 'id' => 'download_meal', |
144 | 144 | 'type' => 'post_search_ajax', |
145 | 145 | 'limit' => 1, |
146 | 146 | 'query_args' => array( |
147 | - 'post_type' => array( 'dlm_download' ), |
|
148 | - 'post_status' => array( 'publish' ), |
|
147 | + 'post_type' => array('dlm_download'), |
|
148 | + 'post_status' => array('publish'), |
|
149 | 149 | 'posts_per_page' => -1, |
150 | 150 | ), |
151 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
151 | + 'after_row' => __('<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan'), |
|
152 | 152 | ) |
153 | 153 | ); |
154 | 154 | } |
@@ -12,133 +12,133 @@ |
||
12 | 12 | */ |
13 | 13 | class Plan { |
14 | 14 | |
15 | - /** |
|
16 | - * Holds class instance |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - * |
|
20 | - * @var object \lsx_health_plan\classes\admin\Plan() |
|
21 | - */ |
|
22 | - protected static $instance = null; |
|
15 | + /** |
|
16 | + * Holds class instance |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + * |
|
20 | + * @var object \lsx_health_plan\classes\admin\Plan() |
|
21 | + */ |
|
22 | + protected static $instance = null; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Constructor |
|
26 | - */ |
|
27 | - public function __construct() { |
|
28 | - add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 ); |
|
29 | - } |
|
24 | + /** |
|
25 | + * Constructor |
|
26 | + */ |
|
27 | + public function __construct() { |
|
28 | + add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 ); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Return an instance of this class. |
|
33 | - * |
|
34 | - * @since 1.0.0 |
|
35 | - * |
|
36 | - * @return object \lsx_health_plan\classes\admin\Plan() A single instance of this class. |
|
37 | - */ |
|
38 | - public static function get_instance() { |
|
39 | - // If the single instance hasn't been set, set it now. |
|
40 | - if ( null === self::$instance ) { |
|
41 | - self::$instance = new self(); |
|
42 | - } |
|
43 | - return self::$instance; |
|
44 | - } |
|
31 | + /** |
|
32 | + * Return an instance of this class. |
|
33 | + * |
|
34 | + * @since 1.0.0 |
|
35 | + * |
|
36 | + * @return object \lsx_health_plan\classes\admin\Plan() A single instance of this class. |
|
37 | + */ |
|
38 | + public static function get_instance() { |
|
39 | + // If the single instance hasn't been set, set it now. |
|
40 | + if ( null === self::$instance ) { |
|
41 | + self::$instance = new self(); |
|
42 | + } |
|
43 | + return self::$instance; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Registers the general settings. |
|
48 | - * |
|
49 | - * @param object $cmb new_cmb2_box(). |
|
50 | - * @return void |
|
51 | - */ |
|
52 | - public function settings( $cmb ) { |
|
53 | - $cmb->add_field( |
|
54 | - array( |
|
55 | - 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
56 | - 'id' => 'plan_filters_disabled', |
|
57 | - 'type' => 'checkbox', |
|
58 | - 'value' => 1, |
|
59 | - 'default' => 0, |
|
60 | - 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
61 | - ) |
|
62 | - ); |
|
46 | + /** |
|
47 | + * Registers the general settings. |
|
48 | + * |
|
49 | + * @param object $cmb new_cmb2_box(). |
|
50 | + * @return void |
|
51 | + */ |
|
52 | + public function settings( $cmb ) { |
|
53 | + $cmb->add_field( |
|
54 | + array( |
|
55 | + 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
56 | + 'id' => 'plan_filters_disabled', |
|
57 | + 'type' => 'checkbox', |
|
58 | + 'value' => 1, |
|
59 | + 'default' => 0, |
|
60 | + 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
61 | + ) |
|
62 | + ); |
|
63 | 63 | |
64 | - $cmb->add_field( |
|
65 | - array( |
|
66 | - 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
67 | - 'name' => __( 'My Plan Slug', 'lsx-health-plan' ), |
|
68 | - 'description' => __( 'This will be the slug url for redirecting users after login, use the login page slug.', 'lsx-health-plan' ), |
|
69 | - 'id' => 'my_plan_slug', |
|
70 | - 'type' => 'input', |
|
71 | - 'value' => '', |
|
72 | - 'default' => 'my-plan', |
|
73 | - ) |
|
74 | - ); |
|
75 | - $cmb->add_field( |
|
76 | - array( |
|
77 | - 'name' => __( 'Single Plan Slug', 'lsx-health-plan' ), |
|
78 | - 'id' => 'plan_single_slug', |
|
79 | - 'type' => 'input', |
|
80 | - 'value' => '', |
|
81 | - 'default' => 'plan', |
|
82 | - ) |
|
83 | - ); |
|
84 | - $cmb->add_field( |
|
85 | - array( |
|
86 | - 'name' => __( 'Plans Archive Slug', 'lsx-health-plan' ), |
|
87 | - 'id' => 'endpoint_plan_archive', |
|
88 | - 'type' => 'input', |
|
89 | - 'value' => '', |
|
90 | - 'default' => 'plans', |
|
91 | - ) |
|
92 | - ); |
|
64 | + $cmb->add_field( |
|
65 | + array( |
|
66 | + 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
67 | + 'name' => __( 'My Plan Slug', 'lsx-health-plan' ), |
|
68 | + 'description' => __( 'This will be the slug url for redirecting users after login, use the login page slug.', 'lsx-health-plan' ), |
|
69 | + 'id' => 'my_plan_slug', |
|
70 | + 'type' => 'input', |
|
71 | + 'value' => '', |
|
72 | + 'default' => 'my-plan', |
|
73 | + ) |
|
74 | + ); |
|
75 | + $cmb->add_field( |
|
76 | + array( |
|
77 | + 'name' => __( 'Single Plan Slug', 'lsx-health-plan' ), |
|
78 | + 'id' => 'plan_single_slug', |
|
79 | + 'type' => 'input', |
|
80 | + 'value' => '', |
|
81 | + 'default' => 'plan', |
|
82 | + ) |
|
83 | + ); |
|
84 | + $cmb->add_field( |
|
85 | + array( |
|
86 | + 'name' => __( 'Plans Archive Slug', 'lsx-health-plan' ), |
|
87 | + 'id' => 'endpoint_plan_archive', |
|
88 | + 'type' => 'input', |
|
89 | + 'value' => '', |
|
90 | + 'default' => 'plans', |
|
91 | + ) |
|
92 | + ); |
|
93 | 93 | |
94 | - $cmb->add_field( |
|
95 | - array( |
|
96 | - 'before_row' => '<h4><b><u>My Stats Options</u></b></h4>', |
|
97 | - 'name' => __( 'Disable All Stats', 'lsx-health-plan' ), |
|
98 | - 'desc' => 'Disable All Stats', |
|
99 | - 'id' => 'disable_all_stats', |
|
100 | - 'type' => 'checkbox', |
|
101 | - 'value' => 1, |
|
102 | - 'default' => 0, |
|
103 | - ) |
|
104 | - ); |
|
105 | - $cmb->add_field( |
|
106 | - array( |
|
107 | - 'name' => __( 'Disable Weight', 'lsx-health-plan' ), |
|
108 | - 'id' => 'disable_weight_checkbox', |
|
109 | - 'type' => 'checkbox', |
|
110 | - 'value' => 1, |
|
111 | - 'default' => 0, |
|
112 | - ) |
|
113 | - ); |
|
114 | - $cmb->add_field( |
|
115 | - array( |
|
116 | - 'name' => __( 'Disable Height', 'lsx-health-plan' ), |
|
117 | - 'id' => 'disable_height_checkbox', |
|
118 | - 'type' => 'checkbox', |
|
119 | - 'value' => 1, |
|
120 | - 'default' => 0, |
|
121 | - ) |
|
122 | - ); |
|
123 | - $cmb->add_field( |
|
124 | - array( |
|
125 | - 'name' => __( 'Disable Waist', 'lsx-health-plan' ), |
|
126 | - 'id' => 'disable_waist_checkbox', |
|
127 | - 'type' => 'checkbox', |
|
128 | - 'value' => 1, |
|
129 | - 'default' => 0, |
|
130 | - ) |
|
131 | - ); |
|
132 | - $cmb->add_field( |
|
133 | - array( |
|
134 | - 'name' => __( 'Disable BMI', 'lsx-health-plan' ), |
|
135 | - 'id' => 'disable_bmi_checkbox', |
|
136 | - 'type' => 'checkbox', |
|
137 | - 'value' => 1, |
|
138 | - 'default' => 0, |
|
139 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
140 | - ) |
|
141 | - ); |
|
142 | - } |
|
94 | + $cmb->add_field( |
|
95 | + array( |
|
96 | + 'before_row' => '<h4><b><u>My Stats Options</u></b></h4>', |
|
97 | + 'name' => __( 'Disable All Stats', 'lsx-health-plan' ), |
|
98 | + 'desc' => 'Disable All Stats', |
|
99 | + 'id' => 'disable_all_stats', |
|
100 | + 'type' => 'checkbox', |
|
101 | + 'value' => 1, |
|
102 | + 'default' => 0, |
|
103 | + ) |
|
104 | + ); |
|
105 | + $cmb->add_field( |
|
106 | + array( |
|
107 | + 'name' => __( 'Disable Weight', 'lsx-health-plan' ), |
|
108 | + 'id' => 'disable_weight_checkbox', |
|
109 | + 'type' => 'checkbox', |
|
110 | + 'value' => 1, |
|
111 | + 'default' => 0, |
|
112 | + ) |
|
113 | + ); |
|
114 | + $cmb->add_field( |
|
115 | + array( |
|
116 | + 'name' => __( 'Disable Height', 'lsx-health-plan' ), |
|
117 | + 'id' => 'disable_height_checkbox', |
|
118 | + 'type' => 'checkbox', |
|
119 | + 'value' => 1, |
|
120 | + 'default' => 0, |
|
121 | + ) |
|
122 | + ); |
|
123 | + $cmb->add_field( |
|
124 | + array( |
|
125 | + 'name' => __( 'Disable Waist', 'lsx-health-plan' ), |
|
126 | + 'id' => 'disable_waist_checkbox', |
|
127 | + 'type' => 'checkbox', |
|
128 | + 'value' => 1, |
|
129 | + 'default' => 0, |
|
130 | + ) |
|
131 | + ); |
|
132 | + $cmb->add_field( |
|
133 | + array( |
|
134 | + 'name' => __( 'Disable BMI', 'lsx-health-plan' ), |
|
135 | + 'id' => 'disable_bmi_checkbox', |
|
136 | + 'type' => 'checkbox', |
|
137 | + 'value' => 1, |
|
138 | + 'default' => 0, |
|
139 | + 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
140 | + ) |
|
141 | + ); |
|
142 | + } |
|
143 | 143 | } |
144 | 144 | Plan::get_instance(); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * Constructor |
26 | 26 | */ |
27 | 27 | public function __construct() { |
28 | - add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 ); |
|
28 | + add_action('lsx_hp_settings_page_plan_top', array($this, 'settings'), 1, 1); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function get_instance() { |
39 | 39 | // If the single instance hasn't been set, set it now. |
40 | - if ( null === self::$instance ) { |
|
40 | + if (null === self::$instance) { |
|
41 | 41 | self::$instance = new self(); |
42 | 42 | } |
43 | 43 | return self::$instance; |
@@ -49,23 +49,23 @@ discard block |
||
49 | 49 | * @param object $cmb new_cmb2_box(). |
50 | 50 | * @return void |
51 | 51 | */ |
52 | - public function settings( $cmb ) { |
|
52 | + public function settings($cmb) { |
|
53 | 53 | $cmb->add_field( |
54 | 54 | array( |
55 | - 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
55 | + 'name' => __('Plan Filters', 'lsx-health-plan'), |
|
56 | 56 | 'id' => 'plan_filters_disabled', |
57 | 57 | 'type' => 'checkbox', |
58 | 58 | 'value' => 1, |
59 | 59 | 'default' => 0, |
60 | - 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
60 | + 'description' => __('Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan'), |
|
61 | 61 | ) |
62 | 62 | ); |
63 | 63 | |
64 | 64 | $cmb->add_field( |
65 | 65 | array( |
66 | 66 | 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
67 | - 'name' => __( 'My Plan Slug', 'lsx-health-plan' ), |
|
68 | - 'description' => __( 'This will be the slug url for redirecting users after login, use the login page slug.', 'lsx-health-plan' ), |
|
67 | + 'name' => __('My Plan Slug', 'lsx-health-plan'), |
|
68 | + 'description' => __('This will be the slug url for redirecting users after login, use the login page slug.', 'lsx-health-plan'), |
|
69 | 69 | 'id' => 'my_plan_slug', |
70 | 70 | 'type' => 'input', |
71 | 71 | 'value' => '', |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | ); |
75 | 75 | $cmb->add_field( |
76 | 76 | array( |
77 | - 'name' => __( 'Single Plan Slug', 'lsx-health-plan' ), |
|
77 | + 'name' => __('Single Plan Slug', 'lsx-health-plan'), |
|
78 | 78 | 'id' => 'plan_single_slug', |
79 | 79 | 'type' => 'input', |
80 | 80 | 'value' => '', |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | ); |
84 | 84 | $cmb->add_field( |
85 | 85 | array( |
86 | - 'name' => __( 'Plans Archive Slug', 'lsx-health-plan' ), |
|
86 | + 'name' => __('Plans Archive Slug', 'lsx-health-plan'), |
|
87 | 87 | 'id' => 'endpoint_plan_archive', |
88 | 88 | 'type' => 'input', |
89 | 89 | 'value' => '', |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $cmb->add_field( |
95 | 95 | array( |
96 | 96 | 'before_row' => '<h4><b><u>My Stats Options</u></b></h4>', |
97 | - 'name' => __( 'Disable All Stats', 'lsx-health-plan' ), |
|
97 | + 'name' => __('Disable All Stats', 'lsx-health-plan'), |
|
98 | 98 | 'desc' => 'Disable All Stats', |
99 | 99 | 'id' => 'disable_all_stats', |
100 | 100 | 'type' => 'checkbox', |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | ); |
105 | 105 | $cmb->add_field( |
106 | 106 | array( |
107 | - 'name' => __( 'Disable Weight', 'lsx-health-plan' ), |
|
107 | + 'name' => __('Disable Weight', 'lsx-health-plan'), |
|
108 | 108 | 'id' => 'disable_weight_checkbox', |
109 | 109 | 'type' => 'checkbox', |
110 | 110 | 'value' => 1, |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ); |
114 | 114 | $cmb->add_field( |
115 | 115 | array( |
116 | - 'name' => __( 'Disable Height', 'lsx-health-plan' ), |
|
116 | + 'name' => __('Disable Height', 'lsx-health-plan'), |
|
117 | 117 | 'id' => 'disable_height_checkbox', |
118 | 118 | 'type' => 'checkbox', |
119 | 119 | 'value' => 1, |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | ); |
123 | 123 | $cmb->add_field( |
124 | 124 | array( |
125 | - 'name' => __( 'Disable Waist', 'lsx-health-plan' ), |
|
125 | + 'name' => __('Disable Waist', 'lsx-health-plan'), |
|
126 | 126 | 'id' => 'disable_waist_checkbox', |
127 | 127 | 'type' => 'checkbox', |
128 | 128 | 'value' => 1, |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | ); |
132 | 132 | $cmb->add_field( |
133 | 133 | array( |
134 | - 'name' => __( 'Disable BMI', 'lsx-health-plan' ), |
|
134 | + 'name' => __('Disable BMI', 'lsx-health-plan'), |
|
135 | 135 | 'id' => 'disable_bmi_checkbox', |
136 | 136 | 'type' => 'checkbox', |
137 | 137 | 'value' => 1, |
138 | 138 | 'default' => 0, |
139 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
139 | + 'after_row' => __('<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan'), |
|
140 | 140 | ) |
141 | 141 | ); |
142 | 142 | } |
@@ -12,128 +12,128 @@ |
||
12 | 12 | */ |
13 | 13 | class Recipe { |
14 | 14 | |
15 | - /** |
|
16 | - * Holds class instance |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - * |
|
20 | - * @var object \lsx_health_plan\classes\admin\Recipe() |
|
21 | - */ |
|
22 | - protected static $instance = null; |
|
15 | + /** |
|
16 | + * Holds class instance |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + * |
|
20 | + * @var object \lsx_health_plan\classes\admin\Recipe() |
|
21 | + */ |
|
22 | + protected static $instance = null; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Constructor |
|
26 | - */ |
|
27 | - public function __construct() { |
|
28 | - add_action( 'lsx_hp_settings_page_recipe_top', array( $this, 'settings' ), 1, 1 ); |
|
29 | - } |
|
24 | + /** |
|
25 | + * Constructor |
|
26 | + */ |
|
27 | + public function __construct() { |
|
28 | + add_action( 'lsx_hp_settings_page_recipe_top', array( $this, 'settings' ), 1, 1 ); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Return an instance of this class. |
|
33 | - * |
|
34 | - * @since 1.0.0 |
|
35 | - * |
|
36 | - * @return object \lsx_health_plan\classes\admin\Recipe() A single instance of this class. |
|
37 | - */ |
|
38 | - public static function get_instance() { |
|
39 | - // If the single instance hasn't been set, set it now. |
|
40 | - if ( null === self::$instance ) { |
|
41 | - self::$instance = new self(); |
|
42 | - } |
|
43 | - return self::$instance; |
|
44 | - } |
|
31 | + /** |
|
32 | + * Return an instance of this class. |
|
33 | + * |
|
34 | + * @since 1.0.0 |
|
35 | + * |
|
36 | + * @return object \lsx_health_plan\classes\admin\Recipe() A single instance of this class. |
|
37 | + */ |
|
38 | + public static function get_instance() { |
|
39 | + // If the single instance hasn't been set, set it now. |
|
40 | + if ( null === self::$instance ) { |
|
41 | + self::$instance = new self(); |
|
42 | + } |
|
43 | + return self::$instance; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Registers the general settings. |
|
48 | - * |
|
49 | - * @param object $cmb new_cmb2_box(). |
|
50 | - * @return void |
|
51 | - */ |
|
52 | - public function settings( $cmb ) { |
|
53 | - $cmb->add_field( |
|
54 | - array( |
|
55 | - 'name' => __( 'Disable Recipes', 'lsx-health-plan' ), |
|
56 | - 'id' => 'recipe_disabled', |
|
57 | - 'type' => 'checkbox', |
|
58 | - 'value' => 1, |
|
59 | - 'default' => 0, |
|
60 | - 'description' => __( 'Disable recipe post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
61 | - ) |
|
62 | - ); |
|
46 | + /** |
|
47 | + * Registers the general settings. |
|
48 | + * |
|
49 | + * @param object $cmb new_cmb2_box(). |
|
50 | + * @return void |
|
51 | + */ |
|
52 | + public function settings( $cmb ) { |
|
53 | + $cmb->add_field( |
|
54 | + array( |
|
55 | + 'name' => __( 'Disable Recipes', 'lsx-health-plan' ), |
|
56 | + 'id' => 'recipe_disabled', |
|
57 | + 'type' => 'checkbox', |
|
58 | + 'value' => 1, |
|
59 | + 'default' => 0, |
|
60 | + 'description' => __( 'Disable recipe post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
61 | + ) |
|
62 | + ); |
|
63 | 63 | |
64 | - $cmb->add_field( |
|
65 | - array( |
|
66 | - 'id' => 'recipe_archive_description', |
|
67 | - 'type' => 'wysiwyg', |
|
68 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
69 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
70 | - 'options' => array( |
|
71 | - 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
72 | - ), |
|
73 | - ) |
|
74 | - ); |
|
64 | + $cmb->add_field( |
|
65 | + array( |
|
66 | + 'id' => 'recipe_archive_description', |
|
67 | + 'type' => 'wysiwyg', |
|
68 | + 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
69 | + 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
70 | + 'options' => array( |
|
71 | + 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
72 | + ), |
|
73 | + ) |
|
74 | + ); |
|
75 | 75 | |
76 | - $cmb->add_field( |
|
77 | - array( |
|
78 | - 'name' => __( 'Recipes Intro', 'lsx-health-plan' ), |
|
79 | - 'id' => 'recipes_intro', |
|
80 | - 'type' => 'textarea_small', |
|
81 | - 'value' => '', |
|
82 | - 'default' => __( "Let's get cooking! Delicious and easy to follow recipes.", 'lsx-health-plan' ), |
|
83 | - ) |
|
84 | - ); |
|
76 | + $cmb->add_field( |
|
77 | + array( |
|
78 | + 'name' => __( 'Recipes Intro', 'lsx-health-plan' ), |
|
79 | + 'id' => 'recipes_intro', |
|
80 | + 'type' => 'textarea_small', |
|
81 | + 'value' => '', |
|
82 | + 'default' => __( "Let's get cooking! Delicious and easy to follow recipes.", 'lsx-health-plan' ), |
|
83 | + ) |
|
84 | + ); |
|
85 | 85 | |
86 | - $cmb->add_field( |
|
87 | - array( |
|
88 | - 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
89 | - 'name' => __( 'Recipes Slug', 'lsx-health-plan' ), |
|
90 | - 'id' => 'endpoint_recipe', |
|
91 | - 'type' => 'input', |
|
92 | - 'value' => '', |
|
93 | - 'default' => 'recipe', |
|
94 | - ) |
|
95 | - ); |
|
86 | + $cmb->add_field( |
|
87 | + array( |
|
88 | + 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
89 | + 'name' => __( 'Recipes Slug', 'lsx-health-plan' ), |
|
90 | + 'id' => 'endpoint_recipe', |
|
91 | + 'type' => 'input', |
|
92 | + 'value' => '', |
|
93 | + 'default' => 'recipe', |
|
94 | + ) |
|
95 | + ); |
|
96 | 96 | |
97 | - $cmb->add_field( |
|
98 | - array( |
|
99 | - 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
100 | - 'name' => __( 'Recipe', 'lsx-health-plan' ), |
|
101 | - 'description' => __( 'Set a default recipe.', 'lsx-health-plan' ), |
|
102 | - 'limit' => 1, |
|
103 | - 'id' => 'connected_recipes', |
|
104 | - 'type' => 'post_search_ajax', |
|
105 | - 'query_args' => array( |
|
106 | - 'post_type' => 'recipe', |
|
107 | - 'post_status' => array( 'publish' ), |
|
108 | - 'posts_per_page' => -1, |
|
109 | - ), |
|
110 | - ) |
|
111 | - ); |
|
112 | - if ( function_exists( 'download_monitor' ) ) { |
|
113 | - $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
114 | - $plugin_name = 'Download Monitor'; |
|
115 | - $description = sprintf( |
|
116 | - /* translators: %s: The subscription info */ |
|
117 | - __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your recipe here.', 'lsx-search' ), |
|
118 | - $page_url, |
|
119 | - $plugin_name |
|
120 | - ); |
|
121 | - $cmb->add_field( |
|
122 | - array( |
|
123 | - 'name' => __( 'Default Recipe PDF', 'lsx-health-plan' ), |
|
124 | - 'description' => $description, |
|
125 | - 'id' => 'download_recipe', |
|
126 | - 'type' => 'post_search_ajax', |
|
127 | - 'limit' => 1, |
|
128 | - 'query_args' => array( |
|
129 | - 'post_type' => array( 'dlm_download' ), |
|
130 | - 'post_status' => array( 'publish' ), |
|
131 | - 'posts_per_page' => -1, |
|
132 | - ), |
|
133 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
134 | - ) |
|
135 | - ); |
|
136 | - } |
|
137 | - } |
|
97 | + $cmb->add_field( |
|
98 | + array( |
|
99 | + 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
100 | + 'name' => __( 'Recipe', 'lsx-health-plan' ), |
|
101 | + 'description' => __( 'Set a default recipe.', 'lsx-health-plan' ), |
|
102 | + 'limit' => 1, |
|
103 | + 'id' => 'connected_recipes', |
|
104 | + 'type' => 'post_search_ajax', |
|
105 | + 'query_args' => array( |
|
106 | + 'post_type' => 'recipe', |
|
107 | + 'post_status' => array( 'publish' ), |
|
108 | + 'posts_per_page' => -1, |
|
109 | + ), |
|
110 | + ) |
|
111 | + ); |
|
112 | + if ( function_exists( 'download_monitor' ) ) { |
|
113 | + $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
114 | + $plugin_name = 'Download Monitor'; |
|
115 | + $description = sprintf( |
|
116 | + /* translators: %s: The subscription info */ |
|
117 | + __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your recipe here.', 'lsx-search' ), |
|
118 | + $page_url, |
|
119 | + $plugin_name |
|
120 | + ); |
|
121 | + $cmb->add_field( |
|
122 | + array( |
|
123 | + 'name' => __( 'Default Recipe PDF', 'lsx-health-plan' ), |
|
124 | + 'description' => $description, |
|
125 | + 'id' => 'download_recipe', |
|
126 | + 'type' => 'post_search_ajax', |
|
127 | + 'limit' => 1, |
|
128 | + 'query_args' => array( |
|
129 | + 'post_type' => array( 'dlm_download' ), |
|
130 | + 'post_status' => array( 'publish' ), |
|
131 | + 'posts_per_page' => -1, |
|
132 | + ), |
|
133 | + 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
134 | + ) |
|
135 | + ); |
|
136 | + } |
|
137 | + } |
|
138 | 138 | } |
139 | 139 | Recipe::get_instance(); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * Constructor |
26 | 26 | */ |
27 | 27 | public function __construct() { |
28 | - add_action( 'lsx_hp_settings_page_recipe_top', array( $this, 'settings' ), 1, 1 ); |
|
28 | + add_action('lsx_hp_settings_page_recipe_top', array($this, 'settings'), 1, 1); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function get_instance() { |
39 | 39 | // If the single instance hasn't been set, set it now. |
40 | - if ( null === self::$instance ) { |
|
40 | + if (null === self::$instance) { |
|
41 | 41 | self::$instance = new self(); |
42 | 42 | } |
43 | 43 | return self::$instance; |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | * @param object $cmb new_cmb2_box(). |
50 | 50 | * @return void |
51 | 51 | */ |
52 | - public function settings( $cmb ) { |
|
52 | + public function settings($cmb) { |
|
53 | 53 | $cmb->add_field( |
54 | 54 | array( |
55 | - 'name' => __( 'Disable Recipes', 'lsx-health-plan' ), |
|
55 | + 'name' => __('Disable Recipes', 'lsx-health-plan'), |
|
56 | 56 | 'id' => 'recipe_disabled', |
57 | 57 | 'type' => 'checkbox', |
58 | 58 | 'value' => 1, |
59 | 59 | 'default' => 0, |
60 | - 'description' => __( 'Disable recipe post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
60 | + 'description' => __('Disable recipe post type if you are wanting a minimal site.', 'lsx-health-plan'), |
|
61 | 61 | ) |
62 | 62 | ); |
63 | 63 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | array( |
66 | 66 | 'id' => 'recipe_archive_description', |
67 | 67 | 'type' => 'wysiwyg', |
68 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
69 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
68 | + 'name' => __('Archive Description', 'lsx-health-plan'), |
|
69 | + 'description' => __('This will show up on the post type archive.', 'lsx-health-plan'), |
|
70 | 70 | 'options' => array( |
71 | 71 | 'textarea_rows' => get_option('default_post_edit_rows', 6), |
72 | 72 | ), |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | |
76 | 76 | $cmb->add_field( |
77 | 77 | array( |
78 | - 'name' => __( 'Recipes Intro', 'lsx-health-plan' ), |
|
78 | + 'name' => __('Recipes Intro', 'lsx-health-plan'), |
|
79 | 79 | 'id' => 'recipes_intro', |
80 | 80 | 'type' => 'textarea_small', |
81 | 81 | 'value' => '', |
82 | - 'default' => __( "Let's get cooking! Delicious and easy to follow recipes.", 'lsx-health-plan' ), |
|
82 | + 'default' => __("Let's get cooking! Delicious and easy to follow recipes.", 'lsx-health-plan'), |
|
83 | 83 | ) |
84 | 84 | ); |
85 | 85 | |
86 | 86 | $cmb->add_field( |
87 | 87 | array( |
88 | 88 | 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
89 | - 'name' => __( 'Recipes Slug', 'lsx-health-plan' ), |
|
89 | + 'name' => __('Recipes Slug', 'lsx-health-plan'), |
|
90 | 90 | 'id' => 'endpoint_recipe', |
91 | 91 | 'type' => 'input', |
92 | 92 | 'value' => '', |
@@ -97,40 +97,40 @@ discard block |
||
97 | 97 | $cmb->add_field( |
98 | 98 | array( |
99 | 99 | 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
100 | - 'name' => __( 'Recipe', 'lsx-health-plan' ), |
|
101 | - 'description' => __( 'Set a default recipe.', 'lsx-health-plan' ), |
|
100 | + 'name' => __('Recipe', 'lsx-health-plan'), |
|
101 | + 'description' => __('Set a default recipe.', 'lsx-health-plan'), |
|
102 | 102 | 'limit' => 1, |
103 | 103 | 'id' => 'connected_recipes', |
104 | 104 | 'type' => 'post_search_ajax', |
105 | 105 | 'query_args' => array( |
106 | 106 | 'post_type' => 'recipe', |
107 | - 'post_status' => array( 'publish' ), |
|
107 | + 'post_status' => array('publish'), |
|
108 | 108 | 'posts_per_page' => -1, |
109 | 109 | ), |
110 | 110 | ) |
111 | 111 | ); |
112 | - if ( function_exists( 'download_monitor' ) ) { |
|
112 | + if (function_exists('download_monitor')) { |
|
113 | 113 | $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
114 | 114 | $plugin_name = 'Download Monitor'; |
115 | 115 | $description = sprintf( |
116 | 116 | /* translators: %s: The subscription info */ |
117 | - __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your recipe here.', 'lsx-search' ), |
|
117 | + __('If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your recipe here.', 'lsx-search'), |
|
118 | 118 | $page_url, |
119 | 119 | $plugin_name |
120 | 120 | ); |
121 | 121 | $cmb->add_field( |
122 | 122 | array( |
123 | - 'name' => __( 'Default Recipe PDF', 'lsx-health-plan' ), |
|
123 | + 'name' => __('Default Recipe PDF', 'lsx-health-plan'), |
|
124 | 124 | 'description' => $description, |
125 | 125 | 'id' => 'download_recipe', |
126 | 126 | 'type' => 'post_search_ajax', |
127 | 127 | 'limit' => 1, |
128 | 128 | 'query_args' => array( |
129 | - 'post_type' => array( 'dlm_download' ), |
|
130 | - 'post_status' => array( 'publish' ), |
|
129 | + 'post_type' => array('dlm_download'), |
|
130 | + 'post_status' => array('publish'), |
|
131 | 131 | 'posts_per_page' => -1, |
132 | 132 | ), |
133 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
133 | + 'after_row' => __('<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan'), |
|
134 | 134 | ) |
135 | 135 | ); |
136 | 136 | } |
@@ -12,112 +12,112 @@ |
||
12 | 12 | */ |
13 | 13 | class Exercise { |
14 | 14 | |
15 | - /** |
|
16 | - * Holds class instance |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - * |
|
20 | - * @var object \lsx_health_plan\classes\admin\Exercise() |
|
21 | - */ |
|
22 | - protected static $instance = null; |
|
15 | + /** |
|
16 | + * Holds class instance |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + * |
|
20 | + * @var object \lsx_health_plan\classes\admin\Exercise() |
|
21 | + */ |
|
22 | + protected static $instance = null; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Constructor |
|
26 | - */ |
|
27 | - public function __construct() { |
|
28 | - add_action( 'lsx_hp_settings_page_exercise_top', array( $this, 'settings' ), 1, 1 ); |
|
29 | - } |
|
24 | + /** |
|
25 | + * Constructor |
|
26 | + */ |
|
27 | + public function __construct() { |
|
28 | + add_action( 'lsx_hp_settings_page_exercise_top', array( $this, 'settings' ), 1, 1 ); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Return an instance of this class. |
|
33 | - * |
|
34 | - * @since 1.0.0 |
|
35 | - * |
|
36 | - * @return object \lsx_health_plan\classes\admin\Exercise() A single instance of this class. |
|
37 | - */ |
|
38 | - public static function get_instance() { |
|
39 | - // If the single instance hasn't been set, set it now. |
|
40 | - if ( null === self::$instance ) { |
|
41 | - self::$instance = new self(); |
|
42 | - } |
|
43 | - return self::$instance; |
|
44 | - } |
|
31 | + /** |
|
32 | + * Return an instance of this class. |
|
33 | + * |
|
34 | + * @since 1.0.0 |
|
35 | + * |
|
36 | + * @return object \lsx_health_plan\classes\admin\Exercise() A single instance of this class. |
|
37 | + */ |
|
38 | + public static function get_instance() { |
|
39 | + // If the single instance hasn't been set, set it now. |
|
40 | + if ( null === self::$instance ) { |
|
41 | + self::$instance = new self(); |
|
42 | + } |
|
43 | + return self::$instance; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Registers the general settings. |
|
48 | - * |
|
49 | - * @param object $cmb new_cmb2_box(). |
|
50 | - * @return void |
|
51 | - */ |
|
52 | - public function settings( $cmb ) { |
|
53 | - $cmb->add_field( |
|
54 | - array( |
|
55 | - 'name' => __( 'Exercises', 'lsx-health-plan' ), |
|
56 | - 'id' => 'exercise_enabled', |
|
57 | - 'type' => 'checkbox', |
|
58 | - 'value' => 1, |
|
59 | - 'default' => 0, |
|
60 | - 'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ), |
|
61 | - ) |
|
62 | - ); |
|
63 | - $cmb->add_field( |
|
64 | - array( |
|
65 | - 'id' => 'exercise_archive_description', |
|
66 | - 'type' => 'wysiwyg', |
|
67 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
68 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
69 | - 'options' => array( |
|
70 | - 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
71 | - ), |
|
72 | - ) |
|
73 | - ); |
|
74 | - $cmb->add_field( |
|
75 | - array( |
|
76 | - 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
77 | - 'name' => __( 'Single Exercise Slug', 'lsx-health-plan' ), |
|
78 | - 'id' => 'endpoint_exercise_single', |
|
79 | - 'type' => 'input', |
|
80 | - 'value' => '', |
|
81 | - 'default' => 'exercise', |
|
82 | - ) |
|
83 | - ); |
|
84 | - $cmb->add_field( |
|
85 | - array( |
|
86 | - 'name' => __( 'Archive Exercise Slug', 'lsx-health-plan' ), |
|
87 | - 'id' => 'endpoint_exercise_archive', |
|
88 | - 'type' => 'input', |
|
89 | - 'value' => '', |
|
90 | - 'default' => 'exercises', |
|
91 | - ) |
|
92 | - ); |
|
93 | - $cmb->add_field( |
|
94 | - array( |
|
95 | - 'name' => __( 'Exercise Type Slug', 'lsx-health-plan' ), |
|
96 | - 'id' => 'endpoint_exercise_type', |
|
97 | - 'type' => 'input', |
|
98 | - 'value' => '', |
|
99 | - 'default' => 'exercise-type', |
|
100 | - ) |
|
101 | - ); |
|
102 | - $cmb->add_field( |
|
103 | - array( |
|
104 | - 'name' => __( 'Equipment Slug', 'lsx-health-plan' ), |
|
105 | - 'id' => 'endpoint_exercise_equipment', |
|
106 | - 'type' => 'input', |
|
107 | - 'value' => '', |
|
108 | - 'default' => 'equipment', |
|
109 | - ) |
|
110 | - ); |
|
111 | - $cmb->add_field( |
|
112 | - array( |
|
113 | - 'name' => __( 'Muscle Group Slug', 'lsx-health-plan' ), |
|
114 | - 'id' => 'endpoint_exercise_musclegroup', |
|
115 | - 'type' => 'input', |
|
116 | - 'value' => '', |
|
117 | - 'default' => 'muscle-group', |
|
118 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
119 | - ) |
|
120 | - ); |
|
121 | - } |
|
46 | + /** |
|
47 | + * Registers the general settings. |
|
48 | + * |
|
49 | + * @param object $cmb new_cmb2_box(). |
|
50 | + * @return void |
|
51 | + */ |
|
52 | + public function settings( $cmb ) { |
|
53 | + $cmb->add_field( |
|
54 | + array( |
|
55 | + 'name' => __( 'Exercises', 'lsx-health-plan' ), |
|
56 | + 'id' => 'exercise_enabled', |
|
57 | + 'type' => 'checkbox', |
|
58 | + 'value' => 1, |
|
59 | + 'default' => 0, |
|
60 | + 'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ), |
|
61 | + ) |
|
62 | + ); |
|
63 | + $cmb->add_field( |
|
64 | + array( |
|
65 | + 'id' => 'exercise_archive_description', |
|
66 | + 'type' => 'wysiwyg', |
|
67 | + 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
68 | + 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
69 | + 'options' => array( |
|
70 | + 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
71 | + ), |
|
72 | + ) |
|
73 | + ); |
|
74 | + $cmb->add_field( |
|
75 | + array( |
|
76 | + 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
77 | + 'name' => __( 'Single Exercise Slug', 'lsx-health-plan' ), |
|
78 | + 'id' => 'endpoint_exercise_single', |
|
79 | + 'type' => 'input', |
|
80 | + 'value' => '', |
|
81 | + 'default' => 'exercise', |
|
82 | + ) |
|
83 | + ); |
|
84 | + $cmb->add_field( |
|
85 | + array( |
|
86 | + 'name' => __( 'Archive Exercise Slug', 'lsx-health-plan' ), |
|
87 | + 'id' => 'endpoint_exercise_archive', |
|
88 | + 'type' => 'input', |
|
89 | + 'value' => '', |
|
90 | + 'default' => 'exercises', |
|
91 | + ) |
|
92 | + ); |
|
93 | + $cmb->add_field( |
|
94 | + array( |
|
95 | + 'name' => __( 'Exercise Type Slug', 'lsx-health-plan' ), |
|
96 | + 'id' => 'endpoint_exercise_type', |
|
97 | + 'type' => 'input', |
|
98 | + 'value' => '', |
|
99 | + 'default' => 'exercise-type', |
|
100 | + ) |
|
101 | + ); |
|
102 | + $cmb->add_field( |
|
103 | + array( |
|
104 | + 'name' => __( 'Equipment Slug', 'lsx-health-plan' ), |
|
105 | + 'id' => 'endpoint_exercise_equipment', |
|
106 | + 'type' => 'input', |
|
107 | + 'value' => '', |
|
108 | + 'default' => 'equipment', |
|
109 | + ) |
|
110 | + ); |
|
111 | + $cmb->add_field( |
|
112 | + array( |
|
113 | + 'name' => __( 'Muscle Group Slug', 'lsx-health-plan' ), |
|
114 | + 'id' => 'endpoint_exercise_musclegroup', |
|
115 | + 'type' => 'input', |
|
116 | + 'value' => '', |
|
117 | + 'default' => 'muscle-group', |
|
118 | + 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
119 | + ) |
|
120 | + ); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | Exercise::get_instance(); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * Constructor |
26 | 26 | */ |
27 | 27 | public function __construct() { |
28 | - add_action( 'lsx_hp_settings_page_exercise_top', array( $this, 'settings' ), 1, 1 ); |
|
28 | + add_action('lsx_hp_settings_page_exercise_top', array($this, 'settings'), 1, 1); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function get_instance() { |
39 | 39 | // If the single instance hasn't been set, set it now. |
40 | - if ( null === self::$instance ) { |
|
40 | + if (null === self::$instance) { |
|
41 | 41 | self::$instance = new self(); |
42 | 42 | } |
43 | 43 | return self::$instance; |
@@ -49,23 +49,23 @@ discard block |
||
49 | 49 | * @param object $cmb new_cmb2_box(). |
50 | 50 | * @return void |
51 | 51 | */ |
52 | - public function settings( $cmb ) { |
|
52 | + public function settings($cmb) { |
|
53 | 53 | $cmb->add_field( |
54 | 54 | array( |
55 | - 'name' => __( 'Exercises', 'lsx-health-plan' ), |
|
55 | + 'name' => __('Exercises', 'lsx-health-plan'), |
|
56 | 56 | 'id' => 'exercise_enabled', |
57 | 57 | 'type' => 'checkbox', |
58 | 58 | 'value' => 1, |
59 | 59 | 'default' => 0, |
60 | - 'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ), |
|
60 | + 'description' => __('Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan'), |
|
61 | 61 | ) |
62 | 62 | ); |
63 | 63 | $cmb->add_field( |
64 | 64 | array( |
65 | 65 | 'id' => 'exercise_archive_description', |
66 | 66 | 'type' => 'wysiwyg', |
67 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
68 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
67 | + 'name' => __('Archive Description', 'lsx-health-plan'), |
|
68 | + 'description' => __('This will show up on the post type archive.', 'lsx-health-plan'), |
|
69 | 69 | 'options' => array( |
70 | 70 | 'textarea_rows' => get_option('default_post_edit_rows', 6), |
71 | 71 | ), |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $cmb->add_field( |
75 | 75 | array( |
76 | 76 | 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
77 | - 'name' => __( 'Single Exercise Slug', 'lsx-health-plan' ), |
|
77 | + 'name' => __('Single Exercise Slug', 'lsx-health-plan'), |
|
78 | 78 | 'id' => 'endpoint_exercise_single', |
79 | 79 | 'type' => 'input', |
80 | 80 | 'value' => '', |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | ); |
84 | 84 | $cmb->add_field( |
85 | 85 | array( |
86 | - 'name' => __( 'Archive Exercise Slug', 'lsx-health-plan' ), |
|
86 | + 'name' => __('Archive Exercise Slug', 'lsx-health-plan'), |
|
87 | 87 | 'id' => 'endpoint_exercise_archive', |
88 | 88 | 'type' => 'input', |
89 | 89 | 'value' => '', |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ); |
93 | 93 | $cmb->add_field( |
94 | 94 | array( |
95 | - 'name' => __( 'Exercise Type Slug', 'lsx-health-plan' ), |
|
95 | + 'name' => __('Exercise Type Slug', 'lsx-health-plan'), |
|
96 | 96 | 'id' => 'endpoint_exercise_type', |
97 | 97 | 'type' => 'input', |
98 | 98 | 'value' => '', |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | ); |
102 | 102 | $cmb->add_field( |
103 | 103 | array( |
104 | - 'name' => __( 'Equipment Slug', 'lsx-health-plan' ), |
|
104 | + 'name' => __('Equipment Slug', 'lsx-health-plan'), |
|
105 | 105 | 'id' => 'endpoint_exercise_equipment', |
106 | 106 | 'type' => 'input', |
107 | 107 | 'value' => '', |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | ); |
111 | 111 | $cmb->add_field( |
112 | 112 | array( |
113 | - 'name' => __( 'Muscle Group Slug', 'lsx-health-plan' ), |
|
113 | + 'name' => __('Muscle Group Slug', 'lsx-health-plan'), |
|
114 | 114 | 'id' => 'endpoint_exercise_musclegroup', |
115 | 115 | 'type' => 'input', |
116 | 116 | 'value' => '', |
117 | 117 | 'default' => 'muscle-group', |
118 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
118 | + 'after_row' => __('<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan'), |
|
119 | 119 | ) |
120 | 120 | ); |
121 | 121 | } |
@@ -12,269 +12,269 @@ |
||
12 | 12 | */ |
13 | 13 | class Settings { |
14 | 14 | |
15 | - /** |
|
16 | - * Holds class instance |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - * |
|
20 | - * @var object \lsx_health_plan\classes\admin\Settings() |
|
21 | - */ |
|
22 | - protected static $instance = null; |
|
23 | - |
|
24 | - /** |
|
25 | - * Option key, and option page slug |
|
26 | - * |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - protected $screen_id = 'lsx_health_plan_settings'; |
|
30 | - |
|
31 | - /** |
|
32 | - * An array of the post types for the Global Downloads field. |
|
33 | - * |
|
34 | - * @var array |
|
35 | - */ |
|
36 | - public $download_types = array(); |
|
37 | - |
|
38 | - /** |
|
39 | - * An array of the post types for the Global Defaults field. |
|
40 | - * |
|
41 | - * @var array |
|
42 | - */ |
|
43 | - //public $default_types = array(); |
|
44 | - |
|
45 | - /** |
|
46 | - * An array of the endpoints for the Endpoint Translation field. |
|
47 | - * |
|
48 | - * @var array |
|
49 | - */ |
|
50 | - public $endpoints = array(); |
|
51 | - |
|
52 | - /** |
|
53 | - * Constructor |
|
54 | - */ |
|
55 | - public function __construct() { |
|
56 | - $this->load_classes(); |
|
57 | - add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
58 | - add_action( 'lsx_hp_settings_page', array( $this, 'generate_tabs' ), 1, 1 ); |
|
59 | - |
|
60 | - add_action( 'lsx_hp_settings_page_general_top', array( $this, 'general_settings' ), 1, 1 ); |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * Return an instance of this class. |
|
65 | - * |
|
66 | - * @since 1.0.0 |
|
67 | - * |
|
68 | - * @return object \lsx_health_plan\classes\admin\Settings() A single instance of this class. |
|
69 | - */ |
|
70 | - public static function get_instance() { |
|
71 | - // If the single instance hasn't been set, set it now. |
|
72 | - if ( null === self::$instance ) { |
|
73 | - self::$instance = new self(); |
|
74 | - } |
|
75 | - return self::$instance; |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Loads the variable classes and the static classes. |
|
80 | - */ |
|
81 | - private function load_classes() { |
|
82 | - |
|
83 | - $this->post_types = array( |
|
84 | - 'plan', |
|
85 | - 'workout', |
|
86 | - 'exercise', |
|
87 | - 'meal', |
|
88 | - 'recipe', |
|
89 | - //'tip', |
|
90 | - ); |
|
91 | - |
|
92 | - foreach ( $this->post_types as $post_type ) { |
|
93 | - $this->$post_type = require_once LSX_HEALTH_PLAN_PATH . 'classes/admin/settings/class-' . $post_type . '.php'; |
|
94 | - } |
|
95 | - |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Hook in and register a submenu options page for the Page post-type menu. |
|
100 | - */ |
|
101 | - public function register_settings_page() { |
|
102 | - $cmb = new_cmb2_box( |
|
103 | - array( |
|
104 | - 'id' => $this->screen_id, |
|
105 | - 'title' => esc_html__( 'Settings', 'lsx-health-plan' ), |
|
106 | - 'object_types' => array( 'options-page' ), |
|
107 | - 'option_key' => 'lsx_health_plan_options', // The option key and admin menu page slug. |
|
108 | - 'parent_slug' => 'edit.php?post_type=plan', // Make options page a submenu item of the themes menu. |
|
109 | - 'capability' => 'manage_options', // Cap required to view options-page. |
|
110 | - ) |
|
111 | - ); |
|
112 | - do_action( 'lsx_hp_settings_page', $cmb ); |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * Registers the general settings. |
|
117 | - * |
|
118 | - * @param object $cmb new_cmb2_box(). |
|
119 | - * @return void |
|
120 | - */ |
|
121 | - public function general_settings( $cmb ) { |
|
122 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
123 | - $cmb->add_field( |
|
124 | - array( |
|
125 | - 'name' => __( 'Membership Product', 'lsx-health-plan' ), |
|
126 | - 'id' => 'membership_product', |
|
127 | - 'type' => 'post_search_ajax', |
|
128 | - 'limit' => 1, |
|
129 | - 'sortable' => false, |
|
130 | - 'query_args' => array( |
|
131 | - 'post_type' => array( 'product' ), |
|
132 | - 'post_status' => array( 'publish' ), |
|
133 | - 'posts_per_page' => -1, |
|
134 | - ), |
|
135 | - ) |
|
136 | - ); |
|
137 | - } |
|
138 | - |
|
139 | - if ( false === \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
140 | - $cmb->add_field( |
|
141 | - array( |
|
142 | - 'name' => __( 'Exercises', 'lsx-health-plan' ), |
|
143 | - 'id' => 'exercise_enabled', |
|
144 | - 'type' => 'checkbox', |
|
145 | - 'value' => 1, |
|
146 | - 'default' => 0, |
|
147 | - 'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ), |
|
148 | - ) |
|
149 | - ); |
|
150 | - } |
|
151 | - |
|
152 | - |
|
153 | - if ( \lsx_health_plan\functions\get_option( 'workout_disabled' ) ) { |
|
154 | - $cmb->add_field( |
|
155 | - array( |
|
156 | - 'name' => __( 'Disable Workouts', 'lsx-health-plan' ), |
|
157 | - 'id' => 'workout_disabled', |
|
158 | - 'type' => 'checkbox', |
|
159 | - 'value' => 1, |
|
160 | - 'default' => 0, |
|
161 | - 'description' => __( 'Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
162 | - ) |
|
163 | - ); |
|
164 | - } |
|
165 | - |
|
166 | - if ( \lsx_health_plan\functions\get_option( 'recipe_disabled' ) ) { |
|
167 | - $cmb->add_field( |
|
168 | - array( |
|
169 | - 'name' => __( 'Disable Recipes', 'lsx-health-plan' ), |
|
170 | - 'id' => 'recipe_disabled', |
|
171 | - 'type' => 'checkbox', |
|
172 | - 'value' => 1, |
|
173 | - 'default' => 0, |
|
174 | - 'description' => __( 'Disable recipe post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
175 | - ) |
|
176 | - ); |
|
177 | - } |
|
178 | - |
|
179 | - if ( \lsx_health_plan\functions\get_option( 'meal_disabled' ) ) { |
|
180 | - $cmb->add_field( |
|
181 | - array( |
|
182 | - 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
183 | - 'id' => 'meal_disabled', |
|
184 | - 'type' => 'checkbox', |
|
185 | - 'value' => 1, |
|
186 | - 'default' => 0, |
|
187 | - 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
188 | - ) |
|
189 | - ); |
|
190 | - } |
|
15 | + /** |
|
16 | + * Holds class instance |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + * |
|
20 | + * @var object \lsx_health_plan\classes\admin\Settings() |
|
21 | + */ |
|
22 | + protected static $instance = null; |
|
23 | + |
|
24 | + /** |
|
25 | + * Option key, and option page slug |
|
26 | + * |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + protected $screen_id = 'lsx_health_plan_settings'; |
|
30 | + |
|
31 | + /** |
|
32 | + * An array of the post types for the Global Downloads field. |
|
33 | + * |
|
34 | + * @var array |
|
35 | + */ |
|
36 | + public $download_types = array(); |
|
37 | + |
|
38 | + /** |
|
39 | + * An array of the post types for the Global Defaults field. |
|
40 | + * |
|
41 | + * @var array |
|
42 | + */ |
|
43 | + //public $default_types = array(); |
|
44 | + |
|
45 | + /** |
|
46 | + * An array of the endpoints for the Endpoint Translation field. |
|
47 | + * |
|
48 | + * @var array |
|
49 | + */ |
|
50 | + public $endpoints = array(); |
|
51 | + |
|
52 | + /** |
|
53 | + * Constructor |
|
54 | + */ |
|
55 | + public function __construct() { |
|
56 | + $this->load_classes(); |
|
57 | + add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
58 | + add_action( 'lsx_hp_settings_page', array( $this, 'generate_tabs' ), 1, 1 ); |
|
59 | + |
|
60 | + add_action( 'lsx_hp_settings_page_general_top', array( $this, 'general_settings' ), 1, 1 ); |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * Return an instance of this class. |
|
65 | + * |
|
66 | + * @since 1.0.0 |
|
67 | + * |
|
68 | + * @return object \lsx_health_plan\classes\admin\Settings() A single instance of this class. |
|
69 | + */ |
|
70 | + public static function get_instance() { |
|
71 | + // If the single instance hasn't been set, set it now. |
|
72 | + if ( null === self::$instance ) { |
|
73 | + self::$instance = new self(); |
|
74 | + } |
|
75 | + return self::$instance; |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Loads the variable classes and the static classes. |
|
80 | + */ |
|
81 | + private function load_classes() { |
|
82 | + |
|
83 | + $this->post_types = array( |
|
84 | + 'plan', |
|
85 | + 'workout', |
|
86 | + 'exercise', |
|
87 | + 'meal', |
|
88 | + 'recipe', |
|
89 | + //'tip', |
|
90 | + ); |
|
91 | + |
|
92 | + foreach ( $this->post_types as $post_type ) { |
|
93 | + $this->$post_type = require_once LSX_HEALTH_PLAN_PATH . 'classes/admin/settings/class-' . $post_type . '.php'; |
|
94 | + } |
|
95 | + |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Hook in and register a submenu options page for the Page post-type menu. |
|
100 | + */ |
|
101 | + public function register_settings_page() { |
|
102 | + $cmb = new_cmb2_box( |
|
103 | + array( |
|
104 | + 'id' => $this->screen_id, |
|
105 | + 'title' => esc_html__( 'Settings', 'lsx-health-plan' ), |
|
106 | + 'object_types' => array( 'options-page' ), |
|
107 | + 'option_key' => 'lsx_health_plan_options', // The option key and admin menu page slug. |
|
108 | + 'parent_slug' => 'edit.php?post_type=plan', // Make options page a submenu item of the themes menu. |
|
109 | + 'capability' => 'manage_options', // Cap required to view options-page. |
|
110 | + ) |
|
111 | + ); |
|
112 | + do_action( 'lsx_hp_settings_page', $cmb ); |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * Registers the general settings. |
|
117 | + * |
|
118 | + * @param object $cmb new_cmb2_box(). |
|
119 | + * @return void |
|
120 | + */ |
|
121 | + public function general_settings( $cmb ) { |
|
122 | + if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
123 | + $cmb->add_field( |
|
124 | + array( |
|
125 | + 'name' => __( 'Membership Product', 'lsx-health-plan' ), |
|
126 | + 'id' => 'membership_product', |
|
127 | + 'type' => 'post_search_ajax', |
|
128 | + 'limit' => 1, |
|
129 | + 'sortable' => false, |
|
130 | + 'query_args' => array( |
|
131 | + 'post_type' => array( 'product' ), |
|
132 | + 'post_status' => array( 'publish' ), |
|
133 | + 'posts_per_page' => -1, |
|
134 | + ), |
|
135 | + ) |
|
136 | + ); |
|
137 | + } |
|
138 | + |
|
139 | + if ( false === \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
140 | + $cmb->add_field( |
|
141 | + array( |
|
142 | + 'name' => __( 'Exercises', 'lsx-health-plan' ), |
|
143 | + 'id' => 'exercise_enabled', |
|
144 | + 'type' => 'checkbox', |
|
145 | + 'value' => 1, |
|
146 | + 'default' => 0, |
|
147 | + 'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ), |
|
148 | + ) |
|
149 | + ); |
|
150 | + } |
|
151 | + |
|
152 | + |
|
153 | + if ( \lsx_health_plan\functions\get_option( 'workout_disabled' ) ) { |
|
154 | + $cmb->add_field( |
|
155 | + array( |
|
156 | + 'name' => __( 'Disable Workouts', 'lsx-health-plan' ), |
|
157 | + 'id' => 'workout_disabled', |
|
158 | + 'type' => 'checkbox', |
|
159 | + 'value' => 1, |
|
160 | + 'default' => 0, |
|
161 | + 'description' => __( 'Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
162 | + ) |
|
163 | + ); |
|
164 | + } |
|
165 | + |
|
166 | + if ( \lsx_health_plan\functions\get_option( 'recipe_disabled' ) ) { |
|
167 | + $cmb->add_field( |
|
168 | + array( |
|
169 | + 'name' => __( 'Disable Recipes', 'lsx-health-plan' ), |
|
170 | + 'id' => 'recipe_disabled', |
|
171 | + 'type' => 'checkbox', |
|
172 | + 'value' => 1, |
|
173 | + 'default' => 0, |
|
174 | + 'description' => __( 'Disable recipe post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
175 | + ) |
|
176 | + ); |
|
177 | + } |
|
178 | + |
|
179 | + if ( \lsx_health_plan\functions\get_option( 'meal_disabled' ) ) { |
|
180 | + $cmb->add_field( |
|
181 | + array( |
|
182 | + 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
183 | + 'id' => 'meal_disabled', |
|
184 | + 'type' => 'checkbox', |
|
185 | + 'value' => 1, |
|
186 | + 'default' => 0, |
|
187 | + 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
188 | + ) |
|
189 | + ); |
|
190 | + } |
|
191 | 191 | |
192 | 192 | |
193 | - $cmb->add_field( |
|
194 | - array( |
|
195 | - 'name' => __( 'Login Slug', 'lsx-health-plan' ), |
|
196 | - 'id' => 'login_slug', |
|
197 | - 'type' => 'input', |
|
198 | - 'value' => '', |
|
199 | - 'default' => 'login', |
|
200 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
201 | - ) |
|
202 | - ); |
|
203 | - |
|
204 | - } |
|
205 | - |
|
206 | - /** |
|
207 | - * Enable Business Directory Search settings only if LSX Search plugin is enabled. |
|
208 | - * |
|
209 | - * @param object $cmb The CMB2() class. |
|
210 | - * @param string $section either engine,archive or single. |
|
211 | - * @return void |
|
212 | - */ |
|
213 | - public function generate_tabs( $cmb ) { |
|
214 | - $tabs = $this->get_settings_tabs(); |
|
215 | - |
|
216 | - foreach ( $tabs as $tab_key => $tab ) { |
|
217 | - $cmb->add_field( |
|
218 | - array( |
|
219 | - 'id' => 'settings_' . $tab_key . '_title', |
|
220 | - 'type' => 'title', |
|
221 | - 'name' => $tab['title'], |
|
222 | - 'default' => $tab['title'], |
|
223 | - 'description' => $tab['desc'], |
|
224 | - ) |
|
225 | - ); |
|
226 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_top', $cmb ); |
|
227 | - |
|
228 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_middle', $cmb ); |
|
229 | - |
|
230 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb ); |
|
231 | - |
|
232 | - $cmb->add_field( |
|
233 | - array( |
|
234 | - 'id' => 'settings_' . $tab_key . '_closing', |
|
235 | - 'type' => 'tab_closing', |
|
236 | - ) |
|
237 | - ); |
|
238 | - } |
|
239 | - } |
|
240 | - |
|
241 | - |
|
242 | - /** |
|
243 | - * Returns the tabs and their descriptions. |
|
244 | - * |
|
245 | - * @return array |
|
246 | - */ |
|
247 | - public function get_settings_tabs() { |
|
248 | - $tabs = array( |
|
249 | - 'general' => array( |
|
250 | - 'title' => __( 'General', 'lsx-health-plan' ), |
|
251 | - 'desc' => __( 'Control the sitewide settings for the LSX HP site.', 'lsx-health-plan' ), |
|
252 | - ), |
|
253 | - ); |
|
254 | - |
|
255 | - foreach ( $this->post_types as $post_type ) { |
|
256 | - switch ( $post_type ) { |
|
257 | - default: |
|
258 | - //if ( ! in_array( $post_type, \lsx\search\includes\get_restricted_post_types() ) ) { |
|
259 | - $temp_post_type = get_post_type_object( $post_type ); |
|
260 | - if ( ! is_wp_error( $temp_post_type ) ) { |
|
261 | - $page_url = get_post_type_archive_link( $temp_post_type->name ); |
|
262 | - $description = sprintf( |
|
263 | - /* translators: %s: The subscription info */ |
|
264 | - __( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ), |
|
265 | - $page_url, |
|
266 | - $temp_post_type->label |
|
267 | - ); |
|
268 | - |
|
269 | - $tabs[ $post_type ] = array( |
|
270 | - 'title' => $temp_post_type->label, |
|
271 | - 'desc' => $description, |
|
272 | - ); |
|
273 | - } |
|
274 | - //} |
|
275 | - break; |
|
276 | - } |
|
277 | - } |
|
278 | - return $tabs; |
|
279 | - } |
|
193 | + $cmb->add_field( |
|
194 | + array( |
|
195 | + 'name' => __( 'Login Slug', 'lsx-health-plan' ), |
|
196 | + 'id' => 'login_slug', |
|
197 | + 'type' => 'input', |
|
198 | + 'value' => '', |
|
199 | + 'default' => 'login', |
|
200 | + 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
201 | + ) |
|
202 | + ); |
|
203 | + |
|
204 | + } |
|
205 | + |
|
206 | + /** |
|
207 | + * Enable Business Directory Search settings only if LSX Search plugin is enabled. |
|
208 | + * |
|
209 | + * @param object $cmb The CMB2() class. |
|
210 | + * @param string $section either engine,archive or single. |
|
211 | + * @return void |
|
212 | + */ |
|
213 | + public function generate_tabs( $cmb ) { |
|
214 | + $tabs = $this->get_settings_tabs(); |
|
215 | + |
|
216 | + foreach ( $tabs as $tab_key => $tab ) { |
|
217 | + $cmb->add_field( |
|
218 | + array( |
|
219 | + 'id' => 'settings_' . $tab_key . '_title', |
|
220 | + 'type' => 'title', |
|
221 | + 'name' => $tab['title'], |
|
222 | + 'default' => $tab['title'], |
|
223 | + 'description' => $tab['desc'], |
|
224 | + ) |
|
225 | + ); |
|
226 | + do_action( 'lsx_hp_settings_page_' . $tab_key . '_top', $cmb ); |
|
227 | + |
|
228 | + do_action( 'lsx_hp_settings_page_' . $tab_key . '_middle', $cmb ); |
|
229 | + |
|
230 | + do_action( 'lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb ); |
|
231 | + |
|
232 | + $cmb->add_field( |
|
233 | + array( |
|
234 | + 'id' => 'settings_' . $tab_key . '_closing', |
|
235 | + 'type' => 'tab_closing', |
|
236 | + ) |
|
237 | + ); |
|
238 | + } |
|
239 | + } |
|
240 | + |
|
241 | + |
|
242 | + /** |
|
243 | + * Returns the tabs and their descriptions. |
|
244 | + * |
|
245 | + * @return array |
|
246 | + */ |
|
247 | + public function get_settings_tabs() { |
|
248 | + $tabs = array( |
|
249 | + 'general' => array( |
|
250 | + 'title' => __( 'General', 'lsx-health-plan' ), |
|
251 | + 'desc' => __( 'Control the sitewide settings for the LSX HP site.', 'lsx-health-plan' ), |
|
252 | + ), |
|
253 | + ); |
|
254 | + |
|
255 | + foreach ( $this->post_types as $post_type ) { |
|
256 | + switch ( $post_type ) { |
|
257 | + default: |
|
258 | + //if ( ! in_array( $post_type, \lsx\search\includes\get_restricted_post_types() ) ) { |
|
259 | + $temp_post_type = get_post_type_object( $post_type ); |
|
260 | + if ( ! is_wp_error( $temp_post_type ) ) { |
|
261 | + $page_url = get_post_type_archive_link( $temp_post_type->name ); |
|
262 | + $description = sprintf( |
|
263 | + /* translators: %s: The subscription info */ |
|
264 | + __( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ), |
|
265 | + $page_url, |
|
266 | + $temp_post_type->label |
|
267 | + ); |
|
268 | + |
|
269 | + $tabs[ $post_type ] = array( |
|
270 | + 'title' => $temp_post_type->label, |
|
271 | + 'desc' => $description, |
|
272 | + ); |
|
273 | + } |
|
274 | + //} |
|
275 | + break; |
|
276 | + } |
|
277 | + } |
|
278 | + return $tabs; |
|
279 | + } |
|
280 | 280 | } |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function __construct() { |
56 | 56 | $this->load_classes(); |
57 | - add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
58 | - add_action( 'lsx_hp_settings_page', array( $this, 'generate_tabs' ), 1, 1 ); |
|
57 | + add_action('cmb2_admin_init', array($this, 'register_settings_page')); |
|
58 | + add_action('lsx_hp_settings_page', array($this, 'generate_tabs'), 1, 1); |
|
59 | 59 | |
60 | - add_action( 'lsx_hp_settings_page_general_top', array( $this, 'general_settings' ), 1, 1 ); |
|
60 | + add_action('lsx_hp_settings_page_general_top', array($this, 'general_settings'), 1, 1); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public static function get_instance() { |
71 | 71 | // If the single instance hasn't been set, set it now. |
72 | - if ( null === self::$instance ) { |
|
72 | + if (null === self::$instance) { |
|
73 | 73 | self::$instance = new self(); |
74 | 74 | } |
75 | 75 | return self::$instance; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | //'tip', |
90 | 90 | ); |
91 | 91 | |
92 | - foreach ( $this->post_types as $post_type ) { |
|
92 | + foreach ($this->post_types as $post_type) { |
|
93 | 93 | $this->$post_type = require_once LSX_HEALTH_PLAN_PATH . 'classes/admin/settings/class-' . $post_type . '.php'; |
94 | 94 | } |
95 | 95 | |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | $cmb = new_cmb2_box( |
103 | 103 | array( |
104 | 104 | 'id' => $this->screen_id, |
105 | - 'title' => esc_html__( 'Settings', 'lsx-health-plan' ), |
|
106 | - 'object_types' => array( 'options-page' ), |
|
105 | + 'title' => esc_html__('Settings', 'lsx-health-plan'), |
|
106 | + 'object_types' => array('options-page'), |
|
107 | 107 | 'option_key' => 'lsx_health_plan_options', // The option key and admin menu page slug. |
108 | 108 | 'parent_slug' => 'edit.php?post_type=plan', // Make options page a submenu item of the themes menu. |
109 | 109 | 'capability' => 'manage_options', // Cap required to view options-page. |
110 | 110 | ) |
111 | 111 | ); |
112 | - do_action( 'lsx_hp_settings_page', $cmb ); |
|
112 | + do_action('lsx_hp_settings_page', $cmb); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -118,73 +118,73 @@ discard block |
||
118 | 118 | * @param object $cmb new_cmb2_box(). |
119 | 119 | * @return void |
120 | 120 | */ |
121 | - public function general_settings( $cmb ) { |
|
122 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
121 | + public function general_settings($cmb) { |
|
122 | + if (function_exists('wc_memberships_is_post_content_restricted')) { |
|
123 | 123 | $cmb->add_field( |
124 | 124 | array( |
125 | - 'name' => __( 'Membership Product', 'lsx-health-plan' ), |
|
125 | + 'name' => __('Membership Product', 'lsx-health-plan'), |
|
126 | 126 | 'id' => 'membership_product', |
127 | 127 | 'type' => 'post_search_ajax', |
128 | 128 | 'limit' => 1, |
129 | 129 | 'sortable' => false, |
130 | 130 | 'query_args' => array( |
131 | - 'post_type' => array( 'product' ), |
|
132 | - 'post_status' => array( 'publish' ), |
|
131 | + 'post_type' => array('product'), |
|
132 | + 'post_status' => array('publish'), |
|
133 | 133 | 'posts_per_page' => -1, |
134 | 134 | ), |
135 | 135 | ) |
136 | 136 | ); |
137 | 137 | } |
138 | 138 | |
139 | - if ( false === \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
139 | + if (false === \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
140 | 140 | $cmb->add_field( |
141 | 141 | array( |
142 | - 'name' => __( 'Exercises', 'lsx-health-plan' ), |
|
142 | + 'name' => __('Exercises', 'lsx-health-plan'), |
|
143 | 143 | 'id' => 'exercise_enabled', |
144 | 144 | 'type' => 'checkbox', |
145 | 145 | 'value' => 1, |
146 | 146 | 'default' => 0, |
147 | - 'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ), |
|
147 | + 'description' => __('Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan'), |
|
148 | 148 | ) |
149 | 149 | ); |
150 | 150 | } |
151 | 151 | |
152 | 152 | |
153 | - if ( \lsx_health_plan\functions\get_option( 'workout_disabled' ) ) { |
|
153 | + if (\lsx_health_plan\functions\get_option('workout_disabled')) { |
|
154 | 154 | $cmb->add_field( |
155 | 155 | array( |
156 | - 'name' => __( 'Disable Workouts', 'lsx-health-plan' ), |
|
156 | + 'name' => __('Disable Workouts', 'lsx-health-plan'), |
|
157 | 157 | 'id' => 'workout_disabled', |
158 | 158 | 'type' => 'checkbox', |
159 | 159 | 'value' => 1, |
160 | 160 | 'default' => 0, |
161 | - 'description' => __( 'Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
161 | + 'description' => __('Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan'), |
|
162 | 162 | ) |
163 | 163 | ); |
164 | 164 | } |
165 | 165 | |
166 | - if ( \lsx_health_plan\functions\get_option( 'recipe_disabled' ) ) { |
|
166 | + if (\lsx_health_plan\functions\get_option('recipe_disabled')) { |
|
167 | 167 | $cmb->add_field( |
168 | 168 | array( |
169 | - 'name' => __( 'Disable Recipes', 'lsx-health-plan' ), |
|
169 | + 'name' => __('Disable Recipes', 'lsx-health-plan'), |
|
170 | 170 | 'id' => 'recipe_disabled', |
171 | 171 | 'type' => 'checkbox', |
172 | 172 | 'value' => 1, |
173 | 173 | 'default' => 0, |
174 | - 'description' => __( 'Disable recipe post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
174 | + 'description' => __('Disable recipe post type if you are wanting a minimal site.', 'lsx-health-plan'), |
|
175 | 175 | ) |
176 | 176 | ); |
177 | 177 | } |
178 | 178 | |
179 | - if ( \lsx_health_plan\functions\get_option( 'meal_disabled' ) ) { |
|
179 | + if (\lsx_health_plan\functions\get_option('meal_disabled')) { |
|
180 | 180 | $cmb->add_field( |
181 | 181 | array( |
182 | - 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
182 | + 'name' => __('Disable Meals', 'lsx-health-plan'), |
|
183 | 183 | 'id' => 'meal_disabled', |
184 | 184 | 'type' => 'checkbox', |
185 | 185 | 'value' => 1, |
186 | 186 | 'default' => 0, |
187 | - 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
187 | + 'description' => __('Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan'), |
|
188 | 188 | ) |
189 | 189 | ); |
190 | 190 | } |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | |
193 | 193 | $cmb->add_field( |
194 | 194 | array( |
195 | - 'name' => __( 'Login Slug', 'lsx-health-plan' ), |
|
195 | + 'name' => __('Login Slug', 'lsx-health-plan'), |
|
196 | 196 | 'id' => 'login_slug', |
197 | 197 | 'type' => 'input', |
198 | 198 | 'value' => '', |
199 | 199 | 'default' => 'login', |
200 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
200 | + 'after_row' => __('<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan'), |
|
201 | 201 | ) |
202 | 202 | ); |
203 | 203 | |
@@ -210,10 +210,10 @@ discard block |
||
210 | 210 | * @param string $section either engine,archive or single. |
211 | 211 | * @return void |
212 | 212 | */ |
213 | - public function generate_tabs( $cmb ) { |
|
213 | + public function generate_tabs($cmb) { |
|
214 | 214 | $tabs = $this->get_settings_tabs(); |
215 | 215 | |
216 | - foreach ( $tabs as $tab_key => $tab ) { |
|
216 | + foreach ($tabs as $tab_key => $tab) { |
|
217 | 217 | $cmb->add_field( |
218 | 218 | array( |
219 | 219 | 'id' => 'settings_' . $tab_key . '_title', |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | 'description' => $tab['desc'], |
224 | 224 | ) |
225 | 225 | ); |
226 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_top', $cmb ); |
|
226 | + do_action('lsx_hp_settings_page_' . $tab_key . '_top', $cmb); |
|
227 | 227 | |
228 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_middle', $cmb ); |
|
228 | + do_action('lsx_hp_settings_page_' . $tab_key . '_middle', $cmb); |
|
229 | 229 | |
230 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb ); |
|
230 | + do_action('lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb); |
|
231 | 231 | |
232 | 232 | $cmb->add_field( |
233 | 233 | array( |
@@ -247,26 +247,26 @@ discard block |
||
247 | 247 | public function get_settings_tabs() { |
248 | 248 | $tabs = array( |
249 | 249 | 'general' => array( |
250 | - 'title' => __( 'General', 'lsx-health-plan' ), |
|
251 | - 'desc' => __( 'Control the sitewide settings for the LSX HP site.', 'lsx-health-plan' ), |
|
250 | + 'title' => __('General', 'lsx-health-plan'), |
|
251 | + 'desc' => __('Control the sitewide settings for the LSX HP site.', 'lsx-health-plan'), |
|
252 | 252 | ), |
253 | 253 | ); |
254 | 254 | |
255 | - foreach ( $this->post_types as $post_type ) { |
|
256 | - switch ( $post_type ) { |
|
255 | + foreach ($this->post_types as $post_type) { |
|
256 | + switch ($post_type) { |
|
257 | 257 | default: |
258 | 258 | //if ( ! in_array( $post_type, \lsx\search\includes\get_restricted_post_types() ) ) { |
259 | - $temp_post_type = get_post_type_object( $post_type ); |
|
260 | - if ( ! is_wp_error( $temp_post_type ) ) { |
|
261 | - $page_url = get_post_type_archive_link( $temp_post_type->name ); |
|
259 | + $temp_post_type = get_post_type_object($post_type); |
|
260 | + if ( ! is_wp_error($temp_post_type)) { |
|
261 | + $page_url = get_post_type_archive_link($temp_post_type->name); |
|
262 | 262 | $description = sprintf( |
263 | 263 | /* translators: %s: The subscription info */ |
264 | - __( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ), |
|
264 | + __('Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search'), |
|
265 | 265 | $page_url, |
266 | 266 | $temp_post_type->label |
267 | 267 | ); |
268 | 268 | |
269 | - $tabs[ $post_type ] = array( |
|
269 | + $tabs[$post_type] = array( |
|
270 | 270 | 'title' => $temp_post_type->label, |
271 | 271 | 'desc' => $description, |
272 | 272 | ); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | $sharing = 'sharing-disabled'; |
19 | 19 | if ( class_exists( 'LSX_Sharing' ) || ( function_exists( 'sharing_display' ) || class_exists( 'Jetpack_Likes' ) ) ) : |
20 | - $sharing = 'sharing-enabled'; |
|
20 | + $sharing = 'sharing-enabled'; |
|
21 | 21 | endif; |
22 | 22 | |
23 | 23 | ?> |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | <?php if ( class_exists( 'LSX_Sharing' ) || ( function_exists( 'sharing_display' ) || class_exists( 'Jetpack_Likes' ) ) ) : ?> |
39 | 39 | |
40 | 40 | <?php |
41 | - if ( class_exists( 'LSX_Sharing' ) ) { |
|
42 | - lsx_content_sharing(); |
|
43 | - } else { |
|
44 | - if ( function_exists( 'sharing_display' ) ) { |
|
45 | - sharing_display( '', true ); |
|
46 | - } |
|
47 | - |
|
48 | - if ( class_exists( 'Jetpack_Likes' ) ) { |
|
49 | - $custom_likes = new Jetpack_Likes(); |
|
50 | - echo wp_kses_post( $custom_likes->post_likes( '' ) ); |
|
51 | - } |
|
52 | - } |
|
53 | - ?> |
|
41 | + if ( class_exists( 'LSX_Sharing' ) ) { |
|
42 | + lsx_content_sharing(); |
|
43 | + } else { |
|
44 | + if ( function_exists( 'sharing_display' ) ) { |
|
45 | + sharing_display( '', true ); |
|
46 | + } |
|
47 | + |
|
48 | + if ( class_exists( 'Jetpack_Likes' ) ) { |
|
49 | + $custom_likes = new Jetpack_Likes(); |
|
50 | + echo wp_kses_post( $custom_likes->post_likes( '' ) ); |
|
51 | + } |
|
52 | + } |
|
53 | + ?> |
|
54 | 54 | <?php endif ?> |
55 | 55 | |
56 | 56 | <?php lsx_health_plan_exercise_title( '<h2>', '</h2>' ); ?> |
@@ -60,23 +60,23 @@ discard block |
||
60 | 60 | <div class="col-md-6 exercise-image lsx-hp-shadow"> |
61 | 61 | |
62 | 62 | <?php |
63 | - $lsx_hp = lsx_health_plan(); |
|
64 | - |
|
65 | - if ( $lsx_hp->frontend->gallery->has_gallery( get_the_ID() ) ) { |
|
66 | - lsx_health_plan_gallery(); |
|
67 | - } else { |
|
68 | - $featured_image = get_the_post_thumbnail(); |
|
69 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
70 | - the_post_thumbnail( 'large', array( |
|
71 | - 'class' => 'aligncenter', |
|
72 | - ) ); |
|
73 | - } else { |
|
74 | - ?> |
|
63 | + $lsx_hp = lsx_health_plan(); |
|
64 | + |
|
65 | + if ( $lsx_hp->frontend->gallery->has_gallery( get_the_ID() ) ) { |
|
66 | + lsx_health_plan_gallery(); |
|
67 | + } else { |
|
68 | + $featured_image = get_the_post_thumbnail(); |
|
69 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
70 | + the_post_thumbnail( 'large', array( |
|
71 | + 'class' => 'aligncenter', |
|
72 | + ) ); |
|
73 | + } else { |
|
74 | + ?> |
|
75 | 75 | <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
76 | 76 | <?php |
77 | - } |
|
78 | - } |
|
79 | - ?> |
|
77 | + } |
|
78 | + } |
|
79 | + ?> |
|
80 | 80 | |
81 | 81 | <?php if ( ( ! empty( $exercise_type ) ) || ( ! empty( $equipment ) ) || ( ! empty( $muscle_group ) ) ) { ?> |
82 | 82 | <div class="exercise-data"> |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | <?php echo do_shortcode( '[lsx_health_plan_featured_tips_block]' ); ?> |
90 | 90 | <div class="back-plan-btn"> |
91 | 91 | <?php |
92 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
93 | - ?> |
|
92 | + if ( function_exists( 'wc_get_page_id' ) ) { |
|
93 | + ?> |
|
94 | 94 | <a class="btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'Back to my plans', 'lsx-health-plan' ); ?></a> |
95 | 95 | <?php |
96 | - } |
|
97 | - ?> |
|
96 | + } |
|
97 | + ?> |
|
98 | 98 | </div> |
99 | 99 | </div> |
100 | 100 | </div> |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | <?php |
108 | 108 | if ( ! empty( $connected_articles ) ) { |
109 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
109 | + lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
110 | 110 | } |
111 | 111 | ?> |
112 | 112 |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | $muscle_group = lsx_health_plan_muscle_group_equipment(); |
11 | 11 | |
12 | 12 | // Getting translated endpoint. |
13 | -$exercise = \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ); |
|
13 | +$exercise = \lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'); |
|
14 | 14 | |
15 | -$connected_members = get_post_meta( get_the_ID(), ( $exercise . '_connected_team_member' ), true ); |
|
16 | -$connected_articles = get_post_meta( get_the_ID(), ( $exercise . '_connected_articles' ), true ); |
|
15 | +$connected_members = get_post_meta(get_the_ID(), ($exercise . '_connected_team_member'), true); |
|
16 | +$connected_articles = get_post_meta(get_the_ID(), ($exercise . '_connected_articles'), true); |
|
17 | 17 | |
18 | 18 | $sharing = 'sharing-disabled'; |
19 | -if ( class_exists( 'LSX_Sharing' ) || ( function_exists( 'sharing_display' ) || class_exists( 'Jetpack_Likes' ) ) ) : |
|
19 | +if (class_exists('LSX_Sharing') || (function_exists('sharing_display') || class_exists('Jetpack_Likes'))) : |
|
20 | 20 | $sharing = 'sharing-enabled'; |
21 | 21 | endif; |
22 | 22 | |
@@ -34,51 +34,51 @@ discard block |
||
34 | 34 | |
35 | 35 | <div id="single-exercise" class="entry-content"> |
36 | 36 | |
37 | - <div class="exercise-title-section title-lined <?php echo esc_html( $sharing ); ?>"> |
|
38 | - <?php if ( class_exists( 'LSX_Sharing' ) || ( function_exists( 'sharing_display' ) || class_exists( 'Jetpack_Likes' ) ) ) : ?> |
|
37 | + <div class="exercise-title-section title-lined <?php echo esc_html($sharing); ?>"> |
|
38 | + <?php if (class_exists('LSX_Sharing') || (function_exists('sharing_display') || class_exists('Jetpack_Likes'))) : ?> |
|
39 | 39 | |
40 | 40 | <?php |
41 | - if ( class_exists( 'LSX_Sharing' ) ) { |
|
41 | + if (class_exists('LSX_Sharing')) { |
|
42 | 42 | lsx_content_sharing(); |
43 | 43 | } else { |
44 | - if ( function_exists( 'sharing_display' ) ) { |
|
45 | - sharing_display( '', true ); |
|
44 | + if (function_exists('sharing_display')) { |
|
45 | + sharing_display('', true); |
|
46 | 46 | } |
47 | 47 | |
48 | - if ( class_exists( 'Jetpack_Likes' ) ) { |
|
48 | + if (class_exists('Jetpack_Likes')) { |
|
49 | 49 | $custom_likes = new Jetpack_Likes(); |
50 | - echo wp_kses_post( $custom_likes->post_likes( '' ) ); |
|
50 | + echo wp_kses_post($custom_likes->post_likes('')); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | ?> |
54 | 54 | <?php endif ?> |
55 | 55 | |
56 | - <?php lsx_health_plan_exercise_title( '<h2>', '</h2>' ); ?> |
|
56 | + <?php lsx_health_plan_exercise_title('<h2>', '</h2>'); ?> |
|
57 | 57 | </div> |
58 | - <?php echo wp_kses_post( lsx_hp_member_connected( $connected_members, 'exercise' ) ); ?> |
|
58 | + <?php echo wp_kses_post(lsx_hp_member_connected($connected_members, 'exercise')); ?> |
|
59 | 59 | <div class="row"> |
60 | 60 | <div class="col-md-6 exercise-image lsx-hp-shadow"> |
61 | 61 | |
62 | 62 | <?php |
63 | 63 | $lsx_hp = lsx_health_plan(); |
64 | 64 | |
65 | - if ( $lsx_hp->frontend->gallery->has_gallery( get_the_ID() ) ) { |
|
65 | + if ($lsx_hp->frontend->gallery->has_gallery(get_the_ID())) { |
|
66 | 66 | lsx_health_plan_gallery(); |
67 | 67 | } else { |
68 | 68 | $featured_image = get_the_post_thumbnail(); |
69 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
70 | - the_post_thumbnail( 'large', array( |
|
69 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
70 | + the_post_thumbnail('large', array( |
|
71 | 71 | 'class' => 'aligncenter', |
72 | - ) ); |
|
72 | + )); |
|
73 | 73 | } else { |
74 | 74 | ?> |
75 | - <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
|
75 | + <img loading="lazy" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> |
|
76 | 76 | <?php |
77 | 77 | } |
78 | 78 | } |
79 | 79 | ?> |
80 | 80 | |
81 | - <?php if ( ( ! empty( $exercise_type ) ) || ( ! empty( $equipment ) ) || ( ! empty( $muscle_group ) ) ) { ?> |
|
81 | + <?php if (( ! empty($exercise_type)) || ( ! empty($equipment)) || ( ! empty($muscle_group))) { ?> |
|
82 | 82 | <div class="exercise-data"> |
83 | 83 | <?php lsx_health_plan_exercise_data(); ?> |
84 | 84 | </div> |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | </div> |
87 | 87 | <div class="col-md-6 exercise-content"> |
88 | 88 | <?php the_content(); ?> |
89 | - <?php echo do_shortcode( '[lsx_health_plan_featured_tips_block]' ); ?> |
|
89 | + <?php echo do_shortcode('[lsx_health_plan_featured_tips_block]'); ?> |
|
90 | 90 | <div class="back-plan-btn"> |
91 | 91 | <?php |
92 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
92 | + if (function_exists('wc_get_page_id')) { |
|
93 | 93 | ?> |
94 | - <a class="btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'Back to my plans', 'lsx-health-plan' ); ?></a> |
|
94 | + <a class="btn" href="<?php echo wp_kses_post(get_permalink(wc_get_page_id('myaccount'))); ?>"><?php esc_html_e('Back to my plans', 'lsx-health-plan'); ?></a> |
|
95 | 95 | <?php |
96 | 96 | } |
97 | 97 | ?> |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | </article><!-- #post-## --> |
106 | 106 | |
107 | 107 | <?php |
108 | -if ( ! empty( $connected_articles ) ) { |
|
109 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
108 | +if ( ! empty($connected_articles)) { |
|
109 | + lsx_hp_single_related($connected_articles, __('Related articles', 'lsx-health-plan')); |
|
110 | 110 | } |
111 | 111 | ?> |
112 | 112 |
@@ -18,51 +18,51 @@ discard block |
||
18 | 18 | $linked_product = false; |
19 | 19 | $restricted = ''; |
20 | 20 | if ( \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
21 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
22 | - $linked_product = wc_get_product( $products[0] ); |
|
23 | - $product = $linked_product; |
|
21 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
22 | + $linked_product = wc_get_product( $products[0] ); |
|
23 | + $product = $linked_product; |
|
24 | 24 | |
25 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
|
26 | - $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
27 | - } |
|
25 | + if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
|
26 | + $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | // Check for shortcode overrides. |
31 | 31 | if ( null !== $shortcode_args ) { |
32 | - if ( isset( $shortcode_args['columns'] ) ) { |
|
33 | - $column_class = $shortcode_args['columns']; |
|
34 | - $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
35 | - } |
|
36 | - if ( isset( $shortcode_args['link'] ) ) { |
|
37 | - $link_setting = $shortcode_args['link']; |
|
38 | - // Setup our link and content. |
|
39 | - switch ( $link_setting ) { |
|
40 | - case 'single': |
|
41 | - $link_html = '<a href="' . get_permalink( $group['connected_plans'] ) . '">'; |
|
42 | - $link_close = '</a>'; |
|
43 | - break; |
|
32 | + if ( isset( $shortcode_args['columns'] ) ) { |
|
33 | + $column_class = $shortcode_args['columns']; |
|
34 | + $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
35 | + } |
|
36 | + if ( isset( $shortcode_args['link'] ) ) { |
|
37 | + $link_setting = $shortcode_args['link']; |
|
38 | + // Setup our link and content. |
|
39 | + switch ( $link_setting ) { |
|
40 | + case 'single': |
|
41 | + $link_html = '<a href="' . get_permalink( $group['connected_plans'] ) . '">'; |
|
42 | + $link_close = '</a>'; |
|
43 | + break; |
|
44 | 44 | |
45 | - case 'modal': |
|
46 | - $link_html = '<a data-toggle="modal" href="#workout-plan-modal-' . $group['connected_plans'] . '">'; |
|
47 | - $link_close = '</a>'; |
|
48 | - $modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' ); |
|
49 | - $modal_args = array( |
|
50 | - 'modal_content' => $modal_content_setting, |
|
51 | - ); |
|
52 | - // We call the button to register the modal, but we do not output it. |
|
53 | - lsx_health_plan_workout_plan_button( $group['connected_plans'], $group, false, $modal_args ); |
|
54 | - break; |
|
45 | + case 'modal': |
|
46 | + $link_html = '<a data-toggle="modal" href="#workout-plan-modal-' . $group['connected_plans'] . '">'; |
|
47 | + $link_close = '</a>'; |
|
48 | + $modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' ); |
|
49 | + $modal_args = array( |
|
50 | + 'modal_content' => $modal_content_setting, |
|
51 | + ); |
|
52 | + // We call the button to register the modal, but we do not output it. |
|
53 | + lsx_health_plan_workout_plan_button( $group['connected_plans'], $group, false, $modal_args ); |
|
54 | + break; |
|
55 | 55 | |
56 | - case 'none': |
|
57 | - default: |
|
58 | - $link_html = ''; |
|
59 | - $link_close = ''; |
|
60 | - break; |
|
61 | - } |
|
62 | - } |
|
63 | - if ( isset( $shortcode_args['description'] ) ) { |
|
64 | - $content_setting = $shortcode_args['description']; |
|
65 | - } |
|
56 | + case 'none': |
|
57 | + default: |
|
58 | + $link_html = ''; |
|
59 | + $link_close = ''; |
|
60 | + break; |
|
61 | + } |
|
62 | + } |
|
63 | + if ( isset( $shortcode_args['description'] ) ) { |
|
64 | + $content_setting = $shortcode_args['description']; |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $featured = get_post_meta( get_the_ID(), 'plan_featured_plan', true ); |
@@ -78,60 +78,60 @@ discard block |
||
78 | 78 | <?php } ?> |
79 | 79 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
80 | 80 | <?php |
81 | - $featured_image = get_the_post_thumbnail(); |
|
82 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
83 | - the_post_thumbnail( 'lsx-thumbnail', array( |
|
84 | - 'class' => 'aligncenter', |
|
85 | - ) ); |
|
86 | - } else { |
|
87 | - ?> |
|
81 | + $featured_image = get_the_post_thumbnail(); |
|
82 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
83 | + the_post_thumbnail( 'lsx-thumbnail', array( |
|
84 | + 'class' => 'aligncenter', |
|
85 | + ) ); |
|
86 | + } else { |
|
87 | + ?> |
|
88 | 88 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
89 | 89 | <?php |
90 | - } |
|
91 | - ?> |
|
90 | + } |
|
91 | + ?> |
|
92 | 92 | </a> |
93 | 93 | </div> |
94 | 94 | <div class="content-box plan-content-box white-bg"> |
95 | 95 | <h3 class="plan id-<?php the_ID(); ?> <?php echo esc_attr( $completed_class ); ?>"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_title(); ?></a></h3> |
96 | 96 | <?php |
97 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
98 | - ?> |
|
97 | + echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
98 | + ?> |
|
99 | 99 | <?php |
100 | - if ( false !== $linked_product ) { |
|
101 | - echo wp_kses_post( $linked_product->get_price_html() ); |
|
102 | - } |
|
103 | - ?> |
|
100 | + if ( false !== $linked_product ) { |
|
101 | + echo wp_kses_post( $linked_product->get_price_html() ); |
|
102 | + } |
|
103 | + ?> |
|
104 | 104 | <div class="excerpt"> |
105 | 105 | <?php |
106 | - if ( ! has_excerpt() ) { |
|
107 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
108 | - $content = '<p>' . $content . '</p>'; |
|
109 | - } else { |
|
110 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
111 | - } |
|
112 | - echo wp_kses_post( $content ); |
|
113 | - ?> |
|
106 | + if ( ! has_excerpt() ) { |
|
107 | + $content = wp_trim_words( get_the_content(), 20 ); |
|
108 | + $content = '<p>' . $content . '</p>'; |
|
109 | + } else { |
|
110 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
111 | + } |
|
112 | + echo wp_kses_post( $content ); |
|
113 | + ?> |
|
114 | 114 | </div> |
115 | 115 | |
116 | 116 | <?php |
117 | - $button_link = get_permalink(); |
|
118 | - $button_text = __( 'Sign Up', 'lsx-health-plan' ); |
|
119 | - $button_class = ''; |
|
117 | + $button_link = get_permalink(); |
|
118 | + $button_text = __( 'Sign Up', 'lsx-health-plan' ); |
|
119 | + $button_class = ''; |
|
120 | 120 | |
121 | - if ( true === $restricted ) { |
|
122 | - if ( 1 < count( $products ) ) { |
|
123 | - $button_text = __( 'Select Options', 'lsx-health-plan' ); |
|
124 | - } else { |
|
125 | - $button_link = $linked_product->add_to_cart_url() . '&plan_id=' . get_the_ID(); |
|
126 | - $button_text = $linked_product->add_to_cart_text(); |
|
127 | - } |
|
128 | - ?> |
|
121 | + if ( true === $restricted ) { |
|
122 | + if ( 1 < count( $products ) ) { |
|
123 | + $button_text = __( 'Select Options', 'lsx-health-plan' ); |
|
124 | + } else { |
|
125 | + $button_link = $linked_product->add_to_cart_url() . '&plan_id=' . get_the_ID(); |
|
126 | + $button_text = $linked_product->add_to_cart_text(); |
|
127 | + } |
|
128 | + ?> |
|
129 | 129 | <?php |
130 | - } elseif ( false === $restricted ) { |
|
131 | - $button_text = __( 'Already Signed Up', 'lsx-health-plan' ); |
|
132 | - $button_class = 'btn-disabled'; |
|
133 | - } |
|
134 | - ?> |
|
130 | + } elseif ( false === $restricted ) { |
|
131 | + $button_text = __( 'Already Signed Up', 'lsx-health-plan' ); |
|
132 | + $button_class = 'btn-disabled'; |
|
133 | + } |
|
134 | + ?> |
|
135 | 135 | <a class="btn <?php echo esc_attr( $button_class ); ?>" href="<?php echo esc_attr( $button_link ); ?>"><?php echo esc_attr( $button_text ); ?></a> |
136 | 136 | </div> |
137 | 137 | <?php lsx_entry_bottom(); ?> |
@@ -17,40 +17,40 @@ discard block |
||
17 | 17 | $link_close = ''; |
18 | 18 | $linked_product = false; |
19 | 19 | $restricted = ''; |
20 | -if ( \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
20 | +if (\lsx_health_plan\functions\woocommerce\plan_has_products()) { |
|
21 | 21 | $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
22 | - $linked_product = wc_get_product( $products[0] ); |
|
22 | + $linked_product = wc_get_product($products[0]); |
|
23 | 23 | $product = $linked_product; |
24 | 24 | |
25 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
|
26 | - $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
25 | + if (function_exists('wc_memberships_is_post_content_restricted') && wc_memberships_is_post_content_restricted(get_the_ID())) { |
|
26 | + $restricted = ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID()); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | 30 | // Check for shortcode overrides. |
31 | -if ( null !== $shortcode_args ) { |
|
32 | - if ( isset( $shortcode_args['columns'] ) ) { |
|
31 | +if (null !== $shortcode_args) { |
|
32 | + if (isset($shortcode_args['columns'])) { |
|
33 | 33 | $column_class = $shortcode_args['columns']; |
34 | - $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
34 | + $column_class = \lsx_health_plan\functions\column_class($column_class); |
|
35 | 35 | } |
36 | - if ( isset( $shortcode_args['link'] ) ) { |
|
36 | + if (isset($shortcode_args['link'])) { |
|
37 | 37 | $link_setting = $shortcode_args['link']; |
38 | 38 | // Setup our link and content. |
39 | - switch ( $link_setting ) { |
|
39 | + switch ($link_setting) { |
|
40 | 40 | case 'single': |
41 | - $link_html = '<a href="' . get_permalink( $group['connected_plans'] ) . '">'; |
|
41 | + $link_html = '<a href="' . get_permalink($group['connected_plans']) . '">'; |
|
42 | 42 | $link_close = '</a>'; |
43 | 43 | break; |
44 | 44 | |
45 | 45 | case 'modal': |
46 | 46 | $link_html = '<a data-toggle="modal" href="#workout-plan-modal-' . $group['connected_plans'] . '">'; |
47 | 47 | $link_close = '</a>'; |
48 | - $modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' ); |
|
48 | + $modal_content_setting = \lsx_health_plan\functions\get_option('workout_tab_modal_content', 'excerpt'); |
|
49 | 49 | $modal_args = array( |
50 | 50 | 'modal_content' => $modal_content_setting, |
51 | 51 | ); |
52 | 52 | // We call the button to register the modal, but we do not output it. |
53 | - lsx_health_plan_workout_plan_button( $group['connected_plans'], $group, false, $modal_args ); |
|
53 | + lsx_health_plan_workout_plan_button($group['connected_plans'], $group, false, $modal_args); |
|
54 | 54 | break; |
55 | 55 | |
56 | 56 | case 'none': |
@@ -60,79 +60,79 @@ discard block |
||
60 | 60 | break; |
61 | 61 | } |
62 | 62 | } |
63 | - if ( isset( $shortcode_args['description'] ) ) { |
|
63 | + if (isset($shortcode_args['description'])) { |
|
64 | 64 | $content_setting = $shortcode_args['description']; |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | -$featured = get_post_meta( get_the_ID(), 'plan_featured_plan', true ); |
|
68 | +$featured = get_post_meta(get_the_ID(), 'plan_featured_plan', true); |
|
69 | 69 | ?> |
70 | 70 | |
71 | -<div class="lsx-plan-column col-xs-12 col-sm-6 col-md-<?php echo esc_attr( $column_class ); ?> <?php echo esc_attr( lsx_hp_plan_get_classes() ); ?>"> |
|
71 | +<div class="lsx-plan-column col-xs-12 col-sm-6 col-md-<?php echo esc_attr($column_class); ?> <?php echo esc_attr(lsx_hp_plan_get_classes()); ?>"> |
|
72 | 72 | <article class="lsx-slot box-shadow"> |
73 | 73 | <?php lsx_entry_top(); ?> |
74 | 74 | |
75 | 75 | <div class="plan-feature-img"> |
76 | - <?php if ( $featured ) { ?> |
|
76 | + <?php if ($featured) { ?> |
|
77 | 77 | <span class="featured-plan"><?php //lsx_get_svg_icon( 'icon-featured.svg' ); ?></span> |
78 | 78 | <?php } ?> |
79 | - <a href="<?php echo esc_url( get_permalink() ); ?>"> |
|
79 | + <a href="<?php echo esc_url(get_permalink()); ?>"> |
|
80 | 80 | <?php |
81 | 81 | $featured_image = get_the_post_thumbnail(); |
82 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
83 | - the_post_thumbnail( 'lsx-thumbnail', array( |
|
82 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
83 | + the_post_thumbnail('lsx-thumbnail', array( |
|
84 | 84 | 'class' => 'aligncenter', |
85 | - ) ); |
|
85 | + )); |
|
86 | 86 | } else { |
87 | 87 | ?> |
88 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
|
88 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> |
|
89 | 89 | <?php |
90 | 90 | } |
91 | 91 | ?> |
92 | 92 | </a> |
93 | 93 | </div> |
94 | 94 | <div class="content-box plan-content-box white-bg"> |
95 | - <h3 class="plan id-<?php the_ID(); ?> <?php echo esc_attr( $completed_class ); ?>"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_title(); ?></a></h3> |
|
95 | + <h3 class="plan id-<?php the_ID(); ?> <?php echo esc_attr($completed_class); ?>"><a href="<?php echo esc_url(get_permalink()); ?>"><?php the_title(); ?></a></h3> |
|
96 | 96 | <?php |
97 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
97 | + echo wp_kses_post(\lsx_health_plan\functions\hp_get_plan_type_meta($post)); |
|
98 | 98 | ?> |
99 | 99 | <?php |
100 | - if ( false !== $linked_product ) { |
|
101 | - echo wp_kses_post( $linked_product->get_price_html() ); |
|
100 | + if (false !== $linked_product) { |
|
101 | + echo wp_kses_post($linked_product->get_price_html()); |
|
102 | 102 | } |
103 | 103 | ?> |
104 | 104 | <div class="excerpt"> |
105 | 105 | <?php |
106 | - if ( ! has_excerpt() ) { |
|
107 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
106 | + if ( ! has_excerpt()) { |
|
107 | + $content = wp_trim_words(get_the_content(), 20); |
|
108 | 108 | $content = '<p>' . $content . '</p>'; |
109 | 109 | } else { |
110 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
110 | + $content = apply_filters('the_excerpt', get_the_excerpt()); |
|
111 | 111 | } |
112 | - echo wp_kses_post( $content ); |
|
112 | + echo wp_kses_post($content); |
|
113 | 113 | ?> |
114 | 114 | </div> |
115 | 115 | |
116 | 116 | <?php |
117 | 117 | $button_link = get_permalink(); |
118 | - $button_text = __( 'Sign Up', 'lsx-health-plan' ); |
|
118 | + $button_text = __('Sign Up', 'lsx-health-plan'); |
|
119 | 119 | $button_class = ''; |
120 | 120 | |
121 | - if ( true === $restricted ) { |
|
122 | - if ( 1 < count( $products ) ) { |
|
123 | - $button_text = __( 'Select Options', 'lsx-health-plan' ); |
|
121 | + if (true === $restricted) { |
|
122 | + if (1 < count($products)) { |
|
123 | + $button_text = __('Select Options', 'lsx-health-plan'); |
|
124 | 124 | } else { |
125 | 125 | $button_link = $linked_product->add_to_cart_url() . '&plan_id=' . get_the_ID(); |
126 | 126 | $button_text = $linked_product->add_to_cart_text(); |
127 | 127 | } |
128 | 128 | ?> |
129 | 129 | <?php |
130 | - } elseif ( false === $restricted ) { |
|
131 | - $button_text = __( 'Already Signed Up', 'lsx-health-plan' ); |
|
130 | + } elseif (false === $restricted) { |
|
131 | + $button_text = __('Already Signed Up', 'lsx-health-plan'); |
|
132 | 132 | $button_class = 'btn-disabled'; |
133 | 133 | } |
134 | 134 | ?> |
135 | - <a class="btn <?php echo esc_attr( $button_class ); ?>" href="<?php echo esc_attr( $button_link ); ?>"><?php echo esc_attr( $button_text ); ?></a> |
|
135 | + <a class="btn <?php echo esc_attr($button_class); ?>" href="<?php echo esc_attr($button_link); ?>"><?php echo esc_attr($button_text); ?></a> |
|
136 | 136 | </div> |
137 | 137 | <?php lsx_entry_bottom(); ?> |
138 | 138 | </article> |