Passed
Push — add/multiplan ( 0816bf...806c57 )
by Virginia
04:04
created
classes/admin/class-settings.php 1 patch
Indentation   +605 added lines, -605 removed lines patch added patch discarded remove patch
@@ -12,612 +12,612 @@
 block discarded – undo
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
-		//add_action( 'lsx_hp_settings_page', array( $this, 'global_defaults' ), 3, 1 );
62
-		//add_action( 'lsx_hp_settings_page', array( $this, 'global_downloads' ), 5, 1 );
63
-		//add_action( 'lsx_hp_settings_page', array( $this, 'stat_disable' ), 6, 1 );
64
-		//add_action( 'lsx_hp_settings_page', array( $this, 'endpoint_translations' ), 7, 1 );
65
-		// add_action( 'lsx_hp_settings_page', array( $this, 'exercise_translations' ), 7, 1 );
66
-		//add_action( 'lsx_hp_settings_page', array( $this, 'post_type_toggles' ), 9, 1 );
67
-	}
68
-
69
-	/**
70
-	 * Return an instance of this class.
71
-	 *
72
-	 * @since 1.0.0
73
-	 *
74
-	 * @return    object \lsx_health_plan\classes\admin\Settings()    A single instance of this class.
75
-	 */
76
-	public static function get_instance() {
77
-		// If the single instance hasn't been set, set it now.
78
-		if ( null === self::$instance ) {
79
-			self::$instance = new self();
80
-		}
81
-		return self::$instance;
82
-	}
83
-
84
-	/**
85
-	 * Loads the variable classes and the static classes.
86
-	 */
87
-	private function load_classes() {
88
-
89
-		$this->post_types = array(
90
-			'plan',
91
-			'workout',
92
-			'exercise',
93
-			'meal',
94
-			'recipe',
95
-			//'tip',
96
-		);
97
-
98
-		foreach ( $this->post_types as $post_type ) {
99
-			$this->$post_type = require_once LSX_HEALTH_PLAN_PATH . 'classes/admin/settings/class-' . $post_type . '.php';
100
-		}
101
-	}
102
-
103
-	/**
104
-	 * Sets the variables needed for the fields.
105
-	 *
106
-	 * @return void
107
-	 */
108
-	public function set_vars() {
109
-
110
-		// $this->default_types  = array(
111
-		// 	'page' => array(
112
-		// 		'title'       => __( 'Warm Up', 'lsx-health-plan' ),
113
-		// 		'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
114
-		// 		'limit'       => 1,
115
-		// 		'id'          => 'plan_warmup',
116
-		// 	),
117
-		// );
118
-		// $this->download_types = array(
119
-		// 	'page' => array(
120
-		// 		'title'       => __( 'Warm Up', 'lsx-health-plan' ),
121
-		// 		'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
122
-		// 		'limit'       => 1,
123
-		// 	),
124
-		// );
125
-		// $this->endpoints      = array(
126
-		// 	'endpoint_warm_up' => array(
127
-		// 		'title'       => __( 'Warm Up Endpoint', 'lsx-health-plan' ),
128
-		// 		'default'     => 'warm-up',
129
-		// 	),
130
-		// );
131
-
132
-		if ( post_type_exists( 'meal' ) ) {
133
-			// $this->download_types['meal']     = array(
134
-			// 	'title'       => __( 'Meal Plan', 'lsx-health-plan' ),
135
-			// 	'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ),
136
-			// );
137
-			// $this->default_types['meal']      = array(
138
-			// 	'title'       => __( 'Meal Plan', 'lsx-health-plan' ),
139
-			// 	'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ),
140
-			// 	'id'          => 'connected_meals',
141
-			// );
142
-			// $this->endpoints['endpoint_meal'] = array(
143
-			// 	'title'       => __( 'Meal Endpoint', 'lsx-health-plan' ),
144
-			// 	'default'     => 'meal',
145
-			// 	'description' => __( 'Define the tab slug which shows on the single plan page.', 'lsx-health-plan' ),
146
-			// );
147
-			// $this->endpoints['endpoint_meal_archive'] = array(
148
-			// 	'title'   => __( 'Meals Archive Endpoint', 'lsx-health-plan' ),
149
-			// 	'default' => 'meals',
150
-			// );
151
-			// $this->endpoints['meal_single_slug'] = array(
152
-			// 	'title'   => __( 'Single Meal Slug', 'lsx-health-plan' ),
153
-			// 	'default' => 'meal',
154
-			// );
155
-		}
156
-		if ( post_type_exists( 'recipe' ) ) {
157
-			// $this->download_types['recipe'] = array(
158
-			// 	'title'       => __( 'Recipe', 'lsx-health-plan' ),
159
-			// 	'description' => __( 'Set a default recipe.', 'lsx-health-plan' ),
160
-			// );
161
-			// $this->default_types['recipe'] = array(
162
-			// 	'title'       => __( 'Recipe', 'lsx-health-plan' ),
163
-			// 	'description' => __( 'Set a default recipe.', 'lsx-health-plan' ),
164
-			// 	'id'          => 'connected_recipes',
165
-			// );
166
-			// $this->endpoints['endpoint_recipe'] = array(
167
-			// 	'title'   => __( 'Recipes Endpoint', 'lsx-health-plan' ),
168
-			// 	'default' => 'recipe',
169
-			// );
170
-		}
171
-		if ( post_type_exists( 'workout' ) ) {
172
-			// $this->download_types['workout'] = array(
173
-			// 	'title'       => __( 'Workout', 'lsx-health-plan' ),
174
-			// 	'description' => __( 'Set a default workout routine PDF.', 'lsx-health-plan' ),
175
-			// );
176
-			// $this->default_types['workout'] = array(
177
-			// 	'title'       => __( 'Workout', 'lsx-health-plan' ),
178
-			// 	'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ),
179
-			// 	'id'          => 'connected_workouts',
180
-			// );
181
-			// $this->endpoints['endpoint_workout_archive'] = array(
182
-			// 	'title'   => __( 'Workouts Archive Endpoint', 'lsx-health-plan' ),
183
-			// 	'default' => '',
184
-			// );
185
-			// $this->endpoints['endpoint_workout'] = array(
186
-			// 	'title'   => __( 'Single Workout Endpoint', 'lsx-health-plan' ),
187
-			// 	'default' => 'workout',
188
-			// );
189
-		}
190
-
191
-		// $this->endpoints['login_slug'] = array(
192
-		// 	'title'   => __( 'Login Slug', 'lsx-health-plan' ),
193
-		// 	'default' => 'login',
194
-		// );
195
-		// $this->endpoints['my_plan_slug'] = array(
196
-		// 	'title'   => __( 'My Plan Slug', 'lsx-health-plan' ),
197
-		// 	'default' => 'my-plan',
198
-		// );
199
-		// $this->endpoints['plan_single_slug'] = array(
200
-		// 	'title'   => __( 'Single Plan Slug', 'lsx-health-plan' ),
201
-		// 	'default' => 'plan',
202
-		// );
203
-		// $this->endpoints['endpoint_plan_archive'] = array(
204
-		// 	'title'   => __( 'Plans Archive Endpoint', 'lsx-health-plan' ),
205
-		// 	'default' => 'plans',
206
-		// );
207
-
208
-		// if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
209
-		// 	$this->endpoints['exercise'] = array(
210
-		// 		'exercise_single' => array(
211
-		// 			'title'   => __( 'Single Exercise Slug', 'lsx-health-plan' ),
212
-		// 			'default' => 'exercise',
213
-		// 		),
214
-		// 		'exercise_archive' => array(
215
-		// 			'title'   => __( 'Archive Exercise Slug', 'lsx-health-plan' ),
216
-		// 			'default' => 'exercises',
217
-		// 		),
218
-		// 		'exercise_type' => array(
219
-		// 			'title'   => __( 'Exercise Type Slug', 'lsx-health-plan' ),
220
-		// 			'default' => 'exercise-type',
221
-		// 		),
222
-		// 		'exercise_equipment' => array(
223
-		// 			'title'   => __( 'Equipment Slug', 'lsx-health-plan' ),
224
-		// 			'default' => 'equipment',
225
-		// 		),
226
-		// 		'exercise_musclegroup' => array(
227
-		// 			'title'   => __( 'Muscle Group Slug', 'lsx-health-plan' ),
228
-		// 			'default' => 'muscle-group',
229
-		// 		),
230
-		// 	);
231
-		// }
232
-	}
233
-
234
-	/**
235
-	 * Hook in and register a submenu options page for the Page post-type menu.
236
-	 */
237
-	public function register_settings_page() {
238
-		$cmb = new_cmb2_box(
239
-			array(
240
-				'id'           => $this->screen_id,
241
-				'title'        => esc_html__( 'Settings', 'lsx-health-plan' ),
242
-				'object_types' => array( 'options-page' ),
243
-				'option_key'   => 'lsx_health_plan_options', // The option key and admin menu page slug.
244
-				'parent_slug'  => 'edit.php?post_type=plan', // Make options page a submenu item of the themes menu.
245
-				'capability'   => 'manage_options', // Cap required to view options-page.
246
-			)
247
-		);
248
-		do_action( 'lsx_hp_settings_page', $cmb );
249
-	}
250
-
251
-	/**
252
-	 * Registers the general settings.
253
-	 *
254
-	 * @param object $cmb new_cmb2_box().
255
-	 * @return void
256
-	 */
257
-	public function general_settings( $cmb ) {
258
-		if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) {
259
-			$cmb->add_field(
260
-				array(
261
-					'name'       => __( 'Membership Product', 'lsx-health-plan' ),
262
-					'id'         => 'membership_product',
263
-					'type'       => 'post_search_ajax',
264
-					'limit'      => 1,
265
-					'sortable'   => false,
266
-					'query_args' => array(
267
-						'post_type'      => array( 'product' ),
268
-						'post_status'    => array( 'publish' ),
269
-						'posts_per_page' => -1,
270
-					),
271
-				)
272
-			);
273
-		}
274
-
275
-		$cmb->add_field(
276
-			array(
277
-				'name'    =>  __( 'Login Slug', 'lsx-health-plan' ),
278
-				'id'      => 'login_slug',
279
-				'type'    => 'input',
280
-				'value'   => '',
281
-				'default' => 'login',
282
-			)
283
-		);
284
-
285
-	}
286
-
287
-	/**
288
-	 * Registers the global default settings.
289
-	 *
290
-	 * @param object $cmb new_cmb2_box().
291
-	 * @return void
292
-	 */
293
-	// public function global_defaults( $cmb ) {
294
-	// 	$cmb->add_field(
295
-	// 		array(
296
-	// 			'id'      => 'global_defaults_title',
297
-	// 			'type'    => 'title',
298
-	// 			'name'    => __( 'Global Defaults', 'lsx-health-plan' ),
299
-	// 			'default' => __( 'Global Defaults', 'lsx-health-plan' ),
300
-	// 			'description' => __( 'If you have not connected a specific post to your day plan, set a default option below.', 'lsx-health-plan' ),
301
-	// 		)
302
-	// 	);
303
-
304
-	// 	foreach ( $this->default_types as $type => $default_type ) {
305
-	// 		$limit    = 5;
306
-	// 		$sortable = false;
307
-	// 		if ( isset( $default_type['limit'] ) ) {
308
-	// 			$limit    = $default_type['limit'];
309
-	// 			$sortable = true;
310
-	// 		}
311
-
312
-	// 		if ( 'page' === $type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
313
-	// 			$type = array( 'page', 'workout' );
314
-	// 		}
315
-
316
-	// 		$cmb->add_field(
317
-	// 			array(
318
-	// 				'name'       => $default_type['title'],
319
-	// 				'desc'       => $default_type['description'],
320
-	// 				'id'         => $default_type['id'],
321
-	// 				'type'       => 'post_search_ajax',
322
-	// 				'limit'      => $limit,
323
-	// 				'sortable'   => $sortable,
324
-	// 				'query_args' => array(
325
-	// 					'post_type'      => $type,
326
-	// 					'post_status'    => array( 'publish' ),
327
-	// 					'posts_per_page' => -1,
328
-	// 				),
329
-	// 			)
330
-	// 		);
331
-	// 	}
332
-
333
-	// 	$cmb->add_field(
334
-	// 		array(
335
-	// 			'id'   => 'settings_global_defaults_closing',
336
-	// 			'type' => 'tab_closing',
337
-	// 		)
338
-	// 	);
339
-	// }
340
-
341
-	/**
342
-	 * Registers the global dowloads settings
343
-	 *
344
-	 * @param object $cmb new_cmb2_box().
345
-	 * @return void
346
-	 */
347
-	// public function global_downloads( $cmb ) {
348
-	// 	if ( ! function_exists( 'download_monitor' ) ) {
349
-	// 		return;
350
-	// 	}
351
-	// 	$page_url    = 'https://wordpress.org/plugins/download-monitor/';
352
-	// 	$plugin_name = 'Download Monitor';
353
-	// 	$description = sprintf(
354
-	// 		/* translators: %s: The subscription info */
355
-	// 		__( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your plan here.', 'lsx-search' ),
356
-	// 		$page_url,
357
-	// 		$plugin_name
358
-	// 	);
359
-	// 	$cmb->add_field(
360
-	// 		array(
361
-	// 			'id'          => 'global_downloads_title',
362
-	// 			'type'        => 'title',
363
-	// 			'name'        => __( 'Global Downloads', 'lsx-health-plan' ),
364
-	// 			'default'     => __( 'Global Downloads', 'lsx-health-plan' ),
365
-	// 			'description' => $description,
366
-	// 		)
367
-	// 	);
368
-
369
-	// 	foreach ( $this->download_types as $type => $download_type ) {
370
-	// 		$limit    = 5;
371
-	// 		$sortable = false;
372
-	// 		if ( isset( $download_type['limit'] ) ) {
373
-	// 			$limit    = $download_type['limit'];
374
-	// 			$sortable = true;
375
-	// 		}
376
-
377
-	// 		$cmb->add_field(
378
-	// 			array(
379
-	// 				'name'       => $download_type['title'],
380
-	// 				'id'         => 'download_' . $type,
381
-	// 				'type'       => 'post_search_ajax',
382
-	// 				'limit'      => $limit,
383
-	// 				'sortable'   => $sortable,
384
-	// 				'query_args' => array(
385
-	// 					'post_type'      => array( 'dlm_download' ),
386
-	// 					'post_status'    => array( 'publish' ),
387
-	// 					'posts_per_page' => -1,
388
-	// 				),
389
-	// 			)
390
-	// 		);
391
-	// 	}
392
-	// 	$cmb->add_field(
393
-	// 		array(
394
-	// 			'id'   => 'settings_global_downloads_closing',
395
-	// 			'type' => 'tab_closing',
396
-	// 		)
397
-	// 	);
398
-	// }
399
-
400
-	/**
401
-	 * Registers the endpoint translation settings.
402
-	 *
403
-	 * @param object $cmb new_cmb2_box().
404
-	 * @return void
405
-	 */
406
-	// public function endpoint_translations( $cmb ) {
407
-	// 	$cmb->add_field(
408
-	// 		array(
409
-	// 			'id'          => 'endpoints_title',
410
-	// 			'type'        => 'title',
411
-	// 			'name'        => __( 'Set Endpoint Translations', 'lsx-health-plan' ),
412
-	// 			'default'     => __( 'Set Endpoint Translations', 'lsx-health-plan' ),
413
-	// 		)
414
-	// 	);
415
-	// 	foreach ( $this->endpoints as $slug => $endpoint_vars ) {
416
-	// 		if ( 'exercise' === $slug ) {
417
-	// 			continue;
418
-	// 		}
419
-
420
-	// 		$cmb->add_field(
421
-	// 			array(
422
-	// 				'name'    => $slug,
423
-	// 				'id'      => $slug,
424
-	// 				'type'    => 'input',
425
-	// 				'value'   => '',
426
-	// 				'default' => $endpoint_vars['default'],
427
-	// 			)
428
-	// 		);
429
-	// 	}
430
-	// 	$cmb->add_field(
431
-	// 		array(
432
-	// 			'id'            => 'settings_endpoints_closing',
433
-	// 			'type'          => 'tab_closing',
434
-	// 			'before_row'    => '<p style="margin-top:20px; font-style: italic;">Endpoint is a web address (URL) at which the user can gain access to it. You need to resave your permalinks after changing the endpoint settings.</p>',
435
-	// 		)
436
-	// 	);
437
-	// }
438
-
439
-	/**
440
-	 * Registers the endpoint translation settings.
441
-	 *
442
-	 * @param object $cmb new_cmb2_box().
443
-	 * @return void
444
-	 */
445
-	// public function exercise_translations( $cmb ) {
446
-	// 	if ( isset( $this->endpoints['exercise'] ) && '' !== $this->endpoints['exercise'] && ! empty( $this->endpoints['exercise'] ) ) {
447
-	// 		$cmb->add_field(
448
-	// 			array(
449
-	// 				'id'          => 'exercise_endpoints_title',
450
-	// 				'type'        => 'title',
451
-	// 				'name'        => __( 'Set Exercise Translations', 'lsx-health-plan' ),
452
-	// 				'default'     => __( 'Set Exercise Translations', 'lsx-health-plan' ),
453
-	// 				'description' => __( 'Change the exercise endpoints.', 'lsx-health-plan' ),
454
-	// 			)
455
-	// 		);
456
-
457
-	// 		foreach ( $this->endpoints['exercise'] as $slug => $endpoint_vars ) {
458
-	// 			$cmb->add_field(
459
-	// 				array(
460
-	// 					'name'    => 'endpoint_' . $slug,
461
-	// 					'id'      => 'endpoint_' . $slug,
462
-	// 					'type'    => 'input',
463
-	// 					'value'   => '',
464
-	// 					'default' => $endpoint_vars['default'],
465
-	// 				)
466
-	// 			);
467
-	// 		}
468
-
469
-	// 		$cmb->add_field(
470
-	// 			array(
471
-	// 				'id'            => 'settings_exercise_endpoints_closing',
472
-	// 				'type'          => 'tab_closing',
473
-	// 				'before_row'    => '<p style="margin-top:20px; font-style: italic;">If you need to translate the exercise URL slugs, do so below.</p>',
474
-	// 			)
475
-	// 		);
476
-	// 	}
477
-	// }
478
-
479
-	/**
480
-	 * Registers the post type toggle settings
481
-	 *
482
-	 * @param object $cmb new_cmb2_box().
483
-	 * @return void
484
-	 */
485
-	// public function post_type_toggles( $cmb ) {
486
-	// 	$post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) );
487
-
488
-	// 	$cmb->add_field(
489
-	// 		array(
490
-	// 			'id'          => 'post_type_toggles_title',
491
-	// 			'type'        => 'title',
492
-	// 			'name'        => __( 'Disable Post Types', 'lsx-health-plan' ),
493
-	// 			'default'     => __( 'Disable Post Types', 'lsx-health-plan' ),
494
-	// 			'description' => __( 'Disable post types if you are wanting a minimal site.', 'lsx-health-plan' ),
495
-	// 		)
496
-	// 	);
497
-
498
-	// 	foreach ( $post_types as $post_type ) {
499
-	// 		if ( 'plan' === $post_type || 'exercise' === $post_type || ( 'video' === $post_type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) ) {
500
-	// 			continue;
501
-	// 		}
502
-
503
-	// 		$cmb->add_field(
504
-	// 			array(
505
-	// 				'name'    => $post_type . '_disabled',
506
-	// 				'id'      => $post_type . '_disabled',
507
-	// 				'type'    => 'checkbox',
508
-	// 				'value'   => 1,
509
-	// 				'default' => 0,
510
-	// 			)
511
-	// 		);
512
-	// 	}
513
-
514
-	// 	$cmb->add_field(
515
-	// 		array(
516
-	// 			'id'   => 'settings_post_type_toggles_closing',
517
-	// 			'type' => 'tab_closing',
518
-	// 		)
519
-	// 	);
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
+          //add_action( 'lsx_hp_settings_page', array( $this, 'global_defaults' ), 3, 1 );
62
+          //add_action( 'lsx_hp_settings_page', array( $this, 'global_downloads' ), 5, 1 );
63
+          //add_action( 'lsx_hp_settings_page', array( $this, 'stat_disable' ), 6, 1 );
64
+          //add_action( 'lsx_hp_settings_page', array( $this, 'endpoint_translations' ), 7, 1 );
65
+          // add_action( 'lsx_hp_settings_page', array( $this, 'exercise_translations' ), 7, 1 );
66
+          //add_action( 'lsx_hp_settings_page', array( $this, 'post_type_toggles' ), 9, 1 );
67
+     }
68
+
69
+     /**
70
+      * Return an instance of this class.
71
+      *
72
+      * @since 1.0.0
73
+      *
74
+      * @return    object \lsx_health_plan\classes\admin\Settings()    A single instance of this class.
75
+      */
76
+     public static function get_instance() {
77
+          // If the single instance hasn't been set, set it now.
78
+          if ( null === self::$instance ) {
79
+               self::$instance = new self();
80
+          }
81
+          return self::$instance;
82
+     }
83
+
84
+     /**
85
+      * Loads the variable classes and the static classes.
86
+      */
87
+     private function load_classes() {
88
+
89
+          $this->post_types = array(
90
+               'plan',
91
+               'workout',
92
+               'exercise',
93
+               'meal',
94
+               'recipe',
95
+               //'tip',
96
+          );
97
+
98
+          foreach ( $this->post_types as $post_type ) {
99
+               $this->$post_type = require_once LSX_HEALTH_PLAN_PATH . 'classes/admin/settings/class-' . $post_type . '.php';
100
+          }
101
+     }
102
+
103
+     /**
104
+      * Sets the variables needed for the fields.
105
+      *
106
+      * @return void
107
+      */
108
+     public function set_vars() {
109
+
110
+          // $this->default_types  = array(
111
+          // 	'page' => array(
112
+          // 		'title'       => __( 'Warm Up', 'lsx-health-plan' ),
113
+          // 		'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
114
+          // 		'limit'       => 1,
115
+          // 		'id'          => 'plan_warmup',
116
+          // 	),
117
+          // );
118
+          // $this->download_types = array(
119
+          // 	'page' => array(
120
+          // 		'title'       => __( 'Warm Up', 'lsx-health-plan' ),
121
+          // 		'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
122
+          // 		'limit'       => 1,
123
+          // 	),
124
+          // );
125
+          // $this->endpoints      = array(
126
+          // 	'endpoint_warm_up' => array(
127
+          // 		'title'       => __( 'Warm Up Endpoint', 'lsx-health-plan' ),
128
+          // 		'default'     => 'warm-up',
129
+          // 	),
130
+          // );
131
+
132
+          if ( post_type_exists( 'meal' ) ) {
133
+               // $this->download_types['meal']     = array(
134
+               // 	'title'       => __( 'Meal Plan', 'lsx-health-plan' ),
135
+               // 	'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ),
136
+               // );
137
+               // $this->default_types['meal']      = array(
138
+               // 	'title'       => __( 'Meal Plan', 'lsx-health-plan' ),
139
+               // 	'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ),
140
+               // 	'id'          => 'connected_meals',
141
+               // );
142
+               // $this->endpoints['endpoint_meal'] = array(
143
+               // 	'title'       => __( 'Meal Endpoint', 'lsx-health-plan' ),
144
+               // 	'default'     => 'meal',
145
+               // 	'description' => __( 'Define the tab slug which shows on the single plan page.', 'lsx-health-plan' ),
146
+               // );
147
+               // $this->endpoints['endpoint_meal_archive'] = array(
148
+               // 	'title'   => __( 'Meals Archive Endpoint', 'lsx-health-plan' ),
149
+               // 	'default' => 'meals',
150
+               // );
151
+               // $this->endpoints['meal_single_slug'] = array(
152
+               // 	'title'   => __( 'Single Meal Slug', 'lsx-health-plan' ),
153
+               // 	'default' => 'meal',
154
+               // );
155
+          }
156
+          if ( post_type_exists( 'recipe' ) ) {
157
+               // $this->download_types['recipe'] = array(
158
+               // 	'title'       => __( 'Recipe', 'lsx-health-plan' ),
159
+               // 	'description' => __( 'Set a default recipe.', 'lsx-health-plan' ),
160
+               // );
161
+               // $this->default_types['recipe'] = array(
162
+               // 	'title'       => __( 'Recipe', 'lsx-health-plan' ),
163
+               // 	'description' => __( 'Set a default recipe.', 'lsx-health-plan' ),
164
+               // 	'id'          => 'connected_recipes',
165
+               // );
166
+               // $this->endpoints['endpoint_recipe'] = array(
167
+               // 	'title'   => __( 'Recipes Endpoint', 'lsx-health-plan' ),
168
+               // 	'default' => 'recipe',
169
+               // );
170
+          }
171
+          if ( post_type_exists( 'workout' ) ) {
172
+               // $this->download_types['workout'] = array(
173
+               // 	'title'       => __( 'Workout', 'lsx-health-plan' ),
174
+               // 	'description' => __( 'Set a default workout routine PDF.', 'lsx-health-plan' ),
175
+               // );
176
+               // $this->default_types['workout'] = array(
177
+               // 	'title'       => __( 'Workout', 'lsx-health-plan' ),
178
+               // 	'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ),
179
+               // 	'id'          => 'connected_workouts',
180
+               // );
181
+               // $this->endpoints['endpoint_workout_archive'] = array(
182
+               // 	'title'   => __( 'Workouts Archive Endpoint', 'lsx-health-plan' ),
183
+               // 	'default' => '',
184
+               // );
185
+               // $this->endpoints['endpoint_workout'] = array(
186
+               // 	'title'   => __( 'Single Workout Endpoint', 'lsx-health-plan' ),
187
+               // 	'default' => 'workout',
188
+               // );
189
+          }
190
+
191
+          // $this->endpoints['login_slug'] = array(
192
+          // 	'title'   => __( 'Login Slug', 'lsx-health-plan' ),
193
+          // 	'default' => 'login',
194
+          // );
195
+          // $this->endpoints['my_plan_slug'] = array(
196
+          // 	'title'   => __( 'My Plan Slug', 'lsx-health-plan' ),
197
+          // 	'default' => 'my-plan',
198
+          // );
199
+          // $this->endpoints['plan_single_slug'] = array(
200
+          // 	'title'   => __( 'Single Plan Slug', 'lsx-health-plan' ),
201
+          // 	'default' => 'plan',
202
+          // );
203
+          // $this->endpoints['endpoint_plan_archive'] = array(
204
+          // 	'title'   => __( 'Plans Archive Endpoint', 'lsx-health-plan' ),
205
+          // 	'default' => 'plans',
206
+          // );
207
+
208
+          // if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
209
+          // 	$this->endpoints['exercise'] = array(
210
+          // 		'exercise_single' => array(
211
+          // 			'title'   => __( 'Single Exercise Slug', 'lsx-health-plan' ),
212
+          // 			'default' => 'exercise',
213
+          // 		),
214
+          // 		'exercise_archive' => array(
215
+          // 			'title'   => __( 'Archive Exercise Slug', 'lsx-health-plan' ),
216
+          // 			'default' => 'exercises',
217
+          // 		),
218
+          // 		'exercise_type' => array(
219
+          // 			'title'   => __( 'Exercise Type Slug', 'lsx-health-plan' ),
220
+          // 			'default' => 'exercise-type',
221
+          // 		),
222
+          // 		'exercise_equipment' => array(
223
+          // 			'title'   => __( 'Equipment Slug', 'lsx-health-plan' ),
224
+          // 			'default' => 'equipment',
225
+          // 		),
226
+          // 		'exercise_musclegroup' => array(
227
+          // 			'title'   => __( 'Muscle Group Slug', 'lsx-health-plan' ),
228
+          // 			'default' => 'muscle-group',
229
+          // 		),
230
+          // 	);
231
+          // }
232
+     }
233
+
234
+     /**
235
+      * Hook in and register a submenu options page for the Page post-type menu.
236
+      */
237
+     public function register_settings_page() {
238
+          $cmb = new_cmb2_box(
239
+               array(
240
+                    'id'           => $this->screen_id,
241
+                    'title'        => esc_html__( 'Settings', 'lsx-health-plan' ),
242
+                    'object_types' => array( 'options-page' ),
243
+                    'option_key'   => 'lsx_health_plan_options', // The option key and admin menu page slug.
244
+                    'parent_slug'  => 'edit.php?post_type=plan', // Make options page a submenu item of the themes menu.
245
+                    'capability'   => 'manage_options', // Cap required to view options-page.
246
+               )
247
+          );
248
+          do_action( 'lsx_hp_settings_page', $cmb );
249
+     }
250
+
251
+     /**
252
+      * Registers the general settings.
253
+      *
254
+      * @param object $cmb new_cmb2_box().
255
+      * @return void
256
+      */
257
+     public function general_settings( $cmb ) {
258
+          if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) {
259
+               $cmb->add_field(
260
+                    array(
261
+                         'name'       => __( 'Membership Product', 'lsx-health-plan' ),
262
+                         'id'         => 'membership_product',
263
+                         'type'       => 'post_search_ajax',
264
+                         'limit'      => 1,
265
+                         'sortable'   => false,
266
+                         'query_args' => array(
267
+                              'post_type'      => array( 'product' ),
268
+                              'post_status'    => array( 'publish' ),
269
+                              'posts_per_page' => -1,
270
+                         ),
271
+                    )
272
+               );
273
+          }
274
+
275
+          $cmb->add_field(
276
+               array(
277
+                    'name'    =>  __( 'Login Slug', 'lsx-health-plan' ),
278
+                    'id'      => 'login_slug',
279
+                    'type'    => 'input',
280
+                    'value'   => '',
281
+                    'default' => 'login',
282
+               )
283
+          );
284
+
285
+     }
286
+
287
+     /**
288
+      * Registers the global default settings.
289
+      *
290
+      * @param object $cmb new_cmb2_box().
291
+      * @return void
292
+      */
293
+     // public function global_defaults( $cmb ) {
294
+     // 	$cmb->add_field(
295
+     // 		array(
296
+     // 			'id'      => 'global_defaults_title',
297
+     // 			'type'    => 'title',
298
+     // 			'name'    => __( 'Global Defaults', 'lsx-health-plan' ),
299
+     // 			'default' => __( 'Global Defaults', 'lsx-health-plan' ),
300
+     // 			'description' => __( 'If you have not connected a specific post to your day plan, set a default option below.', 'lsx-health-plan' ),
301
+     // 		)
302
+     // 	);
303
+
304
+     // 	foreach ( $this->default_types as $type => $default_type ) {
305
+     // 		$limit    = 5;
306
+     // 		$sortable = false;
307
+     // 		if ( isset( $default_type['limit'] ) ) {
308
+     // 			$limit    = $default_type['limit'];
309
+     // 			$sortable = true;
310
+     // 		}
311
+
312
+     // 		if ( 'page' === $type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
313
+     // 			$type = array( 'page', 'workout' );
314
+     // 		}
315
+
316
+     // 		$cmb->add_field(
317
+     // 			array(
318
+     // 				'name'       => $default_type['title'],
319
+     // 				'desc'       => $default_type['description'],
320
+     // 				'id'         => $default_type['id'],
321
+     // 				'type'       => 'post_search_ajax',
322
+     // 				'limit'      => $limit,
323
+     // 				'sortable'   => $sortable,
324
+     // 				'query_args' => array(
325
+     // 					'post_type'      => $type,
326
+     // 					'post_status'    => array( 'publish' ),
327
+     // 					'posts_per_page' => -1,
328
+     // 				),
329
+     // 			)
330
+     // 		);
331
+     // 	}
332
+
333
+     // 	$cmb->add_field(
334
+     // 		array(
335
+     // 			'id'   => 'settings_global_defaults_closing',
336
+     // 			'type' => 'tab_closing',
337
+     // 		)
338
+     // 	);
339
+     // }
340
+
341
+     /**
342
+      * Registers the global dowloads settings
343
+      *
344
+      * @param object $cmb new_cmb2_box().
345
+      * @return void
346
+      */
347
+     // public function global_downloads( $cmb ) {
348
+     // 	if ( ! function_exists( 'download_monitor' ) ) {
349
+     // 		return;
350
+     // 	}
351
+     // 	$page_url    = 'https://wordpress.org/plugins/download-monitor/';
352
+     // 	$plugin_name = 'Download Monitor';
353
+     // 	$description = sprintf(
354
+     // 		/* translators: %s: The subscription info */
355
+     // 		__( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your plan here.', 'lsx-search' ),
356
+     // 		$page_url,
357
+     // 		$plugin_name
358
+     // 	);
359
+     // 	$cmb->add_field(
360
+     // 		array(
361
+     // 			'id'          => 'global_downloads_title',
362
+     // 			'type'        => 'title',
363
+     // 			'name'        => __( 'Global Downloads', 'lsx-health-plan' ),
364
+     // 			'default'     => __( 'Global Downloads', 'lsx-health-plan' ),
365
+     // 			'description' => $description,
366
+     // 		)
367
+     // 	);
368
+
369
+     // 	foreach ( $this->download_types as $type => $download_type ) {
370
+     // 		$limit    = 5;
371
+     // 		$sortable = false;
372
+     // 		if ( isset( $download_type['limit'] ) ) {
373
+     // 			$limit    = $download_type['limit'];
374
+     // 			$sortable = true;
375
+     // 		}
376
+
377
+     // 		$cmb->add_field(
378
+     // 			array(
379
+     // 				'name'       => $download_type['title'],
380
+     // 				'id'         => 'download_' . $type,
381
+     // 				'type'       => 'post_search_ajax',
382
+     // 				'limit'      => $limit,
383
+     // 				'sortable'   => $sortable,
384
+     // 				'query_args' => array(
385
+     // 					'post_type'      => array( 'dlm_download' ),
386
+     // 					'post_status'    => array( 'publish' ),
387
+     // 					'posts_per_page' => -1,
388
+     // 				),
389
+     // 			)
390
+     // 		);
391
+     // 	}
392
+     // 	$cmb->add_field(
393
+     // 		array(
394
+     // 			'id'   => 'settings_global_downloads_closing',
395
+     // 			'type' => 'tab_closing',
396
+     // 		)
397
+     // 	);
398
+     // }
399
+
400
+     /**
401
+      * Registers the endpoint translation settings.
402
+      *
403
+      * @param object $cmb new_cmb2_box().
404
+      * @return void
405
+      */
406
+     // public function endpoint_translations( $cmb ) {
407
+     // 	$cmb->add_field(
408
+     // 		array(
409
+     // 			'id'          => 'endpoints_title',
410
+     // 			'type'        => 'title',
411
+     // 			'name'        => __( 'Set Endpoint Translations', 'lsx-health-plan' ),
412
+     // 			'default'     => __( 'Set Endpoint Translations', 'lsx-health-plan' ),
413
+     // 		)
414
+     // 	);
415
+     // 	foreach ( $this->endpoints as $slug => $endpoint_vars ) {
416
+     // 		if ( 'exercise' === $slug ) {
417
+     // 			continue;
418
+     // 		}
419
+
420
+     // 		$cmb->add_field(
421
+     // 			array(
422
+     // 				'name'    => $slug,
423
+     // 				'id'      => $slug,
424
+     // 				'type'    => 'input',
425
+     // 				'value'   => '',
426
+     // 				'default' => $endpoint_vars['default'],
427
+     // 			)
428
+     // 		);
429
+     // 	}
430
+     // 	$cmb->add_field(
431
+     // 		array(
432
+     // 			'id'            => 'settings_endpoints_closing',
433
+     // 			'type'          => 'tab_closing',
434
+     // 			'before_row'    => '<p style="margin-top:20px; font-style: italic;">Endpoint is a web address (URL) at which the user can gain access to it. You need to resave your permalinks after changing the endpoint settings.</p>',
435
+     // 		)
436
+     // 	);
437
+     // }
438
+
439
+     /**
440
+      * Registers the endpoint translation settings.
441
+      *
442
+      * @param object $cmb new_cmb2_box().
443
+      * @return void
444
+      */
445
+     // public function exercise_translations( $cmb ) {
446
+     // 	if ( isset( $this->endpoints['exercise'] ) && '' !== $this->endpoints['exercise'] && ! empty( $this->endpoints['exercise'] ) ) {
447
+     // 		$cmb->add_field(
448
+     // 			array(
449
+     // 				'id'          => 'exercise_endpoints_title',
450
+     // 				'type'        => 'title',
451
+     // 				'name'        => __( 'Set Exercise Translations', 'lsx-health-plan' ),
452
+     // 				'default'     => __( 'Set Exercise Translations', 'lsx-health-plan' ),
453
+     // 				'description' => __( 'Change the exercise endpoints.', 'lsx-health-plan' ),
454
+     // 			)
455
+     // 		);
456
+
457
+     // 		foreach ( $this->endpoints['exercise'] as $slug => $endpoint_vars ) {
458
+     // 			$cmb->add_field(
459
+     // 				array(
460
+     // 					'name'    => 'endpoint_' . $slug,
461
+     // 					'id'      => 'endpoint_' . $slug,
462
+     // 					'type'    => 'input',
463
+     // 					'value'   => '',
464
+     // 					'default' => $endpoint_vars['default'],
465
+     // 				)
466
+     // 			);
467
+     // 		}
468
+
469
+     // 		$cmb->add_field(
470
+     // 			array(
471
+     // 				'id'            => 'settings_exercise_endpoints_closing',
472
+     // 				'type'          => 'tab_closing',
473
+     // 				'before_row'    => '<p style="margin-top:20px; font-style: italic;">If you need to translate the exercise URL slugs, do so below.</p>',
474
+     // 			)
475
+     // 		);
476
+     // 	}
477
+     // }
478
+
479
+     /**
480
+      * Registers the post type toggle settings
481
+      *
482
+      * @param object $cmb new_cmb2_box().
483
+      * @return void
484
+      */
485
+     // public function post_type_toggles( $cmb ) {
486
+     // 	$post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) );
487
+
488
+     // 	$cmb->add_field(
489
+     // 		array(
490
+     // 			'id'          => 'post_type_toggles_title',
491
+     // 			'type'        => 'title',
492
+     // 			'name'        => __( 'Disable Post Types', 'lsx-health-plan' ),
493
+     // 			'default'     => __( 'Disable Post Types', 'lsx-health-plan' ),
494
+     // 			'description' => __( 'Disable post types if you are wanting a minimal site.', 'lsx-health-plan' ),
495
+     // 		)
496
+     // 	);
497
+
498
+     // 	foreach ( $post_types as $post_type ) {
499
+     // 		if ( 'plan' === $post_type || 'exercise' === $post_type || ( 'video' === $post_type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) ) {
500
+     // 			continue;
501
+     // 		}
502
+
503
+     // 		$cmb->add_field(
504
+     // 			array(
505
+     // 				'name'    => $post_type . '_disabled',
506
+     // 				'id'      => $post_type . '_disabled',
507
+     // 				'type'    => 'checkbox',
508
+     // 				'value'   => 1,
509
+     // 				'default' => 0,
510
+     // 			)
511
+     // 		);
512
+     // 	}
513
+
514
+     // 	$cmb->add_field(
515
+     // 		array(
516
+     // 			'id'   => 'settings_post_type_toggles_closing',
517
+     // 			'type' => 'tab_closing',
518
+     // 		)
519
+     // 	);
520 520
 
