Passed
Push — add/multiplan ( e46fc7...0a2963 )
by Warwick
04:26 queued 12s
created
classes/integrations/woocommerce/class-checkout.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
 	 * Contructor
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
 		// Checkout.
32
-		add_action( 'woocommerce_after_checkout_form', array( $this, 'payment_gateway_logos' ) );
33
-		add_action( 'body_class', array( $this, 'hp_wc_add_body_classes' ) );
34
-		add_action( 'lsx_nav_before', array( $this, 'hp_link_lsx_navbar_header' ), 99 );
35
-		add_action( 'wp_head', array( $this, 'hp_simple_checkout' ), 99 );
32
+		add_action('woocommerce_after_checkout_form', array($this, 'payment_gateway_logos'));
33
+		add_action('body_class', array($this, 'hp_wc_add_body_classes'));
34
+		add_action('lsx_nav_before', array($this, 'hp_link_lsx_navbar_header'), 99);
35
+		add_action('wp_head', array($this, 'hp_simple_checkout'), 99);
36 36
 
37 37
 		// Cart Messages.
38
-		add_action( 'lsx_content_wrap_before', array( $this, 'cart_notices' ) );
39
-		add_filter( 'wc_add_to_cart_message_html', array( $this, 'add_to_cart_message' ), 10, 3 );
38
+		add_action('lsx_content_wrap_before', array($this, 'cart_notices'));
39
+		add_filter('wc_add_to_cart_message_html', array($this, 'add_to_cart_message'), 10, 3);
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;
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	 * @param string $label
61 61
 	 * @return void
62 62
 	 */
