Passed
Push — add/multiplan ( a119bd...15cba9 )
by Virginia
05:11
created
templates/partials/help.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1 1
 <?php
2
-	$lsx_hp_documentation = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/getting-started/' );
3
-	$lsx_hp_settings      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/installation/' );
4
-	$lsx_hp_features      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/' );
5
-	$version              = esc_html( LSX_HEALTH_PLAN_VER );
2
+     $lsx_hp_documentation = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/getting-started/' );
3
+     $lsx_hp_settings      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/installation/' );
4
+     $lsx_hp_features      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/' );
5
+     $version              = esc_html( LSX_HEALTH_PLAN_VER );
6 6
 
7
-	//Product Urls
8
-	$health_plan_link  = esc_url( 'https://wordpress.org/plugins/lsx-health-plan/' );
9
-	$lsx_hp_plans      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/plans/' );
10
-	$lsx_hp_weeks      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/plans/#week' );
11
-	$lsx_hp_tips       = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/tips/' );
12
-	$lsx_hp_workouts   = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/workouts/' );
13
-	$lsx_hp_exercises  = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/exercises/' );
14
-	$lsx_hp_meals      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/meals/' );
15
-	$lsx_hp_recipes    = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/recipes/' );
16
-	$lsx_hp_shortcodes = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/shortcodes/' );
7
+     //Product Urls
8
+     $health_plan_link  = esc_url( 'https://wordpress.org/plugins/lsx-health-plan/' );
9
+     $lsx_hp_plans      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/plans/' );
10
+     $lsx_hp_weeks      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/plans/#week' );
11
+     $lsx_hp_tips       = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/tips/' );
12
+     $lsx_hp_workouts   = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/workouts/' );
13
+     $lsx_hp_exercises  = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/exercises/' );
14
+     $lsx_hp_meals      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/meals/' );
15
+     $lsx_hp_recipes    = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/recipes/' );
16
+     $lsx_hp_shortcodes = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/shortcodes/' );
17 17
 	
18 18
 ?>
19 19
 
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2
-	$lsx_hp_documentation = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/getting-started/' );
3
-	$lsx_hp_settings      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/installation/' );
4
-	$lsx_hp_features      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/' );
5
-	$version              = esc_html( LSX_HEALTH_PLAN_VER );
2
+	$lsx_hp_documentation = esc_url('https://www.lsdev.biz/lsx/documentation/lsx-health/getting-started/');
3
+	$lsx_hp_settings      = esc_url('https://www.lsdev.biz/lsx/documentation/lsx-health/installation/');
4
+	$lsx_hp_features      = esc_url('https://www.lsdev.biz/lsx/documentation/lsx-health/');
5
+	$version              = esc_html(LSX_HEALTH_PLAN_VER);
6 6
 
7 7
 	//Product Urls
8
-	$health_plan_link  = esc_url( 'https://wordpress.org/plugins/lsx-health-plan/' );
9
-	$lsx_hp_plans      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/plans/' );
10
-	$lsx_hp_weeks      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/plans/#week' );
11
-	$lsx_hp_tips       = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/tips/' );
12
-	$lsx_hp_workouts   = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/workouts/' );
13
-	$lsx_hp_exercises  = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/exercises/' );
14
-	$lsx_hp_meals      = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/meals/' );
15
-	$lsx_hp_recipes    = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/recipes/' );
16
-	$lsx_hp_shortcodes = esc_url( 'https://www.lsdev.biz/lsx/documentation/lsx-health/shortcodes/' );
8
+	$health_plan_link  = esc_url('https://wordpress.org/plugins/lsx-health-plan/');
9
+	$lsx_hp_plans      = esc_url('https://www.lsdev.biz/lsx/documentation/lsx-health/plans/');
10
+	$lsx_hp_weeks      = esc_url('https://www.lsdev.biz/lsx/documentation/lsx-health/plans/#week');
11
+	$lsx_hp_tips       = esc_url('https://www.lsdev.biz/lsx/documentation/lsx-health/tips/');
12
+	$lsx_hp_workouts   = esc_url('https://www.lsdev.biz/lsx/documentation/lsx-health/workouts/');
13
+	$lsx_hp_exercises  = esc_url('https://www.lsdev.biz/lsx/documentation/lsx-health/exercises/');
14
+	$lsx_hp_meals      = esc_url('https://www.lsdev.biz/lsx/documentation/lsx-health/meals/');
15
+	$lsx_hp_recipes    = esc_url('https://www.lsdev.biz/lsx/documentation/lsx-health/recipes/');
16
+	$lsx_hp_shortcodes = esc_url('https://www.lsdev.biz/lsx/documentation/lsx-health/shortcodes/');
17 17
 	
18 18
 ?>
19 19
 
@@ -22,27 +22,27 @@  discard block
 block discarded – undo
22 22
 		<div class="row">
23 23
 			<div class="col-md-12">
24 24
 				<div class="box documentation">
25
-					<h2><?php esc_html_e( 'Getting Support', 'lsx-health-plan' ); ?></h2>
26
-					<p><?php esc_html_e( 'Our website\'s', 'lsx-health-plan' ); ?> <a href="<?php echo wp_kses_post( $lsx_hp_documentation ); ?>" target="_blank"><?php esc_html_e( 'documentation', 'lsx-health-plan' ); ?></a> <?php esc_html_e( 'page is a great place to start to learn how to configure and customize our plugin. Here are some links to some of the key settings and modules:', 'lsx-health-plan' ); ?></p>
25
+					<h2><?php esc_html_e('Getting Support', 'lsx-health-plan'); ?></h2>
26
+					<p><?php esc_html_e('Our website\'s', 'lsx-health-plan'); ?> <a href="<?php echo wp_kses_post($lsx_hp_documentation); ?>" target="_blank"><?php esc_html_e('documentation', 'lsx-health-plan'); ?></a> <?php esc_html_e('page is a great place to start to learn how to configure and customize our plugin. Here are some links to some of the key settings and modules:', 'lsx-health-plan'); ?></p>
27 27
 
28 28
 					<ul>
29
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_documentation ); ?>" target="_blank"><?php esc_html_e( 'Getting Started:', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( 'Setup a new Health Plan site from scratch.', 'lsx-health-plan' ); ?></li>
30
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_settings ); ?>" target="_blank"><?php esc_html_e( 'Settings overview:', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( 'A thorough walkthrough of The Health Plan site configuration options and the settings that are available to you.', 'lsx-health-plan' ); ?></li>
31
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_features ); ?>" target="_blank"><?php esc_html_e( 'Features overview:', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( 'A complete look at the features you can expect to see right out of the box as well as how to use them.', 'lsx-health-plan' ); ?></li>
29
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_documentation); ?>" target="_blank"><?php esc_html_e('Getting Started:', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('Setup a new Health Plan site from scratch.', 'lsx-health-plan'); ?></li>
30
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_settings); ?>" target="_blank"><?php esc_html_e('Settings overview:', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('A thorough walkthrough of The Health Plan site configuration options and the settings that are available to you.', 'lsx-health-plan'); ?></li>
31
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_features); ?>" target="_blank"><?php esc_html_e('Features overview:', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('A complete look at the features you can expect to see right out of the box as well as how to use them.', 'lsx-health-plan'); ?></li>
32 32
 
33
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_plans ); ?>" target="_blank"><?php esc_html_e( 'Plans', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( '(Parent Post Type)', 'lsx-health-plan' ); ?></li>
34
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_weeks ); ?>" target="_blank"><?php esc_html_e( 'Weeks', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( '(Global Taxonomy)', 'lsx-health-plan' ); ?></li>
35
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_tips ); ?>" target="_blank"><?php esc_html_e( 'Tips', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( '(Global Post type connected to all other post types)', 'lsx-health-plan' ); ?></li>
36
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_workouts ); ?>" target="_blank"><?php esc_html_e( 'Workouts', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( '(Plans Child Post Type)', 'lsx-health-plan' ); ?></li>
37
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_exercises ); ?>" target="_blank"><?php esc_html_e( 'Exercises', 'lsx-health-plan' ); ?></a></strong>  <?php esc_html_e( '(Workouts Child Post Type)', 'lsx-health-plan' ); ?></li>
38
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_exercises ); ?>" target="_blank"><?php esc_html_e( 'Exercise Types', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( '(Exercises Taxonomy)', 'lsx-health-plan' ); ?></li>
39
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_exercises ); ?>" target="_blank"><?php esc_html_e( 'Equipment', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( '(Exercises Taxonomy)', 'lsx-health-plan' ); ?></li>
40
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_exercises ); ?>" target="_blank"><?php esc_html_e( 'Muscle Group ', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( '(Exercises Taxonomy)', 'lsx-health-plan' ); ?></li>
41
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_meals ); ?>" target="_blank"><?php esc_html_e( 'Meals', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( '(Plans Child Post Type)', 'lsx-health-plan' ); ?></li>
42
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_recipes ); ?>" target="_blank"><?php esc_html_e( 'Recipes', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( '(Meal Plans Child Post Type)', 'lsx-health-plan' ); ?></li>
43
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_recipes ); ?>" target="_blank"><?php esc_html_e( 'Types', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( '(Recipes Taxonomy)', 'lsx-health-plan' ); ?></li>
44
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_recipes ); ?>" target="_blank"><?php esc_html_e( 'Cuisines', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( '(Recipes Taxonomy)', 'lsx-health-plan' ); ?></li>
45
-						<li><strong><a href="<?php echo wp_kses_post( $lsx_hp_shortcodes ); ?>" target="_blank"><?php esc_html_e( 'Shortcodes:', 'lsx-health-plan' ); ?></a></strong> <?php esc_html_e( 'Insert content blocks for any content type.', 'lsx-health-plan' ); ?></li>
33
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_plans); ?>" target="_blank"><?php esc_html_e('Plans', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('(Parent Post Type)', 'lsx-health-plan'); ?></li>
34
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_weeks); ?>" target="_blank"><?php esc_html_e('Weeks', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('(Global Taxonomy)', 'lsx-health-plan'); ?></li>
35
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_tips); ?>" target="_blank"><?php esc_html_e('Tips', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('(Global Post type connected to all other post types)', 'lsx-health-plan'); ?></li>
36
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_workouts); ?>" target="_blank"><?php esc_html_e('Workouts', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('(Plans Child Post Type)', 'lsx-health-plan'); ?></li>
37
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_exercises); ?>" target="_blank"><?php esc_html_e('Exercises', 'lsx-health-plan'); ?></a></strong>  <?php esc_html_e('(Workouts Child Post Type)', 'lsx-health-plan'); ?></li>
38
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_exercises); ?>" target="_blank"><?php esc_html_e('Exercise Types', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('(Exercises Taxonomy)', 'lsx-health-plan'); ?></li>
39
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_exercises); ?>" target="_blank"><?php esc_html_e('Equipment', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('(Exercises Taxonomy)', 'lsx-health-plan'); ?></li>
40
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_exercises); ?>" target="_blank"><?php esc_html_e('Muscle Group ', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('(Exercises Taxonomy)', 'lsx-health-plan'); ?></li>
41
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_meals); ?>" target="_blank"><?php esc_html_e('Meals', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('(Plans Child Post Type)', 'lsx-health-plan'); ?></li>
42
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_recipes); ?>" target="_blank"><?php esc_html_e('Recipes', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('(Meal Plans Child Post Type)', 'lsx-health-plan'); ?></li>
43
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_recipes); ?>" target="_blank"><?php esc_html_e('Types', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('(Recipes Taxonomy)', 'lsx-health-plan'); ?></li>
44
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_recipes); ?>" target="_blank"><?php esc_html_e('Cuisines', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('(Recipes Taxonomy)', 'lsx-health-plan'); ?></li>
45
+						<li><strong><a href="<?php echo wp_kses_post($lsx_hp_shortcodes); ?>" target="_blank"><?php esc_html_e('Shortcodes:', 'lsx-health-plan'); ?></a></strong> <?php esc_html_e('Insert content blocks for any content type.', 'lsx-health-plan'); ?></li>
46 46
 					</ul>
47 47
 				</div>
48 48
 			</div>
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 		<div class="row">
56 56
 			<div class="col-md-12">
57 57
 				<div class="box info">
58
-					<h2><?php esc_html_e( 'Health Plan', 'lsx-health-plan' ); ?></h2>
58
+					<h2><?php esc_html_e('Health Plan', 'lsx-health-plan'); ?></h2>
59 59
 
60 60
 					<ul>
61
-						<li><strong><?php esc_html_e( 'Latest Version:', 'lsx-health-plan' ); ?></strong> <?php echo esc_attr( $version ); ?></li>
62
-						<li><strong><?php esc_html_e( 'Requires:', 'lsx-health-plan' ); ?></strong> <?php esc_html_e( 'WordPress 5.0+', 'lsx-health-plan' ); ?></li>
63
-						<li><strong><?php esc_html_e( 'Tested up to:', 'lsx-health-plan' ); ?></strong> <?php esc_html_e( 'WordPress 5.0', 'lsx-health-plan' ); ?></li>
61
+						<li><strong><?php esc_html_e('Latest Version:', 'lsx-health-plan'); ?></strong> <?php echo esc_attr($version); ?></li>
62
+						<li><strong><?php esc_html_e('Requires:', 'lsx-health-plan'); ?></strong> <?php esc_html_e('WordPress 5.0+', 'lsx-health-plan'); ?></li>
63
+						<li><strong><?php esc_html_e('Tested up to:', 'lsx-health-plan'); ?></strong> <?php esc_html_e('WordPress 5.0', 'lsx-health-plan'); ?></li>
64 64
 					</ul>
65 65
 
66 66
 					<div class="more-button">
67
-						<a href="<?php echo wp_kses_post( $health_plan_link ); ?>" target="_blank" class="button button-primary">
68
-							<?php esc_html_e( 'Visit plugin website', 'lsx-health-plan' ); ?>
67
+						<a href="<?php echo wp_kses_post($health_plan_link); ?>" target="_blank" class="button button-primary">
68
+							<?php esc_html_e('Visit plugin website', 'lsx-health-plan'); ?>
69 69
 						</a>
70 70
 					</div>
71 71
 				</div>
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 		<div class="row">
76 76
 			<div class="col-md-12">
77 77
 				<div class="box news">
78
-					<h3><?php esc_html_e( 'Support', 'lsx-health-plan' ); ?></h3>
79
-					<p><?php esc_html_e( 'If the documentation is not getting you where you need to be, you can contact us directly for support and assistance.', 'lsx-health-plan' ); ?></p>
80
-					<p><?php esc_html_e( 'You can contact us for support at', 'lsx-health-plan' ); ?> <a href="mailto:[email protected]"><?php esc_html_e( '[email protected].', 'lsx-health-plan' ); ?></a></p>
78
+					<h3><?php esc_html_e('Support', 'lsx-health-plan'); ?></h3>
79
+					<p><?php esc_html_e('If the documentation is not getting you where you need to be, you can contact us directly for support and assistance.', 'lsx-health-plan'); ?></p>
80
+					<p><?php esc_html_e('You can contact us for support at', 'lsx-health-plan'); ?> <a href="mailto:[email protected]"><?php esc_html_e('[email protected].', 'lsx-health-plan'); ?></a></p>
81 81
 				</div>
82 82
 			</div>
83 83
 		</div>
Please login to merge, or discard this patch.
classes/admin/class-help-page.php 2 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -12,134 +12,134 @@
 block discarded – undo
12 12
  */
13 13
 class Help_Page {
14 14
 
15
-	/**
16
-	 * Holds class instance
17
-	 *
18
-	 * @since 1.0.0
19
-	 *
20
-	 * @var      object \lsx_health_plan\classes\admin\Help_Page()
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_hp_help';
30
-
31
-	/**
32
-	 * Constructor
33
-	 */
34
-	public function __construct() {
35
-		add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) );
36
-		add_action( 'admin_menu', array( $this, 'register_menu' ) );
37
-		add_action( 'lsx_hp_help', array( $this, 'header' ), 10 );
38
-		add_action( 'lsx_hp_help', array( $this, 'body' ), 20 );
39
-		add_action( 'lsx_hp_help', array( $this, 'footer' ), 30 );
40
-	}
41
-
42
-	/**
43
-	 * Return an instance of this class.
44
-	 *
45
-	 * @since 1.0.0
46
-	 *
47
-	 * @return    object \lsx_health_plan\classes\admin\Help_Page()    A single instance of this class.
48
-	 */
49
-	public static function get_instance() {
50
-		// If the single instance hasn't been set, set it now.
51
-		if ( null === self::$instance ) {
52
-			self::$instance = new self();
53
-		}
54
-		return self::$instance;
55
-	}
56
-
57
-
58
-
59
-	/**
60
-	 * Load hp_help screen css.
61
-	 *
62
-	 * @package    lsx
63
-	 * @subpackage hp-help-page
64
-	 *
65
-	 * @param string $hook_suffix the current page hook suffix.
66
-	 */
67
-	public function assets( $hook_suffix ) {
68
-		if ( 'plan_page_help' === $hook_suffix ) {
69
-			wp_enqueue_style( 'lsx-hp-help-screen', LSX_HEALTH_PLAN_URL . 'assets/css/help.css', array(), LSX_HEALTH_PLAN_VER );
70
-			wp_style_add_data( 'lsx-hp-help-screen', 'rtl', 'replace' );
71
-		}
72
-	}
73
-
74
-	/**
75
-	 * Creates the dashboard page.
76
-	 *
77
-	 * @package    lsx
78
-	 * @subpackage hp-help-page
79
-	 */
80
-	public function register_menu() {
81
-		add_submenu_page( 'edit.php?post_type=plan', __( 'Help', 'lsx-health-plan' ), __( 'Help', 'lsx-health-plan' ), 'manage_options', 'help', array( $this, 'screen' ) );
82
-	}
83
-
84
-
85
-	/**
86
-	 * The help screen.
87
-	 *
88
-	 * @package    lsx
89
-	 * @subpackage hp-help-page
90
-	 */
91
-	public function screen() {
92
-		require_once ABSPATH . 'wp-load.php';
93
-		require_once ABSPATH . 'wp-admin/admin.php';
94
-		require_once ABSPATH . 'wp-admin/admin-header.php';
95
-		?>
15
+     /**
16
+      * Holds class instance
17
+      *
18
+      * @since 1.0.0
19
+      *
20
+      * @var      object \lsx_health_plan\classes\admin\Help_Page()
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_hp_help';
30
+
31
+     /**
32
+      * Constructor
33
+      */
34
+     public function __construct() {
35
+          add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) );
36
+          add_action( 'admin_menu', array( $this, 'register_menu' ) );
37
+          add_action( 'lsx_hp_help', array( $this, 'header' ), 10 );
38
+          add_action( 'lsx_hp_help', array( $this, 'body' ), 20 );
39
+          add_action( 'lsx_hp_help', array( $this, 'footer' ), 30 );
40
+     }
41
+
42
+     /**
43
+      * Return an instance of this class.
44
+      *
45
+      * @since 1.0.0
46
+      *
47
+      * @return    object \lsx_health_plan\classes\admin\Help_Page()    A single instance of this class.
48
+      */
49
+     public static function get_instance() {
50
+          // If the single instance hasn't been set, set it now.
51
+          if ( null === self::$instance ) {
52
+               self::$instance = new self();
53
+          }
54
+          return self::$instance;
55
+     }
56
+
57
+
58
+
59
+     /**
60
+      * Load hp_help screen css.
61
+      *
62
+      * @package    lsx
63
+      * @subpackage hp-help-page
64
+      *
65
+      * @param string $hook_suffix the current page hook suffix.
66
+      */
67
+     public function assets( $hook_suffix ) {
68
+          if ( 'plan_page_help' === $hook_suffix ) {
69
+               wp_enqueue_style( 'lsx-hp-help-screen', LSX_HEALTH_PLAN_URL . 'assets/css/help.css', array(), LSX_HEALTH_PLAN_VER );
70
+               wp_style_add_data( 'lsx-hp-help-screen', 'rtl', 'replace' );
71
+          }
72
+     }
73
+
74
+     /**
75
+      * Creates the dashboard page.
76
+      *
77
+      * @package    lsx
78
+      * @subpackage hp-help-page
79
+      */
80
+     public function register_menu() {
81
+          add_submenu_page( 'edit.php?post_type=plan', __( 'Help', 'lsx-health-plan' ), __( 'Help', 'lsx-health-plan' ), 'manage_options', 'help', array( $this, 'screen' ) );
82
+     }
83
+
84
+
85
+     /**
86
+      * The help screen.
87
+      *
88
+      * @package    lsx
89
+      * @subpackage hp-help-page
90
+      */
91
+     public function screen() {
92
+          require_once ABSPATH . 'wp-load.php';
93
+          require_once ABSPATH . 'wp-admin/admin.php';
94
+          require_once ABSPATH . 'wp-admin/admin-header.php';
95
+          ?>
96 96
 		<div class="wrap about-wrap">
97 97
 			<?php
98
-			/**
99
-			 * Functions hooked into lsx_hp_help action
100
-			 *
101
-			 * @hooked lsx_hp_help_header  - 10
102
-			 * @hooked lsx_hp_help_body - 20
103
-			 * @hooked lsx_hp_help_footer  - 30
104
-			 */
105
-			do_action( 'lsx_hp_help' );
106
-			?>
98
+               /**
99
+                * Functions hooked into lsx_hp_help action
100
+                *
101
+                * @hooked lsx_hp_help_header  - 10
102
+                * @hooked lsx_hp_help_body - 20
103
+                * @hooked lsx_hp_help_footer  - 30
104
+                */
105
+               do_action( 'lsx_hp_help' );
106
+               ?>
107 107
 		</div>
108 108
 		<?php
109
-	}
110
-
111
-	/**
112
-	 * Help screen intro.
113
-	 *
114
-	 * @package    lsx
115
-	 * @subpackage hp-help-page
116
-	 */
117
-	public function header() {
118
-		?>
109
+     }
110
+
111
+     /**
112
+      * Help screen intro.
113
+      *
114
+      * @package    lsx
115
+      * @subpackage hp-help-page
116
+      */
117
+     public function header() {
118
+          ?>
119 119
 		<div class="enrich">
120 120
 			<h2><?php esc_html_e( 'LightSpeed’s LSX Health Plugin', 'lsx-health-plan' ); ?></h2>
121 121
 			<p><?php esc_html_e( "Thank you for using the LSX Health plugin. All of us here at LightSpeed appreciate your ongoing support and we can't wait to see what people create with the plugin. We're committed to ensuring you have all the help you need to make the most of the plugin.", 'lsx-health-plan' ); ?></p>
122 122
 		</div>
123 123
 		<?php
124
-	}
125
-
126
-	/**
127
-	 * Help screen body section.
128
-	 *
129
-	 * @package    lsx
130
-	 * @subpackage hp-help-page
131
-	 */
132
-	public function body() {
133
-		include LSX_HEALTH_PLAN_PATH . 'templates/partials/help.php';
134
-	}
135
-
136
-	/**
137
-	 * Help screen contribute section.
138
-	 *
139
-	 * @package    lsx
140
-	 * @subpackage hp-help-page
141
-	 */
142
-	public function footer() {
143
-
144
-	}
124
+     }
125
+
126
+     /**
127
+      * Help screen body section.
128
+      *
129
+      * @package    lsx
130
+      * @subpackage hp-help-page
131
+      */
132
+     public function body() {
133
+          include LSX_HEALTH_PLAN_PATH . 'templates/partials/help.php';
134
+     }
135
+
136
+     /**
137
+      * Help screen contribute section.
138
+      *
139
+      * @package    lsx
140
+      * @subpackage hp-help-page
141
+      */
142
+     public function footer() {
143
+
144
+     }
145 145
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 	 * Constructor
33 33
 	 */
34 34
 	public function __construct() {
35
-		add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) );
36
-		add_action( 'admin_menu', array( $this, 'register_menu' ) );
37
-		add_action( 'lsx_hp_help', array( $this, 'header' ), 10 );
38
-		add_action( 'lsx_hp_help', array( $this, 'body' ), 20 );
39
-		add_action( 'lsx_hp_help', array( $this, 'footer' ), 30 );
35
+		add_action('admin_enqueue_scripts', array($this, 'assets'));
36
+		add_action('admin_menu', array($this, 'register_menu'));
37
+		add_action('lsx_hp_help', array($this, 'header'), 10);
38
+		add_action('lsx_hp_help', array($this, 'body'), 20);
39
+		add_action('lsx_hp_help', array($this, 'footer'), 30);
40 40
 	}
41 41
 
42 42
 	/**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public static function get_instance() {
50 50
 		// If the single instance hasn't been set, set it now.
51
-		if ( null === self::$instance ) {
51
+		if (null === self::$instance) {
52 52
 			self::$instance = new self();
53 53
 		}
54 54
 		return self::$instance;
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @param string $hook_suffix the current page hook suffix.
66 66
 	 */