521 521
 		
522
-	// }
523
-
524
-	/**
525
-	 * Registers the Profile Stat Toggle settings
526
-	 *
527
-	 * @param object $cmb new_cmb2_box().
528
-	 * @return void
529
-	 */
530
-
531
-	// public function stat_disable( $cmb ) {
532
-	// 	$cmb->add_field(
533
-	// 		array(
534
-	// 			'id'      => 'stat_disable_title',
535
-	// 			'type'    => 'title',
536
-	// 			'name'    => __( 'My Plans', 'lsx-health-plan' ),
537
-	// 			'default' => __( 'My Plans', 'lsx-health-plan' ),
538
-	// 		)
539
-	// 	);
522
+     // }
523
+
524
+     /**
525
+      * Registers the Profile Stat Toggle settings
526
+      *
527
+      * @param object $cmb new_cmb2_box().
528
+      * @return void
529
+      */
530
+
531
+     // public function stat_disable( $cmb ) {
532
+     // 	$cmb->add_field(
533
+     // 		array(
534
+     // 			'id'      => 'stat_disable_title',
535
+     // 			'type'    => 'title',
536
+     // 			'name'    => __( 'My Plans', 'lsx-health-plan' ),
537
+     // 			'default' => __( 'My Plans', 'lsx-health-plan' ),
538
+     // 		)
539
+     // 	);
540 540
 		