63
-	public function checkout_button_text( $label = '' ) {
64
-		$label = __( 'Place order', 'lsx-health-plan' );
63
+	public function checkout_button_text($label = '') {
64
+		$label = __('Place order', 'lsx-health-plan');
65 65
 		return $label;
66 66
 	}
67 67
 
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	 * @return void
72 72
 	 */
73 73
 	public function hp_link_lsx_navbar_header() {
74
-		if ( is_checkout() ) {
75
-			$home_ulr = '<nav class="checkout-navbar"><ul class="nav navbar-nav"><li><a href="' . home_url() . '">' . __( 'Home', 'lsx-health-plan' ) . '</a></li></ul></nav>';
76
-			echo wp_kses_post( $home_ulr );
74
+		if (is_checkout()) {
75
+			$home_ulr = '<nav class="checkout-navbar"><ul class="nav navbar-nav"><li><a href="' . home_url() . '">' . __('Home', 'lsx-health-plan') . '</a></li></ul></nav>';
76
+			echo wp_kses_post($home_ulr);
77 77
 		}
78 78
 	}
79 79
 
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 	 * @param array $classes
84 84
 	 * @return void
85 85
 	 */
86
-	public function hp_wc_add_body_classes( $classes = array() ) {
86
+	public function hp_wc_add_body_classes($classes = array()) {
87 87
 		global $post;
88
-		if ( is_checkout() ) {
88
+		if (is_checkout()) {
89 89
 			$classes[] = 'lsx-hp-simple-checkout';
90 90
 		}
91 91
 		return $classes;
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 * @return void
99 99
 	 */
100 100
 	public function hp_simple_checkout() {
101
-		if ( is_checkout() ) {
102
-			remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' );
101
+		if (is_checkout()) {
102
+			remove_action('lsx_footer_before', 'lsx_add_footer_sidebar_area');
103 103
 		}
104 104
 	}
105 105
 
@@ -114,16 +114,16 @@  discard block
 block discarded – undo
114 114
 		?>
115 115
 		<div class="row text-center vertical-align lsx-full-width-base-small checkout-cta-bottom">
116 116
 			<div class="col-md-12 img-payfast">
117
-				<img loading="lazy" src="<?php echo esc_url( $payfast_image ); ?>" alt="payfast"/>
117
+				<img loading="lazy" src="<?php echo esc_url($payfast_image); ?>" alt="payfast"/>
118 118
 			</div>
119 119
 			<div class="col-md-12 img-payments hidden-xs">
120
-				<img loading="lazy" src="<?php echo esc_url( $payment_logos ); ?>" alt="payments"/>
120
+				<img loading="lazy" src="<?php echo esc_url($payment_logos); ?>" alt="payments"/>
121 121
 			</div>
122 122
 			<div class="col-md-12 img-payments hidden-sm hidden-md hidden-lg">
123
-				<img loading="lazy" src="<?php echo esc_url( $payment_logos_mobile ); ?>" alt="payments"/>
123
+				<img loading="lazy" src="<?php echo esc_url($payment_logos_mobile); ?>" alt="payments"/>
124 124
 			</div>
125 125
 			<div class="col-md-12 img-encrypt">
126
-				<img loading="lazy" src="<?php echo esc_url( $encript_image ); ?>" alt="lets_encrypt"/>
126
+				<img loading="lazy" src="<?php echo esc_url($encript_image); ?>" alt="lets_encrypt"/>
127 127
 			</div>
128 128
 		</div>
129 129
 
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 	 * @param string $variation_id
139 139
 	 * @return void
140 140
 	 */
141
-	public function add_plan_id_to_cart( $cart_item_data, $product_id, $variation_id ) {
142
-		$plan_id = filter_input( INPUT_GET, 'plan_id' );
143
-		if ( empty( $plan_id ) || '' === $plan_id ) {
141
+	public function add_plan_id_to_cart($cart_item_data, $product_id, $variation_id) {
142
+		$plan_id = filter_input(INPUT_GET, 'plan_id');
143
+		if (empty($plan_id) || '' === $plan_id) {
144 144
 			return $cart_item_data;
145 145
 		}
146 146
 		$cart_item_data['plan_id'] = $plan_id;
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 	 * @return void
154 154
 	 */
155 155
 	public function cart_notices() {
156
-		if ( function_exists( 'woocommerce_output_all_notices' ) && is_post_type_archive( 'plan' ) ) {
157
-			echo wp_kses_post( '<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">' );
156
+		if (function_exists('woocommerce_output_all_notices') && is_post_type_archive('plan')) {
157
+			echo wp_kses_post('<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">');
158 158
 			wc_print_notices();
159
-			echo wp_kses_post( '</div>' );
159
+			echo wp_kses_post('</div>');
160 160
 		}
161 161
 	}
162 162
 
@@ -168,19 +168,19 @@  discard block
 block discarded – undo
168 168
 	 * @param  boolean $show_qty
169 169
 	 * @return string
170 170
 	 */
171
-	public function add_to_cart_message( $message, $products, $show_qty ) {
172
-		if ( isset( $_GET['plan_id'] ) ) { // @codingStandardsIgnoreLine.
173
-			$this->plan_id = sanitize_text_field( wp_slash( $_GET['plan_id'] ) ); // @codingStandardsIgnoreLine.
171
+	public function add_to_cart_message($message, $products, $show_qty) {
172
+		if (isset($_GET['plan_id'])) { // @codingStandardsIgnoreLine.
173
+			$this->plan_id = sanitize_text_field(wp_slash($_GET['plan_id'])); // @codingStandardsIgnoreLine.
174 174
 
175
-			$title = '<strong>' . get_the_title( $this->plan_id ) . '</strong>';
176
-			$title = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan' ), $title );
175
+			$title = '<strong>' . get_the_title($this->plan_id) . '</strong>';
176
+			$title = sprintf(_n('%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan'), $title);
177 177
 
178 178
 			// Output success messages.
179
-			if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
180
-				$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' ) );
181
-				$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 );
179
+			if ('yes' === get_option('woocommerce_cart_redirect_after_add')) {
180
+				$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'));
181
+				$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);
182 182
 			} else {
183
-				$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 );
183
+				$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);
184 184
 			}
185 185
 		}
186 186
 		return $message;
Please login to merge, or discard this patch.
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -8,110 +8,110 @@  discard block
 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;
19
-
20
-	/**
21
-	 * @var string
22
-	 */
23
-	public $plan_id = '';
24
-
25
-	/**
26
-	 * Contructor
27
-	 */
28
-	public function __construct() {
29
-		add_filter( 'woocommerce_order_button_text', array( $this, 'checkout_button_text' ), 10, 1 );
30
-
31
-		// Checkout.
32
-		add_action( 'woocommerce_after_checkout_form', array( $this, 'payment_gateway_logos' ) );
33
-		add_action( 'body_class', array( $this, 'hp_wc_add_body_classes' ) );
34
-		add_action( 'lsx_nav_before', array( $this, 'hp_link_lsx_navbar_header' ), 99 );
35
-		add_action( 'wp_head', array( $this, 'hp_simple_checkout' ), 99 );
36
-
37
-		// Cart Messages.
38
-		add_action( 'lsx_content_wrap_before', array( $this, 'cart_notices' ) );
39
-		add_filter( 'wc_add_to_cart_message_html', array( $this, 'add_to_cart_message' ), 10, 3 );
40
-	}
41
-
42
-	/**
43
-	 * Return an instance of this class.
44
-	 *
45
-	 * @since 1.0.0
46
-	 *
47
-	 * @return    object \lsx_health_plan\classes\integrations\woocommerce\Checkout()    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
-	 * Return the Place Order Text
59
-	 *
60
-	 * @param string $label
61
-	 * @return void
62
-	 */
63
-	public function checkout_button_text( $label = '' ) {
64
-		$label = __( 'Place order', 'lsx-health-plan' );
65
-		return $label;
66
-	}
67
-
68
-	/**
69
-	 * Adding the 'Home' link to the checkout.
70
-	 *
71
-	 * @return void
72
-	 */
73
-	public function hp_link_lsx_navbar_header() {
74
-		if ( is_checkout() ) {
75
-			$home_ulr = '<nav class="checkout-navbar"><ul class="nav navbar-nav"><li><a href="' . home_url() . '">' . __( 'Home', 'lsx-health-plan' ) . '</a></li></ul></nav>';
76
-			echo wp_kses_post( $home_ulr );
77
-		}
78
-	}
79
-
80
-	/**
81
-	 * Add 'lsx-simple-checkout' class to body if it is woocommerce checkout page.
82
-	 *
83
-	 * @param array $classes
84
-	 * @return void
85
-	 */
86
-	public function hp_wc_add_body_classes( $classes = array() ) {
87
-		global $post;
88
-		if ( is_checkout() ) {
89
-			$classes[] = 'lsx-hp-simple-checkout';
90
-		}
91
-		return $classes;
92
-	}
93
-
94
-	/**
95
-	 * Remove unnecessary items for simple woocommerce checkout page.
96
-	 *
97
-	 * @param array $classes
98
-	 * @return void
99
-	 */
100
-	public function hp_simple_checkout() {
101
-		if ( is_checkout() ) {
102
-			remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' );
103
-		}
104
-	}
105
-
106
-	/**
107
-	 * Add Lets Enrypt and PayFast logos to cart.
108
-	**/
109
-	public function payment_gateway_logos() {
110
-		$encript_image = LSX_HEALTH_PLAN_URL . 'assets/images/lets-encript.svg';
111
-		$payfast_image = LSX_HEALTH_PLAN_URL . 'assets/images/payfast-footer-logo.svg';
112
-		$payment_logos = LSX_HEALTH_PLAN_URL . 'assets/images/payment-logos.svg';
113
-		$payment_logos_mobile = LSX_HEALTH_PLAN_URL . 'assets/images/payment-logos-mobile.svg';
114
-		?>
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
+
20
+     /**
21
+      * @var string
22
+      */
23
+     public $plan_id = '';
24
+
25
+     /**
26
+      * Contructor
27
+      */
28
+     public function __construct() {
29
+          add_filter( 'woocommerce_order_button_text', array( $this, 'checkout_button_text' ), 10, 1 );
30
+
31
+          // Checkout.
32
+          add_action( 'woocommerce_after_checkout_form', array( $this, 'payment_gateway_logos' ) );
33
+          add_action( 'body_class', array( $this, 'hp_wc_add_body_classes' ) );
34
+          add_action( 'lsx_nav_before', array( $this, 'hp_link_lsx_navbar_header' ), 99 );
35
+          add_action( 'wp_head', array( $this, 'hp_simple_checkout' ), 99 );
36
+
37
+          // Cart Messages.
38
+          add_action( 'lsx_content_wrap_before', array( $this, 'cart_notices' ) );
39
+          add_filter( 'wc_add_to_cart_message_html', array( $this, 'add_to_cart_message' ), 10, 3 );
40
+     }
41
+
42
+     /**
43
+      * Return an instance of this class.
44
+      *
45
+      * @since 1.0.0
46
+      *
47
+      * @return    object \lsx_health_plan\classes\integrations\woocommerce\Checkout()    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
+      * Return the Place Order Text
59
+      *
60
+      * @param string $label
61
+      * @return void
62
+      */
63
+     public function checkout_button_text( $label = '' ) {
64
+          $label = __( 'Place order', 'lsx-health-plan' );
65
+          return $label;
66
+     }
67
+
68
+     /**
69
+      * Adding the 'Home' link to the checkout.
70
+      *
71
+      * @return void
72
+      */
73
+     public function hp_link_lsx_navbar_header() {
74
+          if ( is_checkout() ) {
75
+               $home_ulr = '<nav class="checkout-navbar"><ul class="nav navbar-nav"><li><a href="' . home_url() . '">' . __( 'Home', 'lsx-health-plan' ) . '</a></li></ul></nav>';
76
+               echo wp_kses_post( $home_ulr );
77
+          }
78
+     }
79
+
80
+     /**
81
+      * Add 'lsx-simple-checkout' class to body if it is woocommerce checkout page.
82
+      *
83
+      * @param array $classes
84
+      * @return void
85
+      */
86
+     public function hp_wc_add_body_classes( $classes = array() ) {
87
+          global $post;
88
+          if ( is_checkout() ) {
89
+               $classes[] = 'lsx-hp-simple-checkout';
90
+          }
91
+          return $classes;
92
+     }
93
+
94
+     /**
95
+      * Remove unnecessary items for simple woocommerce checkout page.
96
+      *
97
+      * @param array $classes
98
+      * @return void
99
+      */
100
+     public function hp_simple_checkout() {
101
+          if ( is_checkout() ) {
102
+               remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' );
103
+          }
104
+     }
105
+
106
+     /**
107
+      * Add Lets Enrypt and PayFast logos to cart.
108
+      **/
109
+     public function payment_gateway_logos() {
110
+          $encript_image = LSX_HEALTH_PLAN_URL . 'assets/images/lets-encript.svg';
111
+          $payfast_image = LSX_HEALTH_PLAN_URL . 'assets/images/payfast-footer-logo.svg';
112
+          $payment_logos = LSX_HEALTH_PLAN_URL . 'assets/images/payment-logos.svg';
113
+          $payment_logos_mobile = LSX_HEALTH_PLAN_URL . 'assets/images/payment-logos-mobile.svg';
114
+          ?>
115 115
 		<div class="row text-center vertical-align lsx-full-width-base-small checkout-cta-bottom">
116 116
 			<div class="col-md-12 img-payfast">
117 117
 				<img loading="lazy" src="<?php echo esc_url( $payfast_image ); ?>" alt="payfast"/>
@@ -128,61 +128,61 @@  discard block
 block discarded – undo
128 128
 		</div>
129 129
 
130 130
 		<?php
131
-	}
132
-
133
-	/**
134
-	 * Saves the Plan ID to the cart data, so we can attach it to the order later.
135
-	 *
136
-	 * @param array $cart_item_data
137
-	 * @param string $product_id
138
-	 * @param string $variation_id
139
-	 * @return void
140
-	 */
141
-	public function add_plan_id_to_cart( $cart_item_data, $product_id, $variation_id ) {
142
-		$plan_id = filter_input( INPUT_GET, 'plan_id' );
143
-		if ( empty( $plan_id ) || '' === $plan_id ) {
144
-			return $cart_item_data;
145
-		}
146
-		$cart_item_data['plan_id'] = $plan_id;
147
-		return $cart_item_data;
148
-	}
149
-
150
-	/**
151
-	 * Output the WooCommerce Cart Notices.
152
-	 *
153
-	 * @return void
154
-	 */
155
-	public function cart_notices() {
156
-		if ( function_exists( 'woocommerce_output_all_notices' ) && is_post_type_archive( 'plan' ) ) {
157
-			echo wp_kses_post( '<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">' );
158
-			wc_print_notices();
159
-			echo wp_kses_post( '</div>' );
160
-		}
161
-	}
162
-
163
-	/**
164
-	 * Changes the add to cart message and adds our course name.
165
-	 *
166
-	 * @param  string  $message
167
-	 * @param  array   $products
168
-	 * @param  boolean $show_qty
169
-	 * @return string
170
-	 */
171
-	public function add_to_cart_message( $message, $products, $show_qty ) {
172
-		if ( isset( $_GET['plan_id'] ) ) { // @codingStandardsIgnoreLine.
173
-			$this->plan_id = sanitize_text_field( wp_slash( $_GET['plan_id'] ) ); // @codingStandardsIgnoreLine.
174
-
175
-			$title = '<strong>' . get_the_title( $this->plan_id ) . '</strong>';
176
-			$title = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan' ), $title );
177
-
178
-			// Output success messages.
179
-			if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
180
-				$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' ) );
181
-				$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 );
182
-			} else {
183
-				$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 );
184
-			}
185
-		}
186
-		return $message;
187
-	}
131
+     }
132
+
133
+     /**
134
+      * Saves the Plan ID to the cart data, so we can attach it to the order later.
135
+      *
136
+      * @param array $cart_item_data
137
+      * @param string $product_id
138
+      * @param string $variation_id
139
+      * @return void
140
+      */
141
+     public function add_plan_id_to_cart( $cart_item_data, $product_id, $variation_id ) {
142
+          $plan_id = filter_input( INPUT_GET, 'plan_id' );
143
+          if ( empty( $plan_id ) || '' === $plan_id ) {
144
+               return $cart_item_data;
145
+          }
146
+          $cart_item_data['plan_id'] = $plan_id;
147
+          return $cart_item_data;
148
+     }
149
+
150
+     /**
151
+      * Output the WooCommerce Cart Notices.
152
+      *
153
+      * @return void
154
+      */
155
+     public function cart_notices() {
156
+          if ( function_exists( 'woocommerce_output_all_notices' ) && is_post_type_archive( 'plan' ) ) {
157
+               echo wp_kses_post( '<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">' );
158
+               wc_print_notices();
159
+               echo wp_kses_post( '</div>' );
160
+          }
161
+     }
162
+
163
+     /**
164
+      * Changes the add to cart message and adds our course name.
165
+      *
166
+      * @param  string  $message
167
+      * @param  array   $products
168
+      * @param  boolean $show_qty
169
+      * @return string
170
+      */
171
+     public function add_to_cart_message( $message, $products, $show_qty ) {
172
+          if ( isset( $_GET['plan_id'] ) ) { // @codingStandardsIgnoreLine.
173
+               $this->plan_id = sanitize_text_field( wp_slash( $_GET['plan_id'] ) ); // @codingStandardsIgnoreLine.
174
+
175
+               $title = '<strong>' . get_the_title( $this->plan_id ) . '</strong>';
176
+               $title = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan' ), $title );
177
+
178
+               // Output success messages.
179
+               if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
180
+                    $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' ) );
181
+                    $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 );
182
+               } else {
183
+                    $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 );
184
+               }
185
+          }
186
+          return $message;
187
+     }
188 188
 }
Please login to merge, or discard this patch.
classes/integrations/class-blog.php 2 patches
Spacing   +15 added lines, -15 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
-					'limit'      => 3,  // Limit selection to X items only (default 1).
76
+					'limit'      => 3, // Limit selection to X items only (default 1).
77 77
 					'sortable'   => true, // Allow selected items to be sortable (default false).
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' => -1,
82 82
 					),
83 83
 				)