67
-	public function assets( $hook_suffix ) {
68
-		if ( 'plan_page_help' === $hook_suffix ) {
69
-			wp_enqueue_style( 'lsx-hp-help-screen', LSX_HEALTH_PLAN_URL . 'assets/css/help.css', array(), LSX_HEALTH_PLAN_VER );
70
-			wp_style_add_data( 'lsx-hp-help-screen', 'rtl', 'replace' );
67
+	public function assets($hook_suffix) {
68
+		if ('plan_page_help' === $hook_suffix) {
69
+			wp_enqueue_style('lsx-hp-help-screen', LSX_HEALTH_PLAN_URL . 'assets/css/help.css', array(), LSX_HEALTH_PLAN_VER);
70
+			wp_style_add_data('lsx-hp-help-screen', 'rtl', 'replace');
71 71
 		}
72 72
 	}
73 73
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @subpackage hp-help-page
79 79
 	 */
80 80
 	public function register_menu() {
81
-		add_submenu_page( 'edit.php?post_type=plan', __( 'Help', 'lsx-health-plan' ), __( 'Help', 'lsx-health-plan' ), 'manage_options', 'help', array( $this, 'screen' ) );
81
+		add_submenu_page('edit.php?post_type=plan', __('Help', 'lsx-health-plan'), __('Help', 'lsx-health-plan'), 'manage_options', 'help', array($this, 'screen'));
82 82
 	}
83 83
 
84 84
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 			 * @hooked lsx_hp_help_body - 20
103 103
 			 * @hooked lsx_hp_help_footer  - 30
104 104
 			 */
105
-			do_action( 'lsx_hp_help' );
105
+			do_action('lsx_hp_help');
106 106
 			?>
107 107
 		</div>
108 108
 		<?php
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	public function header() {
118 118
 		?>
119 119
 		<div class="enrich">
120
-			<h2><?php esc_html_e( 'LightSpeed’s LSX Health Plugin', 'lsx-health-plan' ); ?></h2>
121
-			<p><?php esc_html_e( "Thank you for using the LSX Health plugin. All of us here at LightSpeed appreciate your ongoing support and we can't wait to see what people create with the plugin. We're committed to ensuring you have all the help you need to make the most of the plugin.", 'lsx-health-plan' ); ?></p>
120
+			<h2><?php esc_html_e('LightSpeed’s LSX Health Plugin', 'lsx-health-plan'); ?></h2>
121
+			<p><?php esc_html_e("Thank you for using the LSX Health plugin. All of us here at LightSpeed appreciate your ongoing support and we can't wait to see what people create with the plugin. We're committed to ensuring you have all the help you need to make the most of the plugin.", 'lsx-health-plan'); ?></p>
122 122
 		</div>
123 123
 		<?php
124 124
 	}
Please login to merge, or discard this patch.
classes/post-types/class-plan.php 2 patches
Indentation   +522 added lines, -522 removed lines patch added patch discarded remove patch
@@ -10,207 +10,207 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class Plan {
12 12
 
13
-	/**
14
-	 * Holds class instance
15
-	 *
16
-	 * @since 1.0.0
17
-	 *
18
-	 * @var      object \lsx_health_plan\classes\Plan()
19
-	 */
20
-	protected static $instance = null;
21
-
22
-	/**
23
-	 * Holds post_type slug used as an index
24
-	 *
25
-	 * @since 1.0.0
26
-	 *
27
-	 * @var      string
28
-	 */
29
-	public $slug = 'plan';
30
-
31
-	/**
32
-	 * Constructor
33
-	 */
34
-	public function __construct() {
35
-
36
-		add_action( 'init', array( $this, 'register_post_type' ) );
37
-		add_action( 'init', array( $this, 'plan_type_taxonomy_setup' ) );
38
-		add_action( 'init', array( $this, 'week_taxonomy_setup' ) );
39
-
40
-		// Icons for the plan types.
41
-		add_action( 'create_term', array( $this, 'save_meta' ), 10, 2 );
42
-		add_action( 'edit_term', array( $this, 'save_meta' ), 10, 2 );
43
-		$prefix_taxonomy = 'plan-type';
44
-		add_action( sprintf( '%s_edit_form_fields', $prefix_taxonomy ), array( $this, 'add_thumbnail_form_field' ), 3, 1 );
45
-
46
-		// Register the Metaboxes.
47
-		add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 );
48
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ), 5 );
49
-		add_action( 'cmb2_admin_init', array( $this, 'plan_connections' ), 5 );
50
-		add_action( 'cmb2_admin_init', array( $this, 'sections_metabox_loop' ), 1 );
51
-
52
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
53
-		//add_filter( 'lsx_global_header_title', array( $this, 'hp_recipe_header_title' ), 200, 1 );
54
-
55
-		// Template Redirects.
56
-		add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
57
-		add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
58
-
59
-		// Plan Archive Actions.
60
-		add_action( 'pre_get_posts', array( $this, 'set_parent_only' ), 10, 1 );
61
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
62
-		add_action( 'lsx_content_top', 'lsx_hp_plan_archive_filters', 10, 1 );
63
-		add_filter( 'lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_search_enabled', 10, 1 );
64
-		add_filter( 'lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_filters_disabled', 10, 1 );
65
-
66
-		//Breadcrumbs
67
-		add_filter( 'woocommerce_get_breadcrumb', array( $this, 'plan_breadcrumb_filter' ), 30, 1 );
13
+     /**
14
+      * Holds class instance
15
+      *
16
+      * @since 1.0.0
17
+      *
18
+      * @var      object \lsx_health_plan\classes\Plan()
19
+      */
20
+     protected static $instance = null;
21
+
22
+     /**
23
+      * Holds post_type slug used as an index
24
+      *
25
+      * @since 1.0.0
26
+      *
27
+      * @var      string
28
+      */
29
+     public $slug = 'plan';
30
+
31
+     /**
32
+      * Constructor
33
+      */
34
+     public function __construct() {
35
+
36
+          add_action( 'init', array( $this, 'register_post_type' ) );
37
+          add_action( 'init', array( $this, 'plan_type_taxonomy_setup' ) );
38
+          add_action( 'init', array( $this, 'week_taxonomy_setup' ) );
39
+
40
+          // Icons for the plan types.
41
+          add_action( 'create_term', array( $this, 'save_meta' ), 10, 2 );
42
+          add_action( 'edit_term', array( $this, 'save_meta' ), 10, 2 );
43
+          $prefix_taxonomy = 'plan-type';
44
+          add_action( sprintf( '%s_edit_form_fields', $prefix_taxonomy ), array( $this, 'add_thumbnail_form_field' ), 3, 1 );
45
+
46
+          // Register the Metaboxes.
47
+          add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 );
48
+          add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ), 5 );
49
+          add_action( 'cmb2_admin_init', array( $this, 'plan_connections' ), 5 );
50
+          add_action( 'cmb2_admin_init', array( $this, 'sections_metabox_loop' ), 1 );
51
+
52
+          add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
53
+          //add_filter( 'lsx_global_header_title', array( $this, 'hp_recipe_header_title' ), 200, 1 );
54
+
55
+          // Template Redirects.
56
+          add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
57
+          add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
58
+
59
+          // Plan Archive Actions.
60
+          add_action( 'pre_get_posts', array( $this, 'set_parent_only' ), 10, 1 );
61
+          add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
62
+          add_action( 'lsx_content_top', 'lsx_hp_plan_archive_filters', 10, 1 );
63
+          add_filter( 'lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_search_enabled', 10, 1 );
64
+          add_filter( 'lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_filters_disabled', 10, 1 );
65
+
66
+          //Breadcrumbs
67
+          add_filter( 'woocommerce_get_breadcrumb', array( $this, 'plan_breadcrumb_filter' ), 30, 1 );
68 68
 		
69
-	}
70
-
71
-	/**
72
-	 * Return an instance of this class.
73
-	 *
74
-	 * @since 1.0.0
75
-	 *
76
-	 * @return    object \lsx_health_plan\classes\Meal_Plan()    A single instance of this class.
77
-	 */
78
-	public static function get_instance() {
79
-		// If the single instance hasn't been set, set it now.
80
-		if ( null === self::$instance ) {
81
-			self::$instance = new self();
82
-		}
83
-		return self::$instance;
84
-	}
85
-	/**
86
-	 * Register the post type.
87
-	 */
88
-	public function register_post_type() {
89
-		$labels = array(
90
-			'name'               => esc_html__( 'Plans', 'lsx-health-plan' ),
91
-			'singular_name'      => esc_html__( 'Plan', 'lsx-health-plan' ),
92
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
93
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
94
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
95
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
96
-			'all_items'          => esc_html__( 'All Plans', 'lsx-health-plan' ),
97
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
98
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
99
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
100
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
101
-			'parent_item_colon'  => '',
102
-			'menu_name'          => esc_html__( 'Plans', 'lsx-health-plan' ),
103
-		);
104
-		$args   = array(
105
-			'labels'             => $labels,
106
-			'public'             => true,
107
-			'publicly_queryable' => true,
108
-			'show_ui'            => true,
109
-			'show_in_menu'       => true,
110
-			'show_in_rest'       => true,
111
-			'menu_icon'          => 'dashicons-welcome-write-blog',
112
-			'query_var'          => true,
113
-			'rewrite'            => array(
114
-				'slug' => \lsx_health_plan\functions\get_option( 'plan_single_slug', 'plan' ),
115
-			),
116
-			'capability_type'    => 'page',
117
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_plan_archive', 'plans' ),
118
-			'hierarchical'       => false,
119
-			'menu_position'      => null,
120
-			'supports'           => array(
121
-				'title',
122
-				'editor',
123
-				'thumbnail',
124
-				'page-attributes',
125
-				'custom-fields',
126
-			),
127
-		);
128
-		register_post_type( 'plan', $args );
129
-	}
130
-
131
-	/**
132
-	 * Register the Type taxonomy.
133
-	 */
134
-	public function plan_type_taxonomy_setup() {
135
-		$labels = array(
136
-			'name'              => esc_html_x( 'Plan Type', 'taxonomy general name', 'lsx-health-plan' ),
137
-			'singular_name'     => esc_html_x( 'Plan Type', 'taxonomy singular name', 'lsx-health-plan' ),
138
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
139
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
140
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
141
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
142
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
143
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
144
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
145
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
146
-			'menu_name'         => esc_html__( 'Plan Types', 'lsx-health-plan' ),
147
-		);
148
-
149
-		$args = array(
150
-			'hierarchical'      => true,
151
-			'labels'            => $labels,
152
-			'show_ui'           => true,
153
-			'show_admin_column' => true,
154
-			'query_var'         => true,
155
-			'rewrite'           => array(
156
-				'slug' => 'plan-type',
157
-			),
158
-		);
159
-
160
-		register_taxonomy( 'plan-type', array( 'plan' ), $args );
161
-	}
162
-
163
-	/**
164
-	 * Register the Week taxonomy.
165
-	 */
166
-	public function week_taxonomy_setup() {
167
-		$labels = array(
168
-			'name'              => esc_html_x( 'Week', 'taxonomy general name', 'lsx-health-plan' ),
169
-			'singular_name'     => esc_html_x( 'Week', 'taxonomy singular name', 'lsx-health-plan' ),
170
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
171
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
172
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
173
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
174
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
175
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
176
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
177
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
178
-			'menu_name'         => esc_html__( 'Weeks', 'lsx-health-plan' ),
179
-		);
180
-
181
-		$args = array(
182
-			'hierarchical'      => true,
183
-			'labels'            => $labels,
184
-			'show_ui'           => true,
185
-			'show_admin_column' => true,
186
-			'query_var'         => true,
187
-			'show_in_rest'      => true,
188
-			'rewrite'           => array(
189
-				'slug' => 'week',
190
-			),
191
-		);
192
-
193
-		register_taxonomy( 'week', array( 'plan' ), $args );
194
-	}
195
-
196
-	/**
197
-	 * Output the form field for this metadata when adding a new term
198
-	 *
199
-	 * @since 0.1.0
200
-	 */
201
-	public function add_thumbnail_form_field( $term = false ) {
202
-		if ( is_object( $term ) ) {
203
-			$value         = get_term_meta( $term->term_id, 'thumbnail', true );
204
-			$image_preview = wp_get_attachment_image_src( $value, 'thumbnail' );
205
-
206
-			if ( is_array( $image_preview ) ) {
207
-				$image_preview = '<img style="height: 50px; width: 50px;" src="' . esc_url( $image_preview[0] ) . '" width="' . $image_preview[1] . '" height="' . $image_preview[2] . '" class="alignnone size-thumbnail d wp-image-' . $value . '" />';
208
-			}
209
-		} else {
210
-			$image_preview = false;
211
-			$value         = false;
212
-		}
213
-		?>
69
+     }
70
+
71
+     /**
72
+      * Return an instance of this class.
73
+      *
74
+      * @since 1.0.0
75
+      *
76
+      * @return    object \lsx_health_plan\classes\Meal_Plan()    A single instance of this class.
77
+      */
78
+     public static function get_instance() {
79
+          // If the single instance hasn't been set, set it now.
80
+          if ( null === self::$instance ) {
81
+               self::$instance = new self();
82
+          }
83
+          return self::$instance;
84
+     }
85
+     /**
86
+      * Register the post type.
87
+      */
88
+     public function register_post_type() {
89
+          $labels = array(
90
+               'name'               => esc_html__( 'Plans', 'lsx-health-plan' ),
91
+               'singular_name'      => esc_html__( 'Plan', 'lsx-health-plan' ),
92
+               'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
93
+               'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
94
+               'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
95
+               'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
96
+               'all_items'          => esc_html__( 'All Plans', 'lsx-health-plan' ),
97
+               'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
98
+               'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
99
+               'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
100
+               'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
101
+               'parent_item_colon'  => '',
102
+               'menu_name'          => esc_html__( 'Plans', 'lsx-health-plan' ),
103
+          );
104
+          $args   = array(
105
+               'labels'             => $labels,
106
+               'public'             => true,
107
+               'publicly_queryable' => true,
108
+               'show_ui'            => true,
109
+               'show_in_menu'       => true,
110
+               'show_in_rest'       => true,
111
+               'menu_icon'          => 'dashicons-welcome-write-blog',
112
+               'query_var'          => true,
113
+               'rewrite'            => array(
114
+                    'slug' => \lsx_health_plan\functions\get_option( 'plan_single_slug', 'plan' ),
115
+               ),
116
+               'capability_type'    => 'page',
117
+               'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_plan_archive', 'plans' ),
118
+               'hierarchical'       => false,
119
+               'menu_position'      => null,
120
+               'supports'           => array(
121
+                    'title',
122
+                    'editor',
123
+                    'thumbnail',
124
+                    'page-attributes',
125
+                    'custom-fields',
126
+               ),
127
+          );
128
+          register_post_type( 'plan', $args );
129
+     }
130
+
131
+     /**
132
+      * Register the Type taxonomy.
133
+      */
134
+     public function plan_type_taxonomy_setup() {
135
+          $labels = array(
136
+               'name'              => esc_html_x( 'Plan Type', 'taxonomy general name', 'lsx-health-plan' ),
137
+               'singular_name'     => esc_html_x( 'Plan Type', 'taxonomy singular name', 'lsx-health-plan' ),
138
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
139
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
140
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
141
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
142
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
143
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
144
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
145
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
146
+               'menu_name'         => esc_html__( 'Plan Types', 'lsx-health-plan' ),
147
+          );
148
+
149
+          $args = array(
150
+               'hierarchical'      => true,
151
+               'labels'            => $labels,
152
+               'show_ui'           => true,
153
+               'show_admin_column' => true,
154
+               'query_var'         => true,
155
+               'rewrite'           => array(
156
+                    'slug' => 'plan-type',
157
+               ),
158
+          );
159
+
160
+          register_taxonomy( 'plan-type', array( 'plan' ), $args );
161
+     }
162
+
163
+     /**
164
+      * Register the Week taxonomy.
165
+      */
166
+     public function week_taxonomy_setup() {
167
+          $labels = array(
168
+               'name'              => esc_html_x( 'Week', 'taxonomy general name', 'lsx-health-plan' ),
169
+               'singular_name'     => esc_html_x( 'Week', 'taxonomy singular name', 'lsx-health-plan' ),
170
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
171
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
172
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
173
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
174
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
175
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
176
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
177
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
178
+               'menu_name'         => esc_html__( 'Weeks', 'lsx-health-plan' ),
179
+          );
180
+
181
+          $args = array(
182
+               'hierarchical'      => true,
183
+               'labels'            => $labels,
184
+               'show_ui'           => true,
185
+               'show_admin_column' => true,
186
+               'query_var'         => true,
187
+               'show_in_rest'      => true,
188
+               'rewrite'           => array(
189
+                    'slug' => 'week',
190
+               ),
191
+          );
192
+
193
+          register_taxonomy( 'week', array( 'plan' ), $args );
194
+     }
195
+
196
+     /**
197
+      * Output the form field for this metadata when adding a new term
198
+      *
199
+      * @since 0.1.0
200
+      */
201
+     public function add_thumbnail_form_field( $term = false ) {
202
+          if ( is_object( $term ) ) {
203
+               $value         = get_term_meta( $term->term_id, 'thumbnail', true );
204
+               $image_preview = wp_get_attachment_image_src( $value, 'thumbnail' );
205
+
206
+               if ( is_array( $image_preview ) ) {
207
+                    $image_preview = '<img style="height: 50px; width: 50px;" src="' . esc_url( $image_preview[0] ) . '" width="' . $image_preview[1] . '" height="' . $image_preview[2] . '" class="alignnone size-thumbnail d wp-image-' . $value . '" />';
208
+               }
209
+          } else {
210
+               $image_preview = false;
211
+               $value         = false;
212
+          }
213
+          ?>
214 214
 		<tr class="form-field form-required term-thumbnail-wrap">
215 215
 			<th scope="row"><label for="thumbnail"><?php esc_html_e( 'Icon Image', 'lsx-health-plan' ); ?></label></th>
216 216
 			<td>
@@ -224,331 +224,331 @@  discard block
 block discarded – undo
224 224
 			</td>
225 225
 		</tr>
226 226
 		<?php
227
-	}
228
-
229
-	/**
230
-	 * Saves the Taxonomy term icon image
231
-	 *
232
-	 * @since 0.1.0
233
-	 *
234
-	 * @param  int    $term_id
235
-	 * @param  string $taxonomy
236
-	 */
237
-	public function save_meta( $term_id = 0, $taxonomy = '' ) {
238
-		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
239
-			return;
240
-		}
241
-
242
-		if ( ! isset( $_POST['thumbnail'] ) ) {
243
-			return;
244
-		}
245
-
246
-		if ( check_admin_referer( 'lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce' ) ) {
247
-			if ( ! isset( $_POST['thumbnail'] ) ) {
248
-				return;
249
-			}
250
-
251
-			$thumbnail_meta = sanitize_text_field( $_POST['thumbnail'] );
252
-			$thumbnail_meta = ! empty( $thumbnail_meta ) ? $thumbnail_meta : '';
253
-
254
-			if ( empty( $thumbnail_meta ) ) {
255
-				delete_term_meta( $term_id, 'thumbnail' );
256
-			} else {
257
-				update_term_meta( $term_id, 'thumbnail', $thumbnail_meta );
258
-			}
259
-		}
260
-	}
261
-
262
-	/**
263
-	 * Define the metabox and field configurations.
264
-	 */
265
-	public function details_metaboxes() {
266
-		$cmb = new_cmb2_box( array(
267
-			'id'           => $this->slug . '_details_metabox',
268
-			'title'        => __( 'Details', 'lsx-health-plan' ),
269
-			'object_types' => array( $this->slug ), // Post type
270
-			'context'      => 'normal',
271
-			'priority'     => 'high',
272
-			'show_names'   => true,
273
-		) );
274
-
275
-		$cmb->add_field( array(
276
-			'name' => __( 'Plan Short Description', 'lsx-health-plan' ),
277
-			'id'   => $this->slug . '_short_description',
278
-			'type' => 'textarea_small',
279
-			'desc' => __( 'Add a small description for this plan (optional)', 'lsx-health-plan' ),
280
-		) );
281
-
282
-		$warmup_type = 'page';
283
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
284
-			$warmup_type = array( 'page', 'workout' );
285
-		}
286
-		$cmb->add_field( array(
287
-			'name'       => __( 'Warmup', 'lsx-health-plan' ),
288
-			'desc'       => __( 'Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan' ),
289
-			'id'         => $this->slug . '_warmup',
290
-			'type'       => 'post_search_ajax',
291
-			// Optional :
292
-			'limit'      => 3,  // Limit selection to X items only (default 1)
293
-			'sortable'   => true, // Allow selected items to be sortable (default false)
294
-			'query_args' => array(
295
-				'post_type'      => $warmup_type,
296
-				'post_status'    => array( 'publish' ),
297
-				'posts_per_page' => -1,
298
-			),
299
-		) );
300
-	}
301
-
302
-	/**
303
-	 * Adds the post type to the different arrays.
304
-	 *
305
-	 * @param array $post_types
306
-	 * @return array
307
-	 */
308
-	public function enable_post_type( $post_types = array() ) {
309
-		$post_types[] = $this->slug;
310
-		return $post_types;
311
-	}
312
-
313
-	/**
314
-	 * Registers the workout connections on the plan post type.
315
-	 *
316
-	 * @return void
317
-	 */
318
-	public function plan_connections() {
319
-		$cmb = new_cmb2_box(
320
-			array(
321
-				'id'           => $this->slug . '_connections_metabox',
322
-				'title'        => __( 'Plans', 'lsx-health-plan' ),
323
-				'object_types' => array( 'workout', 'meal', 'tip', 'recipe' ),
324
-				'context'      => 'normal',
325
-				'priority'     => 'high',
326
-				'show_names'   => true,
327
-			)
328
-		);
329
-		$cmb->add_field(
330
-			array(
331
-				'name'       => __( 'Plan', 'lsx-health-plan' ),
332
-				'id'         => 'connected_plans',
333
-				'desc'       => __( 'Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan' ),
334
-				'type'       => 'post_search_ajax',
335
-				'limit'      => 15,
336
-				'sortable'   => true,
337
-				'query_args' => array(
338
-					'post_type'      => array( 'plan' ),
339
-					'post_status'    => array( 'publish' ),
340
-					'posts_per_page' => -1,
341
-				),
342
-			)
343
-		);
344
-	}
345
-
346
-	/**
347
-	 * Remove the "Archives:" from the post type.
348
-	 *
349
-	 * @param string $title the term title.
350
-	 * @return string
351
-	 */
352
-	public function get_the_archive_title( $title ) {
353
-		if ( is_post_type_archive( 'plan' ) ) {
354
-			$title = __( 'Our health plans', 'lsx-health-plan' );
355
-		}
356
-		return $title;
357
-	}
358
-
359
-	/**
360
-	 * Set the post type archive to show the parent plans only.
361
-	 *
362
-	 * @param object $wp_query
363
-	 * @return array
364
-	 */
365
-	public function set_parent_only( $wp_query ) {
366
-		if ( ! is_admin() && $wp_query->is_main_query() && ( $wp_query->is_post_type_archive( 'plan' ) || $wp_query->is_tax( 'plan-type' ) ) ) {
367
-			$wp_query->set( 'post_parent', '0' );
368
-		}
369
-	}
370
-
371
-	/**
372
-	 * Define the metabox and field configurations.
373
-	 */
374
-	public function featured_metabox() {
375
-		$cmb = new_cmb2_box(
376
-			array(
377
-				'id'           => $this->slug . '_featured_metabox_plan',
378
-				'title'        => __( 'Featured Plan', 'lsx-health-plan' ),
379
-				'object_types' => array( $this->slug ), // Post type
380
-				'context'      => 'side',
381
-				'priority'     => 'high',
382
-				'show_names'   => true,
383
-			)
384
-		);
385
-		$cmb->add_field(
386
-			array(
387
-				'name'       => __( 'Featured Plan', 'lsx-health-plan' ),
388
-				'desc'       => __( 'Enable a featured plan' ),
389
-				'id'         => $this->slug . '_featured_plan',
390
-				'type'       => 'checkbox',
391
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
392
-			)
393
-		);
394
-	}
395
-
396
-	/**
397
-	 * Define the metabox and field configurations.
398
-	 */
399
-	public function sections_metabox_loop() {
400
-		$cmb = new_cmb2_box(
401
-			array(
402
-				'id'           => $this->slug . '_sections_metabox',
403
-				'title'        => __( 'Sections', 'lsx-health-plan' ),
404
-				'object_types' => array( $this->slug ), // Post type.
405
-				'context'      => 'normal',
406
-				'priority'     => 'low',
407
-				'show_names'   => true,
408
-			)
409
-		);
410
-
411
-		/*
227
+     }
228
+
229
+     /**
230
+      * Saves the Taxonomy term icon image
231
+      *
232
+      * @since 0.1.0
233
+      *
234
+      * @param  int    $term_id
235
+      * @param  string $taxonomy
236
+      */
237
+     public function save_meta( $term_id = 0, $taxonomy = '' ) {
238
+          if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
239
+               return;
240
+          }
241
+
242
+          if ( ! isset( $_POST['thumbnail'] ) ) {
243
+               return;
244
+          }
245
+
246
+          if ( check_admin_referer( 'lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce' ) ) {
247
+               if ( ! isset( $_POST['thumbnail'] ) ) {
248
+                    return;
249
+               }
250
+
251
+               $thumbnail_meta = sanitize_text_field( $_POST['thumbnail'] );
252
+               $thumbnail_meta = ! empty( $thumbnail_meta ) ? $thumbnail_meta : '';
253
+
254
+               if ( empty( $thumbnail_meta ) ) {
255
+                    delete_term_meta( $term_id, 'thumbnail' );
256
+               } else {
257
+                    update_term_meta( $term_id, 'thumbnail', $thumbnail_meta );
258
+               }
259
+          }
260
+     }
261
+
262
+     /**
263
+      * Define the metabox and field configurations.
264
+      */
265
+     public function details_metaboxes() {
266
+          $cmb = new_cmb2_box( array(
267
+               'id'           => $this->slug . '_details_metabox',
268
+               'title'        => __( 'Details', 'lsx-health-plan' ),
269
+               'object_types' => array( $this->slug ), // Post type
270
+               'context'      => 'normal',
271
+               'priority'     => 'high',
272
+               'show_names'   => true,
273
+          ) );
274
+
275
+          $cmb->add_field( array(
276
+               'name' => __( 'Plan Short Description', 'lsx-health-plan' ),
277
+               'id'   => $this->slug . '_short_description',
278
+               'type' => 'textarea_small',
279
+               'desc' => __( 'Add a small description for this plan (optional)', 'lsx-health-plan' ),
280
+          ) );
281
+
282
+          $warmup_type = 'page';
283
+          if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
284
+               $warmup_type = array( 'page', 'workout' );
285
+          }
286
+          $cmb->add_field( array(
287
+               'name'       => __( 'Warmup', 'lsx-health-plan' ),
288
+               'desc'       => __( 'Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan' ),
289
+               'id'         => $this->slug . '_warmup',
290
+               'type'       => 'post_search_ajax',
291
+               // Optional :
292
+               'limit'      => 3,  // Limit selection to X items only (default 1)
293
+               'sortable'   => true, // Allow selected items to be sortable (default false)
294
+               'query_args' => array(
295
+                    'post_type'      => $warmup_type,
296
+                    'post_status'    => array( 'publish' ),
297
+                    'posts_per_page' => -1,
298
+               ),
299
+          ) );
300
+     }
301
+
302
+     /**
303
+      * Adds the post type to the different arrays.
304
+      *
305
+      * @param array $post_types
306
+      * @return array
307
+      */
308
+     public function enable_post_type( $post_types = array() ) {
309
+          $post_types[] = $this->slug;
310
+          return $post_types;
311
+     }
312
+
313
+     /**
314
+      * Registers the workout connections on the plan post type.
315
+      *
316
+      * @return void
317
+      */
318
+     public function plan_connections() {
319
+          $cmb = new_cmb2_box(
320
+               array(
321
+                    'id'           => $this->slug . '_connections_metabox',
322
+                    'title'        => __( 'Plans', 'lsx-health-plan' ),
323
+                    'object_types' => array( 'workout', 'meal', 'tip', 'recipe' ),
324
+                    'context'      => 'normal',
325
+                    'priority'     => 'high',
326
+                    'show_names'   => true,
327
+               )
328
+          );
329
+          $cmb->add_field(
330
+               array(
331
+                    'name'       => __( 'Plan', 'lsx-health-plan' ),
332
+                    'id'         => 'connected_plans',
333
+                    'desc'       => __( 'Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan' ),
334
+                    'type'       => 'post_search_ajax',
335
+                    'limit'      => 15,
336
+                    'sortable'   => true,
337
+                    'query_args' => array(
338
+                         'post_type'      => array( 'plan' ),
339
+                         'post_status'    => array( 'publish' ),
340
+                         'posts_per_page' => -1,
341
+                    ),
342
+               )
343
+          );
344
+     }
345
+
346
+     /**
347
+      * Remove the "Archives:" from the post type.
348
+      *
349
+      * @param string $title the term title.
350
+      * @return string
351
+      */
352
+     public function get_the_archive_title( $title ) {
353
+          if ( is_post_type_archive( 'plan' ) ) {
354
+               $title = __( 'Our health plans', 'lsx-health-plan' );
355
+          }
356
+          return $title;
357
+     }
358
+
359
+     /**
360
+      * Set the post type archive to show the parent plans only.
361
+      *
362
+      * @param object $wp_query
363
+      * @return array
364
+      */
365
+     public function set_parent_only( $wp_query ) {
366
+          if ( ! is_admin() && $wp_query->is_main_query() && ( $wp_query->is_post_type_archive( 'plan' ) || $wp_query->is_tax( 'plan-type' ) ) ) {
367
+               $wp_query->set( 'post_parent', '0' );
368
+          }
369
+     }
370
+
371
+     /**
372
+      * Define the metabox and field configurations.
373
+      */
374
+     public function featured_metabox() {
375
+          $cmb = new_cmb2_box(
376
+               array(
377
+                    'id'           => $this->slug . '_featured_metabox_plan',
378
+                    'title'        => __( 'Featured Plan', 'lsx-health-plan' ),
379
+                    'object_types' => array( $this->slug ), // Post type
380
+                    'context'      => 'side',
381
+                    'priority'     => 'high',
382
+                    'show_names'   => true,
383
+               )
384
+          );
385
+          $cmb->add_field(
386
+               array(
387
+                    'name'       => __( 'Featured Plan', 'lsx-health-plan' ),
388
+                    'desc'       => __( 'Enable a featured plan' ),
389
+                    'id'         => $this->slug . '_featured_plan',
390
+                    'type'       => 'checkbox',
391
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
392
+               )
393
+          );
394
+     }
395
+
396
+     /**
397
+      * Define the metabox and field configurations.
398
+      */
399
+     public function sections_metabox_loop() {
400
+          $cmb = new_cmb2_box(
401
+               array(
402
+                    'id'           => $this->slug . '_sections_metabox',
403
+                    'title'        => __( 'Sections', 'lsx-health-plan' ),
404
+                    'object_types' => array( $this->slug ), // Post type.
405
+                    'context'      => 'normal',
406
+                    'priority'     => 'low',
407
+                    'show_names'   => true,
408
+               )
409
+          );
410
+
411
+          /*
412 412
 		This is where the repeatable group is defined, each field has the same ID as the legacy field.
413 413
 		There is a function which runs and adds to looped fields to individual fields for WP Query compatability.
414 414
 		*/
415
-		$group = $cmb->add_field(
416
-			array(
417
-				'id'      => $this->slug . '_sections',
418
-				'type'    => 'group',
419
-				'options' => array(
420
-					'group_title'   => __( 'Section', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number
421
-					'add_button'    => __( 'Add section', 'lsx-health-plan' ),
422
-					'remove_button' => __( 'Remove section', 'lsx-health-plan' ),
423
-					'sortable'      => true,
424
-					'closed'        => true, // true to have the groups closed by default
425
-				),
426
-				'classes' => 'lsx-admin-row',
415
+          $group = $cmb->add_field(
416
+               array(
417
+                    'id'      => $this->slug . '_sections',
418
+                    'type'    => 'group',
419
+                    'options' => array(
420
+                         'group_title'   => __( 'Section', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number
421
+                         'add_button'    => __( 'Add section', 'lsx-health-plan' ),
422
+                         'remove_button' => __( 'Remove section', 'lsx-health-plan' ),
423
+                         'sortable'      => true,
424
+                         'closed'        => true, // true to have the groups closed by default
425
+                    ),
426
+                    'classes' => 'lsx-admin-row',
427 427
 				
428
-			)
429
-		);
430
-
431
-		$cmb->add_group_field(
432
-			$group,
433
-			array(
434
-				'name'       => __( 'Title', 'lsx-health-plan' ),
435
-				'id'         => 'title',
436
-				'type'       => 'text',
437
-				'desc'       => __( 'e.g Day 1 / Week 1', 'lsx-health-plan' ),
438
-				'classes'    => 'lsx-field-col  lsx-field-col-50',
439
-			)
440
-		);
441
-
442
-		$cmb->add_group_field(
443
-			$group,
444
-			array(
445
-				'name'       => __( 'Group', 'lsx-health-plan' ),
446
-				'id'         => 'group',
447
-				'type'       => 'text',
448
-				'desc'       => __( 'e.g Week 1 / January', 'lsx-health-plan' ),
449
-				'classes'    => 'lsx-field-col  lsx-field-col-50',
450
-			)
451
-		);
452
-
453
-		$cmb->add_group_field(
454
-			$group,
455
-			array(
456
-				'name' => __( 'Overview', 'lsx-health-plan' ),
457
-				'id'   => 'description',
458
-				'type' => 'wysiwyg',
459
-			)
460
-		);
461
-
462
-		if ( post_type_exists( 'workout' ) ) {
463
-			$cmb->add_group_field(
464
-				$group,
465
-				array(
466
-					'name'       => __( 'Workouts', 'lsx-health-plan' ),
467
-					'id'         => 'connected_workouts',
468
-					'desc'       => __( 'Connect the workout(s) that apply to this section.', 'lsx-health-plan' ),
469
-					'type'       => 'post_search_ajax',
470
-					'limit'      => 15,
471
-					'sortable'   => true,
472
-					'query_args' => array(
473
-						'post_type'      => array( 'workout' ),
474
-						'post_status'    => array( 'publish' ),
475
-						'posts_per_page' => -1,
476
-					),
477
-					'classes'    => 'lsx-field-col lsx-field-add-field  lsx-field-col-33',
478
-				)
479
-			);
480
-		}
481
-
482
-		if ( post_type_exists( 'meal' ) ) {
483
-			$cmb->add_group_field(
484
-				$group,
485
-				array(
486
-					'name'       => __( 'Meals', 'lsx-health-plan' ),
487
-					'desc'       => __( 'Connect the meal(s) that apply to this section.', 'lsx-health-plan' ),
488
-					'id'         => 'connected_meals',
489
-					'type'       => 'post_search_ajax',
490
-					// Optional :
491
-					'limit'      => 15, // Limit selection to X items only (default 1)
492
-					'sortable'   => true, // Allow selected items to be sortable (default false)
493
-					'query_args' => array(
494
-						'post_type'      => array( 'meal' ),
495
-						'post_status'    => array( 'publish' ),
496
-						'posts_per_page' => -1,
497
-					),
498
-					'classes'    => 'lsx-field-col lsx-field-add-field  lsx-field-col-33',
499
-				)
500
-			);
501
-		}
502
-		if ( post_type_exists( 'tip' ) ) {
503
-			$cmb->add_group_field(
504
-				$group,
505
-				array(
506
-					'name'       => __( 'Tips', 'lsx-health-plan' ),
507
-					'id'         => 'connected_tips',
508
-					'desc'       => __( 'Connect the tip(s) that apply to this section.', 'lsx-health-plan' ),
509
-					'type'       => 'post_search_ajax',
510
-					// Optional :
511
-					'limit'      => 15,  // Limit selection to X items only (default 1)
512
-					'sortable'   => true,  // Allow selected items to be sortable (default false)
513
-					'query_args' => array(
514
-						'post_type'      => array( 'tip' ),
515
-						'post_status'    => array( 'publish' ),
516
-						'posts_per_page' => -1,
517
-					),
518
-					'classes'    => 'lsx-field-col lsx-field-add-field  lsx-field-col-33',
519
-				)
520
-			);
521
-		}
522
-	}
523
-
524
-	/**
525
-	 * Holds the array for the single plan breadcrumbs.
526
-	 *
527
-	 * @var array $crumbs
528
-	 * @return array
529
-	 */
530
-	public function plan_breadcrumb_filter( $crumbs ) {
531
-		if ( is_singular( 'plan' ) ) {
532
-			$plan          = \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' );
533
-			$plans         = \lsx_health_plan\functions\get_option( 'endpoint_plan_archive', 'plan' );	
534
-			$plan_name     = get_the_title();
535
-			$url           = get_post_type_archive_link( $plan );
536
-			$term_obj_list = get_the_terms( get_the_ID(), 'plan-type' );
537
-			$plan_type     = $term_obj_list[0]->name;
538
-			$plan_type_url = get_term_link( $term_obj_list[0]->term_id );
428
+               )
429
+          );
430
+
431
+          $cmb->add_group_field(
432
+               $group,
433
+               array(
434
+                    'name'       => __( 'Title', 'lsx-health-plan' ),
435
+                    'id'         => 'title',
436
+                    'type'       => 'text',
437
+                    'desc'       => __( 'e.g Day 1 / Week 1', 'lsx-health-plan' ),
438
+                    'classes'    => 'lsx-field-col  lsx-field-col-50',
439
+               )
440
+          );
441
+
442
+          $cmb->add_group_field(
443
+               $group,
444
+               array(
445
+                    'name'       => __( 'Group', 'lsx-health-plan' ),
446
+                    'id'         => 'group',
447
+                    'type'       => 'text',
448
+                    'desc'       => __( 'e.g Week 1 / January', 'lsx-health-plan' ),
449
+                    'classes'    => 'lsx-field-col  lsx-field-col-50',
450
+               )
451
+          );
452
+
453
+          $cmb->add_group_field(
454
+               $group,
455
+               array(
456
+                    'name' => __( 'Overview', 'lsx-health-plan' ),
457
+                    'id'   => 'description',
458
+                    'type' => 'wysiwyg',
459
+               )
460
+          );
461
+
462
+          if ( post_type_exists( 'workout' ) ) {
463
+               $cmb->add_group_field(
464
+                    $group,
465
+                    array(
466
+                         'name'       => __( 'Workouts', 'lsx-health-plan' ),
467
+                         'id'         => 'connected_workouts',
468
+                         'desc'       => __( 'Connect the workout(s) that apply to this section.', 'lsx-health-plan' ),
469
+                         'type'       => 'post_search_ajax',
470
+                         'limit'      => 15,
471
+                         'sortable'   => true,
472
+                         'query_args' => array(
473
+                              'post_type'      => array( 'workout' ),
474
+                              'post_status'    => array( 'publish' ),
475
+                              'posts_per_page' => -1,
476
+                         ),
477
+                         'classes'    => 'lsx-field-col lsx-field-add-field  lsx-field-col-33',
478
+                    )
479
+               );
480
+          }
481
+
482
+          if ( post_type_exists( 'meal' ) ) {
483
+               $cmb->add_group_field(
484
+                    $group,
485
+                    array(
486
+                         'name'       => __( 'Meals', 'lsx-health-plan' ),
487
+                         'desc'       => __( 'Connect the meal(s) that apply to this section.', 'lsx-health-plan' ),
488
+                         'id'         => 'connected_meals',
489
+                         'type'       => 'post_search_ajax',
490
+                         // Optional :
491
+                         'limit'      => 15, // Limit selection to X items only (default 1)
492
+                         'sortable'   => true, // Allow selected items to be sortable (default false)
493
+                         'query_args' => array(
494
+                              'post_type'      => array( 'meal' ),
495
+                              'post_status'    => array( 'publish' ),
496
+                              'posts_per_page' => -1,
497
+                         ),
498
+                         'classes'    => 'lsx-field-col lsx-field-add-field  lsx-field-col-33',
499
+                    )
500
+               );
501
+          }
502
+          if ( post_type_exists( 'tip' ) ) {
503
+               $cmb->add_group_field(
504
+                    $group,
505
+                    array(
506
+                         'name'       => __( 'Tips', 'lsx-health-plan' ),
507
+                         'id'         => 'connected_tips',
508
+                         'desc'       => __( 'Connect the tip(s) that apply to this section.', 'lsx-health-plan' ),
509
+                         'type'       => 'post_search_ajax',
510
+                         // Optional :
511
+                         'limit'      => 15,  // Limit selection to X items only (default 1)
512
+                         'sortable'   => true,  // Allow selected items to be sortable (default false)
513
+                         'query_args' => array(
514
+                              'post_type'      => array( 'tip' ),
515
+                              'post_status'    => array( 'publish' ),
516
+                              'posts_per_page' => -1,
517
+                         ),
518
+                         'classes'    => 'lsx-field-col lsx-field-add-field  lsx-field-col-33',
519
+                    )
520
+               );
521
+          }
522
+     }
523
+
524
+     /**
525
+      * Holds the array for the single plan breadcrumbs.
526
+      *
527
+      * @var array $crumbs
528
+      * @return array
529
+      */
530
+     public function plan_breadcrumb_filter( $crumbs ) {
531
+          if ( is_singular( 'plan' ) ) {
532
+               $plan          = \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' );
533
+               $plans         = \lsx_health_plan\functions\get_option( 'endpoint_plan_archive', 'plan' );	
534
+               $plan_name     = get_the_title();
535
+               $url           = get_post_type_archive_link( $plan );
536
+               $term_obj_list = get_the_terms( get_the_ID(), 'plan-type' );
537
+               $plan_type     = $term_obj_list[0]->name;
538
+               $plan_type_url = get_term_link( $term_obj_list[0]->term_id );
539 539
 		
540
-			$crumbs[1] = array(
541
-				0 => $plans,
542
-				1 => $url,
543
-			);
544
-			$crumbs[2] = array(
545
-				0 => $plan_type,
546
-				1 => $plan_type_url,
547
-			);
548
-			$crumbs[3] = array(
549
-				0 => $plan_name,
550
-			);
551
-		}
552
-		return $crumbs;
553
-	}
540
+               $crumbs[1] = array(
541
+                    0 => $plans,
542
+                    1 => $url,
543
+               );
544
+               $crumbs[2] = array(
545
+                    0 => $plan_type,
546
+                    1 => $plan_type_url,
547
+               );
548
+               $crumbs[3] = array(
549
+                    0 => $plan_name,
550
+               );
551
+          }
552
+          return $crumbs;
553
+     }
554 554
 }