541
-	// 	$cmb->add_field(
542
-	// 		array(
543
-	// 			'id'   => 'settings_stat_disable_closing',
544
-	// 			'type' => 'tab_closing',
545
-	// 		)
546
-	// 	);
547
-	// }
548
-
549
-	/**
550
-	 * Enable Business Directory Search settings only if LSX Search plugin is enabled.
551
-	 *
552
-	 * @param object $cmb The CMB2() class.
553
-	 * @param string $section either engine,archive or single.
554
-	 * @return void
555
-	 */
556
-	public function generate_tabs( $cmb ) {
557
-		$tabs = $this->get_settings_tabs();
558
-
559
-		foreach ( $tabs as $tab_key => $tab ) {
560
-			$cmb->add_field(
561
-				array(
562
-					'id'          => 'settings_' . $tab_key . '_title',
563
-					'type'        => 'title',
564
-					'name'        => $tab['title'],
565
-					'default'     => $tab['title'],
566
-					'description' => $tab['desc'],
567
-				)
568
-			);
569
-			do_action( 'lsx_hp_settings_page_' . $tab_key . '_top', $cmb );
570
-
571
-			do_action( 'lsx_hp_settings_page_' . $tab_key . '_middle', $cmb );
572
-
573
-			do_action( 'lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb );
574
-
575
-			$cmb->add_field(
576
-				array(
577
-					'id'   => 'settings_' . $tab_key . '_closing',
578
-					'type' => 'tab_closing',
579
-				)
580
-			);
581
-		}
582
-	}
583
-
584
-
585
-	/**
586
-	 * Returns the tabs and their descriptions.
587
-	 *
588
-	 * @return array
589
-	 */
590
-	public function get_settings_tabs() {
591
-		$tabs = array(
592
-			'general' => array(
593
-				'title' => __( 'General', 'lsx-health-plan' ),
594
-				'desc'  => __( 'Control the sitewide settings for the LSX HP site.', 'lsx-health-plan' ),
595
-			),
596
-		);
597
-
598
-		foreach ( $this->post_types as $post_type ) {
599
-			switch ( $post_type ) {
600
-				default:
601
-					//if ( ! in_array( $post_type, \lsx\search\includes\get_restricted_post_types() ) ) {
602
-						$temp_post_type = get_post_type_object( $post_type );
603
-						if ( ! is_wp_error( $temp_post_type ) ) {
604
-							$page_url    = get_post_type_archive_link( $temp_post_type->name );
605
-							$description = sprintf(
606
-								/* translators: %s: The subscription info */
607
-								__( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ),
608
-								$page_url,
609
-								$temp_post_type->label
610
-							);
611
-
612
-							$tabs[ $post_type ] = array(
613
-								'title' => $temp_post_type->label,
614
-								'desc'  => $description,
615
-							);
616
-						}
617
-					//}
618
-					break;
619
-			}
620
-		}
621
-		return $tabs;
622
-	}
541
+     // 	$cmb->add_field(
542
+     // 		array(
543
+     // 			'id'   => 'settings_stat_disable_closing',
544
+     // 			'type' => 'tab_closing',
545
+     // 		)
546
+     // 	);
547
+     // }
548
+
549
+     /**
550
+      * Enable Business Directory Search settings only if LSX Search plugin is enabled.
551
+      *
552
+      * @param object $cmb The CMB2() class.
553
+      * @param string $section either engine,archive or single.
554
+      * @return void
555
+      */
556
+     public function generate_tabs( $cmb ) {
557
+          $tabs = $this->get_settings_tabs();
558
+
559
+          foreach ( $tabs as $tab_key => $tab ) {
560
+               $cmb->add_field(
561
+                    array(
562
+                         'id'          => 'settings_' . $tab_key . '_title',
563
+                         'type'        => 'title',
564
+                         'name'        => $tab['title'],
565
+                         'default'     => $tab['title'],
566
+                         'description' => $tab['desc'],
567
+                    )
568
+               );
569
+               do_action( 'lsx_hp_settings_page_' . $tab_key . '_top', $cmb );
570
+
571
+               do_action( 'lsx_hp_settings_page_' . $tab_key . '_middle', $cmb );
572
+
573
+               do_action( 'lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb );
574
+
575
+               $cmb->add_field(
576
+                    array(
577
+                         'id'   => 'settings_' . $tab_key . '_closing',
578
+                         'type' => 'tab_closing',
579
+                    )
580
+               );
581
+          }
582
+     }
583
+
584
+
585
+     /**
586
+      * Returns the tabs and their descriptions.
587
+      *
588
+      * @return array
589
+      */
590
+     public function get_settings_tabs() {
591
+          $tabs = array(
592
+               'general' => array(
593
+                    'title' => __( 'General', 'lsx-health-plan' ),
594
+                    'desc'  => __( 'Control the sitewide settings for the LSX HP site.', 'lsx-health-plan' ),
595
+               ),
596
+          );
597
+
598
+          foreach ( $this->post_types as $post_type ) {
599
+               switch ( $post_type ) {
600
+                    default:
601
+                         //if ( ! in_array( $post_type, \lsx\search\includes\get_restricted_post_types() ) ) {
602
+                              $temp_post_type = get_post_type_object( $post_type );
603
+                              if ( ! is_wp_error( $temp_post_type ) ) {
604
+                                   $page_url    = get_post_type_archive_link( $temp_post_type->name );
605
+                                   $description = sprintf(
606
+                                        /* translators: %s: The subscription info */
607
+                                        __( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ),
608
+                                        $page_url,
609
+                                        $temp_post_type->label
610
+                                   );
611
+
612
+                                   $tabs[ $post_type ] = array(
613
+                                        'title' => $temp_post_type->label,
614
+                                        'desc'  => $description,
615
+                                   );
616
+                              }
617
+                         //}
618
+                         break;
619
+               }
620
+          }
621
+          return $tabs;
622
+     }
623 623
 }
Please login to merge, or discard this patch.
classes/admin/settings/class-meal.php 1 patch
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -12,146 +12,146 @@
 block discarded – undo
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 Endpoint', '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 Endpoint', '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 Slu', '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 Endpoint', '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 Endpoint', '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 Slu', '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
-				)
152
-			);
153
-		}
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
+                    )
152
+               );
153
+          }
154 154
 		