Please login to merge, or discard this patch.
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,  // Limit selection to X items only (default 1).
77
-					'sortable'   => true, // Allow selected items to be sortable (default false).
78
-					'query_args' => array(
79
-						'post_type'      => array( 'post' ),
80
-						'post_status'    => array( 'publish' ),
81
-						'posts_per_page' => -1,
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,  // Limit selection to X items only (default 1).
77
+                         'sortable'   => true, // Allow selected items to be sortable (default false).
78
+                         'query_args' => array(
79
+                              'post_type'      => array( 'post' ),
80
+                              'post_status'    => array( 'publish' ),
81
+                              'posts_per_page' => -1,
82
+                         ),
83
+                    )
84
+               );
85
+          }
86 86
 
87
-	}
87
+     }
88 88
 
89 89
 }
Please login to merge, or discard this patch.
classes/class-setup.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * Contructor
27 27
 	 */
28 28
 	public function __construct() {
29
-		add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
30
-		add_action( 'wp_head', array( $this, 'load_shortcodes' ) );
29
+		add_action('init', array($this, 'load_plugin_textdomain'));
30
+		add_action('wp_head', array($this, 'load_shortcodes'));
31 31
 		$this->load_classes();
32 32
 	}
33 33
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	public static function get_instance() {
42 42
 
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
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * Adds text domain.
54 54
 	 */
55 55
 	public function load_plugin_textdomain() {
56
-		load_plugin_textdomain( 'lsx-health-plan', false, basename( LSX_HEALTH_PLAN_PATH ) . '/languages' );
56
+		load_plugin_textdomain('lsx-health-plan', false, basename(LSX_HEALTH_PLAN_PATH) . '/languages');
57 57
 	}
58 58
 
59 59
 	/**
@@ -72,22 +72,22 @@  discard block
 block discarded – undo
72 72
 	 * @return void
73 73
 	 */
74 74
 	public function load_shortcodes() {
75
-		add_shortcode( 'lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content' );
76
-		add_shortcode( 'lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs' );
77
-		add_shortcode( 'lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box' );
78
-		add_shortcode( 'lsx_health_plan_all_plans_block', '\lsx_health_plan\shortcodes\all_plans_box' );
79
-		add_shortcode( 'lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box' );
80
-		add_shortcode( 'lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices' );
75
+		add_shortcode('lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content');
76
+		add_shortcode('lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs');
77
+		add_shortcode('lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box');
78
+		add_shortcode('lsx_health_plan_all_plans_block', '\lsx_health_plan\shortcodes\all_plans_box');
79
+		add_shortcode('lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box');
80
+		add_shortcode('lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices');
81 81
 
82
-		if ( post_type_exists( 'video' ) ) {
83
-			add_shortcode( 'lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box' );
82
+		if (post_type_exists('video')) {
83
+			add_shortcode('lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box');
84 84
 		}
85
-		if ( post_type_exists( 'recipe' ) ) {
86
-			add_shortcode( 'lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box' );
85
+		if (post_type_exists('recipe')) {
86
+			add_shortcode('lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box');
87 87
 		}
88
-		if ( post_type_exists( 'tip' ) ) {
89
-			add_shortcode( 'lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box' );
88
+		if (post_type_exists('tip')) {
89
+			add_shortcode('lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box');
90 90
 		}
91
-		add_shortcode( 'lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box' );
91
+		add_shortcode('lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box');
92 92
 	}
93 93
 }
Please login to merge, or discard this patch.
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -8,86 +8,86 @@
 block discarded – undo
8 8
  */
9 9
 class Setup {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\Setup()
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\Setup()
17
+      */
18
+     protected static $instance = null;
19 19
 
20
-	/**
21
-	 * @var object \lsx_health_plan\classes\Post_Type();
22
-	 */
23
-	public $post_types;
20
+     /**
21
+      * @var object \lsx_health_plan\classes\Post_Type();
22
+      */
23
+     public $post_types;
24 24
 
25
-	/**
26
-	 * Contructor
27
-	 */
28
-	public function __construct() {
29
-		add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
30
-		add_action( 'wp_head', array( $this, 'load_shortcodes' ) );
31
-		$this->load_classes();
32
-	}
25
+     /**
26
+      * Contructor
27
+      */
28
+     public function __construct() {
29
+          add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
30
+          add_action( 'wp_head', array( $this, 'load_shortcodes' ) );
31
+          $this->load_classes();
32
+     }
33 33
 
34
-	/**
35
-	 * Return an instance of this class.
36
-	 *
37
-	 * @since 1.0.0
38
-	 *
39
-	 * @return    object \lsx_health_plan\classes\Setup()    A single instance of this class.
40
-	 */
41
-	public static function get_instance() {
34
+     /**
35
+      * Return an instance of this class.
36
+      *
37
+      * @since 1.0.0
38
+      *
39
+      * @return    object \lsx_health_plan\classes\Setup()    A single instance of this class.
40
+      */
41
+     public static function get_instance() {
42 42
 
43
-		// If the single instance hasn't been set, set it now.
44
-		if ( null === self::$instance ) {
45
-			self::$instance = new self();
46
-		}
43
+          // If the single instance hasn't been set, set it now.
44
+          if ( null === self::$instance ) {
45
+               self::$instance = new self();
46
+          }
47 47
 
48
-		return self::$instance;
48
+          return self::$instance;
49 49
 
50
-	}
50
+     }
51 51
 
52
-	/**
53
-	 * Adds text domain.
54
-	 */
55
-	public function load_plugin_textdomain() {
56
-		load_plugin_textdomain( 'lsx-health-plan', false, basename( LSX_HEALTH_PLAN_PATH ) . '/languages' );
57
-	}
52
+     /**
53
+      * Adds text domain.
54
+      */
55
+     public function load_plugin_textdomain() {
56
+          load_plugin_textdomain( 'lsx-health-plan', false, basename( LSX_HEALTH_PLAN_PATH ) . '/languages' );
57
+     }
58 58
 
59
-	/**
60
-	 * Registers our shortcodes.
61
-	 *
62
-	 * @return void
63
-	 */
64
-	public function load_classes() {
65
-		require_once LSX_HEALTH_PLAN_PATH . 'classes/class-post-type.php';
66
-		$this->post_types = Post_Type::get_instance();
67
-	}
59
+     /**
60
+      * Registers our shortcodes.
61
+      *
62
+      * @return void
63
+      */
64
+     public function load_classes() {
65
+          require_once LSX_HEALTH_PLAN_PATH . 'classes/class-post-type.php';
66
+          $this->post_types = Post_Type::get_instance();
67
+     }
68 68
 
69
-	/**
70
-	 * Registers our shortcodes.
71
-	 *
72
-	 * @return void
73
-	 */
74
-	public function load_shortcodes() {
75
-		add_shortcode( 'lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content' );
76
-		add_shortcode( 'lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs' );
77
-		add_shortcode( 'lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box' );
78
-		add_shortcode( 'lsx_health_plan_all_plans_block', '\lsx_health_plan\shortcodes\all_plans_box' );
79
-		add_shortcode( 'lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box' );
80
-		add_shortcode( 'lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices' );
69
+     /**
70
+      * Registers our shortcodes.
71
+      *
72
+      * @return void
73
+      */
74
+     public function load_shortcodes() {
75
+          add_shortcode( 'lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content' );
76
+          add_shortcode( 'lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs' );
77
+          add_shortcode( 'lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box' );
78
+          add_shortcode( 'lsx_health_plan_all_plans_block', '\lsx_health_plan\shortcodes\all_plans_box' );
79
+          add_shortcode( 'lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box' );
80
+          add_shortcode( 'lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices' );
81 81
 
82
-		if ( post_type_exists( 'video' ) ) {
83
-			add_shortcode( 'lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box' );
84
-		}
85
-		if ( post_type_exists( 'recipe' ) ) {
86
-			add_shortcode( 'lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box' );
87
-		}
88
-		if ( post_type_exists( 'tip' ) ) {
89
-			add_shortcode( 'lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box' );
90
-		}
91
-		add_shortcode( 'lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box' );
92
-	}
82
+          if ( post_type_exists( 'video' ) ) {
83
+               add_shortcode( 'lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box' );
84
+          }
85
+          if ( post_type_exists( 'recipe' ) ) {
86
+               add_shortcode( 'lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box' );
87
+          }
88
+          if ( post_type_exists( 'tip' ) ) {
89
+               add_shortcode( 'lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box' );
90
+          }
91
+          add_shortcode( 'lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box' );
92
+     }
93 93
 }
Please login to merge, or discard this patch.
templates/tab-content-meal.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 // Getting translated endpoint.
9
-$meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' );
9
+$meal = \lsx_health_plan\functions\get_option('endpoint_meal', 'meal');
10 10
 
11
-$connected_members  = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true );
12
-$connected_articles = get_post_meta( get_the_ID(), ( $meal . '_connected_articles' ), true );
11
+$connected_members  = get_post_meta(get_the_ID(), ($meal . '_connected_team_member'), true);
12
+$connected_articles = get_post_meta(get_the_ID(), ($meal . '_connected_articles'), true);
13 13
 
14 14
 ?>
15 15
 
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
24 24
 	<div class="entry-content">
25 25
 		<div class="single-plan-inner meal-content">
26 26
 			<?php
27
-			if ( is_singular( 'meal' ) ) { ?>
27
+			if (is_singular('meal')) { ?>
28 28
 				<div class="single-plan-section-title meal-plan title-lined">
29
-					<?php lsx_get_svg_icon( 'meal.svg' ); ?>
29
+					<?php lsx_get_svg_icon('meal.svg'); ?>
30 30
 					<h2><?php the_title(); ?></h2>
31 31
 
32 32
 				</div>
33 33
 			<?php } else { ?>
34 34
 				<div class="single-plan-section-title meal-plan title-lined">
35
-					<?php lsx_get_svg_icon( 'meal.svg' ); ?>
36
-					<h2><?php esc_html_e( 'My Meal Plan', 'lsx-health-plan' ); ?> <?php the_title(); ?></h2>
35
+					<?php lsx_get_svg_icon('meal.svg'); ?>
36
+					<h2><?php esc_html_e('My Meal Plan', 'lsx-health-plan'); ?> <?php the_title(); ?></h2>
37 37
 				</div>
38 38
 			<?php } ?>
39 39
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 </article><!-- #post-## -->
47 47
 
48 48
 <?php
49
-if ( ! empty( $connected_articles ) ) {
50
-	lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) );
49
+if ( ! empty($connected_articles)) {
50
+	lsx_hp_single_related($connected_articles, __('Related articles', 'lsx-health-plan'));
51 51
 }
52 52
 ?>
53 53
 
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	<div class="entry-content">
25 25
 		<div class="single-plan-inner meal-content">
26 26
 			<?php
27
-			if ( is_singular( 'meal' ) ) { ?>
27
+               if ( is_singular( 'meal' ) ) { ?>
28 28
 				<div class="single-plan-section-title meal-plan title-lined">
29 29
 					<?php lsx_get_svg_icon( 'meal.svg' ); ?>
30 30
 					<h2><?php the_title(); ?></h2>
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 <?php
49 49
 if ( ! empty( $connected_articles ) ) {
50
-	lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) );
50
+     lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) );
51 51
 }
