@@ -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 ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
| 23 | + if ( ! function_exists('wc_memberships_view_restricted_post_content') || 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 exercise-archive-plan 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 | ?> |
@@ -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 ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
| 23 | + if ( ! function_exists('wc_memberships_view_restricted_post_content') || 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 exercise-archive-plan 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 | ?> |
@@ -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 ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || current_user_can( 'wc_memberships_view_restricted_post_content', $page_id ) ) { |
|
| 23 | + if ( ! function_exists('wc_memberships_view_restricted_post_content') || 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 workout-archive-plan 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 | ?> |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | <?php lsx_content_wrap_before(); ?> |
| 11 | 11 | |
| 12 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 12 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 13 | 13 | |
| 14 | 14 | <?php lsx_content_before(); ?> |
| 15 | 15 | |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | <div class="post-wrapper archive-plan"> |
| 21 | 21 | <div class="row"> |
| 22 | - <?php if ( have_posts() ) : ?> |
|
| 22 | + <?php if (have_posts()) : ?> |
|
| 23 | 23 | <?php |
| 24 | - while ( have_posts() ) : |
|
| 24 | + while (have_posts()) : |
|
| 25 | 25 | the_post(); |
| 26 | 26 | ?> |
| 27 | 27 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | <?php else : ?> |
| 33 | 33 | |
| 34 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
| 34 | + <?php get_template_part('partials/content', 'none'); ?> |
|
| 35 | 35 | |
| 36 | 36 | <?php endif; ?> |
| 37 | 37 | </div> |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | <?php lsx_content_wrap_before(); ?> |
| 11 | 11 | |
| 12 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 12 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 13 | 13 | |
| 14 | 14 | <?php lsx_content_before(); ?> |
| 15 | 15 | |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | <div class="post-wrapper archive-plan"> |
| 21 | 21 | <div class="row"> |
| 22 | - <?php if ( have_posts() ) : ?> |
|
| 22 | + <?php if (have_posts()) : ?> |
|
| 23 | 23 | <?php |
| 24 | - while ( have_posts() ) : |
|
| 24 | + while (have_posts()) : |
|
| 25 | 25 | the_post(); |
| 26 | 26 | ?> |
| 27 | 27 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | <?php else : ?> |
| 33 | 33 | |
| 34 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
| 34 | + <?php get_template_part('partials/content', 'none'); ?> |
|
| 35 | 35 | |
| 36 | 36 | <?php endif; ?> |
| 37 | 37 | </div> |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | * Constructor |
| 22 | 22 | */ |
| 23 | 23 | public function __construct() { |
| 24 | - add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
| 25 | - add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
| 26 | - add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); |
|
| 27 | - add_action( 'wp', array( $this, 'redirect_restrictions' ), 99 ); |
|
| 24 | + add_filter('template_include', array($this, 'archive_template_include'), 99); |
|
| 25 | + add_filter('template_include', array($this, 'single_template_include'), 99); |
|
| 26 | + add_filter('template_include', array($this, 'taxonomy_template_include'), 99); |
|
| 27 | + add_action('wp', array($this, 'redirect_restrictions'), 99); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public static function get_instance() { |
| 38 | 38 | // If the single instance hasn't been set, set it now. |
| 39 | - if ( null === self::$instance ) { |
|
| 39 | + if (null === self::$instance) { |
|
| 40 | 40 | self::$instance = new self(); |
| 41 | 41 | } |
| 42 | 42 | return self::$instance; |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | /** |
| 46 | 46 | * Archive template. |
| 47 | 47 | */ |
| 48 | - public function archive_template_include( $template ) { |
|
| 49 | - $applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() ); |
|
| 50 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) { |
|
| 48 | + public function archive_template_include($template) { |
|
| 49 | + $applicable_post_types = apply_filters('lsx_health_plan_archive_template', array()); |
|
| 50 | + if ( ! empty($applicable_post_types) && is_main_query() && is_post_type_archive($applicable_post_types)) { |
|
| 51 | 51 | $post_type = get_post_type(); |
| 52 | - if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) { |
|
| 52 | + if (empty(locate_template(array('archive-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php')) { |
|
| 53 | 53 | $template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php'; |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | /** |
| 60 | 60 | * Single template. |
| 61 | 61 | */ |
| 62 | - public function single_template_include( $template ) { |
|
| 63 | - $applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() ); |
|
| 64 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) { |
|
| 62 | + public function single_template_include($template) { |
|
| 63 | + $applicable_post_types = apply_filters('lsx_health_plan_single_template', array()); |
|
| 64 | + if ( ! empty($applicable_post_types) && is_main_query() && is_singular($applicable_post_types)) { |
|
| 65 | 65 | $post_type = get_post_type(); |
| 66 | - if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) { |
|
| 66 | + if (empty(locate_template(array('single-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php')) { |
|
| 67 | 67 | $template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php'; |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | * @param $template string |
| 77 | 77 | * @return string |
| 78 | 78 | */ |
| 79 | - public function taxonomy_template_include( $template ) { |
|
| 80 | - $applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() ); |
|
| 81 | - if ( is_main_query() && is_tax( $applicable_taxonomies ) ) { |
|
| 82 | - $current_taxonomy = get_query_var( 'taxonomy' ); |
|
| 83 | - if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { |
|
| 79 | + public function taxonomy_template_include($template) { |
|
| 80 | + $applicable_taxonomies = apply_filters('lsx_health_plan_taxonomies_template', array()); |
|
| 81 | + if (is_main_query() && is_tax($applicable_taxonomies)) { |
|
| 82 | + $current_taxonomy = get_query_var('taxonomy'); |
|
| 83 | + if ('' === locate_template(array('taxonomy-' . $current_taxonomy . '.php')) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php')) { |
|
| 84 | 84 | $template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php'; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -92,21 +92,21 @@ discard block |
||
| 92 | 92 | * restriction functionality elsewhere. |
| 93 | 93 | */ |
| 94 | 94 | public function redirect_restrictions() { |
| 95 | - if ( function_exists( 'WC' ) && ! is_user_logged_in() ) { |
|
| 96 | - if ( is_post_type_archive( array( 'recipe', 'exercise', 'meal', 'workout' ) ) |
|
| 97 | - || is_tax( array( 'meal-type', 'workout-type', 'recipe-type', 'recipe-cuisine', 'exercise-type', 'equipment', 'muscle-group' ) ) |
|
| 98 | - || is_single( 'recipe', 'exercise' ) ) { |
|
| 95 | + if (function_exists('WC') && ! is_user_logged_in()) { |
|
| 96 | + if (is_post_type_archive(array('recipe', 'exercise', 'meal', 'workout')) |
|
| 97 | + || is_tax(array('meal-type', 'workout-type', 'recipe-type', 'recipe-cuisine', 'exercise-type', 'equipment', 'muscle-group')) |
|
| 98 | + || is_single('recipe', 'exercise')) { |
|
| 99 | 99 | |
| 100 | - $redirect = \lsx_health_plan\functions\get_option( 'my_plan_slug', '/' ); |
|
| 101 | - if ( function_exists( 'wc_memberships' ) ) { |
|
| 100 | + $redirect = \lsx_health_plan\functions\get_option('my_plan_slug', '/'); |
|
| 101 | + if (function_exists('wc_memberships')) { |
|
| 102 | 102 | $restriction_mode = wc_memberships()->get_restrictions_instance()->get_restriction_mode(); |
| 103 | - if ( 'redirect' === $restriction_mode ) { |
|
| 103 | + if ('redirect' === $restriction_mode) { |
|
| 104 | 104 | $page_id = wc_memberships()->get_restrictions_instance()->get_restricted_content_redirect_page_id(); |
| 105 | - $redirect = get_permalink( $page_id ); |
|
| 105 | + $redirect = get_permalink($page_id); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - wp_redirect( $redirect ); |
|
| 109 | + wp_redirect($redirect); |
|
| 110 | 110 | exit; |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | <?php lsx_content_wrap_before(); ?> |
| 11 | 11 | |
| 12 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 12 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 13 | 13 | |
| 14 | 14 | <?php lsx_content_before(); ?> |
| 15 | 15 | |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | <div class="post-wrapper archive-plan"> |
| 21 | 21 | <div class="row"> |
| 22 | - <?php if ( have_posts() ) : ?> |
|
| 22 | + <?php if (have_posts()) : ?> |
|
| 23 | 23 | <?php |
| 24 | - while ( have_posts() ) : |
|
| 24 | + while (have_posts()) : |
|
| 25 | 25 | the_post(); |
| 26 | 26 | ?> |
| 27 | 27 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | <?php else : ?> |
| 33 | 33 | |
| 34 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
| 34 | + <?php get_template_part('partials/content', 'none'); ?> |
|
| 35 | 35 | |
| 36 | 36 | <?php endif; ?> |
| 37 | 37 | </div> |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | <?php lsx_content_wrap_before(); ?> |
| 11 | 11 | |
| 12 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 12 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 13 | 13 | |
| 14 | 14 | <?php lsx_content_before(); ?> |
| 15 | 15 | |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | <div class="post-wrapper archive-plan"> |
| 21 | 21 | <div class="row"> |
| 22 | - <?php if ( have_posts() ) : ?> |
|
| 22 | + <?php if (have_posts()) : ?> |
|
| 23 | 23 | <?php |
| 24 | - while ( have_posts() ) : |
|
| 24 | + while (have_posts()) : |
|
| 25 | 25 | the_post(); |
| 26 | 26 | ?> |
| 27 | 27 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | <?php else : ?> |
| 33 | 33 | |
| 34 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
| 34 | + <?php get_template_part('partials/content', 'none'); ?> |
|
| 35 | 35 | |
| 36 | 36 | <?php endif; ?> |
| 37 | 37 | </div> |
@@ -16,24 +16,24 @@ discard block |
||
| 16 | 16 | * @param boolean $single |
| 17 | 17 | * @return boolean |
| 18 | 18 | */ |
| 19 | -function has_attached_post( $post_id = '', $meta_key = '', $single = true ) { |
|
| 19 | +function has_attached_post($post_id = '', $meta_key = '', $single = true) { |
|
| 20 | 20 | $has_post = false; |
| 21 | - if ( '' === $post_id ) { |
|
| 21 | + if ('' === $post_id) { |
|
| 22 | 22 | $post_id = get_the_ID(); |
| 23 | 23 | } |
| 24 | - $items = get_post_meta( $post_id, $meta_key, $single ); |
|
| 25 | - if ( '' !== $items && false !== $items && 0 !== $items ) { |
|
| 26 | - if ( ! is_array( $items ) ) { |
|
| 27 | - $items = array( $items ); |
|
| 24 | + $items = get_post_meta($post_id, $meta_key, $single); |
|
| 25 | + if ('' !== $items && false !== $items && 0 !== $items) { |
|
| 26 | + if ( ! is_array($items)) { |
|
| 27 | + $items = array($items); |
|
| 28 | 28 | } |
| 29 | - $items = check_posts_exist( $items ); |
|
| 30 | - if ( ! empty( $items ) ) { |
|
| 29 | + $items = check_posts_exist($items); |
|
| 30 | + if ( ! empty($items)) { |
|
| 31 | 31 | $has_post = true; |
| 32 | 32 | } |
| 33 | 33 | } else { |
| 34 | 34 | // Check for defaults. |
| 35 | - $options = get_option( 'all' ); |
|
| 36 | - if ( isset( $options[ $meta_key ] ) && '' !== $options[ $meta_key ] && ! empty( $options[ $meta_key ] ) ) { |
|
| 35 | + $options = get_option('all'); |
|
| 36 | + if (isset($options[$meta_key]) && '' !== $options[$meta_key] && ! empty($options[$meta_key])) { |
|
| 37 | 37 | $has_post = true; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -47,17 +47,17 @@ discard block |
||
| 47 | 47 | * @param mixed $default Optional default value |
| 48 | 48 | * @return mixed Option value |
| 49 | 49 | */ |
| 50 | -function get_option( $key = '', $default = false ) { |
|
| 51 | - if ( function_exists( 'cmb2_get_option' ) ) { |
|
| 52 | - return cmb2_get_option( 'lsx_health_plan_options', $key, $default ); |
|
| 50 | +function get_option($key = '', $default = false) { |
|
| 51 | + if (function_exists('cmb2_get_option')) { |
|
| 52 | + return cmb2_get_option('lsx_health_plan_options', $key, $default); |
|
| 53 | 53 | } |
| 54 | 54 | // Fallback to get_option if CMB2 is not loaded yet. |
| 55 | - $opts = \get_option( 'lsx_health_plan_options', $default ); |
|
| 55 | + $opts = \get_option('lsx_health_plan_options', $default); |
|
| 56 | 56 | $val = $default; |
| 57 | - if ( 'all' === $key ) { |
|
| 57 | + if ('all' === $key) { |
|
| 58 | 58 | $val = $opts; |
| 59 | - } elseif ( is_array( $opts ) && array_key_exists( $key, $opts ) && false !== $opts[ $key ] ) { |
|
| 60 | - $val = $opts[ $key ]; |
|
| 59 | + } elseif (is_array($opts) && array_key_exists($key, $opts) && false !== $opts[$key]) { |
|
| 60 | + $val = $opts[$key]; |
|
| 61 | 61 | } |
| 62 | 62 | return $val; |
| 63 | 63 | } |
@@ -69,54 +69,54 @@ discard block |
||
| 69 | 69 | * @param mixed $default Optional default value |
| 70 | 70 | * @return mixed Option value |
| 71 | 71 | */ |
| 72 | -function get_downloads( $type = 'all', $post_id = '' ) { |
|
| 72 | +function get_downloads($type = 'all', $post_id = '') { |
|
| 73 | 73 | $lsx_health_plan = \lsx_health_plan(); |
| 74 | 74 | $post_types = $lsx_health_plan->get_post_types(); |
| 75 | - if ( '' === $post_id ) { |
|
| 75 | + if ('' === $post_id) { |
|
| 76 | 76 | $post_id = get_the_ID(); |
| 77 | 77 | } |
| 78 | 78 | $downloads = array(); |
| 79 | - $options = get_option( 'all' ); |
|
| 79 | + $options = get_option('all'); |
|
| 80 | 80 | |
| 81 | - foreach ( $post_types as $post_type ) { |
|
| 82 | - if ( 'all' === $type || in_array( $type, $post_types, true ) ) { |
|
| 81 | + foreach ($post_types as $post_type) { |
|
| 82 | + if ('all' === $type || in_array($type, $post_types, true)) { |
|
| 83 | 83 | |
| 84 | 84 | // Get the default downloads for this post type. |
| 85 | 85 | $default_downloads = array(); |
| 86 | 86 | $new_downloads = array(); |
| 87 | - if ( isset( $options[ 'download_' . $post_type ] ) ) { |
|
| 88 | - if ( is_array( $options[ 'download_' . $post_type ] ) ) { |
|
| 89 | - $default_downloads = $options[ 'download_' . $post_type ]; |
|
| 87 | + if (isset($options['download_' . $post_type])) { |
|
| 88 | + if (is_array($options['download_' . $post_type])) { |
|
| 89 | + $default_downloads = $options['download_' . $post_type]; |
|
| 90 | 90 | } else { |
| 91 | - $default_downloads[] = $options[ 'download_' . $post_type ]; |
|
| 91 | + $default_downloads[] = $options['download_' . $post_type]; |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if ( 'page' === $post_type ) { |
|
| 95 | + if ('page' === $post_type) { |
|
| 96 | 96 | $key = 'plan_warmup'; |
| 97 | 97 | } else { |
| 98 | 98 | $key = 'connected_' . $post_type . 's'; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - $connected_items = get_post_meta( $post_id, $key, true ); |
|
| 102 | - if ( ! empty( $connected_items ) ) { |
|
| 103 | - foreach ( $connected_items as $connected_item ) { |
|
| 104 | - $current_downloads = get_post_meta( $connected_item, 'connected_downloads', true ); |
|
| 105 | - if ( false !== $current_downloads && ! empty( $current_downloads ) ) { |
|
| 106 | - $new_downloads = array_merge( $new_downloads, $current_downloads ); |
|
| 101 | + $connected_items = get_post_meta($post_id, $key, true); |
|
| 102 | + if ( ! empty($connected_items)) { |
|
| 103 | + foreach ($connected_items as $connected_item) { |
|
| 104 | + $current_downloads = get_post_meta($connected_item, 'connected_downloads', true); |
|
| 105 | + if (false !== $current_downloads && ! empty($current_downloads)) { |
|
| 106 | + $new_downloads = array_merge($new_downloads, $current_downloads); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if ( ! empty( $new_downloads ) ) { |
|
| 112 | - $downloads = array_merge( $downloads, $new_downloads ); |
|
| 113 | - } elseif ( ! empty( $default_downloads ) ) { |
|
| 114 | - $downloads = array_merge( $downloads, $default_downloads ); |
|
| 111 | + if ( ! empty($new_downloads)) { |
|
| 112 | + $downloads = array_merge($downloads, $new_downloads); |
|
| 113 | + } elseif ( ! empty($default_downloads)) { |
|
| 114 | + $downloads = array_merge($downloads, $default_downloads); |
|
| 115 | 115 | } |
| 116 | - $downloads = array_unique( $downloads ); |
|
| 116 | + $downloads = array_unique($downloads); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | - $downloads = check_posts_exist( $downloads ); |
|
| 119 | + $downloads = check_posts_exist($downloads); |
|
| 120 | 120 | return $downloads; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -126,11 +126,11 @@ discard block |
||
| 126 | 126 | * @param string $week Week name 'week-1'. |
| 127 | 127 | * @return array an array of the downloads or empty. |
| 128 | 128 | */ |
| 129 | -function get_weekly_downloads( $week = '' ) { |
|
| 129 | +function get_weekly_downloads($week = '') { |
|
| 130 | 130 | $downloads = array(); |
| 131 | - if ( '' !== $week ) { |
|
| 132 | - $saved_downloads = get_transient( 'lsx_hp_weekly_downloads_' . $week ); |
|
| 133 | - if ( false !== $saved_downloads && ! empty( $saved_downloads ) ) { |
|
| 131 | + if ('' !== $week) { |
|
| 132 | + $saved_downloads = get_transient('lsx_hp_weekly_downloads_' . $week); |
|
| 133 | + if (false !== $saved_downloads && ! empty($saved_downloads)) { |
|
| 134 | 134 | $downloads = $saved_downloads; |
| 135 | 135 | } else { |
| 136 | 136 | $args = array( |
@@ -144,17 +144,17 @@ discard block |
||
| 144 | 144 | array( |
| 145 | 145 | 'taxonomy' => 'dlm_download_category', |
| 146 | 146 | 'field' => 'slug', |
| 147 | - 'terms' => array( $week ), |
|
| 147 | + 'terms' => array($week), |
|
| 148 | 148 | ), |
| 149 | 149 | ), |
| 150 | 150 | ); |
| 151 | - $download_query = new \WP_Query( $args ); |
|
| 152 | - if ( $download_query->have_posts() ) { |
|
| 151 | + $download_query = new \WP_Query($args); |
|
| 152 | + if ($download_query->have_posts()) { |
|
| 153 | 153 | $downloads = $download_query->posts; |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | - $downloads = check_posts_exist( $downloads ); |
|
| 157 | + $downloads = check_posts_exist($downloads); |
|
| 158 | 158 | return $downloads; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -164,20 +164,20 @@ discard block |
||
| 164 | 164 | * @param array $post_ids |
| 165 | 165 | * @return void |
| 166 | 166 | */ |
| 167 | -function check_posts_exist( $post_ids = array() ) { |
|
| 167 | +function check_posts_exist($post_ids = array()) { |
|
| 168 | 168 | $new_ids = array(); |
| 169 | 169 | global $wpdb; |
| 170 | - if ( is_array( $post_ids ) && ! empty( $post_ids ) ) { |
|
| 171 | - $post_ids = "'" . implode( "','", $post_ids ) . "'"; |
|
| 170 | + if (is_array($post_ids) && ! empty($post_ids)) { |
|
| 171 | + $post_ids = "'" . implode("','", $post_ids) . "'"; |
|
| 172 | 172 | $query = " |
| 173 | 173 | SELECT `ID` |
| 174 | 174 | FROM `{$wpdb->posts}` |
| 175 | 175 | WHERE `ID` IN ({$post_ids}) |
| 176 | 176 | AND `post_status` != 'trash' |
| 177 | 177 | "; |
| 178 | - $results = $wpdb->get_results( $query ); // WPCS: unprepared SQL |
|
| 179 | - if ( ! empty( $results ) ) { |
|
| 180 | - $new_ids = wp_list_pluck( $results, 'ID' ); |
|
| 178 | + $results = $wpdb->get_results($query); // WPCS: unprepared SQL |
|
| 179 | + if ( ! empty($results)) { |
|
| 180 | + $new_ids = wp_list_pluck($results, 'ID'); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | return $new_ids; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param string $body |
| 192 | 192 | * @return void |
| 193 | 193 | */ |
| 194 | -function register_modal( $id = '', $title = '', $body = '' ) { |
|
| 194 | +function register_modal($id = '', $title = '', $body = '') { |
|
| 195 | 195 | lsx_health_plan()->frontend->modals->register_modal( |
| 196 | 196 | array( |
| 197 | 197 | 'title' => $title, |
@@ -207,36 +207,36 @@ discard block |
||
| 207 | 207 | * @param array $args |
| 208 | 208 | * @return void |
| 209 | 209 | */ |
| 210 | -function output_modal( $args = array() ) { |
|
| 210 | +function output_modal($args = array()) { |
|
| 211 | 211 | $defaults = array( |
| 212 | 212 | 'id' => '', |
| 213 | 213 | 'title' => '', |
| 214 | 214 | 'body' => '', |
| 215 | 215 | ); |
| 216 | - $args = wp_parse_args( $args, $defaults ); |
|
| 216 | + $args = wp_parse_args($args, $defaults); |
|
| 217 | 217 | ?> |
| 218 | 218 | <!-- Modal --> |
| 219 | - <div class="modal fade lsx-health-plan-modal" id="<?php echo esc_html( $args['id'] ); ?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo esc_html( $args['id'] ); ?>" aria-hidden="true"> |
|
| 219 | + <div class="modal fade lsx-health-plan-modal" id="<?php echo esc_html($args['id']); ?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo esc_html($args['id']); ?>" aria-hidden="true"> |
|
| 220 | 220 | <div class="modal-dialog" role="document"> |
| 221 | 221 | <div class="modal-content"> |
| 222 | 222 | <button type="button" class="close" data-dismiss="modal">×</button> |
| 223 | 223 | <div class="modal-header"> |
| 224 | 224 | <?php |
| 225 | - if ( '' !== $args['title'] ) { |
|
| 226 | - echo wp_kses_post( '<h2>' . $args['title'] . '</h2>' ); |
|
| 225 | + if ('' !== $args['title']) { |
|
| 226 | + echo wp_kses_post('<h2>' . $args['title'] . '</h2>'); |
|
| 227 | 227 | } |
| 228 | 228 | ?> |
| 229 | 229 | </div> |
| 230 | 230 | <div class="modal-body"> |
| 231 | 231 | <?php |
| 232 | - if ( '' !== $args['body'] ) { |
|
| 232 | + if ('' !== $args['body']) { |
|
| 233 | 233 | $allowed_html = array( |
| 234 | 234 | 'iframe' => array( |
| 235 | 235 | 'data-src' => array(), |
| 236 | 236 | 'src' => array(), |
| 237 | 237 | 'width' => array(), |
| 238 | 238 | 'height' => array(), |
| 239 | - 'frameBorder' => array( '0' ), |
|
| 239 | + 'frameBorder' => array('0'), |
|
| 240 | 240 | 'class' => array(), |
| 241 | 241 | 'allowFullScreen' => array(), |
| 242 | 242 | 'style' => array(), |
@@ -245,10 +245,10 @@ discard block |
||
| 245 | 245 | 'class' => array(), |
| 246 | 246 | ), |
| 247 | 247 | ); |
| 248 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 249 | - echo wp_kses_post( $args['body'] ); |
|
| 248 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
| 249 | + echo wp_kses_post($args['body']); |
|
| 250 | 250 | } else { |
| 251 | - echo wp_kses( $args['body'], $allowed_html ); |
|
| 251 | + echo wp_kses($args['body'], $allowed_html); |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | ?> |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | * @param [type] $embed |
| 267 | 267 | * @return void |
| 268 | 268 | */ |
| 269 | -function get_video_url( $embed ) { |
|
| 269 | +function get_video_url($embed) { |
|
| 270 | 270 | $url = ''; |
| 271 | - if ( false !== stripos( $embed, '<iframe' ) ) { |
|
| 272 | - preg_match( '/src="([^"]+)"/', $embed, $match ); |
|
| 273 | - if ( is_array( $match ) && isset( $match[1] ) ) { |
|
| 271 | + if (false !== stripos($embed, '<iframe')) { |
|
| 272 | + preg_match('/src="([^"]+)"/', $embed, $match); |
|
| 273 | + if (is_array($match) && isset($match[1])) { |
|
| 274 | 274 | $url = '<iframe data-src="' . $match[1] . '" style="border: 0;" frameBorder="0" class="giphy-embed" allowFullScreen height="300" width="100%"></iframe>'; |
| 275 | 275 | } else { |
| 276 | 276 | $url = $embed; |
@@ -288,15 +288,15 @@ discard block |
||
| 288 | 288 | * @param array $post_ids |
| 289 | 289 | * @return boolean |
| 290 | 290 | */ |
| 291 | -function is_week_complete( $term_id = false, $section_keys = array(), $group_title = '' ) { |
|
| 291 | +function is_week_complete($term_id = false, $section_keys = array(), $group_title = '') { |
|
| 292 | 292 | $return = false; |
| 293 | - if ( ! empty( $section_keys ) ) { |
|
| 294 | - $group_count = count( $section_keys ); |
|
| 295 | - foreach ( $section_keys as &$pid ) { |
|
| 296 | - $pid = 'day_' . \lsx_health_plan\functions\plan\generate_section_id( $pid ) . '_complete'; |
|
| 293 | + if ( ! empty($section_keys)) { |
|
| 294 | + $group_count = count($section_keys); |
|
| 295 | + foreach ($section_keys as &$pid) { |
|
| 296 | + $pid = 'day_' . \lsx_health_plan\functions\plan\generate_section_id($pid) . '_complete'; |
|
| 297 | 297 | } |
| 298 | - $days_complete = get_meta_amounts( $section_keys ); |
|
| 299 | - if ( (int) $group_count === (int) $days_complete ) { |
|
| 298 | + $days_complete = get_meta_amounts($section_keys); |
|
| 299 | + if ((int) $group_count === (int) $days_complete) { |
|
| 300 | 300 | $return = true; |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -310,20 +310,20 @@ discard block |
||
| 310 | 310 | * @param string $key |
| 311 | 311 | * @return void |
| 312 | 312 | */ |
| 313 | -function get_meta_amounts( $post_ids = array() ) { |
|
| 313 | +function get_meta_amounts($post_ids = array()) { |
|
| 314 | 314 | global $wpdb; |
| 315 | 315 | $amount = 0; |
| 316 | 316 | $current_user = wp_get_current_user(); |
| 317 | - if ( false !== $current_user && ! empty( $post_ids ) ) { |
|
| 318 | - $post_ids = "'" . implode( "','", $post_ids ) . "'"; |
|
| 317 | + if (false !== $current_user && ! empty($post_ids)) { |
|
| 318 | + $post_ids = "'" . implode("','", $post_ids) . "'"; |
|
| 319 | 319 | $query = " |
| 320 | 320 | SELECT COUNT(`meta_value`) |
| 321 | 321 | FROM `{$wpdb->usermeta}` |
| 322 | 322 | WHERE `meta_key` IN ({$post_ids}) |
| 323 | 323 | AND `user_id` = '{$current_user->ID}' |
| 324 | 324 | "; |
| 325 | - $results = $wpdb->get_var( $query ); // WPCS: unprepared SQL |
|
| 326 | - if ( ! empty( $results ) ) { |
|
| 325 | + $results = $wpdb->get_var($query); // WPCS: unprepared SQL |
|
| 326 | + if ( ! empty($results)) { |
|
| 327 | 327 | $amount = $results; |
| 328 | 328 | } |
| 329 | 329 | } |
@@ -336,27 +336,27 @@ discard block |
||
| 336 | 336 | * @param [type] $post |
| 337 | 337 | * @return void |
| 338 | 338 | */ |
| 339 | -function hp_get_plan_type_meta( $post ) { |
|
| 339 | +function hp_get_plan_type_meta($post) { |
|
| 340 | 340 | $plan_meta = ''; |
| 341 | 341 | |
| 342 | - $term_obj_list = get_the_terms( $post->ID, 'plan-type' ); |
|
| 343 | - if ( false !== $term_obj_list ) { |
|
| 342 | + $term_obj_list = get_the_terms($post->ID, 'plan-type'); |
|
| 343 | + if (false !== $term_obj_list) { |
|
| 344 | 344 | $terms_string = ''; |
| 345 | - $terms_ids = wp_list_pluck( $term_obj_list, 'term_id' ); |
|
| 345 | + $terms_ids = wp_list_pluck($term_obj_list, 'term_id'); |
|
| 346 | 346 | |
| 347 | - foreach ( $term_obj_list as $term ) { |
|
| 348 | - $term_link = get_term_link( $term ); |
|
| 349 | - $term_name = '<a href="' . $term_link . '">' .$term->name . '<span>, </span></a>'; |
|
| 347 | + foreach ($term_obj_list as $term) { |
|
| 348 | + $term_link = get_term_link($term); |
|
| 349 | + $term_name = '<a href="' . $term_link . '">' . $term->name . '<span>, </span></a>'; |
|
| 350 | 350 | |
| 351 | 351 | $terms_string .= $term_name; |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - foreach ( $terms_ids as $terms_id ) { |
|
| 355 | - $term_thumbnail_id = get_term_meta( $terms_id, 'thumbnail', true ); |
|
| 356 | - $img = wp_get_attachment_image_src( $term_thumbnail_id, 'thumbnail' ); |
|
| 357 | - if ( ! empty( $img ) ) { |
|
| 354 | + foreach ($terms_ids as $terms_id) { |
|
| 355 | + $term_thumbnail_id = get_term_meta($terms_id, 'thumbnail', true); |
|
| 356 | + $img = wp_get_attachment_image_src($term_thumbnail_id, 'thumbnail'); |
|
| 357 | + if ( ! empty($img)) { |
|
| 358 | 358 | $image_url = $img[0]; |
| 359 | - $img = '<img loading="lazy" alt="thumbnail" style="width:24px; height: auto;" class="attachment-responsive wp-post-image lsx-responsive" src="' . esc_url( $image_url ) . '" />'; |
|
| 359 | + $img = '<img loading="lazy" alt="thumbnail" style="width:24px; height: auto;" class="attachment-responsive wp-post-image lsx-responsive" src="' . esc_url($image_url) . '" />'; |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | $plan_meta .= $img; |
@@ -371,14 +371,14 @@ discard block |
||
| 371 | 371 | /** |
| 372 | 372 | * Limit media library access |
| 373 | 373 | */ |
| 374 | -function set_only_author( $wp_query ) { |
|
| 374 | +function set_only_author($wp_query) { |
|
| 375 | 375 | global $current_user; |
| 376 | - if ( is_admin() && ! current_user_can( 'edit_others_posts' ) ) { |
|
| 377 | - $wp_query->set( 'administrator', $current_user->ID ); |
|
| 378 | - add_filter( 'views_upload', 'fix_media_counts' ); |
|
| 376 | + if (is_admin() && ! current_user_can('edit_others_posts')) { |
|
| 377 | + $wp_query->set('administrator', $current_user->ID); |
|
| 378 | + add_filter('views_upload', 'fix_media_counts'); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | -add_action( 'pre_get_posts', '\lsx_health_plan\functions\set_only_author' ); |
|
| 381 | +add_action('pre_get_posts', '\lsx_health_plan\functions\set_only_author'); |
|
| 382 | 382 | |
| 383 | 383 | /** |
| 384 | 384 | * Outputs an excerpt even if there is not excerpt. |
@@ -386,11 +386,11 @@ discard block |
||
| 386 | 386 | * @param [type] $post_id |
| 387 | 387 | * @return void |
| 388 | 388 | */ |
| 389 | -function hp_excerpt( $post_id ) { |
|
| 390 | - if ( ! has_excerpt( $post_id ) ) { |
|
| 391 | - $content = wp_trim_words( get_post_field( 'post_content', $post_id ), 10 ); |
|
| 389 | +function hp_excerpt($post_id) { |
|
| 390 | + if ( ! has_excerpt($post_id)) { |
|
| 391 | + $content = wp_trim_words(get_post_field('post_content', $post_id), 10); |
|
| 392 | 392 | } else { |
| 393 | - $content = get_the_excerpt( $post_id ); |
|
| 393 | + $content = get_the_excerpt($post_id); |
|
| 394 | 394 | } |
| 395 | 395 | return $content; |
| 396 | 396 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | * @param string $columns |
| 402 | 402 | * @return void |
| 403 | 403 | */ |
| 404 | -function column_class( $columns = '3' ) { |
|
| 404 | +function column_class($columns = '3') { |
|
| 405 | 405 | $cols = ''; |
| 406 | 406 | $cols .= '5' === $columns ? '15' : 12 / $columns; |
| 407 | 407 | return $cols; |
@@ -413,16 +413,16 @@ discard block |
||
| 413 | 413 | * @param string $workout |
| 414 | 414 | * @return void |
| 415 | 415 | */ |
| 416 | -function get_exercises_by_workout( $workout = '' ) { |
|
| 416 | +function get_exercises_by_workout($workout = '') { |
|
| 417 | 417 | $exercises = array(); |
| 418 | 418 | $i = 1; |
| 419 | 419 | $section_counter = 6; |
| 420 | - while ( $i <= $section_counter ) { |
|
| 420 | + while ($i <= $section_counter) { |
|
| 421 | 421 | $group_name = 'workout_section_' . $i; |
| 422 | - $groups = get_post_meta( $workout, $group_name, true ); |
|
| 423 | - if ( ! empty( $groups ) ) { |
|
| 424 | - foreach ( $groups as $group ) { |
|
| 425 | - if ( isset( $group['connected_exercises'] ) ) { |
|
| 422 | + $groups = get_post_meta($workout, $group_name, true); |
|
| 423 | + if ( ! empty($groups)) { |
|
| 424 | + foreach ($groups as $group) { |
|
| 425 | + if (isset($group['connected_exercises'])) { |
|
| 426 | 426 | $exercises[] = $group['connected_exercises']; |
| 427 | 427 | } |
| 428 | 428 | } |
@@ -439,23 +439,23 @@ discard block |
||
| 439 | 439 | * @param int $plan_id |
| 440 | 440 | * @return int |
| 441 | 441 | */ |
| 442 | -function get_progress( $plan_id = false ) { |
|
| 442 | +function get_progress($plan_id = false) { |
|
| 443 | 443 | $progress = 0; |
| 444 | 444 | $complete = array(); |
| 445 | 445 | $count = 0; |
| 446 | - if ( false !== $plan_id && \lsx_health_plan\functions\plan\has_sections( $plan_id ) ) { |
|
| 446 | + if (false !== $plan_id && \lsx_health_plan\functions\plan\has_sections($plan_id)) { |
|
| 447 | 447 | $sections = \lsx_health_plan\functions\plan\get_sections(); |
| 448 | - $all_count = count( $sections ); |
|
| 448 | + $all_count = count($sections); |
|
| 449 | 449 | $rest_days = 0; |
| 450 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 451 | - if ( false !== $section_values['rest_day_enabled'] && ! $section_values['connected_meals'] ) { |
|
| 450 | + foreach ($sections as $section_key => $section_values) { |
|
| 451 | + if (false !== $section_values['rest_day_enabled'] && ! $section_values['connected_meals']) { |
|
| 452 | 452 | $rest_days++; |
| 453 | - } else if ( lsx_health_plan_is_day_complete( $plan_id, $section_values['title'] ) ) { |
|
| 453 | + } else if (lsx_health_plan_is_day_complete($plan_id, $section_values['title'])) { |
|
| 454 | 454 | $complete[] = true; |
| 455 | 455 | } |
| 456 | 456 | } |
| 457 | 457 | $all_count = $all_count - $rest_days; |
| 458 | - $progress = (int) count( $complete ) / (int) $all_count * 100; |
|
| 458 | + $progress = (int) count($complete) / (int) $all_count * 100; |
|
| 459 | 459 | } |
| 460 | 460 | return $progress; |
| 461 | 461 | } |
@@ -473,15 +473,15 @@ discard block |
||
| 473 | 473 | $post_type = get_queried_object()->taxonomy; |
| 474 | 474 | $post_type = $wp_taxonomies[$post_type]->object_type; |
| 475 | 475 | |
| 476 | - if ( is_tax() ) { |
|
| 476 | + if (is_tax()) { |
|
| 477 | 477 | ?> |
| 478 | 478 | <div class="archive-category-title hp-archive-category-title"> |
| 479 | - <a class="back-to-blog" href="<?php echo ( esc_url( get_post_type_archive_link( $post_type[0] ) ) ); ?>"><?php echo esc_html__( 'Back To ', 'lsx' ) . esc_html( $post_type[0] ) . 's'; ?></a> |
|
| 479 | + <a class="back-to-blog" href="<?php echo (esc_url(get_post_type_archive_link($post_type[0]))); ?>"><?php echo esc_html__('Back To ', 'lsx') . esc_html($post_type[0]) . 's'; ?></a> |
|
| 480 | 480 | </div> |
| 481 | 481 | <?php |
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | -add_action( 'lsx_content_wrap_before', '\lsx_health_plan\functions\hp_back_archive_link', 20 ); |
|
| 484 | +add_action('lsx_content_wrap_before', '\lsx_health_plan\functions\hp_back_archive_link', 20); |
|
| 485 | 485 | |
| 486 | 486 | /** |
| 487 | 487 | * Returns an array. |
@@ -489,11 +489,11 @@ discard block |
||
| 489 | 489 | * @param mixed $item |
| 490 | 490 | * @return array |
| 491 | 491 | */ |
| 492 | -function prep_array( $item ) { |
|
| 493 | - if ( ! is_array( $item ) ) { |
|
| 494 | - $item = explode( ',', $item ); |
|
| 495 | - if ( ! is_array( $item ) ) { |
|
| 496 | - $item = array( $item ); |
|
| 492 | +function prep_array($item) { |
|
| 493 | + if ( ! is_array($item)) { |
|
| 494 | + $item = explode(',', $item); |
|
| 495 | + if ( ! is_array($item)) { |
|
| 496 | + $item = array($item); |
|
| 497 | 497 | } |
| 498 | 498 | } |
| 499 | 499 | return $item; |