155
-	}
155
+     }
156 156
 }
157 157
 Meal::get_instance();
Please login to merge, or discard this patch.
classes/admin/settings/class-workout.php 1 patch
Indentation   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -12,243 +12,243 @@
 block discarded – undo
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
-				'id'          => 'workout_tab_layout',
86
-				'type'        => 'select',
87
-				'name'        => __( 'Workout Tab Layout', 'lsx-health-plan' ),
88
-				'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ),
89
-				'options'     => array(
90
-					'table' => __( 'Table', 'lsx-health-plan' ),
91
-					'list'  => __( 'List', 'lsx-health-plan' ),
92
-					'grid'  => __( 'Grid', 'lsx-health-plan' ),
93
-				),
94
-			)
95
-		);
96
-		$cmb->add_field(
97
-			array(
98
-				'id'          => 'workout_tab_link',
99
-				'type'        => 'select',
100
-				'name'        => __( 'Workout Tab Link', 'lsx-health-plan' ),
101
-				'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ),
102
-				'options'     => array(
103
-					''       => __( 'None', 'lsx-health-plan' ),
104
-					'single' => __( 'Single', 'lsx-health-plan' ),
105
-					'modal'  => __( 'Modal', 'lsx-health-plan' ),
106
-				),
107
-				'default' => 'modal',
108
-			)
109
-		);
110
-		$cmb->add_field(
111
-			array(
112
-				'id'          => 'workout_tab_modal_content',
113
-				'type'        => 'select',
114
-				'name'        => __( 'Modal Content', 'lsx-health-plan' ),
115
-				'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ),
116
-				'options'     => array(
117
-					''        => __( 'None', 'lsx-health-plan' ),
118
-					'excerpt' => __( 'Excerpt', 'lsx-health-plan' ),
119
-					'full'    => __( 'Full Content', 'lsx-health-plan' ),
120
-				),
121
-				'default' => '',
122
-			)
123
-		);
124
-		$cmb->add_field(
125
-			array(
126
-				'id'          => 'workout_tab_columns',
127
-				'type'        => 'select',
128
-				'name'        => __( 'Grid Columns', 'lsx-health-plan' ),
129
-				'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ),
130
-				'options'     => array(
131
-					'12' => __( '1', 'lsx-health-plan' ),
132
-					'6'  => __( '2', 'lsx-health-plan' ),
133
-					'4'  => __( '3', 'lsx-health-plan' ),
134
-					'3'  => __( '4', 'lsx-health-plan' ),
135
-					'2'  => __( '6', 'lsx-health-plan' ),
136
-				),
137
-				'default' => '4',
138
-			)
139
-		);
140
-		$cmb->add_field(
141
-			array(
142
-				'id'          => 'workout_tab_content',
143
-				'type'        => 'select',
144
-				'name'        => __( 'Grid Content', 'lsx-health-plan' ),
145
-				'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ),
146
-				'options'     => array(
147
-					''        => __( 'None', 'lsx-health-plan' ),
148
-					'excerpt' => __( 'Excerpt', 'lsx-health-plan' ),
149
-					'full'    => __( 'Full Content', 'lsx-health-plan' ),
150
-				),
151
-				'default'     => '',
152
-			)
153
-		);
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
+                    'id'          => 'workout_tab_layout',
86
+                    'type'        => 'select',
87
+                    'name'        => __( 'Workout Tab Layout', 'lsx-health-plan' ),
88
+                    'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ),
89
+                    'options'     => array(
90
+                         'table' => __( 'Table', 'lsx-health-plan' ),
91
+                         'list'  => __( 'List', 'lsx-health-plan' ),
92
+                         'grid'  => __( 'Grid', 'lsx-health-plan' ),
93
+                    ),
94
+               )
95
+          );
96
+          $cmb->add_field(
97
+               array(
98
+                    'id'          => 'workout_tab_link',
99
+                    'type'        => 'select',
100
+                    'name'        => __( 'Workout Tab Link', 'lsx-health-plan' ),
101
+                    'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ),
102
+                    'options'     => array(
103
+                         ''       => __( 'None', 'lsx-health-plan' ),
104
+                         'single' => __( 'Single', 'lsx-health-plan' ),
105
+                         'modal'  => __( 'Modal', 'lsx-health-plan' ),
106
+                    ),
107
+                    'default' => 'modal',
108
+               )
109
+          );
110
+          $cmb->add_field(
111
+               array(
112
+                    'id'          => 'workout_tab_modal_content',
113
+                    'type'        => 'select',
114
+                    'name'        => __( 'Modal Content', 'lsx-health-plan' ),
115
+                    'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ),
116
+                    'options'     => array(
117
+                         ''        => __( 'None', 'lsx-health-plan' ),
118
+                         'excerpt' => __( 'Excerpt', 'lsx-health-plan' ),
119
+                         'full'    => __( 'Full Content', 'lsx-health-plan' ),
120
+                    ),
121
+                    'default' => '',
122
+               )
123
+          );
124
+          $cmb->add_field(
125
+               array(
126
+                    'id'          => 'workout_tab_columns',
127
+                    'type'        => 'select',
128
+                    'name'        => __( 'Grid Columns', 'lsx-health-plan' ),
129
+                    'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ),
130
+                    'options'     => array(
131
+                         '12' => __( '1', 'lsx-health-plan' ),
132
+                         '6'  => __( '2', 'lsx-health-plan' ),
133
+                         '4'  => __( '3', 'lsx-health-plan' ),
134
+                         '3'  => __( '4', 'lsx-health-plan' ),
135
+                         '2'  => __( '6', 'lsx-health-plan' ),
136
+                    ),
137
+                    'default' => '4',
138
+               )
139
+          );
140
+          $cmb->add_field(
141
+               array(
142
+                    'id'          => 'workout_tab_content',
143
+                    'type'        => 'select',
144
+                    'name'        => __( 'Grid Content', 'lsx-health-plan' ),
145
+                    'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ),
146
+                    'options'     => array(
147
+                         ''        => __( 'None', 'lsx-health-plan' ),
148
+                         'excerpt' => __( 'Excerpt', 'lsx-health-plan' ),
149
+                         'full'    => __( 'Full Content', 'lsx-health-plan' ),
150
+                    ),
151
+                    'default'     => '',
152
+               )
153
+          );
154 154
 