52 52
 ?>
53 53
 
Please login to merge, or discard this patch.
lsx-health-plan.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // If this file is called directly, abort.
15
-if ( ! defined( 'WPINC' ) ) {
15
+if ( ! defined('WPINC')) {
16 16
 	die;
17 17
 }
18
-define( 'LSX_HEALTH_PLAN_PATH', plugin_dir_path( __FILE__ ) );
19
-define( 'LSX_HEALTH_PLAN_CORE', __FILE__ );
20
-define( 'LSX_HEALTH_PLAN_URL', plugin_dir_url( __FILE__ ) );
21
-define( 'LSX_HEALTH_PLAN_VER', '1.4.0' );
18
+define('LSX_HEALTH_PLAN_PATH', plugin_dir_path(__FILE__));
19
+define('LSX_HEALTH_PLAN_CORE', __FILE__);
20
+define('LSX_HEALTH_PLAN_URL', plugin_dir_url(__FILE__));
21
+define('LSX_HEALTH_PLAN_VER', '1.4.0');
22 22
 
23 23
 /* ======================= Below is the Plugin Class init ========================= */
24 24
 
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function lsx_remove_extra_meta_box() {
33 33
 	global $wp_meta_boxes;
34
-	$all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ];
34
+	$all_post_types = ['plan', 'video', 'workout', 'tip', 'recipe', 'meal'];
35 35
 	//remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' );
36
-	remove_meta_box( 'commentsdiv', $all_post_types, 'normal' );
37
-	remove_meta_box( 'commentstatusdiv', $all_post_types, 'normal' );
38
-	remove_meta_box( 'lsx_blocks_title_meta', $all_post_types, 'side' );
36
+	remove_meta_box('commentsdiv', $all_post_types, 'normal');
37
+	remove_meta_box('commentstatusdiv', $all_post_types, 'normal');
38
+	remove_meta_box('lsx_blocks_title_meta', $all_post_types, 'side');
39 39
 }
