@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | * @return string |
| 14 | 14 | */ |
| 15 | 15 | function restricted_content() { |
| 16 | - $content = ''; |
|
| 17 | - if ( ! is_user_logged_in() ) { |
|
| 18 | - ob_start(); |
|
| 19 | - echo do_shortcode( '[woocommerce_my_account]' ); |
|
| 20 | - $content = ob_get_clean(); |
|
| 21 | - } |
|
| 22 | - return $content; |
|
| 16 | + $content = ''; |
|
| 17 | + if ( ! is_user_logged_in() ) { |
|
| 18 | + ob_start(); |
|
| 19 | + echo do_shortcode( '[woocommerce_my_account]' ); |
|
| 20 | + $content = ob_get_clean(); |
|
| 21 | + } |
|
| 22 | + return $content; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | 30 | function my_profile_tabs() { |
| 31 | - ob_start(); |
|
| 32 | - echo lsx_health_plan_my_profile_tabs(); // WPCS: XSS OK. |
|
| 33 | - $content = ob_get_clean(); |
|
| 34 | - return $content; |
|
| 31 | + ob_start(); |
|
| 32 | + echo lsx_health_plan_my_profile_tabs(); // WPCS: XSS OK. |
|
| 33 | + $content = ob_get_clean(); |
|
| 34 | + return $content; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | * @return void |
| 41 | 41 | */ |
| 42 | 42 | function my_profile_box() { |
| 43 | - ob_start(); |
|
| 44 | - echo lsx_health_plan_my_profile_box(); // WPCS: XSS OK. |
|
| 45 | - $content = ob_get_clean(); |
|
| 46 | - return $content; |
|
| 43 | + ob_start(); |
|
| 44 | + echo lsx_health_plan_my_profile_box(); // WPCS: XSS OK. |
|
| 45 | + $content = ob_get_clean(); |
|
| 46 | + return $content; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | function all_plans_box( $args = array() ) { |
| 55 | 55 | |
| 56 | - ob_start(); |
|
| 57 | - echo lsx_health_plan_all_plans_block(); // WPCS: XSS OK. |
|
| 58 | - $content = ob_get_clean(); |
|
| 59 | - return $content; |
|
| 56 | + ob_start(); |
|
| 57 | + echo lsx_health_plan_all_plans_block(); // WPCS: XSS OK. |
|
| 58 | + $content = ob_get_clean(); |
|
| 59 | + return $content; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -65,20 +65,20 @@ discard block |
||
| 65 | 65 | * @return void |
| 66 | 66 | */ |
| 67 | 67 | function day_plan_box( $args = array() ) { |
| 68 | - $defaults = array( |
|
| 69 | - 'week_view' => false, |
|
| 70 | - 'show_downloads' => false, |
|
| 71 | - 'plan' => '', |
|
| 72 | - ); |
|
| 73 | - $args = wp_parse_args( $args, $defaults ); |
|
| 74 | - ob_start(); |
|
| 75 | - if ( false === $args['week_view'] ) { |
|
| 76 | - echo lsx_health_plan_day_plan_block( $args ); // WPCS: XSS OK. |
|
| 77 | - } else { |
|
| 78 | - echo lsx_health_plan_week_plan_block( $args ); // WPCS: XSS OK. |
|
| 79 | - } |
|
| 80 | - $content = ob_get_clean(); |
|
| 81 | - return $content; |
|
| 68 | + $defaults = array( |
|
| 69 | + 'week_view' => false, |
|
| 70 | + 'show_downloads' => false, |
|
| 71 | + 'plan' => '', |
|
| 72 | + ); |
|
| 73 | + $args = wp_parse_args( $args, $defaults ); |
|
| 74 | + ob_start(); |
|
| 75 | + if ( false === $args['week_view'] ) { |
|
| 76 | + echo lsx_health_plan_day_plan_block( $args ); // WPCS: XSS OK. |
|
| 77 | + } else { |
|
| 78 | + echo lsx_health_plan_week_plan_block( $args ); // WPCS: XSS OK. |
|
| 79 | + } |
|
| 80 | + $content = ob_get_clean(); |
|
| 81 | + return $content; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -88,29 +88,29 @@ discard block |
||
| 88 | 88 | * @return void |
| 89 | 89 | */ |
| 90 | 90 | function exercise_box( $args = array() ) { |
| 91 | - $defaults = array( |
|
| 92 | - 'include' => '', |
|
| 93 | - 'term' => '', |
|
| 94 | - 'taxonomy' => '', |
|
| 95 | - 'view_more' => false, |
|
| 96 | - 'columns' => 3, |
|
| 97 | - 'limit' => 4, |
|
| 98 | - 'post_type' => 'exercise', |
|
| 99 | - 'orderby' => 'date', |
|
| 100 | - 'order' => 'DESC', |
|
| 101 | - 'description' => 'none', |
|
| 102 | - 'link' => 'item', |
|
| 103 | - 'link_class' => 'btn border-btn', |
|
| 104 | - 'layout' => 'grid', |
|
| 105 | - 'image_size' => 'lsx-thumbnail-square', |
|
| 106 | - 'parent' => false, |
|
| 107 | - 'modal_content' => 'excerpt', |
|
| 108 | - ); |
|
| 109 | - $args = wp_parse_args( $args, $defaults ); |
|
| 110 | - ob_start(); |
|
| 111 | - echo lsx_health_plan_items( $args ); // WPCS: XSS OK. |
|
| 112 | - $content = ob_get_clean(); |
|
| 113 | - return $content; |
|
| 91 | + $defaults = array( |
|
| 92 | + 'include' => '', |
|
| 93 | + 'term' => '', |
|
| 94 | + 'taxonomy' => '', |
|
| 95 | + 'view_more' => false, |
|
| 96 | + 'columns' => 3, |
|
| 97 | + 'limit' => 4, |
|
| 98 | + 'post_type' => 'exercise', |
|
| 99 | + 'orderby' => 'date', |
|
| 100 | + 'order' => 'DESC', |
|
| 101 | + 'description' => 'none', |
|
| 102 | + 'link' => 'item', |
|
| 103 | + 'link_class' => 'btn border-btn', |
|
| 104 | + 'layout' => 'grid', |
|
| 105 | + 'image_size' => 'lsx-thumbnail-square', |
|
| 106 | + 'parent' => false, |
|
| 107 | + 'modal_content' => 'excerpt', |
|
| 108 | + ); |
|
| 109 | + $args = wp_parse_args( $args, $defaults ); |
|
| 110 | + ob_start(); |
|
| 111 | + echo lsx_health_plan_items( $args ); // WPCS: XSS OK. |
|
| 112 | + $content = ob_get_clean(); |
|
| 113 | + return $content; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | * @return void |
| 120 | 120 | */ |
| 121 | 121 | function feature_video_box() { |
| 122 | - ob_start(); |
|
| 123 | - echo lsx_health_plan_featured_video_block(); // WPCS: XSS OK. |
|
| 124 | - $content = ob_get_clean(); |
|
| 122 | + ob_start(); |
|
| 123 | + echo lsx_health_plan_featured_video_block(); // WPCS: XSS OK. |
|
| 124 | + $content = ob_get_clean(); |
|
| 125 | 125 | |
| 126 | - wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 127 | - wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 128 | - return $content; |
|
| 126 | + wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 127 | + wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 128 | + return $content; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -134,12 +134,12 @@ discard block |
||
| 134 | 134 | * @return void |
| 135 | 135 | */ |
| 136 | 136 | function feature_recipes_box() { |
| 137 | - ob_start(); |
|
| 138 | - echo lsx_health_plan_featured_recipes_block(); // WPCS: XSS OK. |
|
| 139 | - $content = ob_get_clean(); |
|
| 140 | - wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 141 | - wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 142 | - return $content; |
|
| 137 | + ob_start(); |
|
| 138 | + echo lsx_health_plan_featured_recipes_block(); // WPCS: XSS OK. |
|
| 139 | + $content = ob_get_clean(); |
|
| 140 | + wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 141 | + wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 142 | + return $content; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -148,12 +148,12 @@ discard block |
||
| 148 | 148 | * @return void |
| 149 | 149 | */ |
| 150 | 150 | function feature_tips_box() { |
| 151 | - ob_start(); |
|
| 152 | - echo lsx_health_plan_featured_tips_block(); // WPCS: XSS OK. |
|
| 153 | - $content = ob_get_clean(); |
|
| 154 | - wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 155 | - wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 156 | - return $content; |
|
| 151 | + ob_start(); |
|
| 152 | + echo lsx_health_plan_featured_tips_block(); // WPCS: XSS OK. |
|
| 153 | + $content = ob_get_clean(); |
|
| 154 | + wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 155 | + wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-slider.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 156 | + return $content; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | * @return string |
| 163 | 163 | */ |
| 164 | 164 | function account_notices() { |
| 165 | - $content = ''; |
|
| 166 | - if ( function_exists( 'wc_print_notices' ) ) { |
|
| 167 | - $content = wc_print_notices( true ); |
|
| 168 | - } |
|
| 169 | - return $content; |
|
| 165 | + $content = ''; |
|
| 166 | + if ( function_exists( 'wc_print_notices' ) ) { |
|
| 167 | + $content = wc_print_notices( true ); |
|
| 168 | + } |
|
| 169 | + return $content; |
|
| 170 | 170 | } |
@@ -7,38 +7,38 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | function lsx_hp_single_plan_products() { |
| 10 | - global $product; |
|
| 10 | + global $product; |
|
| 11 | 11 | |
| 12 | - $restricted = false; |
|
| 13 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 14 | - $restricted = wc_memberships_is_post_content_restricted() && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 15 | - } |
|
| 16 | - if ( true === $restricted && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 17 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 18 | - $product_count = count( $products ); |
|
| 19 | - if ( 1 === (int) $product_count ) { |
|
| 20 | - $class = 'col-md-12'; |
|
| 21 | - } else { |
|
| 22 | - $class = 'col-md-6'; |
|
| 23 | - } |
|
| 24 | - ?> |
|
| 12 | + $restricted = false; |
|
| 13 | + if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 14 | + $restricted = wc_memberships_is_post_content_restricted() && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 15 | + } |
|
| 16 | + if ( true === $restricted && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 17 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 18 | + $product_count = count( $products ); |
|
| 19 | + if ( 1 === (int) $product_count ) { |
|
| 20 | + $class = 'col-md-12'; |
|
| 21 | + } else { |
|
| 22 | + $class = 'col-md-6'; |
|
| 23 | + } |
|
| 24 | + ?> |
|
| 25 | 25 | <div class="plans-products-wrapper row"> |
| 26 | 26 | <?php |
| 27 | - foreach ( $products as $product ) { |
|
| 28 | - $product = wc_get_product( $product ); |
|
| 29 | - ?> |
|
| 27 | + foreach ( $products as $product ) { |
|
| 28 | + $product = wc_get_product( $product ); |
|
| 29 | + ?> |
|
| 30 | 30 | <div class="plan-product <?php echo esc_attr( $class ); ?>"> |
| 31 | 31 | <h3 class="title"><a href="<?php echo esc_html( $product->get_permalink() ); ?>"><?php echo esc_html( $product->get_title() ); ?></a></h3> |
| 32 | 32 | <?php |
| 33 | - $description = $product->is_type( 'variation' ) ? $product->get_description() : $product->get_short_description(); |
|
| 34 | - if ( '' !== $description ) { |
|
| 35 | - ?> |
|
| 33 | + $description = $product->is_type( 'variation' ) ? $product->get_description() : $product->get_short_description(); |
|
| 34 | + if ( '' !== $description ) { |
|
| 35 | + ?> |
|
| 36 | 36 | <div class="description"> |
| 37 | 37 | <?php echo esc_html( $description ); ?> |
| 38 | 38 | </div> |
| 39 | 39 | <?php |
| 40 | - } |
|
| 41 | - ?> |
|
| 40 | + } |
|
| 41 | + ?> |
|
| 42 | 42 | <?php echo wp_kses_post( $product->get_price_html() ); ?> |
| 43 | 43 | |
| 44 | 44 | <div class="add-to-cart"> |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | </div> |
| 47 | 47 | </div> |
| 48 | 48 | <?php |
| 49 | - } |
|
| 50 | - ?> |
|
| 49 | + } |
|
| 50 | + ?> |
|
| 51 | 51 | </div> |
| 52 | 52 | <?php |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -11,10 +11,10 @@ discard block |
||
| 11 | 11 | * @return exercise_type |
| 12 | 12 | */ |
| 13 | 13 | function lsx_health_plan_exercise_type() { |
| 14 | - $term_obj_list = get_the_term_list( get_the_ID(), 'exercise-type', '', ', ' ); |
|
| 15 | - if ( ! empty( $term_obj_list ) ) { |
|
| 16 | - return $term_obj_list; |
|
| 17 | - } |
|
| 14 | + $term_obj_list = get_the_term_list( get_the_ID(), 'exercise-type', '', ', ' ); |
|
| 15 | + if ( ! empty( $term_obj_list ) ) { |
|
| 16 | + return $term_obj_list; |
|
| 17 | + } |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /** |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | * @return muscle_group_equipment |
| 24 | 24 | */ |
| 25 | 25 | function lsx_health_plan_muscle_group_equipment() { |
| 26 | - $term_obj_list = get_the_term_list( get_the_ID(), 'muscle-group', '', ', ' ); |
|
| 27 | - if ( ! empty( $term_obj_list ) ) { |
|
| 28 | - return $term_obj_list; |
|
| 29 | - } |
|
| 26 | + $term_obj_list = get_the_term_list( get_the_ID(), 'muscle-group', '', ', ' ); |
|
| 27 | + if ( ! empty( $term_obj_list ) ) { |
|
| 28 | + return $term_obj_list; |
|
| 29 | + } |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | * @return exercise_equipment |
| 36 | 36 | */ |
| 37 | 37 | function lsx_health_plan_exercise_equipment() { |
| 38 | - $term_obj_list = get_the_term_list( get_the_ID(), 'equipment', '', ', ' ); |
|
| 39 | - if ( ! empty( $term_obj_list ) ) { |
|
| 40 | - return $term_obj_list; |
|
| 41 | - } |
|
| 38 | + $term_obj_list = get_the_term_list( get_the_ID(), 'equipment', '', ', ' ); |
|
| 39 | + if ( ! empty( $term_obj_list ) ) { |
|
| 40 | + return $term_obj_list; |
|
| 41 | + } |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -47,81 +47,81 @@ discard block |
||
| 47 | 47 | * @return void |
| 48 | 48 | */ |
| 49 | 49 | function lsx_health_plan_exercise_data() { |
| 50 | - include LSX_HEALTH_PLAN_PATH . '/templates/table-exercise-data.php'; |
|
| 50 | + include LSX_HEALTH_PLAN_PATH . '/templates/table-exercise-data.php'; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | function lsx_health_plan_workout_exercise_alt_button( $m, $group, $echo = true, $args = array(), $alt_title, $alt_description, $alt_image ) { |
| 54 | - $defaults = array( |
|
| 55 | - 'modal_trigger' => 'button', |
|
| 56 | - 'modal_content' => 'excerpt', |
|
| 57 | - ); |
|
| 58 | - $args = wp_parse_args( $args, $defaults ); |
|
| 54 | + $defaults = array( |
|
| 55 | + 'modal_trigger' => 'button', |
|
| 56 | + 'modal_content' => 'excerpt', |
|
| 57 | + ); |
|
| 58 | + $args = wp_parse_args( $args, $defaults ); |
|
| 59 | 59 | |
| 60 | - $exercise_id = ''; |
|
| 61 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
| 62 | - $exercise_id = esc_html( $group['connected_exercises'] ); |
|
| 63 | - $content = get_post_field( 'post_content', $exercise_id ); |
|
| 64 | - $url = get_permalink( $exercise_id ); |
|
| 65 | - $equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' ); |
|
| 66 | - $muscle_group = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' ); |
|
| 67 | - $lsx_hp = lsx_health_plan(); |
|
| 60 | + $exercise_id = ''; |
|
| 61 | + if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
| 62 | + $exercise_id = esc_html( $group['connected_exercises'] ); |
|
| 63 | + $content = get_post_field( 'post_content', $exercise_id ); |
|
| 64 | + $url = get_permalink( $exercise_id ); |
|
| 65 | + $equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' ); |
|
| 66 | + $muscle_group = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' ); |
|
| 67 | + $lsx_hp = lsx_health_plan(); |
|
| 68 | 68 | |
| 69 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 70 | - $content = wp_trim_words( $content, 40 ); |
|
| 71 | - } |
|
| 69 | + if ( 'excerpt' === $args['modal_content'] ) { |
|
| 70 | + $content = wp_trim_words( $content, 40 ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if ( 'link' ) { |
|
| 74 | - $play_button = '<a data-toggle="modal" href="#workout-alt-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
| 75 | - } else { |
|
| 76 | - $play_button = '<button data-toggle="alt-modal" data-target="#workout-alt-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 77 | - } |
|
| 73 | + if ( 'link' ) { |
|
| 74 | + $play_button = '<a data-toggle="modal" href="#workout-alt-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
| 75 | + } else { |
|
| 76 | + $play_button = '<button data-toggle="alt-modal" data-target="#workout-alt-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - $modal_body = ''; |
|
| 79 | + $modal_body = ''; |
|
| 80 | 80 | |
| 81 | - if ( '' !== $alt_image ) { |
|
| 82 | - $modal_body .= '<div class="modal-image"/><img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '"></div>'; |
|
| 83 | - } else { |
|
| 84 | - if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
| 85 | - $gallery_args = array( |
|
| 86 | - 'css_class' => 'modal-slider', |
|
| 87 | - ); |
|
| 88 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 89 | - } else { |
|
| 90 | - $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
| 91 | - } |
|
| 92 | - } |
|
| 81 | + if ( '' !== $alt_image ) { |
|
| 82 | + $modal_body .= '<div class="modal-image"/><img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '"></div>'; |
|
| 83 | + } else { |
|
| 84 | + if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
| 85 | + $gallery_args = array( |
|
| 86 | + 'css_class' => 'modal-slider', |
|
| 87 | + ); |
|
| 88 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 89 | + } else { |
|
| 90 | + $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - if ( '' !== $alt_title ) { |
|
| 95 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $alt_title . '</h5>'; |
|
| 96 | - } else { |
|
| 97 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
| 98 | - } |
|
| 94 | + if ( '' !== $alt_title ) { |
|
| 95 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $alt_title . '</h5>'; |
|
| 96 | + } else { |
|
| 97 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - if ( ! empty( $equipment_group ) ) { |
|
| 101 | - $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
| 102 | - } |
|
| 103 | - if ( ! empty( $muscle_group ) ) { |
|
| 104 | - $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
|
| 105 | - } |
|
| 106 | - $modal_body .= '</div>'; |
|
| 107 | - if ( '' !== $args['modal_content'] ) { |
|
| 108 | - if ( '' !== $alt_description ) { |
|
| 109 | - $modal_body .= '<div class="modal-excerpt"/>' . $alt_description . '</div>'; |
|
| 110 | - } else { |
|
| 111 | - $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 115 | - $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>'; |
|
| 116 | - } |
|
| 117 | - \lsx_health_plan\functions\register_modal( 'workout-alt-exercise-modal-' . $m, '', $modal_body ); |
|
| 100 | + if ( ! empty( $equipment_group ) ) { |
|
| 101 | + $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
| 102 | + } |
|
| 103 | + if ( ! empty( $muscle_group ) ) { |
|
| 104 | + $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
|
| 105 | + } |
|
| 106 | + $modal_body .= '</div>'; |
|
| 107 | + if ( '' !== $args['modal_content'] ) { |
|
| 108 | + if ( '' !== $alt_description ) { |
|
| 109 | + $modal_body .= '<div class="modal-excerpt"/>' . $alt_description . '</div>'; |
|
| 110 | + } else { |
|
| 111 | + $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + if ( 'excerpt' === $args['modal_content'] ) { |
|
| 115 | + $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>'; |
|
| 116 | + } |
|
| 117 | + \lsx_health_plan\functions\register_modal( 'workout-alt-exercise-modal-' . $m, '', $modal_body ); |
|
| 118 | 118 | |
| 119 | - if ( true === $echo ) { |
|
| 120 | - echo wp_kses_post( $play_button ); |
|
| 121 | - } else { |
|
| 122 | - return $play_button; |
|
| 123 | - } |
|
| 124 | - } |
|
| 119 | + if ( true === $echo ) { |
|
| 120 | + echo wp_kses_post( $play_button ); |
|
| 121 | + } else { |
|
| 122 | + return $play_button; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -134,65 +134,65 @@ discard block |
||
| 134 | 134 | * @return void |
| 135 | 135 | */ |
| 136 | 136 | function lsx_health_plan_workout_exercise_button( $m, $group, $echo = true, $args = array() ) { |
| 137 | - $defaults = array( |
|
| 138 | - 'modal_trigger' => 'button', |
|
| 139 | - 'modal_content' => 'excerpt', |
|
| 140 | - ); |
|
| 141 | - $args = wp_parse_args( $args, $defaults ); |
|
| 137 | + $defaults = array( |
|
| 138 | + 'modal_trigger' => 'button', |
|
| 139 | + 'modal_content' => 'excerpt', |
|
| 140 | + ); |
|
| 141 | + $args = wp_parse_args( $args, $defaults ); |
|
| 142 | 142 | |
| 143 | - $exercise_id = ''; |
|
| 144 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
| 145 | - $exercise_id = esc_html( $group['connected_exercises'] ); |
|
| 146 | - $content = get_post_field( 'post_content', $exercise_id ); |
|
| 147 | - $url = get_permalink( $exercise_id ); |
|
| 148 | - $equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' ); |
|
| 149 | - $muscle_group = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' ); |
|
| 150 | - $lsx_hp = lsx_health_plan(); |
|
| 143 | + $exercise_id = ''; |
|
| 144 | + if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
| 145 | + $exercise_id = esc_html( $group['connected_exercises'] ); |
|
| 146 | + $content = get_post_field( 'post_content', $exercise_id ); |
|
| 147 | + $url = get_permalink( $exercise_id ); |
|
| 148 | + $equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' ); |
|
| 149 | + $muscle_group = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' ); |
|
| 150 | + $lsx_hp = lsx_health_plan(); |
|
| 151 | 151 | |
| 152 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 153 | - $content = wp_trim_words( $content, 40 ); |
|
| 154 | - } |
|
| 152 | + if ( 'excerpt' === $args['modal_content'] ) { |
|
| 153 | + $content = wp_trim_words( $content, 40 ); |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - if ( 'link' ) { |
|
| 157 | - $play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
| 158 | - } else { |
|
| 159 | - $play_button = '<button data-toggle="modal" data-target="#workout-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 160 | - } |
|
| 156 | + if ( 'link' ) { |
|
| 157 | + $play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
| 158 | + } else { |
|
| 159 | + $play_button = '<button data-toggle="modal" data-target="#workout-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | - $modal_body = ''; |
|
| 162 | + $modal_body = ''; |
|
| 163 | 163 | |
| 164 | - if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
| 165 | - $gallery_args = array( |
|
| 166 | - 'css_class' => 'modal-slider', |
|
| 167 | - ); |
|
| 168 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 169 | - } else { |
|
| 170 | - $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
| 171 | - } |
|
| 164 | + if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
| 165 | + $gallery_args = array( |
|
| 166 | + 'css_class' => 'modal-slider', |
|
| 167 | + ); |
|
| 168 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 169 | + } else { |
|
| 170 | + $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
| 173 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
| 174 | 174 | |
| 175 | - if ( ! empty( $equipment_group ) ) { |
|
| 176 | - $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
| 177 | - } |
|
| 178 | - if ( ! empty( $muscle_group ) ) { |
|
| 179 | - $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
|
| 180 | - } |
|
| 181 | - $modal_body .= '</div>'; |
|
| 182 | - if ( '' !== $args['modal_content'] ) { |
|
| 183 | - $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
|
| 184 | - } |
|
| 185 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 186 | - $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>'; |
|
| 187 | - } |
|
| 188 | - \lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body ); |
|
| 175 | + if ( ! empty( $equipment_group ) ) { |
|
| 176 | + $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
| 177 | + } |
|
| 178 | + if ( ! empty( $muscle_group ) ) { |
|
| 179 | + $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
|
| 180 | + } |
|
| 181 | + $modal_body .= '</div>'; |
|
| 182 | + if ( '' !== $args['modal_content'] ) { |
|
| 183 | + $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
|
| 184 | + } |
|
| 185 | + if ( 'excerpt' === $args['modal_content'] ) { |
|
| 186 | + $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>'; |
|
| 187 | + } |
|
| 188 | + \lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body ); |
|
| 189 | 189 | |
| 190 | - if ( true === $echo ) { |
|
| 191 | - echo wp_kses_post( $play_button ); |
|
| 192 | - } else { |
|
| 193 | - return $play_button; |
|
| 194 | - } |
|
| 195 | - } |
|
| 190 | + if ( true === $echo ) { |
|
| 191 | + echo wp_kses_post( $play_button ); |
|
| 192 | + } else { |
|
| 193 | + return $play_button; |
|
| 194 | + } |
|
| 195 | + } |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -203,38 +203,38 @@ discard block |
||
| 203 | 203 | * @return void |
| 204 | 204 | */ |
| 205 | 205 | function lsx_health_plan_shortcode_exercise_button( $m, $content = true ) { |
| 206 | - $equipment_group = get_the_term_list( $m, 'equipment', '', ', ' ); |
|
| 207 | - $muscle_group = get_the_term_list( $m, 'muscle-group', '', ', ' ); |
|
| 208 | - $title = get_the_title(); |
|
| 209 | - $lsx_hp = lsx_health_plan(); |
|
| 210 | - $button = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>'; |
|
| 206 | + $equipment_group = get_the_term_list( $m, 'equipment', '', ', ' ); |
|
| 207 | + $muscle_group = get_the_term_list( $m, 'muscle-group', '', ', ' ); |
|
| 208 | + $title = get_the_title(); |
|
| 209 | + $lsx_hp = lsx_health_plan(); |
|
| 210 | + $button = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>'; |
|
| 211 | 211 | |
| 212 | - if ( true === $content ) { |
|
| 213 | - $content = get_the_content(); |
|
| 214 | - } |
|
| 212 | + if ( true === $content ) { |
|
| 213 | + $content = get_the_content(); |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - $modal_body = ''; |
|
| 217 | - if ( $lsx_hp->frontend->gallery->has_gallery( $m ) ) { |
|
| 218 | - $gallery_args = array( |
|
| 219 | - 'css_class' => 'modal-slider', |
|
| 220 | - ); |
|
| 221 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 222 | - } else { |
|
| 223 | - $modal_body .= '<div class="modal-image">' . get_the_post_thumbnail( $m, 'large' ) . '</div>'; |
|
| 224 | - } |
|
| 225 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $title . '</h5>'; |
|
| 216 | + $modal_body = ''; |
|
| 217 | + if ( $lsx_hp->frontend->gallery->has_gallery( $m ) ) { |
|
| 218 | + $gallery_args = array( |
|
| 219 | + 'css_class' => 'modal-slider', |
|
| 220 | + ); |
|
| 221 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 222 | + } else { |
|
| 223 | + $modal_body .= '<div class="modal-image">' . get_the_post_thumbnail( $m, 'large' ) . '</div>'; |
|
| 224 | + } |
|
| 225 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $title . '</h5>'; |
|
| 226 | 226 | |
| 227 | - if ( ! empty( $equipment_group ) ) { |
|
| 228 | - $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
| 229 | - } |
|
| 230 | - if ( ! empty( $muscle_group ) ) { |
|
| 231 | - $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
|
| 232 | - } |
|
| 233 | - $modal_body .= '</div>'; |
|
| 234 | - $modal_body .= $content; |
|
| 235 | - \lsx_health_plan\functions\register_modal( 'exercise-modal-' . $m, '', $modal_body ); |
|
| 227 | + if ( ! empty( $equipment_group ) ) { |
|
| 228 | + $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
| 229 | + } |
|
| 230 | + if ( ! empty( $muscle_group ) ) { |
|
| 231 | + $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
|
| 232 | + } |
|
| 233 | + $modal_body .= '</div>'; |
|
| 234 | + $modal_body .= $content; |
|
| 235 | + \lsx_health_plan\functions\register_modal( 'exercise-modal-' . $m, '', $modal_body ); |
|
| 236 | 236 | |
| 237 | - return ( $button ); |
|
| 237 | + return ( $button ); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -246,18 +246,18 @@ discard block |
||
| 246 | 246 | * @return string |
| 247 | 247 | */ |
| 248 | 248 | function lsx_health_plan_exercise_title( $before = '', $after = '', $echo = true, $exercise_id = false ) { |
| 249 | - if ( false === $exercise_id ) { |
|
| 250 | - $exercise_id = get_the_ID(); |
|
| 251 | - } |
|
| 252 | - $title = get_the_title( $exercise_id ); |
|
| 253 | - $side = get_post_meta( $exercise_id, 'exercise_side', true ); |
|
| 254 | - if ( '' !== $side ) { |
|
| 255 | - $title .= ' - ' . ucwords( $side ); |
|
| 256 | - } |
|
| 257 | - $title = apply_filters( 'lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id ); |
|
| 258 | - if ( true === $echo ) { |
|
| 259 | - echo wp_kses_post( $title ); |
|
| 260 | - } else { |
|
| 261 | - return $title; |
|
| 262 | - } |
|
| 249 | + if ( false === $exercise_id ) { |
|
| 250 | + $exercise_id = get_the_ID(); |
|
| 251 | + } |
|
| 252 | + $title = get_the_title( $exercise_id ); |
|
| 253 | + $side = get_post_meta( $exercise_id, 'exercise_side', true ); |
|
| 254 | + if ( '' !== $side ) { |
|
| 255 | + $title .= ' - ' . ucwords( $side ); |
|
| 256 | + } |
|
| 257 | + $title = apply_filters( 'lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id ); |
|
| 258 | + if ( true === $echo ) { |
|
| 259 | + echo wp_kses_post( $title ); |
|
| 260 | + } else { |
|
| 261 | + return $title; |
|
| 262 | + } |
|
| 263 | 263 | } |
@@ -22,17 +22,17 @@ discard block |
||
| 22 | 22 | <?php } ?> |
| 23 | 23 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
| 24 | 24 | <?php |
| 25 | - $featured_image = get_the_post_thumbnail(); |
|
| 26 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 27 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 28 | - 'class' => 'aligncenter', |
|
| 29 | - ) ); |
|
| 30 | - } else { |
|
| 31 | - ?> |
|
| 25 | + $featured_image = get_the_post_thumbnail(); |
|
| 26 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 27 | + the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 28 | + 'class' => 'aligncenter', |
|
| 29 | + ) ); |
|
| 30 | + } else { |
|
| 31 | + ?> |
|
| 32 | 32 | <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 33 | 33 | <?php |
| 34 | - } |
|
| 35 | - ?> |
|
| 34 | + } |
|
| 35 | + ?> |
|
| 36 | 36 | </a> |
| 37 | 37 | </div> |
| 38 | 38 | <div class="content-box workout-content-box white-bg"> |
@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | <?php the_title( '<h3 class="workout-title">', '</h3>' ); ?> |
| 41 | 41 | </a> |
| 42 | 42 | <?php |
| 43 | - if ( ! has_excerpt() ) { |
|
| 44 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
| 45 | - $content = '<p>' . $content . '</p>'; |
|
| 46 | - } else { |
|
| 47 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 48 | - } |
|
| 49 | - echo wp_kses_post( $content ); |
|
| 50 | - ?> |
|
| 43 | + if ( ! has_excerpt() ) { |
|
| 44 | + $content = wp_trim_words( get_the_content(), 20 ); |
|
| 45 | + $content = '<p>' . $content . '</p>'; |
|
| 46 | + } else { |
|
| 47 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 48 | + } |
|
| 49 | + echo wp_kses_post( $content ); |
|
| 50 | + ?> |
|
| 51 | 51 | <a href="<?php echo esc_url( get_permalink() ); ?>" class="btn border-btn"><?php esc_html_e( 'See workout', 'lsx-health-plan' ); ?></a> |
| 52 | 52 | </div> |
| 53 | 53 | <?php lsx_entry_bottom(); ?> |
@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | * @return boolean |
| 15 | 15 | */ |
| 16 | 16 | function is_search_enabled() { |
| 17 | - $enabled = false; |
|
| 18 | - if ( function_exists( 'lsx_search' ) ) { |
|
| 19 | - $search_instance = \LSX_Search::get_instance(); |
|
| 20 | - if ( null !== $search_instance ) { |
|
| 21 | - $enabled = $search_instance->frontend->is_search_enabled(); |
|
| 22 | - } |
|
| 23 | - } |
|
| 24 | - return $enabled; |
|
| 17 | + $enabled = false; |
|
| 18 | + if ( function_exists( 'lsx_search' ) ) { |
|
| 19 | + $search_instance = \LSX_Search::get_instance(); |
|
| 20 | + if ( null !== $search_instance ) { |
|
| 21 | + $enabled = $search_instance->frontend->is_search_enabled(); |
|
| 22 | + } |
|
| 23 | + } |
|
| 24 | + return $enabled; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | * @return boolean |
| 32 | 32 | */ |
| 33 | 33 | function has_sections( $plan_id = 0 ) { |
| 34 | - $sections = false; |
|
| 35 | - if ( 0 === $plan_id ) { |
|
| 36 | - $plan_id = get_the_ID(); |
|
| 37 | - } |
|
| 38 | - $lsx_hp = lsx_health_plan(); |
|
| 39 | - $sections = $lsx_hp->frontend->plan_query->query_sections( $plan_id ); |
|
| 40 | - return $sections; |
|
| 34 | + $sections = false; |
|
| 35 | + if ( 0 === $plan_id ) { |
|
| 36 | + $plan_id = get_the_ID(); |
|
| 37 | + } |
|
| 38 | + $lsx_hp = lsx_health_plan(); |
|
| 39 | + $sections = $lsx_hp->frontend->plan_query->query_sections( $plan_id ); |
|
| 40 | + return $sections; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | * @return array |
| 49 | 49 | */ |
| 50 | 50 | function get_sections( $group_sections = false ) { |
| 51 | - $lsx_hp = lsx_health_plan(); |
|
| 52 | - $sections = $lsx_hp->frontend->plan_query->get_sections( $group_sections ); |
|
| 53 | - return $sections; |
|
| 51 | + $lsx_hp = lsx_health_plan(); |
|
| 52 | + $sections = $lsx_hp->frontend->plan_query->get_sections( $group_sections ); |
|
| 53 | + return $sections; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -60,18 +60,18 @@ discard block |
||
| 60 | 60 | * @return array |
| 61 | 61 | */ |
| 62 | 62 | function get_section_info( $section_key = '' ) { |
| 63 | - $section_info = array(); |
|
| 63 | + $section_info = array(); |
|
| 64 | 64 | |
| 65 | - $sections = get_sections(); |
|
| 66 | - if ( ! empty( $sections ) ) { |
|
| 67 | - foreach ( $sections as $key => $values ) { |
|
| 68 | - $current_key = sanitize_title( $values['title'] ); |
|
| 69 | - if ( $current_key === $section_key ) { |
|
| 70 | - return $values; |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - return $section_info; |
|
| 65 | + $sections = get_sections(); |
|
| 66 | + if ( ! empty( $sections ) ) { |
|
| 67 | + foreach ( $sections as $key => $values ) { |
|
| 68 | + $current_key = sanitize_title( $values['title'] ); |
|
| 69 | + if ( $current_key === $section_key ) { |
|
| 70 | + return $values; |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + return $section_info; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -81,14 +81,14 @@ discard block |
||
| 81 | 81 | * @return array |
| 82 | 82 | */ |
| 83 | 83 | function get_group_title( $sections = array() ) { |
| 84 | - $group_title = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) ); |
|
| 85 | - if ( ! empty( $sections ) ) { |
|
| 86 | - $first_section = reset( $sections ); |
|
| 87 | - if ( isset( $first_section['group'] ) && '' !== $first_section['group'] ) { |
|
| 88 | - $group_title = $first_section['group']; |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - return $group_title; |
|
| 84 | + $group_title = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) ); |
|
| 85 | + if ( ! empty( $sections ) ) { |
|
| 86 | + $first_section = reset( $sections ); |
|
| 87 | + if ( isset( $first_section['group'] ) && '' !== $first_section['group'] ) { |
|
| 88 | + $group_title = $first_section['group']; |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + return $group_title; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -99,14 +99,14 @@ discard block |
||
| 99 | 99 | * @return array |
| 100 | 100 | */ |
| 101 | 101 | function get_permalink( $plan_id = 0, $title = '' ) { |
| 102 | - if ( 0 === $plan_id ) { |
|
| 103 | - $plan_id = get_the_ID(); |
|
| 104 | - } |
|
| 105 | - $url = \get_permalink( $plan_id ); |
|
| 106 | - if ( '' !== $title ) { |
|
| 107 | - $url .= sanitize_title( $title ) . '/'; |
|
| 108 | - } |
|
| 109 | - return $url; |
|
| 102 | + if ( 0 === $plan_id ) { |
|
| 103 | + $plan_id = get_the_ID(); |
|
| 104 | + } |
|
| 105 | + $url = \get_permalink( $plan_id ); |
|
| 106 | + if ( '' !== $title ) { |
|
| 107 | + $url .= sanitize_title( $title ) . '/'; |
|
| 108 | + } |
|
| 109 | + return $url; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | * @return boolean |
| 116 | 116 | */ |
| 117 | 117 | function is_filters_disabled( $disabled = false ) { |
| 118 | - $is_disabled = \lsx_health_plan\functions\get_option( 'plan_filters_disabled', false ); |
|
| 119 | - if ( false !== $is_disabled ) { |
|
| 120 | - $disabled = true; |
|
| 121 | - } |
|
| 122 | - return $disabled; |
|
| 118 | + $is_disabled = \lsx_health_plan\functions\get_option( 'plan_filters_disabled', false ); |
|
| 119 | + if ( false !== $is_disabled ) { |
|
| 120 | + $disabled = true; |
|
| 121 | + } |
|
| 122 | + return $disabled; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -130,17 +130,17 @@ discard block |
||
| 130 | 130 | * @return string |
| 131 | 131 | */ |
| 132 | 132 | function generate_section_id( $section_key = '' ) { |
| 133 | - $key = get_the_ID(); |
|
| 134 | - if ( '' === $section_key ) { |
|
| 135 | - $section_key = get_query_var( 'section' ); |
|
| 136 | - } |
|
| 133 | + $key = get_the_ID(); |
|
| 134 | + if ( '' === $section_key ) { |
|
| 135 | + $section_key = get_query_var( 'section' ); |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - $section_key = sanitize_title( $section_key ); |
|
| 138 | + $section_key = sanitize_title( $section_key ); |
|
| 139 | 139 | |
| 140 | - if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 141 | - $group_title = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) ); |
|
| 142 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 143 | - $key .= '_' . sanitize_key( $group_title ) . '_' . sanitize_key( $section_info['title'] ); |
|
| 144 | - } |
|
| 145 | - return $key; |
|
| 140 | + if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 141 | + $group_title = apply_filters( 'lsx_hp_default_plan_group', __( 'Daily Plan', 'lsx-health-plan' ) ); |
|
| 142 | + $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 143 | + $key .= '_' . sanitize_key( $group_title ) . '_' . sanitize_key( $section_info['title'] ); |
|
| 144 | + } |
|
| 145 | + return $key; |
|
| 146 | 146 | } |
@@ -8,120 +8,120 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Frontend { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @since 1.0.0 |
|
| 15 | - * |
|
| 16 | - * @var object \lsx_health_plan\classes\Frontend() |
|
| 17 | - */ |
|
| 18 | - protected static $instance = null; |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * @var object \lsx_health_plan\classes\frontend\Endpoints(); |
|
| 22 | - */ |
|
| 23 | - public $endpoints; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @var object \lsx_health_plan\classes\frontend\Modals(); |
|
| 27 | - */ |
|
| 28 | - public $modals; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * @var object \lsx_health_plan\classes\frontend\Gallery(); |
|
| 32 | - */ |
|
| 33 | - public $gallery; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @var object \lsx_health_plan\classes\frontend\Plan_Status(); |
|
| 37 | - */ |
|
| 38 | - public $plan_status; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @var object \lsx_health_plan\classes\frontend\Plan_Query(); |
|
| 42 | - */ |
|
| 43 | - public $plan_query; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @var object \lsx_health_plan\classes\frontend\General(); |
|
| 47 | - */ |
|
| 48 | - public $general; |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @var object \lsx_health_plan\classes\frontend\Template_Redirects(); |
|
| 52 | - */ |
|
| 53 | - public $template_redirects; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Constructor |
|
| 57 | - */ |
|
| 58 | - public function __construct() { |
|
| 59 | - if ( ! is_admin() ) { |
|
| 60 | - $this->load_classes(); |
|
| 61 | - add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @since 1.0.0 |
|
| 15 | + * |
|
| 16 | + * @var object \lsx_health_plan\classes\Frontend() |
|
| 17 | + */ |
|
| 18 | + protected static $instance = null; |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * @var object \lsx_health_plan\classes\frontend\Endpoints(); |
|
| 22 | + */ |
|
| 23 | + public $endpoints; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @var object \lsx_health_plan\classes\frontend\Modals(); |
|
| 27 | + */ |
|
| 28 | + public $modals; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @var object \lsx_health_plan\classes\frontend\Gallery(); |
|
| 32 | + */ |
|
| 33 | + public $gallery; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @var object \lsx_health_plan\classes\frontend\Plan_Status(); |
|
| 37 | + */ |
|
| 38 | + public $plan_status; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @var object \lsx_health_plan\classes\frontend\Plan_Query(); |
|
| 42 | + */ |
|
| 43 | + public $plan_query; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @var object \lsx_health_plan\classes\frontend\General(); |
|
| 47 | + */ |
|
| 48 | + public $general; |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @var object \lsx_health_plan\classes\frontend\Template_Redirects(); |
|
| 52 | + */ |
|
| 53 | + public $template_redirects; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Constructor |
|
| 57 | + */ |
|
| 58 | + public function __construct() { |
|
| 59 | + if ( ! is_admin() ) { |
|
| 60 | + $this->load_classes(); |
|
| 61 | + add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
| 62 | 62 | |
| 63 | - } |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * Return an instance of this class. |
|
| 68 | - * |
|
| 69 | - * @since 1.0.0 |
|
| 70 | - * |
|
| 71 | - * @return object \lsx_health_plan\classes\Frontend() A single instance of this class. |
|
| 72 | - */ |
|
| 73 | - public static function get_instance() { |
|
| 74 | - // If the single instance hasn't been set, set it now. |
|
| 75 | - if ( null === self::$instance ) { |
|
| 76 | - self::$instance = new self(); |
|
| 77 | - } |
|
| 78 | - return self::$instance; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * Loads the variable classes and the static classes. |
|
| 83 | - */ |
|
| 84 | - private function load_classes() { |
|
| 85 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php'; |
|
| 86 | - $this->endpoints = frontend\Endpoints::get_instance(); |
|
| 87 | - |
|
| 88 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-modals.php'; |
|
| 89 | - $this->modals = Modals::get_instance(); |
|
| 90 | - |
|
| 91 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php'; |
|
| 92 | - $this->gallery = frontend\Gallery::get_instance(); |
|
| 93 | - |
|
| 94 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-status.php'; |
|
| 95 | - $this->plan_status = frontend\Plan_Status::get_instance(); |
|
| 96 | - |
|
| 97 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-query.php'; |
|
| 98 | - $this->plan_query = frontend\Plan_Query::get_instance(); |
|
| 99 | - |
|
| 100 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-general.php'; |
|
| 101 | - $this->general = frontend\General::get_instance(); |
|
| 102 | - |
|
| 103 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-template-redirects.php'; |
|
| 104 | - $this->template_redirects = frontend\Template_Redirects::get_instance(); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Redirect the user from the cart or checkout page if they have purchased the product already. |
|
| 109 | - * |
|
| 110 | - * @return void |
|
| 111 | - */ |
|
| 112 | - public function redirect() { |
|
| 113 | - if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
| 114 | - return; |
|
| 115 | - } |
|
| 116 | - if ( lsx_health_plan_user_has_purchase() && ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) ) ) { |
|
| 117 | - wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) ); |
|
| 118 | - die; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - $product_id = \lsx_health_plan\functions\get_option( 'membership_product', false ); |
|
| 122 | - if ( false !== $product_id && is_single( $product_id ) ) { |
|
| 123 | - wp_redirect( home_url() ); |
|
| 124 | - wp_die(); |
|
| 125 | - } |
|
| 126 | - } |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * Return an instance of this class. |
|
| 68 | + * |
|
| 69 | + * @since 1.0.0 |
|
| 70 | + * |
|
| 71 | + * @return object \lsx_health_plan\classes\Frontend() A single instance of this class. |
|
| 72 | + */ |
|
| 73 | + public static function get_instance() { |
|
| 74 | + // If the single instance hasn't been set, set it now. |
|
| 75 | + if ( null === self::$instance ) { |
|
| 76 | + self::$instance = new self(); |
|
| 77 | + } |
|
| 78 | + return self::$instance; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * Loads the variable classes and the static classes. |
|
| 83 | + */ |
|
| 84 | + private function load_classes() { |
|
| 85 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php'; |
|
| 86 | + $this->endpoints = frontend\Endpoints::get_instance(); |
|
| 87 | + |
|
| 88 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-modals.php'; |
|
| 89 | + $this->modals = Modals::get_instance(); |
|
| 90 | + |
|
| 91 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php'; |
|
| 92 | + $this->gallery = frontend\Gallery::get_instance(); |
|
| 93 | + |
|
| 94 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-status.php'; |
|
| 95 | + $this->plan_status = frontend\Plan_Status::get_instance(); |
|
| 96 | + |
|
| 97 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-query.php'; |
|
| 98 | + $this->plan_query = frontend\Plan_Query::get_instance(); |
|
| 99 | + |
|
| 100 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-general.php'; |
|
| 101 | + $this->general = frontend\General::get_instance(); |
|
| 102 | + |
|
| 103 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-template-redirects.php'; |
|
| 104 | + $this->template_redirects = frontend\Template_Redirects::get_instance(); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Redirect the user from the cart or checkout page if they have purchased the product already. |
|
| 109 | + * |
|
| 110 | + * @return void |
|
| 111 | + */ |
|
| 112 | + public function redirect() { |
|
| 113 | + if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
| 114 | + return; |
|
| 115 | + } |
|
| 116 | + if ( lsx_health_plan_user_has_purchase() && ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) ) ) { |
|
| 117 | + wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) ); |
|
| 118 | + die; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + $product_id = \lsx_health_plan\functions\get_option( 'membership_product', false ); |
|
| 122 | + if ( false !== $product_id && is_single( $product_id ) ) { |
|
| 123 | + wp_redirect( home_url() ); |
|
| 124 | + wp_die(); |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | 127 | } |
@@ -8,88 +8,88 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Endpoints { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @since 1.0.0 |
|
| 15 | - * |
|
| 16 | - * @var object \lsx_health_plan\classes\frontend\Endpoints() |
|
| 17 | - */ |
|
| 18 | - protected static $instance = null; |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @since 1.0.0 |
|
| 15 | + * |
|
| 16 | + * @var object \lsx_health_plan\classes\frontend\Endpoints() |
|
| 17 | + */ |
|
| 18 | + protected static $instance = null; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Constructor |
|
| 22 | - */ |
|
| 23 | - public function __construct() { |
|
| 24 | - add_action( 'init', array( $this, 'setup' ) ); |
|
| 25 | - } |
|
| 20 | + /** |
|
| 21 | + * Constructor |
|
| 22 | + */ |
|
| 23 | + public function __construct() { |
|
| 24 | + add_action( 'init', array( $this, 'setup' ) ); |
|
| 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\frontend\Endpoints() 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\frontend\Endpoints() 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 | - * Runs on init |
|
| 44 | - */ |
|
| 45 | - public function setup() { |
|
| 46 | - $this->add_rewrite_rules(); |
|
| 47 | - } |
|
| 42 | + /** |
|
| 43 | + * Runs on init |
|
| 44 | + */ |
|
| 45 | + public function setup() { |
|
| 46 | + $this->add_rewrite_rules(); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Registers the rewrites. |
|
| 51 | - */ |
|
| 52 | - public function add_rewrite_rules() { |
|
| 53 | - // Here is where we add in the rewrite rules above the normal WP ones. |
|
| 54 | - add_rewrite_tag( '%endpoint%', '([^&]+)' ); |
|
| 55 | - add_rewrite_tag( '%section%', '([^&]+)' ); |
|
| 49 | + /** |
|
| 50 | + * Registers the rewrites. |
|
| 51 | + */ |
|
| 52 | + public function add_rewrite_rules() { |
|
| 53 | + // Here is where we add in the rewrite rules above the normal WP ones. |
|
| 54 | + add_rewrite_tag( '%endpoint%', '([^&]+)' ); |
|
| 55 | + add_rewrite_tag( '%section%', '([^&]+)' ); |
|
| 56 | 56 | |
| 57 | - // Plan Sections. |
|
| 58 | - add_rewrite_rule( 'plan/([^/]+)/([^/]+)/?$', 'index.php?plan=$matches[1]§ion=$matches[2]', 'top' ); |
|
| 57 | + // Plan Sections. |
|
| 58 | + add_rewrite_rule( 'plan/([^/]+)/([^/]+)/?$', 'index.php?plan=$matches[1]§ion=$matches[2]', 'top' ); |
|
| 59 | 59 | |
| 60 | - // Warm up. |
|
| 61 | - $warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false ); |
|
| 62 | - if ( false === $warm_up ) { |
|
| 63 | - $warm_up = 'warm-up'; |
|
| 64 | - } |
|
| 60 | + // Warm up. |
|
| 61 | + $warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false ); |
|
| 62 | + if ( false === $warm_up ) { |
|
| 63 | + $warm_up = 'warm-up'; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $warm_up . '/?$', 'index.php?plan=$matches[1]§ion=$matches[2]&endpoint=warm-up', 'top' ); |
|
| 66 | + add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $warm_up . '/?$', 'index.php?plan=$matches[1]§ion=$matches[2]&endpoint=warm-up', 'top' ); |
|
| 67 | 67 | |
| 68 | - // Workout. |
|
| 69 | - if ( post_type_exists( 'workout' ) ) { |
|
| 70 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false ); |
|
| 71 | - if ( false === $workout ) { |
|
| 72 | - $workout = 'workout'; |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $workout . '/?$', 'index.php?plan=$matches[1]§ion=$matches[2]&endpoint=workout', 'top' ); |
|
| 68 | + // Workout. |
|
| 69 | + if ( post_type_exists( 'workout' ) ) { |
|
| 70 | + $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false ); |
|
| 71 | + if ( false === $workout ) { |
|
| 72 | + $workout = 'workout'; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $workout . '/?$', 'index.php?plan=$matches[1]§ion=$matches[2]&endpoint=workout', 'top' ); |
|
| 76 | 76 | |
| 77 | - // Meal. |
|
| 78 | - if ( post_type_exists( 'meal' ) ) { |
|
| 79 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
|
| 80 | - if ( false === $meal ) { |
|
| 81 | - $meal = 'meal'; |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $meal . '/?$', 'index.php?plan=$matches[1]§ion=$matches[2]&endpoint=meal', 'top' ); |
|
| 77 | + // Meal. |
|
| 78 | + if ( post_type_exists( 'meal' ) ) { |
|
| 79 | + $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
|
| 80 | + if ( false === $meal ) { |
|
| 81 | + $meal = 'meal'; |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $meal . '/?$', 'index.php?plan=$matches[1]§ion=$matches[2]&endpoint=meal', 'top' ); |
|
| 85 | 85 | |
| 86 | - // Recipe. |
|
| 87 | - if ( post_type_exists( 'recipe' ) ) { |
|
| 88 | - $recipe = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); |
|
| 89 | - if ( false === $recipe ) { |
|
| 90 | - $recipe = 'recipes'; |
|
| 91 | - } |
|
| 92 | - } |
|
| 93 | - add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $recipe . '/?$', 'index.php?plan=$matches[1]§ion=$matches[2]&endpoint=recipes', 'top' ); |
|
| 94 | - } |
|
| 86 | + // Recipe. |
|
| 87 | + if ( post_type_exists( 'recipe' ) ) { |
|
| 88 | + $recipe = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); |
|
| 89 | + if ( false === $recipe ) { |
|
| 90 | + $recipe = 'recipes'; |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | + add_rewrite_rule( 'plan/([^/]+)/([^/]+)/' . $recipe . '/?$', 'index.php?plan=$matches[1]§ion=$matches[2]&endpoint=recipes', 'top' ); |
|
| 94 | + } |
|
| 95 | 95 | } |
@@ -8,53 +8,53 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Plan_Status { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @since 1.0.0 |
|
| 15 | - * |
|
| 16 | - * @var object \lsx_health_plan\classes\frontend\Plan_Status() |
|
| 17 | - */ |
|
| 18 | - protected static $instance = null; |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @since 1.0.0 |
|
| 15 | + * |
|
| 16 | + * @var object \lsx_health_plan\classes\frontend\Plan_Status() |
|
| 17 | + */ |
|
| 18 | + protected static $instance = null; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Constructor |
|
| 22 | - */ |
|
| 23 | - public function __construct() { |
|
| 24 | - add_action( 'init', array( $this, 'handle_day_action' ), 100 ); |
|
| 25 | - } |
|
| 20 | + /** |
|
| 21 | + * Constructor |
|
| 22 | + */ |
|
| 23 | + public function __construct() { |
|
| 24 | + add_action( 'init', array( $this, 'handle_day_action' ), 100 ); |
|
| 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\frontend\Plan_Status() 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\frontend\Plan_Status() 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 | - * Registers the rewrites. |
|
| 44 | - */ |
|
| 45 | - public function handle_day_action() { |
|
| 46 | - if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) { |
|
| 47 | - update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true ); |
|
| 48 | - $plan_id = sanitize_key( $_POST['lsx-health-plan-id'] ); |
|
| 49 | - $plan_parent = wp_get_post_parent_id( $plan_id ); |
|
| 50 | - if ( 0 !== $plan_parent ) { |
|
| 51 | - $plan_id = $plan_parent; |
|
| 52 | - } |
|
| 53 | - wp_safe_redirect( get_permalink( $plan_id ) ); |
|
| 54 | - } |
|
| 42 | + /** |
|
| 43 | + * Registers the rewrites. |
|
| 44 | + */ |
|
| 45 | + public function handle_day_action() { |
|
| 46 | + if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) { |
|
| 47 | + update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true ); |
|
| 48 | + $plan_id = sanitize_key( $_POST['lsx-health-plan-id'] ); |
|
| 49 | + $plan_parent = wp_get_post_parent_id( $plan_id ); |
|
| 50 | + if ( 0 !== $plan_parent ) { |
|
| 51 | + $plan_id = $plan_parent; |
|
| 52 | + } |
|
| 53 | + wp_safe_redirect( get_permalink( $plan_id ) ); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) { |
|
| 57 | - delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' ); |
|
| 58 | - } |
|
| 59 | - } |
|
| 56 | + if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) { |
|
| 57 | + delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' ); |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -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 | - * Constructor |
|
| 29 | - */ |
|
| 30 | - public function __construct() { |
|
| 31 | - add_action( 'wp_footer', array( $this, 'output_modals' ) ); |
|
| 32 | - } |
|
| 27 | + /** |
|
| 28 | + * Constructor |
|
| 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 | } |