Please login to merge, or discard this patch.
Spacing   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -33,38 +33,38 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public function __construct() {
35 35
 
36
-		add_action( 'init', array( $this, 'register_post_type' ) );
37
-		add_action( 'init', array( $this, 'plan_type_taxonomy_setup' ) );
38
-		add_action( 'init', array( $this, 'week_taxonomy_setup' ) );
36
+		add_action('init', array($this, 'register_post_type'));
37
+		add_action('init', array($this, 'plan_type_taxonomy_setup'));
38
+		add_action('init', array($this, 'week_taxonomy_setup'));
39 39
 
40 40
 		// Icons for the plan types.
41
-		add_action( 'create_term', array( $this, 'save_meta' ), 10, 2 );
42
-		add_action( 'edit_term', array( $this, 'save_meta' ), 10, 2 );
41
+		add_action('create_term', array($this, 'save_meta'), 10, 2);
42
+		add_action('edit_term', array($this, 'save_meta'), 10, 2);
43 43
 		$prefix_taxonomy = 'plan-type';
44
-		add_action( sprintf( '%s_edit_form_fields', $prefix_taxonomy ), array( $this, 'add_thumbnail_form_field' ), 3, 1 );
44
+		add_action(sprintf('%s_edit_form_fields', $prefix_taxonomy), array($this, 'add_thumbnail_form_field'), 3, 1);
45 45
 
46 46
 		// Register the Metaboxes.
47
-		add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 );
48
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ), 5 );
49
-		add_action( 'cmb2_admin_init', array( $this, 'plan_connections' ), 5 );
50
-		add_action( 'cmb2_admin_init', array( $this, 'sections_metabox_loop' ), 1 );
47
+		add_action('cmb2_admin_init', array($this, 'featured_metabox'), 5);
48
+		add_action('cmb2_admin_init', array($this, 'details_metaboxes'), 5);
49
+		add_action('cmb2_admin_init', array($this, 'plan_connections'), 5);
50
+		add_action('cmb2_admin_init', array($this, 'sections_metabox_loop'), 1);
51 51
 
52
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
52
+		add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100);
53 53
 		//add_filter( 'lsx_global_header_title', array( $this, 'hp_recipe_header_title' ), 200, 1 );
54 54
 
55 55
 		// Template Redirects.
56
-		add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
57
-		add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
56
+		add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1);
57
+		add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1);
58 58
 
59 59
 		// Plan Archive Actions.
60
-		add_action( 'pre_get_posts', array( $this, 'set_parent_only' ), 10, 1 );
61
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
62
-		add_action( 'lsx_content_top', 'lsx_hp_plan_archive_filters', 10, 1 );
63
-		add_filter( 'lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_search_enabled', 10, 1 );
64
-		add_filter( 'lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_filters_disabled', 10, 1 );
60
+		add_action('pre_get_posts', array($this, 'set_parent_only'), 10, 1);
61
+		add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100);
62
+		add_action('lsx_content_top', 'lsx_hp_plan_archive_filters', 10, 1);
63
+		add_filter('lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_search_enabled', 10, 1);
64
+		add_filter('lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_filters_disabled', 10, 1);
65 65
 
66 66
 		//Breadcrumbs
67
-		add_filter( 'woocommerce_get_breadcrumb', array( $this, 'plan_breadcrumb_filter' ), 30, 1 );
67
+		add_filter('woocommerce_get_breadcrumb', array($this, 'plan_breadcrumb_filter'), 30, 1);
68 68
 		
69 69
 	}