40
-add_action( 'add_meta_boxes', 'lsx_remove_extra_meta_box', 100 );
40
+add_action('add_meta_boxes', 'lsx_remove_extra_meta_box', 100);
41 41
 
42 42
 /**
43 43
  * Redirect user after login or redirect
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
  * @return void
46 46
  */
47 47
 function lsx_login_redirect() {
48
-	$plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false );
49
-	if ( false === $plan_slug ) {
48
+	$plan_slug = \lsx_health_plan\functions\get_option('my_plan_slug', false);
49
+	if (false === $plan_slug) {
50 50
 		$plan_slug = 'my-plan';
51 51
 	}
52
-	return home_url( $plan_slug );
52
+	return home_url($plan_slug);
53 53
 }
54
-add_filter( 'woocommerce_login_redirect', 'lsx_login_redirect' );
54
+add_filter('woocommerce_login_redirect', 'lsx_login_redirect');
55 55
 
56 56
 /**
57 57
  * Undocumented function
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
  *
69 69
  * @return void
70 70
  */
71
-function lsx_get_svg_icon( $icon ) {
71
+function lsx_get_svg_icon($icon) {
72 72
 	$path = '/assets/images/';
73 73
 
74
-	if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) {
74
+	if (file_exists(LSX_HEALTH_PLAN_PATH . $path . $icon)) {
75 75
 		// Load and return the contents of the file
76 76
 		return include LSX_HEALTH_PLAN_PATH . $path . $icon;
77 77
 	}
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 // If this file is called directly, abort.
15 15
 if ( ! defined( 'WPINC' ) ) {
16
-	die;
16
+     die;
17 17
 }
18 18
 define( 'LSX_HEALTH_PLAN_PATH', plugin_dir_path( __FILE__ ) );
19 19
 define( 'LSX_HEALTH_PLAN_CORE', __FILE__ );
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
  * @return void
31 31
  */
32 32
 function lsx_remove_extra_meta_box() {
33
-	global $wp_meta_boxes;
34
-	$all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ];
35
-	//remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' );
36
-	remove_meta_box( 'commentsdiv', $all_post_types, 'normal' );
37
-	remove_meta_box( 'commentstatusdiv', $all_post_types, 'normal' );
38
-	remove_meta_box( 'lsx_blocks_title_meta', $all_post_types, 'side' );
33
+     global $wp_meta_boxes;
34
+     $all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ];
35
+     //remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' );
36
+     remove_meta_box( 'commentsdiv', $all_post_types, 'normal' );
37
+     remove_meta_box( 'commentstatusdiv', $all_post_types, 'normal' );
38
+     remove_meta_box( 'lsx_blocks_title_meta', $all_post_types, 'side' );
39 39
 }
40 40
 add_action( 'add_meta_boxes', 'lsx_remove_extra_meta_box', 100 );
41 41
 
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
  * @return void
46 46
  */
47 47
 function lsx_login_redirect() {
48
-	$plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false );
49
-	if ( false === $plan_slug ) {
50
-		$plan_slug = 'my-plan';
51
-	}
52
-	return home_url( $plan_slug );
48
+     $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false );
49
+     if ( false === $plan_slug ) {
50
+          $plan_slug = 'my-plan';
51
+     }
52
+     return home_url( $plan_slug );
53 53
 }
54 54
 add_filter( 'woocommerce_login_redirect', 'lsx_login_redirect' );
55 55
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
  * @return object lsx_health_plan\classes\Core::get_instance();
60 60
  */
61 61
 function lsx_health_plan() {
62
-	return \lsx_health_plan\classes\Core::get_instance();
62
+     return \lsx_health_plan\classes\Core::get_instance();
63 63
 }
64 64
 lsx_health_plan();
65 65
 
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
  * @return void
70 70
  */
71 71
 function lsx_get_svg_icon( $icon ) {
72
-	$path = '/assets/images/';
72
+     $path = '/assets/images/';
73 73
 
74
-	if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) {
75
-		// Load and return the contents of the file
76
-		return include LSX_HEALTH_PLAN_PATH . $path . $icon;
77
-	}
74
+     if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) {
75
+          // Load and return the contents of the file
76
+          return include LSX_HEALTH_PLAN_PATH . $path . $icon;
77
+     }
78 78
 
79
-	// Return a blank string if we can't find the file.
80
-	return '';
79
+     // Return a blank string if we can't find the file.
80
+     return '';
81 81
 }
Please login to merge, or discard this patch.
classes/admin/settings/class-plan.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * Contructor
26 26
 	 */
27 27
 	public function __construct() {
28
-		add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 );
28
+		add_action('lsx_hp_settings_page_plan_top', array($this, 'settings'), 1, 1);
29 29
 	}
30 30
 
31 31
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public static function get_instance() {
39 39
 		// If the single instance hasn't been set, set it now.
40
-		if ( null === self::$instance ) {
40
+		if (null === self::$instance) {
41 41
 			self::$instance = new self();
42 42
 		}
43 43
 		return self::$instance;
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
 	 * @param object $cmb new_cmb2_box().
50 50
 	 * @return void
51 51
 	 */
52
-	public function settings( $cmb ) {
52
+	public function settings($cmb) {
53 53
 		$cmb->add_field(
54 54
 			array(
55
-				'name'        => __( 'Plan Filters', 'lsx-health-plan' ),
55
+				'name'        => __('Plan Filters', 'lsx-health-plan'),
56 56
 				'id'          => 'plan_filters_disabled',
57 57
 				'type'        => 'checkbox',
58 58
 				'value'       => 1,
59 59
 				'default'     => 0,
60
-				'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ),
60
+				'description' => __('Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan'),
61 61
 			)
62 62
 		);
63 63
 	}
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -12,54 +12,54 @@
 block discarded – undo
12 12
  */
13 13
 class Plan {
14 14
 
15
-	/**
16
-	 * Holds class instance
17
-	 *
18
-	 * @since 1.0.0
19
-	 *
20
-	 * @var      object \lsx_health_plan\classes\admin\Plan()
21
-	 */
22
-	protected static $instance = null;
15
+     /**
16
+      * Holds class instance
17
+      *
18
+      * @since 1.0.0
19
+      *
20
+      * @var      object \lsx_health_plan\classes\admin\Plan()
21
+      */
22
+     protected static $instance = null;
23 23
 
24
-	/**
25
-	 * Contructor
26
-	 */
27
-	public function __construct() {
28
-		add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 );
29
-	}
24
+     /**
25
+      * Contructor
26
+      */
27
+     public function __construct() {
28
+          add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 );
29
+     }
30 30
 
31
-	/**
32
-	 * Return an instance of this class.
33
-	 *
34
-	 * @since 1.0.0
35
-	 *
36
-	 * @return    object \lsx_health_plan\classes\admin\Plan()    A single instance of this class.
37
-	 */
38
-	public static function get_instance() {
39
-		// If the single instance hasn't been set, set it now.
40
-		if ( null === self::$instance ) {
41
-			self::$instance = new self();
42
-		}
43
-		return self::$instance;
44
-	}
31
+     /**
32
+      * Return an instance of this class.
33
+      *
34
+      * @since 1.0.0
35
+      *
36
+      * @return    object \lsx_health_plan\classes\admin\Plan()    A single instance of this class.
37
+      */
38
+     public static function get_instance() {
39
+          // If the single instance hasn't been set, set it now.
40
+          if ( null === self::$instance ) {
41
+               self::$instance = new self();
42
+          }
43
+          return self::$instance;
44
+     }
45 45
 
46
-	/**
47
-	 * Registers the general settings.
48
-	 *
49
-	 * @param object $cmb new_cmb2_box().
50
-	 * @return void
51
-	 */
52
-	public function settings( $cmb ) {
53
-		$cmb->add_field(
54
-			array(
55
-				'name'        => __( 'Plan Filters', 'lsx-health-plan' ),
56
-				'id'          => 'plan_filters_disabled',
57
-				'type'        => 'checkbox',
58
-				'value'       => 1,
59
-				'default'     => 0,
60
-				'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ),
61
-			)
62
-		);
63
-	}
46
+     /**
47
+      * Registers the general settings.
48
+      *
49
+      * @param object $cmb new_cmb2_box().
50
+      * @return void
51
+      */
52
+     public function settings( $cmb ) {
53
+          $cmb->add_field(
54
+               array(
55
+                    'name'        => __( 'Plan Filters', 'lsx-health-plan' ),
56
+                    'id'          => 'plan_filters_disabled',
57
+                    'type'        => 'checkbox',
58
+                    'value'       => 1,
59
+                    'default'     => 0,
60
+                    'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ),
61
+               )
62
+          );
63
+     }
64 64
 }
65 65
 Plan::get_instance();
Please login to merge, or discard this patch.
classes/frontend/class-general.php 2 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@  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 );
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 32
 	}
