@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | * Contructor |
| 52 | 52 | */ |
| 53 | 53 | public function __construct() { |
| 54 | - if ( ! is_admin() ) { |
|
| 54 | + if ( ! is_admin()) { |
|
| 55 | 55 | $this->load_classes(); |
| 56 | - add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
| 56 | + add_action('template_redirect', array($this, 'redirect')); |
|
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public static function get_instance() { |
| 69 | 69 | // If the single instance hasn't been set, set it now. |
| 70 | - if ( null === self::$instance ) { |
|
| 70 | + if (null === self::$instance) { |
|
| 71 | 71 | self::$instance = new self(); |
| 72 | 72 | } |
| 73 | 73 | return self::$instance; |
@@ -102,17 +102,17 @@ discard block |
||
| 102 | 102 | * @return void |
| 103 | 103 | */ |
| 104 | 104 | public function redirect() { |
| 105 | - if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
| 105 | + if ( ! is_user_logged_in() || ! function_exists('wc_get_page_id') || is_home()) { |
|
| 106 | 106 | return; |
| 107 | 107 | } |
| 108 | - if ( lsx_health_plan_user_has_purchase() && ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) ) ) { |
|
| 109 | - wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) ); |
|
| 108 | + if (lsx_health_plan_user_has_purchase() && (is_page(wc_get_page_id('cart')) || is_page(wc_get_page_id('checkout')))) { |
|
| 109 | + wp_redirect(get_permalink(wc_get_page_id('myaccount'))); |
|
| 110 | 110 | die; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $product_id = \lsx_health_plan\functions\get_option( 'membership_product', false ); |
|
| 114 | - if ( false !== $product_id && is_single( $product_id ) ) { |
|
| 115 | - wp_redirect( home_url() ); |
|
| 113 | + $product_id = \lsx_health_plan\functions\get_option('membership_product', false); |
|
| 114 | + if (false !== $product_id && is_single($product_id)) { |
|
| 115 | + wp_redirect(home_url()); |
|
| 116 | 116 | wp_die(); |
| 117 | 117 | } |
| 118 | 118 | } |