70 70
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	public static function get_instance() {
79 79
 		// If the single instance hasn't been set, set it now.
80
-		if ( null === self::$instance ) {
80
+		if (null === self::$instance) {
81 81
 			self::$instance = new self();
82 82
 		}
83 83
 		return self::$instance;
@@ -87,21 +87,21 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function register_post_type() {
89 89
 		$labels = array(
90
-			'name'               => esc_html__( 'Plans', 'lsx-health-plan' ),
91
-			'singular_name'      => esc_html__( 'Plan', 'lsx-health-plan' ),
92
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
93
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
94
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
95
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
96
-			'all_items'          => esc_html__( 'All Plans', 'lsx-health-plan' ),
97
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
98
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
99
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
100
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
90
+			'name'               => esc_html__('Plans', 'lsx-health-plan'),
91
+			'singular_name'      => esc_html__('Plan', 'lsx-health-plan'),
92
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'),
93
+			'add_new_item'       => esc_html__('Add New', 'lsx-health-plan'),
94
+			'edit_item'          => esc_html__('Edit', 'lsx-health-plan'),
95
+			'new_item'           => esc_html__('New', 'lsx-health-plan'),
96
+			'all_items'          => esc_html__('All Plans', 'lsx-health-plan'),
97
+			'view_item'          => esc_html__('View', 'lsx-health-plan'),
98
+			'search_items'       => esc_html__('Search', 'lsx-health-plan'),
99
+			'not_found'          => esc_html__('None found', 'lsx-health-plan'),
100
+			'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'),
101 101
 			'parent_item_colon'  => '',
102
-			'menu_name'          => esc_html__( 'Plans', 'lsx-health-plan' ),
102
+			'menu_name'          => esc_html__('Plans', 'lsx-health-plan'),
103 103
 		);
104
-		$args   = array(
104
+		$args = array(
105 105
 			'labels'             => $labels,
106 106
 			'public'             => true,
107 107
 			'publicly_queryable' => true,
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
 			'menu_icon'          => 'dashicons-welcome-write-blog',
112 112
 			'query_var'          => true,
113 113
 			'rewrite'            => array(
114
-				'slug' => \lsx_health_plan\functions\get_option( 'plan_single_slug', 'plan' ),
114
+				'slug' => \lsx_health_plan\functions\get_option('plan_single_slug', 'plan'),
115 115
 			),
116 116
 			'capability_type'    => 'page',
117
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_plan_archive', 'plans' ),
117
+			'has_archive'        => \lsx_health_plan\functions\get_option('endpoint_plan_archive', 'plans'),
118 118
 			'hierarchical'       => false,
119 119
 			'menu_position'      => null,
120 120
 			'supports'           => array(
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 				'custom-fields',
126 126
 			),
127 127
 		);
128
-		register_post_type( 'plan', $args );
128
+		register_post_type('plan', $args);
129 129
 	}
130 130
 
131 131
 	/**
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function plan_type_taxonomy_setup() {
135 135
 		$labels = array(
136
-			'name'              => esc_html_x( 'Plan Type', 'taxonomy general name', 'lsx-health-plan' ),
137
-			'singular_name'     => esc_html_x( 'Plan Type', 'taxonomy singular name', 'lsx-health-plan' ),
138
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
139
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
140
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
141
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
142
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
143
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
144
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
145
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
146
-			'menu_name'         => esc_html__( 'Plan Types', 'lsx-health-plan' ),
136
+			'name'              => esc_html_x('Plan Type', 'taxonomy general name', 'lsx-health-plan'),
137
+			'singular_name'     => esc_html_x('Plan Type', 'taxonomy singular name', 'lsx-health-plan'),
138
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
139
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
140
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
141
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
142
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
143
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
144
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
145
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
146
+			'menu_name'         => esc_html__('Plan Types', 'lsx-health-plan'),
147 147
 		);
148 148
 
149 149
 		$args = array(
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			),
158 158
 		);
159 159
 
160
-		register_taxonomy( 'plan-type', array( 'plan' ), $args );
160
+		register_taxonomy('plan-type', array('plan'), $args);
161 161
 	}
162 162
 
163 163
 	/**
@@ -165,17 +165,17 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	public function week_taxonomy_setup() {
167 167
 		$labels = array(
168
-			'name'              => esc_html_x( 'Week', 'taxonomy general name', 'lsx-health-plan' ),
169
-			'singular_name'     => esc_html_x( 'Week', 'taxonomy singular name', 'lsx-health-plan' ),
170
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
171
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
172
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
173
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
174
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
175
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
176
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
177
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
178
-			'menu_name'         => esc_html__( 'Weeks', 'lsx-health-plan' ),
168
+			'name'              => esc_html_x('Week', 'taxonomy general name', 'lsx-health-plan'),
169
+			'singular_name'     => esc_html_x('Week', 'taxonomy singular name', 'lsx-health-plan'),
170
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
171
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
172
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
173
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
174
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
175
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
176
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
177
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
178
+			'menu_name'         => esc_html__('Weeks', 'lsx-health-plan'),
179 179
 		);
180 180
 
181 181
 		$args = array(
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 			),
191 191
 		);
192 192
 
193
-		register_taxonomy( 'week', array( 'plan' ), $args );
193
+		register_taxonomy('week', array('plan'), $args);
194 194
 	}
195 195
 
196 196
 	/**
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @since 0.1.0
200 200
 	 */
201
-	public function add_thumbnail_form_field( $term = false ) {
202
-		if ( is_object( $term ) ) {
203
-			$value         = get_term_meta( $term->term_id, 'thumbnail', true );
204
-			$image_preview = wp_get_attachment_image_src( $value, 'thumbnail' );
201
+	public function add_thumbnail_form_field($term = false) {
202
+		if (is_object($term)) {
203
+			$value         = get_term_meta($term->term_id, 'thumbnail', true);
204
+			$image_preview = wp_get_attachment_image_src($value, 'thumbnail');
205 205
 
206
-			if ( is_array( $image_preview ) ) {
207
-				$image_preview = '<img style="height: 50px; width: 50px;" src="' . esc_url( $image_preview[0] ) . '" width="' . $image_preview[1] . '" height="' . $image_preview[2] . '" class="alignnone size-thumbnail d wp-image-' . $value . '" />';
206
+			if (is_array($image_preview)) {
207
+				$image_preview = '<img style="height: 50px; width: 50px;" src="' . esc_url($image_preview[0]) . '" width="' . $image_preview[1] . '" height="' . $image_preview[2] . '" class="alignnone size-thumbnail d wp-image-' . $value . '" />';
208 208
 			}
209 209
 		} else {
210 210
 			$image_preview = false;
@@ -212,15 +212,15 @@  discard block
 block discarded – undo
212 212
 		}
213 213
 		?>
214 214
 		<tr class="form-field form-required term-thumbnail-wrap">
215
-			<th scope="row"><label for="thumbnail"><?php esc_html_e( 'Icon Image', 'lsx-health-plan' ); ?></label></th>
215
+			<th scope="row"><label for="thumbnail"><?php esc_html_e('Icon Image', 'lsx-health-plan'); ?></label></th>
216 216
 			<td>
217
-				<input class="input_image_id" type="hidden" name="thumbnail" value="<?php echo wp_kses_post( $value ); ?>">
217
+				<input class="input_image_id" type="hidden" name="thumbnail" value="<?php echo wp_kses_post($value); ?>">
218 218
 				<div class="thumbnail-preview">
219
-					<?php echo wp_kses_post( $image_preview ); ?>
219
+					<?php echo wp_kses_post($image_preview); ?>
220 220
 				</div>
221
-				<a style="<?php if ( '' !== $value && false !== $value ) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-add"><?php esc_html_e( 'Choose Image', 'lsx-health-plan' ); ?></a>
222
-				<a style="<?php if ( '' === $value || false === $value ) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-remove"><?php esc_html_e( 'Remove Image', 'lsx-health-plan' ); ?></a>
223
-				<?php wp_nonce_field( 'lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce' ); ?>
221
+				<a style="<?php if ('' !== $value && false !== $value) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-add"><?php esc_html_e('Choose Image', 'lsx-health-plan'); ?></a>
222
+				<a style="<?php if ('' === $value || false === $value) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-remove"><?php esc_html_e('Remove Image', 'lsx-health-plan'); ?></a>
223
+				<?php wp_nonce_field('lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce'); ?>
224 224
 			</td>
225 225
 		</tr>
226 226
 		<?php
@@ -234,27 +234,27 @@  discard block
 block discarded – undo
234 234
 	 * @param  int    $term_id
235 235
 	 * @param  string $taxonomy
236 236
 	 */
237
-	public function save_meta( $term_id = 0, $taxonomy = '' ) {
238
-		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
237
+	public function save_meta($term_id = 0, $taxonomy = '') {
238
+		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
239 239
 			return;
240 240
 		}
241 241
 
242
-		if ( ! isset( $_POST['thumbnail'] ) ) {
242
+		if ( ! isset($_POST['thumbnail'])) {
243 243
 			return;
244 244
 		}
245 245
 
246
-		if ( check_admin_referer( 'lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce' ) ) {
247
-			if ( ! isset( $_POST['thumbnail'] ) ) {
246
+		if (check_admin_referer('lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce')) {
247
+			if ( ! isset($_POST['thumbnail'])) {
248 248
 				return;
249 249
 			}
250 250
 
251
-			$thumbnail_meta = sanitize_text_field( $_POST['thumbnail'] );
252
-			$thumbnail_meta = ! empty( $thumbnail_meta ) ? $thumbnail_meta : '';
251
+			$thumbnail_meta = sanitize_text_field($_POST['thumbnail']);
252
+			$thumbnail_meta = ! empty($thumbnail_meta) ? $thumbnail_meta : '';
253 253
 
254
-			if ( empty( $thumbnail_meta ) ) {
255
-				delete_term_meta( $term_id, 'thumbnail' );
254
+			if (empty($thumbnail_meta)) {
255
+				delete_term_meta($term_id, 'thumbnail');
256 256
 			} else {
257
-				update_term_meta( $term_id, 'thumbnail', $thumbnail_meta );
257
+				update_term_meta($term_id, 'thumbnail', $thumbnail_meta);
258 258
 			}
259 259
 		}
260 260
 	}
@@ -263,40 +263,40 @@  discard block
 block discarded – undo
263 263
 	 * Define the metabox and field configurations.
264 264
 	 */
265 265
 	public function details_metaboxes() {
266
-		$cmb = new_cmb2_box( array(
266
+		$cmb = new_cmb2_box(array(
267 267
 			'id'           => $this->slug . '_details_metabox',
268
-			'title'        => __( 'Details', 'lsx-health-plan' ),
269
-			'object_types' => array( $this->slug ), // Post type
268
+			'title'        => __('Details', 'lsx-health-plan'),
269
+			'object_types' => array($this->slug), // Post type
270 270
 			'context'      => 'normal',
271 271
 			'priority'     => 'high',
272 272
 			'show_names'   => true,
273
-		) );
273
+		));
274 274
 
275
-		$cmb->add_field( array(
276
-			'name' => __( 'Plan Short Description', 'lsx-health-plan' ),
275
+		$cmb->add_field(array(
276
+			'name' => __('Plan Short Description', 'lsx-health-plan'),
277 277
 			'id'   => $this->slug . '_short_description',
278 278
 			'type' => 'textarea_small',
279
-			'desc' => __( 'Add a small description for this plan (optional)', 'lsx-health-plan' ),
280
-		) );
279
+			'desc' => __('Add a small description for this plan (optional)', 'lsx-health-plan'),
280
+		));
281 281
 
282 282
 		$warmup_type = 'page';
283
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
284
-			$warmup_type = array( 'page', 'workout' );
283
+		if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
284
+			$warmup_type = array('page', 'workout');
285 285
 		}
286
-		$cmb->add_field( array(
287
-			'name'       => __( 'Warmup', 'lsx-health-plan' ),
288
-			'desc'       => __( 'Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan' ),
286
+		$cmb->add_field(array(
287
+			'name'       => __('Warmup', 'lsx-health-plan'),
288
+			'desc'       => __('Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan'),
289 289
 			'id'         => $this->slug . '_warmup',
290 290
 			'type'       => 'post_search_ajax',
291 291
 			// Optional :
292
-			'limit'      => 3,  // Limit selection to X items only (default 1)
292
+			'limit'      => 3, // Limit selection to X items only (default 1)
293 293
 			'sortable'   => true, // Allow selected items to be sortable (default false)
294 294
 			'query_args' => array(
295 295
 				'post_type'      => $warmup_type,
296
-				'post_status'    => array( 'publish' ),
296
+				'post_status'    => array('publish'),
297 297
 				'posts_per_page' => -1,
298 298
 			),
299
-		) );
299
+		));
300 300
 	}
301 301
 
302 302
 	/**
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	 * @param array $post_types
306 306
 	 * @return array
307 307
 	 */
308
-	public function enable_post_type( $post_types = array() ) {
308
+	public function enable_post_type($post_types = array()) {
309 309
 		$post_types[] = $this->slug;
310 310
 		return $post_types;
311 311
 	}
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 		$cmb = new_cmb2_box(
320 320
 			array(
321 321
 				'id'           => $this->slug . '_connections_metabox',
322
-				'title'        => __( 'Plans', 'lsx-health-plan' ),
323
-				'object_types' => array( 'workout', 'meal', 'tip', 'recipe' ),
322
+				'title'        => __('Plans', 'lsx-health-plan'),
323
+				'object_types' => array('workout', 'meal', 'tip', 'recipe'),
324 324
 				'context'      => 'normal',
325 325
 				'priority'     => 'high',
326 326
 				'show_names'   => true,
@@ -328,15 +328,15 @@  discard block
 block discarded – undo
328 328
 		);
329 329
 		$cmb->add_field(
330 330
 			array(
331
-				'name'       => __( 'Plan', 'lsx-health-plan' ),
331
+				'name'       => __('Plan', 'lsx-health-plan'),
332 332
 				'id'         => 'connected_plans',
333
-				'desc'       => __( 'Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan' ),
333
+				'desc'       => __('Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan'),
334 334
 				'type'       => 'post_search_ajax',
335 335
 				'limit'      => 15,
336 336
 				'sortable'   => true,
337 337
 				'query_args' => array(
338
-					'post_type'      => array( 'plan' ),
339
-					'post_status'    => array( 'publish' ),
338
+					'post_type'      => array('plan'),
339
+					'post_status'    => array('publish'),
340 340
 					'posts_per_page' => -1,
341 341
 				),
342 342
 			)
@@ -349,9 +349,9 @@  discard block
 block discarded – undo
349 349
 	 * @param string $title the term title.
350 350
 	 * @return string
351 351
 	 */
352
-	public function get_the_archive_title( $title ) {
353
-		if ( is_post_type_archive( 'plan' ) ) {
354
-			$title = __( 'Our health plans', 'lsx-health-plan' );
352
+	public function get_the_archive_title($title) {
353
+		if (is_post_type_archive('plan')) {
354
+			$title = __('Our health plans', 'lsx-health-plan');
355 355
 		}
356 356
 		return $title;
357 357
 	}
@@ -362,9 +362,9 @@  discard block
 block discarded – undo
362 362
 	 * @param object $wp_query
363 363
 	 * @return array
364 364
 	 */
365
-	public function set_parent_only( $wp_query ) {
366
-		if ( ! is_admin() && $wp_query->is_main_query() && ( $wp_query->is_post_type_archive( 'plan' ) || $wp_query->is_tax( 'plan-type' ) ) ) {
367
-			$wp_query->set( 'post_parent', '0' );
365
+	public function set_parent_only($wp_query) {
366
+		if ( ! is_admin() && $wp_query->is_main_query() && ($wp_query->is_post_type_archive('plan') || $wp_query->is_tax('plan-type'))) {
367
+			$wp_query->set('post_parent', '0');
368 368
 		}
369 369
 	}
370 370
 
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
 		$cmb = new_cmb2_box(
376 376
 			array(
377 377
 				'id'           => $this->slug . '_featured_metabox_plan',
378
-				'title'        => __( 'Featured Plan', 'lsx-health-plan' ),
379
-				'object_types' => array( $this->slug ), // Post type
378
+				'title'        => __('Featured Plan', 'lsx-health-plan'),
379
+				'object_types' => array($this->slug), // Post type
380 380
 				'context'      => 'side',
381 381
 				'priority'     => 'high',
382 382
 				'show_names'   => true,
@@ -384,8 +384,8 @@  discard block
 block discarded – undo
384 384
 		);
385 385
 		$cmb->add_field(
386 386
 			array(
387
-				'name'       => __( 'Featured Plan', 'lsx-health-plan' ),
388
-				'desc'       => __( 'Enable a featured plan' ),
387
+				'name'       => __('Featured Plan', 'lsx-health-plan'),
388
+				'desc'       => __('Enable a featured plan'),
389 389
 				'id'         => $this->slug . '_featured_plan',
390 390
 				'type'       => 'checkbox',
391 391
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
 		$cmb = new_cmb2_box(
401 401
 			array(
402 402
 				'id'           => $this->slug . '_sections_metabox',
403
-				'title'        => __( 'Sections', 'lsx-health-plan' ),
404
-				'object_types' => array( $this->slug ), // Post type.
403
+				'title'        => __('Sections', 'lsx-health-plan'),
404
+				'object_types' => array($this->slug), // Post type.
405 405
 				'context'      => 'normal',
406 406
 				'priority'     => 'low',
407 407
 				'show_names'   => true,
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
 				'id'      => $this->slug . '_sections',
418 418
 				'type'    => 'group',
419 419
 				'options' => array(
420
-					'group_title'   => __( 'Section', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number
421
-					'add_button'    => __( 'Add section', 'lsx-health-plan' ),
422
-					'remove_button' => __( 'Remove section', 'lsx-health-plan' ),
420
+					'group_title'   => __('Section', 'lsx-health-plan') . ' {#}', // {#} gets replaced by row number
421
+					'add_button'    => __('Add section', 'lsx-health-plan'),
422
+					'remove_button' => __('Remove section', 'lsx-health-plan'),
423 423
 					'sortable'      => true,
424 424
 					'closed'        => true, // true to have the groups closed by default
425 425
 				),
@@ -431,10 +431,10 @@  discard block
 block discarded – undo
431 431
 		$cmb->add_group_field(
432 432
 			$group,
433 433
 			array(
434
-				'name'       => __( 'Title', 'lsx-health-plan' ),
434
+				'name'       => __('Title', 'lsx-health-plan'),
435 435
 				'id'         => 'title',
436 436
 				'type'       => 'text',
437
-				'desc'       => __( 'e.g Day 1 / Week 1', 'lsx-health-plan' ),
437
+				'desc'       => __('e.g Day 1 / Week 1', 'lsx-health-plan'),
438 438
 				'classes'    => 'lsx-field-col  lsx-field-col-50',
439 439
 			)
440 440
 		);
@@ -442,10 +442,10 @@  discard block
 block discarded – undo
442 442
 		$cmb->add_group_field(
443 443
 			$group,
444 444
 			array(
445
-				'name'       => __( 'Group', 'lsx-health-plan' ),
445
+				'name'       => __('Group', 'lsx-health-plan'),
446 446
 				'id'         => 'group',
447 447
 				'type'       => 'text',
448
-				'desc'       => __( 'e.g Week 1 / January', 'lsx-health-plan' ),
448
+				'desc'       => __('e.g Week 1 / January', 'lsx-health-plan'),
449 449
 				'classes'    => 'lsx-field-col  lsx-field-col-50',
450 450
 			)
451 451
 		);
@@ -453,25 +453,25 @@  discard block
 block discarded – undo
453 453
 		$cmb->add_group_field(
454 454
 			$group,
455 455
 			array(
456
-				'name' => __( 'Overview', 'lsx-health-plan' ),
456
+				'name' => __('Overview', 'lsx-health-plan'),
457 457
 				'id'   => 'description',
458 458
 				'type' => 'wysiwyg',
459 459
 			)
460 460
 		);
461 461
 
462
-		if ( post_type_exists( 'workout' ) ) {
462
+		if (post_type_exists('workout')) {
463 463
 			$cmb->add_group_field(
464 464
 				$group,
465 465
 				array(
466
-					'name'       => __( 'Workouts', 'lsx-health-plan' ),
466
+					'name'       => __('Workouts', 'lsx-health-plan'),
467 467
 					'id'         => 'connected_workouts',
468
-					'desc'       => __( 'Connect the workout(s) that apply to this section.', 'lsx-health-plan' ),
468
+					'desc'       => __('Connect the workout(s) that apply to this section.', 'lsx-health-plan'),
469 469
 					'type'       => 'post_search_ajax',
470 470
 					'limit'      => 15,
471 471
 					'sortable'   => true,
472 472
 					'query_args' => array(
473
-						'post_type'      => array( 'workout' ),
474
-						'post_status'    => array( 'publish' ),
473
+						'post_type'      => array('workout'),
474
+						'post_status'    => array('publish'),
475 475
 						'posts_per_page' => -1,
476 476
 					),
477 477
 					'classes'    => 'lsx-field-col lsx-field-add-field  lsx-field-col-33',
@@ -479,40 +479,40 @@  discard block
 block discarded – undo
479 479
 			);
480 480
 		}
481 481
 
482
-		if ( post_type_exists( 'meal' ) ) {
482
+		if (post_type_exists('meal')) {
483 483
 			$cmb->add_group_field(
484 484
 				$group,
485 485
 				array(
486
-					'name'       => __( 'Meals', 'lsx-health-plan' ),
487
-					'desc'       => __( 'Connect the meal(s) that apply to this section.', 'lsx-health-plan' ),
486
+					'name'       => __('Meals', 'lsx-health-plan'),
487
+					'desc'       => __('Connect the meal(s) that apply to this section.', 'lsx-health-plan'),
488 488
 					'id'         => 'connected_meals',
489 489
 					'type'       => 'post_search_ajax',
490 490
 					// Optional :
491 491
 					'limit'      => 15, // Limit selection to X items only (default 1)
492 492
 					'sortable'   => true, // Allow selected items to be sortable (default false)
493 493
 					'query_args' => array(
494
-						'post_type'      => array( 'meal' ),
495
-						'post_status'    => array( 'publish' ),
494
+						'post_type'      => array('meal'),
495
+						'post_status'    => array('publish'),
496 496
 						'posts_per_page' => -1,
497 497
 					),
498 498
 					'classes'    => 'lsx-field-col lsx-field-add-field  lsx-field-col-33',
499 499
 				)
500 500
 			);
501 501
 		}
502
-		if ( post_type_exists( 'tip' ) ) {
502
+		if (post_type_exists('tip')) {
503 503
 			$cmb->add_group_field(
504 504
 				$group,
505 505
 				array(
506
-					'name'       => __( 'Tips', 'lsx-health-plan' ),
506
+					'name'       => __('Tips', 'lsx-health-plan'),
507 507
 					'id'         => 'connected_tips',
508
-					'desc'       => __( 'Connect the tip(s) that apply to this section.', 'lsx-health-plan' ),
508
+					'desc'       => __('Connect the tip(s) that apply to this section.', 'lsx-health-plan'),
509 509
 					'type'       => 'post_search_ajax',
510 510
 					// Optional :
511
-					'limit'      => 15,  // Limit selection to X items only (default 1)
512
-					'sortable'   => true,  // Allow selected items to be sortable (default false)
511
+					'limit'      => 15, // Limit selection to X items only (default 1)
512
+					'sortable'   => true, // Allow selected items to be sortable (default false)
513 513
 					'query_args' => array(
514
-						'post_type'      => array( 'tip' ),
515
-						'post_status'    => array( 'publish' ),
514
+						'post_type'      => array('tip'),
515
+						'post_status'    => array('publish'),
516 516
 						'posts_per_page' => -1,
517 517
 					),
518 518
 					'classes'    => 'lsx-field-col lsx-field-add-field  lsx-field-col-33',
@@ -527,15 +527,15 @@  discard block
 block discarded – undo
527 527
 	 * @var array $crumbs
528 528
 	 * @return array
529 529
 	 */
530
-	public function plan_breadcrumb_filter( $crumbs ) {
531
-		if ( is_singular( 'plan' ) ) {
532
-			$plan          = \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' );
533
-			$plans         = \lsx_health_plan\functions\get_option( 'endpoint_plan_archive', 'plan' );	
530
+	public function plan_breadcrumb_filter($crumbs) {
531
+		if (is_singular('plan')) {
532
+			$plan          = \lsx_health_plan\functions\get_option('endpoint_plan', 'plan');
533
+			$plans         = \lsx_health_plan\functions\get_option('endpoint_plan_archive', 'plan');	
534 534
 			$plan_name     = get_the_title();
535
-			$url           = get_post_type_archive_link( $plan );
536
-			$term_obj_list = get_the_terms( get_the_ID(), 'plan-type' );
535
+			$url           = get_post_type_archive_link($plan);
536
+			$term_obj_list = get_the_terms(get_the_ID(), 'plan-type');
537 537
 			$plan_type     = $term_obj_list[0]->name;
538
-			$plan_type_url = get_term_link( $term_obj_list[0]->term_id );
538
+			$plan_type_url = get_term_link($term_obj_list[0]->term_id);
539 539
 		
540 540
 			$crumbs[1] = array(
541 541
 				0 => $plans,
Please login to merge, or discard this patch.
classes/frontend/class-general.php 2 patches
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -8,169 +8,169 @@
 block discarded – undo
8 8
  */
9 9
 class General {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\frontend\General()
17
-	 */
18
-	protected static $instance = null;
19
-
20
-	/**
21
-	 * Constructor
22
-	 */
23
-	public function __construct() {
24
-		// Before Output.
25
-		add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 );
26
-		add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 );
27
-
28
-		// Output.
29
-		add_action( 'body_class', array( $this, 'body_classes' ) );
30
-		add_filter( 'lsx_global_header_title',  array( $this, 'single_title' ), 200, 1 );
31
-		add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 );
32
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 9 );
33
-	}
34
-
35
-	/**
36
-	 * Return an instance of this class.
37
-	 *
38
-	 * @since 1.0.0
39
-	 *
40
-	 * @return    object \lsx_health_plan\classes\frontend\General()    A single instance of this class.
41
-	 */
42
-	public static function get_instance() {
43
-		// If the single instance hasn't been set, set it now.
44
-		if ( null === self::$instance ) {
45
-			self::$instance = new self();
46
-		}
47
-		return self::$instance;
48
-	}
49
-
50
-	/**
51
-	 * Registers the plugin frontend assets
52
-	 *
53
-	 * @return void
54
-	 */
55
-	public function assets() {
56
-
57
-		if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) {
58
-			wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true );
59
-		}
60
-
61
-		wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER );
62
-		wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' );
63
-		wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) );
64
-
65
-	}
66
-
67
-	/**
68
-	 * Adds the iframe and the progress HTML tags to the allowed WordPress list.
69
-	 */
70
-	public function allow_html_tags_attributes( $tags, $context ) {
71
-		if ( 'post' === $context ) {
72
-			$tags['iframe'] = array(
73
-				'src'             => true,
74
-				'height'          => true,
75
-				'width'           => true,
76
-				'frameborder'     => true,
77
-				'allowfullscreen' => true,
78
-			);
79
-		}
80
-		$tags['progress'] = array(
81
-			'id'    => true,
82
-			'value' => true,
83
-			'max'   => true,
84
-		);
85
-		return $tags;
86
-	}
87
-
88
-	/**
89
-	 * Add body classes to body.
90
-	 *
91
-	 * @param array $classes
92
-	 * @return void
93
-	 */
94
-	public function body_classes( $classes = array() ) {
95
-		global $post;
96
-
97
-		if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) {
98
-			$classes[] = 'my-plan-shortcode';
99
-		}
100
-
101
-		if ( is_single() && is_singular( 'plan' ) ) {
102
-			$args = array(
103
-				'post_parent' => get_the_ID(),
104
-				'post_type'   => 'plan',
105
-			);
106
-
107
-			$post_id      = get_the_ID();
108
-			$has_children = get_children( $args );
109
-			$has_parent   = wp_get_post_parent_id( $post_id );
110
-
111
-			if ( ! empty( $has_children ) ) {
112
-				$plan_type_class = 'parent-plan-page';
113
-				if ( 0 !== $has_parent ) {
114
-					$plan_type_class = 'parent-sub-plan-page';
115
-				}
116
-			} else {
117
-				$plan_type_class = 'unique-plan-page';
118
-				if ( 0 !== $has_parent ) {
119
-					$plan_type_class = 'child-plan-page';
120
-				}
121
-			}
122
-			$classes[] = $plan_type_class;
123
-		}
124
-		return $classes;
125
-	}
126
-
127
-	/**
128
-	 * Remove the single recipe and exercise title
129
-	 */
130
-	public function single_title( $title ) {
131
-
132
-		if ( is_single() && is_singular( 'recipe' ) ) {
133
-
134
-			$title = __( 'Recipe', 'lsx-health-plan' );
135
-		}
136
-
137
-		if ( is_single() && is_singular( 'exercise' ) ) {
138
-
139
-			$title = __( 'Exercise', 'lsx-health-plan' );
140
-		}
141
-
142
-		return $title;
143
-	}
144
-
145
-	/**
146
-	 * Removing footer for HP single pages.
147
-	 *
148
-	 * @return void
149
-	 */
150
-	public function remove_single_footer() {
151
-		if ( ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) || ( is_archive() && is_post_type_archive( array( 'exercise', 'recipe', 'workout', 'meal' ) ) )) {
152
-			remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' );
153
-		}
154
-	}
155
-	/**
156
-	 * Remove the "Archives:" from the post type recipes.
157
-	 *
158
-	 * @param string $title the term title.
159
-	 * @return string
160
-	 */
161
-	public function get_the_archive_title( $title ) {
162
-		if ( is_post_type_archive( 'recipe' ) ) {
163
-			$title = __( 'Recipes', 'lsx-health-plan' );
164
-		}
165
-		if ( is_post_type_archive( 'exercise' ) ) {
166
-			$title = __( 'Exercises', 'lsx-health-plan' );
167
-		}
168
-		if ( is_tax() ) {
169
-			$queried_object = get_queried_object();
170
-			if ( isset( $queried_object->name ) ) {
171
-				$title = $queried_object->name;
172
-			}
173
-		}
174
-		return $title;
175
-	}
11
+     /**
12
+      * Holds class instance
13
+      *
14
+      * @since 1.0.0
15
+      *
16
+      * @var      object \lsx_health_plan\classes\frontend\General()
17
+      */
18
+     protected static $instance = null;
19
+
20
+     /**
21
+      * Constructor
22
+      */
23
+     public function __construct() {
24
+          // Before Output.
25
+          add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 );
26
+          add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 );
27
+
28
+          // Output.
29
+          add_action( 'body_class', array( $this, 'body_classes' ) );
30
+          add_filter( 'lsx_global_header_title',  array( $this, 'single_title' ), 200, 1 );
31
+          add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 );
32
+          add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 9 );
33
+     }
34
+
35
+     /**
36
+      * Return an instance of this class.
37
+      *
38
+      * @since 1.0.0
39
+      *
40
+      * @return    object \lsx_health_plan\classes\frontend\General()    A single instance of this class.
41
+      */
42
+     public static function get_instance() {
43
+          // If the single instance hasn't been set, set it now.
44
+          if ( null === self::$instance ) {
45
+               self::$instance = new self();
46
+          }
47
+          return self::$instance;
48
+     }
49
+
50
+     /**
51
+      * Registers the plugin frontend assets
52
+      *
53
+      * @return void
54
+      */
55
+     public function assets() {
56
+
57
+          if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) {
58
+               wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true );
59
+          }
60
+
61
+          wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER );
62
+          wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' );
63
+          wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) );
64
+
65
+     }
66
+
67
+     /**
68
+      * Adds the iframe and the progress HTML tags to the allowed WordPress list.
69
+      */
70
+     public function allow_html_tags_attributes( $tags, $context ) {
71
+          if ( 'post' === $context ) {
72
+               $tags['iframe'] = array(
73
+                    'src'             => true,
74
+                    'height'          => true,
75
+                    'width'           => true,
76
+                    'frameborder'     => true,
77
+                    'allowfullscreen' => true,
78
+               );
79
+          }
80
+          $tags['progress'] = array(
81
+               'id'    => true,
82
+               'value' => true,
83
+               'max'   => true,
84
+          );
85
+          return $tags;
86
+     }
87
+
88
+     /**
89
+      * Add body classes to body.
90
+      *
91
+      * @param array $classes
92
+      * @return void
93
+      */
94
+     public function body_classes( $classes = array() ) {
95
+          global $post;
96
+
97
+          if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) {
98
+               $classes[] = 'my-plan-shortcode';
99
+          }
100
+
101
+          if ( is_single() && is_singular( 'plan' ) ) {
102
+               $args = array(
103
+                    'post_parent' => get_the_ID(),
104
+                    'post_type'   => 'plan',
105
+               );
106
+
107
+               $post_id      = get_the_ID();
108
+               $has_children = get_children( $args );
109
+               $has_parent   = wp_get_post_parent_id( $post_id );
110
+
111
+               if ( ! empty( $has_children ) ) {
112
+                    $plan_type_class = 'parent-plan-page';
113
+                    if ( 0 !== $has_parent ) {
114
+                         $plan_type_class = 'parent-sub-plan-page';
115
+                    }
116
+               } else {
117
+                    $plan_type_class = 'unique-plan-page';
118
+                    if ( 0 !== $has_parent ) {
119
+                         $plan_type_class = 'child-plan-page';
120
+                    }
121
+               }
122
+               $classes[] = $plan_type_class;
123
+          }
124
+          return $classes;
125
+     }
126
+
127
+     /**
128
+      * Remove the single recipe and exercise title
129
+      */
130
+     public function single_title( $title ) {
131
+
132
+          if ( is_single() && is_singular( 'recipe' ) ) {
133
+
134
+               $title = __( 'Recipe', 'lsx-health-plan' );
135
+          }
136
+
137
+          if ( is_single() && is_singular( 'exercise' ) ) {
138
+
139
+               $title = __( 'Exercise', 'lsx-health-plan' );
140
+          }
141
+
142
+          return $title;
143
+     }
144
+
145
+     /**
146
+      * Removing footer for HP single pages.
147
+      *
148
+      * @return void
149
+      */
150
+     public function remove_single_footer() {
151
+          if ( ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) || ( is_archive() && is_post_type_archive( array( 'exercise', 'recipe', 'workout', 'meal' ) ) )) {
152
+               remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' );
153
+          }
154
+     }
155
+     /**
156
+      * Remove the "Archives:" from the post type recipes.
157
+      *
158
+      * @param string $title the term title.
159
+      * @return string
160
+      */
161
+     public function get_the_archive_title( $title ) {
162
+          if ( is_post_type_archive( 'recipe' ) ) {
163
+               $title = __( 'Recipes', 'lsx-health-plan' );
164
+          }
165
+          if ( is_post_type_archive( 'exercise' ) ) {
166
+               $title = __( 'Exercises', 'lsx-health-plan' );
167
+          }
168
+          if ( is_tax() ) {
169
+               $queried_object = get_queried_object();
170
+               if ( isset( $queried_object->name ) ) {
171
+                    $title = $queried_object->name;
172
+               }
173
+          }
174
+          return $title;
175
+     }
176 176
 }
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function __construct() {
24 24
 		// Before Output.
25
-		add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 );
26
-		add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 );
25
+		add_action('wp_enqueue_scripts', array($this, 'assets'), 5);
26
+		add_filter('wp_kses_allowed_html', array($this, 'allow_html_tags_attributes'), 100, 2);
27 27
 
28 28
 		// Output.
29
-		add_action( 'body_class', array( $this, 'body_classes' ) );
30
-		add_filter( 'lsx_global_header_title',  array( $this, 'single_title' ), 200, 1 );
31
-		add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 );
32
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 9 );
29
+		add_action('body_class', array($this, 'body_classes'));
30
+		add_filter('lsx_global_header_title', array($this, 'single_title'), 200, 1);
31
+		add_action('wp_head', array($this, 'remove_single_footer'), 99);
32
+		add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 9);
33 33
 	}
34 34
 
35 35
 	/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public static function get_instance() {
43 43
 		// If the single instance hasn't been set, set it now.
44
-		if ( null === self::$instance ) {
44
+		if (null === self::$instance) {
45 45
 			self::$instance = new self();
46 46
 		}
47 47
 		return self::$instance;
@@ -54,21 +54,21 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function assets() {
56 56
 
57
-		if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) {
58
-			wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true );
57
+		if (is_post_type_archive('plan') && false === \lsx_health_plan\functions\plan\is_filters_disabled()) {
58
+			wp_enqueue_script('isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array('jquery'), null, LSX_HEALTH_PLAN_URL, true);
59 59
 		}
60 60
 
61
-		wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER );
62
-		wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' );
63
-		wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) );
61
+		wp_enqueue_style('lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER);
62
+		wp_style_add_data('lsx-health-plan', 'rtl', 'replace');
63
+		wp_enqueue_script('lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array('jquery'));
64 64
 
65 65
 	}
66 66
 
67 67
 	/**
68 68
 	 * Adds the iframe and the progress HTML tags to the allowed WordPress list.
69 69
 	 */
70
-	public function allow_html_tags_attributes( $tags, $context ) {
71
-		if ( 'post' === $context ) {
70
+	public function allow_html_tags_attributes($tags, $context) {
71
+		if ('post' === $context) {
72 72
 			$tags['iframe'] = array(
73 73
 				'src'             => true,
74 74
 				'height'          => true,
@@ -91,31 +91,31 @@  discard block
 block discarded – undo
91 91
 	 * @param array $classes
92 92
 	 * @return void
93 93
 	 */
94
-	public function body_classes( $classes = array() ) {
94
+	public function body_classes($classes = array()) {
95 95
 		global $post;
96 96
 
97
-		if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) {
97
+		if (isset($post->post_content) && has_shortcode($post->post_content, 'lsx_health_plan_my_profile_block')) {
98 98
 			$classes[] = 'my-plan-shortcode';
99 99
 		}
100 100
 
101
-		if ( is_single() && is_singular( 'plan' ) ) {
101
+		if (is_single() && is_singular('plan')) {
102 102
 			$args = array(
103 103
 				'post_parent' => get_the_ID(),
104 104
 				'post_type'   => 'plan',
105 105
 			);
106 106
 
107 107
 			$post_id      = get_the_ID();
108
-			$has_children = get_children( $args );
109
-			$has_parent   = wp_get_post_parent_id( $post_id );
108
+			$has_children = get_children($args);
109
+			$has_parent   = wp_get_post_parent_id($post_id);
110 110
 
111
-			if ( ! empty( $has_children ) ) {
111
+			if ( ! empty($has_children)) {
112 112
 				$plan_type_class = 'parent-plan-page';
113
-				if ( 0 !== $has_parent ) {
113
+				if (0 !== $has_parent) {
114 114
 					$plan_type_class = 'parent-sub-plan-page';
115 115
 				}
116 116
 			} else {
117 117
 				$plan_type_class = 'unique-plan-page';
118
-				if ( 0 !== $has_parent ) {
118
+				if (0 !== $has_parent) {
119 119
 					$plan_type_class = 'child-plan-page';
120 120
 				}
121 121
 			}
@@ -127,16 +127,16 @@  discard block
 block discarded – undo
127 127
 	/**
128 128
 	 * Remove the single recipe and exercise title
129 129
 	 */
130
-	public function single_title( $title ) {
130
+	public function single_title($title) {
131 131
 
132
-		if ( is_single() && is_singular( 'recipe' ) ) {
132
+		if (is_single() && is_singular('recipe')) {
133 133
 
134
-			$title = __( 'Recipe', 'lsx-health-plan' );
134
+			$title = __('Recipe', 'lsx-health-plan');
135 135
 		}
136 136
 
137
-		if ( is_single() && is_singular( 'exercise' ) ) {
137
+		if (is_single() && is_singular('exercise')) {
138 138
 
139
-			$title = __( 'Exercise', 'lsx-health-plan' );
139
+			$title = __('Exercise', 'lsx-health-plan');
140 140
 		}
141 141
 
142 142
 		return $title;
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 	 * @return void
149 149
 	 */
150 150
 	public function remove_single_footer() {
151
-		if ( ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) || ( is_archive() && is_post_type_archive( array( 'exercise', 'recipe', 'workout', 'meal' ) ) )) {
152
-			remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' );
151
+		if ((is_single() && is_singular(array('exercise', 'recipe', 'workout', 'meal'))) || (is_archive() && is_post_type_archive(array('exercise', 'recipe', 'workout', 'meal')))) {
152
+			remove_action('lsx_footer_before', 'lsx_add_footer_sidebar_area');
153 153
 		}
154 154
 	}
155 155
 	/**
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 	 * @param string $title the term title.
159 159
 	 * @return string
160 160
 	 */
161
-	public function get_the_archive_title( $title ) {
162
-		if ( is_post_type_archive( 'recipe' ) ) {
163
-			$title = __( 'Recipes', 'lsx-health-plan' );
161
+	public function get_the_archive_title($title) {
162
+		if (is_post_type_archive('recipe')) {
163
+			$title = __('Recipes', 'lsx-health-plan');
164 164
 		}
165
-		if ( is_post_type_archive( 'exercise' ) ) {
166
-			$title = __( 'Exercises', 'lsx-health-plan' );
165
+		if (is_post_type_archive('exercise')) {
166
+			$title = __('Exercises', 'lsx-health-plan');
167 167
 		}
168
-		if ( is_tax() ) {
168
+		if (is_tax()) {
169 169
 			$queried_object = get_queried_object();
170
-			if ( isset( $queried_object->name ) ) {
170
+			if (isset($queried_object->name)) {
171 171
 				$title = $queried_object->name;
172 172
 			}
173 173
 		}
Please login to merge, or discard this patch.
classes/integrations/woocommerce/class-checkout.php 2 patches
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -8,110 +8,110 @@
 block discarded – undo
8 8
  */
9 9
 class Checkout {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\integrations\woocommerce\Checkout()
17
-	 */
18
-	protected static $instance = null;
11
+     /**
12
+      * Holds class instance
13
+      *
14
+      * @since 1.0.0
15
+      *
16
+      * @var      object \lsx_health_plan\classes\integrations\woocommerce\Checkout()
17
+      */
18
+     protected static $instance = null;
19 19
 
20
-	/**
21
-	 * @var string
22
-	 */
23
-	public $plan_id = '';
20
+     /**
21
+      * @var string
22
+      */
23
+     public $plan_id = '';
24 24
 
25
-	/**
26
-	 * Constructor
27
-	 */
28
-	public function __construct() {
29
-		add_filter( 'woocommerce_order_button_text', array( $this, 'checkout_button_text' ), 10, 1 );
25
+     /**
26
+      * Constructor
27
+      */
28
+     public function __construct() {
29
+          add_filter( 'woocommerce_order_button_text', array( $this, 'checkout_button_text' ), 10, 1 );
30 30
 
31
-		// Cart Messages.
32
-		add_action( 'lsx_content_wrap_before', array( $this, 'cart_notices' ) );
33
-		add_filter( 'wc_add_to_cart_message_html', array( $this, 'add_to_cart_message' ), 10, 3 );
34
-	}
31
+          // Cart Messages.
32
+          add_action( 'lsx_content_wrap_before', array( $this, 'cart_notices' ) );
33
+          add_filter( 'wc_add_to_cart_message_html', array( $this, 'add_to_cart_message' ), 10, 3 );
34
+     }
35 35
 
36
-	/**
37
-	 * Return an instance of this class.
38
-	 *
39
-	 * @since 1.0.0
40
-	 *
41
-	 * @return    object \lsx_health_plan\classes\integrations\woocommerce\Checkout()    A single instance of this class.
42
-	 */
43
-	public static function get_instance() {
44
-		// If the single instance hasn't been set, set it now.
45
-		if ( null === self::$instance ) {
46
-			self::$instance = new self();
47
-		}
48
-		return self::$instance;
49
-	}
36
+     /**
37
+      * Return an instance of this class.
38
+      *
39
+      * @since 1.0.0
40
+      *
41
+      * @return    object \lsx_health_plan\classes\integrations\woocommerce\Checkout()    A single instance of this class.
42
+      */
43
+     public static function get_instance() {
44
+          // If the single instance hasn't been set, set it now.
45
+          if ( null === self::$instance ) {
46
+               self::$instance = new self();
47
+          }
48
+          return self::$instance;
49
+     }
50 50
 
51
-	/**
52
-	 * Return the Place Order Text
53
-	 *
54
-	 * @param string $label
55
-	 * @return void
56
-	 */
57
-	public function checkout_button_text( $label = '' ) {
58
-		$label = __( 'Place order', 'lsx-health-plan' );
59
-		return $label;
60
-	}
51
+     /**
52
+      * Return the Place Order Text
53
+      *
54
+      * @param string $label
55
+      * @return void
56
+      */
57
+     public function checkout_button_text( $label = '' ) {
58
+          $label = __( 'Place order', 'lsx-health-plan' );
59
+          return $label;
60
+     }
61 61
 
62
-	/**
63
-	 * Saves the Plan ID to the cart data, so we can attach it to the order later.
64
-	 *
65
-	 * @param array $cart_item_data
66
-	 * @param string $product_id
67
-	 * @param string $variation_id
68
-	 * @return void
69
-	 */
70
-	public function add_plan_id_to_cart( $cart_item_data, $product_id, $variation_id ) {
71
-		$plan_id = filter_input( INPUT_GET, 'plan_id' );
72
-		if ( empty( $plan_id ) || '' === $plan_id ) {
73
-			return $cart_item_data;
74
-		}
75
-		$cart_item_data['plan_id'] = $plan_id;
76
-		return $cart_item_data;
77
-	}
62
+     /**
63
+      * Saves the Plan ID to the cart data, so we can attach it to the order later.
64
+      *
65
+      * @param array $cart_item_data
66
+      * @param string $product_id
67
+      * @param string $variation_id
68
+      * @return void
69
+      */
70
+     public function add_plan_id_to_cart( $cart_item_data, $product_id, $variation_id ) {
71
+          $plan_id = filter_input( INPUT_GET, 'plan_id' );
72
+          if ( empty( $plan_id ) || '' === $plan_id ) {
73
+               return $cart_item_data;
74
+          }
75
+          $cart_item_data['plan_id'] = $plan_id;
76
+          return $cart_item_data;
77
+     }
78 78
 
79
-	/**
80
-	 * Output the WooCommerce Cart Notices.
81
-	 *
82
-	 * @return void
83
-	 */
84
-	public function cart_notices() {
85
-		if ( function_exists( 'woocommerce_output_all_notices' ) && is_post_type_archive( 'plan' ) ) {
86
-			echo wp_kses_post( '<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">' );
87
-			wc_print_notices();
88
-			echo wp_kses_post( '</div>' );
89
-		}
90
-	}
79
+     /**
80
+      * Output the WooCommerce Cart Notices.
81
+      *
82
+      * @return void
83
+      */
84
+     public function cart_notices() {
85
+          if ( function_exists( 'woocommerce_output_all_notices' ) && is_post_type_archive( 'plan' ) ) {
86
+               echo wp_kses_post( '<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">' );
87
+               wc_print_notices();
88
+               echo wp_kses_post( '</div>' );
89
+          }
90
+     }
91 91
 
92
-	/**
93
-	 * Changes the add to cart message and adds our course name.
94
-	 *
95
-	 * @param  string  $message
96
-	 * @param  array   $products
97
-	 * @param  boolean $show_qty
98
-	 * @return string
99
-	 */
100
-	public function add_to_cart_message( $message, $products, $show_qty ) {
101
-		if ( isset( $_GET['plan_id'] ) ) { // @codingStandardsIgnoreLine.
102
-			$this->plan_id = sanitize_text_field( wp_slash( $_GET['plan_id'] ) ); // @codingStandardsIgnoreLine.
92
+     /**
93
+      * Changes the add to cart message and adds our course name.
94
+      *
95
+      * @param  string  $message
96
+      * @param  array   $products
97
+      * @param  boolean $show_qty
98
+      * @return string
99
+      */
100
+     public function add_to_cart_message( $message, $products, $show_qty ) {
101
+          if ( isset( $_GET['plan_id'] ) ) { // @codingStandardsIgnoreLine.
102
+               $this->plan_id = sanitize_text_field( wp_slash( $_GET['plan_id'] ) ); // @codingStandardsIgnoreLine.
103 103
 
104
-			$title = '<strong>' . get_the_title( $this->plan_id ) . '</strong>';
105
-			$title = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan' ), $title );
104
+               $title = '<strong>' . get_the_title( $this->plan_id ) . '</strong>';
105
+               $title = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan' ), $title );
106 106
 
107
-			// Output success messages.
108
-			if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
109
-				$return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) );
110
-				$message   = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( $return_to ), esc_html__( 'Continue shopping', 'lsx-health-plan' ), $title );
111
-			} else {
112
-				$message = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( wc_get_cart_url() ), esc_html__( 'View cart', 'lsx-health-plan' ), $title );
113
-			}
114
-		}
115
-		return $message;
116
-	}
107
+               // Output success messages.
108
+               if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
109
+                    $return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) );
110
+                    $message   = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( $return_to ), esc_html__( 'Continue shopping', 'lsx-health-plan' ), $title );
111
+               } else {
112
+                    $message = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( wc_get_cart_url() ), esc_html__( 'View cart', 'lsx-health-plan' ), $title );
113
+               }
114
+          }
115
+          return $message;
116
+     }
117 117
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 	 * Constructor
27 27
 	 */
28 28
 	public function __construct() {
29
-		add_filter( 'woocommerce_order_button_text', array( $this, 'checkout_button_text' ), 10, 1 );
29
+		add_filter('woocommerce_order_button_text', array($this, 'checkout_button_text'), 10, 1);
30 30
 
31 31
 		// Cart Messages.
32
-		add_action( 'lsx_content_wrap_before', array( $this, 'cart_notices' ) );
33
-		add_filter( 'wc_add_to_cart_message_html', array( $this, 'add_to_cart_message' ), 10, 3 );
32
+		add_action('lsx_content_wrap_before', array($this, 'cart_notices'));
33
+		add_filter('wc_add_to_cart_message_html', array($this, 'add_to_cart_message'), 10, 3);
34 34
 	}
35 35
 
36 36
 	/**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public static function get_instance() {
44 44
 		// If the single instance hasn't been set, set it now.
45
-		if ( null === self::$instance ) {
45
+		if (null === self::$instance) {
46 46
 			self::$instance = new self();
47 47
 		}
48 48
 		return self::$instance;
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 * @param string $label
55 55
 	 * @return void
56 56
 	 */
57
-	public function checkout_button_text( $label = '' ) {
58
-		$label = __( 'Place order', 'lsx-health-plan' );
57
+	public function checkout_button_text($label = '') {
58
+		$label = __('Place order', 'lsx-health-plan');
59 59
 		return $label;
60 60
 	}
61 61
 
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 	 * @param string $variation_id
68 68
 	 * @return void
69 69
 	 */
70
-	public function add_plan_id_to_cart( $cart_item_data, $product_id, $variation_id ) {
71
-		$plan_id = filter_input( INPUT_GET, 'plan_id' );
72
-		if ( empty( $plan_id ) || '' === $plan_id ) {
70
+	public function add_plan_id_to_cart($cart_item_data, $product_id, $variation_id) {
71
+		$plan_id = filter_input(INPUT_GET, 'plan_id');
72
+		if (empty($plan_id) || '' === $plan_id) {
73 73
 			return $cart_item_data;
74 74
 		}
75 75
 		$cart_item_data['plan_id'] = $plan_id;
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 	 * @return void
83 83
 	 */
84 84
 	public function cart_notices() {
85
-		if ( function_exists( 'woocommerce_output_all_notices' ) && is_post_type_archive( 'plan' ) ) {
86
-			echo wp_kses_post( '<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">' );
85
+		if (function_exists('woocommerce_output_all_notices') && is_post_type_archive('plan')) {
86
+			echo wp_kses_post('<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">');
87 87
 			wc_print_notices();
88
-			echo wp_kses_post( '</div>' );
88
+			echo wp_kses_post('</div>');
89 89
 		}
90 90
 	}
91 91
 
@@ -97,19 +97,19 @@  discard block
 block discarded – undo
97 97
 	 * @param  boolean $show_qty
98 98
 	 * @return string
99 99
 	 */
100
-	public function add_to_cart_message( $message, $products, $show_qty ) {
101
-		if ( isset( $_GET['plan_id'] ) ) { // @codingStandardsIgnoreLine.
102
-			$this->plan_id = sanitize_text_field( wp_slash( $_GET['plan_id'] ) ); // @codingStandardsIgnoreLine.
100
+	public function add_to_cart_message($message, $products, $show_qty) {
101
+		if (isset($_GET['plan_id'])) { // @codingStandardsIgnoreLine.
102
+			$this->plan_id = sanitize_text_field(wp_slash($_GET['plan_id'])); // @codingStandardsIgnoreLine.
103 103
 
104
-			$title = '<strong>' . get_the_title( $this->plan_id ) . '</strong>';
105
-			$title = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan' ), $title );
104
+			$title = '<strong>' . get_the_title($this->plan_id) . '</strong>';
105
+			$title = sprintf(_n('%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan'), $title);
106 106
 
107 107
 			// Output success messages.
108
-			if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
109
-				$return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) );
110
-				$message   = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( $return_to ), esc_html__( 'Continue shopping', 'lsx-health-plan' ), $title );
108
+			if ('yes' === get_option('woocommerce_cart_redirect_after_add')) {
109
+				$return_to = apply_filters('woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect(wc_get_raw_referer(), false) : wc_get_page_permalink('shop'));
110
+				$message   = sprintf('<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url($return_to), esc_html__('Continue shopping', 'lsx-health-plan'), $title);
111 111
 			} else {
112
-				$message = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( wc_get_cart_url() ), esc_html__( 'View cart', 'lsx-health-plan' ), $title );
112
+				$message = sprintf('<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url(wc_get_cart_url()), esc_html__('View cart', 'lsx-health-plan'), $title);
113 113
 			}
114 114
 		}
115 115
 		return $message;
Please login to merge, or discard this patch.
classes/integrations/class-articles.php 2 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -8,82 +8,82 @@
 block discarded – undo
8 8
  */
9 9
 class Articles {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @var      object \lsx_health_plan\classes\Articles()
15
-	 */
16
-	protected static $instance = null;
11
+     /**
12
+      * Holds class instance
13
+      *
14
+      * @var      object \lsx_health_plan\classes\Articles()
15
+      */
16
+     protected static $instance = null;
17 17
 
18
-	/**
19
-	 * An array of the post types for the Global Defaults field.
20
-	 *
21
-	 * @var array
22
-	 */
23
-	//public $default_types = array( 'exercise', 'recipe', 'meal', 'workout', 'plan' );
18
+     /**
19
+      * An array of the post types for the Global Defaults field.
20
+      *
21
+      * @var array
22
+      */
23
+     //public $default_types = array( 'exercise', 'recipe', 'meal', 'workout', 'plan' );
24 24
 
25
-	/**
26
-	 * Constructor.
27
-	 */
28
-	public function __construct() {
29
-		$this->default_types = array(
30
-			\lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ),
31
-			\lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ),
32
-			\lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ),
33
-			\lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ),
34
-			\lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ),
35
-		);
36
-		add_action( 'cmb2_admin_init', array( $this, 'related_articles_metabox' ) );
37
-	}
25
+     /**
26
+      * Constructor.
27
+      */
28
+     public function __construct() {
29
+          $this->default_types = array(
30
+               \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ),
31
+               \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ),
32
+               \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ),
33
+               \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ),
34
+               \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ),
35
+          );
36
+          add_action( 'cmb2_admin_init', array( $this, 'related_articles_metabox' ) );
37
+     }
38 38
 
39
-	/**
40
-	 * Return an instance of this class.
41
-	 *
42
-	 * @since 1.0.0
43
-	 *
44
-	 * @return    object \lsx_health_plan\classes\Articles()    A single instance of this class.
45
-	 */
46
-	public static function get_instance() {
47
-		// If the single instance hasn't been set, set it now.
48
-		if ( null === self::$instance ) {
49
-			self::$instance = new self();
50
-		}
51
-		return self::$instance;
52
-	}
39
+     /**
40
+      * Return an instance of this class.
41
+      *
42
+      * @since 1.0.0
43
+      *
44
+      * @return    object \lsx_health_plan\classes\Articles()    A single instance of this class.
45
+      */
46
+     public static function get_instance() {
47
+          // If the single instance hasn't been set, set it now.
48
+          if ( null === self::$instance ) {
49
+               self::$instance = new self();
50
+          }
51
+          return self::$instance;
52
+     }
53 53
 
54
-	/**
55
-	 * Define the related articles member metabox and field configurations.
56
-	 */
57
-	public function related_articles_metabox() {
58
-		foreach ( $this->default_types as $type => $default_type ) {
59
-			$cmb = new_cmb2_box(
60
-				array(
61
-					'id'           => $default_type . '_related_articles_metabox',
62
-					'title'        => __( 'Related Articles', 'lsx-health-plan' ),
63
-					'object_types' => array( $default_type ), // Post type.
64
-					'context'      => 'normal',
65
-					'priority'     => 'low',
66
-					'show_names'   => true,
67
-				)
68
-			);
54
+     /**
55
+      * Define the related articles member metabox and field configurations.
56
+      */
57
+     public function related_articles_metabox() {
58
+          foreach ( $this->default_types as $type => $default_type ) {
59
+               $cmb = new_cmb2_box(
60
+                    array(
61
+                         'id'           => $default_type . '_related_articles_metabox',
62
+                         'title'        => __( 'Related Articles', 'lsx-health-plan' ),
63
+                         'object_types' => array( $default_type ), // Post type.
64
+                         'context'      => 'normal',
65
+                         'priority'     => 'low',
66
+                         'show_names'   => true,
67
+                    )
68
+               );
69 69
 
70
-			$cmb->add_field(
71
-				array(
72
-					'name'       => __( 'Related Articles', 'lsx-health-plan' ),
73
-					'desc'       => __( 'Connect the related articles that applies to this ', 'lsx-health-plan' ) . $default_type,
74
-					'id'         => $default_type . '_connected_articles',
75
-					'type'       => 'post_search_ajax',
76
-					'limit'      => 3,
77
-					'sortable'   => true,
78
-					'query_args' => array(
79
-						'post_type'      => array( 'post' ),
80
-						'post_status'    => array( 'publish' ),
81
-						'posts_per_page' => 3,
82
-					),
83
-				)
84
-			);
85
-		}
70
+               $cmb->add_field(
71
+                    array(
72
+                         'name'       => __( 'Related Articles', 'lsx-health-plan' ),
73
+                         'desc'       => __( 'Connect the related articles that applies to this ', 'lsx-health-plan' ) . $default_type,
74
+                         'id'         => $default_type . '_connected_articles',
75
+                         'type'       => 'post_search_ajax',
76
+                         'limit'      => 3,
77
+                         'sortable'   => true,
78
+                         'query_args' => array(
79
+                              'post_type'      => array( 'post' ),
80
+                              'post_status'    => array( 'publish' ),
81
+                              'posts_per_page' => 3,
82
+                         ),
83
+                    )
84
+               );
85
+          }
86 86
 
87
-	}
87
+     }
88 88
 
89 89
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function __construct() {
29 29
 		$this->default_types = array(
30
-			\lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ),
31
-			\lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ),
32
-			\lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ),
33
-			\lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ),
34
-			\lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ),
30
+			\lsx_health_plan\functions\get_option('endpoint_meal', 'meal'),
31
+			\lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'),
32
+			\lsx_health_plan\functions\get_option('endpoint_recipe_single', 'recipe'),
33
+			\lsx_health_plan\functions\get_option('endpoint_workout', 'workout'),
34
+			\lsx_health_plan\functions\get_option('endpoint_plan', 'plan'),
35 35
 		);
36
-		add_action( 'cmb2_admin_init', array( $this, 'related_articles_metabox' ) );
36
+		add_action('cmb2_admin_init', array($this, 'related_articles_metabox'));
37 37
 	}
38 38
 
39 39
 	/**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public static function get_instance() {
47 47
 		// If the single instance hasn't been set, set it now.
48
-		if ( null === self::$instance ) {
48
+		if (null === self::$instance) {
49 49
 			self::$instance = new self();
50 50
 		}
51 51
 		return self::$instance;
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
 	 * Define the related articles member metabox and field configurations.
56 56
 	 */
57 57
 	public function related_articles_metabox() {
58
-		foreach ( $this->default_types as $type => $default_type ) {
58
+		foreach ($this->default_types as $type => $default_type) {
59 59
 			$cmb = new_cmb2_box(
60 60
 				array(
61 61
 					'id'           => $default_type . '_related_articles_metabox',
62
-					'title'        => __( 'Related Articles', 'lsx-health-plan' ),
63
-					'object_types' => array( $default_type ), // Post type.
62
+					'title'        => __('Related Articles', 'lsx-health-plan'),
63
+					'object_types' => array($default_type), // Post type.
64 64
 					'context'      => 'normal',
65 65
 					'priority'     => 'low',
66 66
 					'show_names'   => true,
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 
70 70
 			$cmb->add_field(
71 71
 				array(
72
-					'name'       => __( 'Related Articles', 'lsx-health-plan' ),
73
-					'desc'       => __( 'Connect the related articles that applies to this ', 'lsx-health-plan' ) . $default_type,
72
+					'name'       => __('Related Articles', 'lsx-health-plan'),
73
+					'desc'       => __('Connect the related articles that applies to this ', 'lsx-health-plan') . $default_type,
74 74
 					'id'         => $default_type . '_connected_articles',
75 75
 					'type'       => 'post_search_ajax',
76 76
 					'limit'      => 3,
77 77
 					'sortable'   => true,
78 78
 					'query_args' => array(
79
-						'post_type'      => array( 'post' ),
80
-						'post_status'    => array( 'publish' ),
79
+						'post_type'      => array('post'),
80
+						'post_status'    => array('publish'),
81 81
 						'posts_per_page' => 3,
82 82
 					),
83 83
 				)
Please login to merge, or discard this patch.
includes/functions.php 2 patches
Indentation   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -17,27 +17,27 @@  discard block
 block discarded – undo
17 17
  * @return boolean
18 18
  */
19 19
 function has_attached_post( $post_id = '', $meta_key = '', $single = true ) {
20
-	$has_post = false;
21
-	if ( '' === $post_id ) {
22
-		$post_id = get_the_ID();
23
-	}
24
-	$items = get_post_meta( $post_id, $meta_key, $single );
25
-	if ( '' !== $items && false !== $items && 0 !== $items ) {
26
-		if ( ! is_array( $items ) ) {
27
-			$items = array( $items );
28
-		}
29
-		$items = check_posts_exist( $items );
30
-		if ( ! empty( $items ) ) {
31
-			$has_post = true;
32
-		}
33
-	} else {
34
-		// Check for defaults.
35
-		$options = get_option( 'all' );
36
-		if ( isset( $options[ $meta_key ] ) && '' !== $options[ $meta_key ] && ! empty( $options[ $meta_key ] ) ) {
37
-			$has_post = true;
38
-		}
39
-	}
40
-	return $has_post;
20
+     $has_post = false;
21
+     if ( '' === $post_id ) {
22
+          $post_id = get_the_ID();
23
+     }
24
+     $items = get_post_meta( $post_id, $meta_key, $single );
25
+     if ( '' !== $items && false !== $items && 0 !== $items ) {
26
+          if ( ! is_array( $items ) ) {
27
+               $items = array( $items );
28
+          }
29
+          $items = check_posts_exist( $items );
30
+          if ( ! empty( $items ) ) {
31
+               $has_post = true;
32
+          }
33
+     } else {
34
+          // Check for defaults.
35
+          $options = get_option( 'all' );
36
+          if ( isset( $options[ $meta_key ] ) && '' !== $options[ $meta_key ] && ! empty( $options[ $meta_key ] ) ) {
37
+               $has_post = true;
38
+          }
39
+     }
40
+     return $has_post;
41 41
 }
42 42
 
43 43
 /**
@@ -48,18 +48,18 @@  discard block
 block discarded – undo
48 48
  * @return mixed           Option value
49 49
  */
50 50
 function get_option( $key = '', $default = false ) {
51
-	if ( function_exists( 'cmb2_get_option' ) ) {
52
-		return cmb2_get_option( 'lsx_health_plan_options', $key, $default );
53
-	}
54
-	// Fallback to get_option if CMB2 is not loaded yet.
55
-	$opts = \get_option( 'lsx_health_plan_options', $default );
56
-	$val  = $default;
57
-	if ( 'all' === $key ) {
58
-		$val = $opts;
59
-	} elseif ( is_array( $opts ) && array_key_exists( $key, $opts ) && false !== $opts[ $key ] ) {
60
-		$val = $opts[ $key ];
61
-	}
62
-	return $val;
51
+     if ( function_exists( 'cmb2_get_option' ) ) {
52
+          return cmb2_get_option( 'lsx_health_plan_options', $key, $default );
53
+     }
54
+     // Fallback to get_option if CMB2 is not loaded yet.
55
+     $opts = \get_option( 'lsx_health_plan_options', $default );
56
+     $val  = $default;
57
+     if ( 'all' === $key ) {
58
+          $val = $opts;
59
+     } elseif ( is_array( $opts ) && array_key_exists( $key, $opts ) && false !== $opts[ $key ] ) {
60
+          $val = $opts[ $key ];
61
+     }
62
+     return $val;
63 63
 }
64 64
 
65 65
 /**
@@ -70,54 +70,54 @@  discard block
 block discarded – undo
70 70
  * @return mixed           Option value
71 71
  */
72 72
 function get_downloads( $type = 'all', $post_id = '' ) {
73
-	$lsx_health_plan = \lsx_health_plan();
74
-	$post_types      = $lsx_health_plan->get_post_types();
75
-	if ( '' === $post_id ) {
76
-		$post_id = get_the_ID();
77
-	}
78
-	$downloads = array();
79
-	$options   = get_option( 'all' );
80
-
81
-	foreach ( $post_types as $post_type ) {
82
-		if ( 'all' === $type || in_array( $type, $post_types, true ) ) {
83
-
84
-			// Get the default downloads for this post type.
85
-			$default_downloads = array();
86
-			$new_downloads     = array();
87
-			if ( isset( $options[ 'download_' . $post_type ] ) ) {
88
-				if ( is_array( $options[ 'download_' . $post_type ] ) ) {
89
-					$default_downloads = $options[ 'download_' . $post_type ];
90
-				} else {
91
-					$default_downloads[] = $options[ 'download_' . $post_type ];
92
-				}
93
-			}
94
-
95
-			if ( 'page' === $post_type ) {
96
-				$key = 'plan_warmup';
97
-			} else {
98
-				$key = 'connected_' . $post_type . 's';
99
-			}
100
-
101
-			$connected_items = get_post_meta( $post_id, $key, true );
102
-			if ( ! empty( $connected_items ) ) {
103
-				foreach ( $connected_items as $connected_item ) {
104
-					$current_downloads = get_post_meta( $connected_item, 'connected_downloads', true );
105
-					if ( false !== $current_downloads && ! empty( $current_downloads ) ) {
106
-						$new_downloads = array_merge( $new_downloads, $current_downloads );
107
-					}
108
-				}
109
-			}
110
-
111
-			if ( ! empty( $new_downloads ) ) {
112
-				$downloads = array_merge( $downloads, $new_downloads );
113
-			} elseif ( ! empty( $default_downloads ) ) {
114
-				$downloads = array_merge( $downloads, $default_downloads );
115
-			}
116
-			$downloads = array_unique( $downloads );
117
-		}
118
-	}
119
-	$downloads = check_posts_exist( $downloads );
120
-	return $downloads;
73
+     $lsx_health_plan = \lsx_health_plan();
74
+     $post_types      = $lsx_health_plan->get_post_types();
75
+     if ( '' === $post_id ) {
76
+          $post_id = get_the_ID();
77
+     }
78
+     $downloads = array();
79
+     $options   = get_option( 'all' );
80
+
81
+     foreach ( $post_types as $post_type ) {
82
+          if ( 'all' === $type || in_array( $type, $post_types, true ) ) {
83
+
84
+               // Get the default downloads for this post type.
85
+               $default_downloads = array();
86
+               $new_downloads     = array();
87
+               if ( isset( $options[ 'download_' . $post_type ] ) ) {
88
+                    if ( is_array( $options[ 'download_' . $post_type ] ) ) {
89
+                         $default_downloads = $options[ 'download_' . $post_type ];
90
+                    } else {
91
+                         $default_downloads[] = $options[ 'download_' . $post_type ];
92
+                    }
93
+               }
94
+
95
+               if ( 'page' === $post_type ) {
96
+                    $key = 'plan_warmup';
97
+               } else {
98
+                    $key = 'connected_' . $post_type . 's';
99
+               }
100
+
101
+               $connected_items = get_post_meta( $post_id, $key, true );
102
+               if ( ! empty( $connected_items ) ) {
103
+                    foreach ( $connected_items as $connected_item ) {
104
+                         $current_downloads = get_post_meta( $connected_item, 'connected_downloads', true );
105
+                         if ( false !== $current_downloads && ! empty( $current_downloads ) ) {
106
+                              $new_downloads = array_merge( $new_downloads, $current_downloads );
107
+                         }
108
+                    }
109
+               }
110
+
111
+               if ( ! empty( $new_downloads ) ) {
112
+                    $downloads = array_merge( $downloads, $new_downloads );
113
+               } elseif ( ! empty( $default_downloads ) ) {
114
+                    $downloads = array_merge( $downloads, $default_downloads );
115
+               }
116
+               $downloads = array_unique( $downloads );
117
+          }
118
+     }
119
+     $downloads = check_posts_exist( $downloads );
120
+     return $downloads;
121 121
 }
122 122
 
123 123
 /**
@@ -127,35 +127,35 @@  discard block
 block discarded – undo
127 127
  * @return array           an array of the downloads or empty.
128 128
  */
129 129
 function get_weekly_downloads( $week = '' ) {
130
-	$downloads = array();
131
-	if ( '' !== $week ) {
132
-		$saved_downloads = get_transient( 'lsx_hp_weekly_downloads_' . $week );
133
-		if ( false !== $saved_downloads && ! empty( $saved_downloads ) ) {
134
-			$downloads = $saved_downloads;
135
-		} else {
136
-			$args = array(
137
-				'orderby'        => 'title',
138
-				'order'          => 'ASC',
139
-				'post_type'      => 'dlm_download',
140
-				'posts_per_page' => -1,
141
-				'nopagin'        => true,
142
-				'fields'         => 'ids',
143
-				'tax_query'      => array(
144
-					array(
145
-						'taxonomy' => 'dlm_download_category',
146
-						'field'    => 'slug',
147
-						'terms'    => array( $week ),
148
-					),
149
-				),
150
-			);
151
-			$download_query = new \WP_Query( $args );
152
-			if ( $download_query->have_posts() ) {
153
-				$downloads = $download_query->posts;
154
-			}
155
-		}
156
-	}
157
-	$downloads = check_posts_exist( $downloads );
158
-	return $downloads;
130
+     $downloads = array();
131
+     if ( '' !== $week ) {
132
+          $saved_downloads = get_transient( 'lsx_hp_weekly_downloads_' . $week );
133
+          if ( false !== $saved_downloads && ! empty( $saved_downloads ) ) {
134
+               $downloads = $saved_downloads;
135
+          } else {
136
+               $args = array(
137
+                    'orderby'        => 'title',
138
+                    'order'          => 'ASC',
139
+                    'post_type'      => 'dlm_download',
140
+                    'posts_per_page' => -1,
141
+                    'nopagin'        => true,
142
+                    'fields'         => 'ids',
143
+                    'tax_query'      => array(
144
+                         array(
145
+                              'taxonomy' => 'dlm_download_category',
146
+                              'field'    => 'slug',
147
+                              'terms'    => array( $week ),
148
+                         ),
149
+                    ),
150
+               );
151
+               $download_query = new \WP_Query( $args );
152
+               if ( $download_query->have_posts() ) {
153
+                    $downloads = $download_query->posts;
154
+               }
155
+          }
156
+     }
157
+     $downloads = check_posts_exist( $downloads );
158
+     return $downloads;
159 159
 }
160 160
 
161 161
 /**
@@ -165,22 +165,22 @@  discard block
 block discarded – undo
165 165
  * @return void
166 166
  */
167 167
 function check_posts_exist( $post_ids = array() ) {
168
-	$new_ids = array();
169
-	global $wpdb;
170
-	if ( is_array( $post_ids ) && ! empty( $post_ids ) ) {
171
-		$post_ids = "'" . implode( "','", $post_ids ) . "'";
172
-		$query    = "
168
+     $new_ids = array();
169
+     global $wpdb;
170
+     if ( is_array( $post_ids ) && ! empty( $post_ids ) ) {
171
+          $post_ids = "'" . implode( "','", $post_ids ) . "'";
172
+          $query    = "
173 173
 			SELECT `ID` 
174 174
 			FROM `{$wpdb->posts}`
175 175
 			WHERE `ID` IN ({$post_ids})
176 176
 			AND `post_status` != 'trash'
177 177
 		";
178
-		$results = $wpdb->get_results( $query ); // WPCS: unprepared SQL
179
-		if ( ! empty( $results ) ) {
180
-			$new_ids = wp_list_pluck( $results, 'ID' );
181
-		}
182
-	}
183
-	return $new_ids;
178
+          $results = $wpdb->get_results( $query ); // WPCS: unprepared SQL
179
+          if ( ! empty( $results ) ) {
180
+               $new_ids = wp_list_pluck( $results, 'ID' );
181
+          }
182
+     }
183
+     return $new_ids;
184 184
 }
185 185
 
186 186
 /**
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
  * @return void
193 193
  */
194 194
 function register_modal( $id = '', $title = '', $body = '' ) {
195
-	lsx_health_plan()->frontend->modals->register_modal(
196
-		array(
197
-			'title' => $title,
198
-			'body'  => $body,
199
-		),
200
-		$id
201
-	);
195
+     lsx_health_plan()->frontend->modals->register_modal(
196
+          array(
197
+               'title' => $title,
198
+               'body'  => $body,
199
+          ),
200
+          $id
201
+     );
202 202
 }
203 203
 
204 204
 /**
@@ -208,13 +208,13 @@  discard block
 block discarded – undo
208 208
  * @return void
209 209
  */
210 210
 function output_modal( $args = array() ) {
211
-	$defaults = array(
212
-		'id'    => '',
213
-		'title' => '',
214
-		'body'  => '',
215
-	);
216
-	$args     = wp_parse_args( $args, $defaults );
217
-	?>
211
+     $defaults = array(
212
+          'id'    => '',
213
+          'title' => '',
214
+          'body'  => '',
215
+     );
216
+     $args     = wp_parse_args( $args, $defaults );
217
+     ?>
218 218
 	<!-- Modal -->
219 219
 	<div class="modal fade lsx-health-plan-modal" id="<?php echo esc_html( $args['id'] ); ?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo esc_html( $args['id'] ); ?>"  aria-hidden="true">
220 220
 		<div class="modal-dialog" role="document">
@@ -222,36 +222,36 @@  discard block
 block discarded – undo
222 222
 			<button type="button" class="close" data-dismiss="modal">&times;</button>			
223 223
 				<div class="modal-header">
224 224
 					<?php
225
-					if ( '' !== $args['title'] ) {
226
-						echo wp_kses_post( '<h2>' . $args['title'] . '</h2>' );
227
-					}
228
-					?>
225
+                         if ( '' !== $args['title'] ) {
226
+                              echo wp_kses_post( '<h2>' . $args['title'] . '</h2>' );
227
+                         }
228
+                         ?>
229 229
 				</div>
230 230
 				<div class="modal-body">
231 231
 				<?php
232
-				if ( '' !== $args['body'] ) {
233
-					$allowed_html = array(
234
-						'iframe' => array(
235
-							'data-src'        => array(),
236
-							'src'             => array(),
237
-							'width'           => array(),
238
-							'height'          => array(),
239
-							'frameBorder'     => array( '0' ),
240
-							'class'           => array(),
241
-							'allowFullScreen' => array(),
242
-							'style'           => array(),
243
-						),
244
-						'h5'     => array(
245
-							'class' => array(),
246
-						),
247
-					);
248
-					if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
249
-						echo wp_kses_post( $args['body'] );
250
-					} else {
251
-						echo wp_kses( $args['body'], $allowed_html );
252
-					}
253
-				}
254
-				?>
232
+                    if ( '' !== $args['body'] ) {
233
+                         $allowed_html = array(
234
+                              'iframe' => array(
235
+                                   'data-src'        => array(),
236
+                                   'src'             => array(),
237
+                                   'width'           => array(),
238
+                                   'height'          => array(),
239
+                                   'frameBorder'     => array( '0' ),
240
+                                   'class'           => array(),
241
+                                   'allowFullScreen' => array(),
242
+                                   'style'           => array(),
243
+                              ),
244
+                              'h5'     => array(
245
+                                   'class' => array(),
246
+                              ),
247
+                         );
248
+                         if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
249
+                              echo wp_kses_post( $args['body'] );
250
+                         } else {
251
+                              echo wp_kses( $args['body'], $allowed_html );
252
+                         }
253
+                    }
254
+                    ?>
255 255
 				</div>
256 256
 			</div>
257 257
 		</div>
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
  * @return void
268 268
  */
269 269
 function get_video_url( $embed ) {
270
-	$url = '';
271
-	if ( false !== stripos( $embed, '<iframe' ) ) {
272
-		preg_match( '/src="([^"]+)"/', $embed, $match );
273
-		if ( is_array( $match ) && isset( $match[1] ) ) {
274
-			$url = '<iframe data-src="' . $match[1] . '" style="border: 0;" frameBorder="0" class="giphy-embed" allowFullScreen height="300" width="100%"></iframe>';
275
-		} else {
276
-			$url = $embed;
277
-		}
278
-	} else {
279
-		$url = $embed;
280
-	}
281
-	return $url;
270
+     $url = '';
271
+     if ( false !== stripos( $embed, '<iframe' ) ) {
272
+          preg_match( '/src="([^"]+)"/', $embed, $match );
273
+          if ( is_array( $match ) && isset( $match[1] ) ) {
274
+               $url = '<iframe data-src="' . $match[1] . '" style="border: 0;" frameBorder="0" class="giphy-embed" allowFullScreen height="300" width="100%"></iframe>';
275
+          } else {
276
+               $url = $embed;
277
+          }
278
+     } else {
279
+          $url = $embed;
280
+     }
281
+     return $url;
282 282
 }
283 283
 
284 284
 /**
@@ -289,18 +289,18 @@  discard block
 block discarded – undo
289 289
  * @return boolean
290 290
  */
291 291
 function is_week_complete( $term_id = false, $section_keys = array(), $group_title = '' ) {
292
-	$return = false;
293
-	if ( ! empty( $section_keys ) ) {
294
-		$group_count = count( $section_keys );
295
-		foreach ( $section_keys as &$pid ) {
296
-			$pid = 'day_' . \lsx_health_plan\functions\plan\generate_section_id( $pid ) . '_complete';
297
-		}
298
-		$days_complete = get_meta_amounts( $section_keys );
299
-		if ( (int) $group_count === (int) $days_complete ) {
300
-			$return = true;
301
-		}
302
-	}
303
-	return $return;
292
+     $return = false;
293
+     if ( ! empty( $section_keys ) ) {
294
+          $group_count = count( $section_keys );
295
+          foreach ( $section_keys as &$pid ) {
296
+               $pid = 'day_' . \lsx_health_plan\functions\plan\generate_section_id( $pid ) . '_complete';
297
+          }
298
+          $days_complete = get_meta_amounts( $section_keys );
299
+          if ( (int) $group_count === (int) $days_complete ) {
300
+               $return = true;
301
+          }
302
+     }
303
+     return $return;
304 304
 }
305 305
 
306 306
 /**
@@ -311,23 +311,23 @@  discard block
 block discarded – undo
311 311
  * @return void
312 312
  */
313 313
 function get_meta_amounts( $post_ids = array() ) {
314
-	global $wpdb;
315
-	$amount       = 0;
316
-	$current_user = wp_get_current_user();
317
-	if ( false !== $current_user && ! empty( $post_ids ) ) {
318
-		$post_ids = "'" . implode( "','", $post_ids ) . "'";
319
-		$query    = "
314
+     global $wpdb;
315
+     $amount       = 0;
316
+     $current_user = wp_get_current_user();
317
+     if ( false !== $current_user && ! empty( $post_ids ) ) {
318
+          $post_ids = "'" . implode( "','", $post_ids ) . "'";
319
+          $query    = "
320 320
 			SELECT COUNT(`meta_value`) 
321 321
 			FROM `{$wpdb->usermeta}`
322 322
 			WHERE `meta_key` IN ({$post_ids})
323 323
 			AND `user_id` = '{$current_user->ID}'
324 324
 		";
325
-		$results  = $wpdb->get_var( $query ); // WPCS: unprepared SQL
326
-		if ( ! empty( $results ) ) {
327
-			$amount = $results;
328
-		}
329
-	}
330
-	return $amount;
325
+          $results  = $wpdb->get_var( $query ); // WPCS: unprepared SQL
326
+          if ( ! empty( $results ) ) {
327
+               $amount = $results;
328
+          }
329
+     }
330
+     return $amount;
331 331
 }
332 332
 
333 333
 /**
@@ -337,39 +337,39 @@  discard block
 block discarded – undo
337 337
  * @return void
338 338
  */
339 339
 function hp_get_plan_type_meta( $post ) {
340
-	$plan_meta = '';
340
+     $plan_meta = '';
341 341
 
342
-	$term_obj_list = get_the_terms( $post->ID, 'plan-type' );
343
-	if ( false !== $term_obj_list ) {
344
-		$terms_string  = join( ' & ', wp_list_pluck( $term_obj_list, 'name' ) );
345
-		$terms_ids     = wp_list_pluck( $term_obj_list, 'term_id' );
342
+     $term_obj_list = get_the_terms( $post->ID, 'plan-type' );
343
+     if ( false !== $term_obj_list ) {
344
+          $terms_string  = join( ' & ', wp_list_pluck( $term_obj_list, 'name' ) );
345
+          $terms_ids     = wp_list_pluck( $term_obj_list, 'term_id' );
346 346
 
347
-		foreach ( $terms_ids as $terms_id ) {
348
-			$term_thumbnail_id = get_term_meta( $terms_id, 'thumbnail', true );
349
-			$img               = wp_get_attachment_image_src( $term_thumbnail_id, 'thumbnail' );
350
-			if ( ! empty( $img ) ) {
351
-				$image_url         = $img[0];
352
-				$img               = '<img loading="lazy" alt="thumbnail" style="width:24px; height: auto;" class="attachment-responsive wp-post-image lsx-responsive" src="' . esc_url( $image_url ) . '" />';
353
-			}
347
+          foreach ( $terms_ids as $terms_id ) {
348
+               $term_thumbnail_id = get_term_meta( $terms_id, 'thumbnail', true );
349
+               $img               = wp_get_attachment_image_src( $term_thumbnail_id, 'thumbnail' );
350
+               if ( ! empty( $img ) ) {
351
+                    $image_url         = $img[0];
352
+                    $img               = '<img loading="lazy" alt="thumbnail" style="width:24px; height: auto;" class="attachment-responsive wp-post-image lsx-responsive" src="' . esc_url( $image_url ) . '" />';
353
+               }
354 354
 
355
-			$plan_meta .= $img;
356
-		}
355
+               $plan_meta .= $img;
356
+          }
357 357
 
358
-		$plan_meta = '<div class="plan-meta">' . $plan_meta . '<span>' . $terms_string . '</span></div>';
359
-	}
358
+          $plan_meta = '<div class="plan-meta">' . $plan_meta . '<span>' . $terms_string . '</span></div>';
359
+     }
360 360
 
361
-	return $plan_meta;
361
+     return $plan_meta;
362 362
 }
363 363
 
364 364
 /**
365 365
  * Limit media library access
366 366
  */
367 367
 function set_only_author( $wp_query ) {
368
-	global $current_user;
369
-	if ( is_admin() && ! current_user_can( 'edit_others_posts' ) ) {
370
-		$wp_query->set( 'administrator', $current_user->ID );
371
-		add_filter( 'views_upload', 'fix_media_counts' );
372
-	}
368
+     global $current_user;
369
+     if ( is_admin() && ! current_user_can( 'edit_others_posts' ) ) {
370
+          $wp_query->set( 'administrator', $current_user->ID );
371
+          add_filter( 'views_upload', 'fix_media_counts' );
372
+     }
373 373
 }
374 374
 add_action( 'pre_get_posts', '\lsx_health_plan\functions\set_only_author' );
375 375
 
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
  * @return void
381 381
  */
382 382
 function hp_excerpt( $post_id ) {
383
-	if ( ! has_excerpt( $post_id ) ) {
384
-		$content = wp_trim_words( get_post_field( 'post_content', $post_id ), 10 );
385
-	} else {
386
-		$content = get_the_excerpt( $post_id );
387
-	}
388
-	return $content;
383
+     if ( ! has_excerpt( $post_id ) ) {
384
+          $content = wp_trim_words( get_post_field( 'post_content', $post_id ), 10 );
385
+     } else {
386
+          $content = get_the_excerpt( $post_id );
387
+     }
388
+     return $content;
389 389
 }
390 390
 
391 391
 /**
@@ -395,9 +395,9 @@  discard block
 block discarded – undo
395 395
  * @return void
396 396
  */
397 397
 function column_class( $columns = '3' ) {
398
-	$cols  = '';
399
-	$cols .= '5' === $columns ? '15' : 12 / $columns;
400
-	return $cols;
398
+     $cols  = '';
399
+     $cols .= '5' === $columns ? '15' : 12 / $columns;
400
+     return $cols;
401 401
 }
402 402
 
403 403
 /**
@@ -407,22 +407,22 @@  discard block
 block discarded – undo
407 407
  * @return void
408 408
  */
409 409
 function get_exercises_by_workout( $workout = '' ) {
410
-	$exercises = array();
411
-	$i               = 1;
412
-	$section_counter = 6;
413
-	while ( $i <= $section_counter ) {
414
-		$group_name = 'workout_section_' . $i;
415
-		$groups     = get_post_meta( $workout, $group_name, true );
416
-		if ( ! empty( $groups ) ) {
417
-			foreach ( $groups as $group ) {
418
-				if ( isset( $group['connected_exercises'] ) ) {
419
-					$exercises[] = $group['connected_exercises'];
420
-				}
421
-			}
422
-		}
423
-		$i++;
424
-	}
425
-	return $exercises;
410
+     $exercises = array();
411
+     $i               = 1;
412
+     $section_counter = 6;
413
+     while ( $i <= $section_counter ) {
414
+          $group_name = 'workout_section_' . $i;
415
+          $groups     = get_post_meta( $workout, $group_name, true );
416
+          if ( ! empty( $groups ) ) {
417
+               foreach ( $groups as $group ) {
418
+                    if ( isset( $group['connected_exercises'] ) ) {
419
+                         $exercises[] = $group['connected_exercises'];
420
+                    }
421
+               }
422
+          }
423
+          $i++;
424
+     }
425
+     return $exercises;
426 426
 }
427 427
 
428 428
 
@@ -433,20 +433,20 @@  discard block
 block discarded – undo
433 433
  * @return int
434 434
  */
435 435
 function get_progress( $plan_id = false ) {
436
-	$progress = 0;
437
-	$complete = array();
438
-	$count    = 0;
439
-	if ( false !== $plan_id &&  \lsx_health_plan\functions\plan\has_sections( $plan_id ) ) {
440
-		$sections = \lsx_health_plan\functions\plan\get_sections();
441
-		$all_count = count( $sections );
442
-		foreach ( $sections as $section_key => $section_values ) {
443
-			if ( lsx_health_plan_is_day_complete( $plan_id, $section_values['title'] ) ) {
444
-				$complete[] = true;
445
-			}
446
-		}
447
-		$progress = (int) count( $complete ) / (int) $all_count * 100;
448
-	}
449
-	return $progress;
436
+     $progress = 0;
437
+     $complete = array();
438
+     $count    = 0;
439
+     if ( false !== $plan_id &&  \lsx_health_plan\functions\plan\has_sections( $plan_id ) ) {
440
+          $sections = \lsx_health_plan\functions\plan\get_sections();
441
+          $all_count = count( $sections );
442
+          foreach ( $sections as $section_key => $section_values ) {
443
+               if ( lsx_health_plan_is_day_complete( $plan_id, $section_values['title'] ) ) {
444
+                    $complete[] = true;
445
+               }
446
+          }
447
+          $progress = (int) count( $complete ) / (int) $all_count * 100;
448
+     }
449
+     return $progress;
450 450
 }
451 451
 
452 452
 
@@ -458,18 +458,18 @@  discard block
 block discarded – undo
458 458
  */
459 459
 function hp_back_archive_link() {
460 460
 
461
-	$post_type = 'exercise';
462
-	if ( is_tax( 'recipe-cuisine' ) || is_tax( 'recipe-type' ) ) {
463
-		$post_type = 'recipe';
464
-	}
461
+     $post_type = 'exercise';
462
+     if ( is_tax( 'recipe-cuisine' ) || is_tax( 'recipe-type' ) ) {
463
+          $post_type = 'recipe';
464
+     }
465 465
 
466
-	if ( is_tax() ) {
467
-		?>
466
+     if ( is_tax() ) {
467
+          ?>
468 468
 		<div class="archive-category-title hp-archive-category-title">
469 469
 			<a class="back-to-blog" href="<?php echo ( esc_url( get_post_type_archive_link( $post_type ) ) ); ?>"><?php echo esc_html__( 'Back To ', 'lsx' ) . esc_html( $post_type ) . 's'; ?></a>
470 470
 		</div>
471 471
 		<?php
472
-	}
472
+     }
473 473
 }
474 474
 add_action( 'lsx_content_wrap_before', '\lsx_health_plan\functions\hp_back_archive_link', 20 );
475 475
 
@@ -480,11 +480,11 @@  discard block
 block discarded – undo
480 480
  * @return array
481 481
  */
482 482
 function prep_array( $item ) {
483
-	if ( ! is_array( $item ) ) {
484
-		$item = explode( ',', $item );
485
-		if ( ! is_array( $item ) ) {
486
-			$item = array( $item );
487
-		}
488
-	}
489
-	return $item;
483
+     if ( ! is_array( $item ) ) {
484
+          $item = explode( ',', $item );
485
+          if ( ! is_array( $item ) ) {
486
+               $item = array( $item );
487
+          }
488
+     }
489
+     return $item;
490 490
 }
Please login to merge, or discard this patch.
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -16,24 +16,24 @@  discard block
 block discarded – undo
16 16
  * @param boolean $single
17 17
  * @return boolean
18 18
  */
19
-function has_attached_post( $post_id = '', $meta_key = '', $single = true ) {
19
+function has_attached_post($post_id = '', $meta_key = '', $single = true) {
20 20
 	$has_post = false;
21
-	if ( '' === $post_id ) {
21
+	if ('' === $post_id) {
22 22
 		$post_id = get_the_ID();
23 23
 	}
24
-	$items = get_post_meta( $post_id, $meta_key, $single );
25
-	if ( '' !== $items && false !== $items && 0 !== $items ) {
26
-		if ( ! is_array( $items ) ) {
27
-			$items = array( $items );
24
+	$items = get_post_meta($post_id, $meta_key, $single);
25
+	if ('' !== $items && false !== $items && 0 !== $items) {
26
+		if ( ! is_array($items)) {
27
+			$items = array($items);
28 28
 		}
29
-		$items = check_posts_exist( $items );
30
-		if ( ! empty( $items ) ) {
29
+		$items = check_posts_exist($items);
30
+		if ( ! empty($items)) {
31 31
 			$has_post = true;
32 32
 		}
33 33
 	} else {
34 34
 		// Check for defaults.
35
-		$options = get_option( 'all' );
36
-		if ( isset( $options[ $meta_key ] ) && '' !== $options[ $meta_key ] && ! empty( $options[ $meta_key ] ) ) {
35
+		$options = get_option('all');
36
+		if (isset($options[$meta_key]) && '' !== $options[$meta_key] && ! empty($options[$meta_key])) {
37 37
 			$has_post = true;
38 38
 		}
39 39
 	}
@@ -47,17 +47,17 @@  discard block
 block discarded – undo
47 47
  * @param  mixed  $default Optional default value
48 48
  * @return mixed           Option value
49 49
  */
50
-function get_option( $key = '', $default = false ) {
51
-	if ( function_exists( 'cmb2_get_option' ) ) {
52
-		return cmb2_get_option( 'lsx_health_plan_options', $key, $default );
50
+function get_option($key = '', $default = false) {
51
+	if (function_exists('cmb2_get_option')) {
52
+		return cmb2_get_option('lsx_health_plan_options', $key, $default);
53 53
 	}
54 54
 	// Fallback to get_option if CMB2 is not loaded yet.
55
-	$opts = \get_option( 'lsx_health_plan_options', $default );
55
+	$opts = \get_option('lsx_health_plan_options', $default);
56 56
 	$val  = $default;
57
-	if ( 'all' === $key ) {
57
+	if ('all' === $key) {
58 58
 		$val = $opts;
59
-	} elseif ( is_array( $opts ) && array_key_exists( $key, $opts ) && false !== $opts[ $key ] ) {
60
-		$val = $opts[ $key ];
59
+	} elseif (is_array($opts) && array_key_exists($key, $opts) && false !== $opts[$key]) {
60
+		$val = $opts[$key];
61 61
 	}
62 62
 	return $val;
63 63
 }
@@ -69,54 +69,54 @@  discard block
 block discarded – undo
69 69
  * @param  mixed  $default Optional default value
70 70
  * @return mixed           Option value
71 71
  */
72
-function get_downloads( $type = 'all', $post_id = '' ) {
72
+function get_downloads($type = 'all', $post_id = '') {
73 73
 	$lsx_health_plan = \lsx_health_plan();
74 74
 	$post_types      = $lsx_health_plan->get_post_types();
75
-	if ( '' === $post_id ) {
75
+	if ('' === $post_id) {
76 76
 		$post_id = get_the_ID();
77 77
 	}
78 78
 	$downloads = array();
79
-	$options   = get_option( 'all' );
79
+	$options   = get_option('all');
80 80
 
81
-	foreach ( $post_types as $post_type ) {
82
-		if ( 'all' === $type || in_array( $type, $post_types, true ) ) {
81
+	foreach ($post_types as $post_type) {
82
+		if ('all' === $type || in_array($type, $post_types, true)) {
83 83
 
84 84
 			// Get the default downloads for this post type.
85 85
 			$default_downloads = array();
86 86
 			$new_downloads     = array();
87
-			if ( isset( $options[ 'download_' . $post_type ] ) ) {
88
-				if ( is_array( $options[ 'download_' . $post_type ] ) ) {
89
-					$default_downloads = $options[ 'download_' . $post_type ];
87
+			if (isset($options['download_' . $post_type])) {
88
+				if (is_array($options['download_' . $post_type])) {
89
+					$default_downloads = $options['download_' . $post_type];
90 90
 				} else {
91
-					$default_downloads[] = $options[ 'download_' . $post_type ];
91
+					$default_downloads[] = $options['download_' . $post_type];
92 92
 				}
93 93
 			}
94 94
 
95
-			if ( 'page' === $post_type ) {
95
+			if ('page' === $post_type) {
96 96
 				$key = 'plan_warmup';
97 97
 			} else {
98 98
 				$key = 'connected_' . $post_type . 's';
99 99
 			}
100 100
 
101
-			$connected_items = get_post_meta( $post_id, $key, true );
102
-			if ( ! empty( $connected_items ) ) {
103
-				foreach ( $connected_items as $connected_item ) {
104
-					$current_downloads = get_post_meta( $connected_item, 'connected_downloads', true );
105
-					if ( false !== $current_downloads && ! empty( $current_downloads ) ) {
106
-						$new_downloads = array_merge( $new_downloads, $current_downloads );
101
+			$connected_items = get_post_meta($post_id, $key, true);
102
+			if ( ! empty($connected_items)) {
103
+				foreach ($connected_items as $connected_item) {
104
+					$current_downloads = get_post_meta($connected_item, 'connected_downloads', true);
105
+					if (false !== $current_downloads && ! empty($current_downloads)) {
106
+						$new_downloads = array_merge($new_downloads, $current_downloads);
107 107
 					}
108 108
 				}
109 109
 			}
110 110
 
111
-			if ( ! empty( $new_downloads ) ) {
112
-				$downloads = array_merge( $downloads, $new_downloads );
113
-			} elseif ( ! empty( $default_downloads ) ) {
114
-				$downloads = array_merge( $downloads, $default_downloads );
111
+			if ( ! empty($new_downloads)) {
112
+				$downloads = array_merge($downloads, $new_downloads);
113
+			} elseif ( ! empty($default_downloads)) {
114
+				$downloads = array_merge($downloads, $default_downloads);
115 115
 			}
116
-			$downloads = array_unique( $downloads );
116
+			$downloads = array_unique($downloads);
117 117
 		}
118 118
 	}
119
-	$downloads = check_posts_exist( $downloads );
119
+	$downloads = check_posts_exist($downloads);
120 120
 	return $downloads;
121 121
 }
122 122
 
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
  * @param  string $week    Week name 'week-1'.
127 127
  * @return array           an array of the downloads or empty.
128 128
  */
129
-function get_weekly_downloads( $week = '' ) {
129
+function get_weekly_downloads($week = '') {
130 130
 	$downloads = array();
131
-	if ( '' !== $week ) {
132
-		$saved_downloads = get_transient( 'lsx_hp_weekly_downloads_' . $week );
133
-		if ( false !== $saved_downloads && ! empty( $saved_downloads ) ) {
131
+	if ('' !== $week) {
132
+		$saved_downloads = get_transient('lsx_hp_weekly_downloads_' . $week);
133
+		if (false !== $saved_downloads && ! empty($saved_downloads)) {
134 134
 			$downloads = $saved_downloads;
135 135
 		} else {
136 136
 			$args = array(
@@ -144,17 +144,17 @@  discard block
 block discarded – undo
144 144
 					array(
145 145
 						'taxonomy' => 'dlm_download_category',
146 146
 						'field'    => 'slug',
147
-						'terms'    => array( $week ),
147
+						'terms'    => array($week),
148 148
 					),
149 149
 				),
150 150
 			);
151
-			$download_query = new \WP_Query( $args );
152
-			if ( $download_query->have_posts() ) {
151
+			$download_query = new \WP_Query($args);
152
+			if ($download_query->have_posts()) {
153 153
 				$downloads = $download_query->posts;
154 154
 			}
155 155
 		}
156 156
 	}
157
-	$downloads = check_posts_exist( $downloads );
157
+	$downloads = check_posts_exist($downloads);
158 158
 	return $downloads;
159 159
 }
160 160
 
@@ -164,20 +164,20 @@  discard block
 block discarded – undo
164 164
  * @param array $post_ids
165 165
  * @return void
166 166
  */
167
-function check_posts_exist( $post_ids = array() ) {
167
+function check_posts_exist($post_ids = array()) {
168 168
 	$new_ids = array();
169 169
 	global $wpdb;
170
-	if ( is_array( $post_ids ) && ! empty( $post_ids ) ) {
171
-		$post_ids = "'" . implode( "','", $post_ids ) . "'";
170
+	if (is_array($post_ids) && ! empty($post_ids)) {
171
+		$post_ids = "'" . implode("','", $post_ids) . "'";
172 172
 		$query    = "
173 173
 			SELECT `ID` 
174 174
 			FROM `{$wpdb->posts}`
175 175
 			WHERE `ID` IN ({$post_ids})
176 176
 			AND `post_status` != 'trash'
177 177
 		";
178
-		$results = $wpdb->get_results( $query ); // WPCS: unprepared SQL
179
-		if ( ! empty( $results ) ) {
180
-			$new_ids = wp_list_pluck( $results, 'ID' );
178
+		$results = $wpdb->get_results($query); // WPCS: unprepared SQL
179
+		if ( ! empty($results)) {
180
+			$new_ids = wp_list_pluck($results, 'ID');
181 181
 		}
182 182
 	}
183 183
 	return $new_ids;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
  * @param string $body
192 192
  * @return void
193 193
  */
194
-function register_modal( $id = '', $title = '', $body = '' ) {
194
+function register_modal($id = '', $title = '', $body = '') {
195 195
 	lsx_health_plan()->frontend->modals->register_modal(
196 196
 		array(
197 197
 			'title' => $title,
@@ -207,36 +207,36 @@  discard block
 block discarded – undo
207 207
  * @param array $args
208 208
  * @return void
209 209
  */
210
-function output_modal( $args = array() ) {
210
+function output_modal($args = array()) {
211 211
 	$defaults = array(
212 212
 		'id'    => '',
213 213
 		'title' => '',
214 214
 		'body'  => '',
215 215
 	);
216
-	$args     = wp_parse_args( $args, $defaults );
216
+	$args = wp_parse_args($args, $defaults);
217 217
 	?>
218 218
 	<!-- Modal -->
219
-	<div class="modal fade lsx-health-plan-modal" id="<?php echo esc_html( $args['id'] ); ?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo esc_html( $args['id'] ); ?>"  aria-hidden="true">
219
+	<div class="modal fade lsx-health-plan-modal" id="<?php echo esc_html($args['id']); ?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo esc_html($args['id']); ?>"  aria-hidden="true">
220 220
 		<div class="modal-dialog" role="document">
221 221
 			<div class="modal-content">
222 222
 			<button type="button" class="close" data-dismiss="modal">&times;</button>			
223 223
 				<div class="modal-header">
224 224
 					<?php
225
-					if ( '' !== $args['title'] ) {
226
-						echo wp_kses_post( '<h2>' . $args['title'] . '</h2>' );
225
+					if ('' !== $args['title']) {
226
+						echo wp_kses_post('<h2>' . $args['title'] . '</h2>');
227 227
 					}
228 228
 					?>
229 229
 				</div>
230 230
 				<div class="modal-body">
231 231
 				<?php
232
-				if ( '' !== $args['body'] ) {
232
+				if ('' !== $args['body']) {
233 233
 					$allowed_html = array(
234 234
 						'iframe' => array(
235 235
 							'data-src'        => array(),
236 236
 							'src'             => array(),
237 237
 							'width'           => array(),
238 238
 							'height'          => array(),
239
-							'frameBorder'     => array( '0' ),
239
+							'frameBorder'     => array('0'),
240 240
 							'class'           => array(),
241 241
 							'allowFullScreen' => array(),
242 242
 							'style'           => array(),
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 							'class' => array(),
246 246
 						),
247 247
 					);
248
-					if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
249
-						echo wp_kses_post( $args['body'] );
248
+					if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
249
+						echo wp_kses_post($args['body']);
250 250
 					} else {
251
-						echo wp_kses( $args['body'], $allowed_html );
251
+						echo wp_kses($args['body'], $allowed_html);
252 252
 					}
253 253
 				}
254 254
 				?>
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
  * @param [type] $embed
267 267
  * @return void
268 268
  */
269
-function get_video_url( $embed ) {
269
+function get_video_url($embed) {
270 270
 	$url = '';
271
-	if ( false !== stripos( $embed, '<iframe' ) ) {
272
-		preg_match( '/src="([^"]+)"/', $embed, $match );
273
-		if ( is_array( $match ) && isset( $match[1] ) ) {
271
+	if (false !== stripos($embed, '<iframe')) {
272
+		preg_match('/src="([^"]+)"/', $embed, $match);
273
+		if (is_array($match) && isset($match[1])) {
274 274
 			$url = '<iframe data-src="' . $match[1] . '" style="border: 0;" frameBorder="0" class="giphy-embed" allowFullScreen height="300" width="100%"></iframe>';
275 275
 		} else {
276 276
 			$url = $embed;
@@ -288,15 +288,15 @@  discard block
 block discarded – undo
288 288
  * @param array $post_ids
289 289
  * @return boolean
290 290
  */
291
-function is_week_complete( $term_id = false, $section_keys = array(), $group_title = '' ) {
291
+function is_week_complete($term_id = false, $section_keys = array(), $group_title = '') {
292 292
 	$return = false;
293
-	if ( ! empty( $section_keys ) ) {
294
-		$group_count = count( $section_keys );
295
-		foreach ( $section_keys as &$pid ) {
296
-			$pid = 'day_' . \lsx_health_plan\functions\plan\generate_section_id( $pid ) . '_complete';
293
+	if ( ! empty($section_keys)) {
294
+		$group_count = count($section_keys);
295
+		foreach ($section_keys as &$pid) {
296
+			$pid = 'day_' . \lsx_health_plan\functions\plan\generate_section_id($pid) . '_complete';
297 297
 		}
298
-		$days_complete = get_meta_amounts( $section_keys );
299
-		if ( (int) $group_count === (int) $days_complete ) {
298
+		$days_complete = get_meta_amounts($section_keys);
299
+		if ((int) $group_count === (int) $days_complete) {
300 300
 			$return = true;
301 301
 		}
302 302
 	}
@@ -310,20 +310,20 @@  discard block
 block discarded – undo
310 310
  * @param string $key
311 311
  * @return void
312 312
  */
313
-function get_meta_amounts( $post_ids = array() ) {
313
+function get_meta_amounts($post_ids = array()) {
314 314
 	global $wpdb;
315 315
 	$amount       = 0;
316 316
 	$current_user = wp_get_current_user();
317
-	if ( false !== $current_user && ! empty( $post_ids ) ) {
318
-		$post_ids = "'" . implode( "','", $post_ids ) . "'";
317
+	if (false !== $current_user && ! empty($post_ids)) {
318
+		$post_ids = "'" . implode("','", $post_ids) . "'";
319 319
 		$query    = "
320 320
 			SELECT COUNT(`meta_value`) 
321 321
 			FROM `{$wpdb->usermeta}`
322 322
 			WHERE `meta_key` IN ({$post_ids})
323 323
 			AND `user_id` = '{$current_user->ID}'
324 324
 		";
325
-		$results  = $wpdb->get_var( $query ); // WPCS: unprepared SQL
326
-		if ( ! empty( $results ) ) {
325
+		$results = $wpdb->get_var($query); // WPCS: unprepared SQL
326
+		if ( ! empty($results)) {
327 327
 			$amount = $results;
328 328
 		}
329 329
 	}
@@ -336,20 +336,20 @@  discard block
 block discarded – undo
336 336
  * @param [type] $post
337 337
  * @return void
338 338
  */
339
-function hp_get_plan_type_meta( $post ) {
339
+function hp_get_plan_type_meta($post) {
340 340
 	$plan_meta = '';
341 341
 
342
-	$term_obj_list = get_the_terms( $post->ID, 'plan-type' );
343
-	if ( false !== $term_obj_list ) {
344
-		$terms_string  = join( ' & ', wp_list_pluck( $term_obj_list, 'name' ) );
345
-		$terms_ids     = wp_list_pluck( $term_obj_list, 'term_id' );
342
+	$term_obj_list = get_the_terms($post->ID, 'plan-type');
343
+	if (false !== $term_obj_list) {
344
+		$terms_string  = join(' & ', wp_list_pluck($term_obj_list, 'name'));
345
+		$terms_ids     = wp_list_pluck($term_obj_list, 'term_id');
346 346
 
347
-		foreach ( $terms_ids as $terms_id ) {
348
-			$term_thumbnail_id = get_term_meta( $terms_id, 'thumbnail', true );
349
-			$img               = wp_get_attachment_image_src( $term_thumbnail_id, 'thumbnail' );
350
-			if ( ! empty( $img ) ) {
347
+		foreach ($terms_ids as $terms_id) {
348
+			$term_thumbnail_id = get_term_meta($terms_id, 'thumbnail', true);
349
+			$img               = wp_get_attachment_image_src($term_thumbnail_id, 'thumbnail');
350
+			if ( ! empty($img)) {
351 351
 				$image_url         = $img[0];
352
-				$img               = '<img loading="lazy" alt="thumbnail" style="width:24px; height: auto;" class="attachment-responsive wp-post-image lsx-responsive" src="' . esc_url( $image_url ) . '" />';
352
+				$img               = '<img loading="lazy" alt="thumbnail" style="width:24px; height: auto;" class="attachment-responsive wp-post-image lsx-responsive" src="' . esc_url($image_url) . '" />';
353 353
 			}
354 354
 
355 355
 			$plan_meta .= $img;
@@ -364,14 +364,14 @@  discard block
 block discarded – undo
364 364
 /**
365 365
  * Limit media library access
366 366
  */
367
-function set_only_author( $wp_query ) {
367
+function set_only_author($wp_query) {
368 368
 	global $current_user;
369
-	if ( is_admin() && ! current_user_can( 'edit_others_posts' ) ) {
370
-		$wp_query->set( 'administrator', $current_user->ID );
371
-		add_filter( 'views_upload', 'fix_media_counts' );
369
+	if (is_admin() && ! current_user_can('edit_others_posts')) {
370
+		$wp_query->set('administrator', $current_user->ID);
371
+		add_filter('views_upload', 'fix_media_counts');
372 372
 	}
373 373
 }
374
-add_action( 'pre_get_posts', '\lsx_health_plan\functions\set_only_author' );
374
+add_action('pre_get_posts', '\lsx_health_plan\functions\set_only_author');
375 375
 
376 376
 /**
377 377
  * Outputs an excerpt even if there is not excerpt.
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
  * @param [type] $post_id
380 380
  * @return void
381 381
  */
382
-function hp_excerpt( $post_id ) {
383
-	if ( ! has_excerpt( $post_id ) ) {
384
-		$content = wp_trim_words( get_post_field( 'post_content', $post_id ), 10 );
382
+function hp_excerpt($post_id) {
383
+	if ( ! has_excerpt($post_id)) {
384
+		$content = wp_trim_words(get_post_field('post_content', $post_id), 10);
385 385
 	} else {
386
-		$content = get_the_excerpt( $post_id );
386
+		$content = get_the_excerpt($post_id);
387 387
 	}
388 388
 	return $content;
389 389
 }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
  * @param string $columns
395 395
  * @return void
396 396
  */
397
-function column_class( $columns = '3' ) {
397
+function column_class($columns = '3') {
398 398
 	$cols  = '';
399 399
 	$cols .= '5' === $columns ? '15' : 12 / $columns;
400 400
 	return $cols;
@@ -406,16 +406,16 @@  discard block
 block discarded – undo
406 406
  * @param string $workout
407 407
  * @return void
408 408
  */
409
-function get_exercises_by_workout( $workout = '' ) {
409
+function get_exercises_by_workout($workout = '') {
410 410
 	$exercises = array();
411 411
 	$i               = 1;
412 412
 	$section_counter = 6;
413
-	while ( $i <= $section_counter ) {
413
+	while ($i <= $section_counter) {
414 414
 		$group_name = 'workout_section_' . $i;
415
-		$groups     = get_post_meta( $workout, $group_name, true );
416
-		if ( ! empty( $groups ) ) {
417
-			foreach ( $groups as $group ) {
418
-				if ( isset( $group['connected_exercises'] ) ) {
415
+		$groups     = get_post_meta($workout, $group_name, true);
416
+		if ( ! empty($groups)) {
417
+			foreach ($groups as $group) {
418
+				if (isset($group['connected_exercises'])) {
419 419
 					$exercises[] = $group['connected_exercises'];
420 420
 				}
421 421
 			}
@@ -432,19 +432,19 @@  discard block
 block discarded – undo
432 432
  * @param  int $plan_id
433 433
  * @return int
434 434
  */
435
-function get_progress( $plan_id = false ) {
435
+function get_progress($plan_id = false) {
436 436
 	$progress = 0;
437 437
 	$complete = array();
438 438
 	$count    = 0;
439
-	if ( false !== $plan_id &&  \lsx_health_plan\functions\plan\has_sections( $plan_id ) ) {
439
+	if (false !== $plan_id && \lsx_health_plan\functions\plan\has_sections($plan_id)) {
440 440
 		$sections = \lsx_health_plan\functions\plan\get_sections();
441
-		$all_count = count( $sections );
442
-		foreach ( $sections as $section_key => $section_values ) {
443
-			if ( lsx_health_plan_is_day_complete( $plan_id, $section_values['title'] ) ) {
441
+		$all_count = count($sections);
442
+		foreach ($sections as $section_key => $section_values) {
443
+			if (lsx_health_plan_is_day_complete($plan_id, $section_values['title'])) {
444 444
 				$complete[] = true;
445 445
 			}
446 446
 		}
447
-		$progress = (int) count( $complete ) / (int) $all_count * 100;
447
+		$progress = (int) count($complete) / (int) $all_count * 100;
448 448
 	}
449 449
 	return $progress;
450 450
 }
@@ -459,19 +459,19 @@  discard block
 block discarded – undo
459 459
 function hp_back_archive_link() {
460 460
 
461 461
 	$post_type = 'exercise';
462
-	if ( is_tax( 'recipe-cuisine' ) || is_tax( 'recipe-type' ) ) {
462
+	if (is_tax('recipe-cuisine') || is_tax('recipe-type')) {
463 463
 		$post_type = 'recipe';
464 464
 	}
465 465
 
466
-	if ( is_tax() ) {
466
+	if (is_tax()) {
467 467
 		?>
468 468
 		<div class="archive-category-title hp-archive-category-title">
469
-			<a class="back-to-blog" href="<?php echo ( esc_url( get_post_type_archive_link( $post_type ) ) ); ?>"><?php echo esc_html__( 'Back To ', 'lsx' ) . esc_html( $post_type ) . 's'; ?></a>
469
+			<a class="back-to-blog" href="<?php echo (esc_url(get_post_type_archive_link($post_type))); ?>"><?php echo esc_html__('Back To ', 'lsx') . esc_html($post_type) . 's'; ?></a>
470 470
 		</div>
471 471
 		<?php
472 472
 	}
473 473
 }
474
-add_action( 'lsx_content_wrap_before', '\lsx_health_plan\functions\hp_back_archive_link', 20 );
474
+add_action('lsx_content_wrap_before', '\lsx_health_plan\functions\hp_back_archive_link', 20);
475 475
 
476 476
 /**
477 477
  * Returns an array.
@@ -479,11 +479,11 @@  discard block
 block discarded – undo
479 479
  * @param  mixed $item
480 480
  * @return array
481 481
  */
482
-function prep_array( $item ) {
483
-	if ( ! is_array( $item ) ) {
484
-		$item = explode( ',', $item );
485
-		if ( ! is_array( $item ) ) {
486
-			$item = array( $item );
482
+function prep_array($item) {
483
+	if ( ! is_array($item)) {
484
+		$item = explode(',', $item);
485
+		if ( ! is_array($item)) {
486
+			$item = array($item);
487 487
 		}
488 488
 	}
489 489
 	return $item;
Please login to merge, or discard this patch.
templates/table-exercise-data.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,47 +9,47 @@
 block discarded – undo
9 9
 <table class="exercise-table">
10 10
 	<tbody>
11 11
 		<?php
12
-		if ( ! empty( $type ) ) {
13
-		?>
12
+          if ( ! empty( $type ) ) {
13
+          ?>
14 14
 			<tr class="types">
15 15
 				<td><?php esc_html_e( 'Type:', 'lsx-health-plan' ); ?>&nbsp;</td>
16 16
 				<td>
17 17
 				<?php
18
-					echo wp_kses_post( $type );
19
-				?>
18
+                         echo wp_kses_post( $type );
19
+                    ?>
20 20
 				</td>
21 21
 			</tr>
22 22
 		<?php
23
-		}
24
-		?>
23
+          }
24
+          ?>
25 25
 		<?php
26
-		if ( ! empty( $muscle_group ) ) {
27
-		?>
26
+          if ( ! empty( $muscle_group ) ) {
27
+          ?>
28 28
 			<tr class="muscle-group">
29 29
 				<td><?php esc_html_e( 'Muscle Group:', 'lsx-health-plan' ); ?>&nbsp;</td>
30 30
 				<td>
31 31
 				<?php
32
-					echo wp_kses_post( $muscle_group );
33
-				?>
32
+                         echo wp_kses_post( $muscle_group );
33
+                    ?>
34 34
 				</td>
35 35
 			</tr>
36 36
 		<?php
37
-		}
38
-		?>
37
+          }
38
+          ?>
39 39
 		<?php
40
-		if ( ! empty( $equipment ) ) {
41
-		?>
40
+          if ( ! empty( $equipment ) ) {
41
+          ?>
42 42
 			<tr class="equipment">
43 43
 				<td><?php esc_html_e( 'Equipment:', 'lsx-health-plan' ); ?>&nbsp;</td>
44 44
 				<td>
45 45
 				<?php
46
-					echo wp_kses_post( $equipment );
47
-				?>
46
+                         echo wp_kses_post( $equipment );
47
+                    ?>
48 48
 				</td>
49 49
 			</tr>
50 50
 		<?php
51
-		}
52
-		?>
51
+          }
52
+          ?>
53 53
 	</tbody>
54 54
 </table>
55 55
 <?php } ?>
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,17 +5,17 @@  discard block
 block discarded – undo
5 5
 $muscle_group = lsx_health_plan_muscle_group_equipment();
6 6
 
7 7
 ?>
8
-<?php if ( ( ! empty( $type ) ) || ( ! empty( $equipment ) ) || ( ! empty( $muscle_group ) ) ) { ?>
8
+<?php if (( ! empty($type)) || ( ! empty($equipment)) || ( ! empty($muscle_group))) { ?>
9 9
 <table class="exercise-table">
10 10
 	<tbody>
11 11
 		<?php
12
-		if ( ! empty( $type ) ) {
12
+		if ( ! empty($type)) {
13 13
 		?>
14 14
 			<tr class="types">
15
-				<td><?php esc_html_e( 'Type:', 'lsx-health-plan' ); ?>&nbsp;</td>
15
+				<td><?php esc_html_e('Type:', 'lsx-health-plan'); ?>&nbsp;</td>
16 16
 				<td>
17 17
 				<?php
18
-					echo wp_kses_post( $type );
18
+					echo wp_kses_post($type);
19 19
 				?>
20 20
 				</td>
21 21
 			</tr>
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 		}
24 24
 		?>
25 25
 		<?php
26
-		if ( ! empty( $muscle_group ) ) {
26
+		if ( ! empty($muscle_group)) {
27 27
 		?>
28 28
 			<tr class="muscle-group">
29
-				<td><?php esc_html_e( 'Muscle Group:', 'lsx-health-plan' ); ?>&nbsp;</td>
29
+				<td><?php esc_html_e('Muscle Group:', 'lsx-health-plan'); ?>&nbsp;</td>
30 30
 				<td>
31 31
 				<?php
32
-					echo wp_kses_post( $muscle_group );
32
+					echo wp_kses_post($muscle_group);
33 33
 				?>
34 34
 				</td>
35 35
 			</tr>
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 		}
38 38
 		?>
39 39
 		<?php
40
-		if ( ! empty( $equipment ) ) {
40
+		if ( ! empty($equipment)) {
41 41
 		?>
42 42
 			<tr class="equipment">
43
-				<td><?php esc_html_e( 'Equipment:', 'lsx-health-plan' ); ?>&nbsp;</td>
43
+				<td><?php esc_html_e('Equipment:', 'lsx-health-plan'); ?>&nbsp;</td>
44 44
 				<td>
45 45
 				<?php
46
-					echo wp_kses_post( $equipment );
46
+					echo wp_kses_post($equipment);
47 47
 				?>
48 48
 				</td>
49 49
 			</tr>
Please login to merge, or discard this patch.
templates/content-archive-exercise.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -18,40 +18,40 @@  discard block
 block discarded – undo
18 18
 
19 19
 // Check for shortcode overrides.
20 20
 if ( null !== $shortcode_args ) {
21
-	if ( isset( $shortcode_args['columns'] ) ) {
22
-		$column_class = $shortcode_args['columns'];
23
-		$column_class = \lsx_health_plan\functions\column_class( $column_class );
24
-	}
25
-	if ( isset( $shortcode_args['link'] ) ) {
26
-		$link_setting = $shortcode_args['link'];
27
-		// Setup our link and content.
28
-		switch ( $link_setting ) {
29
-			case 'single':
30
-				$link_html  = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">';
31
-				$link_close = '</a>';
32
-				break;
21
+     if ( isset( $shortcode_args['columns'] ) ) {
22
+          $column_class = $shortcode_args['columns'];
23
+          $column_class = \lsx_health_plan\functions\column_class( $column_class );
24
+     }
25
+     if ( isset( $shortcode_args['link'] ) ) {
26
+          $link_setting = $shortcode_args['link'];
27
+          // Setup our link and content.
28
+          switch ( $link_setting ) {
29
+               case 'single':
30
+                    $link_html  = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">';
31
+                    $link_close = '</a>';
32
+                    break;
33 33
 
34
-			case 'modal':
35
-				$link_html  = '<a class="btn border-btn" data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">';
36
-				$link_close = '</a>';
37
-				$modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' );
38
-				$modal_args = array(
39
-					'modal_content' => $modal_content_setting,
40
-				);
41
-				// We call the button to register the modal, but we do not output it.
42
-				lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args );
43
-				break;
34
+               case 'modal':
35
+                    $link_html  = '<a class="btn border-btn" data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">';
36
+                    $link_close = '</a>';
37
+                    $modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' );
38
+                    $modal_args = array(
39
+                         'modal_content' => $modal_content_setting,
40
+                    );
41
+                    // We call the button to register the modal, but we do not output it.
42
+                    lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args );
43
+                    break;
44 44
 
45
-			case 'none':
46
-			default:
47
-				$link_html  = '';
48
-				$link_close = '';
49
-				break;
50
-		}
51
-	}
52
-	if ( isset( $shortcode_args['description'] ) ) {
53
-		$content_setting = $shortcode_args['description'];
54
-	}
45
+               case 'none':
46
+               default:
47
+                    $link_html  = '';
48
+                    $link_close = '';
49
+                    break;
50
+          }
51
+     }
52
+     if ( isset( $shortcode_args['description'] ) ) {
53
+          $content_setting = $shortcode_args['description'];
54
+     }
55 55
 }
56 56
 
57 57
 ?>
@@ -63,17 +63,17 @@  discard block
 block discarded – undo
63 63
 		<div class="exercise-feature-img">
64 64
 			<a href="<?php echo esc_url( get_permalink() ); ?>">
65 65
 			<?php
66
-			$featured_image = get_the_post_thumbnail();
67
-			if ( ! empty( $featured_image ) && '' !== $featured_image ) {
68
-				the_post_thumbnail( 'lsx-thumbnail-square', array(
69
-					'class' => 'aligncenter',
70
-				) );
71
-			} else {
72
-				?>
66
+               $featured_image = get_the_post_thumbnail();
67
+               if ( ! empty( $featured_image ) && '' !== $featured_image ) {
68
+                    the_post_thumbnail( 'lsx-thumbnail-square', array(
69
+                         'class' => 'aligncenter',
70
+                    ) );
71
+               } else {
72
+                    ?>
73 73
 				<img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>">
74 74
 				<?php
75
-			}
76
-			?>
75
+               }
76
+               ?>
77 77
 			</a>
78 78
 		</div>
79 79
 		<div class="content-box exercise-content-box white-bg">
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
 				<?php lsx_health_plan_exercise_data(); ?>
83 83
 			</div>
84 84
 			<?php
85
-			if ( '' !== $content_setting && 'excerpt' === $content_setting ) {
86
-				if ( ! has_excerpt() ) {
87
-					$content = wp_trim_words( get_the_content(), 20 );
88
-					$content = '<p>' . $content . '</p>';
89
-				} else {
90
-					$content = apply_filters( 'the_excerpt', get_the_excerpt() );
91
-				}
92
-				echo wp_kses_post( $content );
93
-			}
94
-			if ( '' !== $content_setting && 'full' === $content_setting ) {
95
-				the_content();
96
-			}
97
-			?>
85
+               if ( '' !== $content_setting && 'excerpt' === $content_setting ) {
86
+                    if ( ! has_excerpt() ) {
87
+                         $content = wp_trim_words( get_the_content(), 20 );
88
+                         $content = '<p>' . $content . '</p>';
89
+                    } else {
90
+                         $content = apply_filters( 'the_excerpt', get_the_excerpt() );
91
+                    }
92
+                    echo wp_kses_post( $content );
93
+               }
94
+               if ( '' !== $content_setting && 'full' === $content_setting ) {
95
+                    the_content();
96
+               }
97
+               ?>
98 98
 			<a href="<?php echo esc_url( get_permalink() ); ?>" class="btn border-btn"><?php esc_html_e( 'See exercise', 'lsx-health-plan' ); ?></a>
99 99
 		</div>
100 100
 		<?php lsx_entry_bottom(); ?>
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -17,29 +17,29 @@  discard block
 block discarded – undo
17 17
 $link_close      = '';
18 18
 
19 19
 // Check for shortcode overrides.
20
-if ( null !== $shortcode_args ) {
21
-	if ( isset( $shortcode_args['columns'] ) ) {
20
+if (null !== $shortcode_args) {
21
+	if (isset($shortcode_args['columns'])) {
22 22
 		$column_class = $shortcode_args['columns'];
23
-		$column_class = \lsx_health_plan\functions\column_class( $column_class );
23
+		$column_class = \lsx_health_plan\functions\column_class($column_class);
24 24
 	}
25
-	if ( isset( $shortcode_args['link'] ) ) {
25
+	if (isset($shortcode_args['link'])) {
26 26
 		$link_setting = $shortcode_args['link'];
27 27
 		// Setup our link and content.
28
-		switch ( $link_setting ) {
28
+		switch ($link_setting) {
29 29
 			case 'single':
30
-				$link_html  = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">';
30
+				$link_html  = '<a href="' . get_permalink($group['connected_exercises']) . '">';
31 31
 				$link_close = '</a>';
32 32
 				break;
33 33
 
34 34
 			case 'modal':
35 35
 				$link_html  = '<a class="btn border-btn" data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">';
36 36
 				$link_close = '</a>';
37
-				$modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' );
37
+				$modal_content_setting = \lsx_health_plan\functions\get_option('workout_tab_modal_content', 'excerpt');
38 38
 				$modal_args = array(
39 39
 					'modal_content' => $modal_content_setting,
40 40
 				);
41 41
 				// We call the button to register the modal, but we do not output it.
42
-				lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args );
42
+				lsx_health_plan_workout_exercise_button($group['connected_exercises'], $group, false, $modal_args);
43 43
 				break;
44 44
 
45 45
 			case 'none':
@@ -49,28 +49,28 @@  discard block
 block discarded – undo
49 49
 				break;
50 50
 		}
51 51
 	}
52
-	if ( isset( $shortcode_args['description'] ) ) {
52
+	if (isset($shortcode_args['description'])) {
53 53
 		$content_setting = $shortcode_args['description'];
54 54
 	}
55 55
 }
56 56
 
57 57
 ?>
58 58
 
59
-<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr( $column_class ); ?> has-content-<?php echo esc_attr( $content_setting ); ?>">
59
+<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr($column_class); ?> has-content-<?php echo esc_attr($content_setting); ?>">
60 60
 	<article class="lsx-slot box-shadow">
61 61
 		<?php lsx_entry_top(); ?>
62 62
 
63 63
 		<div class="exercise-feature-img">
64
-			<a href="<?php echo esc_url( get_permalink() ); ?>">
64
+			<a href="<?php echo esc_url(get_permalink()); ?>">
65 65
 			<?php
66 66
 			$featured_image = get_the_post_thumbnail();
67
-			if ( ! empty( $featured_image ) && '' !== $featured_image ) {
68
-				the_post_thumbnail( 'lsx-thumbnail-square', array(
67
+			if ( ! empty($featured_image) && '' !== $featured_image) {
68
+				the_post_thumbnail('lsx-thumbnail-square', array(
69 69
 					'class' => 'aligncenter',
70
-				) );
70
+				));
71 71
 			} else {
72 72
 				?>
73
-				<img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>">
73
+				<img loading="lazy" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>">
74 74
 				<?php
75 75
 			}
76 76
 			?>
@@ -78,24 +78,24 @@  discard block
 block discarded – undo
78 78
 		</div>
79 79
 		<div class="content-box exercise-content-box white-bg">
80 80
 			<div class="title-lined">
81
-				<?php lsx_health_plan_exercise_title( '<h3 class="exercise-title">', '</h3>' ); ?>
81
+				<?php lsx_health_plan_exercise_title('<h3 class="exercise-title">', '</h3>'); ?>
82 82
 				<?php lsx_health_plan_exercise_data(); ?>
83 83
 			</div>
84 84
 			<?php
85
-			if ( '' !== $content_setting && 'excerpt' === $content_setting ) {
86
-				if ( ! has_excerpt() ) {
87
-					$content = wp_trim_words( get_the_content(), 20 );
85
+			if ('' !== $content_setting && 'excerpt' === $content_setting) {
86
+				if ( ! has_excerpt()) {
87
+					$content = wp_trim_words(get_the_content(), 20);
88 88
 					$content = '<p>' . $content . '</p>';
89 89
 				} else {
90
-					$content = apply_filters( 'the_excerpt', get_the_excerpt() );
90
+					$content = apply_filters('the_excerpt', get_the_excerpt());
91 91
 				}
92
-				echo wp_kses_post( $content );
92
+				echo wp_kses_post($content);
93 93
 			}
94
-			if ( '' !== $content_setting && 'full' === $content_setting ) {
94
+			if ('' !== $content_setting && 'full' === $content_setting) {
95 95
 				the_content();
96 96
 			}
97 97
 			?>
98
-			<a href="<?php echo esc_url( get_permalink() ); ?>" class="btn border-btn"><?php esc_html_e( 'See exercise', 'lsx-health-plan' ); ?></a>
98
+			<a href="<?php echo esc_url(get_permalink()); ?>" class="btn border-btn"><?php esc_html_e('See exercise', 'lsx-health-plan'); ?></a>
99 99
 		</div>
100 100
 		<?php lsx_entry_bottom(); ?>
101 101
 	</article>
Please login to merge, or discard this patch.