33 33
 
34 34
 	/**
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public static function get_instance() {
42 42
 		// If the single instance hasn't been set, set it now.
43
-		if ( null === self::$instance ) {
43
+		if (null === self::$instance) {
44 44
 			self::$instance = new self();
45 45
 		}
46 46
 		return self::$instance;
@@ -53,21 +53,21 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function assets() {
55 55
 
56
-		if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) {
57
-			wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true );
56
+		if (is_post_type_archive('plan') && false === \lsx_health_plan\functions\plan\is_filters_disabled()) {
57
+			wp_enqueue_script('isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array('jquery'), null, LSX_HEALTH_PLAN_URL, true);
58 58
 		}
59 59
 
60
-		wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER );
61
-		wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' );
62
-		wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) );
60
+		wp_enqueue_style('lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER);
61
+		wp_style_add_data('lsx-health-plan', 'rtl', 'replace');
62
+		wp_enqueue_script('lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array('jquery'));
63 63
 
64 64
 	}
65 65
 
66 66
 	/**
67 67
 	 * Adds the iframe and the progress HTML tags to the allowed WordPress list.
68 68
 	 */
69
-	public function allow_html_tags_attributes( $tags, $context ) {
70
-		if ( 'post' === $context ) {
69
+	public function allow_html_tags_attributes($tags, $context) {
70
+		if ('post' === $context) {
71 71
 			$tags['iframe'] = array(
72 72
 				'src'             => true,
73 73
 				'height'          => true,
@@ -90,31 +90,31 @@  discard block
 block discarded – undo
90 90
 	 * @param array $classes
91 91
 	 * @return void
92 92
 	 */
93
-	public function body_classes( $classes = array() ) {
93
+	public function body_classes($classes = array()) {
94 94
 		global $post;
95 95
 
96
-		if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) {
96
+		if (isset($post->post_content) && has_shortcode($post->post_content, 'lsx_health_plan_my_profile_block')) {
97 97
 			$classes[] = 'my-plan-shortcode';
98 98
 		}
99 99
 
100
-		if ( is_single() && is_singular( 'plan' ) ) {
100
+		if (is_single() && is_singular('plan')) {
101 101
 			$args = array(
102 102
 				'post_parent' => get_the_ID(),
103 103
 				'post_type'   => 'plan',
104 104
 			);
105 105
 
106 106
 			$post_id      = get_the_ID();
107
-			$has_children = get_children( $args );
108
-			$has_parent   = wp_get_post_parent_id( $post_id );
107
+			$has_children = get_children($args);
108
+			$has_parent   = wp_get_post_parent_id($post_id);
109 109
 
110
-			if ( ! empty( $has_children ) ) {
110
+			if ( ! empty($has_children)) {
111 111
 				$plan_type_class = 'parent-plan-page';
112
-				if ( 0 !== $has_parent ) {
112
+				if (0 !== $has_parent) {
113 113
 					$plan_type_class = 'parent-sub-plan-page';
114 114
 				}
115 115
 			} else {
116 116
 				$plan_type_class = 'unique-plan-page';
117
-				if ( 0 !== $has_parent ) {
117
+				if (0 !== $has_parent) {
118 118
 					$plan_type_class = 'child-plan-page';
119 119
 				}
120 120
 			}
@@ -126,16 +126,16 @@  discard block
 block discarded – undo
126 126
 	/**
127 127
 	 * Remove the single recipe and exercise title
128 128
 	 */
129
-	public function single_title( $title ) {
129
+	public function single_title($title) {
130 130
 
131
-		if ( is_single() && is_singular( 'recipe' ) ) {
131
+		if (is_single() && is_singular('recipe')) {
132 132
 
133
-			$title = __( 'Recipe', 'lsx-health-plan' );
133
+			$title = __('Recipe', 'lsx-health-plan');
134 134
 		}
135 135
 
136
-		if ( is_single() && is_singular( 'exercise' ) ) {
136
+		if (is_single() && is_singular('exercise')) {
137 137
 
138
-			$title = __( 'Exercise', 'lsx-health-plan' );
138
+			$title = __('Exercise', 'lsx-health-plan');
139 139
 		}
140 140
 
141 141
 		return $title;
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @return void
148 148
 	 */
149 149
 	public function remove_single_footer() {
150
-		if ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) {
151
-			remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' );
150
+		if (is_single() && is_singular(array('exercise', 'recipe', 'workout', 'meal'))) {
151
+			remove_action('lsx_footer_before', 'lsx_add_footer_sidebar_area');
152 152
 		}
153 153
 	}
154 154
 }
Please login to merge, or discard this patch.
Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -8,147 +8,147 @@
 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
-	 * Contructor
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
-	}
33
-
34
-	/**
35
-	 * Return an instance of this class.
36
-	 *
37
-	 * @since 1.0.0
38
-	 *
39
-	 * @return    object \lsx_health_plan\classes\frontend\General()    A single instance of this class.
40
-	 */
41
-	public static function get_instance() {
42
-		// If the single instance hasn't been set, set it now.
43
-		if ( null === self::$instance ) {
44
-			self::$instance = new self();
45
-		}
46
-		return self::$instance;
47
-	}
48
-
49
-	/**
50
-	 * Registers the plugin frontend assets
51
-	 *
52
-	 * @return void
53
-	 */
54
-	public function assets() {
55
-
56
-		if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) {
57
-			wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true );
58
-		}
59
-
60
-		wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER );
61
-		wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' );
62
-		wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) );
63
-
64
-	}
65
-
66
-	/**
67
-	 * Adds the iframe and the progress HTML tags to the allowed WordPress list.
68
-	 */
69
-	public function allow_html_tags_attributes( $tags, $context ) {
70
-		if ( 'post' === $context ) {
71
-			$tags['iframe'] = array(
72
-				'src'             => true,
73
-				'height'          => true,
74
-				'width'           => true,
75
-				'frameborder'     => true,
76
-				'allowfullscreen' => true,
77
-			);
78
-		}
79
-		$tags['progress'] = array(
80
-			'id'    => true,
81
-			'value' => true,
82
-			'max'   => true,
83
-		);
84
-		return $tags;
85
-	}
86
-
87
-	/**
88
-	 * Add body classes to body.
89
-	 *
90
-	 * @param array $classes
91
-	 * @return void
92
-	 */
93
-	public function body_classes( $classes = array() ) {
94
-		global $post;
95
-
96
-		if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) {
97
-			$classes[] = 'my-plan-shortcode';
98
-		}
99
-
100
-		if ( is_single() && is_singular( 'plan' ) ) {
101
-			$args = array(
102
-				'post_parent' => get_the_ID(),
103
-				'post_type'   => 'plan',
104
-			);
105
-
106
-			$post_id      = get_the_ID();
107
-			$has_children = get_children( $args );
108
-			$has_parent   = wp_get_post_parent_id( $post_id );
109
-
110
-			if ( ! empty( $has_children ) ) {
111
-				$plan_type_class = 'parent-plan-page';
112
-				if ( 0 !== $has_parent ) {
113
-					$plan_type_class = 'parent-sub-plan-page';
114
-				}
115
-			} else {
116
-				$plan_type_class = 'unique-plan-page';
117
-				if ( 0 !== $has_parent ) {
118
-					$plan_type_class = 'child-plan-page';
119
-				}
120
-			}
121
-			$classes[] = $plan_type_class;
122
-		}
123
-		return $classes;
124
-	}
125
-
126
-	/**
127
-	 * Remove the single recipe and exercise title
128
-	 */
129
-	public function single_title( $title ) {
130
-
131
-		if ( is_single() && is_singular( 'recipe' ) ) {
132
-
133
-			$title = __( 'Recipe', 'lsx-health-plan' );
134
-		}
135
-
136
-		if ( is_single() && is_singular( 'exercise' ) ) {
137
-
138
-			$title = __( 'Exercise', 'lsx-health-plan' );
139
-		}
140
-
141
-		return $title;
142
-	}
143
-
144
-	/**
145
-	 * Removing footer for HP single pages.
146
-	 *
147
-	 * @return void
148
-	 */
149
-	public function remove_single_footer() {
150
-		if ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) {
151
-			remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' );
152
-		}
153
-	}
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
+      * Contructor
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
+     }
33
+
34
+     /**
35
+      * Return an instance of this class.
36
+      *
37
+      * @since 1.0.0
38
+      *
39
+      * @return    object \lsx_health_plan\classes\frontend\General()    A single instance of this class.
40
+      */
41
+     public static function get_instance() {
42
+          // If the single instance hasn't been set, set it now.
43
+          if ( null === self::$instance ) {
44
+               self::$instance = new self();
45
+          }
46
+          return self::$instance;
47
+     }
48
+
49
+     /**
50
+      * Registers the plugin frontend assets
51
+      *
52
+      * @return void
53
+      */
54
+     public function assets() {
55
+
56
+          if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) {
57
+               wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true );
58
+          }
59
+
60
+          wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER );
61
+          wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' );
62
+          wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) );
63
+
64
+     }
65
+
66
+     /**
67
+      * Adds the iframe and the progress HTML tags to the allowed WordPress list.
68
+      */
69
+     public function allow_html_tags_attributes( $tags, $context ) {
70
+          if ( 'post' === $context ) {
71
+               $tags['iframe'] = array(
72
+                    'src'             => true,
73
+                    'height'          => true,
74
+                    'width'           => true,
75
+                    'frameborder'     => true,
76
+                    'allowfullscreen' => true,
77
+               );
78
+          }
79
+          $tags['progress'] = array(
80
+               'id'    => true,
81
+               'value' => true,
82
+               'max'   => true,
83
+          );
84
+          return $tags;
85
+     }
86
+
87
+     /**
88
+      * Add body classes to body.
89
+      *
90
+      * @param array $classes
91
+      * @return void
92
+      */
93
+     public function body_classes( $classes = array() ) {
94
+          global $post;
95
+
96
+          if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) {
97
+               $classes[] = 'my-plan-shortcode';
98
+          }
99
+
100
+          if ( is_single() && is_singular( 'plan' ) ) {
101
+               $args = array(
102
+                    'post_parent' => get_the_ID(),
103
+                    'post_type'   => 'plan',
104
+               );
105
+
106
+               $post_id      = get_the_ID();
107
+               $has_children = get_children( $args );
108
+               $has_parent   = wp_get_post_parent_id( $post_id );
109
+
110
+               if ( ! empty( $has_children ) ) {
111
+                    $plan_type_class = 'parent-plan-page';
112
+                    if ( 0 !== $has_parent ) {
113
+                         $plan_type_class = 'parent-sub-plan-page';
114
+                    }
115
+               } else {
116
+                    $plan_type_class = 'unique-plan-page';
117
+                    if ( 0 !== $has_parent ) {
118
+                         $plan_type_class = 'child-plan-page';
119
+                    }
120
+               }
121
+               $classes[] = $plan_type_class;
122
+          }
123
+          return $classes;
124
+     }
125
+
126
+     /**
127
+      * Remove the single recipe and exercise title
128
+      */
129
+     public function single_title( $title ) {
130
+
131
+          if ( is_single() && is_singular( 'recipe' ) ) {
132
+
133
+               $title = __( 'Recipe', 'lsx-health-plan' );
134
+          }
135
+
136
+          if ( is_single() && is_singular( 'exercise' ) ) {
137
+
138
+               $title = __( 'Exercise', 'lsx-health-plan' );
139
+          }
140
+
141
+          return $title;
142
+     }
143
+
144
+     /**
145
+      * Removing footer for HP single pages.
146
+      *
147
+      * @return void
148
+      */
149
+     public function remove_single_footer() {
150
+          if ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) {
151
+               remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' );
152
+          }
153
+     }
154 154
 }
