@@ -12,245 +12,245 @@ |
||
12 | 12 | */ |
13 | 13 | class Workout { |
14 | 14 | |
15 | - /** |
|
16 | - * Holds class instance |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - * |
|
20 | - * @var object \lsx_health_plan\classes\admin\Workout() |
|
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\Workout() |
|
21 | + */ |
|
22 | + protected static $instance = null; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Constructor |
|
26 | - */ |
|
27 | - public function __construct() { |
|
28 | - add_action( 'lsx_hp_settings_page_workout_top', array( $this, 'settings' ), 1, 1 ); |
|
29 | - } |
|
24 | + /** |
|
25 | + * Constructor |
|
26 | + */ |
|
27 | + public function __construct() { |
|
28 | + add_action( 'lsx_hp_settings_page_workout_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\Workout() 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\Workout() 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 Workouts', 'lsx-health-plan' ), |
|
56 | - 'id' => 'workout_disabled', |
|
57 | - 'type' => 'checkbox', |
|
58 | - 'value' => 1, |
|
59 | - 'default' => 0, |
|
60 | - 'description' => __( 'Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
61 | - ) |
|
62 | - ); |
|
63 | - $cmb->add_field( |
|
64 | - array( |
|
65 | - 'name' => __( 'Your Warm-up Intro', 'lsx-health-plan' ), |
|
66 | - 'id' => 'warmup_intro', |
|
67 | - 'type' => 'textarea_small', |
|
68 | - 'value' => '', |
|
69 | - 'default' => __( "Don't forget your warm-up! It's a vital part of your daily workout routine.", 'lsx-health-plan' ), |
|
70 | - ) |
|
71 | - ); |
|
72 | - if ( post_type_exists( 'workout' ) ) { |
|
73 | - $cmb->add_field( |
|
74 | - array( |
|
75 | - 'name' => __( 'Your Workout Intro', 'lsx-health-plan' ), |
|
76 | - 'id' => 'workout_intro', |
|
77 | - 'type' => 'textarea_small', |
|
78 | - 'value' => '', |
|
79 | - 'default' => __( "Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan' ), |
|
80 | - ) |
|
81 | - ); |
|
82 | - } |
|
83 | - $cmb->add_field( |
|
84 | - array( |
|
85 | - 'before_row' => '<h4><b><u>Layout Options</u></b></h4>', |
|
86 | - 'id' => 'workout_tab_layout', |
|
87 | - 'type' => 'select', |
|
88 | - 'name' => __( 'Workout Tab Layout', 'lsx-health-plan' ), |
|
89 | - 'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ), |
|
90 | - 'options' => array( |
|
91 | - 'table' => __( 'Table', 'lsx-health-plan' ), |
|
92 | - 'list' => __( 'List', 'lsx-health-plan' ), |
|
93 | - 'grid' => __( 'Grid', 'lsx-health-plan' ), |
|
94 | - ), |
|
95 | - ) |
|
96 | - ); |
|
97 | - $cmb->add_field( |
|
98 | - array( |
|
99 | - 'id' => 'workout_tab_link', |
|
100 | - 'type' => 'select', |
|
101 | - 'name' => __( 'Workout Tab Link', 'lsx-health-plan' ), |
|
102 | - 'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ), |
|
103 | - 'options' => array( |
|
104 | - 'none' => __( 'None', 'lsx-health-plan' ), |
|
105 | - 'single' => __( 'Single', 'lsx-health-plan' ), |
|
106 | - 'modal' => __( 'Modal', 'lsx-health-plan' ), |
|
107 | - ), |
|
108 | - 'default' => '', |
|
109 | - ) |
|
110 | - ); |
|
111 | - $cmb->add_field( |
|
112 | - array( |
|
113 | - 'id' => 'workout_tab_modal_content', |
|
114 | - 'type' => 'select', |
|
115 | - 'name' => __( 'Modal Content', 'lsx-health-plan' ), |
|
116 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ), |
|
117 | - 'options' => array( |
|
118 | - '' => __( 'None', 'lsx-health-plan' ), |
|
119 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
120 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
121 | - ), |
|
122 | - 'default' => '', |
|
123 | - ) |
|
124 | - ); |
|
125 | - $cmb->add_field( |
|
126 | - array( |
|
127 | - 'id' => 'workout_tab_columns', |
|
128 | - 'type' => 'select', |
|
129 | - 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
130 | - 'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ), |
|
131 | - 'options' => array( |
|
132 | - '12' => __( '1', 'lsx-health-plan' ), |
|
133 | - '6' => __( '2', 'lsx-health-plan' ), |
|
134 | - '4' => __( '3', 'lsx-health-plan' ), |
|
135 | - '3' => __( '4', 'lsx-health-plan' ), |
|
136 | - '2' => __( '6', 'lsx-health-plan' ), |
|
137 | - ), |
|
138 | - 'default' => '4', |
|
139 | - ) |
|
140 | - ); |
|
141 | - $cmb->add_field( |
|
142 | - array( |
|
143 | - 'id' => 'workout_tab_content', |
|
144 | - 'type' => 'select', |
|
145 | - 'name' => __( 'Grid Content', 'lsx-health-plan' ), |
|
146 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ), |
|
147 | - 'options' => array( |
|
148 | - '' => __( 'None', 'lsx-health-plan' ), |
|
149 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
150 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
151 | - ), |
|
152 | - 'default' => '', |
|
153 | - ) |
|
154 | - ); |
|
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 Workouts', 'lsx-health-plan' ), |
|
56 | + 'id' => 'workout_disabled', |
|
57 | + 'type' => 'checkbox', |
|
58 | + 'value' => 1, |
|
59 | + 'default' => 0, |
|
60 | + 'description' => __( 'Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
61 | + ) |
|
62 | + ); |
|
63 | + $cmb->add_field( |
|
64 | + array( |
|
65 | + 'name' => __( 'Your Warm-up Intro', 'lsx-health-plan' ), |
|
66 | + 'id' => 'warmup_intro', |
|
67 | + 'type' => 'textarea_small', |
|
68 | + 'value' => '', |
|
69 | + 'default' => __( "Don't forget your warm-up! It's a vital part of your daily workout routine.", 'lsx-health-plan' ), |
|
70 | + ) |
|
71 | + ); |
|
72 | + if ( post_type_exists( 'workout' ) ) { |
|
73 | + $cmb->add_field( |
|
74 | + array( |
|
75 | + 'name' => __( 'Your Workout Intro', 'lsx-health-plan' ), |
|
76 | + 'id' => 'workout_intro', |
|
77 | + 'type' => 'textarea_small', |
|
78 | + 'value' => '', |
|
79 | + 'default' => __( "Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan' ), |
|
80 | + ) |
|
81 | + ); |
|
82 | + } |
|
83 | + $cmb->add_field( |
|
84 | + array( |
|
85 | + 'before_row' => '<h4><b><u>Layout Options</u></b></h4>', |
|
86 | + 'id' => 'workout_tab_layout', |
|
87 | + 'type' => 'select', |
|
88 | + 'name' => __( 'Workout Tab Layout', 'lsx-health-plan' ), |
|
89 | + 'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ), |
|
90 | + 'options' => array( |
|
91 | + 'table' => __( 'Table', 'lsx-health-plan' ), |
|
92 | + 'list' => __( 'List', 'lsx-health-plan' ), |
|
93 | + 'grid' => __( 'Grid', 'lsx-health-plan' ), |
|
94 | + ), |
|
95 | + ) |
|
96 | + ); |
|
97 | + $cmb->add_field( |
|
98 | + array( |
|
99 | + 'id' => 'workout_tab_link', |
|
100 | + 'type' => 'select', |
|
101 | + 'name' => __( 'Workout Tab Link', 'lsx-health-plan' ), |
|
102 | + 'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ), |
|
103 | + 'options' => array( |
|
104 | + 'none' => __( 'None', 'lsx-health-plan' ), |
|
105 | + 'single' => __( 'Single', 'lsx-health-plan' ), |
|
106 | + 'modal' => __( 'Modal', 'lsx-health-plan' ), |
|
107 | + ), |
|
108 | + 'default' => '', |
|
109 | + ) |
|
110 | + ); |
|
111 | + $cmb->add_field( |
|
112 | + array( |
|
113 | + 'id' => 'workout_tab_modal_content', |
|
114 | + 'type' => 'select', |
|
115 | + 'name' => __( 'Modal Content', 'lsx-health-plan' ), |
|
116 | + 'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ), |
|
117 | + 'options' => array( |
|
118 | + '' => __( 'None', 'lsx-health-plan' ), |
|
119 | + 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
120 | + 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
121 | + ), |
|
122 | + 'default' => '', |
|
123 | + ) |
|
124 | + ); |
|
125 | + $cmb->add_field( |
|
126 | + array( |
|
127 | + 'id' => 'workout_tab_columns', |
|
128 | + 'type' => 'select', |
|
129 | + 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
130 | + 'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ), |
|
131 | + 'options' => array( |
|
132 | + '12' => __( '1', 'lsx-health-plan' ), |
|
133 | + '6' => __( '2', 'lsx-health-plan' ), |
|
134 | + '4' => __( '3', 'lsx-health-plan' ), |
|
135 | + '3' => __( '4', 'lsx-health-plan' ), |
|
136 | + '2' => __( '6', 'lsx-health-plan' ), |
|
137 | + ), |
|
138 | + 'default' => '4', |
|
139 | + ) |
|
140 | + ); |
|
141 | + $cmb->add_field( |
|
142 | + array( |
|
143 | + 'id' => 'workout_tab_content', |
|
144 | + 'type' => 'select', |
|
145 | + 'name' => __( 'Grid Content', 'lsx-health-plan' ), |
|
146 | + 'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ), |
|
147 | + 'options' => array( |
|
148 | + '' => __( 'None', 'lsx-health-plan' ), |
|
149 | + 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
150 | + 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
151 | + ), |
|
152 | + 'default' => '', |
|
153 | + ) |
|
154 | + ); |
|
155 | 155 | |
156 | - $cmb->add_field( |
|
157 | - array( |
|
158 | - '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>', |
|
159 | - 'name' => __( 'Single Workout Slug', 'lsx-health-plan' ), |
|
160 | - 'id' => 'endpoint_workout', |
|
161 | - 'type' => 'input', |
|
162 | - 'value' => '', |
|
163 | - 'default' => 'workout', |
|
164 | - ) |
|
165 | - ); |
|
166 | - $cmb->add_field( |
|
167 | - array( |
|
168 | - 'name' => __( 'Workouts Archive Slug', 'lsx-health-plan' ), |
|
169 | - 'id' => 'endpoint_workout_archive', |
|
170 | - 'type' => 'input', |
|
171 | - 'value' => '', |
|
172 | - 'default' => 'workouts', |
|
173 | - ) |
|
174 | - ); |
|
175 | - $cmb->add_field( |
|
176 | - array( |
|
177 | - 'name' => __( 'Warm Up Slug', 'lsx-health-plan' ), |
|
178 | - 'id' => 'endpoint_warm_up', |
|
179 | - 'type' => 'input', |
|
180 | - 'value' => '', |
|
181 | - 'default' => 'warm-up', |
|
182 | - ) |
|
183 | - ); |
|
156 | + $cmb->add_field( |
|
157 | + array( |
|
158 | + '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>', |
|
159 | + 'name' => __( 'Single Workout Slug', 'lsx-health-plan' ), |
|
160 | + 'id' => 'endpoint_workout', |
|
161 | + 'type' => 'input', |
|
162 | + 'value' => '', |
|
163 | + 'default' => 'workout', |
|
164 | + ) |
|
165 | + ); |
|
166 | + $cmb->add_field( |
|
167 | + array( |
|
168 | + 'name' => __( 'Workouts Archive Slug', 'lsx-health-plan' ), |
|
169 | + 'id' => 'endpoint_workout_archive', |
|
170 | + 'type' => 'input', |
|
171 | + 'value' => '', |
|
172 | + 'default' => 'workouts', |
|
173 | + ) |
|
174 | + ); |
|
175 | + $cmb->add_field( |
|
176 | + array( |
|
177 | + 'name' => __( 'Warm Up Slug', 'lsx-health-plan' ), |
|
178 | + 'id' => 'endpoint_warm_up', |
|
179 | + 'type' => 'input', |
|
180 | + 'value' => '', |
|
181 | + 'default' => 'warm-up', |
|
182 | + ) |
|
183 | + ); |
|
184 | 184 | |
185 | 185 | |
186 | - $cmb->add_field( |
|
187 | - array( |
|
188 | - 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
189 | - 'name' => __( 'Warm Up', 'lsx-health-plan' ), |
|
190 | - 'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ), |
|
191 | - 'limit' => 1, |
|
192 | - 'id' => 'plan_warmup', |
|
193 | - 'type' => 'post_search_ajax', |
|
194 | - 'query_args' => array( |
|
195 | - 'post_type' => 'post', |
|
196 | - 'post_status' => array( 'publish' ), |
|
197 | - 'posts_per_page' => -1, |
|
198 | - ), |
|
199 | - ) |
|
200 | - ); |
|
201 | - $cmb->add_field( |
|
202 | - array( |
|
203 | - 'name' => __( 'Workout', 'lsx-health-plan' ), |
|
204 | - 'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ), |
|
205 | - 'limit' => 1, |
|
206 | - 'id' => 'connected_workouts', |
|
207 | - 'type' => 'post_search_ajax', |
|
208 | - 'query_args' => array( |
|
209 | - 'post_type' => 'workout', |
|
210 | - 'post_status' => array( 'publish' ), |
|
211 | - 'posts_per_page' => -1, |
|
212 | - ), |
|
213 | - ) |
|
214 | - ); |
|
215 | - if ( function_exists( 'download_monitor' ) ) { |
|
216 | - $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
217 | - $plugin_name = 'Download Monitor'; |
|
218 | - $description = sprintf( |
|
219 | - /* translators: %s: The subscription info */ |
|
220 | - __( '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' ), |
|
221 | - $page_url, |
|
222 | - $plugin_name |
|
223 | - ); |
|
224 | - $cmb->add_field( |
|
225 | - array( |
|
226 | - 'name' => __( 'Default Warm Up PDF', 'lsx-health-plan' ), |
|
227 | - 'description' => $description, |
|
228 | - 'id' => 'download_page', |
|
229 | - 'type' => 'post_search_ajax', |
|
230 | - 'limit' => 1, |
|
231 | - 'query_args' => array( |
|
232 | - 'post_type' => array( 'dlm_download' ), |
|
233 | - 'post_status' => array( 'publish' ), |
|
234 | - 'posts_per_page' => -1, |
|
235 | - ), |
|
236 | - ) |
|
237 | - ); |
|
238 | - $cmb->add_field( |
|
239 | - array( |
|
240 | - 'name' => __( 'Default Workout PDF', 'lsx-health-plan' ), |
|
241 | - 'description' => $description, |
|
242 | - 'id' => 'download_workout', |
|
243 | - 'type' => 'post_search_ajax', |
|
244 | - 'limit' => 1, |
|
245 | - 'query_args' => array( |
|
246 | - 'post_type' => array( 'dlm_download' ), |
|
247 | - 'post_status' => array( 'publish' ), |
|
248 | - 'posts_per_page' => -1, |
|
249 | - ), |
|
250 | - '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' ), |
|
251 | - ) |
|
252 | - ); |
|
253 | - } |
|
254 | - } |
|
186 | + $cmb->add_field( |
|
187 | + array( |
|
188 | + 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
189 | + 'name' => __( 'Warm Up', 'lsx-health-plan' ), |
|
190 | + 'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ), |
|
191 | + 'limit' => 1, |
|
192 | + 'id' => 'plan_warmup', |
|
193 | + 'type' => 'post_search_ajax', |
|
194 | + 'query_args' => array( |
|
195 | + 'post_type' => 'post', |
|
196 | + 'post_status' => array( 'publish' ), |
|
197 | + 'posts_per_page' => -1, |
|
198 | + ), |
|
199 | + ) |
|
200 | + ); |
|
201 | + $cmb->add_field( |
|
202 | + array( |
|
203 | + 'name' => __( 'Workout', 'lsx-health-plan' ), |
|
204 | + 'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ), |
|
205 | + 'limit' => 1, |
|
206 | + 'id' => 'connected_workouts', |
|
207 | + 'type' => 'post_search_ajax', |
|
208 | + 'query_args' => array( |
|
209 | + 'post_type' => 'workout', |
|
210 | + 'post_status' => array( 'publish' ), |
|
211 | + 'posts_per_page' => -1, |
|
212 | + ), |
|
213 | + ) |
|
214 | + ); |
|
215 | + if ( function_exists( 'download_monitor' ) ) { |
|
216 | + $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
217 | + $plugin_name = 'Download Monitor'; |
|
218 | + $description = sprintf( |
|
219 | + /* translators: %s: The subscription info */ |
|
220 | + __( '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' ), |
|
221 | + $page_url, |
|
222 | + $plugin_name |
|
223 | + ); |
|
224 | + $cmb->add_field( |
|
225 | + array( |
|
226 | + 'name' => __( 'Default Warm Up PDF', 'lsx-health-plan' ), |
|
227 | + 'description' => $description, |
|
228 | + 'id' => 'download_page', |
|
229 | + 'type' => 'post_search_ajax', |
|
230 | + 'limit' => 1, |
|
231 | + 'query_args' => array( |
|
232 | + 'post_type' => array( 'dlm_download' ), |
|
233 | + 'post_status' => array( 'publish' ), |
|
234 | + 'posts_per_page' => -1, |
|
235 | + ), |
|
236 | + ) |
|
237 | + ); |
|
238 | + $cmb->add_field( |
|
239 | + array( |
|
240 | + 'name' => __( 'Default Workout PDF', 'lsx-health-plan' ), |
|
241 | + 'description' => $description, |
|
242 | + 'id' => 'download_workout', |
|
243 | + 'type' => 'post_search_ajax', |
|
244 | + 'limit' => 1, |
|
245 | + 'query_args' => array( |
|
246 | + 'post_type' => array( 'dlm_download' ), |
|
247 | + 'post_status' => array( 'publish' ), |
|
248 | + 'posts_per_page' => -1, |
|
249 | + ), |
|
250 | + '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' ), |
|
251 | + ) |
|
252 | + ); |
|
253 | + } |
|
254 | + } |
|
255 | 255 | } |
256 | 256 | Workout::get_instance(); |