@@ -8,66 +8,66 @@ |
||
8 | 8 | */ |
9 | 9 | class Admin { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\integrations\woocommerce\Admin() |
|
17 | - */ |
|
18 | - protected static $instance = null; |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * |
|
16 | + * @var object \lsx_health_plan\classes\integrations\woocommerce\Admin() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Constructor |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - add_action( 'cmb2_admin_init', array( $this, 'products_metaboxes' ), 5 ); |
|
25 | - } |
|
20 | + /** |
|
21 | + * Constructor |
|
22 | + */ |
|
23 | + public function __construct() { |
|
24 | + add_action( 'cmb2_admin_init', array( $this, 'products_metaboxes' ), 5 ); |
|
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\integrations\woocommerce\Admin() 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\integrations\woocommerce\Admin() 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 | - * Define the product metabox on the plan post type |
|
44 | - */ |
|
45 | - public function products_metaboxes() { |
|
46 | - $cmb = new_cmb2_box( |
|
47 | - array( |
|
48 | - 'id' => 'plan_product_metabox', |
|
49 | - 'title' => __( 'Products', 'lsx-health-plan' ), |
|
50 | - 'object_types' => array( 'plan' ), // Post type. |
|
51 | - 'context' => 'side', |
|
52 | - 'priority' => 'low', |
|
53 | - 'show_names' => true, |
|
54 | - ) |
|
55 | - ); |
|
42 | + /** |
|
43 | + * Define the product metabox on the plan post type |
|
44 | + */ |
|
45 | + public function products_metaboxes() { |
|
46 | + $cmb = new_cmb2_box( |
|
47 | + array( |
|
48 | + 'id' => 'plan_product_metabox', |
|
49 | + 'title' => __( 'Products', 'lsx-health-plan' ), |
|
50 | + 'object_types' => array( 'plan' ), // Post type. |
|
51 | + 'context' => 'side', |
|
52 | + 'priority' => 'low', |
|
53 | + 'show_names' => true, |
|
54 | + ) |
|
55 | + ); |
|
56 | 56 | |
57 | - $cmb->add_field( |
|
58 | - array( |
|
59 | - 'name' => __( 'Search your products', 'lsx-health-plan' ), |
|
60 | - 'desc' => __( 'Connect the product(s) which sell access to this plan.', 'lsx-health-plan' ), |
|
61 | - 'id' => 'plan_product', |
|
62 | - 'type' => 'post_search_ajax', |
|
63 | - 'limit' => 5, // Limit selection to X items only (default 1). |
|
64 | - 'sortable' => false, // Allow selected items to be sortable (default false). |
|
65 | - 'query_args' => array( |
|
66 | - 'post_type' => 'product', |
|
67 | - 'post_status' => array( 'publish' ), |
|
68 | - 'posts_per_page' => -1, |
|
69 | - ), |
|
70 | - ) |
|
71 | - ); |
|
72 | - } |
|
57 | + $cmb->add_field( |
|
58 | + array( |
|
59 | + 'name' => __( 'Search your products', 'lsx-health-plan' ), |
|
60 | + 'desc' => __( 'Connect the product(s) which sell access to this plan.', 'lsx-health-plan' ), |
|
61 | + 'id' => 'plan_product', |
|
62 | + 'type' => 'post_search_ajax', |
|
63 | + 'limit' => 5, // Limit selection to X items only (default 1). |
|
64 | + 'sortable' => false, // Allow selected items to be sortable (default false). |
|
65 | + 'query_args' => array( |
|
66 | + 'post_type' => 'product', |
|
67 | + 'post_status' => array( 'publish' ), |
|
68 | + 'posts_per_page' => -1, |
|
69 | + ), |
|
70 | + ) |
|
71 | + ); |
|
72 | + } |
|
73 | 73 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * Constructor |
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | - add_action( 'cmb2_admin_init', array( $this, 'products_metaboxes' ), 5 ); |
|
24 | + add_action('cmb2_admin_init', array($this, 'products_metaboxes'), 5); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -33,7 +33,7 @@ discard block |
||
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; |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $cmb = new_cmb2_box( |
47 | 47 | array( |
48 | 48 | 'id' => 'plan_product_metabox', |
49 | - 'title' => __( 'Products', 'lsx-health-plan' ), |
|
50 | - 'object_types' => array( 'plan' ), // Post type. |
|
49 | + 'title' => __('Products', 'lsx-health-plan'), |
|
50 | + 'object_types' => array('plan'), // Post type. |
|
51 | 51 | 'context' => 'side', |
52 | 52 | 'priority' => 'low', |
53 | 53 | 'show_names' => true, |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | |
57 | 57 | $cmb->add_field( |
58 | 58 | array( |
59 | - 'name' => __( 'Search your products', 'lsx-health-plan' ), |
|
60 | - 'desc' => __( 'Connect the product(s) which sell access to this plan.', 'lsx-health-plan' ), |
|
59 | + 'name' => __('Search your products', 'lsx-health-plan'), |
|
60 | + 'desc' => __('Connect the product(s) which sell access to this plan.', 'lsx-health-plan'), |
|
61 | 61 | 'id' => 'plan_product', |
62 | 62 | 'type' => 'post_search_ajax', |
63 | - 'limit' => 5, // Limit selection to X items only (default 1). |
|
63 | + 'limit' => 5, // Limit selection to X items only (default 1). |
|
64 | 64 | 'sortable' => false, // Allow selected items to be sortable (default false). |
65 | 65 | 'query_args' => array( |
66 | 66 | 'post_type' => 'product', |
67 | - 'post_status' => array( 'publish' ), |
|
67 | + 'post_status' => array('publish'), |
|
68 | 68 | 'posts_per_page' => -1, |
69 | 69 | ), |
70 | 70 | ) |
@@ -8,46 +8,46 @@ |
||
8 | 8 | */ |
9 | 9 | class WP_User_Avatar { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\Woocommerce() |
|
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\Woocommerce() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Constructor |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - add_filter( 'wpua_profile_title', array( $this, 'profile_title' ), 10, 1 ); |
|
25 | - } |
|
20 | + /** |
|
21 | + * Constructor |
|
22 | + */ |
|
23 | + public function __construct() { |
|
24 | + add_filter( 'wpua_profile_title', array( $this, 'profile_title' ), 10, 1 ); |
|
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\Woocommerce() 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\Woocommerce() 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 | - * Changes the profile title |
|
44 | - * |
|
45 | - * @param string $title |
|
46 | - * @return string |
|
47 | - */ |
|
48 | - public function profile_title( $title ) { |
|
49 | - $title = '<h3>' . __( 'My Profile', 'lsx-health-plan' ) . '</h3>'; |
|
50 | - $title .= '<p class="tagline">' . __( 'Please upload an image of yourself in .jpeg format. Images should be square, to best fit the cropping area, and files sizes kept below 500kb.', 'lsx-health-plan' ) . '</p>'; |
|
51 | - return $title; |
|
52 | - } |
|
42 | + /** |
|
43 | + * Changes the profile title |
|
44 | + * |
|
45 | + * @param string $title |
|
46 | + * @return string |
|
47 | + */ |
|
48 | + public function profile_title( $title ) { |
|
49 | + $title = '<h3>' . __( 'My Profile', 'lsx-health-plan' ) . '</h3>'; |
|
50 | + $title .= '<p class="tagline">' . __( 'Please upload an image of yourself in .jpeg format. Images should be square, to best fit the cropping area, and files sizes kept below 500kb.', 'lsx-health-plan' ) . '</p>'; |
|
51 | + return $title; |
|
52 | + } |
|
53 | 53 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * Constructor |
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | - add_filter( 'wpua_profile_title', array( $this, 'profile_title' ), 10, 1 ); |
|
24 | + add_filter('wpua_profile_title', array($this, 'profile_title'), 10, 1); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -33,7 +33,7 @@ discard block |
||
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; |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | * @param string $title |
46 | 46 | * @return string |
47 | 47 | */ |
48 | - public function profile_title( $title ) { |
|
49 | - $title = '<h3>' . __( 'My Profile', 'lsx-health-plan' ) . '</h3>'; |
|
50 | - $title .= '<p class="tagline">' . __( 'Please upload an image of yourself in .jpeg format. Images should be square, to best fit the cropping area, and files sizes kept below 500kb.', 'lsx-health-plan' ) . '</p>'; |
|
48 | + public function profile_title($title) { |
|
49 | + $title = '<h3>' . __('My Profile', 'lsx-health-plan') . '</h3>'; |
|
50 | + $title .= '<p class="tagline">' . __('Please upload an image of yourself in .jpeg format. Images should be square, to best fit the cropping area, and files sizes kept below 500kb.', 'lsx-health-plan') . '</p>'; |
|
51 | 51 | return $title; |
52 | 52 | } |
53 | 53 | } |
@@ -10,186 +10,186 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class Settings_Theme { |
12 | 12 | |
13 | - /** |
|
14 | - * Holds class instance |
|
15 | - * |
|
16 | - * @since 1.0.0 |
|
17 | - * |
|
18 | - * @var object \lsx_health_plan\classes\admin\Settings_Theme() |
|
19 | - */ |
|
20 | - protected static $instance = null; |
|
13 | + /** |
|
14 | + * Holds class instance |
|
15 | + * |
|
16 | + * @since 1.0.0 |
|
17 | + * |
|
18 | + * @var object \lsx_health_plan\classes\admin\Settings_Theme() |
|
19 | + */ |
|
20 | + protected static $instance = null; |
|
21 | 21 | |
22 | - /** |
|
23 | - * Will return true if this is the LSX Search settings page. |
|
24 | - * |
|
25 | - * @var array |
|
26 | - */ |
|
27 | - public $is_options_page = false; |
|
22 | + /** |
|
23 | + * Will return true if this is the LSX Search settings page. |
|
24 | + * |
|
25 | + * @var array |
|
26 | + */ |
|
27 | + public $is_options_page = false; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Holds the id and labels for the navigation. |
|
31 | - * |
|
32 | - * @var array |
|
33 | - */ |
|
34 | - public $navigation = array(); |
|
29 | + /** |
|
30 | + * Holds the id and labels for the navigation. |
|
31 | + * |
|
32 | + * @var array |
|
33 | + */ |
|
34 | + public $navigation = array(); |
|
35 | 35 | |
36 | - /** |
|
37 | - * Constructor |
|
38 | - */ |
|
39 | - public function __construct() { |
|
40 | - add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
41 | - add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
42 | - add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
43 | - add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
44 | - add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
45 | - add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
46 | - add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
47 | - add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
48 | - } |
|
36 | + /** |
|
37 | + * Constructor |
|
38 | + */ |
|
39 | + public function __construct() { |
|
40 | + add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
41 | + add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
42 | + add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
43 | + add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
44 | + add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
45 | + add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
46 | + add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
47 | + add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * Return an instance of this class. |
|
52 | - * |
|
53 | - * @since 1.0.0 |
|
54 | - * |
|
55 | - * @return object \lsx_health_plan\classes\admin\Settings_Theme() A single instance of this class. |
|
56 | - */ |
|
57 | - public static function get_instance() { |
|
58 | - // If the single instance hasn't been set, set it now. |
|
59 | - if ( null == self::$instance ) { |
|
60 | - self::$instance = new self(); |
|
61 | - } |
|
62 | - return self::$instance; |
|
63 | - } |
|
50 | + /** |
|
51 | + * Return an instance of this class. |
|
52 | + * |
|
53 | + * @since 1.0.0 |
|
54 | + * |
|
55 | + * @return object \lsx_health_plan\classes\admin\Settings_Theme() A single instance of this class. |
|
56 | + */ |
|
57 | + public static function get_instance() { |
|
58 | + // If the single instance hasn't been set, set it now. |
|
59 | + if ( null == self::$instance ) { |
|
60 | + self::$instance = new self(); |
|
61 | + } |
|
62 | + return self::$instance; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Disable CMB2 styles on front end forms. |
|
67 | - * |
|
68 | - * @return bool $enabled Whether to enable (enqueue) styles. |
|
69 | - */ |
|
70 | - public function disable_cmb2_styles( $enabled ) { |
|
71 | - if ( is_admin() ) { |
|
72 | - $current_screen = get_current_screen(); |
|
73 | - if ( is_object( $current_screen ) && 'plan_page_lsx_health_plan_options' === $current_screen->id ) { |
|
74 | - $enabled = false; |
|
75 | - } |
|
76 | - } |
|
77 | - return $enabled; |
|
78 | - } |
|
65 | + /** |
|
66 | + * Disable CMB2 styles on front end forms. |
|
67 | + * |
|
68 | + * @return bool $enabled Whether to enable (enqueue) styles. |
|
69 | + */ |
|
70 | + public function disable_cmb2_styles( $enabled ) { |
|
71 | + if ( is_admin() ) { |
|
72 | + $current_screen = get_current_screen(); |
|
73 | + if ( is_object( $current_screen ) && 'plan_page_lsx_health_plan_options' === $current_screen->id ) { |
|
74 | + $enabled = false; |
|
75 | + } |
|
76 | + } |
|
77 | + return $enabled; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * Generates the tabbed navigation for the settings page. |
|
82 | - * |
|
83 | - * @param string $cmb_id |
|
84 | - * @param string $object_id |
|
85 | - * @param string $object_type |
|
86 | - * @param object $cmb2_obj |
|
87 | - * @return void |
|
88 | - */ |
|
89 | - public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
90 | - if ( 'lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type ) { |
|
91 | - $this->navigation = array(); |
|
92 | - $this->is_options_page = true; |
|
93 | - if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
94 | - foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
95 | - if ( 'title' === $field['type'] ) { |
|
96 | - $this->navigation[ $field_index ] = $field['name']; |
|
97 | - } |
|
98 | - } |
|
99 | - } |
|
100 | - $this->output_navigation(); |
|
101 | - } |
|
102 | - } |
|
80 | + /** |
|
81 | + * Generates the tabbed navigation for the settings page. |
|
82 | + * |
|
83 | + * @param string $cmb_id |
|
84 | + * @param string $object_id |
|
85 | + * @param string $object_type |
|
86 | + * @param object $cmb2_obj |
|
87 | + * @return void |
|
88 | + */ |
|
89 | + public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
90 | + if ( 'lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type ) { |
|
91 | + $this->navigation = array(); |
|
92 | + $this->is_options_page = true; |
|
93 | + if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
94 | + foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
95 | + if ( 'title' === $field['type'] ) { |
|
96 | + $this->navigation[ $field_index ] = $field['name']; |
|
97 | + } |
|
98 | + } |
|
99 | + } |
|
100 | + $this->output_navigation(); |
|
101 | + } |
|
102 | + } |
|
103 | 103 | |
104 | - /** |
|
105 | - * Outputs the WP style navigation for the Settings page. |
|
106 | - * |
|
107 | - * @return void |
|
108 | - */ |
|
109 | - public function output_navigation() { |
|
110 | - if ( ! empty( $this->navigation ) ) { |
|
111 | - ?> |
|
104 | + /** |
|
105 | + * Outputs the WP style navigation for the Settings page. |
|
106 | + * |
|
107 | + * @return void |
|
108 | + */ |
|
109 | + public function output_navigation() { |
|
110 | + if ( ! empty( $this->navigation ) ) { |
|
111 | + ?> |
|
112 | 112 | <div class="wp-filter hide-if-no-js"> |
113 | 113 | <ul class="filter-links"> |
114 | 114 | <?php |
115 | - $first_tab = true; |
|
116 | - $total = count( $this->navigation ); |
|
117 | - $count = 0; |
|
118 | - $separator = ' |'; |
|
119 | - $selected_tab = ''; |
|
120 | - if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
121 | - $selected_tab = sanitize_text_field( $_GET['cmb_tab'] ); |
|
122 | - $selected_tab = 'settings_' . $selected_tab; |
|
123 | - } |
|
124 | - foreach ( $this->navigation as $key => $label ) { |
|
125 | - $count++; |
|
126 | - $current_css = ''; |
|
127 | - if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
128 | - $first_tab = false; |
|
129 | - $current_css = 'current'; |
|
130 | - } |
|
131 | - if ( $count === $total ) { |
|
132 | - $separator = ''; |
|
133 | - } |
|
134 | - ?> |
|
115 | + $first_tab = true; |
|
116 | + $total = count( $this->navigation ); |
|
117 | + $count = 0; |
|
118 | + $separator = ' |'; |
|
119 | + $selected_tab = ''; |
|
120 | + if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
121 | + $selected_tab = sanitize_text_field( $_GET['cmb_tab'] ); |
|
122 | + $selected_tab = 'settings_' . $selected_tab; |
|
123 | + } |
|
124 | + foreach ( $this->navigation as $key => $label ) { |
|
125 | + $count++; |
|
126 | + $current_css = ''; |
|
127 | + if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
128 | + $first_tab = false; |
|
129 | + $current_css = 'current'; |
|
130 | + } |
|
131 | + if ( $count === $total ) { |
|
132 | + $separator = ''; |
|
133 | + } |
|
134 | + ?> |
|
135 | 135 | <li><a href="#" class="<?php echo esc_attr( $current_css ); ?>" data-sort="<?php echo esc_attr( $key ); ?>_tab"><?php echo esc_attr( $label ); ?></a><?php echo esc_attr( $separator ); ?></li> |
136 | 136 | <?php |
137 | - } |
|
138 | - ?> |
|
137 | + } |
|
138 | + ?> |
|
139 | 139 | </ul> |
140 | 140 | </div> |
141 | 141 | <?php |
142 | - } |
|
143 | - } |
|
142 | + } |
|
143 | + } |
|
144 | 144 | |
145 | - /** |
|
146 | - * Outputs the opening tab div. |
|
147 | - * |
|
148 | - * @param object $field CMB2_Field(); |
|
149 | - * @return void |
|
150 | - */ |
|
151 | - public function output_tab_open_div( $field ) { |
|
152 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
153 | - ?> |
|
145 | + /** |
|
146 | + * Outputs the opening tab div. |
|
147 | + * |
|
148 | + * @param object $field CMB2_Field(); |
|
149 | + * @return void |
|
150 | + */ |
|
151 | + public function output_tab_open_div( $field ) { |
|
152 | + if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
153 | + ?> |
|
154 | 154 | <div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden"> |
155 | 155 | <?php |
156 | - } |
|
157 | - } |
|
156 | + } |
|
157 | + } |
|
158 | 158 | |
159 | - /** |
|
160 | - * Outputs the opening closing div. |
|
161 | - * |
|
162 | - * @param object $field CMB2_Field(); |
|
163 | - * @return void |
|
164 | - */ |
|
165 | - public function output_tab_closing_div( $field ) { |
|
166 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
167 | - ?> |
|
159 | + /** |
|
160 | + * Outputs the opening closing div. |
|
161 | + * |
|
162 | + * @param object $field CMB2_Field(); |
|
163 | + * @return void |
|
164 | + */ |
|
165 | + public function output_tab_closing_div( $field ) { |
|
166 | + if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
167 | + ?> |
|
168 | 168 | </div> |
169 | 169 | <?php |
170 | - } |
|
171 | - } |
|
170 | + } |
|
171 | + } |
|
172 | 172 | |
173 | - public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
174 | - return; |
|
175 | - } |
|
173 | + public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
174 | + return; |
|
175 | + } |
|
176 | 176 | |
177 | - public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
178 | - return ''; |
|
179 | - } |
|
177 | + public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
178 | + return ''; |
|
179 | + } |
|
180 | 180 | |
181 | - /** |
|
182 | - * Outputs the Script for the tabbed navigation. |
|
183 | - * |
|
184 | - * @param string $cmb_id |
|
185 | - * @param string $object_id |
|
186 | - * @param string $object_type |
|
187 | - * @param object $cmb2_obj |
|
188 | - * @return void |
|
189 | - */ |
|
190 | - public function navigation_js( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
191 | - if ( 'lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type ) { |
|
192 | - ?> |
|
181 | + /** |
|
182 | + * Outputs the Script for the tabbed navigation. |
|
183 | + * |
|
184 | + * @param string $cmb_id |
|
185 | + * @param string $object_id |
|
186 | + * @param string $object_type |
|
187 | + * @param object $cmb2_obj |
|
188 | + * @return void |
|
189 | + */ |
|
190 | + public function navigation_js( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
191 | + if ( 'lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type ) { |
|
192 | + ?> |
|
193 | 193 | <script> |
194 | 194 | var LSX_HP_CMB2 = Object.create( null ); |
195 | 195 | |
@@ -261,25 +261,25 @@ discard block |
||
261 | 261 | } )( jQuery, window, document ); |
262 | 262 | </script> |
263 | 263 | <?php |
264 | - } |
|
265 | - } |
|
264 | + } |
|
265 | + } |
|
266 | 266 | |
267 | - /** |
|
268 | - * This will add the tab selection to the url. |
|
269 | - * |
|
270 | - * @param string $url |
|
271 | - * @return void |
|
272 | - */ |
|
273 | - public function add_tab_argument( $url ) { |
|
274 | - if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
275 | - $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
276 | - $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
277 | - if ( 'single' !== $tab_selection ) { |
|
278 | - $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
279 | - } else { |
|
280 | - $url = remove_query_arg( 'cmb_tab', $url ); |
|
281 | - } |
|
282 | - } |
|
283 | - return $url; |
|
284 | - } |
|
267 | + /** |
|
268 | + * This will add the tab selection to the url. |
|
269 | + * |
|
270 | + * @param string $url |
|
271 | + * @return void |
|
272 | + */ |
|
273 | + public function add_tab_argument( $url ) { |
|
274 | + if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
275 | + $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
276 | + $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
277 | + if ( 'single' !== $tab_selection ) { |
|
278 | + $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
279 | + } else { |
|
280 | + $url = remove_query_arg( 'cmb_tab', $url ); |
|
281 | + } |
|
282 | + } |
|
283 | + return $url; |
|
284 | + } |
|
285 | 285 | } |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | * Constructor |
38 | 38 | */ |
39 | 39 | public function __construct() { |
40 | - add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
41 | - add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
42 | - add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
43 | - add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
44 | - add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
45 | - add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
46 | - add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
47 | - add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
40 | + add_filter('cmb2_enqueue_css', array($this, 'disable_cmb2_styles'), 1, 1); |
|
41 | + add_action('cmb2_before_form', array($this, 'generate_navigation'), 10, 4); |
|
42 | + add_action('cmb2_before_title_field_row', array($this, 'output_tab_open_div'), 10, 1); |
|
43 | + add_action('cmb2_after_tab_closing_field_row', array($this, 'output_tab_closing_div'), 10, 1); |
|
44 | + add_action('cmb2_render_tab_closing', array($this, 'cmb2_render_callback_for_tab_closing'), 10, 5); |
|
45 | + add_filter('cmb2_sanitize_tab_closing', array($this, 'cmb2_sanitize_tab_closing_callback'), 10, 2); |
|
46 | + add_action('cmb2_after_form', array($this, 'navigation_js'), 10, 4); |
|
47 | + add_filter('cmb2_options_page_redirect_url', array($this, 'add_tab_argument'), 10, 1); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public static function get_instance() { |
58 | 58 | // If the single instance hasn't been set, set it now. |
59 | - if ( null == self::$instance ) { |
|
59 | + if (null == self::$instance) { |
|
60 | 60 | self::$instance = new self(); |
61 | 61 | } |
62 | 62 | return self::$instance; |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return bool $enabled Whether to enable (enqueue) styles. |
69 | 69 | */ |
70 | - public function disable_cmb2_styles( $enabled ) { |
|
71 | - if ( is_admin() ) { |
|
70 | + public function disable_cmb2_styles($enabled) { |
|
71 | + if (is_admin()) { |
|
72 | 72 | $current_screen = get_current_screen(); |
73 | - if ( is_object( $current_screen ) && 'plan_page_lsx_health_plan_options' === $current_screen->id ) { |
|
73 | + if (is_object($current_screen) && 'plan_page_lsx_health_plan_options' === $current_screen->id) { |
|
74 | 74 | $enabled = false; |
75 | 75 | } |
76 | 76 | } |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | * @param object $cmb2_obj |
87 | 87 | * @return void |
88 | 88 | */ |
89 | - public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
90 | - if ( 'lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type ) { |
|
89 | + public function generate_navigation($cmb_id, $object_id, $object_type, $cmb2_obj) { |
|
90 | + if ('lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type) { |
|
91 | 91 | $this->navigation = array(); |
92 | 92 | $this->is_options_page = true; |
93 | - if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
94 | - foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
95 | - if ( 'title' === $field['type'] ) { |
|
96 | - $this->navigation[ $field_index ] = $field['name']; |
|
93 | + if (isset($cmb2_obj->meta_box['fields']) && ! empty($cmb2_obj->meta_box['fields'])) { |
|
94 | + foreach ($cmb2_obj->meta_box['fields'] as $field_index => $field) { |
|
95 | + if ('title' === $field['type']) { |
|
96 | + $this->navigation[$field_index] = $field['name']; |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | } |
@@ -107,32 +107,32 @@ discard block |
||
107 | 107 | * @return void |
108 | 108 | */ |
109 | 109 | public function output_navigation() { |
110 | - if ( ! empty( $this->navigation ) ) { |
|
110 | + if ( ! empty($this->navigation)) { |
|
111 | 111 | ?> |
112 | 112 | <div class="wp-filter hide-if-no-js"> |
113 | 113 | <ul class="filter-links"> |
114 | 114 | <?php |
115 | 115 | $first_tab = true; |
116 | - $total = count( $this->navigation ); |
|
116 | + $total = count($this->navigation); |
|
117 | 117 | $count = 0; |
118 | 118 | $separator = ' |'; |
119 | 119 | $selected_tab = ''; |
120 | - if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
121 | - $selected_tab = sanitize_text_field( $_GET['cmb_tab'] ); |
|
120 | + if (isset($_GET['cmb_tab']) && '' !== $_GET['cmb_tab']) { |
|
121 | + $selected_tab = sanitize_text_field($_GET['cmb_tab']); |
|
122 | 122 | $selected_tab = 'settings_' . $selected_tab; |
123 | 123 | } |
124 | - foreach ( $this->navigation as $key => $label ) { |
|
124 | + foreach ($this->navigation as $key => $label) { |
|
125 | 125 | $count++; |
126 | 126 | $current_css = ''; |
127 | - if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
127 | + if ((true === $first_tab && '' === $selected_tab) || $key === $selected_tab) { |
|
128 | 128 | $first_tab = false; |
129 | 129 | $current_css = 'current'; |
130 | 130 | } |
131 | - if ( $count === $total ) { |
|
131 | + if ($count === $total) { |
|
132 | 132 | $separator = ''; |
133 | 133 | } |
134 | 134 | ?> |
135 | - <li><a href="#" class="<?php echo esc_attr( $current_css ); ?>" data-sort="<?php echo esc_attr( $key ); ?>_tab"><?php echo esc_attr( $label ); ?></a><?php echo esc_attr( $separator ); ?></li> |
|
135 | + <li><a href="#" class="<?php echo esc_attr($current_css); ?>" data-sort="<?php echo esc_attr($key); ?>_tab"><?php echo esc_attr($label); ?></a><?php echo esc_attr($separator); ?></li> |
|
136 | 136 | <?php |
137 | 137 | } |
138 | 138 | ?> |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | * @param object $field CMB2_Field(); |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - public function output_tab_open_div( $field ) { |
|
152 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
151 | + public function output_tab_open_div($field) { |
|
152 | + if (true === $this->is_options_page && isset($field->args['type']) && 'title' === $field->args['type']) { |
|
153 | 153 | ?> |
154 | - <div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden"> |
|
154 | + <div id="<?php echo esc_attr($field->args['id']); ?>_tab" class="tab tab-nav hidden"> |
|
155 | 155 | <?php |
156 | 156 | } |
157 | 157 | } |
@@ -162,19 +162,19 @@ discard block |
||
162 | 162 | * @param object $field CMB2_Field(); |
163 | 163 | * @return void |
164 | 164 | */ |
165 | - public function output_tab_closing_div( $field ) { |
|
166 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
165 | + public function output_tab_closing_div($field) { |
|
166 | + if (true === $this->is_options_page && isset($field->args['type']) && 'tab_closing' === $field->args['type']) { |
|
167 | 167 | ?> |
168 | 168 | </div> |
169 | 169 | <?php |
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | - public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
173 | + public function cmb2_render_callback_for_tab_closing($field, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
174 | 174 | return; |
175 | 175 | } |
176 | 176 | |
177 | - public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
177 | + public function cmb2_sanitize_tab_closing_callback($override_value, $value) { |
|
178 | 178 | return ''; |
179 | 179 | } |
180 | 180 | |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | * @param object $cmb2_obj |
188 | 188 | * @return void |
189 | 189 | */ |
190 | - public function navigation_js( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
191 | - if ( 'lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type ) { |
|
190 | + public function navigation_js($cmb_id, $object_id, $object_type, $cmb2_obj) { |
|
191 | + if ('lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type) { |
|
192 | 192 | ?> |
193 | 193 | <script> |
194 | 194 | var LSX_HP_CMB2 = Object.create( null ); |
@@ -270,14 +270,14 @@ discard block |
||
270 | 270 | * @param string $url |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - public function add_tab_argument( $url ) { |
|
274 | - if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
275 | - $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
276 | - $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
277 | - if ( 'single' !== $tab_selection ) { |
|
278 | - $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
273 | + public function add_tab_argument($url) { |
|
274 | + if (isset($_POST['cmb_tab']) && '' !== $_POST['cmb_tab']) { // @codingStandardsIgnoreLine |
|
275 | + $tab_selection = sanitize_text_field($_POST['cmb_tab']); // @codingStandardsIgnoreLine |
|
276 | + $tab_selection = str_replace(array('settings_', '_tab'), '', $tab_selection); // @codingStandardsIgnoreLine |
|
277 | + if ('single' !== $tab_selection) { |
|
278 | + $url = add_query_arg('cmb_tab', $tab_selection, $url); |
|
279 | 279 | } else { |
280 | - $url = remove_query_arg( 'cmb_tab', $url ); |
|
280 | + $url = remove_query_arg('cmb_tab', $url); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | return $url; |
@@ -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 | } |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * Constructor |
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 |
||
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 |
||
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 |
||
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 | } |
@@ -114,13 +114,19 @@ |
||
114 | 114 | <div class="entry-tabs hp-entry-tabs"> |
115 | 115 | <ul class="nav nav-tabs"> |
116 | 116 | <?php foreach ( $tabs as $i => $tab ) : ?> |
117 | - <li<?php if ( 0 === $i ) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li> |
|
117 | + <li<?php if ( 0 === $i ) { |
|
118 | + echo ' class="active"'; |
|
119 | +} |
|
120 | +?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li> |
|
118 | 121 | <?php endforeach; ?> |
119 | 122 | </ul> |
120 | 123 | |
121 | 124 | <div class="tab-content"> |
122 | 125 | <?php foreach ( $tabs as $i => $tab ) : ?> |
123 | - <div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) echo ' in active'; ?>"> |
|
126 | + <div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) { |
|
127 | + echo ' in active'; |
|
128 | +} |
|
129 | +?>"> |
|
124 | 130 | <?php echo do_shortcode( $tab['shortcode'] ); ?> |
125 | 131 | <?php echo wp_kses_post( $tab['content'] ); ?> |
126 | 132 | </div> |
@@ -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 ) : ?> |
@@ -4,85 +4,85 @@ |
||
4 | 4 | $tabs = array(); |
5 | 5 | |
6 | 6 | // Tab Experience |
7 | -$tab_experience['title'] = esc_html__( 'Experience', 'lsx-team' ); |
|
8 | -$tab_experience['content'] = get_post_meta( get_the_ID(), 'team_member_experience', true ); |
|
7 | +$tab_experience['title'] = esc_html__('Experience', 'lsx-team'); |
|
8 | +$tab_experience['content'] = get_post_meta(get_the_ID(), 'team_member_experience', true); |
|
9 | 9 | $tab_experience['shortcode'] = ''; |
10 | -if ( ! empty( $tab_experience['content'] ) ) { |
|
10 | +if ( ! empty($tab_experience['content'])) { |
|
11 | 11 | $tabs[] = $tab_experience; |
12 | 12 | } |
13 | 13 | |
14 | 14 | // Tab Featured plan |
15 | -$tab_plans['title'] = esc_html__( 'Featured Plans', 'lsx-team' ); |
|
16 | -$tab_plans['posts'] = get_post_meta( get_the_ID(), 'connected_team_member_plan', true ); |
|
15 | +$tab_plans['title'] = esc_html__('Featured Plans', 'lsx-team'); |
|
16 | +$tab_plans['posts'] = get_post_meta(get_the_ID(), 'connected_team_member_plan', true); |
|
17 | 17 | $tab_plans['content'] = ''; |
18 | 18 | $tab_plans['shortcode'] = ''; |
19 | 19 | |
20 | -if ( ! empty( $tab_plans['posts'] ) ) { |
|
20 | +if ( ! empty($tab_plans['posts'])) { |
|
21 | 21 | |
22 | 22 | $plan_content = ''; |
23 | 23 | |
24 | - $include = implode( ',', $tab_plans['posts'] ); |
|
24 | + $include = implode(',', $tab_plans['posts']); |
|
25 | 25 | $args = array( |
26 | 26 | 'orderby' => 'menu_order', |
27 | 27 | 'order' => 'ASC', |
28 | 28 | 'post_type' => 'plan', |
29 | 29 | 'post__in' => $tab_plans['posts'], |
30 | 30 | ); |
31 | - $plan_query = new WP_Query( $args ); |
|
31 | + $plan_query = new WP_Query($args); |
|
32 | 32 | |
33 | 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() ) { |
|
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 | 38 | $plan_query->the_post(); |
39 | 39 | ob_start(); |
40 | 40 | include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-plan.php'; |
41 | 41 | $plan_content .= ob_get_clean(); |
42 | 42 | } |
43 | 43 | wp_reset_postdata(); |
44 | - remove_action( 'lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10 ); |
|
44 | + remove_action('lsx_sharing_is_disabled', '\lsx_health_plan\functions\triggers\disable_sharing', 10); |
|
45 | 45 | } |
46 | 46 | $plan_content .= '</div></div>'; |
47 | 47 | |
48 | 48 | $tab_plans['content'] = $plan_content; |
49 | 49 | } |
50 | -if ( ! empty( $tab_plans['content'] ) ) { |
|
50 | +if ( ! empty($tab_plans['content'])) { |
|
51 | 51 | $tabs[] = $tab_plans; |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | // Tab Testimonials |
56 | 56 | $tab_testimonial['post_type'] = 'testimonial'; |
57 | -$tab_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-team' ); |
|
58 | -$tab_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_team', true ); |
|
57 | +$tab_testimonial['title'] = esc_html__('Testimonials', 'lsx-team'); |
|
58 | +$tab_testimonial['posts'] = get_post_meta(get_the_ID(), 'testimonial_to_team', true); |
|
59 | 59 | $tab_testimonial['content'] = ''; |
60 | 60 | |
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'] ); |
|
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 | 64 | } else { |
65 | 65 | $columns = 3; |
66 | 66 | } |
67 | 67 | |
68 | - $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
68 | + $post_ids = join(',', $tab_testimonial['posts']); |
|
69 | 69 | $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
70 | 70 | $tabs[] = $tab_testimonial; |
71 | 71 | } |
72 | 72 | |
73 | -if ( count( $tabs ) > 0 ) : ?> |
|
73 | +if (count($tabs) > 0) : ?> |
|
74 | 74 | <div class="entry-tabs hp-entry-tabs"> |
75 | 75 | <ul class="nav nav-tabs"> |
76 | - <?php foreach ( $tabs as $i => $tab ) : ?> |
|
77 | - <li<?php if ( 0 === $i ) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li> |
|
76 | + <?php foreach ($tabs as $i => $tab) : ?> |
|
77 | + <li<?php if (0 === $i) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr(sanitize_title($tab['title'])); ?>"><?php echo esc_html($tab['title']); ?></a></li> |
|
78 | 78 | <?php endforeach; ?> |
79 | 79 | </ul> |
80 | 80 | |
81 | 81 | <div class="tab-content"> |
82 | - <?php foreach ( $tabs as $i => $tab ) : ?> |
|
83 | - <div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) echo ' in active'; ?>"> |
|
84 | - <?php echo do_shortcode( $tab['shortcode'] ); ?> |
|
85 | - <?php echo wp_kses_post( $tab['content'] ); ?> |
|
82 | + <?php foreach ($tabs as $i => $tab) : ?> |
|
83 | + <div id="<?php echo esc_attr(sanitize_title($tab['title'])); ?>" class="tab-pane fade<?php if (0 === $i) echo ' in active'; ?>"> |
|
84 | + <?php echo do_shortcode($tab['shortcode']); ?> |
|
85 | + <?php echo wp_kses_post($tab['content']); ?> |
|
86 | 86 | </div> |
87 | 87 | <?php endforeach; ?> |
88 | 88 | </div> |
@@ -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 | } |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | * Constructor |
67 | 67 | */ |
68 | 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' ) ); |
|
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 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function get_instance() { |
86 | 86 | // If the single instance hasn't been set, set it now. |
87 | - if ( null === self::$instance ) { |
|
87 | + if (null === self::$instance) { |
|
88 | 88 | self::$instance = new self(); |
89 | 89 | } |
90 | 90 | return self::$instance; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function cmb2_post_search_ajax() { |
99 | 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' ) ) { |
|
100 | + if (method_exists('MAG_CMB2_Field_Post_Search_Ajax', 'get_instance')) { |
|
101 | 101 | $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance(); |
102 | 102 | } |
103 | 103 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @return void |
109 | 109 | */ |
110 | 110 | public function download_monitor_init() { |
111 | - if ( function_exists( 'download_monitor' ) ) { |
|
111 | + if (function_exists('download_monitor')) { |
|
112 | 112 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-download-monitor.php'; |
113 | 113 | $this->download_monitor = Download_Monitor::get_instance(); |
114 | 114 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @return void |
121 | 121 | */ |
122 | 122 | public function woocommerce_init() { |
123 | - if ( function_exists( 'WC' ) ) { |
|
123 | + if (function_exists('WC')) { |
|
124 | 124 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-woocommerce.php'; |
125 | 125 | $this->woocommerce = Woocommerce::get_instance(); |
126 | 126 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @return void |
133 | 133 | */ |
134 | 134 | public function wp_user_avatar_init() { |
135 | - if ( class_exists( 'WP_User_Avatar_Setup' ) ) { |
|
135 | + if (class_exists('WP_User_Avatar_Setup')) { |
|
136 | 136 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-wp-user-avatar.php'; |
137 | 137 | $this->wp_user_avatar = WP_User_Avatar::get_instance(); |
138 | 138 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @return void |
145 | 145 | */ |
146 | 146 | public function facetwp_init() { |
147 | - if ( class_exists( 'FacetWP' ) ) { |
|
147 | + if (class_exists('FacetWP')) { |
|
148 | 148 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-facetwp.php'; |
149 | 149 | $this->facetwp = FacetWP::get_instance(); |
150 | 150 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @return void |
157 | 157 | */ |
158 | 158 | public function lsx_team_init() { |
159 | - if ( class_exists( 'LSX_Team' ) ) { |
|
159 | + if (class_exists('LSX_Team')) { |
|
160 | 160 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-lsx-team.php'; |
161 | 161 | $this->team = LSX_Team::get_instance(); |
162 | 162 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @return void |
169 | 169 | */ |
170 | 170 | public function lsx_article_init() { |
171 | - if ( wp_count_posts()->publish > 0 ) { |
|
171 | + if (wp_count_posts()->publish > 0) { |
|
172 | 172 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-articles.php'; |
173 | 173 | $this->article = Articles::get_instance(); |
174 | 174 | } |
@@ -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 | } |
@@ -12,13 +12,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -13,5 +13,5 @@ |
||
13 | 13 | * @return boolean |
14 | 14 | */ |
15 | 15 | function disable_sharing( $disabled ) { |
16 | - return true; |
|
16 | + return true; |
|
17 | 17 | } |
@@ -12,6 +12,6 @@ |
||
12 | 12 | * |
13 | 13 | * @return boolean |
14 | 14 | */ |
15 | -function disable_sharing( $disabled ) { |
|
15 | +function disable_sharing($disabled) { |
|
16 | 16 | return true; |
17 | 17 | } |
@@ -7,18 +7,18 @@ discard block |
||
7 | 7 | global $connected_meals, $shortcode_args; |
8 | 8 | |
9 | 9 | if ( is_singular( 'plan' ) ) { |
10 | - $section_key = get_query_var( 'section' ); |
|
11 | - if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) { |
|
12 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
13 | - if ( isset( $section_info['connected_meals'] ) && '' !== $section_info['connected_meals'] ) { |
|
14 | - $connected_meals = \lsx_health_plan\functions\prep_array( $section_info['connected_meals'] ); |
|
15 | - } |
|
16 | - } |
|
10 | + $section_key = get_query_var( 'section' ); |
|
11 | + if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) { |
|
12 | + $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
13 | + if ( isset( $section_info['connected_meals'] ) && '' !== $section_info['connected_meals'] ) { |
|
14 | + $connected_meals = \lsx_health_plan\functions\prep_array( $section_info['connected_meals'] ); |
|
15 | + } |
|
16 | + } |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | // Check for any shortcode overrides. |
20 | 20 | if ( null !== $shortcode_args && isset( $shortcode_args['include'] ) ) { |
21 | - $connected_meals = array( get_the_ID() ); |
|
21 | + $connected_meals = array( get_the_ID() ); |
|
22 | 22 | } |
23 | 23 | ?> |
24 | 24 | |
@@ -26,144 +26,144 @@ discard block |
||
26 | 26 | |
27 | 27 | <?php |
28 | 28 | |
29 | - // Looking for meals. |
|
30 | - if ( empty( $connected_meals ) ) { |
|
31 | - $connected_meals = get_post_meta( get_the_ID(), 'connected_meals', true ); |
|
32 | - |
|
33 | - if ( empty( $connected_meals ) ) { |
|
34 | - $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
35 | - if ( isset( $options['connected_meals'] ) && '' !== $options['connected_meals'] && ! empty( $options['connected_meals'] ) ) { |
|
36 | - $connected_meals = $options['connected_meals']; |
|
37 | - if ( ! array( $connected_meals ) ) { |
|
38 | - $connected_meals = array( $connected_meals ); |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
42 | - } |
|
43 | - |
|
44 | - // This is for the meal single template. |
|
45 | - if ( is_single() && is_singular( 'meal' ) ) { |
|
46 | - $connected_meals = array( get_the_ID() ); |
|
47 | - } |
|
48 | - |
|
49 | - // The top part |
|
50 | - echo wp_kses_post( wp_kses_post( lsx_health_plan_meal_main_content() ) ); |
|
51 | - |
|
52 | - if ( false !== $connected_meals && '' !== $connected_meals && ! empty( $connected_meals ) ) { |
|
53 | - |
|
54 | - $args = array( |
|
55 | - 'orderby' => 'date', |
|
56 | - 'order' => 'DESC', |
|
57 | - 'post_type' => 'meal', |
|
58 | - 'post__in' => $connected_meals, |
|
59 | - ); |
|
60 | - $meals = new WP_Query( $args ); |
|
61 | - if ( $meals->have_posts() ) { |
|
62 | - while ( $meals->have_posts() ) { |
|
63 | - $meals->the_post(); |
|
64 | - $meal_id = get_the_ID(); |
|
29 | + // Looking for meals. |
|
30 | + if ( empty( $connected_meals ) ) { |
|
31 | + $connected_meals = get_post_meta( get_the_ID(), 'connected_meals', true ); |
|
32 | + |
|
33 | + if ( empty( $connected_meals ) ) { |
|
34 | + $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
35 | + if ( isset( $options['connected_meals'] ) && '' !== $options['connected_meals'] && ! empty( $options['connected_meals'] ) ) { |
|
36 | + $connected_meals = $options['connected_meals']; |
|
37 | + if ( ! array( $connected_meals ) ) { |
|
38 | + $connected_meals = array( $connected_meals ); |
|
39 | + } |
|
40 | + } |
|
41 | + } |
|
42 | + } |
|
43 | + |
|
44 | + // This is for the meal single template. |
|
45 | + if ( is_single() && is_singular( 'meal' ) ) { |
|
46 | + $connected_meals = array( get_the_ID() ); |
|
47 | + } |
|
48 | + |
|
49 | + // The top part |
|
50 | + echo wp_kses_post( wp_kses_post( lsx_health_plan_meal_main_content() ) ); |
|
51 | + |
|
52 | + if ( false !== $connected_meals && '' !== $connected_meals && ! empty( $connected_meals ) ) { |
|
53 | + |
|
54 | + $args = array( |
|
55 | + 'orderby' => 'date', |
|
56 | + 'order' => 'DESC', |
|
57 | + 'post_type' => 'meal', |
|
58 | + 'post__in' => $connected_meals, |
|
59 | + ); |
|
60 | + $meals = new WP_Query( $args ); |
|
61 | + if ( $meals->have_posts() ) { |
|
62 | + while ( $meals->have_posts() ) { |
|
63 | + $meals->the_post(); |
|
64 | + $meal_id = get_the_ID(); |
|
65 | 65 | |
66 | 66 | |
67 | - // Breakfast. |
|
68 | - $pre_breakfast_snack = get_post_meta( get_the_ID(), 'meal_pre_breakfast_snack', true ); |
|
69 | - $breakfast = get_post_meta( get_the_ID(), 'meal_breakfast', true ); |
|
70 | - $post_breakfast_snack = get_post_meta( get_the_ID(), 'meal_breakfast_snack', true ); |
|
67 | + // Breakfast. |
|
68 | + $pre_breakfast_snack = get_post_meta( get_the_ID(), 'meal_pre_breakfast_snack', true ); |
|
69 | + $breakfast = get_post_meta( get_the_ID(), 'meal_breakfast', true ); |
|
70 | + $post_breakfast_snack = get_post_meta( get_the_ID(), 'meal_breakfast_snack', true ); |
|
71 | 71 | |
72 | - // Lunch. |
|
73 | - $pre_lunch_snack = get_post_meta( get_the_ID(), 'meal_pre_lunch_snack', true ); |
|
74 | - $lunch = get_post_meta( get_the_ID(), 'meal_lunch', true ); |
|
75 | - $post_lunch_snack = get_post_meta( get_the_ID(), 'meal_lunch_snack', true ); |
|
72 | + // Lunch. |
|
73 | + $pre_lunch_snack = get_post_meta( get_the_ID(), 'meal_pre_lunch_snack', true ); |
|
74 | + $lunch = get_post_meta( get_the_ID(), 'meal_lunch', true ); |
|
75 | + $post_lunch_snack = get_post_meta( get_the_ID(), 'meal_lunch_snack', true ); |
|
76 | 76 | |
77 | - // Dinner. |
|
78 | - $pre_dinner_snack = get_post_meta( get_the_ID(), 'meal_pre_dinner_snack', true ); |
|
79 | - $dinner = get_post_meta( get_the_ID(), 'meal_dinner', true ); |
|
80 | - $post_dinner_snack = get_post_meta( get_the_ID(), 'meal_dinner_snack', true ); |
|
77 | + // Dinner. |
|
78 | + $pre_dinner_snack = get_post_meta( get_the_ID(), 'meal_pre_dinner_snack', true ); |
|
79 | + $dinner = get_post_meta( get_the_ID(), 'meal_dinner', true ); |
|
80 | + $post_dinner_snack = get_post_meta( get_the_ID(), 'meal_dinner_snack', true ); |
|
81 | 81 | |
82 | - //Main Meals Title |
|
83 | - //echo '<h3 class="meals-section-title">' . esc_html__( 'Meal Plan', 'lsx-health-plan' ) . '</h3>'; |
|
84 | - ?> |
|
82 | + //Main Meals Title |
|
83 | + //echo '<h3 class="meals-section-title">' . esc_html__( 'Meal Plan', 'lsx-health-plan' ) . '</h3>'; |
|
84 | + ?> |
|
85 | 85 | <div class="row eating-row"> |
86 | 86 | <div class="col-md-4 eating-column"> |
87 | 87 | <?php |
88 | - if ( ! empty( $pre_breakfast_snack ) ) { |
|
89 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
90 | - echo wp_kses_post( apply_filters( 'the_content', $pre_breakfast_snack ) ); |
|
91 | - echo '</div>'; |
|
92 | - } |
|
93 | - if ( ! empty( $breakfast ) ) { |
|
94 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Breakfast', 'lsx-health-plan' ) . '</h3>'; |
|
95 | - echo wp_kses_post( apply_filters( 'the_content', $breakfast ) ); |
|
96 | - echo '</div>'; |
|
97 | - } |
|
98 | - if ( ! empty( $post_breakfast_snack ) ) { |
|
99 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
100 | - echo wp_kses_post( apply_filters( 'the_content', $post_breakfast_snack ) ); |
|
101 | - echo '</div>'; |
|
102 | - } |
|
103 | - |
|
104 | - $args = array( |
|
105 | - 'meal_id' => $meal_id, |
|
106 | - 'meal_time' => 'breakfast', |
|
107 | - ); |
|
108 | - lsx_hp_meal_plan_recipes( $args ); |
|
109 | - ?> |
|
88 | + if ( ! empty( $pre_breakfast_snack ) ) { |
|
89 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
90 | + echo wp_kses_post( apply_filters( 'the_content', $pre_breakfast_snack ) ); |
|
91 | + echo '</div>'; |
|
92 | + } |
|
93 | + if ( ! empty( $breakfast ) ) { |
|
94 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Breakfast', 'lsx-health-plan' ) . '</h3>'; |
|
95 | + echo wp_kses_post( apply_filters( 'the_content', $breakfast ) ); |
|
96 | + echo '</div>'; |
|
97 | + } |
|
98 | + if ( ! empty( $post_breakfast_snack ) ) { |
|
99 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
100 | + echo wp_kses_post( apply_filters( 'the_content', $post_breakfast_snack ) ); |
|
101 | + echo '</div>'; |
|
102 | + } |
|
103 | + |
|
104 | + $args = array( |
|
105 | + 'meal_id' => $meal_id, |
|
106 | + 'meal_time' => 'breakfast', |
|
107 | + ); |
|
108 | + lsx_hp_meal_plan_recipes( $args ); |
|
109 | + ?> |
|
110 | 110 | </div> |
111 | 111 | <div class="col-md-4 eating-column"> |
112 | 112 | <?php |
113 | - if ( ! empty( $pre_lunch_snack ) ) { |
|
114 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
115 | - echo wp_kses_post( apply_filters( 'the_content', $pre_lunch_snack ) ); |
|
116 | - echo '</div>'; |
|
117 | - } |
|
118 | - if ( ! empty( $lunch ) ) { |
|
119 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Lunch', 'lsx-health-plan' ) . '</h3>'; |
|
120 | - echo wp_kses_post( apply_filters( 'the_content', $lunch ) ); |
|
121 | - echo '</div>'; |
|
122 | - } |
|
123 | - if ( ! empty( $post_lunch_snack ) ) { |
|
124 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
125 | - echo wp_kses_post( apply_filters( 'the_content', $post_lunch_snack ) ); |
|
126 | - echo '</div>'; |
|
127 | - } |
|
128 | - |
|
129 | - $args = array( |
|
130 | - 'meal_id' => $meal_id, |
|
131 | - 'meal_time' => 'lunch', |
|
132 | - ); |
|
133 | - lsx_hp_meal_plan_recipes( $args ); |
|
134 | - ?> |
|
113 | + if ( ! empty( $pre_lunch_snack ) ) { |
|
114 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
115 | + echo wp_kses_post( apply_filters( 'the_content', $pre_lunch_snack ) ); |
|
116 | + echo '</div>'; |
|
117 | + } |
|
118 | + if ( ! empty( $lunch ) ) { |
|
119 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Lunch', 'lsx-health-plan' ) . '</h3>'; |
|
120 | + echo wp_kses_post( apply_filters( 'the_content', $lunch ) ); |
|
121 | + echo '</div>'; |
|
122 | + } |
|
123 | + if ( ! empty( $post_lunch_snack ) ) { |
|
124 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
125 | + echo wp_kses_post( apply_filters( 'the_content', $post_lunch_snack ) ); |
|
126 | + echo '</div>'; |
|
127 | + } |
|
128 | + |
|
129 | + $args = array( |
|
130 | + 'meal_id' => $meal_id, |
|
131 | + 'meal_time' => 'lunch', |
|
132 | + ); |
|
133 | + lsx_hp_meal_plan_recipes( $args ); |
|
134 | + ?> |
|
135 | 135 | </div> |
136 | 136 | <div class="col-md-4 eating-column"> |
137 | 137 | <?php |
138 | - if ( ! empty( $pre_dinner_snack ) ) { |
|
139 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
140 | - echo wp_kses_post( apply_filters( 'the_content', $pre_dinner_snack ) ); |
|
141 | - echo '</div>'; |
|
142 | - } |
|
143 | - if ( ! empty( $dinner ) ) { |
|
144 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Dinner', 'lsx-health-plan' ) . '</h3>'; |
|
145 | - echo wp_kses_post( apply_filters( 'the_content', $dinner ) ); |
|
146 | - echo '</div>'; |
|
147 | - } |
|
148 | - if ( ! empty( $post_dinner_snack ) ) { |
|
149 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
150 | - echo wp_kses_post( apply_filters( 'the_content', $post_dinner_snack ) ); |
|
151 | - echo '</div>'; |
|
152 | - } |
|
153 | - |
|
154 | - $args = array( |
|
155 | - 'meal_id' => $meal_id, |
|
156 | - 'meal_time' => 'dinner', |
|
157 | - ); |
|
158 | - lsx_hp_meal_plan_recipes( $args ); |
|
159 | - ?> |
|
138 | + if ( ! empty( $pre_dinner_snack ) ) { |
|
139 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
140 | + echo wp_kses_post( apply_filters( 'the_content', $pre_dinner_snack ) ); |
|
141 | + echo '</div>'; |
|
142 | + } |
|
143 | + if ( ! empty( $dinner ) ) { |
|
144 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Dinner', 'lsx-health-plan' ) . '</h3>'; |
|
145 | + echo wp_kses_post( apply_filters( 'the_content', $dinner ) ); |
|
146 | + echo '</div>'; |
|
147 | + } |
|
148 | + if ( ! empty( $post_dinner_snack ) ) { |
|
149 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
150 | + echo wp_kses_post( apply_filters( 'the_content', $post_dinner_snack ) ); |
|
151 | + echo '</div>'; |
|
152 | + } |
|
153 | + |
|
154 | + $args = array( |
|
155 | + 'meal_id' => $meal_id, |
|
156 | + 'meal_time' => 'dinner', |
|
157 | + ); |
|
158 | + lsx_hp_meal_plan_recipes( $args ); |
|
159 | + ?> |
|
160 | 160 | </div> |
161 | 161 | </div> |
162 | 162 | <?php |
163 | - } |
|
164 | - } |
|
165 | - } |
|
166 | - ?> |
|
163 | + } |
|
164 | + } |
|
165 | + } |
|
166 | + ?> |
|
167 | 167 | <?php wp_reset_postdata(); ?> |
168 | 168 | </div> |
169 | 169 | <?php |
@@ -6,19 +6,19 @@ discard block |
||
6 | 6 | */ |
7 | 7 | global $connected_meals, $shortcode_args; |
8 | 8 | |
9 | -if ( is_singular( 'plan' ) ) { |
|
10 | - $section_key = get_query_var( 'section' ); |
|
11 | - if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) { |
|
12 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
13 | - if ( isset( $section_info['connected_meals'] ) && '' !== $section_info['connected_meals'] ) { |
|
14 | - $connected_meals = \lsx_health_plan\functions\prep_array( $section_info['connected_meals'] ); |
|
9 | +if (is_singular('plan')) { |
|
10 | + $section_key = get_query_var('section'); |
|
11 | + if ('' !== $section_key && \lsx_health_plan\functions\plan\has_sections()) { |
|
12 | + $section_info = \lsx_health_plan\functions\plan\get_section_info($section_key); |
|
13 | + if (isset($section_info['connected_meals']) && '' !== $section_info['connected_meals']) { |
|
14 | + $connected_meals = \lsx_health_plan\functions\prep_array($section_info['connected_meals']); |
|
15 | 15 | } |
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
19 | 19 | // Check for any shortcode overrides. |
20 | -if ( null !== $shortcode_args && isset( $shortcode_args['include'] ) ) { |
|
21 | - $connected_meals = array( get_the_ID() ); |
|
20 | +if (null !== $shortcode_args && isset($shortcode_args['include'])) { |
|
21 | + $connected_meals = array(get_the_ID()); |
|
22 | 22 | } |
23 | 23 | ?> |
24 | 24 | |
@@ -27,57 +27,57 @@ discard block |
||
27 | 27 | <?php |
28 | 28 | |
29 | 29 | // Looking for meals. |
30 | - if ( empty( $connected_meals ) ) { |
|
31 | - $connected_meals = get_post_meta( get_the_ID(), 'connected_meals', true ); |
|
30 | + if (empty($connected_meals)) { |
|
31 | + $connected_meals = get_post_meta(get_the_ID(), 'connected_meals', true); |
|
32 | 32 | |
33 | - if ( empty( $connected_meals ) ) { |
|
34 | - $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
35 | - if ( isset( $options['connected_meals'] ) && '' !== $options['connected_meals'] && ! empty( $options['connected_meals'] ) ) { |
|
33 | + if (empty($connected_meals)) { |
|
34 | + $options = \lsx_health_plan\functions\get_option('all'); |
|
35 | + if (isset($options['connected_meals']) && '' !== $options['connected_meals'] && ! empty($options['connected_meals'])) { |
|
36 | 36 | $connected_meals = $options['connected_meals']; |
37 | - if ( ! array( $connected_meals ) ) { |
|
38 | - $connected_meals = array( $connected_meals ); |
|
37 | + if ( ! array($connected_meals)) { |
|
38 | + $connected_meals = array($connected_meals); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | 44 | // This is for the meal single template. |
45 | - if ( is_single() && is_singular( 'meal' ) ) { |
|
46 | - $connected_meals = array( get_the_ID() ); |
|
45 | + if (is_single() && is_singular('meal')) { |
|
46 | + $connected_meals = array(get_the_ID()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // The top part |
50 | - echo wp_kses_post( wp_kses_post( lsx_health_plan_meal_main_content() ) ); |
|
50 | + echo wp_kses_post(wp_kses_post(lsx_health_plan_meal_main_content())); |
|
51 | 51 | |
52 | - if ( false !== $connected_meals && '' !== $connected_meals && ! empty( $connected_meals ) ) { |
|
52 | + if (false !== $connected_meals && '' !== $connected_meals && ! empty($connected_meals)) { |
|
53 | 53 | |
54 | - $args = array( |
|
54 | + $args = array( |
|
55 | 55 | 'orderby' => 'date', |
56 | 56 | 'order' => 'DESC', |
57 | 57 | 'post_type' => 'meal', |
58 | 58 | 'post__in' => $connected_meals, |
59 | 59 | ); |
60 | - $meals = new WP_Query( $args ); |
|
61 | - if ( $meals->have_posts() ) { |
|
62 | - while ( $meals->have_posts() ) { |
|
60 | + $meals = new WP_Query($args); |
|
61 | + if ($meals->have_posts()) { |
|
62 | + while ($meals->have_posts()) { |
|
63 | 63 | $meals->the_post(); |
64 | - $meal_id = get_the_ID(); |
|
64 | + $meal_id = get_the_ID(); |
|
65 | 65 | |
66 | 66 | |
67 | 67 | // Breakfast. |
68 | - $pre_breakfast_snack = get_post_meta( get_the_ID(), 'meal_pre_breakfast_snack', true ); |
|
69 | - $breakfast = get_post_meta( get_the_ID(), 'meal_breakfast', true ); |
|
70 | - $post_breakfast_snack = get_post_meta( get_the_ID(), 'meal_breakfast_snack', true ); |
|
68 | + $pre_breakfast_snack = get_post_meta(get_the_ID(), 'meal_pre_breakfast_snack', true); |
|
69 | + $breakfast = get_post_meta(get_the_ID(), 'meal_breakfast', true); |
|
70 | + $post_breakfast_snack = get_post_meta(get_the_ID(), 'meal_breakfast_snack', true); |
|
71 | 71 | |
72 | 72 | // Lunch. |
73 | - $pre_lunch_snack = get_post_meta( get_the_ID(), 'meal_pre_lunch_snack', true ); |
|
74 | - $lunch = get_post_meta( get_the_ID(), 'meal_lunch', true ); |
|
75 | - $post_lunch_snack = get_post_meta( get_the_ID(), 'meal_lunch_snack', true ); |
|
73 | + $pre_lunch_snack = get_post_meta(get_the_ID(), 'meal_pre_lunch_snack', true); |
|
74 | + $lunch = get_post_meta(get_the_ID(), 'meal_lunch', true); |
|
75 | + $post_lunch_snack = get_post_meta(get_the_ID(), 'meal_lunch_snack', true); |
|
76 | 76 | |
77 | 77 | // Dinner. |
78 | - $pre_dinner_snack = get_post_meta( get_the_ID(), 'meal_pre_dinner_snack', true ); |
|
79 | - $dinner = get_post_meta( get_the_ID(), 'meal_dinner', true ); |
|
80 | - $post_dinner_snack = get_post_meta( get_the_ID(), 'meal_dinner_snack', true ); |
|
78 | + $pre_dinner_snack = get_post_meta(get_the_ID(), 'meal_pre_dinner_snack', true); |
|
79 | + $dinner = get_post_meta(get_the_ID(), 'meal_dinner', true); |
|
80 | + $post_dinner_snack = get_post_meta(get_the_ID(), 'meal_dinner_snack', true); |
|
81 | 81 | |
82 | 82 | //Main Meals Title |
83 | 83 | //echo '<h3 class="meals-section-title">' . esc_html__( 'Meal Plan', 'lsx-health-plan' ) . '</h3>'; |
@@ -85,19 +85,19 @@ discard block |
||
85 | 85 | <div class="row eating-row"> |
86 | 86 | <div class="col-md-4 eating-column"> |
87 | 87 | <?php |
88 | - if ( ! empty( $pre_breakfast_snack ) ) { |
|
89 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
90 | - echo wp_kses_post( apply_filters( 'the_content', $pre_breakfast_snack ) ); |
|
88 | + if ( ! empty($pre_breakfast_snack)) { |
|
89 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__('Snack', 'lsx-health-plan') . '</h3>'; |
|
90 | + echo wp_kses_post(apply_filters('the_content', $pre_breakfast_snack)); |
|
91 | 91 | echo '</div>'; |
92 | 92 | } |
93 | - if ( ! empty( $breakfast ) ) { |
|
94 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Breakfast', 'lsx-health-plan' ) . '</h3>'; |
|
95 | - echo wp_kses_post( apply_filters( 'the_content', $breakfast ) ); |
|
93 | + if ( ! empty($breakfast)) { |
|
94 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__('Breakfast', 'lsx-health-plan') . '</h3>'; |
|
95 | + echo wp_kses_post(apply_filters('the_content', $breakfast)); |
|
96 | 96 | echo '</div>'; |
97 | 97 | } |
98 | - if ( ! empty( $post_breakfast_snack ) ) { |
|
99 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
100 | - echo wp_kses_post( apply_filters( 'the_content', $post_breakfast_snack ) ); |
|
98 | + if ( ! empty($post_breakfast_snack)) { |
|
99 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__('Snack', 'lsx-health-plan') . '</h3>'; |
|
100 | + echo wp_kses_post(apply_filters('the_content', $post_breakfast_snack)); |
|
101 | 101 | echo '</div>'; |
102 | 102 | } |
103 | 103 | |
@@ -105,24 +105,24 @@ discard block |
||
105 | 105 | 'meal_id' => $meal_id, |
106 | 106 | 'meal_time' => 'breakfast', |
107 | 107 | ); |
108 | - lsx_hp_meal_plan_recipes( $args ); |
|
108 | + lsx_hp_meal_plan_recipes($args); |
|
109 | 109 | ?> |
110 | 110 | </div> |
111 | 111 | <div class="col-md-4 eating-column"> |
112 | 112 | <?php |
113 | - if ( ! empty( $pre_lunch_snack ) ) { |
|
114 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
115 | - echo wp_kses_post( apply_filters( 'the_content', $pre_lunch_snack ) ); |
|
113 | + if ( ! empty($pre_lunch_snack)) { |
|
114 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__('Snack', 'lsx-health-plan') . '</h3>'; |
|
115 | + echo wp_kses_post(apply_filters('the_content', $pre_lunch_snack)); |
|
116 | 116 | echo '</div>'; |
117 | 117 | } |
118 | - if ( ! empty( $lunch ) ) { |
|
119 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Lunch', 'lsx-health-plan' ) . '</h3>'; |
|
120 | - echo wp_kses_post( apply_filters( 'the_content', $lunch ) ); |
|
118 | + if ( ! empty($lunch)) { |
|
119 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__('Lunch', 'lsx-health-plan') . '</h3>'; |
|
120 | + echo wp_kses_post(apply_filters('the_content', $lunch)); |
|
121 | 121 | echo '</div>'; |
122 | 122 | } |
123 | - if ( ! empty( $post_lunch_snack ) ) { |
|
124 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
125 | - echo wp_kses_post( apply_filters( 'the_content', $post_lunch_snack ) ); |
|
123 | + if ( ! empty($post_lunch_snack)) { |
|
124 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__('Snack', 'lsx-health-plan') . '</h3>'; |
|
125 | + echo wp_kses_post(apply_filters('the_content', $post_lunch_snack)); |
|
126 | 126 | echo '</div>'; |
127 | 127 | } |
128 | 128 | |
@@ -130,24 +130,24 @@ discard block |
||
130 | 130 | 'meal_id' => $meal_id, |
131 | 131 | 'meal_time' => 'lunch', |
132 | 132 | ); |
133 | - lsx_hp_meal_plan_recipes( $args ); |
|
133 | + lsx_hp_meal_plan_recipes($args); |
|
134 | 134 | ?> |
135 | 135 | </div> |
136 | 136 | <div class="col-md-4 eating-column"> |
137 | 137 | <?php |
138 | - if ( ! empty( $pre_dinner_snack ) ) { |
|
139 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
140 | - echo wp_kses_post( apply_filters( 'the_content', $pre_dinner_snack ) ); |
|
138 | + if ( ! empty($pre_dinner_snack)) { |
|
139 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__('Snack', 'lsx-health-plan') . '</h3>'; |
|
140 | + echo wp_kses_post(apply_filters('the_content', $pre_dinner_snack)); |
|
141 | 141 | echo '</div>'; |
142 | 142 | } |
143 | - if ( ! empty( $dinner ) ) { |
|
144 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Dinner', 'lsx-health-plan' ) . '</h3>'; |
|
145 | - echo wp_kses_post( apply_filters( 'the_content', $dinner ) ); |
|
143 | + if ( ! empty($dinner)) { |
|
144 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__('Dinner', 'lsx-health-plan') . '</h3>'; |
|
145 | + echo wp_kses_post(apply_filters('the_content', $dinner)); |
|
146 | 146 | echo '</div>'; |
147 | 147 | } |
148 | - if ( ! empty( $post_dinner_snack ) ) { |
|
149 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
150 | - echo wp_kses_post( apply_filters( 'the_content', $post_dinner_snack ) ); |
|
148 | + if ( ! empty($post_dinner_snack)) { |
|
149 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__('Snack', 'lsx-health-plan') . '</h3>'; |
|
150 | + echo wp_kses_post(apply_filters('the_content', $post_dinner_snack)); |
|
151 | 151 | echo '</div>'; |
152 | 152 | } |
153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | 'meal_id' => $meal_id, |
156 | 156 | 'meal_time' => 'dinner', |
157 | 157 | ); |
158 | - lsx_hp_meal_plan_recipes( $args ); |
|
158 | + lsx_hp_meal_plan_recipes($args); |
|
159 | 159 | ?> |
160 | 160 | </div> |
161 | 161 | </div> |