Please login to merge, or discard this patch.
classes/frontend/class-template-redirects.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	 * Contructor
22 22
 	 */
23 23
 	public function __construct() {
24
-		add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 );
25
-		add_filter( 'template_include', array( $this, 'single_template_include' ), 99 );
26
-		add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 );
24
+		add_filter('template_include', array($this, 'archive_template_include'), 99);
25
+		add_filter('template_include', array($this, 'single_template_include'), 99);
26
+		add_filter('template_include', array($this, 'taxonomy_template_include'), 99);
27 27
 	}
28 28
 
29 29
 	/**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public static function get_instance() {
37 37
 		// If the single instance hasn't been set, set it now.
38
-		if ( null === self::$instance ) {
38
+		if (null === self::$instance) {
39 39
 			self::$instance = new self();
40 40
 		}
41 41
 		return self::$instance;
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	/**
45 45
 	 * Archive template.
46 46
 	 */
47
-	public function archive_template_include( $template ) {
48
-		$applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() );
49
-		if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) {
47
+	public function archive_template_include($template) {
48
+		$applicable_post_types = apply_filters('lsx_health_plan_archive_template', array());
49
+		if ( ! empty($applicable_post_types) && is_main_query() && is_post_type_archive($applicable_post_types)) {
50 50
 			$post_type = get_post_type();
51
-			if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) {
51
+			if (empty(locate_template(array('archive-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php')) {
52 52
 				$template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php';
53 53
 			}
54 54
 		}
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 	/**
59 59
 	 * Single template.
60 60
 	 */
61
-	public function single_template_include( $template ) {
62
-		$applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() );
63
-		if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) {
61
+	public function single_template_include($template) {
62
+		$applicable_post_types = apply_filters('lsx_health_plan_single_template', array());
63
+		if ( ! empty($applicable_post_types) && is_main_query() && is_singular($applicable_post_types)) {
64 64
 			$post_type = get_post_type();
65
-			if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) {
65
+			if (empty(locate_template(array('single-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php')) {
66 66
 				$template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php';
67 67
 			}
68 68
 		}
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 	 * @param     $template string
76 76
 	 * @return    string
77 77
 	 */
78
-	public function taxonomy_template_include( $template ) {
79
-		$applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() );
80
-		if ( is_main_query() && is_tax( $applicable_taxonomies ) ) {
81
-			$current_taxonomy = get_query_var( 'taxonomy' );
82
-			if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) {
78
+	public function taxonomy_template_include($template) {
79
+		$applicable_taxonomies = apply_filters('lsx_health_plan_taxonomies_template', array());
80
+		if (is_main_query() && is_tax($applicable_taxonomies)) {
81
+			$current_taxonomy = get_query_var('taxonomy');
82
+			if ('' === locate_template(array('taxonomy-' . $current_taxonomy . '.php')) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php')) {
83 83
 				$template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php';
84 84
 			}
85 85
 		}
Please login to merge, or discard this patch.
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -8,81 +8,81 @@
 block discarded – undo
8 8
  */
9 9
 class Template_Redirects {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\frontend\Template_Redirects()
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\frontend\Template_Redirects()
17
+      */
18
+     protected static $instance = null;
19 19
 
20
-	/**
21
-	 * Contructor
22
-	 */
23
-	public function __construct() {
24
-		add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 );
25
-		add_filter( 'template_include', array( $this, 'single_template_include' ), 99 );
26
-		add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 );
27
-	}
20
+     /**
21
+      * Contructor
22
+      */
23
+     public function __construct() {
24
+          add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 );
25
+          add_filter( 'template_include', array( $this, 'single_template_include' ), 99 );
26
+          add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 );
27
+     }
28 28
 
29
-	/**
30
-	 * Return an instance of this class.
31
-	 *
32
-	 * @since 1.0.0
33
-	 *
34
-	 * @return    object \lsx_health_plan\classes\frontend\Template_Redirects()    A single instance of this class.
35
-	 */
36
-	public static function get_instance() {
37
-		// If the single instance hasn't been set, set it now.
38
-		if ( null === self::$instance ) {
39
-			self::$instance = new self();
40
-		}
41
-		return self::$instance;
42
-	}
29
+     /**
30
+      * Return an instance of this class.
31
+      *
32
+      * @since 1.0.0
33
+      *
34
+      * @return    object \lsx_health_plan\classes\frontend\Template_Redirects()    A single instance of this class.
35
+      */
36
+     public static function get_instance() {
37
+          // If the single instance hasn't been set, set it now.
38
+          if ( null === self::$instance ) {
39
+               self::$instance = new self();
40
+          }
41
+          return self::$instance;
42
+     }
43 43
 
44
-	/**
45
-	 * Archive template.
46
-	 */
47
-	public function archive_template_include( $template ) {
48
-		$applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() );
49
-		if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) {
50
-			$post_type = get_post_type();
51
-			if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) {
52
-				$template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php';
53
-			}
54
-		}
55
-		return $template;
56
-	}
44
+     /**
45
+      * Archive template.
46
+      */
47
+     public function archive_template_include( $template ) {
48
+          $applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() );
49
+          if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) {
50
+               $post_type = get_post_type();
51
+               if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) {
52
+                    $template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php';
53
+               }
54
+          }
55
+          return $template;
56
+     }
57 57
 
