@@ -8,124 +8,124 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Frontend { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @since 1.0.0 |
|
| 15 | - * |
|
| 16 | - * @var object \lsx_health_plan\classes\Frontend() |
|
| 17 | - */ |
|
| 18 | - protected static $instance = null; |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * @var object \lsx_health_plan\classes\frontend\Endpoints(); |
|
| 22 | - */ |
|
| 23 | - public $endpoints; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @var object \lsx_health_plan\classes\frontend\Modals(); |
|
| 27 | - */ |
|
| 28 | - public $modals; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * @var object \lsx_health_plan\classes\frontend\Gallery(); |
|
| 32 | - */ |
|
| 33 | - public $gallery; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @var object \lsx_health_plan\classes\frontend\Plan_Status(); |
|
| 37 | - */ |
|
| 38 | - public $plan_status; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @var object \lsx_health_plan\classes\frontend\Plan_Query(); |
|
| 42 | - */ |
|
| 43 | - public $plan_query; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @var object \lsx_health_plan\classes\frontend\General(); |
|
| 47 | - */ |
|
| 48 | - public $general; |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @var object \lsx_health_plan\classes\frontend\Template_Redirects(); |
|
| 52 | - */ |
|
| 53 | - public $template_redirects; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Constructor |
|
| 57 | - */ |
|
| 58 | - public function __construct() { |
|
| 59 | - if ( ! is_admin() ) { |
|
| 60 | - $this->load_classes(); |
|
| 61 | - add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Return an instance of this class. |
|
| 67 | - * |
|
| 68 | - * @since 1.0.0 |
|
| 69 | - * |
|
| 70 | - * @return object \lsx_health_plan\classes\Frontend() A single instance of this class. |
|
| 71 | - */ |
|
| 72 | - public static function get_instance() { |
|
| 73 | - // If the single instance hasn't been set, set it now. |
|
| 74 | - if ( null === self::$instance ) { |
|
| 75 | - self::$instance = new self(); |
|
| 76 | - } |
|
| 77 | - return self::$instance; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Loads the variable classes and the static classes. |
|
| 82 | - */ |
|
| 83 | - private function load_classes() { |
|
| 84 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php'; |
|
| 85 | - $this->endpoints = frontend\Endpoints::get_instance(); |
|
| 86 | - |
|
| 87 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-modals.php'; |
|
| 88 | - $this->modals = Modals::get_instance(); |
|
| 89 | - |
|
| 90 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php'; |
|
| 91 | - $this->gallery = frontend\Gallery::get_instance(); |
|
| 92 | - |
|
| 93 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-status.php'; |
|
| 94 | - $this->plan_status = frontend\Plan_Status::get_instance(); |
|
| 95 | - |
|
| 96 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-query.php'; |
|
| 97 | - $this->plan_query = frontend\Plan_Query::get_instance(); |
|
| 98 | - |
|
| 99 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-general.php'; |
|
| 100 | - $this->general = frontend\General::get_instance(); |
|
| 101 | - |
|
| 102 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-template-redirects.php'; |
|
| 103 | - $this->template_redirects = frontend\Template_Redirects::get_instance(); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Redirect the user from the cart or checkout page if they have purchased the product already. |
|
| 108 | - * |
|
| 109 | - * @return void |
|
| 110 | - */ |
|
| 111 | - public function redirect() { |
|
| 112 | - if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
| 113 | - return; |
|
| 114 | - } |
|
| 115 | - } |
|
| 116 | - /** |
|
| 117 | - * Remove the "Archives:" from the post type recipes. |
|
| 118 | - * |
|
| 119 | - * @param string $title the term title. |
|
| 120 | - * @return string |
|
| 121 | - */ |
|
| 122 | - public function get_the_archive_title( $title ) { |
|
| 123 | - if ( is_tax() ) { |
|
| 124 | - $queried_object = get_queried_object(); |
|
| 125 | - if ( isset( $queried_object->name ) ) { |
|
| 126 | - $title = $queried_object->name; |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - return $title; |
|
| 130 | - } |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @since 1.0.0 |
|
| 15 | + * |
|
| 16 | + * @var object \lsx_health_plan\classes\Frontend() |
|
| 17 | + */ |
|
| 18 | + protected static $instance = null; |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * @var object \lsx_health_plan\classes\frontend\Endpoints(); |
|
| 22 | + */ |
|
| 23 | + public $endpoints; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @var object \lsx_health_plan\classes\frontend\Modals(); |
|
| 27 | + */ |
|
| 28 | + public $modals; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @var object \lsx_health_plan\classes\frontend\Gallery(); |
|
| 32 | + */ |
|
| 33 | + public $gallery; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @var object \lsx_health_plan\classes\frontend\Plan_Status(); |
|
| 37 | + */ |
|
| 38 | + public $plan_status; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @var object \lsx_health_plan\classes\frontend\Plan_Query(); |
|
| 42 | + */ |
|
| 43 | + public $plan_query; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @var object \lsx_health_plan\classes\frontend\General(); |
|
| 47 | + */ |
|
| 48 | + public $general; |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @var object \lsx_health_plan\classes\frontend\Template_Redirects(); |
|
| 52 | + */ |
|
| 53 | + public $template_redirects; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Constructor |
|
| 57 | + */ |
|
| 58 | + public function __construct() { |
|
| 59 | + if ( ! is_admin() ) { |
|
| 60 | + $this->load_classes(); |
|
| 61 | + add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Return an instance of this class. |
|
| 67 | + * |
|
| 68 | + * @since 1.0.0 |
|
| 69 | + * |
|
| 70 | + * @return object \lsx_health_plan\classes\Frontend() A single instance of this class. |
|
| 71 | + */ |
|
| 72 | + public static function get_instance() { |
|
| 73 | + // If the single instance hasn't been set, set it now. |
|
| 74 | + if ( null === self::$instance ) { |
|
| 75 | + self::$instance = new self(); |
|
| 76 | + } |
|
| 77 | + return self::$instance; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Loads the variable classes and the static classes. |
|
| 82 | + */ |
|
| 83 | + private function load_classes() { |
|
| 84 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php'; |
|
| 85 | + $this->endpoints = frontend\Endpoints::get_instance(); |
|
| 86 | + |
|
| 87 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-modals.php'; |
|
| 88 | + $this->modals = Modals::get_instance(); |
|
| 89 | + |
|
| 90 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php'; |
|
| 91 | + $this->gallery = frontend\Gallery::get_instance(); |
|
| 92 | + |
|
| 93 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-status.php'; |
|
| 94 | + $this->plan_status = frontend\Plan_Status::get_instance(); |
|
| 95 | + |
|
| 96 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-query.php'; |
|
| 97 | + $this->plan_query = frontend\Plan_Query::get_instance(); |
|
| 98 | + |
|
| 99 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-general.php'; |
|
| 100 | + $this->general = frontend\General::get_instance(); |
|
| 101 | + |
|
| 102 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-template-redirects.php'; |
|
| 103 | + $this->template_redirects = frontend\Template_Redirects::get_instance(); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Redirect the user from the cart or checkout page if they have purchased the product already. |
|
| 108 | + * |
|
| 109 | + * @return void |
|
| 110 | + */ |
|
| 111 | + public function redirect() { |
|
| 112 | + if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
| 113 | + return; |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | + /** |
|
| 117 | + * Remove the "Archives:" from the post type recipes. |
|
| 118 | + * |
|
| 119 | + * @param string $title the term title. |
|
| 120 | + * @return string |
|
| 121 | + */ |
|
| 122 | + public function get_the_archive_title( $title ) { |
|
| 123 | + if ( is_tax() ) { |
|
| 124 | + $queried_object = get_queried_object(); |
|
| 125 | + if ( isset( $queried_object->name ) ) { |
|
| 126 | + $title = $queried_object->name; |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + return $title; |
|
| 130 | + } |
|
| 131 | 131 | } |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | * Constructor |
| 57 | 57 | */ |
| 58 | 58 | public function __construct() { |
| 59 | - if ( ! is_admin() ) { |
|
| 59 | + if ( ! is_admin()) { |
|
| 60 | 60 | $this->load_classes(); |
| 61 | - add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
| 61 | + add_action('template_redirect', array($this, 'redirect')); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public static function get_instance() { |
| 73 | 73 | // If the single instance hasn't been set, set it now. |
| 74 | - if ( null === self::$instance ) { |
|
| 74 | + if (null === self::$instance) { |
|
| 75 | 75 | self::$instance = new self(); |
| 76 | 76 | } |
| 77 | 77 | return self::$instance; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @return void |
| 110 | 110 | */ |
| 111 | 111 | public function redirect() { |
| 112 | - if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
| 112 | + if ( ! is_user_logged_in() || ! function_exists('wc_get_page_id') || is_home()) { |
|
| 113 | 113 | return; |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | * @param string $title the term title. |
| 120 | 120 | * @return string |
| 121 | 121 | */ |
| 122 | - public function get_the_archive_title( $title ) { |
|
| 123 | - if ( is_tax() ) { |
|
| 122 | + public function get_the_archive_title($title) { |
|
| 123 | + if (is_tax()) { |
|
| 124 | 124 | $queried_object = get_queried_object(); |
| 125 | - if ( isset( $queried_object->name ) ) { |
|
| 125 | + if (isset($queried_object->name)) { |
|
| 126 | 126 | $title = $queried_object->name; |
| 127 | 127 | } |
| 128 | 128 | } |