@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @package lsx-health-plan |
6 | 6 | */ |
7 | 7 | |
8 | -$args = array( |
|
8 | +$args = array( |
|
9 | 9 | 'orderby' => 'date', |
10 | 10 | 'order' => 'DESC', |
11 | 11 | 'post_type' => 'video', |
@@ -13,20 +13,20 @@ discard block |
||
13 | 13 | 'meta_key' => 'video_featured_video', |
14 | 14 | 'meta_compare' => 'EXISTS', |
15 | 15 | ); |
16 | -$videos = new WP_Query( $args ); |
|
16 | +$videos = new WP_Query($args); |
|
17 | 17 | ?> |
18 | 18 | |
19 | 19 | <div id="lsx-videos-shortcode" class="daily-plan-block"> |
20 | - <h2 class="title-lined"><?php esc_html_e( 'Featured Workout', 'lsx-health-plan' ); ?></h2> |
|
20 | + <h2 class="title-lined"><?php esc_html_e('Featured Workout', 'lsx-health-plan'); ?></h2> |
|
21 | 21 | <div class="lsx-videos-shortcode lsx-videos-slider slick-slider slick-dotted slick-has-arrows" data-slick="{'slidesToShow': 1, 'slidesToScroll': 1}" > |
22 | 22 | <?php |
23 | - if ( $videos->have_posts() ) : |
|
24 | - while ( $videos->have_posts() ) : |
|
23 | + if ($videos->have_posts()) : |
|
24 | + while ($videos->have_posts()) : |
|
25 | 25 | $videos->the_post(); |
26 | 26 | |
27 | - $featured = get_post_meta( get_the_ID(), 'video_featured_video', true ); |
|
28 | - $giphy = get_post_meta( get_the_ID(), 'video_giphy_source', true ); |
|
29 | - $youtube = esc_url( get_post_meta( get_the_ID(), 'video_youtube_source', 1 ) ); |
|
27 | + $featured = get_post_meta(get_the_ID(), 'video_featured_video', true); |
|
28 | + $giphy = get_post_meta(get_the_ID(), 'video_giphy_source', true); |
|
29 | + $youtube = esc_url(get_post_meta(get_the_ID(), 'video_youtube_source', 1)); |
|
30 | 30 | ?> |
31 | 31 | <div class="lsx-videos-slot"> |
32 | 32 | <div class="row"> |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | </div> |
37 | 37 | <div class="col-md-8"> |
38 | 38 | <?php |
39 | - if ( ! empty( $giphy ) ) { |
|
39 | + if ( ! empty($giphy)) { |
|
40 | 40 | echo $giphy; // WPCS: XSS OK. |
41 | - } elseif ( ! empty( $youtube ) ) { |
|
42 | - echo wp_oembed_get( $youtube ); // WPCS: XSS OK. |
|
41 | + } elseif ( ! empty($youtube)) { |
|
42 | + echo wp_oembed_get($youtube); // WPCS: XSS OK. |
|
43 | 43 | } |
44 | 44 | ?> |
45 | 45 | </div> |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | $args = array( |
9 | - 'orderby' => 'date', |
|
10 | - 'order' => 'DESC', |
|
11 | - 'post_type' => 'video', |
|
12 | - 'posts_per_page' => 3, |
|
13 | - 'meta_key' => 'video_featured_video', |
|
14 | - 'meta_compare' => 'EXISTS', |
|
9 | + 'orderby' => 'date', |
|
10 | + 'order' => 'DESC', |
|
11 | + 'post_type' => 'video', |
|
12 | + 'posts_per_page' => 3, |
|
13 | + 'meta_key' => 'video_featured_video', |
|
14 | + 'meta_compare' => 'EXISTS', |
|
15 | 15 | ); |
16 | 16 | $videos = new WP_Query( $args ); |
17 | 17 | ?> |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | <h2 class="title-lined"><?php esc_html_e( 'Featured Workout', 'lsx-health-plan' ); ?></h2> |
21 | 21 | <div class="lsx-videos-shortcode lsx-videos-slider slick-slider slick-dotted slick-has-arrows" data-slick="{'slidesToShow': 1, 'slidesToScroll': 1}" > |
22 | 22 | <?php |
23 | - if ( $videos->have_posts() ) : |
|
24 | - while ( $videos->have_posts() ) : |
|
25 | - $videos->the_post(); |
|
23 | + if ( $videos->have_posts() ) : |
|
24 | + while ( $videos->have_posts() ) : |
|
25 | + $videos->the_post(); |
|
26 | 26 | |
27 | - $featured = get_post_meta( get_the_ID(), 'video_featured_video', true ); |
|
28 | - $giphy = get_post_meta( get_the_ID(), 'video_giphy_source', true ); |
|
29 | - $youtube = esc_url( get_post_meta( get_the_ID(), 'video_youtube_source', 1 ) ); |
|
30 | - ?> |
|
27 | + $featured = get_post_meta( get_the_ID(), 'video_featured_video', true ); |
|
28 | + $giphy = get_post_meta( get_the_ID(), 'video_giphy_source', true ); |
|
29 | + $youtube = esc_url( get_post_meta( get_the_ID(), 'video_youtube_source', 1 ) ); |
|
30 | + ?> |
|
31 | 31 | <div class="lsx-videos-slot"> |
32 | 32 | <div class="row"> |
33 | 33 | <div class="col-md-4"> |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | </div> |
37 | 37 | <div class="col-md-8"> |
38 | 38 | <?php |
39 | - if ( ! empty( $giphy ) ) { |
|
40 | - echo $giphy; // WPCS: XSS OK. |
|
41 | - } elseif ( ! empty( $youtube ) ) { |
|
42 | - echo wp_oembed_get( $youtube ); // WPCS: XSS OK. |
|
43 | - } |
|
44 | - ?> |
|
39 | + if ( ! empty( $giphy ) ) { |
|
40 | + echo $giphy; // WPCS: XSS OK. |
|
41 | + } elseif ( ! empty( $youtube ) ) { |
|
42 | + echo wp_oembed_get( $youtube ); // WPCS: XSS OK. |
|
43 | + } |
|
44 | + ?> |
|
45 | 45 | </div> |
46 | 46 | </div> |
47 | 47 | </div> |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
15 | 15 | ?> |
16 | 16 | |
17 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
17 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
18 | 18 | |
19 | 19 | <?php lsx_content_before(); ?> |
20 | 20 | |
21 | 21 | <!-- Begining restricted content --> |
22 | 22 | <?php |
23 | - if ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
23 | + if (current_user_can('administrator', $page_id) || current_user_can('wc_memberships_view_restricted_post_content', $page_id)) { |
|
24 | 24 | ?> |
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <div class="post-wrapper archive-plan"> |
30 | 30 | <div class="row"> |
31 | - <?php if ( have_posts() ) : ?> |
|
31 | + <?php if (have_posts()) : ?> |
|
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
33 | + while (have_posts()) : |
|
34 | 34 | the_post(); |
35 | 35 | ?> |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | <?php else : ?> |
42 | 42 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
43 | + <?php get_template_part('partials/content', 'none'); ?> |
|
44 | 44 | |
45 | 45 | <?php endif; ?> |
46 | 46 | </div> |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | <?php lsx_content_wrap_before(); ?> |
11 | 11 | |
12 | 12 | <?php |
13 | - $page_id = get_the_ID(); |
|
14 | - $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
13 | + $page_id = get_the_ID(); |
|
14 | + $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
15 | 15 | ?> |
16 | 16 | |
17 | 17 | <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | <!-- Begining restricted content --> |
22 | 22 | <?php |
23 | - if ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
24 | - ?> |
|
23 | + if ( current_user_can( 'administrator', $page_id ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
24 | + ?> |
|
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
27 | 27 | <?php lsx_content_top(); ?> |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | <div class="row"> |
31 | 31 | <?php if ( have_posts() ) : ?> |
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
34 | - the_post(); |
|
35 | - ?> |
|
33 | + while ( have_posts() ) : |
|
34 | + the_post(); |
|
35 | + ?> |
|
36 | 36 | |
37 | 37 | <?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-recipe.php'; ?> |
38 | 38 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | </main><!-- #main --> |
52 | 52 | |
53 | 53 | <?php |
54 | - } |
|
55 | - ?> |
|
54 | + } |
|
55 | + ?> |
|
56 | 56 | |
57 | 57 | <?php lsx_content_after(); ?> |
58 | 58 |
@@ -38,9 +38,12 @@ |
||
38 | 38 | |
39 | 39 | <?php endwhile; ?> |
40 | 40 | |
41 | - <?php else : ?> |
|
41 | + <?php else { |
|
42 | + : ?> |
|
42 | 43 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
44 | + <?php get_template_part( 'partials/content', 'none' ); |
|
45 | +} |
|
46 | +?> |
|
44 | 47 | |
45 | 48 | <?php endif; ?> |
46 | 49 | </div> |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
15 | 15 | ?> |
16 | 16 | |
17 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
17 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
18 | 18 | |
19 | 19 | <?php lsx_content_before(); ?> |
20 | 20 | |
21 | 21 | <!-- Begining restricted content --> |
22 | 22 | <?php |
23 | - if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
23 | + if (current_user_can('wc_memberships_view_restricted_post_content', $post_id)) { |
|
24 | 24 | ?> |
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <div class="post-wrapper archive-plan"> |
30 | 30 | <div class="row"> |
31 | - <?php if ( have_posts() ) : ?> |
|
31 | + <?php if (have_posts()) : ?> |
|
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
33 | + while (have_posts()) : |
|
34 | 34 | the_post(); |
35 | 35 | ?> |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | <?php else : ?> |
42 | 42 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
43 | + <?php get_template_part('partials/content', 'none'); ?> |
|
44 | 44 | |
45 | 45 | <?php endif; ?> |
46 | 46 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | <?php |
54 | 54 | } else { |
55 | - wp_redirect( $redirect ); |
|
55 | + wp_redirect($redirect); |
|
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | ?> |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | <?php lsx_content_wrap_before(); ?> |
11 | 11 | |
12 | 12 | <?php |
13 | - $page_id = get_the_ID(); |
|
14 | - $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
13 | + $page_id = get_the_ID(); |
|
14 | + $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
15 | 15 | ?> |
16 | 16 | |
17 | 17 | <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | <!-- Begining restricted content --> |
22 | 22 | <?php |
23 | - if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
24 | - ?> |
|
23 | + if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
24 | + ?> |
|
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
27 | 27 | <?php lsx_content_top(); ?> |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | <div class="row"> |
31 | 31 | <?php if ( have_posts() ) : ?> |
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
34 | - the_post(); |
|
35 | - ?> |
|
33 | + while ( have_posts() ) : |
|
34 | + the_post(); |
|
35 | + ?> |
|
36 | 36 | |
37 | 37 | <?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-recipe.php'; ?> |
38 | 38 | |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | </main><!-- #main --> |
52 | 52 | |
53 | 53 | <?php |
54 | - } else { |
|
55 | - wp_redirect( $redirect ); |
|
56 | - exit; |
|
57 | - } |
|
58 | - ?> |
|
54 | + } else { |
|
55 | + wp_redirect( $redirect ); |
|
56 | + exit; |
|
57 | + } |
|
58 | + ?> |
|
59 | 59 | |
60 | 60 | <?php lsx_content_after(); ?> |
61 | 61 |
@@ -38,9 +38,12 @@ |
||
38 | 38 | |
39 | 39 | <?php endwhile; ?> |
40 | 40 | |
41 | - <?php else : ?> |
|
41 | + <?php else { |
|
42 | + : ?> |
|
42 | 43 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
44 | + <?php get_template_part( 'partials/content', 'none' ); |
|
45 | +} |
|
46 | +?> |
|
44 | 47 | |
45 | 48 | <?php endif; ?> |
46 | 49 | </div> |
@@ -5,17 +5,17 @@ discard block |
||
5 | 5 | $muscle_group = lsx_health_plan_muscle_group_equipment(); |
6 | 6 | |
7 | 7 | ?> |
8 | -<?php if ( ( ! empty( $type ) ) || ( ! empty( $equipment ) ) || ( ! empty( $muscle_group ) ) ) { ?> |
|
8 | +<?php if (( ! empty($type)) || ( ! empty($equipment)) || ( ! empty($muscle_group))) { ?> |
|
9 | 9 | <table class="exercise-table"> |
10 | 10 | <tbody> |
11 | 11 | <?php |
12 | - if ( ! empty( $type ) ) { |
|
12 | + if ( ! empty($type)) { |
|
13 | 13 | ?> |
14 | 14 | <tr class="types"> |
15 | - <td><?php esc_html_e( 'Type:', 'lsx-health-plan' ); ?> </td> |
|
15 | + <td><?php esc_html_e('Type:', 'lsx-health-plan'); ?> </td> |
|
16 | 16 | <td> |
17 | 17 | <?php |
18 | - echo wp_kses_post( $type ); |
|
18 | + echo wp_kses_post($type); |
|
19 | 19 | ?> |
20 | 20 | </td> |
21 | 21 | </tr> |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | } |
24 | 24 | ?> |
25 | 25 | <?php |
26 | - if ( ! empty( $muscle_group ) ) { |
|
26 | + if ( ! empty($muscle_group)) { |
|
27 | 27 | ?> |
28 | 28 | <tr class="muscle-group"> |
29 | - <td><?php esc_html_e( 'Muscle Group:', 'lsx-health-plan' ); ?> </td> |
|
29 | + <td><?php esc_html_e('Muscle Group:', 'lsx-health-plan'); ?> </td> |
|
30 | 30 | <td> |
31 | 31 | <?php |
32 | - echo wp_kses_post( $muscle_group ); |
|
32 | + echo wp_kses_post($muscle_group); |
|
33 | 33 | ?> |
34 | 34 | </td> |
35 | 35 | </tr> |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | } |
38 | 38 | ?> |
39 | 39 | <?php |
40 | - if ( ! empty( $equipment ) ) { |
|
40 | + if ( ! empty($equipment)) { |
|
41 | 41 | ?> |
42 | 42 | <tr class="equipment"> |
43 | - <td><?php esc_html_e( 'Equipment:', 'lsx-health-plan' ); ?> </td> |
|
43 | + <td><?php esc_html_e('Equipment:', 'lsx-health-plan'); ?> </td> |
|
44 | 44 | <td> |
45 | 45 | <?php |
46 | - echo wp_kses_post( $equipment ); |
|
46 | + echo wp_kses_post($equipment); |
|
47 | 47 | ?> |
48 | 48 | </td> |
49 | 49 | </tr> |
@@ -9,47 +9,47 @@ |
||
9 | 9 | <table class="exercise-table"> |
10 | 10 | <tbody> |
11 | 11 | <?php |
12 | - if ( ! empty( $type ) ) { |
|
13 | - ?> |
|
12 | + if ( ! empty( $type ) ) { |
|
13 | + ?> |
|
14 | 14 | <tr class="types"> |
15 | 15 | <td><?php esc_html_e( 'Type:', 'lsx-health-plan' ); ?> </td> |
16 | 16 | <td> |
17 | 17 | <?php |
18 | - echo wp_kses_post( $type ); |
|
19 | - ?> |
|
18 | + echo wp_kses_post( $type ); |
|
19 | + ?> |
|
20 | 20 | </td> |
21 | 21 | </tr> |
22 | 22 | <?php |
23 | - } |
|
24 | - ?> |
|
23 | + } |
|
24 | + ?> |
|
25 | 25 | <?php |
26 | - if ( ! empty( $muscle_group ) ) { |
|
27 | - ?> |
|
26 | + if ( ! empty( $muscle_group ) ) { |
|
27 | + ?> |
|
28 | 28 | <tr class="muscle-group"> |
29 | 29 | <td><?php esc_html_e( 'Muscle Group:', 'lsx-health-plan' ); ?> </td> |
30 | 30 | <td> |
31 | 31 | <?php |
32 | - echo wp_kses_post( $muscle_group ); |
|
33 | - ?> |
|
32 | + echo wp_kses_post( $muscle_group ); |
|
33 | + ?> |
|
34 | 34 | </td> |
35 | 35 | </tr> |
36 | 36 | <?php |
37 | - } |
|
38 | - ?> |
|
37 | + } |
|
38 | + ?> |
|
39 | 39 | <?php |
40 | - if ( ! empty( $equipment ) ) { |
|
41 | - ?> |
|
40 | + if ( ! empty( $equipment ) ) { |
|
41 | + ?> |
|
42 | 42 | <tr class="equipment"> |
43 | 43 | <td><?php esc_html_e( 'Equipment:', 'lsx-health-plan' ); ?> </td> |
44 | 44 | <td> |
45 | 45 | <?php |
46 | - echo wp_kses_post( $equipment ); |
|
47 | - ?> |
|
46 | + echo wp_kses_post( $equipment ); |
|
47 | + ?> |
|
48 | 48 | </td> |
49 | 49 | </tr> |
50 | 50 | <?php |
51 | - } |
|
52 | - ?> |
|
51 | + } |
|
52 | + ?> |
|
53 | 53 | </tbody> |
54 | 54 | </table> |
55 | 55 | <?php } ?> |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | -$prep_time = get_post_meta( get_the_ID(), 'recipe_prep_time', true ); |
|
3 | -$cooking_time = get_post_meta( get_the_ID(), 'recipe_cooking_time', true ); |
|
4 | -$serves = get_post_meta( get_the_ID(), 'recipe_serves', true ); |
|
5 | -$portion = get_post_meta( get_the_ID(), 'recipe_portion', true ); |
|
6 | -$energy = get_post_meta( get_the_ID(), 'recipe_energy', true ); |
|
7 | -$protein = get_post_meta( get_the_ID(), 'recipe_protein', true ); |
|
8 | -$carbohydrates = get_post_meta( get_the_ID(), 'recipe_carbohydrates', true ); |
|
9 | -$fibre = get_post_meta( get_the_ID(), 'recipe_fibre', true ); |
|
10 | -$fat = get_post_meta( get_the_ID(), 'recipe_fat', true ); |
|
2 | +$prep_time = get_post_meta(get_the_ID(), 'recipe_prep_time', true); |
|
3 | +$cooking_time = get_post_meta(get_the_ID(), 'recipe_cooking_time', true); |
|
4 | +$serves = get_post_meta(get_the_ID(), 'recipe_serves', true); |
|
5 | +$portion = get_post_meta(get_the_ID(), 'recipe_portion', true); |
|
6 | +$energy = get_post_meta(get_the_ID(), 'recipe_energy', true); |
|
7 | +$protein = get_post_meta(get_the_ID(), 'recipe_protein', true); |
|
8 | +$carbohydrates = get_post_meta(get_the_ID(), 'recipe_carbohydrates', true); |
|
9 | +$fibre = get_post_meta(get_the_ID(), 'recipe_fibre', true); |
|
10 | +$fat = get_post_meta(get_the_ID(), 'recipe_fat', true); |
|
11 | 11 | ?> |
12 | -<?php if ( ( ! empty( $prep_time ) ) || ( ! empty( $cooking_time ) ) || ( ! empty( $serves ) ) || ( ! empty( $portion ) ) ) { ?> |
|
12 | +<?php if (( ! empty($prep_time)) || ( ! empty($cooking_time)) || ( ! empty($serves)) || ( ! empty($portion))) { ?> |
|
13 | 13 | <table class="recipe-table cooking-info-table"> |
14 | - <?php if ( is_single() && is_singular( 'recipe' ) ) { ?> |
|
14 | + <?php if (is_single() && is_singular('recipe')) { ?> |
|
15 | 15 | <thead> |
16 | 16 | <tr> |
17 | 17 | <th>Cooking Info</th> |
@@ -20,29 +20,29 @@ discard block |
||
20 | 20 | <?php } ?> |
21 | 21 | <tbody> |
22 | 22 | <?php |
23 | - if ( 1 >= (int) $serves ) { |
|
23 | + if (1 >= (int) $serves) { |
|
24 | 24 | $serves = '1'; |
25 | - $serves_label = __( 'Person', 'lsx-health-plan' ); |
|
25 | + $serves_label = __('Person', 'lsx-health-plan'); |
|
26 | 26 | } else { |
27 | - $serves_label = __( 'People', 'lsx-health-plan' ); |
|
27 | + $serves_label = __('People', 'lsx-health-plan'); |
|
28 | 28 | } |
29 | 29 | ?> |
30 | 30 | <tr class="serves"> |
31 | - <td><?php esc_html_e( 'Serves:', 'lsx-health-plan' ); ?> </td> |
|
31 | + <td><?php esc_html_e('Serves:', 'lsx-health-plan'); ?> </td> |
|
32 | 32 | <td> |
33 | 33 | <?php |
34 | - echo wp_kses_post( $serves ) . ' ' . esc_html( $serves_label ); |
|
34 | + echo wp_kses_post($serves) . ' ' . esc_html($serves_label); |
|
35 | 35 | ?> |
36 | 36 | </td> |
37 | 37 | </tr> |
38 | 38 | <?php |
39 | - if ( ! empty( $prep_time ) ) { |
|
39 | + if ( ! empty($prep_time)) { |
|
40 | 40 | ?> |
41 | 41 | <tr class="prep-time"> |
42 | - <td><?php esc_html_e( 'Prep time: ', 'lsx-health-plan' ); ?> </td> |
|
42 | + <td><?php esc_html_e('Prep time: ', 'lsx-health-plan'); ?> </td> |
|
43 | 43 | <td> |
44 | 44 | <?php |
45 | - echo wp_kses_post( $prep_time ); |
|
45 | + echo wp_kses_post($prep_time); |
|
46 | 46 | ?> |
47 | 47 | </td> |
48 | 48 | </tr> |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | } |
51 | 51 | ?> |
52 | 52 | <?php |
53 | - if ( ! empty( $cooking_time ) ) { |
|
53 | + if ( ! empty($cooking_time)) { |
|
54 | 54 | ?> |
55 | 55 | <tr class="cooking-time"> |
56 | - <td><?php esc_html_e( 'Cooking time: ', 'lsx-health-plan' ); ?> </td> |
|
56 | + <td><?php esc_html_e('Cooking time: ', 'lsx-health-plan'); ?> </td> |
|
57 | 57 | <td> |
58 | 58 | <?php |
59 | - echo wp_kses_post( $cooking_time ); |
|
59 | + echo wp_kses_post($cooking_time); |
|
60 | 60 | ?> |
61 | 61 | </td> |
62 | 62 | </tr> |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | } |
65 | 65 | ?> |
66 | 66 | <?php |
67 | - if ( ! empty( $portion ) ) { |
|
67 | + if ( ! empty($portion)) { |
|
68 | 68 | ?> |
69 | 69 | <tr class="portion-size"> |
70 | - <td><?php esc_html_e( 'Portion size: ', 'lsx-health-plan' ); ?> </td> |
|
70 | + <td><?php esc_html_e('Portion size: ', 'lsx-health-plan'); ?> </td> |
|
71 | 71 | <td> |
72 | 72 | <?php |
73 | - echo wp_kses_post( $portion ); |
|
73 | + echo wp_kses_post($portion); |
|
74 | 74 | ?> |
75 | 75 | </td> |
76 | 76 | </tr> |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | </tbody> |
81 | 81 | </table> |
82 | 82 | <?php } ?> |
83 | -<?php if ( is_single() && is_singular( 'recipe' ) && ( ( ! empty( $energy ) ) || ( ! empty( $protein ) ) || ( ! empty( $carbohydrates ) ) || ( ! empty( $fibre ) ) || ( ! empty( $fat ) ) ) ) { ?> |
|
83 | +<?php if (is_single() && is_singular('recipe') && (( ! empty($energy)) || ( ! empty($protein)) || ( ! empty($carbohydrates)) || ( ! empty($fibre)) || ( ! empty($fat)))) { ?> |
|
84 | 84 | <table class="recipe-table nutritional-info-table"> |
85 | 85 | <thead> |
86 | 86 | <tr> |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | </thead> |
90 | 90 | <tbody> |
91 | 91 | <?php |
92 | - if ( ! empty( $energy ) ) { |
|
92 | + if ( ! empty($energy)) { |
|
93 | 93 | ?> |
94 | 94 | <tr class="energy"> |
95 | - <td><?php esc_html_e( 'Energy: ', 'lsx-health-plan' ); ?> </td> |
|
95 | + <td><?php esc_html_e('Energy: ', 'lsx-health-plan'); ?> </td> |
|
96 | 96 | <td> |
97 | 97 | <?php |
98 | - echo wp_kses_post( $energy ); |
|
98 | + echo wp_kses_post($energy); |
|
99 | 99 | ?> |
100 | 100 | </td> |
101 | 101 | </tr> |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | } |
104 | 104 | ?> |
105 | 105 | <?php |
106 | - if ( ! empty( $protein ) ) { |
|
106 | + if ( ! empty($protein)) { |
|
107 | 107 | ?> |
108 | 108 | <tr class="protein"> |
109 | - <td><?php esc_html_e( 'Protein: ', 'lsx-health-plan' ); ?> </td> |
|
109 | + <td><?php esc_html_e('Protein: ', 'lsx-health-plan'); ?> </td> |
|
110 | 110 | <td> |
111 | 111 | <?php |
112 | - echo wp_kses_post( $protein ); |
|
112 | + echo wp_kses_post($protein); |
|
113 | 113 | ?> |
114 | 114 | </td> |
115 | 115 | </tr> |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | } |
118 | 118 | ?> |
119 | 119 | <?php |
120 | - if ( ! empty( $carbohydrates ) ) { |
|
120 | + if ( ! empty($carbohydrates)) { |
|
121 | 121 | ?> |
122 | 122 | <tr class="carbohydrates"> |
123 | - <td><?php esc_html_e( 'Carbohydrates: ', 'lsx-health-plan' ); ?> </td> |
|
123 | + <td><?php esc_html_e('Carbohydrates: ', 'lsx-health-plan'); ?> </td> |
|
124 | 124 | <td> |
125 | 125 | <?php |
126 | - echo wp_kses_post( $carbohydrates ); |
|
126 | + echo wp_kses_post($carbohydrates); |
|
127 | 127 | ?> |
128 | 128 | </td> |
129 | 129 | </tr> |
@@ -131,13 +131,13 @@ discard block |
||
131 | 131 | } |
132 | 132 | ?> |
133 | 133 | <?php |
134 | - if ( ! empty( $fibre ) ) { |
|
134 | + if ( ! empty($fibre)) { |
|
135 | 135 | ?> |
136 | 136 | <tr class="fibre"> |
137 | - <td><?php esc_html_e( 'Fibre: ', 'lsx-health-plan' ); ?> </td> |
|
137 | + <td><?php esc_html_e('Fibre: ', 'lsx-health-plan'); ?> </td> |
|
138 | 138 | <td> |
139 | 139 | <?php |
140 | - echo wp_kses_post( $fibre ); |
|
140 | + echo wp_kses_post($fibre); |
|
141 | 141 | ?> |
142 | 142 | </td> |
143 | 143 | </tr> |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | } |
146 | 146 | ?> |
147 | 147 | <?php |
148 | - if ( ! empty( $fat ) ) { |
|
148 | + if ( ! empty($fat)) { |
|
149 | 149 | ?> |
150 | 150 | <tr class="fat"> |
151 | - <td><?php esc_html_e( 'Fat: ', 'lsx-health-plan' ); ?> </td> |
|
151 | + <td><?php esc_html_e('Fat: ', 'lsx-health-plan'); ?> </td> |
|
152 | 152 | <td> |
153 | 153 | <?php |
154 | - echo wp_kses_post( $fat ); |
|
154 | + echo wp_kses_post($fat); |
|
155 | 155 | ?> |
156 | 156 | </td> |
157 | 157 | </tr> |
@@ -20,63 +20,63 @@ discard block |
||
20 | 20 | <?php } ?> |
21 | 21 | <tbody> |
22 | 22 | <?php |
23 | - if ( 1 >= (int) $serves ) { |
|
24 | - $serves = '1'; |
|
25 | - $serves_label = __( 'Person', 'lsx-health-plan' ); |
|
26 | - } else { |
|
27 | - $serves_label = __( 'People', 'lsx-health-plan' ); |
|
28 | - } |
|
29 | - ?> |
|
23 | + if ( 1 >= (int) $serves ) { |
|
24 | + $serves = '1'; |
|
25 | + $serves_label = __( 'Person', 'lsx-health-plan' ); |
|
26 | + } else { |
|
27 | + $serves_label = __( 'People', 'lsx-health-plan' ); |
|
28 | + } |
|
29 | + ?> |
|
30 | 30 | <tr class="serves"> |
31 | 31 | <td><?php esc_html_e( 'Serves:', 'lsx-health-plan' ); ?> </td> |
32 | 32 | <td> |
33 | 33 | <?php |
34 | - echo wp_kses_post( $serves ) . ' ' . esc_html( $serves_label ); |
|
35 | - ?> |
|
34 | + echo wp_kses_post( $serves ) . ' ' . esc_html( $serves_label ); |
|
35 | + ?> |
|
36 | 36 | </td> |
37 | 37 | </tr> |
38 | 38 | <?php |
39 | - if ( ! empty( $prep_time ) ) { |
|
40 | - ?> |
|
39 | + if ( ! empty( $prep_time ) ) { |
|
40 | + ?> |
|
41 | 41 | <tr class="prep-time"> |
42 | 42 | <td><?php esc_html_e( 'Prep time: ', 'lsx-health-plan' ); ?> </td> |
43 | 43 | <td> |
44 | 44 | <?php |
45 | - echo wp_kses_post( $prep_time ); |
|
46 | - ?> |
|
45 | + echo wp_kses_post( $prep_time ); |
|
46 | + ?> |
|
47 | 47 | </td> |
48 | 48 | </tr> |
49 | 49 | <?php |
50 | - } |
|
51 | - ?> |
|
50 | + } |
|
51 | + ?> |
|
52 | 52 | <?php |
53 | - if ( ! empty( $cooking_time ) ) { |
|
54 | - ?> |
|
53 | + if ( ! empty( $cooking_time ) ) { |
|
54 | + ?> |
|
55 | 55 | <tr class="cooking-time"> |
56 | 56 | <td><?php esc_html_e( 'Cooking time: ', 'lsx-health-plan' ); ?> </td> |
57 | 57 | <td> |
58 | 58 | <?php |
59 | - echo wp_kses_post( $cooking_time ); |
|
60 | - ?> |
|
59 | + echo wp_kses_post( $cooking_time ); |
|
60 | + ?> |
|
61 | 61 | </td> |
62 | 62 | </tr> |
63 | 63 | <?php |
64 | - } |
|
65 | - ?> |
|
64 | + } |
|
65 | + ?> |
|
66 | 66 | <?php |
67 | - if ( ! empty( $portion ) ) { |
|
68 | - ?> |
|
67 | + if ( ! empty( $portion ) ) { |
|
68 | + ?> |
|
69 | 69 | <tr class="portion-size"> |
70 | 70 | <td><?php esc_html_e( 'Portion size: ', 'lsx-health-plan' ); ?> </td> |
71 | 71 | <td> |
72 | 72 | <?php |
73 | - echo wp_kses_post( $portion ); |
|
74 | - ?> |
|
73 | + echo wp_kses_post( $portion ); |
|
74 | + ?> |
|
75 | 75 | </td> |
76 | 76 | </tr> |
77 | 77 | <?php |
78 | - } |
|
79 | - ?> |
|
78 | + } |
|
79 | + ?> |
|
80 | 80 | </tbody> |
81 | 81 | </table> |
82 | 82 | <?php } ?> |
@@ -89,75 +89,75 @@ discard block |
||
89 | 89 | </thead> |
90 | 90 | <tbody> |
91 | 91 | <?php |
92 | - if ( ! empty( $energy ) ) { |
|
93 | - ?> |
|
92 | + if ( ! empty( $energy ) ) { |
|
93 | + ?> |
|
94 | 94 | <tr class="energy"> |
95 | 95 | <td><?php esc_html_e( 'Energy: ', 'lsx-health-plan' ); ?> </td> |
96 | 96 | <td> |
97 | 97 | <?php |
98 | - echo wp_kses_post( $energy ); |
|
99 | - ?> |
|
98 | + echo wp_kses_post( $energy ); |
|
99 | + ?> |
|
100 | 100 | </td> |
101 | 101 | </tr> |
102 | 102 | <?php |
103 | - } |
|
104 | - ?> |
|
103 | + } |
|
104 | + ?> |
|
105 | 105 | <?php |
106 | - if ( ! empty( $protein ) ) { |
|
107 | - ?> |
|
106 | + if ( ! empty( $protein ) ) { |
|
107 | + ?> |
|
108 | 108 | <tr class="protein"> |
109 | 109 | <td><?php esc_html_e( 'Protein: ', 'lsx-health-plan' ); ?> </td> |
110 | 110 | <td> |
111 | 111 | <?php |
112 | - echo wp_kses_post( $protein ); |
|
113 | - ?> |
|
112 | + echo wp_kses_post( $protein ); |
|
113 | + ?> |
|
114 | 114 | </td> |
115 | 115 | </tr> |
116 | 116 | <?php |
117 | - } |
|
118 | - ?> |
|
117 | + } |
|
118 | + ?> |
|
119 | 119 | <?php |
120 | - if ( ! empty( $carbohydrates ) ) { |
|
121 | - ?> |
|
120 | + if ( ! empty( $carbohydrates ) ) { |
|
121 | + ?> |
|
122 | 122 | <tr class="carbohydrates"> |
123 | 123 | <td><?php esc_html_e( 'Carbohydrates: ', 'lsx-health-plan' ); ?> </td> |
124 | 124 | <td> |
125 | 125 | <?php |
126 | - echo wp_kses_post( $carbohydrates ); |
|
127 | - ?> |
|
126 | + echo wp_kses_post( $carbohydrates ); |
|
127 | + ?> |
|
128 | 128 | </td> |
129 | 129 | </tr> |
130 | 130 | <?php |
131 | - } |
|
132 | - ?> |
|
131 | + } |
|
132 | + ?> |
|
133 | 133 | <?php |
134 | - if ( ! empty( $fibre ) ) { |
|
135 | - ?> |
|
134 | + if ( ! empty( $fibre ) ) { |
|
135 | + ?> |
|
136 | 136 | <tr class="fibre"> |
137 | 137 | <td><?php esc_html_e( 'Fibre: ', 'lsx-health-plan' ); ?> </td> |
138 | 138 | <td> |
139 | 139 | <?php |
140 | - echo wp_kses_post( $fibre ); |
|
141 | - ?> |
|
140 | + echo wp_kses_post( $fibre ); |
|
141 | + ?> |
|
142 | 142 | </td> |
143 | 143 | </tr> |
144 | 144 | <?php |
145 | - } |
|
146 | - ?> |
|
145 | + } |
|
146 | + ?> |
|
147 | 147 | <?php |
148 | - if ( ! empty( $fat ) ) { |
|
149 | - ?> |
|
148 | + if ( ! empty( $fat ) ) { |
|
149 | + ?> |
|
150 | 150 | <tr class="fat"> |
151 | 151 | <td><?php esc_html_e( 'Fat: ', 'lsx-health-plan' ); ?> </td> |
152 | 152 | <td> |
153 | 153 | <?php |
154 | - echo wp_kses_post( $fat ); |
|
155 | - ?> |
|
154 | + echo wp_kses_post( $fat ); |
|
155 | + ?> |
|
156 | 156 | </td> |
157 | 157 | </tr> |
158 | 158 | <?php |
159 | - } |
|
160 | - ?> |
|
159 | + } |
|
160 | + ?> |
|
161 | 161 | </tbody> |
162 | 162 | </table> |
163 | 163 | <?php } ?> |
@@ -14,17 +14,17 @@ |
||
14 | 14 | * @param string $item_id |
15 | 15 | * @return string |
16 | 16 | */ |
17 | -function lsx_health_plan_gallery( $before = '', $after = '', $echo = true, $item_id = false ) { |
|
17 | +function lsx_health_plan_gallery($before = '', $after = '', $echo = true, $item_id = false) { |
|
18 | 18 | $gallery = ''; |
19 | 19 | $lsx_hp = lsx_health_plan(); |
20 | - if ( false === $item_id ) { |
|
20 | + if (false === $item_id) { |
|
21 | 21 | $item_id = get_the_ID(); |
22 | 22 | } |
23 | - if ( $lsx_hp->frontend->gallery->has_gallery( $item_id ) ) { |
|
23 | + if ($lsx_hp->frontend->gallery->has_gallery($item_id)) { |
|
24 | 24 | $gallery = $before . $lsx_hp->frontend->gallery->get_gallery() . $after; |
25 | 25 | } |
26 | - if ( true === $echo ) { |
|
27 | - echo wp_kses_post( $gallery ); |
|
26 | + if (true === $echo) { |
|
27 | + echo wp_kses_post($gallery); |
|
28 | 28 | } else { |
29 | 29 | return $gallery; |
30 | 30 | } |
@@ -15,17 +15,17 @@ |
||
15 | 15 | * @return string |
16 | 16 | */ |
17 | 17 | function lsx_health_plan_gallery( $before = '', $after = '', $echo = true, $item_id = false ) { |
18 | - $gallery = ''; |
|
19 | - $lsx_hp = lsx_health_plan(); |
|
20 | - if ( false === $item_id ) { |
|
21 | - $item_id = get_the_ID(); |
|
22 | - } |
|
23 | - if ( $lsx_hp->frontend->gallery->has_gallery( $item_id ) ) { |
|
24 | - $gallery = $before . $lsx_hp->frontend->gallery->get_gallery() . $after; |
|
25 | - } |
|
26 | - if ( true === $echo ) { |
|
27 | - echo wp_kses_post( $gallery ); |
|
28 | - } else { |
|
29 | - return $gallery; |
|
30 | - } |
|
18 | + $gallery = ''; |
|
19 | + $lsx_hp = lsx_health_plan(); |
|
20 | + if ( false === $item_id ) { |
|
21 | + $item_id = get_the_ID(); |
|
22 | + } |
|
23 | + if ( $lsx_hp->frontend->gallery->has_gallery( $item_id ) ) { |
|
24 | + $gallery = $before . $lsx_hp->frontend->gallery->get_gallery() . $after; |
|
25 | + } |
|
26 | + if ( true === $echo ) { |
|
27 | + echo wp_kses_post( $gallery ); |
|
28 | + } else { |
|
29 | + return $gallery; |
|
30 | + } |
|
31 | 31 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public static function get_instance() { |
61 | 61 | |
62 | 62 | // If the single instance hasn't been set, set it now. |
63 | - if ( null === self::$instance ) { |
|
63 | + if (null === self::$instance) { |
|
64 | 64 | self::$instance = new self(); |
65 | 65 | } |
66 | 66 | |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | * @return void |
108 | 108 | */ |
109 | 109 | public function get_post_types() { |
110 | - $post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) ); |
|
111 | - foreach ( $post_types as $index => $post_type ) { |
|
112 | - $is_disabled = \cmb2_get_option( 'lsx_health_plan_options', $post_type . '_disabled', false ); |
|
113 | - if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
114 | - unset( $post_types[ $index ] ); |
|
110 | + $post_types = apply_filters('lsx_health_plan_post_types', isset($this->post_types)); |
|
111 | + foreach ($post_types as $index => $post_type) { |
|
112 | + $is_disabled = \cmb2_get_option('lsx_health_plan_options', $post_type . '_disabled', false); |
|
113 | + if (true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled) { |
|
114 | + unset($post_types[$index]); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | return $post_types; |
@@ -8,115 +8,115 @@ |
||
8 | 8 | */ |
9 | 9 | class Core { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\Core() |
|
17 | - */ |
|
18 | - protected static $instance = null; |
|
19 | - |
|
20 | - /** |
|
21 | - * @var object \lsx_health_plan\classes\Setup(); |
|
22 | - */ |
|
23 | - public $setup; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var object \lsx_health_plan\classes\Admin(); |
|
27 | - */ |
|
28 | - public $admin; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var object \lsx_health_plan\classes\Frontend(); |
|
32 | - */ |
|
33 | - public $frontend; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var object \lsx_health_plan\classes\Integrations(); |
|
37 | - */ |
|
38 | - public $integrations; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var object \lsx_health_plan\classes\Integrations(); |
|
42 | - */ |
|
43 | - public $scpo_engine; |
|
44 | - |
|
45 | - /** |
|
46 | - * Contructor |
|
47 | - */ |
|
48 | - public function __construct() { |
|
49 | - $this->load_includes(); |
|
50 | - $this->load_classes(); |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * Return an instance of this class. |
|
55 | - * |
|
56 | - * @since 1.0.0 |
|
57 | - * |
|
58 | - * @return object \lsx_health_plan\classes\Core() A single instance of this class. |
|
59 | - */ |
|
60 | - public static function get_instance() { |
|
61 | - |
|
62 | - // If the single instance hasn't been set, set it now. |
|
63 | - if ( null === self::$instance ) { |
|
64 | - self::$instance = new self(); |
|
65 | - } |
|
66 | - |
|
67 | - return self::$instance; |
|
68 | - |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Loads the variable classes and the static classes. |
|
73 | - */ |
|
74 | - private function load_classes() { |
|
75 | - |
|
76 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/class-setup.php'; |
|
77 | - $this->setup = Setup::get_instance(); |
|
78 | - |
|
79 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/class-admin.php'; |
|
80 | - $this->admin = Admin::get_instance(); |
|
81 | - |
|
82 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/class-frontend.php'; |
|
83 | - $this->frontend = Frontend::get_instance(); |
|
84 | - |
|
85 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/class-integrations.php'; |
|
86 | - $this->integrations = Integrations::get_instance(); |
|
87 | - |
|
88 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/class-scpo-engine.php'; |
|
89 | - $this->scpo_engine = SCPO_Engine::get_instance(); |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * Loads the plugin functions. |
|
94 | - */ |
|
95 | - private function load_includes() { |
|
96 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/functions.php'; |
|
97 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/functions/recipes.php'; |
|
98 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/functions/plan.php'; |
|
99 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/conditionals.php'; |
|
100 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags.php'; |
|
101 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/exercise.php'; |
|
102 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/gallery.php'; |
|
103 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/plan.php'; |
|
104 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/shortcodes.php'; |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * Returns the post types currently active |
|
109 | - * |
|
110 | - * @return void |
|
111 | - */ |
|
112 | - public function get_post_types() { |
|
113 | - $post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) ); |
|
114 | - foreach ( $post_types as $index => $post_type ) { |
|
115 | - $is_disabled = \cmb2_get_option( 'lsx_health_plan_options', $post_type . '_disabled', false ); |
|
116 | - if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
117 | - unset( $post_types[ $index ] ); |
|
118 | - } |
|
119 | - } |
|
120 | - return $post_types; |
|
121 | - } |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * |
|
16 | + * @var object \lsx_health_plan\classes\Core() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | + |
|
20 | + /** |
|
21 | + * @var object \lsx_health_plan\classes\Setup(); |
|
22 | + */ |
|
23 | + public $setup; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var object \lsx_health_plan\classes\Admin(); |
|
27 | + */ |
|
28 | + public $admin; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var object \lsx_health_plan\classes\Frontend(); |
|
32 | + */ |
|
33 | + public $frontend; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var object \lsx_health_plan\classes\Integrations(); |
|
37 | + */ |
|
38 | + public $integrations; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var object \lsx_health_plan\classes\Integrations(); |
|
42 | + */ |
|
43 | + public $scpo_engine; |
|
44 | + |
|
45 | + /** |
|
46 | + * Contructor |
|
47 | + */ |
|
48 | + public function __construct() { |
|
49 | + $this->load_includes(); |
|
50 | + $this->load_classes(); |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * Return an instance of this class. |
|
55 | + * |
|
56 | + * @since 1.0.0 |
|
57 | + * |
|
58 | + * @return object \lsx_health_plan\classes\Core() A single instance of this class. |
|
59 | + */ |
|
60 | + public static function get_instance() { |
|
61 | + |
|
62 | + // If the single instance hasn't been set, set it now. |
|
63 | + if ( null === self::$instance ) { |
|
64 | + self::$instance = new self(); |
|
65 | + } |
|
66 | + |
|
67 | + return self::$instance; |
|
68 | + |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Loads the variable classes and the static classes. |
|
73 | + */ |
|
74 | + private function load_classes() { |
|
75 | + |
|
76 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/class-setup.php'; |
|
77 | + $this->setup = Setup::get_instance(); |
|
78 | + |
|
79 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/class-admin.php'; |
|
80 | + $this->admin = Admin::get_instance(); |
|
81 | + |
|
82 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/class-frontend.php'; |
|
83 | + $this->frontend = Frontend::get_instance(); |
|
84 | + |
|
85 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/class-integrations.php'; |
|
86 | + $this->integrations = Integrations::get_instance(); |
|
87 | + |
|
88 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/class-scpo-engine.php'; |
|
89 | + $this->scpo_engine = SCPO_Engine::get_instance(); |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * Loads the plugin functions. |
|
94 | + */ |
|
95 | + private function load_includes() { |
|
96 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/functions.php'; |
|
97 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/functions/recipes.php'; |
|
98 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/functions/plan.php'; |
|
99 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/conditionals.php'; |
|
100 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags.php'; |
|
101 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/exercise.php'; |
|
102 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/gallery.php'; |
|
103 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/plan.php'; |
|
104 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/shortcodes.php'; |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * Returns the post types currently active |
|
109 | + * |
|
110 | + * @return void |
|
111 | + */ |
|
112 | + public function get_post_types() { |
|
113 | + $post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) ); |
|
114 | + foreach ( $post_types as $index => $post_type ) { |
|
115 | + $is_disabled = \cmb2_get_option( 'lsx_health_plan_options', $post_type . '_disabled', false ); |
|
116 | + if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) { |
|
117 | + unset( $post_types[ $index ] ); |
|
118 | + } |
|
119 | + } |
|
120 | + return $post_types; |
|
121 | + } |
|
122 | 122 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * Contructor |
29 | 29 | */ |
30 | 30 | public function __construct() { |
31 | - add_action( 'wp_footer', array( $this, 'output_modals' ) ); |
|
31 | + add_action('wp_footer', array($this, 'output_modals')); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function get_instance() { |
42 | 42 | // If the single instance hasn't been set, set it now. |
43 | - if ( null === self::$instance ) { |
|
43 | + if (null === self::$instance) { |
|
44 | 44 | self::$instance = new self(); |
45 | 45 | } |
46 | 46 | return self::$instance; |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | * @param string $index |
54 | 54 | * @return void |
55 | 55 | */ |
56 | - public function register_modal( $modal = array(), $index = '' ) { |
|
57 | - if ( '' !== $index && ! empty( $modal ) ) { |
|
56 | + public function register_modal($modal = array(), $index = '') { |
|
57 | + if ('' !== $index && ! empty($modal)) { |
|
58 | 58 | $modal['id'] = $index; |
59 | - $this->modals[ $index ] = $modal; |
|
59 | + $this->modals[$index] = $modal; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * Registers the rewrites. |
65 | 65 | */ |
66 | 66 | public function output_modals() { |
67 | - if ( ! empty( $this->modals ) ) { |
|
68 | - wp_enqueue_script( 'lsx-health-plan-modals', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-modals.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
|
67 | + if ( ! empty($this->modals)) { |
|
68 | + wp_enqueue_script('lsx-health-plan-modals', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-modals.min.js', array('slick'), LSX_HEALTH_PLAN_VER, true); |
|
69 | 69 | |
70 | - foreach ( $this->modals as $index => $modal ) { |
|
71 | - \lsx_health_plan\functions\output_modal( $modal ); |
|
70 | + foreach ($this->modals as $index => $modal) { |
|
71 | + \lsx_health_plan\functions\output_modal($modal); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | } |
@@ -8,68 +8,68 @@ |
||
8 | 8 | */ |
9 | 9 | class Modals { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\Modals() |
|
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\Modals() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Holds the modals to be outputted |
|
22 | - * |
|
23 | - * @var array |
|
24 | - */ |
|
25 | - public $modals = array(); |
|
20 | + /** |
|
21 | + * Holds the modals to be outputted |
|
22 | + * |
|
23 | + * @var array |
|
24 | + */ |
|
25 | + public $modals = array(); |
|
26 | 26 | |
27 | - /** |
|
28 | - * Contructor |
|
29 | - */ |
|
30 | - public function __construct() { |
|
31 | - add_action( 'wp_footer', array( $this, 'output_modals' ) ); |
|
32 | - } |
|
27 | + /** |
|
28 | + * Contructor |
|
29 | + */ |
|
30 | + public function __construct() { |
|
31 | + add_action( 'wp_footer', array( $this, 'output_modals' ) ); |
|
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\Endpoints() A single instance of this class. |
|
40 | - */ |
|
41 | - public static function get_instance() { |
|
42 | - // If the single instance hasn't been set, set it now. |
|
43 | - if ( null === self::$instance ) { |
|
44 | - self::$instance = new self(); |
|
45 | - } |
|
46 | - return self::$instance; |
|
47 | - } |
|
34 | + /** |
|
35 | + * Return an instance of this class. |
|
36 | + * |
|
37 | + * @since 1.0.0 |
|
38 | + * |
|
39 | + * @return object \lsx_health_plan\classes\Endpoints() A single instance of this class. |
|
40 | + */ |
|
41 | + public static function get_instance() { |
|
42 | + // If the single instance hasn't been set, set it now. |
|
43 | + if ( null === self::$instance ) { |
|
44 | + self::$instance = new self(); |
|
45 | + } |
|
46 | + return self::$instance; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Registers a modal to be outputted |
|
51 | - * |
|
52 | - * @param array $modal |
|
53 | - * @param string $index |
|
54 | - * @return void |
|
55 | - */ |
|
56 | - public function register_modal( $modal = array(), $index = '' ) { |
|
57 | - if ( '' !== $index && ! empty( $modal ) ) { |
|
58 | - $modal['id'] = $index; |
|
59 | - $this->modals[ $index ] = $modal; |
|
60 | - } |
|
61 | - } |
|
49 | + /** |
|
50 | + * Registers a modal to be outputted |
|
51 | + * |
|
52 | + * @param array $modal |
|
53 | + * @param string $index |
|
54 | + * @return void |
|
55 | + */ |
|
56 | + public function register_modal( $modal = array(), $index = '' ) { |
|
57 | + if ( '' !== $index && ! empty( $modal ) ) { |
|
58 | + $modal['id'] = $index; |
|
59 | + $this->modals[ $index ] = $modal; |
|
60 | + } |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Registers the rewrites. |
|
65 | - */ |
|
66 | - public function output_modals() { |
|
67 | - if ( ! empty( $this->modals ) ) { |
|
68 | - wp_enqueue_script( 'lsx-health-plan-modals', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-modals.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
|
63 | + /** |
|
64 | + * Registers the rewrites. |
|
65 | + */ |
|
66 | + public function output_modals() { |
|
67 | + if ( ! empty( $this->modals ) ) { |
|
68 | + wp_enqueue_script( 'lsx-health-plan-modals', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-modals.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
|
69 | 69 | |
70 | - foreach ( $this->modals as $index => $modal ) { |
|
71 | - \lsx_health_plan\functions\output_modal( $modal ); |
|
72 | - } |
|
73 | - } |
|
74 | - } |
|
70 | + foreach ( $this->modals as $index => $modal ) { |
|
71 | + \lsx_health_plan\functions\output_modal( $modal ); |
|
72 | + } |
|
73 | + } |
|
74 | + } |
|
75 | 75 | } |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * Contructor |
31 | 31 | */ |
32 | 32 | public function __construct() { |
33 | - add_action( 'cmb2_admin_init', array( $this, 'downloads_post_type_metaboxes' ), 5 ); |
|
34 | - add_action( 'cmb2_admin_init', array( $this, 'download_connections' ), 5 ); |
|
35 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
33 | + add_action('cmb2_admin_init', array($this, 'downloads_post_type_metaboxes'), 5); |
|
34 | + add_action('cmb2_admin_init', array($this, 'download_connections'), 5); |
|
35 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function get_instance() { |
46 | 46 | // If the single instance hasn't been set, set it now. |
47 | - if ( null === self::$instance ) { |
|
47 | + if (null === self::$instance) { |
|
48 | 48 | self::$instance = new self(); |
49 | 49 | } |
50 | 50 | return self::$instance; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param array $connections |
57 | 57 | * @return void |
58 | 58 | */ |
59 | - public function enable_connections( $connections = array() ) { |
|
59 | + public function enable_connections($connections = array()) { |
|
60 | 60 | $connections['dlm_download']['connected_pages'] = 'connected_downloads'; |
61 | 61 | $connections['dlm_download']['connected_workouts'] = 'connected_downloads'; |
62 | 62 | $connections['dlm_download']['connected_meals'] = 'connected_downloads'; |
@@ -74,66 +74,66 @@ discard block |
||
74 | 74 | * Define the metabox and field configurations. |
75 | 75 | */ |
76 | 76 | public function downloads_post_type_metaboxes() { |
77 | - $cmb = new_cmb2_box( array( |
|
77 | + $cmb = new_cmb2_box(array( |
|
78 | 78 | 'id' => $this->slug . '_connections_metabox', |
79 | - 'title' => __( 'Connections', 'lsx-health-plan' ), |
|
80 | - 'object_types' => array( 'dlm_download' ), // Post type |
|
79 | + 'title' => __('Connections', 'lsx-health-plan'), |
|
80 | + 'object_types' => array('dlm_download'), // Post type |
|
81 | 81 | 'context' => 'normal', |
82 | 82 | 'priority' => 'high', |
83 | 83 | 'show_names' => true, |
84 | - ) ); |
|
85 | - $cmb->add_field( array( |
|
86 | - 'name' => __( 'Pages', 'lsx-health-plan' ), |
|
84 | + )); |
|
85 | + $cmb->add_field(array( |
|
86 | + 'name' => __('Pages', 'lsx-health-plan'), |
|
87 | 87 | 'id' => 'connected_pages', |
88 | 88 | 'type' => 'post_search_ajax', |
89 | 89 | // Optional : |
90 | - 'limit' => 10, // Limit selection to X items only (default 1) |
|
90 | + 'limit' => 10, // Limit selection to X items only (default 1) |
|
91 | 91 | 'sortable' => true, // Allow selected items to be sortable (default false) |
92 | 92 | 'query_args' => array( |
93 | - 'post_type' => array( 'page' ), |
|
94 | - 'post_status' => array( 'publish' ), |
|
93 | + 'post_type' => array('page'), |
|
94 | + 'post_status' => array('publish'), |
|
95 | 95 | 'posts_per_page' => -1, |
96 | 96 | ), |
97 | - ) ); |
|
98 | - $cmb->add_field( array( |
|
99 | - 'name' => __( 'Workouts', 'lsx-health-plan' ), |
|
97 | + )); |
|
98 | + $cmb->add_field(array( |
|
99 | + 'name' => __('Workouts', 'lsx-health-plan'), |
|
100 | 100 | 'id' => 'connected_workouts', |
101 | 101 | 'type' => 'post_search_ajax', |
102 | 102 | // Optional : |
103 | - 'limit' => 10, // Limit selection to X items only (default 1) |
|
103 | + 'limit' => 10, // Limit selection to X items only (default 1) |
|
104 | 104 | 'sortable' => true, // Allow selected items to be sortable (default false) |
105 | 105 | 'query_args' => array( |
106 | - 'post_type' => array( 'workout' ), |
|
107 | - 'post_status' => array( 'publish' ), |
|
106 | + 'post_type' => array('workout'), |
|
107 | + 'post_status' => array('publish'), |
|
108 | 108 | 'posts_per_page' => -1, |
109 | 109 | ), |
110 | - ) ); |
|
111 | - $cmb->add_field( array( |
|
112 | - 'name' => __( 'Meals', 'lsx-health-plan' ), |
|
110 | + )); |
|
111 | + $cmb->add_field(array( |
|
112 | + 'name' => __('Meals', 'lsx-health-plan'), |
|
113 | 113 | 'id' => 'connected_meals', |
114 | 114 | 'type' => 'post_search_ajax', |
115 | 115 | // Optional : |
116 | - 'limit' => 10, // Limit selection to X items only (default 1) |
|
117 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
116 | + 'limit' => 10, // Limit selection to X items only (default 1) |
|
117 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
118 | 118 | 'query_args' => array( |
119 | - 'post_type' => array( 'meal' ), |
|
120 | - 'post_status' => array( 'publish' ), |
|
119 | + 'post_type' => array('meal'), |
|
120 | + 'post_status' => array('publish'), |
|
121 | 121 | 'posts_per_page' => -1, |
122 | 122 | ), |
123 | - ) ); |
|
124 | - $cmb->add_field( array( |
|
125 | - 'name' => __( 'Recipe', 'lsx-health-plan' ), |
|
123 | + )); |
|
124 | + $cmb->add_field(array( |
|
125 | + 'name' => __('Recipe', 'lsx-health-plan'), |
|
126 | 126 | 'id' => 'connected_recipes', |
127 | 127 | 'type' => 'post_search_ajax', |
128 | 128 | // Optional : |
129 | 129 | 'limit' => 10, // Limit selection to X items only (default 1) |
130 | 130 | 'sortable' => true, // Allow selected items to be sortable (default false) |
131 | 131 | 'query_args' => array( |
132 | - 'post_type' => array( 'recipe' ), |
|
133 | - 'post_status' => array( 'publish' ), |
|
132 | + 'post_type' => array('recipe'), |
|
133 | + 'post_status' => array('publish'), |
|
134 | 134 | 'posts_per_page' => -1, |
135 | 135 | ), |
136 | - ) ); |
|
136 | + )); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -142,27 +142,27 @@ discard block |
||
142 | 142 | * @return void |
143 | 143 | */ |
144 | 144 | public function download_connections() { |
145 | - $cmb = new_cmb2_box( array( |
|
145 | + $cmb = new_cmb2_box(array( |
|
146 | 146 | 'id' => $this->slug . '_metabox', |
147 | - 'title' => __( 'Downloads', 'lsx-health-plan' ), |
|
148 | - 'object_types' => array( 'workout', 'meal', 'recipe' ), // Post type |
|
147 | + 'title' => __('Downloads', 'lsx-health-plan'), |
|
148 | + 'object_types' => array('workout', 'meal', 'recipe'), // Post type |
|
149 | 149 | 'context' => 'normal', |
150 | 150 | 'priority' => 'high', |
151 | 151 | 'show_names' => true, |
152 | - ) ); |
|
153 | - $cmb->add_field( array( |
|
154 | - 'name' => __( 'Downloads', 'lsx-health-plan' ), |
|
155 | - 'desc' => __( "Add the pdf's connected to this day plan, using the field provided.", 'lsx-health-plan' ), |
|
152 | + )); |
|
153 | + $cmb->add_field(array( |
|
154 | + 'name' => __('Downloads', 'lsx-health-plan'), |
|
155 | + 'desc' => __("Add the pdf's connected to this day plan, using the field provided.", 'lsx-health-plan'), |
|
156 | 156 | 'id' => 'connected_downloads', |
157 | 157 | 'type' => 'post_search_ajax', |
158 | 158 | // Optional |
159 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
159 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
160 | 160 | 'sortable' => true, // Allow selected items to be sortable (default false) |
161 | 161 | 'query_args' => array( |
162 | - 'post_type' => array( 'dlm_download' ), |
|
163 | - 'post_status' => array( 'publish' ), |
|
162 | + 'post_type' => array('dlm_download'), |
|
163 | + 'post_status' => array('publish'), |
|
164 | 164 | 'posts_per_page' => -1, |
165 | 165 | ), |
166 | - ) ); |
|
166 | + )); |
|
167 | 167 | } |
168 | 168 | } |
@@ -8,161 +8,161 @@ |
||
8 | 8 | */ |
9 | 9 | class Download_Monitor { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\Download_Monitor() |
|
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\Download_Monitor() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Holds post_type slug used as an index |
|
22 | - * |
|
23 | - * @since 1.0.0 |
|
24 | - * |
|
25 | - * @var string |
|
26 | - */ |
|
27 | - public $slug = 'download'; |
|
20 | + /** |
|
21 | + * Holds post_type slug used as an index |
|
22 | + * |
|
23 | + * @since 1.0.0 |
|
24 | + * |
|
25 | + * @var string |
|
26 | + */ |
|
27 | + public $slug = 'download'; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Contructor |
|
31 | - */ |
|
32 | - public function __construct() { |
|
33 | - add_action( 'cmb2_admin_init', array( $this, 'downloads_post_type_metaboxes' ), 5 ); |
|
34 | - add_action( 'cmb2_admin_init', array( $this, 'download_connections' ), 5 ); |
|
35 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
36 | - } |
|
29 | + /** |
|
30 | + * Contructor |
|
31 | + */ |
|
32 | + public function __construct() { |
|
33 | + add_action( 'cmb2_admin_init', array( $this, 'downloads_post_type_metaboxes' ), 5 ); |
|
34 | + add_action( 'cmb2_admin_init', array( $this, 'download_connections' ), 5 ); |
|
35 | + add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Return an instance of this class. |
|
40 | - * |
|
41 | - * @since 1.0.0 |
|
42 | - * |
|
43 | - * @return object \lsx_health_plan\classes\Download_Monitor() A single instance of this class. |
|
44 | - */ |
|
45 | - public static function get_instance() { |
|
46 | - // If the single instance hasn't been set, set it now. |
|
47 | - if ( null === self::$instance ) { |
|
48 | - self::$instance = new self(); |
|
49 | - } |
|
50 | - return self::$instance; |
|
51 | - } |
|
38 | + /** |
|
39 | + * Return an instance of this class. |
|
40 | + * |
|
41 | + * @since 1.0.0 |
|
42 | + * |
|
43 | + * @return object \lsx_health_plan\classes\Download_Monitor() A single instance of this class. |
|
44 | + */ |
|
45 | + public static function get_instance() { |
|
46 | + // If the single instance hasn't been set, set it now. |
|
47 | + if ( null === self::$instance ) { |
|
48 | + self::$instance = new self(); |
|
49 | + } |
|
50 | + return self::$instance; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Enables the Bi Directional relationships |
|
55 | - * |
|
56 | - * @param array $connections |
|
57 | - * @return void |
|
58 | - */ |
|
59 | - public function enable_connections( $connections = array() ) { |
|
60 | - $connections['dlm_download']['connected_pages'] = 'connected_downloads'; |
|
61 | - $connections['dlm_download']['connected_workouts'] = 'connected_downloads'; |
|
62 | - $connections['dlm_download']['connected_meals'] = 'connected_downloads'; |
|
63 | - $connections['dlm_download']['connected_recipes'] = 'connected_downloads'; |
|
53 | + /** |
|
54 | + * Enables the Bi Directional relationships |
|
55 | + * |
|
56 | + * @param array $connections |
|
57 | + * @return void |
|
58 | + */ |
|
59 | + public function enable_connections( $connections = array() ) { |
|
60 | + $connections['dlm_download']['connected_pages'] = 'connected_downloads'; |
|
61 | + $connections['dlm_download']['connected_workouts'] = 'connected_downloads'; |
|
62 | + $connections['dlm_download']['connected_meals'] = 'connected_downloads'; |
|
63 | + $connections['dlm_download']['connected_recipes'] = 'connected_downloads'; |
|
64 | 64 | |
65 | - //Post Type Connections |
|
66 | - $connections['workout']['connected_downloads'] = 'connected_workouts'; |
|
67 | - $connections['meal']['connected_downloads'] = 'connected_meals'; |
|
68 | - $connections['recipe']['connected_downloads'] = 'connected_recipes'; |
|
69 | - $connections['page']['connected_downloads'] = 'connected_pages'; |
|
70 | - return $connections; |
|
71 | - } |
|
65 | + //Post Type Connections |
|
66 | + $connections['workout']['connected_downloads'] = 'connected_workouts'; |
|
67 | + $connections['meal']['connected_downloads'] = 'connected_meals'; |
|
68 | + $connections['recipe']['connected_downloads'] = 'connected_recipes'; |
|
69 | + $connections['page']['connected_downloads'] = 'connected_pages'; |
|
70 | + return $connections; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Define the metabox and field configurations. |
|
75 | - */ |
|
76 | - public function downloads_post_type_metaboxes() { |
|
77 | - $cmb = new_cmb2_box( array( |
|
78 | - 'id' => $this->slug . '_connections_metabox', |
|
79 | - 'title' => __( 'Connections', 'lsx-health-plan' ), |
|
80 | - 'object_types' => array( 'dlm_download' ), // Post type |
|
81 | - 'context' => 'normal', |
|
82 | - 'priority' => 'high', |
|
83 | - 'show_names' => true, |
|
84 | - ) ); |
|
85 | - $cmb->add_field( array( |
|
86 | - 'name' => __( 'Pages', 'lsx-health-plan' ), |
|
87 | - 'id' => 'connected_pages', |
|
88 | - 'type' => 'post_search_ajax', |
|
89 | - // Optional : |
|
90 | - 'limit' => 10, // Limit selection to X items only (default 1) |
|
91 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
92 | - 'query_args' => array( |
|
93 | - 'post_type' => array( 'page' ), |
|
94 | - 'post_status' => array( 'publish' ), |
|
95 | - 'posts_per_page' => -1, |
|
96 | - ), |
|
97 | - ) ); |
|
98 | - $cmb->add_field( array( |
|
99 | - 'name' => __( 'Workouts', 'lsx-health-plan' ), |
|
100 | - 'id' => 'connected_workouts', |
|
101 | - 'type' => 'post_search_ajax', |
|
102 | - // Optional : |
|
103 | - 'limit' => 10, // Limit selection to X items only (default 1) |
|
104 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
105 | - 'query_args' => array( |
|
106 | - 'post_type' => array( 'workout' ), |
|
107 | - 'post_status' => array( 'publish' ), |
|
108 | - 'posts_per_page' => -1, |
|
109 | - ), |
|
110 | - ) ); |
|
111 | - $cmb->add_field( array( |
|
112 | - 'name' => __( 'Meals', 'lsx-health-plan' ), |
|
113 | - 'id' => 'connected_meals', |
|
114 | - 'type' => 'post_search_ajax', |
|
115 | - // Optional : |
|
116 | - 'limit' => 10, // Limit selection to X items only (default 1) |
|
117 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
118 | - 'query_args' => array( |
|
119 | - 'post_type' => array( 'meal' ), |
|
120 | - 'post_status' => array( 'publish' ), |
|
121 | - 'posts_per_page' => -1, |
|
122 | - ), |
|
123 | - ) ); |
|
124 | - $cmb->add_field( array( |
|
125 | - 'name' => __( 'Recipe', 'lsx-health-plan' ), |
|
126 | - 'id' => 'connected_recipes', |
|
127 | - 'type' => 'post_search_ajax', |
|
128 | - // Optional : |
|
129 | - 'limit' => 10, // Limit selection to X items only (default 1) |
|
130 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
131 | - 'query_args' => array( |
|
132 | - 'post_type' => array( 'recipe' ), |
|
133 | - 'post_status' => array( 'publish' ), |
|
134 | - 'posts_per_page' => -1, |
|
135 | - ), |
|
136 | - ) ); |
|
137 | - } |
|
73 | + /** |
|
74 | + * Define the metabox and field configurations. |
|
75 | + */ |
|
76 | + public function downloads_post_type_metaboxes() { |
|
77 | + $cmb = new_cmb2_box( array( |
|
78 | + 'id' => $this->slug . '_connections_metabox', |
|
79 | + 'title' => __( 'Connections', 'lsx-health-plan' ), |
|
80 | + 'object_types' => array( 'dlm_download' ), // Post type |
|
81 | + 'context' => 'normal', |
|
82 | + 'priority' => 'high', |
|
83 | + 'show_names' => true, |
|
84 | + ) ); |
|
85 | + $cmb->add_field( array( |
|
86 | + 'name' => __( 'Pages', 'lsx-health-plan' ), |
|
87 | + 'id' => 'connected_pages', |
|
88 | + 'type' => 'post_search_ajax', |
|
89 | + // Optional : |
|
90 | + 'limit' => 10, // Limit selection to X items only (default 1) |
|
91 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
92 | + 'query_args' => array( |
|
93 | + 'post_type' => array( 'page' ), |
|
94 | + 'post_status' => array( 'publish' ), |
|
95 | + 'posts_per_page' => -1, |
|
96 | + ), |
|
97 | + ) ); |
|
98 | + $cmb->add_field( array( |
|
99 | + 'name' => __( 'Workouts', 'lsx-health-plan' ), |
|
100 | + 'id' => 'connected_workouts', |
|
101 | + 'type' => 'post_search_ajax', |
|
102 | + // Optional : |
|
103 | + 'limit' => 10, // Limit selection to X items only (default 1) |
|
104 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
105 | + 'query_args' => array( |
|
106 | + 'post_type' => array( 'workout' ), |
|
107 | + 'post_status' => array( 'publish' ), |
|
108 | + 'posts_per_page' => -1, |
|
109 | + ), |
|
110 | + ) ); |
|
111 | + $cmb->add_field( array( |
|
112 | + 'name' => __( 'Meals', 'lsx-health-plan' ), |
|
113 | + 'id' => 'connected_meals', |
|
114 | + 'type' => 'post_search_ajax', |
|
115 | + // Optional : |
|
116 | + 'limit' => 10, // Limit selection to X items only (default 1) |
|
117 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
118 | + 'query_args' => array( |
|
119 | + 'post_type' => array( 'meal' ), |
|
120 | + 'post_status' => array( 'publish' ), |
|
121 | + 'posts_per_page' => -1, |
|
122 | + ), |
|
123 | + ) ); |
|
124 | + $cmb->add_field( array( |
|
125 | + 'name' => __( 'Recipe', 'lsx-health-plan' ), |
|
126 | + 'id' => 'connected_recipes', |
|
127 | + 'type' => 'post_search_ajax', |
|
128 | + // Optional : |
|
129 | + 'limit' => 10, // Limit selection to X items only (default 1) |
|
130 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
131 | + 'query_args' => array( |
|
132 | + 'post_type' => array( 'recipe' ), |
|
133 | + 'post_status' => array( 'publish' ), |
|
134 | + 'posts_per_page' => -1, |
|
135 | + ), |
|
136 | + ) ); |
|
137 | + } |
|
138 | 138 | |
139 | - /** |
|
140 | - * Registers the workout connections on the plan post type. |
|
141 | - * |
|
142 | - * @return void |
|
143 | - */ |
|
144 | - public function download_connections() { |
|
145 | - $cmb = new_cmb2_box( array( |
|
146 | - 'id' => $this->slug . '_metabox', |
|
147 | - 'title' => __( 'Downloads', 'lsx-health-plan' ), |
|
148 | - 'object_types' => array( 'workout', 'meal', 'recipe' ), // Post type |
|
149 | - 'context' => 'normal', |
|
150 | - 'priority' => 'high', |
|
151 | - 'show_names' => true, |
|
152 | - ) ); |
|
153 | - $cmb->add_field( array( |
|
154 | - 'name' => __( 'Downloads', 'lsx-health-plan' ), |
|
155 | - 'desc' => __( "Add the pdf's connected to this day plan, using the field provided.", 'lsx-health-plan' ), |
|
156 | - 'id' => 'connected_downloads', |
|
157 | - 'type' => 'post_search_ajax', |
|
158 | - // Optional |
|
159 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
160 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
161 | - 'query_args' => array( |
|
162 | - 'post_type' => array( 'dlm_download' ), |
|
163 | - 'post_status' => array( 'publish' ), |
|
164 | - 'posts_per_page' => -1, |
|
165 | - ), |
|
166 | - ) ); |
|
167 | - } |
|
139 | + /** |
|
140 | + * Registers the workout connections on the plan post type. |
|
141 | + * |
|
142 | + * @return void |
|
143 | + */ |
|
144 | + public function download_connections() { |
|
145 | + $cmb = new_cmb2_box( array( |
|
146 | + 'id' => $this->slug . '_metabox', |
|
147 | + 'title' => __( 'Downloads', 'lsx-health-plan' ), |
|
148 | + 'object_types' => array( 'workout', 'meal', 'recipe' ), // Post type |
|
149 | + 'context' => 'normal', |
|
150 | + 'priority' => 'high', |
|
151 | + 'show_names' => true, |
|
152 | + ) ); |
|
153 | + $cmb->add_field( array( |
|
154 | + 'name' => __( 'Downloads', 'lsx-health-plan' ), |
|
155 | + 'desc' => __( "Add the pdf's connected to this day plan, using the field provided.", 'lsx-health-plan' ), |
|
156 | + 'id' => 'connected_downloads', |
|
157 | + 'type' => 'post_search_ajax', |
|
158 | + // Optional |
|
159 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
160 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
161 | + 'query_args' => array( |
|
162 | + 'post_type' => array( 'dlm_download' ), |
|
163 | + 'post_status' => array( 'publish' ), |
|
164 | + 'posts_per_page' => -1, |
|
165 | + ), |
|
166 | + ) ); |
|
167 | + } |
|
168 | 168 | } |