@@ -9,83 +9,83 @@ |
||
9 | 9 | */ |
10 | 10 | class Post_Type { |
11 | 11 | |
12 | - /** |
|
13 | - * Holds class instance |
|
14 | - * |
|
15 | - * @since 1.0.0 |
|
16 | - * |
|
17 | - * @var object \lsx_health_plan\classes\Post_Type() |
|
18 | - */ |
|
19 | - protected static $instance = null; |
|
12 | + /** |
|
13 | + * Holds class instance |
|
14 | + * |
|
15 | + * @since 1.0.0 |
|
16 | + * |
|
17 | + * @var object \lsx_health_plan\classes\Post_Type() |
|
18 | + */ |
|
19 | + protected static $instance = null; |
|
20 | 20 | |
21 | - /** |
|
22 | - * The post types available |
|
23 | - * |
|
24 | - * @var array |
|
25 | - */ |
|
26 | - public $post_types = array(); |
|
21 | + /** |
|
22 | + * The post types available |
|
23 | + * |
|
24 | + * @var array |
|
25 | + */ |
|
26 | + public $post_types = array(); |
|
27 | 27 | |
28 | - /** |
|
29 | - * The related post type connections |
|
30 | - * |
|
31 | - * @var array |
|
32 | - */ |
|
33 | - public $connections = array(); |
|
28 | + /** |
|
29 | + * The related post type connections |
|
30 | + * |
|
31 | + * @var array |
|
32 | + */ |
|
33 | + public $connections = array(); |
|
34 | 34 | |
35 | - /** |
|
36 | - * Constructor |
|
37 | - */ |
|
38 | - public function __construct() { |
|
39 | - $this->enable_post_types(); |
|
40 | - add_filter( 'lsx_health_plan_post_types', array( $this, 'enable_post_types' ) ); |
|
41 | - foreach ( $this->post_types as $index => $post_type ) { |
|
42 | - $is_disabled = \lsx_health_plan\functions\get_option( $post_type . '_disabled', false ); |
|
43 | - // Check if exercises is enabled, if so disable the videos. |
|
44 | - if ( 'video' === $post_type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
45 | - $is_disabled = true; |
|
46 | - } |
|
35 | + /** |
|
36 | + * Constructor |
|
37 | + */ |
|
38 | + public function __construct() { |
|
39 | + $this->enable_post_types(); |
|
40 | + add_filter( 'lsx_health_plan_post_types', array( $this, 'enable_post_types' ) ); |
|
41 | + foreach ( $this->post_types as $index => $post_type ) { |
|
42 | + $is_disabled = \lsx_health_plan\functions\get_option( $post_type . '_disabled', false ); |
|
43 | + // Check if exercises is enabled, if so disable the videos. |
|
44 | + if ( 'video' === $post_type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
45 | + $is_disabled = true; |
|
46 | + } |
|
47 | 47 | |
48 | - if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
49 | - unset( $this->post_types[ $index ] ); |
|
50 | - } else { |
|
51 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/post-types/class-' . $post_type . '.php'; |
|
52 | - $classname = ucwords( $post_type ); |
|
53 | - $this->$post_type = call_user_func_array( '\\lsx_health_plan\classes\\' . $classname . '::get_instance', array() ); |
|
54 | - } |
|
55 | - } |
|
56 | - } |
|
48 | + if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
49 | + unset( $this->post_types[ $index ] ); |
|
50 | + } else { |
|
51 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/post-types/class-' . $post_type . '.php'; |
|
52 | + $classname = ucwords( $post_type ); |
|
53 | + $this->$post_type = call_user_func_array( '\\lsx_health_plan\classes\\' . $classname . '::get_instance', array() ); |
|
54 | + } |
|
55 | + } |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Return an instance of this class. |
|
60 | - * |
|
61 | - * @since 1.0.0 |
|
62 | - * |
|
63 | - * @return object \lsx_health_plan\classes\Post_Type() A single instance of this class. |
|
64 | - */ |
|
65 | - public static function get_instance() { |
|
66 | - // If the single instance hasn't been set, set it now. |
|
67 | - if ( null === self::$instance ) { |
|
68 | - self::$instance = new self(); |
|
69 | - } |
|
70 | - return self::$instance; |
|
71 | - } |
|
58 | + /** |
|
59 | + * Return an instance of this class. |
|
60 | + * |
|
61 | + * @since 1.0.0 |
|
62 | + * |
|
63 | + * @return object \lsx_health_plan\classes\Post_Type() A single instance of this class. |
|
64 | + */ |
|
65 | + public static function get_instance() { |
|
66 | + // If the single instance hasn't been set, set it now. |
|
67 | + if ( null === self::$instance ) { |
|
68 | + self::$instance = new self(); |
|
69 | + } |
|
70 | + return self::$instance; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Enable our post types |
|
75 | - * |
|
76 | - * @return void |
|
77 | - */ |
|
78 | - public function enable_post_types( $post_types = array() ) { |
|
79 | - $post_types = array( |
|
80 | - 'plan', |
|
81 | - 'workout', |
|
82 | - 'meal', |
|
83 | - 'recipe', |
|
84 | - 'tip', |
|
85 | - 'video', |
|
86 | - 'exercise', |
|
87 | - ); |
|
88 | - $this->post_types = $post_types; |
|
89 | - return $post_types; |
|
90 | - } |
|
73 | + /** |
|
74 | + * Enable our post types |
|
75 | + * |
|
76 | + * @return void |
|
77 | + */ |
|
78 | + public function enable_post_types( $post_types = array() ) { |
|
79 | + $post_types = array( |
|
80 | + 'plan', |
|
81 | + 'workout', |
|
82 | + 'meal', |
|
83 | + 'recipe', |
|
84 | + 'tip', |
|
85 | + 'video', |
|
86 | + 'exercise', |
|
87 | + ); |
|
88 | + $this->post_types = $post_types; |
|
89 | + return $post_types; |
|
90 | + } |
|
91 | 91 | } |
@@ -8,86 +8,86 @@ |
||
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 | - * Constructor |
|
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 | + * Constructor |
|
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 | } |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | * @return void |
12 | 12 | */ |
13 | 13 | function lsx_hp_plan_archive_filters() { |
14 | - if ( is_post_type_archive( 'plan' ) && function_exists( 'wc_get_page_id' ) && false === apply_filters( 'lsx_hp_disable_plan_archive_filters', false ) ) { |
|
15 | - ?> |
|
14 | + if ( is_post_type_archive( 'plan' ) && function_exists( 'wc_get_page_id' ) && false === apply_filters( 'lsx_hp_disable_plan_archive_filters', false ) ) { |
|
15 | + ?> |
|
16 | 16 | <div id="type-nav"> |
17 | 17 | <ul class="nav nav-pills lsx-type-nav-filter"> |
18 | 18 | <li class="active"><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_post_type_archive_link( 'plan' ) ); ?>" data-filter="*"><?php esc_html_e( 'All', 'lsx-health-plan' ); ?></a></li> |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | </ul> |
23 | 23 | </div> |
24 | 24 | <?php |
25 | - } |
|
25 | + } |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -31,27 +31,27 @@ discard block |
||
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | function lsx_hp_plan_get_classes() { |
34 | - $classes = 'filter-free'; |
|
35 | - if ( \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
36 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
37 | - $linked_product = wc_get_product( $products[0] ); |
|
38 | - $price = $linked_product->get_price( 'raw' ); |
|
39 | - if ( empty( $price ) ) { |
|
40 | - $classes = 'filter-free'; |
|
41 | - } else { |
|
42 | - $classes = 'filter-paid'; |
|
43 | - } |
|
34 | + $classes = 'filter-free'; |
|
35 | + if ( \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
36 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
37 | + $linked_product = wc_get_product( $products[0] ); |
|
38 | + $price = $linked_product->get_price( 'raw' ); |
|
39 | + if ( empty( $price ) ) { |
|
40 | + $classes = 'filter-free'; |
|
41 | + } else { |
|
42 | + $classes = 'filter-paid'; |
|
43 | + } |
|
44 | 44 | |
45 | - $featured = get_post_meta( get_the_ID(), 'plan_featured_plan', true ); |
|
46 | - if ( false !== $featured && '' !== $featured ) { |
|
47 | - $classes .= ' filter-featured'; |
|
48 | - } |
|
49 | - } |
|
50 | - return $classes; |
|
45 | + $featured = get_post_meta( get_the_ID(), 'plan_featured_plan', true ); |
|
46 | + if ( false !== $featured && '' !== $featured ) { |
|
47 | + $classes .= ' filter-featured'; |
|
48 | + } |
|
49 | + } |
|
50 | + return $classes; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | function lsx_health_plan_back_to_plan_button() { |
54 | - ?> |
|
54 | + ?> |
|
55 | 55 | <div class="back-plan-btn"> |
56 | 56 | <a class="btn" href="<?php the_permalink(); ?>"><?php esc_html_e( 'Back To Plan', 'lsx-health-plan' ); ?></a> |
57 | 57 | </div> |
@@ -8,98 +8,98 @@ |
||
8 | 8 | */ |
9 | 9 | class Plan_Query { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\frontend\Plan_Query() |
|
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_Query() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Holds the sections for the current plan. |
|
22 | - * |
|
23 | - * @var array |
|
24 | - */ |
|
25 | - public $sections = array(); |
|
20 | + /** |
|
21 | + * Holds the sections for the current plan. |
|
22 | + * |
|
23 | + * @var array |
|
24 | + */ |
|
25 | + public $sections = array(); |
|
26 | 26 | |
27 | - /** |
|
28 | - * Holds the variable true/false if the current plan has sections or not. |
|
29 | - * |
|
30 | - * @var array |
|
31 | - */ |
|
32 | - public $has_sections = false; |
|
27 | + /** |
|
28 | + * Holds the variable true/false if the current plan has sections or not. |
|
29 | + * |
|
30 | + * @var array |
|
31 | + */ |
|
32 | + public $has_sections = false; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Constructor |
|
36 | - */ |
|
37 | - public function __construct() { |
|
38 | - } |
|
34 | + /** |
|
35 | + * Constructor |
|
36 | + */ |
|
37 | + public function __construct() { |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Return an instance of this class. |
|
42 | - * |
|
43 | - * @since 1.0.0 |
|
44 | - * |
|
45 | - * @return object \lsx_health_plan\classes\frontend\Plan_Query() A single instance of this class. |
|
46 | - */ |
|
47 | - public static function get_instance() { |
|
48 | - // If the single instance hasn't been set, set it now. |
|
49 | - if ( null === self::$instance ) { |
|
50 | - self::$instance = new self(); |
|
51 | - } |
|
52 | - return self::$instance; |
|
53 | - } |
|
40 | + /** |
|
41 | + * Return an instance of this class. |
|
42 | + * |
|
43 | + * @since 1.0.0 |
|
44 | + * |
|
45 | + * @return object \lsx_health_plan\classes\frontend\Plan_Query() A single instance of this class. |
|
46 | + */ |
|
47 | + public static function get_instance() { |
|
48 | + // If the single instance hasn't been set, set it now. |
|
49 | + if ( null === self::$instance ) { |
|
50 | + self::$instance = new self(); |
|
51 | + } |
|
52 | + return self::$instance; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Undocumented function |
|
57 | - * |
|
58 | - * @return void |
|
59 | - */ |
|
60 | - public function query_sections( $plan_id = '' ) { |
|
61 | - if ( '' === $plan_id ) { |
|
62 | - $plan_id = get_the_ID(); |
|
63 | - } |
|
55 | + /** |
|
56 | + * Undocumented function |
|
57 | + * |
|
58 | + * @return void |
|
59 | + */ |
|
60 | + public function query_sections( $plan_id = '' ) { |
|
61 | + if ( '' === $plan_id ) { |
|
62 | + $plan_id = get_the_ID(); |
|
63 | + } |
|
64 | 64 | |
65 | - $section_array = get_post_meta( $plan_id, 'plan_sections', true ); |
|
66 | - if ( ! empty( $section_array ) ) { |
|
67 | - $this->has_sections = true; |
|
68 | - $this->sections = $section_array; |
|
69 | - } |
|
70 | - return $this->has_sections; |
|
71 | - } |
|
65 | + $section_array = get_post_meta( $plan_id, 'plan_sections', true ); |
|
66 | + if ( ! empty( $section_array ) ) { |
|
67 | + $this->has_sections = true; |
|
68 | + $this->sections = $section_array; |
|
69 | + } |
|
70 | + return $this->has_sections; |
|
71 | + } |
|
72 | 72 | |
73 | - public function get_sections( $group = false ) { |
|
74 | - $sections = $this->sections; |
|
75 | - if ( false !== $group ) { |
|
76 | - $sections = $this->group_sections( $sections ); |
|
77 | - } |
|
78 | - return $sections; |
|
79 | - } |
|
73 | + public function get_sections( $group = false ) { |
|
74 | + $sections = $this->sections; |
|
75 | + if ( false !== $group ) { |
|
76 | + $sections = $this->group_sections( $sections ); |
|
77 | + } |
|
78 | + return $sections; |
|
79 | + } |
|
80 | 80 | |
81 | - public function get_section_count() { |
|
82 | - return count( $this->sections ); |
|
83 | - } |
|
81 | + public function get_section_count() { |
|
82 | + return count( $this->sections ); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * This will group the sections by their "Group" field. |
|
87 | - * |
|
88 | - * @param array $sections |
|
89 | - * @return array |
|
90 | - */ |
|
91 | - public function group_sections( $sections = array() ) { |
|
92 | - $groups = array(); |
|
93 | - if ( ! empty( $sections ) ) { |
|
94 | - foreach ( $sections as $section_key => $section_values ) { |
|
95 | - $group_key = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) ); |
|
96 | - if ( isset( $section_values['group'] ) && '' !== $section_values['group'] ) { |
|
97 | - $group_key = $section_values['group']; |
|
98 | - } |
|
99 | - $group_key = sanitize_title( $group_key ); |
|
100 | - $groups[ $group_key ][ $section_key ] = $section_values; |
|
101 | - } |
|
102 | - } |
|
103 | - return $groups; |
|
104 | - } |
|
85 | + /** |
|
86 | + * This will group the sections by their "Group" field. |
|
87 | + * |
|
88 | + * @param array $sections |
|
89 | + * @return array |
|
90 | + */ |
|
91 | + public function group_sections( $sections = array() ) { |
|
92 | + $groups = array(); |
|
93 | + if ( ! empty( $sections ) ) { |
|
94 | + foreach ( $sections as $section_key => $section_values ) { |
|
95 | + $group_key = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) ); |
|
96 | + if ( isset( $section_values['group'] ) && '' !== $section_values['group'] ) { |
|
97 | + $group_key = $section_values['group']; |
|
98 | + } |
|
99 | + $group_key = sanitize_title( $group_key ); |
|
100 | + $groups[ $group_key ][ $section_key ] = $section_values; |
|
101 | + } |
|
102 | + } |
|
103 | + return $groups; |
|
104 | + } |
|
105 | 105 | } |
@@ -8,169 +8,169 @@ |
||
8 | 8 | */ |
9 | 9 | class Integrations { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\Integrations() |
|
17 | - */ |
|
18 | - protected static $instance = null; |
|
19 | - |
|
20 | - /** |
|
21 | - * Holds class instance |
|
22 | - * |
|
23 | - * @since 1.0.0 |
|
24 | - * |
|
25 | - * @var object \MAG_CMB2_Field_Post_Search_Ajax() |
|
26 | - */ |
|
27 | - public $cmb2_post_search_ajax = false; |
|
28 | - |
|
29 | - /** |
|
30 | - * Holds class instance |
|
31 | - * |
|
32 | - * @since 1.0.0 |
|
33 | - * |
|
34 | - * @var object \lsx_health_plan\classes\Download_Monitor() |
|
35 | - */ |
|
36 | - public $download_monitor = false; |
|
37 | - |
|
38 | - /** |
|
39 | - * Holds class instance |
|
40 | - * |
|
41 | - * @since 1.0.0 |
|
42 | - * |
|
43 | - * @var object \lsx_health_plan\classes\Woocommerce() |
|
44 | - */ |
|
45 | - public $woocommerce = false; |
|
46 | - |
|
47 | - /** |
|
48 | - * Holds class instance |
|
49 | - * |
|
50 | - * @since 1.0.0 |
|
51 | - * |
|
52 | - * @var object \lsx_health_plan\classes\WP_User_Avatar() |
|
53 | - */ |
|
54 | - public $wp_user_avatar = false; |
|
55 | - |
|
56 | - /** |
|
57 | - * Holds class instance |
|
58 | - * |
|
59 | - * @since 1.0.0 |
|
60 | - * |
|
61 | - * @var object \lsx_health_plan\classes\FacetWP() |
|
62 | - */ |
|
63 | - public $facetwp = false; |
|
64 | - |
|
65 | - /** |
|
66 | - * Constructor |
|
67 | - */ |
|
68 | - public function __construct() { |
|
69 | - add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) ); |
|
70 | - add_action( 'init', array( $this, 'download_monitor_init' ) ); |
|
71 | - add_action( 'init', array( $this, 'woocommerce_init' ) ); |
|
72 | - add_action( 'init', array( $this, 'wp_user_avatar_init' ) ); |
|
73 | - add_action( 'init', array( $this, 'facetwp_init' ) ); |
|
74 | - add_action( 'init', array( $this, 'lsx_team_init' ) ); |
|
75 | - add_action( 'init', array( $this, 'lsx_article_init' ) ); |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Return an instance of this class. |
|
80 | - * |
|
81 | - * @since 1.0.0 |
|
82 | - * |
|
83 | - * @return object \lsx_health_plan\classes\Integrations() A single instance of this class. |
|
84 | - */ |
|
85 | - public static function get_instance() { |
|
86 | - // If the single instance hasn't been set, set it now. |
|
87 | - if ( null === self::$instance ) { |
|
88 | - self::$instance = new self(); |
|
89 | - } |
|
90 | - return self::$instance; |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * Includes the Post Search Ajax if it is there. |
|
95 | - * |
|
96 | - * @return void |
|
97 | - */ |
|
98 | - public function cmb2_post_search_ajax() { |
|
99 | - require_once LSX_HEALTH_PLAN_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php'; |
|
100 | - if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) { |
|
101 | - $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance(); |
|
102 | - } |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * Includes the Post Search Ajax if it is there. |
|
107 | - * |
|
108 | - * @return void |
|
109 | - */ |
|
110 | - public function download_monitor_init() { |
|
111 | - if ( function_exists( 'download_monitor' ) ) { |
|
112 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-download-monitor.php'; |
|
113 | - $this->download_monitor = Download_Monitor::get_instance(); |
|
114 | - } |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * Includes the Woocommerce functions. |
|
119 | - * |
|
120 | - * @return void |
|
121 | - */ |
|
122 | - public function woocommerce_init() { |
|
123 | - if ( function_exists( 'WC' ) ) { |
|
124 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-woocommerce.php'; |
|
125 | - $this->woocommerce = Woocommerce::get_instance(); |
|
126 | - } |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * Includes the Woocommerce functions. |
|
131 | - * |
|
132 | - * @return void |
|
133 | - */ |
|
134 | - public function wp_user_avatar_init() { |
|
135 | - if ( class_exists( 'WP_User_Avatar_Setup' ) ) { |
|
136 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-wp-user-avatar.php'; |
|
137 | - $this->wp_user_avatar = WP_User_Avatar::get_instance(); |
|
138 | - } |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * Includes the FacetWP Indexer Filters. |
|
143 | - * |
|
144 | - * @return void |
|
145 | - */ |
|
146 | - public function facetwp_init() { |
|
147 | - if ( class_exists( 'FacetWP' ) ) { |
|
148 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-facetwp.php'; |
|
149 | - $this->facetwp = FacetWP::get_instance(); |
|
150 | - } |
|
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * Includes the LSX Team Integration. |
|
155 | - * |
|
156 | - * @return void |
|
157 | - */ |
|
158 | - public function lsx_team_init() { |
|
159 | - if ( class_exists( 'LSX_Team' ) ) { |
|
160 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-lsx-team.php'; |
|
161 | - $this->team = LSX_Team::get_instance(); |
|
162 | - } |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * Includes the Blog Integration. |
|
167 | - * |
|
168 | - * @return void |
|
169 | - */ |
|
170 | - public function lsx_article_init() { |
|
171 | - if ( wp_count_posts()->publish > 0 ) { |
|
172 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-articles.php'; |
|
173 | - $this->article = Articles::get_instance(); |
|
174 | - } |
|
175 | - } |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * |
|
16 | + * @var object \lsx_health_plan\classes\Integrations() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | + |
|
20 | + /** |
|
21 | + * Holds class instance |
|
22 | + * |
|
23 | + * @since 1.0.0 |
|
24 | + * |
|
25 | + * @var object \MAG_CMB2_Field_Post_Search_Ajax() |
|
26 | + */ |
|
27 | + public $cmb2_post_search_ajax = false; |
|
28 | + |
|
29 | + /** |
|
30 | + * Holds class instance |
|
31 | + * |
|
32 | + * @since 1.0.0 |
|
33 | + * |
|
34 | + * @var object \lsx_health_plan\classes\Download_Monitor() |
|
35 | + */ |
|
36 | + public $download_monitor = false; |
|
37 | + |
|
38 | + /** |
|
39 | + * Holds class instance |
|
40 | + * |
|
41 | + * @since 1.0.0 |
|
42 | + * |
|
43 | + * @var object \lsx_health_plan\classes\Woocommerce() |
|
44 | + */ |
|
45 | + public $woocommerce = false; |
|
46 | + |
|
47 | + /** |
|
48 | + * Holds class instance |
|
49 | + * |
|
50 | + * @since 1.0.0 |
|
51 | + * |
|
52 | + * @var object \lsx_health_plan\classes\WP_User_Avatar() |
|
53 | + */ |
|
54 | + public $wp_user_avatar = false; |
|
55 | + |
|
56 | + /** |
|
57 | + * Holds class instance |
|
58 | + * |
|
59 | + * @since 1.0.0 |
|
60 | + * |
|
61 | + * @var object \lsx_health_plan\classes\FacetWP() |
|
62 | + */ |
|
63 | + public $facetwp = false; |
|
64 | + |
|
65 | + /** |
|
66 | + * Constructor |
|
67 | + */ |
|
68 | + public function __construct() { |
|
69 | + add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) ); |
|
70 | + add_action( 'init', array( $this, 'download_monitor_init' ) ); |
|
71 | + add_action( 'init', array( $this, 'woocommerce_init' ) ); |
|
72 | + add_action( 'init', array( $this, 'wp_user_avatar_init' ) ); |
|
73 | + add_action( 'init', array( $this, 'facetwp_init' ) ); |
|
74 | + add_action( 'init', array( $this, 'lsx_team_init' ) ); |
|
75 | + add_action( 'init', array( $this, 'lsx_article_init' ) ); |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Return an instance of this class. |
|
80 | + * |
|
81 | + * @since 1.0.0 |
|
82 | + * |
|
83 | + * @return object \lsx_health_plan\classes\Integrations() A single instance of this class. |
|
84 | + */ |
|
85 | + public static function get_instance() { |
|
86 | + // If the single instance hasn't been set, set it now. |
|
87 | + if ( null === self::$instance ) { |
|
88 | + self::$instance = new self(); |
|
89 | + } |
|
90 | + return self::$instance; |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * Includes the Post Search Ajax if it is there. |
|
95 | + * |
|
96 | + * @return void |
|
97 | + */ |
|
98 | + public function cmb2_post_search_ajax() { |
|
99 | + require_once LSX_HEALTH_PLAN_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php'; |
|
100 | + if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) { |
|
101 | + $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance(); |
|
102 | + } |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * Includes the Post Search Ajax if it is there. |
|
107 | + * |
|
108 | + * @return void |
|
109 | + */ |
|
110 | + public function download_monitor_init() { |
|
111 | + if ( function_exists( 'download_monitor' ) ) { |
|
112 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-download-monitor.php'; |
|
113 | + $this->download_monitor = Download_Monitor::get_instance(); |
|
114 | + } |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * Includes the Woocommerce functions. |
|
119 | + * |
|
120 | + * @return void |
|
121 | + */ |
|
122 | + public function woocommerce_init() { |
|
123 | + if ( function_exists( 'WC' ) ) { |
|
124 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-woocommerce.php'; |
|
125 | + $this->woocommerce = Woocommerce::get_instance(); |
|
126 | + } |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * Includes the Woocommerce functions. |
|
131 | + * |
|
132 | + * @return void |
|
133 | + */ |
|
134 | + public function wp_user_avatar_init() { |
|
135 | + if ( class_exists( 'WP_User_Avatar_Setup' ) ) { |
|
136 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-wp-user-avatar.php'; |
|
137 | + $this->wp_user_avatar = WP_User_Avatar::get_instance(); |
|
138 | + } |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * Includes the FacetWP Indexer Filters. |
|
143 | + * |
|
144 | + * @return void |
|
145 | + */ |
|
146 | + public function facetwp_init() { |
|
147 | + if ( class_exists( 'FacetWP' ) ) { |
|
148 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-facetwp.php'; |
|
149 | + $this->facetwp = FacetWP::get_instance(); |
|
150 | + } |
|
151 | + } |
|
152 | + |
|
153 | + /** |
|
154 | + * Includes the LSX Team Integration. |
|
155 | + * |
|
156 | + * @return void |
|
157 | + */ |
|
158 | + public function lsx_team_init() { |
|
159 | + if ( class_exists( 'LSX_Team' ) ) { |
|
160 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-lsx-team.php'; |
|
161 | + $this->team = LSX_Team::get_instance(); |
|
162 | + } |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * Includes the Blog Integration. |
|
167 | + * |
|
168 | + * @return void |
|
169 | + */ |
|
170 | + public function lsx_article_init() { |
|
171 | + if ( wp_count_posts()->publish > 0 ) { |
|
172 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-articles.php'; |
|
173 | + $this->article = Articles::get_instance(); |
|
174 | + } |
|
175 | + } |
|
176 | 176 | } |
@@ -13,7 +13,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -8,116 +8,116 @@ |
||
8 | 8 | */ |
9 | 9 | class Core { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\Core() |
|
17 | - */ |
|
18 | - protected static $instance = null; |
|
19 | - |
|
20 | - /** |
|
21 | - * @var object \lsx_health_plan\classes\Setup(); |
|
22 | - */ |
|
23 | - public $setup; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var object \lsx_health_plan\classes\Admin(); |
|
27 | - */ |
|
28 | - public $admin; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var object \lsx_health_plan\classes\Frontend(); |
|
32 | - */ |
|
33 | - public $frontend; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var object \lsx_health_plan\classes\Integrations(); |
|
37 | - */ |
|
38 | - public $integrations; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var object \lsx_health_plan\classes\Integrations(); |
|
42 | - */ |
|
43 | - public $scpo_engine; |
|
44 | - |
|
45 | - /** |
|
46 | - * Constructor |
|
47 | - */ |
|
48 | - public function __construct() { |
|
49 | - $this->load_includes(); |
|
50 | - $this->load_classes(); |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * Return an instance of this class. |
|
55 | - * |
|
56 | - * @since 1.0.0 |
|
57 | - * |
|
58 | - * @return object \lsx_health_plan\classes\Core() A single instance of this class. |
|
59 | - */ |
|
60 | - public static function get_instance() { |
|
61 | - |
|
62 | - // If the single instance hasn't been set, set it now. |
|
63 | - if ( null === self::$instance ) { |
|
64 | - self::$instance = new self(); |
|
65 | - } |
|
66 | - |
|
67 | - return self::$instance; |
|
68 | - |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Loads the variable classes and the static classes. |
|
73 | - */ |
|
74 | - private function load_classes() { |
|
75 | - |
|
76 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/class-setup.php'; |
|
77 | - $this->setup = Setup::get_instance(); |
|
78 | - |
|
79 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/class-admin.php'; |
|
80 | - $this->admin = Admin::get_instance(); |
|
81 | - |
|
82 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/class-frontend.php'; |
|
83 | - $this->frontend = Frontend::get_instance(); |
|
84 | - |
|
85 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/class-integrations.php'; |
|
86 | - $this->integrations = Integrations::get_instance(); |
|
87 | - |
|
88 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/class-scpo-engine.php'; |
|
89 | - $this->scpo_engine = SCPO_Engine::get_instance(); |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * Loads the plugin functions. |
|
94 | - */ |
|
95 | - private function load_includes() { |
|
96 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/functions.php'; |
|
97 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/functions/triggers.php'; |
|
98 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/functions/recipes.php'; |
|
99 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/functions/plan.php'; |
|
100 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/conditionals.php'; |
|
101 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags.php'; |
|
102 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/exercise.php'; |
|
103 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/gallery.php'; |
|
104 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/plan.php'; |
|
105 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/shortcodes.php'; |
|
106 | - } |
|
107 | - |
|
108 | - /** |
|
109 | - * Returns the post types currently active |
|
110 | - * |
|
111 | - * @return void |
|
112 | - */ |
|
113 | - public function get_post_types() { |
|
114 | - $post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) ); |
|
115 | - foreach ( $post_types as $index => $post_type ) { |
|
116 | - $is_disabled = \cmb2_get_option( 'lsx_health_plan_options', $post_type . '_disabled', false ); |
|
117 | - if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
118 | - unset( $post_types[ $index ] ); |
|
119 | - } |
|
120 | - } |
|
121 | - return $post_types; |
|
122 | - } |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * |
|
16 | + * @var object \lsx_health_plan\classes\Core() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | + |
|
20 | + /** |
|
21 | + * @var object \lsx_health_plan\classes\Setup(); |
|
22 | + */ |
|
23 | + public $setup; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var object \lsx_health_plan\classes\Admin(); |
|
27 | + */ |
|
28 | + public $admin; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var object \lsx_health_plan\classes\Frontend(); |
|
32 | + */ |
|
33 | + public $frontend; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var object \lsx_health_plan\classes\Integrations(); |
|
37 | + */ |
|
38 | + public $integrations; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var object \lsx_health_plan\classes\Integrations(); |
|
42 | + */ |
|
43 | + public $scpo_engine; |
|
44 | + |
|
45 | + /** |
|
46 | + * Constructor |
|
47 | + */ |
|
48 | + public function __construct() { |
|
49 | + $this->load_includes(); |
|
50 | + $this->load_classes(); |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * Return an instance of this class. |
|
55 | + * |
|
56 | + * @since 1.0.0 |
|
57 | + * |
|
58 | + * @return object \lsx_health_plan\classes\Core() A single instance of this class. |
|
59 | + */ |
|
60 | + public static function get_instance() { |
|
61 | + |
|
62 | + // If the single instance hasn't been set, set it now. |
|
63 | + if ( null === self::$instance ) { |
|
64 | + self::$instance = new self(); |
|
65 | + } |
|
66 | + |
|
67 | + return self::$instance; |
|
68 | + |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Loads the variable classes and the static classes. |
|
73 | + */ |
|
74 | + private function load_classes() { |
|
75 | + |
|
76 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/class-setup.php'; |
|
77 | + $this->setup = Setup::get_instance(); |
|
78 | + |
|
79 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/class-admin.php'; |
|
80 | + $this->admin = Admin::get_instance(); |
|
81 | + |
|
82 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/class-frontend.php'; |
|
83 | + $this->frontend = Frontend::get_instance(); |
|
84 | + |
|
85 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/class-integrations.php'; |
|
86 | + $this->integrations = Integrations::get_instance(); |
|
87 | + |
|
88 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/class-scpo-engine.php'; |
|
89 | + $this->scpo_engine = SCPO_Engine::get_instance(); |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * Loads the plugin functions. |
|
94 | + */ |
|
95 | + private function load_includes() { |
|
96 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/functions.php'; |
|
97 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/functions/triggers.php'; |
|
98 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/functions/recipes.php'; |
|
99 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/functions/plan.php'; |
|
100 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/conditionals.php'; |
|
101 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags.php'; |
|
102 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/exercise.php'; |
|
103 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/gallery.php'; |
|
104 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/plan.php'; |
|
105 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/shortcodes.php'; |
|
106 | + } |
|
107 | + |
|
108 | + /** |
|
109 | + * Returns the post types currently active |
|
110 | + * |
|
111 | + * @return void |
|
112 | + */ |
|
113 | + public function get_post_types() { |
|
114 | + $post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) ); |
|
115 | + foreach ( $post_types as $index => $post_type ) { |
|
116 | + $is_disabled = \cmb2_get_option( 'lsx_health_plan_options', $post_type . '_disabled', false ); |
|
117 | + if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
118 | + unset( $post_types[ $index ] ); |
|
119 | + } |
|
120 | + } |
|
121 | + return $post_types; |
|
122 | + } |
|
123 | 123 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | $tab_experience['content'] = get_post_meta( get_the_ID(), 'team_member_experience', true ); |
9 | 9 | $tab_experience['shortcode'] = ''; |
10 | 10 | if ( ! empty( $tab_experience['content'] ) ) { |
11 | - $tabs[] = $tab_experience; |
|
11 | + $tabs[] = $tab_experience; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Tab Featured plan |
@@ -19,36 +19,36 @@ discard block |
||
19 | 19 | |
20 | 20 | if ( ! empty( $tab_plans['posts'] ) ) { |
21 | 21 | |
22 | - $plan_content = ''; |
|
22 | + $plan_content = ''; |
|
23 | 23 | |
24 | - $include = implode( ',', $tab_plans['posts'] ); |
|
25 | - $args = array( |
|
26 | - 'orderby' => 'menu_order', |
|
27 | - 'order' => 'ASC', |
|
28 | - 'post_type' => 'plan', |
|
29 | - 'post__in' => $tab_plans['posts'], |
|
30 | - ); |
|
31 | - $plan_query = new WP_Query( $args ); |
|
24 | + $include = implode( ',', $tab_plans['posts'] ); |
|
25 | + $args = array( |
|
26 | + 'orderby' => 'menu_order', |
|
27 | + 'order' => 'ASC', |
|
28 | + 'post_type' => 'plan', |
|
29 | + 'post__in' => $tab_plans['posts'], |
|
30 | + ); |
|
31 | + $plan_query = new WP_Query( $args ); |
|
32 | 32 | |
33 | - $plan_content = '<div class="all-plans-block plan-grid block-all-plans-block team-member-plans"><div class="row">'; |
|
33 | + $plan_content = '<div class="all-plans-block plan-grid block-all-plans-block team-member-plans"><div class="row">'; |
|
34 | 34 | |
35 | - if ( $plan_query->have_posts() ) { |
|
36 | - add_action( 'lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10 ); |
|
37 | - while ( $plan_query->have_posts() ) { |
|
38 | - $plan_query->the_post(); |
|
39 | - ob_start(); |
|
40 | - include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-plan.php'; |
|
41 | - $plan_content .= ob_get_clean(); |
|
42 | - } |
|
43 | - wp_reset_postdata(); |
|
44 | - remove_action( 'lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10 ); |
|
45 | - } |
|
46 | - $plan_content .= '</div></div>'; |
|
35 | + if ( $plan_query->have_posts() ) { |
|
36 | + add_action( 'lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10 ); |
|
37 | + while ( $plan_query->have_posts() ) { |
|
38 | + $plan_query->the_post(); |
|
39 | + ob_start(); |
|
40 | + include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-plan.php'; |
|
41 | + $plan_content .= ob_get_clean(); |
|
42 | + } |
|
43 | + wp_reset_postdata(); |
|
44 | + remove_action( 'lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10 ); |
|
45 | + } |
|
46 | + $plan_content .= '</div></div>'; |
|
47 | 47 | |
48 | - $tab_plans['content'] = $plan_content; |
|
48 | + $tab_plans['content'] = $plan_content; |
|
49 | 49 | } |
50 | 50 | if ( ! empty( $tab_plans['content'] ) ) { |
51 | - $tabs[] = $tab_plans; |
|
51 | + $tabs[] = $tab_plans; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | $tab_testimonial['content'] = ''; |
60 | 60 | |
61 | 61 | if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) { |
62 | - if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
63 | - $columns = count( $tab_testimonial['posts'] ); |
|
64 | - } else { |
|
65 | - $columns = 3; |
|
66 | - } |
|
62 | + if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
63 | + $columns = count( $tab_testimonial['posts'] ); |
|
64 | + } else { |
|
65 | + $columns = 3; |
|
66 | + } |
|
67 | 67 | |
68 | - $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
69 | - $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
|
70 | - $tabs[] = $tab_testimonial; |
|
68 | + $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
69 | + $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
|
70 | + $tabs[] = $tab_testimonial; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if ( count( $tabs ) > 0 ) : ?> |
@@ -13,5 +13,5 @@ |
||
13 | 13 | * @return boolean |
14 | 14 | */ |
15 | 15 | function disable_sharing( $disabled ) { |
16 | - return true; |
|
16 | + return true; |
|
17 | 17 | } |