58
-	/**
59
-	 * Single template.
60
-	 */
61
-	public function single_template_include( $template ) {
62
-		$applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() );
63
-		if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) {
64
-			$post_type = get_post_type();
65
-			if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) {
66
-				$template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php';
67
-			}
68
-		}
69
-		return $template;
70
-	}
58
+     /**
59
+      * Single template.
60
+      */
61
+     public function single_template_include( $template ) {
62
+          $applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() );
63
+          if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) {
64
+               $post_type = get_post_type();
65
+               if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) {
66
+                    $template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php';
67
+               }
68
+          }
69
+          return $template;
70
+     }
71 71
 
72
-	/**
73
-	 * Redirect WordPress to the taxonomy located in the plugin
74
-	 *
75
-	 * @param     $template string
76
-	 * @return    string
77
-	 */
78
-	public function taxonomy_template_include( $template ) {
79
-		$applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() );
80
-		if ( is_main_query() && is_tax( $applicable_taxonomies ) ) {
81
-			$current_taxonomy = get_query_var( 'taxonomy' );
82
-			if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) {
83
-				$template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php';
84
-			}
85
-		}
86
-		return $template;
87
-	}
72
+     /**
73
+      * Redirect WordPress to the taxonomy located in the plugin
74
+      *
75
+      * @param     $template string
76
+      * @return    string
77
+      */
78
+     public function taxonomy_template_include( $template ) {
79
+          $applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() );
80
+          if ( is_main_query() && is_tax( $applicable_taxonomies ) ) {
81
+               $current_taxonomy = get_query_var( 'taxonomy' );
82
+               if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) {
83
+                    $template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php';
84
+               }
85
+          }
86
+          return $template;
87
+     }
88 88
 }
Please login to merge, or discard this patch.
classes/frontend/class-plan-status.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * Contructor
22 22
 	 */
23 23
 	public function __construct() {
24
-		add_action( 'init', array( $this, 'handle_day_action' ), 100 );
24
+		add_action('init', array($this, 'handle_day_action'), 100);
25 25
 	}
26 26
 
27 27
 	/**
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public static function get_instance() {
35 35
 		// If the single instance hasn't been set, set it now.
36
-		if ( null === self::$instance ) {
36
+		if (null === self::$instance) {
37 37
 			self::$instance = new self();
38 38
 		}
39 39
 		return self::$instance;
@@ -43,18 +43,18 @@  discard block
 block discarded – undo
43 43
 	 * Registers the rewrites.
44 44
 	 */
45 45
 	public function handle_day_action() {
46
-		if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) {
47
-			update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true );
48
-			$plan_id     = sanitize_key( $_POST['lsx-health-plan-id'] );
49
-			$plan_parent = wp_get_post_parent_id( $plan_id );
50
-			if ( 0 !== $plan_parent ) {
46
+		if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'complete')) {
47
+			update_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete', true);
48
+			$plan_id     = sanitize_key($_POST['lsx-health-plan-id']);
49
+			$plan_parent = wp_get_post_parent_id($plan_id);
50
+			if (0 !== $plan_parent) {
51 51
 				$plan_id = $plan_parent;
52 52
 			}
53
-			wp_safe_redirect( get_permalink( $plan_id ) );
53
+			wp_safe_redirect(get_permalink($plan_id));
54 54
 		}
55 55
 
56
-		if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) {
57
-			delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' );
56
+		if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'unlock')) {
57
+			delete_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete');
58 58
 		}
59 59
 	}
60 60
 }
Please login to merge, or discard this patch.
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -8,53 +8,53 @@
 block discarded – undo
8 8
  */
9 9
 class Plan_Status {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\frontend\Plan_Status()
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\frontend\Plan_Status()
17
+      */
18
+     protected static $instance = null;
19 19
 
20
-	/**
21
-	 * Contructor
22
-	 */
23
-	public function __construct() {
24
-		add_action( 'init', array( $this, 'handle_day_action' ), 100 );
25
-	}
20
+     /**
21
+      * Contructor
22
+      */
23
+     public function __construct() {
24
+          add_action( 'init', array( $this, 'handle_day_action' ), 100 );
25
+     }
26 26
 
27
-	/**
28
-	 * Return an instance of this class.
29
-	 *
30
-	 * @since 1.0.0
31
-	 *
32
-	 * @return    object \lsx_health_plan\classes\frontend\Plan_Status()    A single instance of this class.
33
-	 */
34
-	public static function get_instance() {
35
-		// If the single instance hasn't been set, set it now.
36
-		if ( null === self::$instance ) {
37
-			self::$instance = new self();
38
-		}
39
-		return self::$instance;
40
-	}
27
+     /**
28
+      * Return an instance of this class.
29
+      *
30
+      * @since 1.0.0
31
+      *
32
+      * @return    object \lsx_health_plan\classes\frontend\Plan_Status()    A single instance of this class.
33
+      */
34
+     public static function get_instance() {
35
+          // If the single instance hasn't been set, set it now.
36
+          if ( null === self::$instance ) {
37
+               self::$instance = new self();
38
+          }
39
+          return self::$instance;
40
+     }
41 41
 
42
-	/**
43
-	 * Registers the rewrites.
44
-	 */
45
-	public function handle_day_action() {
46
-		if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) {
47
-			update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true );
48
-			$plan_id     = sanitize_key( $_POST['lsx-health-plan-id'] );
49
-			$plan_parent = wp_get_post_parent_id( $plan_id );
50
-			if ( 0 !== $plan_parent ) {
51
-				$plan_id = $plan_parent;
52
-			}
53
-			wp_safe_redirect( get_permalink( $plan_id ) );
54
-		}
42
+     /**
43
+      * Registers the rewrites.
44
+      */
45
+     public function handle_day_action() {
46
+          if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) {
47
+               update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true );
48
+               $plan_id     = sanitize_key( $_POST['lsx-health-plan-id'] );
49
+               $plan_parent = wp_get_post_parent_id( $plan_id );
50
+               if ( 0 !== $plan_parent ) {
51
+                    $plan_id = $plan_parent;
52
+               }
53
+               wp_safe_redirect( get_permalink( $plan_id ) );
54
+          }
55 55
 
56
-		if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) {
57
-			delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' );
58
-		}
59
-	}
56
+          if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) {
57
+               delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' );
58
+          }
59
+     }
60 60
 }
Please login to merge, or discard this patch.