155
-		$cmb->add_field(
156
-			array(
157
-				'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>',
158
-				'name'       =>  __( 'Single Workout Endpoint', 'lsx-health-plan' ),
159
-				'id'         => 'endpoint_workout',
160
-				'type'       => 'input',
161
-				'value'      => '',
162
-				'default'    => 'workout',
163
-			)
164
-		);
165
-		$cmb->add_field(
166
-			array(
167
-				'name'    =>  __( 'Workouts Archive Endpoint', 'lsx-health-plan' ),
168
-				'id'      => 'endpoint_workout_archive',
169
-				'type'    => 'input',
170
-				'value'   => '',
171
-				'default' => 'workouts',
172
-			)
173
-		);
174
-		$cmb->add_field(
175
-			array(
176
-				'name'    =>  __( 'Warm Up Endpoint', 'lsx-health-plan' ),
177
-				'id'      => 'endpoint_warm_up',
178
-				'type'    => 'input',
179
-				'value'   => '',
180
-				'default' => 'warm-up',
181
-			)
182
-		);
155
+          $cmb->add_field(
156
+               array(
157
+                    '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>',
158
+                    'name'       =>  __( 'Single Workout Endpoint', 'lsx-health-plan' ),
159
+                    'id'         => 'endpoint_workout',
160
+                    'type'       => 'input',
161
+                    'value'      => '',
162
+                    'default'    => 'workout',
163
+               )
164
+          );
165
+          $cmb->add_field(
166
+               array(
167
+                    'name'    =>  __( 'Workouts Archive Endpoint', 'lsx-health-plan' ),
168
+                    'id'      => 'endpoint_workout_archive',
169
+                    'type'    => 'input',
170
+                    'value'   => '',
171
+                    'default' => 'workouts',
172
+               )
173
+          );
174
+          $cmb->add_field(
175
+               array(
176
+                    'name'    =>  __( 'Warm Up Endpoint', 'lsx-health-plan' ),
177
+                    'id'      => 'endpoint_warm_up',
178
+                    'type'    => 'input',
179
+                    'value'   => '',
180
+                    'default' => 'warm-up',
181
+               )
182
+          );
183 183
 		
184 184
 		
185
-		$cmb->add_field(
186
-			array(
187
-				'before_row'  => '<h4><b><u>Default Options</u></b></h4>',
188
-				'name'        => __( 'Warm Up', 'lsx-health-plan' ),
189
-				'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
190
-				'limit'       => 1,
191
-				'id'          => 'plan_warmup',
192
-				'type'        => 'post_search_ajax',
193
-				'query_args'  => array(
194
-					'post_type'      => 'post',
195
-					'post_status'    => array( 'publish' ),
196
-					'posts_per_page' => -1,
197
-				),
198
-			)
199
-		);
200
-		$cmb->add_field(
201
-			array(
202
-				'name'        => __( 'Workout', 'lsx-health-plan' ),
203
-				'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ),
204
-				'limit'       => 1,
205
-				'id'          => 'connected_workouts',
206
-				'type'        => 'post_search_ajax',
207
-				'query_args'  => array(
208
-					'post_type'      => 'workout',
209
-					'post_status'    => array( 'publish' ),
210
-					'posts_per_page' => -1,
211
-				),
212
-			)
213
-		);
214
-		if ( function_exists( 'download_monitor' ) ) {
215
-			$page_url    = 'https://wordpress.org/plugins/download-monitor/';
216
-			$plugin_name = 'Download Monitor';
217
-			$description = sprintf(
218
-				/* translators: %s: The subscription info */
219
-				__( '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' ),
220
-				$page_url,
221
-				$plugin_name
222
-			);
223
-			$cmb->add_field(
224
-				array(
225
-					'name'        => __( 'Default Warm Up PDF', 'lsx-health-plan' ),
226
-					'description' => $description,
227
-					'id'          => 'download_page',
228
-					'type'        => 'post_search_ajax',
229
-					'limit'       => 1,
230
-					'query_args'  => array(
231
-						'post_type'      => array( 'dlm_download' ),
232
-						'post_status'    => array( 'publish' ),
233
-						'posts_per_page' => -1,
234
-					),
235
-				)
236
-			);
237
-			$cmb->add_field(
238
-				array(
239
-					'name'        => __( 'Default Workout PDF', 'lsx-health-plan' ),
240
-					'description' => $description,
241
-					'id'          => 'download_workout',
242
-					'type'        => 'post_search_ajax',
243
-					'limit'       => 1,
244
-					'query_args'  => array(
245
-						'post_type'      => array( 'dlm_download' ),
246
-						'post_status'    => array( 'publish' ),
247
-						'posts_per_page' => -1,
248
-					),
249
-				)
250
-			);
251
-		}
252
-	}
185
+          $cmb->add_field(
186
+               array(
187
+                    'before_row'  => '<h4><b><u>Default Options</u></b></h4>',
188
+                    'name'        => __( 'Warm Up', 'lsx-health-plan' ),
189
+                    'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
190
+                    'limit'       => 1,
191
+                    'id'          => 'plan_warmup',
192
+                    'type'        => 'post_search_ajax',
193
+                    'query_args'  => array(
194
+                         'post_type'      => 'post',
195
+                         'post_status'    => array( 'publish' ),
196
+                         'posts_per_page' => -1,
197
+                    ),
198
+               )
199
+          );
200
+          $cmb->add_field(
201
+               array(
202
+                    'name'        => __( 'Workout', 'lsx-health-plan' ),
203
+                    'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ),
204
+                    'limit'       => 1,
205
+                    'id'          => 'connected_workouts',
206
+                    'type'        => 'post_search_ajax',
207
+                    'query_args'  => array(
208
+                         'post_type'      => 'workout',
209
+                         'post_status'    => array( 'publish' ),
210
+                         'posts_per_page' => -1,
211
+                    ),
212
+               )
213
+          );
214
+          if ( function_exists( 'download_monitor' ) ) {
215
+               $page_url    = 'https://wordpress.org/plugins/download-monitor/';
216
+               $plugin_name = 'Download Monitor';
217
+               $description = sprintf(
218
+                    /* translators: %s: The subscription info */
219
+                    __( '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' ),
220
+                    $page_url,
221
+                    $plugin_name
222
+               );
223
+               $cmb->add_field(
224
+                    array(
225
+                         'name'        => __( 'Default Warm Up PDF', 'lsx-health-plan' ),
226
+                         'description' => $description,
227
+                         'id'          => 'download_page',
228
+                         'type'        => 'post_search_ajax',
229
+                         'limit'       => 1,
230
+                         'query_args'  => array(
231
+                              'post_type'      => array( 'dlm_download' ),
232
+                              'post_status'    => array( 'publish' ),
233
+                              'posts_per_page' => -1,
234
+                         ),
235
+                    )
236
+               );
237
+               $cmb->add_field(
238
+                    array(
239
+                         'name'        => __( 'Default Workout PDF', 'lsx-health-plan' ),
240
+                         'description' => $description,
241
+                         'id'          => 'download_workout',
242
+                         'type'        => 'post_search_ajax',
243
+                         'limit'       => 1,
244
+                         'query_args'  => array(
245
+                              'post_type'      => array( 'dlm_download' ),
246
+                              'post_status'    => array( 'publish' ),
247
+                              'posts_per_page' => -1,
248
+                         ),
249
+                    )
250
+               );
251
+          }
252
+     }
253 253
 }
254 254
 Workout::get_instance();
Please login to merge, or discard this patch.
classes/admin/settings/class-exercise.php 1 patch
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -12,111 +12,111 @@
 block discarded – undo
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
-			)
119
-		);
120
-	}
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
+               )
119
+          );
120
+     }
121 121
 }
122 122
 Exercise::get_instance();
Please login to merge, or discard this patch.
classes/admin/settings/class-plan.php 1 patch
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -12,132 +12,132 @@
 block discarded – undo
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 Endpoint', '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 Endpoint', '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
-			)
140
-		);
141
-	}
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
+               )
140
+          );
141
+     }
142 142
 }
143 143
 Plan::get_instance();
Please login to merge, or discard this patch.
classes/admin/settings/class-recipe.php 1 patch
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -12,127 +12,127 @@
 block discarded – undo
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 Endpoint', '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 Endpoint', '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
-				)
134
-			);
135
-		}
136
-	}
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
+                    )
134
+               );
135
+          }
136
+     }
137 137
 }
138 138
 Recipe::get_instance();
Please login to merge, or discard this patch.