| @@ -11,29 +11,29 @@ discard block | ||
| 11 | 11 | * @return void | 
| 12 | 12 | */ | 
| 13 | 13 |  function lsx_health_plan_workout_box() { | 
| 14 | -	if ( ! post_type_exists( 'workout' ) ) { | |
| 15 | - return; | |
| 16 | - } | |
| 17 | - $intro_text = \lsx_health_plan\functions\get_option( 'workout_intro', false ); | |
| 18 | - ?> | |
| 14 | +     if ( ! post_type_exists( 'workout' ) ) { | |
| 15 | + return; | |
| 16 | + } | |
| 17 | + $intro_text = \lsx_health_plan\functions\get_option( 'workout_intro', false ); | |
| 18 | + ?> | |
| 19 | 19 | <div class="workout-instructions"> | 
| 20 | 20 | <div class="row"> | 
| 21 | 21 | <div class="col-md-12"> | 
| 22 | 22 | <?php | 
| 23 | -			if ( false !== $intro_text ) { | |
| 24 | - ?> | |
| 23 | +               if ( false !== $intro_text ) { | |
| 24 | + ?> | |
| 25 | 25 | <div class="excerpt"> | 
| 26 | 26 | <p><?php echo wp_kses_post( wpautop( $intro_text ) ); ?></p> | 
| 27 | 27 | </div> | 
| 28 | 28 | <?php | 
| 29 | -			} else { | |
| 30 | - ?> | |
| 29 | +               } else { | |
| 30 | + ?> | |
| 31 | 31 | <div class="content-intro"> | 
| 32 | 32 | <h3><?php esc_html_e( "Don't forget your warm up!", 'lsx-health-plan' ); ?></h3> | 
| 33 | 33 | <p><?php esc_html_e( 'Be sure to do the warm-up before every workout session.', 'lsx-health-plan' ); ?></p> | 
| 34 | 34 | </div> | 
| 35 | 35 | <?php | 
| 36 | - } ?> | |
| 36 | + } ?> | |
| 37 | 37 | </div> | 
| 38 | 38 | </div> | 
| 39 | 39 | </div> | 
| @@ -46,28 +46,28 @@ discard block | ||
| 46 | 46 | * @return void | 
| 47 | 47 | */ | 
| 48 | 48 |  function lsx_health_plan_meal_box() { | 
| 49 | -	if ( ! post_type_exists( 'meal' ) ) { | |
| 50 | - return; | |
| 51 | - } | |
| 52 | - ?> | |
| 49 | +     if ( ! post_type_exists( 'meal' ) ) { | |
| 50 | + return; | |
| 51 | + } | |
| 52 | + ?> | |
| 53 | 53 | <div class="col-md-4" > | 
| 54 | 54 | <div class="lsx-health-plan-box"> | 
| 55 | 55 | <h3 class="title meal-plan-title title-lined"><?php esc_html_e( 'Your Meal Plan', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'meal.svg' ); ?></h3> | 
| 56 | 56 | <div class="spacer"></div> | 
| 57 | 57 | <?php | 
| 58 | - $intro_text = \lsx_health_plan\functions\get_option( 'meal_plan_intro', false ); | |
| 59 | -			if ( false !== $intro_text ) { | |
| 60 | - ?> | |
| 58 | + $intro_text = \lsx_health_plan\functions\get_option( 'meal_plan_intro', false ); | |
| 59 | +               if ( false !== $intro_text ) { | |
| 60 | + ?> | |
| 61 | 61 | <div class="excerpt"> | 
| 62 | 62 | <p><?php echo wp_kses_post( $intro_text ); ?></p> | 
| 63 | 63 | </div> | 
| 64 | 64 | <?php | 
| 65 | - } | |
| 66 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); | |
| 67 | -			if ( false === $meal ) { | |
| 68 | - $meal = 'meal'; | |
| 69 | - } | |
| 70 | - ?> | |
| 65 | + } | |
| 66 | + $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); | |
| 67 | +               if ( false === $meal ) { | |
| 68 | + $meal = 'meal'; | |
| 69 | + } | |
| 70 | + ?> | |
| 71 | 71 | <a href="<?php the_permalink(); ?><?php echo esc_attr( $meal ); ?>/" class="btn"><?php esc_html_e( 'View your meal plan', 'lsx-health-plan' ); ?></a> | 
| 72 | 72 | </div> | 
| 73 | 73 | </div> | 
| @@ -80,28 +80,28 @@ discard block | ||
| 80 | 80 | * @return void | 
| 81 | 81 | */ | 
| 82 | 82 |  function lsx_health_plan_recipe_box() { | 
| 83 | -	if ( ! post_type_exists( 'recipe' ) ) { | |
| 84 | - return; | |
| 85 | - } | |
| 86 | - ?> | |
| 83 | +     if ( ! post_type_exists( 'recipe' ) ) { | |
| 84 | + return; | |
| 85 | + } | |
| 86 | + ?> | |
| 87 | 87 | <div class="col-md-4" > | 
| 88 | 88 | <div class="lsx-health-plan-box"> | 
| 89 | 89 | <h3 class="title recipes-title title-lined"><?php esc_html_e( 'Recipes', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'recipes.svg' ); ?></h3> | 
| 90 | 90 | <div class="spacer"></div> | 
| 91 | 91 | <?php | 
| 92 | - $intro_text = \lsx_health_plan\functions\get_option( 'recipes_intro', false ); | |
| 93 | -			if ( false !== $intro_text ) { | |
| 94 | - ?> | |
| 92 | + $intro_text = \lsx_health_plan\functions\get_option( 'recipes_intro', false ); | |
| 93 | +               if ( false !== $intro_text ) { | |
| 94 | + ?> | |
| 95 | 95 | <div class="excerpt"> | 
| 96 | 96 | <p><?php echo wp_kses_post( $intro_text ); ?></p> | 
| 97 | 97 | </div> | 
| 98 | 98 | <?php | 
| 99 | - } | |
| 100 | - $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); | |
| 101 | -			if ( false === $recipes ) { | |
| 102 | - $recipes = 'recipes'; | |
| 103 | - } | |
| 104 | - ?> | |
| 99 | + } | |
| 100 | + $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); | |
| 101 | +               if ( false === $recipes ) { | |
| 102 | + $recipes = 'recipes'; | |
| 103 | + } | |
| 104 | + ?> | |
| 105 | 105 | <a href="<?php the_permalink(); ?><?php echo esc_attr( $recipes ); ?>/" class="btn"><?php esc_html_e( 'View all recipes', 'lsx-health-plan' ); ?></a> | 
| 106 | 106 | </div> | 
| 107 | 107 | </div> | 
| @@ -114,8 +114,8 @@ discard block | ||
| 114 | 114 | * @return void | 
| 115 | 115 | */ | 
| 116 | 116 |  function lsx_health_plan_downloads_box() { | 
| 117 | - global $current_user; | |
| 118 | - ?> | |
| 117 | + global $current_user; | |
| 118 | + ?> | |
| 119 | 119 | <div class="col-md-4 day-download-box" > | 
| 120 | 120 | <div class="lsx-health-plan-box"> | 
| 121 | 121 | <h3 class="title downloads-title title-lined"><?php esc_html_e( 'Downloads', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'download.svg' ); ?></h3> | 
| @@ -123,13 +123,13 @@ discard block | ||
| 123 | 123 | <div class="download-list"> | 
| 124 | 124 | <ul> | 
| 125 | 125 | <?php | 
| 126 | - $downloads = \lsx_health_plan\functions\get_downloads(); | |
| 127 | -					if ( ! empty( $downloads ) ) { | |
| 128 | -						foreach ( $downloads as $download ) { | |
| 129 | - echo wp_kses_post( '<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode( '[download id="' . $download . '"]' ) . '</a></li>' ); | |
| 130 | - } | |
| 131 | - } | |
| 132 | - ?> | |
| 126 | + $downloads = \lsx_health_plan\functions\get_downloads(); | |
| 127 | +                         if ( ! empty( $downloads ) ) { | |
| 128 | +                              foreach ( $downloads as $download ) { | |
| 129 | + echo wp_kses_post( '<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode( '[download id="' . $download . '"]' ) . '</a></li>' ); | |
| 130 | + } | |
| 131 | + } | |
| 132 | + ?> | |
| 133 | 133 | </ul> | 
| 134 | 134 | </div> | 
| 135 | 135 | </div> | 
| @@ -144,15 +144,15 @@ discard block | ||
| 144 | 144 | * @return void | 
| 145 | 145 | */ | 
| 146 | 146 |  function lsx_health_plan_nav_class( $tab = '' ) { | 
| 147 | - $nav_classes = array(); | |
| 148 | -	if ( function_exists( 'is_wc_endpoint_url' ) && 'edit-account' === $tab && is_wc_endpoint_url( 'edit-account' ) ) { | |
| 149 | - $nav_classes[] = 'active'; | |
| 150 | -	} elseif ( lsx_health_plan_is_current_tab( $tab ) ) { | |
| 151 | - $nav_classes[] = 'active'; | |
| 152 | - } | |
| 153 | -	if ( ! empty( $nav_classes ) ) { | |
| 154 | - echo wp_kses_post( implode( ' ', $nav_classes ) ); | |
| 155 | - } | |
| 147 | + $nav_classes = array(); | |
| 148 | +     if ( function_exists( 'is_wc_endpoint_url' ) && 'edit-account' === $tab && is_wc_endpoint_url( 'edit-account' ) ) { | |
| 149 | + $nav_classes[] = 'active'; | |
| 150 | +     } elseif ( lsx_health_plan_is_current_tab( $tab ) ) { | |
| 151 | + $nav_classes[] = 'active'; | |
| 152 | + } | |
| 153 | +     if ( ! empty( $nav_classes ) ) { | |
| 154 | + echo wp_kses_post( implode( ' ', $nav_classes ) ); | |
| 155 | + } | |
| 156 | 156 | } | 
| 157 | 157 | |
| 158 | 158 | /** | 
| @@ -161,34 +161,34 @@ discard block | ||
| 161 | 161 | * @return void | 
| 162 | 162 | */ | 
| 163 | 163 |  function lsx_health_plan_my_profile_tabs() { | 
| 164 | - ?> | |
| 164 | + ?> | |
| 165 | 165 | <div id="account-nav"> | 
| 166 | 166 | <ul class="nav nav-pills"> | 
| 167 | 167 | <li class=" | 
| 168 | 168 | <?php | 
| 169 | -			if ( ( function_exists( 'is_wc_endpoint_url' ) && ! is_wc_endpoint_url( 'edit-account' ) ) || ! function_exists( 'is_wc_endpoint_url' ) ) { | |
| 170 | - echo esc_attr( 'active' ); | |
| 171 | - } | |
| 172 | - ?> | |
| 169 | +               if ( ( function_exists( 'is_wc_endpoint_url' ) && ! is_wc_endpoint_url( 'edit-account' ) ) || ! function_exists( 'is_wc_endpoint_url' ) ) { | |
| 170 | + echo esc_attr( 'active' ); | |
| 171 | + } | |
| 172 | + ?> | |
| 173 | 173 | "><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a></li> | 
| 174 | 174 | <?php | 
| 175 | -			if ( function_exists( 'WC' ) ) { | |
| 176 | - ?> | |
| 175 | +               if ( function_exists( 'WC' ) ) { | |
| 176 | + ?> | |
| 177 | 177 | <li class=" | 
| 178 | 178 | <?php | 
| 179 | -				if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { | |
| 180 | - echo esc_attr( 'active' ); | |
| 181 | - } | |
| 182 | - ?> | |
| 179 | +                    if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { | |
| 180 | + echo esc_attr( 'active' ); | |
| 181 | + } | |
| 182 | + ?> | |
| 183 | 183 | "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e( 'Account Details', 'lsx-health-plan' ); ?></a></li> | 
| 184 | 184 | <?php | 
| 185 | - } | |
| 186 | -			if ( is_user_logged_in() ) { | |
| 187 | - ?> | |
| 185 | + } | |
| 186 | +               if ( is_user_logged_in() ) { | |
| 187 | + ?> | |
| 188 | 188 | <li class=""><a class="logout-tab" href="<?php echo esc_url( wp_logout_url( get_permalink() ) ); ?>"><?php esc_html_e( 'Logout', 'lsx-health-plan' ); ?></a></li> | 
| 189 | 189 | <?php | 
| 190 | - } | |
| 191 | - ?> | |
| 190 | + } | |
| 191 | + ?> | |
| 192 | 192 | </ul> | 
| 193 | 193 | </div> | 
| 194 | 194 | <?php | 
| @@ -200,7 +200,7 @@ discard block | ||
| 200 | 200 | * @return void | 
| 201 | 201 | */ | 
| 202 | 202 |  function lsx_health_plan_my_profile_box() { | 
| 203 | - ?> | |
| 203 | + ?> | |
| 204 | 204 | <div class="lsx-health-plan my-profile-block wp-block-cover alignfull"> | 
| 205 | 205 | <div class="wp-block-cover__inner-container"> | 
| 206 | 206 | <h2><?php esc_html_e( 'My Dashboard', 'lsx-health-plan' ); ?></h2> | 
| @@ -210,14 +210,14 @@ discard block | ||
| 210 | 210 | <div class="profile-navigation"> | 
| 211 | 211 | <div class="profile-photo"> | 
| 212 | 212 | <?php | 
| 213 | - global $current_user; | |
| 214 | -								if ( function_exists( 'WC' ) ) { | |
| 215 | - get_current_user(); | |
| 216 | - } | |
| 217 | -								if ( class_exists( 'WP_User_Avatar_Setup' ) ) { | |
| 218 | - echo get_avatar( $current_user->ID, 240 ); | |
| 219 | - } | |
| 220 | - ?> | |
| 213 | + global $current_user; | |
| 214 | +                                        if ( function_exists( 'WC' ) ) { | |
| 215 | + get_current_user(); | |
| 216 | + } | |
| 217 | +                                        if ( class_exists( 'WP_User_Avatar_Setup' ) ) { | |
| 218 | + echo get_avatar( $current_user->ID, 240 ); | |
| 219 | + } | |
| 220 | + ?> | |
| 221 | 221 | </div> | 
| 222 | 222 | </div> | 
| 223 | 223 | <?php } ?> | 
| @@ -225,88 +225,88 @@ discard block | ||
| 225 | 225 | <div class="profile-details"> | 
| 226 | 226 | <h1 class="title-lined has-text-color"><?php echo esc_html( $current_user->display_name ); ?></h1> | 
| 227 | 227 | <?php | 
| 228 | - $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); | |
| 229 | -							if ( 'on' !== $disable_stats && function_exists( 'WC' ) ) { | |
| 228 | + $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); | |
| 229 | +                                   if ( 'on' !== $disable_stats && function_exists( 'WC' ) ) { | |
| 230 | 230 | |
| 231 | - $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); | |
| 232 | - $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); | |
| 233 | - $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); | |
| 234 | - $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); | |
| 231 | + $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); | |
| 232 | + $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); | |
| 233 | + $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); | |
| 234 | + $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); | |
| 235 | 235 | |
| 236 | - $weight = get_user_meta( get_current_user_id(), 'weight', true ); | |
| 237 | - $waist = get_user_meta( get_current_user_id(), 'waist', true ); | |
| 238 | - $height = get_user_meta( get_current_user_id(), 'height', true ); | |
| 236 | + $weight = get_user_meta( get_current_user_id(), 'weight', true ); | |
| 237 | + $waist = get_user_meta( get_current_user_id(), 'waist', true ); | |
| 238 | + $height = get_user_meta( get_current_user_id(), 'height', true ); | |
| 239 | 239 | |
| 240 | - $height_m = 0; | |
| 241 | -								if ( is_numeric( $height ) ) { | |
| 242 | - $height_m = $height / 100; | |
| 243 | - } | |
| 240 | + $height_m = 0; | |
| 241 | +                                        if ( is_numeric( $height ) ) { | |
| 242 | + $height_m = $height / 100; | |
| 243 | + } | |
| 244 | 244 | |
| 245 | -								if ( 1 < $weight && 1 < $height_m ) { | |
| 246 | - $bmi = $weight / ( $height_m * $height_m ); | |
| 247 | - $bmi = number_format( $bmi, 1 ); | |
| 248 | -								} else { | |
| 249 | - $bmi = __( 'Add more data', 'lsx-health-plan' ); | |
| 250 | - } | |
| 245 | +                                        if ( 1 < $weight && 1 < $height_m ) { | |
| 246 | + $bmi = $weight / ( $height_m * $height_m ); | |
| 247 | + $bmi = number_format( $bmi, 1 ); | |
| 248 | +                                        } else { | |
| 249 | + $bmi = __( 'Add more data', 'lsx-health-plan' ); | |
| 250 | + } | |
| 251 | 251 | |
| 252 | - ?> | |
| 252 | + ?> | |
| 253 | 253 | |
| 254 | 254 | <div> | 
| 255 | 255 |  									<?php if ( 'on' !== $is_weight_disabled ) { ?> | 
| 256 | 256 | <span><strong><?php esc_html_e( 'Weight:', 'lsx-health-plan' ); ?></strong> | 
| 257 | 257 | <?php | 
| 258 | -										if ( '' !== $weight ) { | |
| 259 | - echo wp_kses_post( $weight . ' kg' ); | |
| 260 | -										} else { | |
| 261 | - echo '/'; | |
| 262 | - } | |
| 263 | - ?> | |
| 258 | +                                                  if ( '' !== $weight ) { | |
| 259 | + echo wp_kses_post( $weight . ' kg' ); | |
| 260 | +                                                  } else { | |
| 261 | + echo '/'; | |
| 262 | + } | |
| 263 | + ?> | |
| 264 | 264 | </span> | 
| 265 | 265 | <?php } | 
| 266 | -									if ( 'on' !== $is_waist_disabled ) { | |
| 267 | - ?> | |
| 266 | +                                             if ( 'on' !== $is_waist_disabled ) { | |
| 267 | + ?> | |
| 268 | 268 | <span><strong><?php esc_html_e( 'Waist:', 'lsx-health-plan' ); ?></strong> | 
| 269 | 269 | <?php | 
| 270 | -										if ( '' !== $waist ) { | |
| 271 | - echo wp_kses_post( $waist . ' cm' ); | |
| 272 | -										} else { | |
| 273 | - echo '/'; | |
| 274 | - } | |
| 275 | - ?> | |
| 270 | +                                                  if ( '' !== $waist ) { | |
| 271 | + echo wp_kses_post( $waist . ' cm' ); | |
| 272 | +                                                  } else { | |
| 273 | + echo '/'; | |
| 274 | + } | |
| 275 | + ?> | |
| 276 | 276 | </span> | 
| 277 | 277 | <?php } | 
| 278 | -									if ( 'on' !== $is_bmi_disabled ) { | |
| 279 | - ?> | |
| 278 | +                                             if ( 'on' !== $is_bmi_disabled ) { | |
| 279 | + ?> | |
| 280 | 280 | <span><strong><?php esc_html_e( 'BMI:', 'lsx-health-plan' ); ?></strong> | 
| 281 | 281 | <?php | 
| 282 | -										if ( '' !== $bmi ) { | |
| 283 | - echo wp_kses_post( $bmi ); | |
| 284 | -										} else { | |
| 285 | - echo '/'; | |
| 286 | - } | |
| 287 | - ?> | |
| 282 | +                                                  if ( '' !== $bmi ) { | |
| 283 | + echo wp_kses_post( $bmi ); | |
| 284 | +                                                  } else { | |
| 285 | + echo '/'; | |
| 286 | + } | |
| 287 | + ?> | |
| 288 | 288 | </span> | 
| 289 | 289 | <?php } ?> | 
| 290 | 290 | </div> | 
| 291 | 291 | <?php | 
| 292 | - } | |
| 292 | + } | |
| 293 | 293 | |
| 294 | - // Only display the edit account link if woocommerce is active. | |
| 295 | -							if ( function_exists( 'WC' ) ) { | |
| 296 | - ?> | |
| 294 | + // Only display the edit account link if woocommerce is active. | |
| 295 | +                                   if ( function_exists( 'WC' ) ) { | |
| 296 | + ?> | |
| 297 | 297 | <div class="edit-profile"> | 
| 298 | 298 | <?php | 
| 299 | -									if ( function_exists( 'wc_get_page_id' ) ) { | |
| 300 | - $url_id = wc_get_page_id( 'myaccount' ); | |
| 301 | -									} else { | |
| 302 | - $url_id = ''; | |
| 303 | - } | |
| 304 | - ?> | |
| 299 | +                                             if ( function_exists( 'wc_get_page_id' ) ) { | |
| 300 | + $url_id = wc_get_page_id( 'myaccount' ); | |
| 301 | +                                             } else { | |
| 302 | + $url_id = ''; | |
| 303 | + } | |
| 304 | + ?> | |
| 305 | 305 | <a href="<?php echo esc_url( get_permalink( $url_id ) ); ?>edit-account/"><?php esc_html_e( 'Edit', 'lsx-health-plan' ); ?></a> | 
| 306 | 306 | </div> | 
| 307 | 307 | <?php | 
| 308 | - } | |
| 309 | - ?> | |
| 308 | + } | |
| 309 | + ?> | |
| 310 | 310 | </div> | 
| 311 | 311 | <?php } ?> | 
| 312 | 312 | </section> | 
| @@ -322,73 +322,73 @@ discard block | ||
| 322 | 322 | * @return void | 
| 323 | 323 | */ | 
| 324 | 324 |  function lsx_health_plan_all_plans_block() { | 
| 325 | - global $post, $product; | |
| 326 | - | |
| 327 | - // If this is the my plan page, and the user is logged out, show to WC login. | |
| 328 | - $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); | |
| 329 | -	if ( function_exists( 'is_wc_endpoint_url' ) && false !== $plan_slug && is_page( $plan_slug ) ) { | |
| 330 | - echo wp_kses_post( '<h2 class="title-lined my-plan"></h2>' ); | |
| 331 | - echo do_shortcode( '[woocommerce_my_account]' ); | |
| 332 | - return; | |
| 333 | - } | |
| 334 | - | |
| 335 | - $args = array( | |
| 336 | - 'orderby' => 'menu_order', | |
| 337 | - 'order' => 'ASC', | |
| 338 | - 'post_type' => 'plan', | |
| 339 | - 'nopagin' => true, | |
| 340 | - 'post_parent' => 0, | |
| 341 | - ); | |
| 342 | - | |
| 343 | -	if ( function_exists( '\lsx_health_plan\functions\woocommerce\get_membership_products' ) ) { | |
| 344 | - $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); | |
| 345 | -		if ( ! empty( $product_ids ) ) { | |
| 346 | - $args['meta_query'] = array( | |
| 347 | - 'relation' => 'OR', | |
| 348 | - array( | |
| 349 | - 'key' => '_plan_product_id', | |
| 350 | - 'value' => $product_ids, | |
| 351 | - 'compare' => 'IN', | |
| 352 | - ), | |
| 353 | - array( | |
| 354 | - 'key' => '_plan_product_id', | |
| 355 | - 'compare' => 'NOT EXISTS', | |
| 356 | - ), | |
| 357 | - ); | |
| 358 | - } | |
| 359 | - } | |
| 360 | - | |
| 361 | - $the_query = new WP_Query( $args ); | |
| 362 | - ?> | |
| 325 | + global $post, $product; | |
| 326 | + | |
| 327 | + // If this is the my plan page, and the user is logged out, show to WC login. | |
| 328 | + $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); | |
| 329 | +     if ( function_exists( 'is_wc_endpoint_url' ) && false !== $plan_slug && is_page( $plan_slug ) ) { | |
| 330 | + echo wp_kses_post( '<h2 class="title-lined my-plan"></h2>' ); | |
| 331 | + echo do_shortcode( '[woocommerce_my_account]' ); | |
| 332 | + return; | |
| 333 | + } | |
| 334 | + | |
| 335 | + $args = array( | |
| 336 | + 'orderby' => 'menu_order', | |
| 337 | + 'order' => 'ASC', | |
| 338 | + 'post_type' => 'plan', | |
| 339 | + 'nopagin' => true, | |
| 340 | + 'post_parent' => 0, | |
| 341 | + ); | |
| 342 | + | |
| 343 | +     if ( function_exists( '\lsx_health_plan\functions\woocommerce\get_membership_products' ) ) { | |
| 344 | + $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); | |
| 345 | +          if ( ! empty( $product_ids ) ) { | |
| 346 | + $args['meta_query'] = array( | |
| 347 | + 'relation' => 'OR', | |
| 348 | + array( | |
| 349 | + 'key' => '_plan_product_id', | |
| 350 | + 'value' => $product_ids, | |
| 351 | + 'compare' => 'IN', | |
| 352 | + ), | |
| 353 | + array( | |
| 354 | + 'key' => '_plan_product_id', | |
| 355 | + 'compare' => 'NOT EXISTS', | |
| 356 | + ), | |
| 357 | + ); | |
| 358 | + } | |
| 359 | + } | |
| 360 | + | |
| 361 | + $the_query = new WP_Query( $args ); | |
| 362 | + ?> | |
| 363 | 363 | <div class="all-plans-block plan-grid block-all-plans-block"> | 
| 364 | 364 | <div class="row"> | 
| 365 | 365 | <?php | 
| 366 | - if ( $the_query->have_posts() ) : | |
| 367 | - while ( $the_query->have_posts() ) : | |
| 368 | - $the_query->the_post(); | |
| 369 | - lsx_entry_before(); | |
| 370 | - $completed_class = ''; | |
| 371 | - $linked_product = false; | |
| 372 | - $restricted = false; | |
| 373 | - $product = null; | |
| 374 | -					if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { | |
| 375 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); | |
| 376 | - $linked_product = wc_get_product( $products[0] ); | |
| 377 | - $product = $linked_product; | |
| 378 | - } | |
| 379 | -					if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { | |
| 380 | - $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); | |
| 381 | - } | |
| 382 | - | |
| 383 | -					if ( lsx_health_plan_is_plan_complete() ) { | |
| 384 | - $completed_class = 'completed'; | |
| 385 | - } | |
| 386 | - $round_progress = ''; | |
| 387 | - $completed_progress = '100'; | |
| 388 | -					if ( false === $restricted ) { | |
| 389 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); | |
| 390 | - } | |
| 391 | - ?> | |
| 366 | + if ( $the_query->have_posts() ) : | |
| 367 | + while ( $the_query->have_posts() ) : | |
| 368 | + $the_query->the_post(); | |
| 369 | + lsx_entry_before(); | |
| 370 | + $completed_class = ''; | |
| 371 | + $linked_product = false; | |
| 372 | + $restricted = false; | |
| 373 | + $product = null; | |
| 374 | +                         if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { | |
| 375 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); | |
| 376 | + $linked_product = wc_get_product( $products[0] ); | |
| 377 | + $product = $linked_product; | |
| 378 | + } | |
| 379 | +                         if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { | |
| 380 | + $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); | |
| 381 | + } | |
| 382 | + | |
| 383 | +                         if ( lsx_health_plan_is_plan_complete() ) { | |
| 384 | + $completed_class = 'completed'; | |
| 385 | + } | |
| 386 | + $round_progress = ''; | |
| 387 | + $completed_progress = '100'; | |
| 388 | +                         if ( false === $restricted ) { | |
| 389 | + $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); | |
| 390 | + } | |
| 391 | + ?> | |
| 392 | 392 | <div class="col-xs-12 col-sm-6 col-md-4"> | 
| 393 | 393 | <article class="lsx-slot lsx-hp-shadow <?php echo esc_html( 'progress-') . $round_progress; ?>"> | 
| 394 | 394 | <div class="plan-feature-img"> | 
| @@ -397,45 +397,45 @@ discard block | ||
| 397 | 397 | <?php } ?> | 
| 398 | 398 | <a href="<?php echo esc_url( get_permalink() ); ?>"> | 
| 399 | 399 | <?php | 
| 400 | - $featured_image = get_the_post_thumbnail(); | |
| 401 | -								if ( ! empty( $featured_image ) && '' !== $featured_image ) { | |
| 402 | - the_post_thumbnail( 'lsx-thumbnail', array( | |
| 403 | - 'class' => 'aligncenter', | |
| 404 | - ) ); | |
| 405 | -								} else { | |
| 406 | - ?> | |
| 400 | + $featured_image = get_the_post_thumbnail(); | |
| 401 | +                                        if ( ! empty( $featured_image ) && '' !== $featured_image ) { | |
| 402 | + the_post_thumbnail( 'lsx-thumbnail', array( | |
| 403 | + 'class' => 'aligncenter', | |
| 404 | + ) ); | |
| 405 | +                                        } else { | |
| 406 | + ?> | |
| 407 | 407 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> | 
| 408 | 408 | <?php | 
| 409 | - } | |
| 410 | - ?> | |
| 409 | + } | |
| 410 | + ?> | |
| 411 | 411 | </a> | 
| 412 | 412 | </div> | 
| 413 | 413 | <div class="content-box plan-content-box"> | 
| 414 | 414 | <h3 class="plan id-<?php the_ID(); ?> <?php echo esc_attr( $completed_class ); ?>"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_title(); ?></a></h3> | 
| 415 | 415 | <?php | 
| 416 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); | |
| 417 | - ?> | |
| 416 | + echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); | |
| 417 | + ?> | |
| 418 | 418 | <?php | 
| 419 | -								if ( false !== $linked_product && false !== $restricted ) { | |
| 420 | - echo wp_kses_post( $linked_product->get_price_html() ); | |
| 421 | - } | |
| 422 | - ?> | |
| 419 | +                                        if ( false !== $linked_product && false !== $restricted ) { | |
| 420 | + echo wp_kses_post( $linked_product->get_price_html() ); | |
| 421 | + } | |
| 422 | + ?> | |
| 423 | 423 | <div class="excerpt"> | 
| 424 | 424 | <?php | 
| 425 | -									if ( ! has_excerpt() ) { | |
| 426 | - $content = wp_trim_words( get_the_content(), 20 ); | |
| 427 | - $content = '<p>' . $content . '</pre>'; | |
| 428 | -									} else { | |
| 429 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); | |
| 430 | - } | |
| 431 | - echo wp_kses_post( $content ); | |
| 432 | - ?> | |
| 425 | +                                             if ( ! has_excerpt() ) { | |
| 426 | + $content = wp_trim_words( get_the_content(), 20 ); | |
| 427 | + $content = '<p>' . $content . '</pre>'; | |
| 428 | +                                             } else { | |
| 429 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); | |
| 430 | + } | |
| 431 | + echo wp_kses_post( $content ); | |
| 432 | + ?> | |
| 433 | 433 | </div> | 
| 434 | 434 | <?php | 
| 435 | -								if ( false === $restricted ) { | |
| 436 | - echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '" max="100"> ' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '% </progress><span>' . $round_progress . '%</span></span>' ); | |
| 437 | - } | |
| 438 | - ?> | |
| 435 | +                                        if ( false === $restricted ) { | |
| 436 | + echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '" max="100"> ' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '% </progress><span>' . $round_progress . '%</span></span>' ); | |
| 437 | + } | |
| 438 | + ?> | |
| 439 | 439 | </div> | 
| 440 | 440 | </article> | 
| 441 | 441 | </div> | 
| @@ -454,36 +454,36 @@ discard block | ||
| 454 | 454 | * @return void | 
| 455 | 455 | */ | 
| 456 | 456 |  function lsx_health_plan_day_plan_block( $args = array() ) { | 
| 457 | - $defaults = array( | |
| 458 | - 'plan' => '', | |
| 459 | - ); | |
| 460 | - $args = wp_parse_args( $args, $defaults ); | |
| 461 | - | |
| 462 | -	if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { | |
| 463 | - $sections = \lsx_health_plan\functions\plan\get_sections(); | |
| 464 | - ?> | |
| 457 | + $defaults = array( | |
| 458 | + 'plan' => '', | |
| 459 | + ); | |
| 460 | + $args = wp_parse_args( $args, $defaults ); | |
| 461 | + | |
| 462 | +     if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { | |
| 463 | + $sections = \lsx_health_plan\functions\plan\get_sections(); | |
| 464 | + ?> | |
| 465 | 465 | <div class="daily-plan-block day-grid"> | 
| 466 | 466 | <?php | 
| 467 | -			foreach ( $sections as $section_key => $section_values ) { | |
| 468 | - $defaults = array( | |
| 469 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), | |
| 470 | - ); | |
| 471 | - $section_args = wp_parse_args( $section_values, $defaults ); | |
| 472 | - | |
| 473 | - $completed_class = ''; | |
| 474 | -				if ( lsx_health_plan_is_day_complete() ) { | |
| 475 | - $completed_class = 'completed'; | |
| 476 | - } | |
| 477 | - ?> | |
| 467 | +               foreach ( $sections as $section_key => $section_values ) { | |
| 468 | + $defaults = array( | |
| 469 | + 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), | |
| 470 | + ); | |
| 471 | + $section_args = wp_parse_args( $section_values, $defaults ); | |
| 472 | + | |
| 473 | + $completed_class = ''; | |
| 474 | +                    if ( lsx_health_plan_is_day_complete() ) { | |
| 475 | + $completed_class = 'completed'; | |
| 476 | + } | |
| 477 | + ?> | |
| 478 | 478 | <a href="<?php echo esc_attr( \lsx_health_plan\functions\plan\get_permalink( $args['plan'], $section_args['title'] ) ); ?>" class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> | 
| 479 | 479 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> | 
| 480 | 480 | </a> | 
| 481 | 481 | <?php | 
| 482 | - } | |
| 483 | - ?> | |
| 482 | + } | |
| 483 | + ?> | |
| 484 | 484 | </div> | 
| 485 | 485 | <?php | 
| 486 | - } | |
| 486 | + } | |
| 487 | 487 | } | 
| 488 | 488 | |
| 489 | 489 | /** | 
| @@ -493,44 +493,44 @@ discard block | ||
| 493 | 493 | * @return void | 
| 494 | 494 | */ | 
| 495 | 495 |  function lsx_health_plan_week_plan_block( $args = array() ) { | 
| 496 | - $defaults = array( | |
| 497 | - 'show_downloads' => false, | |
| 498 | - 'plan' => '', | |
| 499 | - ); | |
| 500 | - $args = wp_parse_args( $args, $defaults ); | |
| 501 | - | |
| 502 | -	if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { | |
| 503 | - $groups = \lsx_health_plan\functions\plan\get_sections( true ); | |
| 504 | - | |
| 505 | -		if ( ! empty( $groups ) ) { | |
| 506 | - $counter = 1; | |
| 507 | - $group_open = false; | |
| 508 | - | |
| 509 | -			foreach ( $groups as $group_key => $sections ) { | |
| 510 | - $collapse_class = ''; | |
| 511 | - $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); | |
| 512 | - | |
| 513 | - // Determine if the current week is complete. | |
| 514 | - $day_ids = wp_list_pluck( $sections, 'title' ); | |
| 515 | -				if ( false === $group_open ) { | |
| 516 | -					if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { | |
| 517 | - $collapse_class = 'in'; | |
| 518 | - $group_open = true; | |
| 519 | -					} elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { | |
| 520 | - $collapse_class = 'in'; | |
| 521 | - $group_open = true; | |
| 522 | - } | |
| 523 | - } | |
| 524 | - | |
| 525 | - // Determine if there are any weekly downloads. | |
| 526 | - $week_downloads_view = ''; | |
| 527 | -				if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { | |
| 528 | - $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); | |
| 529 | -					if ( ! empty( $weekly_downloads ) ) { | |
| 530 | - $week_downloads_view = 'week-downloads-view-on'; | |
| 531 | - } | |
| 532 | - } | |
| 533 | - ?> | |
| 496 | + $defaults = array( | |
| 497 | + 'show_downloads' => false, | |
| 498 | + 'plan' => '', | |
| 499 | + ); | |
| 500 | + $args = wp_parse_args( $args, $defaults ); | |
| 501 | + | |
| 502 | +     if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { | |
| 503 | + $groups = \lsx_health_plan\functions\plan\get_sections( true ); | |
| 504 | + | |
| 505 | +          if ( ! empty( $groups ) ) { | |
| 506 | + $counter = 1; | |
| 507 | + $group_open = false; | |
| 508 | + | |
| 509 | +               foreach ( $groups as $group_key => $sections ) { | |
| 510 | + $collapse_class = ''; | |
| 511 | + $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); | |
| 512 | + | |
| 513 | + // Determine if the current week is complete. | |
| 514 | + $day_ids = wp_list_pluck( $sections, 'title' ); | |
| 515 | +                    if ( false === $group_open ) { | |
| 516 | +                         if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { | |
| 517 | + $collapse_class = 'in'; | |
| 518 | + $group_open = true; | |
| 519 | +                         } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { | |
| 520 | + $collapse_class = 'in'; | |
| 521 | + $group_open = true; | |
| 522 | + } | |
| 523 | + } | |
| 524 | + | |
| 525 | + // Determine if there are any weekly downloads. | |
| 526 | + $week_downloads_view = ''; | |
| 527 | +                    if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { | |
| 528 | + $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); | |
| 529 | +                         if ( ! empty( $weekly_downloads ) ) { | |
| 530 | + $week_downloads_view = 'week-downloads-view-on'; | |
| 531 | + } | |
| 532 | + } | |
| 533 | + ?> | |
| 534 | 534 | <div class="daily-plan-block week-grid"> | 
| 535 | 535 | <a href="#group-<?php echo esc_attr( $group_key ); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr( $group_title ); ?></a> | 
| 536 | 536 | <div id="group-<?php echo esc_attr( $group_key ); ?>" class="week-row collapse <?php echo esc_attr( $collapse_class ); ?>"> | 
| @@ -544,46 +544,46 @@ discard block | ||
| 544 | 544 | <div class="week-meals-recipes-box-inner"> | 
| 545 | 545 | <?php | 
| 546 | 546 | |
| 547 | -								foreach ( $sections as $section_key => $section_values ) { | |
| 547 | +                                        foreach ( $sections as $section_key => $section_values ) { | |
| 548 | 548 | |
| 549 | - $defaults = array( | |
| 550 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), | |
| 551 | - ); | |
| 552 | - $section_args = wp_parse_args( $section_values, $defaults ); | |
| 549 | + $defaults = array( | |
| 550 | + 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), | |
| 551 | + ); | |
| 552 | + $section_args = wp_parse_args( $section_values, $defaults ); | |
| 553 | 553 | |
| 554 | - $completed_class = ''; | |
| 555 | -									if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { | |
| 556 | - $completed_class = 'completed'; | |
| 557 | - } | |
| 558 | -									if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { | |
| 559 | - ?> | |
| 554 | + $completed_class = ''; | |
| 555 | +                                             if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { | |
| 556 | + $completed_class = 'completed'; | |
| 557 | + } | |
| 558 | +                                             if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { | |
| 559 | + ?> | |
| 560 | 560 | <span class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> | 
| 561 | 561 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> | 
| 562 | 562 | </span> | 
| 563 | 563 | <?php | 
| 564 | -									} else { | |
| 565 | - ?> | |
| 564 | +                                             } else { | |
| 565 | + ?> | |
| 566 | 566 | <a href="<?php echo esc_attr( \lsx_health_plan\functions\plan\get_permalink( $args['plan'], $section_args['title'] ) ); ?>" class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> | 
| 567 | 567 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> | 
| 568 | 568 | </a> | 
| 569 | 569 | <?php | 
| 570 | - } | |
| 571 | - } | |
| 572 | - ?> | |
| 570 | + } | |
| 571 | + } | |
| 572 | + ?> | |
| 573 | 573 | </div> | 
| 574 | 574 | </div> | 
| 575 | 575 | <?php | 
| 576 | -							if ( ! empty( $week_downloads_view ) ) { | |
| 577 | - lsx_health_plan_weekly_downloads( $weekly_downloads ); | |
| 578 | - } | |
| 579 | - ?> | |
| 576 | +                                   if ( ! empty( $week_downloads_view ) ) { | |
| 577 | + lsx_health_plan_weekly_downloads( $weekly_downloads ); | |
| 578 | + } | |
| 579 | + ?> | |
| 580 | 580 | </div> | 
| 581 | 581 | </div> | 
| 582 | 582 | </div> | 
| 583 | 583 | <?php | 
| 584 | - } | |
| 585 | - } | |
| 586 | - } | |
| 584 | + } | |
| 585 | + } | |
| 586 | + } | |
| 587 | 587 | } | 
| 588 | 588 | |
| 589 | 589 | /** | 
| @@ -593,22 +593,22 @@ discard block | ||
| 593 | 593 | * @return void | 
| 594 | 594 | */ | 
| 595 | 595 |  function lsx_health_plan_weekly_downloads( $weekly_downloads = array() ) { | 
| 596 | -	if ( ! empty( $weekly_downloads ) ) { | |
| 597 | - ?> | |
| 596 | +     if ( ! empty( $weekly_downloads ) ) { | |
| 597 | + ?> | |
| 598 | 598 | <div class="week-download-box"> | 
| 599 | 599 | <h3 class="title"><?php lsx_get_svg_icon( 'download.svg' ); ?><?php echo esc_html_e( 'Downloads', 'lsx-health-plan' ); ?></h3> | 
| 600 | 600 | <ul class="week-download-box-list"> | 
| 601 | 601 | <?php | 
| 602 | -				foreach ( $weekly_downloads as $weekly_download ) { | |
| 603 | - ?> | |
| 602 | +                    foreach ( $weekly_downloads as $weekly_download ) { | |
| 603 | + ?> | |
| 604 | 604 | <li><?php echo wp_kses_post( do_shortcode( '[download id="' . $weekly_download . '"]' ) ); ?></li> | 
| 605 | 605 | <?php | 
| 606 | - } | |
| 607 | - ?> | |
| 606 | + } | |
| 607 | + ?> | |
| 608 | 608 | </ul> | 
| 609 | 609 | </div> | 
| 610 | 610 | <?php | 
| 611 | - } | |
| 611 | + } | |
| 612 | 612 | } | 
| 613 | 613 | |
| 614 | 614 | /** | 
| @@ -617,9 +617,9 @@ discard block | ||
| 617 | 617 | * @return void | 
| 618 | 618 | */ | 
| 619 | 619 |  function lsx_health_plan_items( $args = array() ) { | 
| 620 | - global $shortcode_args; | |
| 621 | - $shortcode_args = $args; | |
| 622 | - include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; | |
| 620 | + global $shortcode_args; | |
| 621 | + $shortcode_args = $args; | |
| 622 | + include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; | |
| 623 | 623 | } | 
| 624 | 624 | |
| 625 | 625 | /** | 
| @@ -628,10 +628,10 @@ discard block | ||
| 628 | 628 | * @return void | 
| 629 | 629 | */ | 
| 630 | 630 |  function lsx_health_plan_featured_video_block() { | 
| 631 | -	if ( ! post_type_exists( 'video' ) ) { | |
| 632 | - return; | |
| 633 | - } | |
| 634 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; | |
| 631 | +     if ( ! post_type_exists( 'video' ) ) { | |
| 632 | + return; | |
| 633 | + } | |
| 634 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; | |
| 635 | 635 | } | 
| 636 | 636 | |
| 637 | 637 | /** | 
| @@ -640,10 +640,10 @@ discard block | ||
| 640 | 640 | * @return void | 
| 641 | 641 | */ | 
| 642 | 642 |  function lsx_health_plan_featured_recipes_block() { | 
| 643 | -	if ( ! post_type_exists( 'recipe' ) ) { | |
| 644 | - return; | |
| 645 | - } | |
| 646 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; | |
| 643 | +     if ( ! post_type_exists( 'recipe' ) ) { | |
| 644 | + return; | |
| 645 | + } | |
| 646 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; | |
| 647 | 647 | } | 
| 648 | 648 | |
| 649 | 649 | /** | 
| @@ -652,7 +652,7 @@ discard block | ||
| 652 | 652 | * @return void | 
| 653 | 653 | */ | 
| 654 | 654 |  function lsx_health_plan_featured_tips_block() { | 
| 655 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-tips.php'; | |
| 655 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-tips.php'; | |
| 656 | 656 | } | 
| 657 | 657 | |
| 658 | 658 | /** | 
| @@ -662,11 +662,11 @@ discard block | ||
| 662 | 662 | * @return void | 
| 663 | 663 | */ | 
| 664 | 664 |  function lsx_health_plan_day_button() { | 
| 665 | -	if ( lsx_health_plan_is_day_complete() ) { | |
| 666 | - lsx_health_plan_unlock_button(); | |
| 667 | -	} else { | |
| 668 | - lsx_health_plan_complete_button(); | |
| 669 | - } | |
| 665 | +     if ( lsx_health_plan_is_day_complete() ) { | |
| 666 | + lsx_health_plan_unlock_button(); | |
| 667 | +     } else { | |
| 668 | + lsx_health_plan_complete_button(); | |
| 669 | + } | |
| 670 | 670 | } | 
| 671 | 671 | |
| 672 | 672 | /** | 
| @@ -675,7 +675,7 @@ discard block | ||
| 675 | 675 | * @return void | 
| 676 | 676 | */ | 
| 677 | 677 |  function lsx_health_plan_complete_button() { | 
| 678 | - ?> | |
| 678 | + ?> | |
| 679 | 679 | <div class="single-plan-inner-buttons"> | 
| 680 | 680 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> | 
| 681 | 681 | <?php wp_nonce_field( 'complete', 'lsx-health-plan-actions' ); ?> | 
| @@ -693,7 +693,7 @@ discard block | ||
| 693 | 693 | * @return void | 
| 694 | 694 | */ | 
| 695 | 695 |  function lsx_health_plan_unlock_button() { | 
| 696 | - ?> | |
| 696 | + ?> | |
| 697 | 697 | <div class="single-plan-inner-buttons"> | 
| 698 | 698 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> | 
| 699 | 699 | <?php wp_nonce_field( 'unlock', 'lsx-health-plan-actions' ); ?> | 
| @@ -712,10 +712,10 @@ discard block | ||
| 712 | 712 | * @return void | 
| 713 | 713 | */ | 
| 714 | 714 |  function lsx_health_plan_single_nav() { | 
| 715 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); | |
| 716 | -	if ( '' !== $tab_template_path ) { | |
| 717 | - require $tab_template_path; | |
| 718 | - } | |
| 715 | + $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); | |
| 716 | +     if ( '' !== $tab_template_path ) { | |
| 717 | + require $tab_template_path; | |
| 718 | + } | |
| 719 | 719 | } | 
| 720 | 720 | |
| 721 | 721 | /** | 
| @@ -725,32 +725,32 @@ discard block | ||
| 725 | 725 | * @return void | 
| 726 | 726 | */ | 
| 727 | 727 |  function lsx_health_plan_single_tabs() { | 
| 728 | - $endpoint = get_query_var( 'endpoint' ); | |
| 729 | -	switch ( $endpoint ) { | |
| 730 | - case 'meal': | |
| 731 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; | |
| 732 | - break; | |
| 733 | - | |
| 734 | - case 'recipes': | |
| 735 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-recipes.php'; | |
| 736 | - break; | |
| 737 | - | |
| 738 | - case 'workout': | |
| 739 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-workout.php'; | |
| 740 | - break; | |
| 741 | - | |
| 742 | - case 'warm-up': | |
| 743 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-warm-up.php'; | |
| 744 | - break; | |
| 745 | - | |
| 746 | - default: | |
| 747 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; | |
| 748 | - break; | |
| 749 | - } | |
| 750 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); | |
| 751 | -	if ( '' !== $tab_template_path ) { | |
| 752 | - include $tab_template_path; | |
| 753 | - } | |
| 728 | + $endpoint = get_query_var( 'endpoint' ); | |
| 729 | +     switch ( $endpoint ) { | |
| 730 | + case 'meal': | |
| 731 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; | |
| 732 | + break; | |
| 733 | + | |
| 734 | + case 'recipes': | |
| 735 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-recipes.php'; | |
| 736 | + break; | |
| 737 | + | |
| 738 | + case 'workout': | |
| 739 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-workout.php'; | |
| 740 | + break; | |
| 741 | + | |
| 742 | + case 'warm-up': | |
| 743 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-warm-up.php'; | |
| 744 | + break; | |
| 745 | + | |
| 746 | + default: | |
| 747 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; | |
| 748 | + break; | |
| 749 | + } | |
| 750 | + $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); | |
| 751 | +     if ( '' !== $tab_template_path ) { | |
| 752 | + include $tab_template_path; | |
| 753 | + } | |
| 754 | 754 | } | 
| 755 | 755 | |
| 756 | 756 | /** | 
| @@ -759,7 +759,7 @@ discard block | ||
| 759 | 759 | * @return void | 
| 760 | 760 | */ | 
| 761 | 761 |  function lsx_health_plan_recipe_data() { | 
| 762 | - include LSX_HEALTH_PLAN_PATH . '/templates/table-recipe-data.php'; | |
| 762 | + include LSX_HEALTH_PLAN_PATH . '/templates/table-recipe-data.php'; | |
| 763 | 763 | } | 
| 764 | 764 | |
| 765 | 765 | /** | 
| @@ -768,11 +768,11 @@ discard block | ||
| 768 | 768 | * @return recipe_type | 
| 769 | 769 | */ | 
| 770 | 770 |  function lsx_health_plan_recipe_type() { | 
| 771 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); | |
| 772 | - $recipe_type = $term_obj_list[0]->name; | |
| 773 | -	if ( ! empty( $recipe_type ) ) { | |
| 774 | - return $recipe_type; | |
| 775 | - } | |
| 771 | + $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); | |
| 772 | + $recipe_type = $term_obj_list[0]->name; | |
| 773 | +     if ( ! empty( $recipe_type ) ) { | |
| 774 | + return $recipe_type; | |
| 775 | + } | |
| 776 | 776 | } | 
| 777 | 777 | |
| 778 | 778 | /** | 
| @@ -783,35 +783,35 @@ discard block | ||
| 783 | 783 | * @return void | 
| 784 | 784 | */ | 
| 785 | 785 |  function lsx_health_plan_workout_video_play_button( $m, $group, $echo = true ) { | 
| 786 | - $workout_video = ''; | |
| 787 | - $giphy = ''; | |
| 788 | - $youtube = ''; | |
| 789 | -	if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { | |
| 790 | - $workout_video = esc_html( $group['connected_videos'] ); | |
| 791 | - $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); | |
| 792 | - $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); | |
| 793 | - $content = get_post_field( 'post_content', $workout_video ); | |
| 794 | - $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; | |
| 795 | - | |
| 796 | - $modal_body = ''; | |
| 797 | -		if ( ! empty( $giphy ) ) { | |
| 798 | - $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); | |
| 799 | - $modal_body = $giphy; // WPCS: XSS OK. | |
| 800 | -		} elseif ( ! empty( $youtube ) ) { | |
| 801 | - $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. | |
| 802 | - 'width' => 480, | |
| 803 | - ) ); | |
| 804 | - } | |
| 805 | - $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; | |
| 806 | - $modal_body .= $content; | |
| 807 | - \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); | |
| 808 | - | |
| 809 | -		if ( true === $echo ) { | |
| 810 | - echo wp_kses_post( $play_button ); | |
| 811 | -		} else { | |
| 812 | - return $play_button; | |
| 813 | - } | |
| 814 | - } | |
| 786 | + $workout_video = ''; | |
| 787 | + $giphy = ''; | |
| 788 | + $youtube = ''; | |
| 789 | +     if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { | |
| 790 | + $workout_video = esc_html( $group['connected_videos'] ); | |
| 791 | + $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); | |
| 792 | + $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); | |
| 793 | + $content = get_post_field( 'post_content', $workout_video ); | |
| 794 | + $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; | |
| 795 | + | |
| 796 | + $modal_body = ''; | |
| 797 | +          if ( ! empty( $giphy ) ) { | |
| 798 | + $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); | |
| 799 | + $modal_body = $giphy; // WPCS: XSS OK. | |
| 800 | +          } elseif ( ! empty( $youtube ) ) { | |
| 801 | + $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. | |
| 802 | + 'width' => 480, | |
| 803 | + ) ); | |
| 804 | + } | |
| 805 | + $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; | |
| 806 | + $modal_body .= $content; | |
| 807 | + \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); | |
| 808 | + | |
| 809 | +          if ( true === $echo ) { | |
| 810 | + echo wp_kses_post( $play_button ); | |
| 811 | +          } else { | |
| 812 | + return $play_button; | |
| 813 | + } | |
| 814 | + } | |
| 815 | 815 | } | 
| 816 | 816 | |
| 817 | 817 | /** | 
| @@ -820,21 +820,21 @@ discard block | ||
| 820 | 820 | * @return void | 
| 821 | 821 | */ | 
| 822 | 822 |  function lsx_health_plan_recipe_archive_description() { | 
| 823 | - $description = ''; | |
| 824 | -	if ( is_post_type_archive( 'recipe' ) ) { | |
| 825 | - $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); | |
| 826 | -	} elseif ( is_post_type_archive( 'exercise' ) ) { | |
| 827 | - $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); | |
| 828 | -	} elseif ( is_tax() ) { | |
| 829 | - $description = get_the_archive_description(); | |
| 830 | - } | |
| 831 | -	if ( '' !== $description ) { | |
| 832 | - ?> | |
| 823 | + $description = ''; | |
| 824 | +     if ( is_post_type_archive( 'recipe' ) ) { | |
| 825 | + $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); | |
| 826 | +     } elseif ( is_post_type_archive( 'exercise' ) ) { | |
| 827 | + $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); | |
| 828 | +     } elseif ( is_tax() ) { | |
| 829 | + $description = get_the_archive_description(); | |
| 830 | + } | |
| 831 | +     if ( '' !== $description ) { | |
| 832 | + ?> | |
| 833 | 833 | <div class="lsx-hp-archive-description row"> | 
| 834 | 834 | <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> | 
| 835 | 835 | </div> | 
| 836 | 836 | <?php | 
| 837 | - } | |
| 837 | + } | |
| 838 | 838 | } | 
| 839 | 839 | |
| 840 | 840 | /** | 
| @@ -843,23 +843,23 @@ discard block | ||
| 843 | 843 | * @return void | 
| 844 | 844 | */ | 
| 845 | 845 |  function lsx_health_plan_workout_main_content() { | 
| 846 | - // Getting translated endpoint. | |
| 847 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); | |
| 848 | - | |
| 849 | - $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); | |
| 850 | - $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); | |
| 851 | - | |
| 852 | - $content = ''; | |
| 853 | -	if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { | |
| 854 | - $content .= '<div class="short-desc set-box set content-box entry-content">'; | |
| 855 | - $content .= '<div class="the-content">'; | |
| 856 | - $content .= lsx_hp_member_connected( $connected_members, $workout ); | |
| 857 | - $content .= '<span>' . $small_description . '</span>'; | |
| 858 | - $content .= '</div>'; | |
| 859 | - $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); | |
| 860 | - $content .= '</div>'; | |
| 861 | - } | |
| 862 | - return $content; | |
| 846 | + // Getting translated endpoint. | |
| 847 | + $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); | |
| 848 | + | |
| 849 | + $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); | |
| 850 | + $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); | |
| 851 | + | |
| 852 | + $content = ''; | |
| 853 | +     if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { | |
| 854 | + $content .= '<div class="short-desc set-box set content-box entry-content">'; | |
| 855 | + $content .= '<div class="the-content">'; | |
| 856 | + $content .= lsx_hp_member_connected( $connected_members, $workout ); | |
| 857 | + $content .= '<span>' . $small_description . '</span>'; | |
| 858 | + $content .= '</div>'; | |
| 859 | + $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); | |
| 860 | + $content .= '</div>'; | |
| 861 | + } | |
| 862 | + return $content; | |
| 863 | 863 | } | 
| 864 | 864 | |
| 865 | 865 | /** | 
| @@ -868,23 +868,23 @@ discard block | ||
| 868 | 868 | * @return void | 
| 869 | 869 | */ | 
| 870 | 870 |  function lsx_health_plan_meal_main_content() { | 
| 871 | - // Getting translated endpoint. | |
| 872 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); | |
| 873 | - | |
| 874 | - $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); | |
| 875 | - $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); | |
| 876 | - | |
| 877 | - $content_meal = ''; | |
| 878 | -	if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { | |
| 879 | - $content_meal .= '<div class="set-box set content-box entry-content">'; | |
| 880 | - $content_meal .= '<div class="the-content">'; | |
| 881 | - $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); | |
| 882 | - $content_meal .= '<span>' . $small_description . '</span>'; | |
| 883 | - $content_meal .= '</div>'; | |
| 884 | - $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); | |
| 885 | - $content_meal .= '</div>'; | |
| 886 | - } | |
| 887 | - return $content_meal; | |
| 871 | + // Getting translated endpoint. | |
| 872 | + $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); | |
| 873 | + | |
| 874 | + $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); | |
| 875 | + $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); | |
| 876 | + | |
| 877 | + $content_meal = ''; | |
| 878 | +     if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { | |
| 879 | + $content_meal .= '<div class="set-box set content-box entry-content">'; | |
| 880 | + $content_meal .= '<div class="the-content">'; | |
| 881 | + $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); | |
| 882 | + $content_meal .= '<span>' . $small_description . '</span>'; | |
| 883 | + $content_meal .= '</div>'; | |
| 884 | + $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); | |
| 885 | + $content_meal .= '</div>'; | |
| 886 | + } | |
| 887 | + return $content_meal; | |
| 888 | 888 | } | 
| 889 | 889 | |
| 890 | 890 | |
| @@ -895,36 +895,36 @@ discard block | ||
| 895 | 895 | * @return void | 
| 896 | 896 | */ | 
| 897 | 897 |  function lsx_health_plan_workout_tab_content( $index = 1 ) { | 
| 898 | - global $group_name,$shortcode_args; | |
| 899 | - $group_name = 'workout_section_' . $index; | |
| 900 | -	if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { | |
| 901 | - $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); | |
| 902 | - | |
| 903 | - // Check for shortcode overrides. | |
| 904 | -		if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { | |
| 905 | - $layout = $shortcode_args['layout']; | |
| 906 | - } | |
| 907 | -	} else { | |
| 908 | - $layout = 'table'; | |
| 909 | - } | |
| 910 | - | |
| 911 | -	switch ( $layout ) { | |
| 912 | - case 'list': | |
| 913 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; | |
| 914 | - break; | |
| 915 | - | |
| 916 | - case 'grid': | |
| 917 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-grid.php'; | |
| 918 | - break; | |
| 919 | - | |
| 920 | - case 'table': | |
| 921 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; | |
| 922 | - break; | |
| 923 | - } | |
| 924 | - $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); | |
| 925 | -	if ( '' !== $tab_template_path ) { | |
| 926 | - include $tab_template_path; | |
| 927 | - } | |
| 898 | + global $group_name,$shortcode_args; | |
| 899 | + $group_name = 'workout_section_' . $index; | |
| 900 | +     if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { | |
| 901 | + $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); | |
| 902 | + | |
| 903 | + // Check for shortcode overrides. | |
| 904 | +          if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { | |
| 905 | + $layout = $shortcode_args['layout']; | |
| 906 | + } | |
| 907 | +     } else { | |
| 908 | + $layout = 'table'; | |
| 909 | + } | |
| 910 | + | |
| 911 | +     switch ( $layout ) { | |
| 912 | + case 'list': | |
| 913 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; | |
| 914 | + break; | |
| 915 | + | |
| 916 | + case 'grid': | |
| 917 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-grid.php'; | |
| 918 | + break; | |
| 919 | + | |
| 920 | + case 'table': | |
| 921 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; | |
| 922 | + break; | |
| 923 | + } | |
| 924 | + $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); | |
| 925 | +     if ( '' !== $tab_template_path ) { | |
| 926 | + include $tab_template_path; | |
| 927 | + } | |
| 928 | 928 | } | 
| 929 | 929 | |
| 930 | 930 | /** | 
| @@ -933,28 +933,28 @@ discard block | ||
| 933 | 933 | * @return void | 
| 934 | 934 | */ | 
| 935 | 935 |  function lsx_health_plan_workout_sets() { | 
| 936 | -	if ( is_singular( 'workout' ) ) { | |
| 937 | - global $connected_workouts; | |
| 938 | - $connected_workouts = array( get_the_ID() ); | |
| 939 | - } | |
| 940 | -	if ( is_singular( 'plan' ) ) { | |
| 941 | - | |
| 942 | - global $connected_workouts; | |
| 943 | - | |
| 944 | - $section_key = get_query_var( 'section' ); | |
| 945 | -		if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { | |
| 946 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); | |
| 947 | -			if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { | |
| 948 | - | |
| 949 | - $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); | |
| 950 | - } | |
| 951 | - } | |
| 952 | - } | |
| 953 | - $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; | |
| 954 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); | |
| 955 | -	if ( '' !== $template_path && ! empty( $template_path ) ) { | |
| 956 | - include $template_path; | |
| 957 | - } | |
| 936 | +     if ( is_singular( 'workout' ) ) { | |
| 937 | + global $connected_workouts; | |
| 938 | + $connected_workouts = array( get_the_ID() ); | |
| 939 | + } | |
| 940 | +     if ( is_singular( 'plan' ) ) { | |
| 941 | + | |
| 942 | + global $connected_workouts; | |
| 943 | + | |
| 944 | + $section_key = get_query_var( 'section' ); | |
| 945 | +          if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { | |
| 946 | + $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); | |
| 947 | +               if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { | |
| 948 | + | |
| 949 | + $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); | |
| 950 | + } | |
| 951 | + } | |
| 952 | + } | |
| 953 | + $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; | |
| 954 | + $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); | |
| 955 | +     if ( '' !== $template_path && ! empty( $template_path ) ) { | |
| 956 | + include $template_path; | |
| 957 | + } | |
| 958 | 958 | } | 
| 959 | 959 | |
| 960 | 960 | /** | 
| @@ -965,11 +965,11 @@ discard block | ||
| 965 | 965 | */ | 
| 966 | 966 |  function lsx_health_plan_warmup_sets( $connected_workouts ) { | 
| 967 | 967 | |
| 968 | - $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; | |
| 969 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); | |
| 970 | -	if ( '' !== $template_path && ! empty( $template_path ) ) { | |
| 971 | - include $template_path; | |
| 972 | - } | |
| 968 | + $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; | |
| 969 | + $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); | |
| 970 | +     if ( '' !== $template_path && ! empty( $template_path ) ) { | |
| 971 | + include $template_path; | |
| 972 | + } | |
| 973 | 973 | } | 
| 974 | 974 | |
| 975 | 975 | /** | 
| @@ -979,48 +979,48 @@ discard block | ||
| 979 | 979 | * @return void | 
| 980 | 980 | */ | 
| 981 | 981 |  function lsx_hp_meal_plan_recipes( $args = array() ) { | 
| 982 | - $defaults = array( | |
| 983 | - 'meal_id' => false, | |
| 984 | - 'meal_time' => '', | |
| 985 | - 'modal' => true, | |
| 986 | - ); | |
| 987 | - $args = wp_parse_args( $args, $defaults ); | |
| 988 | - // Looking for recipes. | |
| 989 | - $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); | |
| 990 | -	if ( ! empty( $connected_recipes ) ) { | |
| 991 | - $query_args = array( | |
| 992 | - 'orderby' => 'date', | |
| 993 | - 'order' => 'DESC', | |
| 994 | - 'post_type' => 'recipe', | |
| 995 | - 'post__in' => $connected_recipes, | |
| 996 | - ); | |
| 997 | - $recipes = new WP_Query( $query_args ); | |
| 998 | - ?> | |
| 982 | + $defaults = array( | |
| 983 | + 'meal_id' => false, | |
| 984 | + 'meal_time' => '', | |
| 985 | + 'modal' => true, | |
| 986 | + ); | |
| 987 | + $args = wp_parse_args( $args, $defaults ); | |
| 988 | + // Looking for recipes. | |
| 989 | + $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); | |
| 990 | +     if ( ! empty( $connected_recipes ) ) { | |
| 991 | + $query_args = array( | |
| 992 | + 'orderby' => 'date', | |
| 993 | + 'order' => 'DESC', | |
| 994 | + 'post_type' => 'recipe', | |
| 995 | + 'post__in' => $connected_recipes, | |
| 996 | + ); | |
| 997 | + $recipes = new WP_Query( $query_args ); | |
| 998 | + ?> | |
| 999 | 999 | <div class="recipes"> | 
| 1000 | 1000 | <div class="row eating-row"> | 
| 1001 | 1001 | <?php | 
| 1002 | -			if ( $recipes->have_posts() ) { | |
| 1003 | -				while ( $recipes->have_posts() ) { | |
| 1004 | - $recipes->the_post(); | |
| 1005 | -					if ( false !== $args['modal'] ) { | |
| 1006 | - \lsx_health_plan\functions\recipes\register_recipe_modal(); | |
| 1007 | - } | |
| 1008 | - ?> | |
| 1002 | +               if ( $recipes->have_posts() ) { | |
| 1003 | +                    while ( $recipes->have_posts() ) { | |
| 1004 | + $recipes->the_post(); | |
| 1005 | +                         if ( false !== $args['modal'] ) { | |
| 1006 | + \lsx_health_plan\functions\recipes\register_recipe_modal(); | |
| 1007 | + } | |
| 1008 | + ?> | |
| 1009 | 1009 | <div class="recipe-column"> | 
| 1010 | 1010 | <a data-toggle="modal" data-target="#recipe-modal-<?php echo esc_attr( get_the_ID() ); ?>" href="#recipe-modal-<?php echo esc_attr( get_the_ID() ); ?>" class="recipe-box box-shadow"> | 
| 1011 | 1011 | <div class="recipe-feature-img"> | 
| 1012 | 1012 | <?php | 
| 1013 | - $featured_image = get_the_post_thumbnail(); | |
| 1014 | -								if ( ! empty( $featured_image ) && '' !== $featured_image ) { | |
| 1015 | - the_post_thumbnail( 'lsx-thumbnail-square', array( | |
| 1016 | - 'class' => 'aligncenter', | |
| 1017 | - ) ); | |
| 1018 | -								} else { | |
| 1019 | - ?> | |
| 1013 | + $featured_image = get_the_post_thumbnail(); | |
| 1014 | +                                        if ( ! empty( $featured_image ) && '' !== $featured_image ) { | |
| 1015 | + the_post_thumbnail( 'lsx-thumbnail-square', array( | |
| 1016 | + 'class' => 'aligncenter', | |
| 1017 | + ) ); | |
| 1018 | +                                        } else { | |
| 1019 | + ?> | |
| 1020 | 1020 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . 'assets/images/placeholder.jpg' ); ?>"> | 
| 1021 | 1021 | <?php | 
| 1022 | - } | |
| 1023 | - ?> | |
| 1022 | + } | |
| 1023 | + ?> | |
| 1024 | 1024 | </div> | 
| 1025 | 1025 | <div class="recipe-content"> | 
| 1026 | 1026 | <h3 class="recipe-title"><?php the_title(); ?></h3> | 
| @@ -1029,41 +1029,41 @@ discard block | ||
| 1029 | 1029 | </a> | 
| 1030 | 1030 | </div> | 
| 1031 | 1031 | <?php | 
| 1032 | - } | |
| 1033 | - } | |
| 1034 | - wp_reset_postdata(); | |
| 1035 | - ?> | |
| 1032 | + } | |
| 1033 | + } | |
| 1034 | + wp_reset_postdata(); | |
| 1035 | + ?> | |
| 1036 | 1036 | </div> | 
| 1037 | 1037 | </div> | 
| 1038 | 1038 | <?php | 
| 1039 | 1039 | |
| 1040 | - } | |
| 1040 | + } | |
| 1041 | 1041 | } | 
| 1042 | 1042 | |
| 1043 | 1043 | /** | 
| 1044 | 1044 | * Output the connected. | 
| 1045 | 1045 | */ | 
| 1046 | 1046 |  function lsx_hp_recipe_plan_meta( $args = array() ) { | 
| 1047 | - $defaults = array(); | |
| 1048 | - $top_level_plans = array(); | |
| 1049 | - // Get meals this exercise is connected to. | |
| 1050 | - $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); | |
| 1051 | -	if ( ! empty( $plans ) ) { | |
| 1052 | - $plan = end( $plans ); | |
| 1053 | - $has_parent = wp_get_post_parent_id( $plan ); | |
| 1054 | -		if ( 0 === $has_parent ) { | |
| 1055 | - $top_level_plans[] = $plan; | |
| 1056 | -		} elseif ( false !== $top_level_plans ) { | |
| 1057 | - $top_level_plans[] = $has_parent; | |
| 1058 | - } | |
| 1059 | - } | |
| 1060 | -	if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { | |
| 1061 | - $top_level_plans = array_unique( $top_level_plans ); | |
| 1062 | - $top_level_plan = end( $top_level_plans ); | |
| 1063 | - ?> | |
| 1047 | + $defaults = array(); | |
| 1048 | + $top_level_plans = array(); | |
| 1049 | + // Get meals this exercise is connected to. | |
| 1050 | + $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); | |
| 1051 | +     if ( ! empty( $plans ) ) { | |
| 1052 | + $plan = end( $plans ); | |
| 1053 | + $has_parent = wp_get_post_parent_id( $plan ); | |
| 1054 | +          if ( 0 === $has_parent ) { | |
| 1055 | + $top_level_plans[] = $plan; | |
| 1056 | +          } elseif ( false !== $top_level_plans ) { | |
| 1057 | + $top_level_plans[] = $has_parent; | |
| 1058 | + } | |
| 1059 | + } | |
| 1060 | +     if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { | |
| 1061 | + $top_level_plans = array_unique( $top_level_plans ); | |
| 1062 | + $top_level_plan = end( $top_level_plans ); | |
| 1063 | + ?> | |
| 1064 | 1064 | <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> | 
| 1065 | 1065 | <?php | 
| 1066 | - } | |
| 1066 | + } | |
| 1067 | 1067 | } | 
| 1068 | 1068 | |
| 1069 | 1069 | /** | 
| @@ -1071,42 +1071,42 @@ discard block | ||
| 1071 | 1071 | */ | 
| 1072 | 1072 |  function lsx_hp_exercise_plan_meta() { | 
| 1073 | 1073 | |
| 1074 | - $top_level_plans = array(); | |
| 1075 | - | |
| 1076 | - // Get workouts this exercise is connected to. | |
| 1077 | - $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); | |
| 1078 | - | |
| 1079 | -	if ( '' !== $workouts && ! is_array( $workouts ) ) { | |
| 1080 | - $workouts = array( $workouts ); | |
| 1081 | - } | |
| 1082 | -	if ( ! empty( $workouts ) ) { | |
| 1083 | -		foreach ( $workouts as $workout ) { | |
| 1084 | - // Get the plans this workout is connected to. | |
| 1085 | - $plans = get_post_meta( $workout, 'connected_plans', true ); | |
| 1086 | - | |
| 1087 | -			if ( '' !== $plans && ! is_array( $plans ) ) { | |
| 1088 | - $plans = array( $plans ); | |
| 1089 | - } | |
| 1090 | -			if ( ! empty( $plans ) ) { | |
| 1091 | -				foreach ( $plans as $plan ) { | |
| 1092 | - $has_parent = wp_get_post_parent_id( $plan ); | |
| 1093 | -					if ( 0 === $has_parent ) { | |
| 1094 | - $top_level_plans = $plan; | |
| 1095 | -					} else { | |
| 1096 | - $top_level_plans = $has_parent; | |
| 1097 | - } | |
| 1098 | - } | |
| 1099 | - } | |
| 1100 | - } | |
| 1101 | - } | |
| 1102 | - | |
| 1103 | -	if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { | |
| 1104 | - $top_level_plans = array_unique( $top_level_plans ); | |
| 1105 | - $top_level_plan = end( $top_level_plans ); | |
| 1106 | - ?> | |
| 1074 | + $top_level_plans = array(); | |
| 1075 | + | |
| 1076 | + // Get workouts this exercise is connected to. | |
| 1077 | + $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); | |
| 1078 | + | |
| 1079 | +     if ( '' !== $workouts && ! is_array( $workouts ) ) { | |
| 1080 | + $workouts = array( $workouts ); | |
| 1081 | + } | |
| 1082 | +     if ( ! empty( $workouts ) ) { | |
| 1083 | +          foreach ( $workouts as $workout ) { | |
| 1084 | + // Get the plans this workout is connected to. | |
| 1085 | + $plans = get_post_meta( $workout, 'connected_plans', true ); | |
| 1086 | + | |
| 1087 | +               if ( '' !== $plans && ! is_array( $plans ) ) { | |
| 1088 | + $plans = array( $plans ); | |
| 1089 | + } | |
| 1090 | +               if ( ! empty( $plans ) ) { | |
| 1091 | +                    foreach ( $plans as $plan ) { | |
| 1092 | + $has_parent = wp_get_post_parent_id( $plan ); | |
| 1093 | +                         if ( 0 === $has_parent ) { | |
| 1094 | + $top_level_plans = $plan; | |
| 1095 | +                         } else { | |
| 1096 | + $top_level_plans = $has_parent; | |
| 1097 | + } | |
| 1098 | + } | |
| 1099 | + } | |
| 1100 | + } | |
| 1101 | + } | |
| 1102 | + | |
| 1103 | +     if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { | |
| 1104 | + $top_level_plans = array_unique( $top_level_plans ); | |
| 1105 | + $top_level_plan = end( $top_level_plans ); | |
| 1106 | + ?> | |
| 1107 | 1107 | <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> | 
| 1108 | 1108 | <?php | 
| 1109 | - } | |
| 1109 | + } | |
| 1110 | 1110 | } | 
| 1111 | 1111 | |
| 1112 | 1112 | /** | 
| @@ -1116,7 +1116,7 @@ discard block | ||
| 1116 | 1116 | * @return void | 
| 1117 | 1117 | */ | 
| 1118 | 1118 |  function lsx_hp_single_related( $related_content, $post_type_text ) { | 
| 1119 | - ?> | |
| 1119 | + ?> | |
| 1120 | 1120 | <section id="lsx-hp-related"> | 
| 1121 | 1121 | <div class="row lsx-related-posts lsx-related-posts-title"> | 
| 1122 | 1122 | <div class="col-xs-12"> | 
| @@ -1127,14 +1127,14 @@ discard block | ||
| 1127 | 1127 | <div class="col-xs-12"> | 
| 1128 | 1128 | <div class="lsx-related-posts-wrapper"> | 
| 1129 | 1129 | <?php | 
| 1130 | - $i = 0; | |
| 1131 | -					foreach ( $related_content as $article ) { | |
| 1132 | - $post_title = get_the_title( $article ); | |
| 1133 | - $post_categories = wp_get_post_categories( $article ); | |
| 1134 | - $post_link = get_permalink( $article ); | |
| 1135 | - | |
| 1136 | - $cats = array(); | |
| 1137 | - ?> | |
| 1130 | + $i = 0; | |
| 1131 | +                         foreach ( $related_content as $article ) { | |
| 1132 | + $post_title = get_the_title( $article ); | |
| 1133 | + $post_categories = wp_get_post_categories( $article ); | |
| 1134 | + $post_link = get_permalink( $article ); | |
| 1135 | + | |
| 1136 | + $cats = array(); | |
| 1137 | + ?> | |
| 1138 | 1138 | <article id="post-<?php echo esc_html( $article ); ?>" class="lsx-slot post"> | 
| 1139 | 1139 | <div class="entry-layout lsx-hp-shadow"> | 
| 1140 | 1140 | <div class="entry-layout-content"> | 
| @@ -1142,25 +1142,25 @@ discard block | ||
| 1142 | 1142 | <div class="entry-image"> | 
| 1143 | 1143 | <a href="<?php echo esc_url( $post_link ); ?>" class="thumbnail"> | 
| 1144 | 1144 | <?php | 
| 1145 | - $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); | |
| 1146 | -											if ( ! empty( $featured_image ) && '' !== $featured_image ) { | |
| 1147 | - echo wp_kses_post( $featured_image ); | |
| 1148 | -											} else { | |
| 1149 | - ?> | |
| 1145 | + $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); | |
| 1146 | +                                                       if ( ! empty( $featured_image ) && '' !== $featured_image ) { | |
| 1147 | + echo wp_kses_post( $featured_image ); | |
| 1148 | +                                                       } else { | |
| 1149 | + ?> | |
| 1150 | 1150 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> | 
| 1151 | 1151 | <?php | 
| 1152 | - } | |
| 1153 | - ?> | |
| 1152 | + } | |
| 1153 | + ?> | |
| 1154 | 1154 | </a> | 
| 1155 | 1155 | </div> | 
| 1156 | 1156 | <div class="entry-meta"> | 
| 1157 | 1157 | <?php | 
| 1158 | -										foreach ( $post_categories as $c ) { | |
| 1159 | - $cat = get_category( $c ); | |
| 1160 | - /* Translators: %s: category name */ | |
| 1161 | - $cats[] = '<a href="' . esc_url( get_category_link( $cat->term_id ) ) . '" title="' . sprintf( esc_html__( 'Posts in %s', 'lsx-blog-customizer' ), $cat->name ) . '">' . $cat->name . '</a>'; | |
| 1162 | - } | |
| 1163 | -										if ( ! empty( $cats ) ) { ?> | |
| 1158 | +                                                  foreach ( $post_categories as $c ) { | |
| 1159 | + $cat = get_category( $c ); | |
| 1160 | + /* Translators: %s: category name */ | |
| 1161 | + $cats[] = '<a href="' . esc_url( get_category_link( $cat->term_id ) ) . '" title="' . sprintf( esc_html__( 'Posts in %s', 'lsx-blog-customizer' ), $cat->name ) . '">' . $cat->name . '</a>'; | |
| 1162 | + } | |
| 1163 | +                                                  if ( ! empty( $cats ) ) { ?> | |
| 1164 | 1164 | <div class="post-categories"><span></span><?php echo wp_kses_post( implode( ', ', $cats ) ); ?></div> | 
| 1165 | 1165 | <?php } ?> | 
| 1166 | 1166 | </div> | 
| @@ -1175,8 +1175,8 @@ discard block | ||
| 1175 | 1175 | </article> | 
| 1176 | 1176 | |
| 1177 | 1177 | <?php | 
| 1178 | - if (++$i === 3) break; | |
| 1179 | - } ?> | |
| 1178 | + if (++$i === 3) break; | |
| 1179 | + } ?> | |
| 1180 | 1180 | </div> | 
| 1181 | 1181 | </div> | 
| 1182 | 1182 | </div> | 
| @@ -1191,32 +1191,32 @@ discard block | ||
| 1191 | 1191 | * @return void | 
| 1192 | 1192 | */ | 
| 1193 | 1193 |  function lsx_hp_member_connected( $connected_members, $post_type ) { | 
| 1194 | -	if ( ! empty( $connected_members ) ) { | |
| 1195 | - $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; | |
| 1196 | -		foreach ( $connected_members as $member ) { | |
| 1197 | - $post_link = get_permalink( $member ); | |
| 1198 | - $member_name = get_the_title( $member ); | |
| 1199 | - $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; | |
| 1200 | - | |
| 1201 | - $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; | |
| 1202 | - | |
| 1203 | - $roles = ''; | |
| 1204 | - $terms = get_the_terms( $member, 'team_role' ); | |
| 1205 | - | |
| 1206 | -			if ( $terms && ! is_wp_error( $terms ) ) { | |
| 1207 | - $roles = array(); | |
| 1208 | - | |
| 1209 | -				foreach ( $terms as $term ) { | |
| 1210 | - $roles[] = $term->name; | |
| 1211 | - } | |
| 1212 | - | |
| 1213 | - $roles = join( ', ', $roles ); | |
| 1214 | - } | |
| 1215 | - $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; | |
| 1216 | - | |
| 1217 | - $content .= '<p>' . $member_roles . ': ' . $member_link . '</p>'; | |
| 1218 | - } | |
| 1219 | - $content .= '</div>'; | |
| 1220 | - return $content; | |
| 1221 | - } | |
| 1194 | +     if ( ! empty( $connected_members ) ) { | |
| 1195 | + $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; | |
| 1196 | +          foreach ( $connected_members as $member ) { | |
| 1197 | + $post_link = get_permalink( $member ); | |
| 1198 | + $member_name = get_the_title( $member ); | |
| 1199 | + $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; | |
| 1200 | + | |
| 1201 | + $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; | |
| 1202 | + | |
| 1203 | + $roles = ''; | |
| 1204 | + $terms = get_the_terms( $member, 'team_role' ); | |
| 1205 | + | |
| 1206 | +               if ( $terms && ! is_wp_error( $terms ) ) { | |
| 1207 | + $roles = array(); | |
| 1208 | + | |
| 1209 | +                    foreach ( $terms as $term ) { | |
| 1210 | + $roles[] = $term->name; | |
| 1211 | + } | |
| 1212 | + | |
| 1213 | + $roles = join( ', ', $roles ); | |
| 1214 | + } | |
| 1215 | + $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; | |
| 1216 | + | |
| 1217 | + $content .= '<p>' . $member_roles . ': ' . $member_link . '</p>'; | |
| 1218 | + } | |
| 1219 | + $content .= '</div>'; | |
| 1220 | + return $content; | |
| 1221 | + } | |
| 1222 | 1222 | } | 
| @@ -11,26 +11,26 @@ discard block | ||
| 11 | 11 | * @return void | 
| 12 | 12 | */ | 
| 13 | 13 |  function lsx_health_plan_workout_box() { | 
| 14 | -	if ( ! post_type_exists( 'workout' ) ) { | |
| 14 | +	if ( ! post_type_exists('workout')) { | |
| 15 | 15 | return; | 
| 16 | 16 | } | 
| 17 | - $intro_text = \lsx_health_plan\functions\get_option( 'workout_intro', false ); | |
| 17 | +	$intro_text = \lsx_health_plan\functions\get_option('workout_intro', false); | |
| 18 | 18 | ?> | 
| 19 | 19 | <div class="workout-instructions"> | 
| 20 | 20 | <div class="row"> | 
| 21 | 21 | <div class="col-md-12"> | 
| 22 | 22 | <?php | 
| 23 | -			if ( false !== $intro_text ) { | |
| 23 | +			if (false !== $intro_text) { | |
| 24 | 24 | ?> | 
| 25 | 25 | <div class="excerpt"> | 
| 26 | - <p><?php echo wp_kses_post( wpautop( $intro_text ) ); ?></p> | |
| 26 | + <p><?php echo wp_kses_post(wpautop($intro_text)); ?></p> | |
| 27 | 27 | </div> | 
| 28 | 28 | <?php | 
| 29 | 29 |  			} else { | 
| 30 | 30 | ?> | 
| 31 | 31 | <div class="content-intro"> | 
| 32 | - <h3><?php esc_html_e( "Don't forget your warm up!", 'lsx-health-plan' ); ?></h3> | |
| 33 | - <p><?php esc_html_e( 'Be sure to do the warm-up before every workout session.', 'lsx-health-plan' ); ?></p> | |
| 32 | +					<h3><?php esc_html_e("Don't forget your warm up!", 'lsx-health-plan'); ?></h3> | |
| 33 | +					<p><?php esc_html_e('Be sure to do the warm-up before every workout session.', 'lsx-health-plan'); ?></p> | |
| 34 | 34 | </div> | 
| 35 | 35 | <?php | 
| 36 | 36 | } ?> | 
| @@ -46,29 +46,29 @@ discard block | ||
| 46 | 46 | * @return void | 
| 47 | 47 | */ | 
| 48 | 48 |  function lsx_health_plan_meal_box() { | 
| 49 | -	if ( ! post_type_exists( 'meal' ) ) { | |
| 49 | +	if ( ! post_type_exists('meal')) { | |
| 50 | 50 | return; | 
| 51 | 51 | } | 
| 52 | 52 | ?> | 
| 53 | 53 | <div class="col-md-4" > | 
| 54 | 54 | <div class="lsx-health-plan-box"> | 
| 55 | - <h3 class="title meal-plan-title title-lined"><?php esc_html_e( 'Your Meal Plan', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'meal.svg' ); ?></h3> | |
| 55 | +			<h3 class="title meal-plan-title title-lined"><?php esc_html_e('Your Meal Plan', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('meal.svg'); ?></h3> | |
| 56 | 56 | <div class="spacer"></div> | 
| 57 | 57 | <?php | 
| 58 | - $intro_text = \lsx_health_plan\functions\get_option( 'meal_plan_intro', false ); | |
| 59 | -			if ( false !== $intro_text ) { | |
| 58 | +			$intro_text = \lsx_health_plan\functions\get_option('meal_plan_intro', false); | |
| 59 | +			if (false !== $intro_text) { | |
| 60 | 60 | ?> | 
| 61 | 61 | <div class="excerpt"> | 
| 62 | - <p><?php echo wp_kses_post( $intro_text ); ?></p> | |
| 62 | + <p><?php echo wp_kses_post($intro_text); ?></p> | |
| 63 | 63 | </div> | 
| 64 | 64 | <?php | 
| 65 | 65 | } | 
| 66 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); | |
| 67 | -			if ( false === $meal ) { | |
| 66 | +			$meal = \lsx_health_plan\functions\get_option('endpoint_meal', false); | |
| 67 | +			if (false === $meal) { | |
| 68 | 68 | $meal = 'meal'; | 
| 69 | 69 | } | 
| 70 | 70 | ?> | 
| 71 | - <a href="<?php the_permalink(); ?><?php echo esc_attr( $meal ); ?>/" class="btn"><?php esc_html_e( 'View your meal plan', 'lsx-health-plan' ); ?></a> | |
| 71 | +			<a href="<?php the_permalink(); ?><?php echo esc_attr($meal); ?>/" class="btn"><?php esc_html_e('View your meal plan', 'lsx-health-plan'); ?></a> | |
| 72 | 72 | </div> | 
| 73 | 73 | </div> | 
| 74 | 74 | <?php | 
| @@ -80,29 +80,29 @@ discard block | ||
| 80 | 80 | * @return void | 
| 81 | 81 | */ | 
| 82 | 82 |  function lsx_health_plan_recipe_box() { | 
| 83 | -	if ( ! post_type_exists( 'recipe' ) ) { | |
| 83 | +	if ( ! post_type_exists('recipe')) { | |
| 84 | 84 | return; | 
| 85 | 85 | } | 
| 86 | 86 | ?> | 
| 87 | 87 | <div class="col-md-4" > | 
| 88 | 88 | <div class="lsx-health-plan-box"> | 
| 89 | - <h3 class="title recipes-title title-lined"><?php esc_html_e( 'Recipes', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'recipes.svg' ); ?></h3> | |
| 89 | +			<h3 class="title recipes-title title-lined"><?php esc_html_e('Recipes', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('recipes.svg'); ?></h3> | |
| 90 | 90 | <div class="spacer"></div> | 
| 91 | 91 | <?php | 
| 92 | - $intro_text = \lsx_health_plan\functions\get_option( 'recipes_intro', false ); | |
| 93 | -			if ( false !== $intro_text ) { | |
| 92 | +			$intro_text = \lsx_health_plan\functions\get_option('recipes_intro', false); | |
| 93 | +			if (false !== $intro_text) { | |
| 94 | 94 | ?> | 
| 95 | 95 | <div class="excerpt"> | 
| 96 | - <p><?php echo wp_kses_post( $intro_text ); ?></p> | |
| 96 | + <p><?php echo wp_kses_post($intro_text); ?></p> | |
| 97 | 97 | </div> | 
| 98 | 98 | <?php | 
| 99 | 99 | } | 
| 100 | - $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); | |
| 101 | -			if ( false === $recipes ) { | |
| 100 | +			$recipes = \lsx_health_plan\functions\get_option('endpoint_recipe', false); | |
| 101 | +			if (false === $recipes) { | |
| 102 | 102 | $recipes = 'recipes'; | 
| 103 | 103 | } | 
| 104 | 104 | ?> | 
| 105 | - <a href="<?php the_permalink(); ?><?php echo esc_attr( $recipes ); ?>/" class="btn"><?php esc_html_e( 'View all recipes', 'lsx-health-plan' ); ?></a> | |
| 105 | +			<a href="<?php the_permalink(); ?><?php echo esc_attr($recipes); ?>/" class="btn"><?php esc_html_e('View all recipes', 'lsx-health-plan'); ?></a> | |
| 106 | 106 | </div> | 
| 107 | 107 | </div> | 
| 108 | 108 | <?php | 
| @@ -118,15 +118,15 @@ discard block | ||
| 118 | 118 | ?> | 
| 119 | 119 | <div class="col-md-4 day-download-box" > | 
| 120 | 120 | <div class="lsx-health-plan-box"> | 
| 121 | - <h3 class="title downloads-title title-lined"><?php esc_html_e( 'Downloads', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'download.svg' ); ?></h3> | |
| 121 | +			<h3 class="title downloads-title title-lined"><?php esc_html_e('Downloads', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('download.svg'); ?></h3> | |
| 122 | 122 | <div class="spacer"></div> | 
| 123 | 123 | <div class="download-list"> | 
| 124 | 124 | <ul> | 
| 125 | 125 | <?php | 
| 126 | 126 | $downloads = \lsx_health_plan\functions\get_downloads(); | 
| 127 | -					if ( ! empty( $downloads ) ) { | |
| 128 | -						foreach ( $downloads as $download ) { | |
| 129 | - echo wp_kses_post( '<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode( '[download id="' . $download . '"]' ) . '</a></li>' ); | |
| 127 | +					if ( ! empty($downloads)) { | |
| 128 | +						foreach ($downloads as $download) { | |
| 129 | +							echo wp_kses_post('<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode('[download id="' . $download . '"]') . '</a></li>'); | |
| 130 | 130 | } | 
| 131 | 131 | } | 
| 132 | 132 | ?> | 
| @@ -143,15 +143,15 @@ discard block | ||
| 143 | 143 | * @param string $tab | 
| 144 | 144 | * @return void | 
| 145 | 145 | */ | 
| 146 | -function lsx_health_plan_nav_class( $tab = '' ) { | |
| 146 | +function lsx_health_plan_nav_class($tab = '') { | |
| 147 | 147 | $nav_classes = array(); | 
| 148 | -	if ( function_exists( 'is_wc_endpoint_url' ) && 'edit-account' === $tab && is_wc_endpoint_url( 'edit-account' ) ) { | |
| 148 | +	if (function_exists('is_wc_endpoint_url') && 'edit-account' === $tab && is_wc_endpoint_url('edit-account')) { | |
| 149 | 149 | $nav_classes[] = 'active'; | 
| 150 | -	} elseif ( lsx_health_plan_is_current_tab( $tab ) ) { | |
| 150 | +	} elseif (lsx_health_plan_is_current_tab($tab)) { | |
| 151 | 151 | $nav_classes[] = 'active'; | 
| 152 | 152 | } | 
| 153 | -	if ( ! empty( $nav_classes ) ) { | |
| 154 | - echo wp_kses_post( implode( ' ', $nav_classes ) ); | |
| 153 | +	if ( ! empty($nav_classes)) { | |
| 154 | +		echo wp_kses_post(implode(' ', $nav_classes)); | |
| 155 | 155 | } | 
| 156 | 156 | } | 
| 157 | 157 | |
| @@ -166,26 +166,26 @@ discard block | ||
| 166 | 166 | <ul class="nav nav-pills"> | 
| 167 | 167 | <li class=" | 
| 168 | 168 | <?php | 
| 169 | -			if ( ( function_exists( 'is_wc_endpoint_url' ) && ! is_wc_endpoint_url( 'edit-account' ) ) || ! function_exists( 'is_wc_endpoint_url' ) ) { | |
| 170 | - echo esc_attr( 'active' ); | |
| 169 | +			if ((function_exists('is_wc_endpoint_url') && ! is_wc_endpoint_url('edit-account')) || ! function_exists('is_wc_endpoint_url')) { | |
| 170 | +				echo esc_attr('active'); | |
| 171 | 171 | } | 
| 172 | 172 | ?> | 
| 173 | - "><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a></li> | |
| 173 | +			"><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e('My Plans', 'lsx-health-plan'); ?></a></li> | |
| 174 | 174 | <?php | 
| 175 | -			if ( function_exists( 'WC' ) ) { | |
| 175 | +			if (function_exists('WC')) { | |
| 176 | 176 | ?> | 
| 177 | 177 | <li class=" | 
| 178 | 178 | <?php | 
| 179 | -				if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { | |
| 180 | - echo esc_attr( 'active' ); | |
| 179 | +				if (function_exists('is_wc_endpoint_url') && is_wc_endpoint_url('edit-account')) { | |
| 180 | +					echo esc_attr('active'); | |
| 181 | 181 | } | 
| 182 | 182 | ?> | 
| 183 | - "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e( 'Account Details', 'lsx-health-plan' ); ?></a></li> | |
| 183 | +				"><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e('Account Details', 'lsx-health-plan'); ?></a></li> | |
| 184 | 184 | <?php | 
| 185 | 185 | } | 
| 186 | -			if ( is_user_logged_in() ) { | |
| 186 | +			if (is_user_logged_in()) { | |
| 187 | 187 | ?> | 
| 188 | - <li class=""><a class="logout-tab" href="<?php echo esc_url( wp_logout_url( get_permalink() ) ); ?>"><?php esc_html_e( 'Logout', 'lsx-health-plan' ); ?></a></li> | |
| 188 | +					<li class=""><a class="logout-tab" href="<?php echo esc_url(wp_logout_url(get_permalink())); ?>"><?php esc_html_e('Logout', 'lsx-health-plan'); ?></a></li> | |
| 189 | 189 | <?php | 
| 190 | 190 | } | 
| 191 | 191 | ?> | 
| @@ -203,84 +203,84 @@ discard block | ||
| 203 | 203 | ?> | 
| 204 | 204 | <div class="lsx-health-plan my-profile-block wp-block-cover alignfull"> | 
| 205 | 205 | <div class="wp-block-cover__inner-container"> | 
| 206 | - <h2><?php esc_html_e( 'My Dashboard', 'lsx-health-plan' ); ?></h2> | |
| 207 | -			<?php if ( ( function_exists( 'WC' ) || class_exists( 'WP_User_Avatar_Setup' ) ) && is_user_logged_in() ) { ?> | |
| 206 | +			<h2><?php esc_html_e('My Dashboard', 'lsx-health-plan'); ?></h2> | |
| 207 | +			<?php if ((function_exists('WC') || class_exists('WP_User_Avatar_Setup')) && is_user_logged_in()) { ?> | |
| 208 | 208 | <section id="dashboard-card"> | 
| 209 | -					<?php if ( function_exists( 'WC' ) || class_exists( 'WP_User_Avatar_Setup' ) ) { ?> | |
| 209 | +					<?php if (function_exists('WC') || class_exists('WP_User_Avatar_Setup')) { ?> | |
| 210 | 210 | <div class="profile-navigation"> | 
| 211 | 211 | <div class="profile-photo"> | 
| 212 | 212 | <?php | 
| 213 | 213 | global $current_user; | 
| 214 | -								if ( function_exists( 'WC' ) ) { | |
| 214 | +								if (function_exists('WC')) { | |
| 215 | 215 | get_current_user(); | 
| 216 | 216 | } | 
| 217 | -								if ( class_exists( 'WP_User_Avatar_Setup' ) ) { | |
| 218 | - echo get_avatar( $current_user->ID, 240 ); | |
| 217 | +								if (class_exists('WP_User_Avatar_Setup')) { | |
| 218 | + echo get_avatar($current_user->ID, 240); | |
| 219 | 219 | } | 
| 220 | 220 | ?> | 
| 221 | 221 | </div> | 
| 222 | 222 | </div> | 
| 223 | 223 | <?php } ?> | 
| 224 | -					<?php if ( function_exists( 'WC' ) ) { ?> | |
| 224 | +					<?php if (function_exists('WC')) { ?> | |
| 225 | 225 | <div class="profile-details"> | 
| 226 | - <h1 class="title-lined has-text-color"><?php echo esc_html( $current_user->display_name ); ?></h1> | |
| 226 | + <h1 class="title-lined has-text-color"><?php echo esc_html($current_user->display_name); ?></h1> | |
| 227 | 227 | <?php | 
| 228 | - $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); | |
| 229 | -							if ( 'on' !== $disable_stats && function_exists( 'WC' ) ) { | |
| 228 | +							$disable_stats = \lsx_health_plan\functions\get_option('disable_all_stats', false); | |
| 229 | +							if ('on' !== $disable_stats && function_exists('WC')) { | |
| 230 | 230 | |
| 231 | - $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); | |
| 232 | - $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); | |
| 233 | - $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); | |
| 234 | - $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); | |
| 231 | +								$is_weight_disabled = \lsx_health_plan\functions\get_option('disable_weight_checkbox', false); | |
| 232 | +								$is_height_disabled = \lsx_health_plan\functions\get_option('disable_height_checkbox', false); | |
| 233 | +								$is_waist_disabled  = \lsx_health_plan\functions\get_option('disable_waist_checkbox', false); | |
| 234 | +								$is_bmi_disabled    = \lsx_health_plan\functions\get_option('disable_bmi_checkbox', false); | |
| 235 | 235 | |
| 236 | - $weight = get_user_meta( get_current_user_id(), 'weight', true ); | |
| 237 | - $waist = get_user_meta( get_current_user_id(), 'waist', true ); | |
| 238 | - $height = get_user_meta( get_current_user_id(), 'height', true ); | |
| 236 | + $weight = get_user_meta(get_current_user_id(), 'weight', true); | |
| 237 | + $waist = get_user_meta(get_current_user_id(), 'waist', true); | |
| 238 | + $height = get_user_meta(get_current_user_id(), 'height', true); | |
| 239 | 239 | |
| 240 | 240 | $height_m = 0; | 
| 241 | -								if ( is_numeric( $height ) ) { | |
| 241 | +								if (is_numeric($height)) { | |
| 242 | 242 | $height_m = $height / 100; | 
| 243 | 243 | } | 
| 244 | 244 | |
| 245 | -								if ( 1 < $weight && 1 < $height_m ) { | |
| 246 | - $bmi = $weight / ( $height_m * $height_m ); | |
| 247 | - $bmi = number_format( $bmi, 1 ); | |
| 245 | +								if (1 < $weight && 1 < $height_m) { | |
| 246 | + $bmi = $weight / ($height_m * $height_m); | |
| 247 | + $bmi = number_format($bmi, 1); | |
| 248 | 248 |  								} else { | 
| 249 | - $bmi = __( 'Add more data', 'lsx-health-plan' ); | |
| 249 | +									$bmi = __('Add more data', 'lsx-health-plan'); | |
| 250 | 250 | } | 
| 251 | 251 | |
| 252 | 252 | ?> | 
| 253 | 253 | |
| 254 | 254 | <div> | 
| 255 | -									<?php if ( 'on' !== $is_weight_disabled ) { ?> | |
| 256 | - <span><strong><?php esc_html_e( 'Weight:', 'lsx-health-plan' ); ?></strong> | |
| 255 | +									<?php if ('on' !== $is_weight_disabled) { ?> | |
| 256 | +										<span><strong><?php esc_html_e('Weight:', 'lsx-health-plan'); ?></strong> | |
| 257 | 257 | <?php | 
| 258 | -										if ( '' !== $weight ) { | |
| 259 | - echo wp_kses_post( $weight . ' kg' ); | |
| 258 | +										if ('' !== $weight) { | |
| 259 | + echo wp_kses_post($weight . ' kg'); | |
| 260 | 260 |  										} else { | 
| 261 | 261 | echo '/'; | 
| 262 | 262 | } | 
| 263 | 263 | ?> | 
| 264 | 264 | </span> | 
| 265 | 265 | <?php } | 
| 266 | -									if ( 'on' !== $is_waist_disabled ) { | |
| 266 | +									if ('on' !== $is_waist_disabled) { | |
| 267 | 267 | ?> | 
| 268 | - <span><strong><?php esc_html_e( 'Waist:', 'lsx-health-plan' ); ?></strong> | |
| 268 | +										<span><strong><?php esc_html_e('Waist:', 'lsx-health-plan'); ?></strong> | |
| 269 | 269 | <?php | 
| 270 | -										if ( '' !== $waist ) { | |
| 271 | - echo wp_kses_post( $waist . ' cm' ); | |
| 270 | +										if ('' !== $waist) { | |
| 271 | + echo wp_kses_post($waist . ' cm'); | |
| 272 | 272 |  										} else { | 
| 273 | 273 | echo '/'; | 
| 274 | 274 | } | 
| 275 | 275 | ?> | 
| 276 | 276 | </span> | 
| 277 | 277 | <?php } | 
| 278 | -									if ( 'on' !== $is_bmi_disabled ) { | |
| 278 | +									if ('on' !== $is_bmi_disabled) { | |
| 279 | 279 | ?> | 
| 280 | - <span><strong><?php esc_html_e( 'BMI:', 'lsx-health-plan' ); ?></strong> | |
| 280 | +										<span><strong><?php esc_html_e('BMI:', 'lsx-health-plan'); ?></strong> | |
| 281 | 281 | <?php | 
| 282 | -										if ( '' !== $bmi ) { | |
| 283 | - echo wp_kses_post( $bmi ); | |
| 282 | +										if ('' !== $bmi) { | |
| 283 | + echo wp_kses_post($bmi); | |
| 284 | 284 |  										} else { | 
| 285 | 285 | echo '/'; | 
| 286 | 286 | } | 
| @@ -292,17 +292,17 @@ discard block | ||
| 292 | 292 | } | 
| 293 | 293 | |
| 294 | 294 | // Only display the edit account link if woocommerce is active. | 
| 295 | -							if ( function_exists( 'WC' ) ) { | |
| 295 | +							if (function_exists('WC')) { | |
| 296 | 296 | ?> | 
| 297 | 297 | <div class="edit-profile"> | 
| 298 | 298 | <?php | 
| 299 | -									if ( function_exists( 'wc_get_page_id' ) ) { | |
| 300 | - $url_id = wc_get_page_id( 'myaccount' ); | |
| 299 | +									if (function_exists('wc_get_page_id')) { | |
| 300 | +										$url_id = wc_get_page_id('myaccount'); | |
| 301 | 301 |  									} else { | 
| 302 | 302 | $url_id = ''; | 
| 303 | 303 | } | 
| 304 | 304 | ?> | 
| 305 | - <a href="<?php echo esc_url( get_permalink( $url_id ) ); ?>edit-account/"><?php esc_html_e( 'Edit', 'lsx-health-plan' ); ?></a> | |
| 305 | +									<a href="<?php echo esc_url(get_permalink($url_id)); ?>edit-account/"><?php esc_html_e('Edit', 'lsx-health-plan'); ?></a> | |
| 306 | 306 | </div> | 
| 307 | 307 | <?php | 
| 308 | 308 | } | 
| @@ -325,10 +325,10 @@ discard block | ||
| 325 | 325 | global $post, $product; | 
| 326 | 326 | |
| 327 | 327 | // If this is the my plan page, and the user is logged out, show to WC login. | 
| 328 | - $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); | |
| 329 | -	if ( function_exists( 'is_wc_endpoint_url' ) && false !== $plan_slug && is_page( $plan_slug ) ) { | |
| 330 | - echo wp_kses_post( '<h2 class="title-lined my-plan"></h2>' ); | |
| 331 | - echo do_shortcode( '[woocommerce_my_account]' ); | |
| 328 | +	$plan_slug = \lsx_health_plan\functions\get_option('my_plan_slug', false); | |
| 329 | +	if (function_exists('is_wc_endpoint_url') && false !== $plan_slug && is_page($plan_slug)) { | |
| 330 | +		echo wp_kses_post('<h2 class="title-lined my-plan"></h2>'); | |
| 331 | +		echo do_shortcode('[woocommerce_my_account]'); | |
| 332 | 332 | return; | 
| 333 | 333 | } | 
| 334 | 334 | |
| @@ -340,9 +340,9 @@ discard block | ||
| 340 | 340 | 'post_parent' => 0, | 
| 341 | 341 | ); | 
| 342 | 342 | |
| 343 | -	if ( function_exists( '\lsx_health_plan\functions\woocommerce\get_membership_products' ) ) { | |
| 343 | +	if (function_exists('\lsx_health_plan\functions\woocommerce\get_membership_products')) { | |
| 344 | 344 | $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); | 
| 345 | -		if ( ! empty( $product_ids ) ) { | |
| 345 | +		if ( ! empty($product_ids)) { | |
| 346 | 346 | $args['meta_query'] = array( | 
| 347 | 347 | 'relation' => 'OR', | 
| 348 | 348 | array( | 
| @@ -358,82 +358,82 @@ discard block | ||
| 358 | 358 | } | 
| 359 | 359 | } | 
| 360 | 360 | |
| 361 | - $the_query = new WP_Query( $args ); | |
| 361 | + $the_query = new WP_Query($args); | |
| 362 | 362 | ?> | 
| 363 | 363 | <div class="all-plans-block plan-grid block-all-plans-block"> | 
| 364 | 364 | <div class="row"> | 
| 365 | 365 | <?php | 
| 366 | - if ( $the_query->have_posts() ) : | |
| 367 | - while ( $the_query->have_posts() ) : | |
| 366 | + if ($the_query->have_posts()) : | |
| 367 | + while ($the_query->have_posts()) : | |
| 368 | 368 | $the_query->the_post(); | 
| 369 | 369 | lsx_entry_before(); | 
| 370 | 370 | $completed_class = ''; | 
| 371 | 371 | $linked_product = false; | 
| 372 | 372 | $restricted = false; | 
| 373 | 373 | $product = null; | 
| 374 | -					if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { | |
| 374 | +					if (function_exists('lsx_health_plan\functions\woocommerce\plan_has_products') && \lsx_health_plan\functions\woocommerce\plan_has_products()) { | |
| 375 | 375 | $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); | 
| 376 | - $linked_product = wc_get_product( $products[0] ); | |
| 376 | + $linked_product = wc_get_product($products[0]); | |
| 377 | 377 | $product = $linked_product; | 
| 378 | 378 | } | 
| 379 | -					if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { | |
| 380 | - $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); | |
| 379 | +					if (function_exists('wc_memberships_is_post_content_restricted')) { | |
| 380 | +						$restricted = wc_memberships_is_post_content_restricted(get_the_ID()) && ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID()); | |
| 381 | 381 | } | 
| 382 | 382 | |
| 383 | -					if ( lsx_health_plan_is_plan_complete() ) { | |
| 383 | +					if (lsx_health_plan_is_plan_complete()) { | |
| 384 | 384 | $completed_class = 'completed'; | 
| 385 | 385 | } | 
| 386 | 386 | $round_progress = ''; | 
| 387 | 387 | $completed_progress = '100'; | 
| 388 | -					if ( false === $restricted ) { | |
| 389 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); | |
| 388 | +					if (false === $restricted) { | |
| 389 | + $round_progress = round(\lsx_health_plan\functions\get_progress(get_the_ID()), 0); | |
| 390 | 390 | } | 
| 391 | 391 | ?> | 
| 392 | 392 | <div class="col-xs-12 col-sm-6 col-md-4"> | 
| 393 | - <article class="lsx-slot lsx-hp-shadow <?php echo esc_html( 'progress-') . $round_progress; ?>"> | |
| 393 | +						<article class="lsx-slot lsx-hp-shadow <?php echo esc_html('progress-') . $round_progress; ?>"> | |
| 394 | 394 | <div class="plan-feature-img"> | 
| 395 | -								<?php if ( (int)$completed_progress === (int)$round_progress ) { ?> | |
| 396 | - <span class="featured-plan"><?php lsx_get_svg_icon( 'icon-completed.svg' ); ?></span> | |
| 395 | +								<?php if ((int) $completed_progress === (int) $round_progress) { ?> | |
| 396 | +									<span class="featured-plan"><?php lsx_get_svg_icon('icon-completed.svg'); ?></span> | |
| 397 | 397 | <?php } ?> | 
| 398 | - <a href="<?php echo esc_url( get_permalink() ); ?>"> | |
| 398 | + <a href="<?php echo esc_url(get_permalink()); ?>"> | |
| 399 | 399 | <?php | 
| 400 | 400 | $featured_image = get_the_post_thumbnail(); | 
| 401 | -								if ( ! empty( $featured_image ) && '' !== $featured_image ) { | |
| 402 | - the_post_thumbnail( 'lsx-thumbnail', array( | |
| 401 | +								if ( ! empty($featured_image) && '' !== $featured_image) { | |
| 402 | +									the_post_thumbnail('lsx-thumbnail', array( | |
| 403 | 403 | 'class' => 'aligncenter', | 
| 404 | - ) ); | |
| 404 | + )); | |
| 405 | 405 |  								} else { | 
| 406 | 406 | ?> | 
| 407 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> | |
| 407 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> | |
| 408 | 408 | <?php | 
| 409 | 409 | } | 
| 410 | 410 | ?> | 
| 411 | 411 | </a> | 
| 412 | 412 | </div> | 
| 413 | 413 | <div class="content-box plan-content-box"> | 
| 414 | - <h3 class="plan id-<?php the_ID(); ?> <?php echo esc_attr( $completed_class ); ?>"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_title(); ?></a></h3> | |
| 414 | + <h3 class="plan id-<?php the_ID(); ?> <?php echo esc_attr($completed_class); ?>"><a href="<?php echo esc_url(get_permalink()); ?>"><?php the_title(); ?></a></h3> | |
| 415 | 415 | <?php | 
| 416 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); | |
| 416 | + echo wp_kses_post(\lsx_health_plan\functions\hp_get_plan_type_meta($post)); | |
| 417 | 417 | ?> | 
| 418 | 418 | <?php | 
| 419 | -								if ( false !== $linked_product && false !== $restricted ) { | |
| 420 | - echo wp_kses_post( $linked_product->get_price_html() ); | |
| 419 | +								if (false !== $linked_product && false !== $restricted) { | |
| 420 | + echo wp_kses_post($linked_product->get_price_html()); | |
| 421 | 421 | } | 
| 422 | 422 | ?> | 
| 423 | 423 | <div class="excerpt"> | 
| 424 | 424 | <?php | 
| 425 | -									if ( ! has_excerpt() ) { | |
| 426 | - $content = wp_trim_words( get_the_content(), 20 ); | |
| 425 | +									if ( ! has_excerpt()) { | |
| 426 | + $content = wp_trim_words(get_the_content(), 20); | |
| 427 | 427 | $content = '<p>' . $content . '</pre>'; | 
| 428 | 428 |  									} else { | 
| 429 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); | |
| 429 | +										$content = apply_filters('the_excerpt', get_the_excerpt()); | |
| 430 | 430 | } | 
| 431 | - echo wp_kses_post( $content ); | |
| 431 | + echo wp_kses_post($content); | |
| 432 | 432 | ?> | 
| 433 | 433 | </div> | 
| 434 | 434 | <?php | 
| 435 | -								if ( false === $restricted ) { | |
| 436 | - echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '" max="100"> ' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '% </progress><span>' . $round_progress . '%</span></span>' ); | |
| 435 | +								if (false === $restricted) { | |
| 436 | +									echo wp_kses_post('<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress(get_the_ID()) . '" max="100"> ' . \lsx_health_plan\functions\get_progress(get_the_ID()) . '% </progress><span>' . $round_progress . '%</span></span>'); | |
| 437 | 437 | } | 
| 438 | 438 | ?> | 
| 439 | 439 | </div> | 
| @@ -453,30 +453,30 @@ discard block | ||
| 453 | 453 | * | 
| 454 | 454 | * @return void | 
| 455 | 455 | */ | 
| 456 | -function lsx_health_plan_day_plan_block( $args = array() ) { | |
| 456 | +function lsx_health_plan_day_plan_block($args = array()) { | |
| 457 | 457 | $defaults = array( | 
| 458 | 458 | 'plan' => '', | 
| 459 | 459 | ); | 
| 460 | - $args = wp_parse_args( $args, $defaults ); | |
| 460 | + $args = wp_parse_args($args, $defaults); | |
| 461 | 461 | |
| 462 | -	if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { | |
| 462 | +	if (isset($args['plan']) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections($args['plan'])) { | |
| 463 | 463 | $sections = \lsx_health_plan\functions\plan\get_sections(); | 
| 464 | 464 | ?> | 
| 465 | 465 | <div class="daily-plan-block day-grid"> | 
| 466 | 466 | <?php | 
| 467 | -			foreach ( $sections as $section_key => $section_values ) { | |
| 468 | - $defaults = array( | |
| 469 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), | |
| 467 | +			foreach ($sections as $section_key => $section_values) { | |
| 468 | + $defaults = array( | |
| 469 | +					'title' => __('Day', 'lsx-health-plan') . ' ' . ($section_key + 1), | |
| 470 | 470 | ); | 
| 471 | - $section_args = wp_parse_args( $section_values, $defaults ); | |
| 471 | + $section_args = wp_parse_args($section_values, $defaults); | |
| 472 | 472 | |
| 473 | 473 | $completed_class = ''; | 
| 474 | -				if ( lsx_health_plan_is_day_complete() ) { | |
| 474 | +				if (lsx_health_plan_is_day_complete()) { | |
| 475 | 475 | $completed_class = 'completed'; | 
| 476 | 476 | } | 
| 477 | 477 | ?> | 
| 478 | - <a href="<?php echo esc_attr( \lsx_health_plan\functions\plan\get_permalink( $args['plan'], $section_args['title'] ) ); ?>" class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> | |
| 479 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> | |
| 478 | + <a href="<?php echo esc_attr(\lsx_health_plan\functions\plan\get_permalink($args['plan'], $section_args['title'])); ?>" class="day id-<?php echo esc_attr($section_key + 1); ?> <?php echo esc_attr($completed_class); ?>"> | |
| 479 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> | |
| 480 | 480 | </a> | 
| 481 | 481 | <?php | 
| 482 | 482 | } | 
| @@ -492,31 +492,31 @@ discard block | ||
| 492 | 492 | * @param array $args An array of arguments. | 
| 493 | 493 | * @return void | 
| 494 | 494 | */ | 
| 495 | -function lsx_health_plan_week_plan_block( $args = array() ) { | |
| 495 | +function lsx_health_plan_week_plan_block($args = array()) { | |
| 496 | 496 | $defaults = array( | 
| 497 | 497 | 'show_downloads' => false, | 
| 498 | 498 | 'plan' => '', | 
| 499 | 499 | ); | 
| 500 | - $args = wp_parse_args( $args, $defaults ); | |
| 500 | + $args = wp_parse_args($args, $defaults); | |
| 501 | 501 | |
| 502 | -	if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { | |
| 503 | - $groups = \lsx_health_plan\functions\plan\get_sections( true ); | |
| 502 | +	if (isset($args['plan']) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections($args['plan'])) { | |
| 503 | + $groups = \lsx_health_plan\functions\plan\get_sections(true); | |
| 504 | 504 | |
| 505 | -		if ( ! empty( $groups ) ) { | |
| 505 | +		if ( ! empty($groups)) { | |
| 506 | 506 | $counter = 1; | 
| 507 | 507 | $group_open = false; | 
| 508 | 508 | |
| 509 | -			foreach ( $groups as $group_key => $sections ) { | |
| 509 | +			foreach ($groups as $group_key => $sections) { | |
| 510 | 510 | $collapse_class = ''; | 
| 511 | - $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); | |
| 511 | + $group_title = \lsx_health_plan\functions\plan\get_group_title($sections); | |
| 512 | 512 | |
| 513 | 513 | // Determine if the current week is complete. | 
| 514 | - $day_ids = wp_list_pluck( $sections, 'title' ); | |
| 515 | -				if ( false === $group_open ) { | |
| 516 | -					if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { | |
| 514 | + $day_ids = wp_list_pluck($sections, 'title'); | |
| 515 | +				if (false === $group_open) { | |
| 516 | +					if (1 === $counter && ! \lsx_health_plan\functions\is_week_complete(false, $day_ids, $group_title)) { | |
| 517 | 517 | $collapse_class = 'in'; | 
| 518 | 518 | $group_open = true; | 
| 519 | -					} elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { | |
| 519 | +					} elseif ( ! \lsx_health_plan\functions\is_week_complete(false, $day_ids, $group_title)) { | |
| 520 | 520 | $collapse_class = 'in'; | 
| 521 | 521 | $group_open = true; | 
| 522 | 522 | } | 
| @@ -524,47 +524,47 @@ discard block | ||
| 524 | 524 | |
| 525 | 525 | // Determine if there are any weekly downloads. | 
| 526 | 526 | $week_downloads_view = ''; | 
| 527 | -				if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { | |
| 528 | - $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); | |
| 529 | -					if ( ! empty( $weekly_downloads ) ) { | |
| 527 | +				if (isset($args['show_downloads']) && false !== $args['show_downloads']) { | |
| 528 | + $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads($group_key); | |
| 529 | +					if ( ! empty($weekly_downloads)) { | |
| 530 | 530 | $week_downloads_view = 'week-downloads-view-on'; | 
| 531 | 531 | } | 
| 532 | 532 | } | 
| 533 | 533 | ?> | 
| 534 | 534 | <div class="daily-plan-block week-grid"> | 
| 535 | - <a href="#group-<?php echo esc_attr( $group_key ); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr( $group_title ); ?></a> | |
| 536 | - <div id="group-<?php echo esc_attr( $group_key ); ?>" class="week-row collapse <?php echo esc_attr( $collapse_class ); ?>"> | |
| 537 | - <div class="week-row-inner <?php echo esc_html( $week_downloads_view ); ?>"> | |
| 535 | + <a href="#group-<?php echo esc_attr($group_key); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr($group_title); ?></a> | |
| 536 | + <div id="group-<?php echo esc_attr($group_key); ?>" class="week-row collapse <?php echo esc_attr($collapse_class); ?>"> | |
| 537 | + <div class="week-row-inner <?php echo esc_html($week_downloads_view); ?>"> | |
| 538 | 538 | <div class="week-meals-recipes-box"> | 
| 539 | 539 | |
| 540 | -								<?php if ( ! empty( $week_downloads_view ) ) { ?> | |
| 541 | - <h3 class="title"><?php lsx_get_svg_icon( 'daily-plan.svg' ); ?><?php echo esc_html_e( 'Plan', 'lsx-health-plan' ); ?></h3> | |
| 540 | +								<?php if ( ! empty($week_downloads_view)) { ?> | |
| 541 | +									<h3 class="title"><?php lsx_get_svg_icon('daily-plan.svg'); ?><?php echo esc_html_e('Plan', 'lsx-health-plan'); ?></h3> | |
| 542 | 542 | <?php } ?> | 
| 543 | 543 | |
| 544 | 544 | <div class="week-meals-recipes-box-inner"> | 
| 545 | 545 | <?php | 
| 546 | 546 | |
| 547 | -								foreach ( $sections as $section_key => $section_values ) { | |
| 547 | +								foreach ($sections as $section_key => $section_values) { | |
| 548 | 548 | |
| 549 | - $defaults = array( | |
| 550 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), | |
| 549 | + $defaults = array( | |
| 550 | +										'title' => __('Day', 'lsx-health-plan') . ' ' . ($section_key + 1), | |
| 551 | 551 | ); | 
| 552 | - $section_args = wp_parse_args( $section_values, $defaults ); | |
| 552 | + $section_args = wp_parse_args($section_values, $defaults); | |
| 553 | 553 | |
| 554 | 554 | $completed_class = ''; | 
| 555 | -									if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { | |
| 555 | +									if (lsx_health_plan_is_day_complete($args['plan'], $section_args['title'])) { | |
| 556 | 556 | $completed_class = 'completed'; | 
| 557 | 557 | } | 
| 558 | -									if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { | |
| 558 | +									if ($section_args['rest_day_enabled'] && ! $section_args['connected_meals']) { | |
| 559 | 559 | ?> | 
| 560 | - <span class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> | |
| 561 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> | |
| 560 | + <span class="day id-<?php echo esc_attr($section_key + 1); ?> <?php echo esc_attr($completed_class); ?>"> | |
| 561 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> | |
| 562 | 562 | </span> | 
| 563 | 563 | <?php | 
| 564 | 564 |  									} else { | 
| 565 | 565 | ?> | 
| 566 | - <a href="<?php echo esc_attr( \lsx_health_plan\functions\plan\get_permalink( $args['plan'], $section_args['title'] ) ); ?>" class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> | |
| 567 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> | |
| 566 | + <a href="<?php echo esc_attr(\lsx_health_plan\functions\plan\get_permalink($args['plan'], $section_args['title'])); ?>" class="day id-<?php echo esc_attr($section_key + 1); ?> <?php echo esc_attr($completed_class); ?>"> | |
| 567 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> | |
| 568 | 568 | </a> | 
| 569 | 569 | <?php | 
| 570 | 570 | } | 
| @@ -573,8 +573,8 @@ discard block | ||
| 573 | 573 | </div> | 
| 574 | 574 | </div> | 
| 575 | 575 | <?php | 
| 576 | -							if ( ! empty( $week_downloads_view ) ) { | |
| 577 | - lsx_health_plan_weekly_downloads( $weekly_downloads ); | |
| 576 | +							if ( ! empty($week_downloads_view)) { | |
| 577 | + lsx_health_plan_weekly_downloads($weekly_downloads); | |
| 578 | 578 | } | 
| 579 | 579 | ?> | 
| 580 | 580 | </div> | 
| @@ -592,16 +592,16 @@ discard block | ||
| 592 | 592 | * @param array $weekly_downloads An array of the download ids. | 
| 593 | 593 | * @return void | 
| 594 | 594 | */ | 
| 595 | -function lsx_health_plan_weekly_downloads( $weekly_downloads = array() ) { | |
| 596 | -	if ( ! empty( $weekly_downloads ) ) { | |
| 595 | +function lsx_health_plan_weekly_downloads($weekly_downloads = array()) { | |
| 596 | +	if ( ! empty($weekly_downloads)) { | |
| 597 | 597 | ?> | 
| 598 | 598 | <div class="week-download-box"> | 
| 599 | - <h3 class="title"><?php lsx_get_svg_icon( 'download.svg' ); ?><?php echo esc_html_e( 'Downloads', 'lsx-health-plan' ); ?></h3> | |
| 599 | +			<h3 class="title"><?php lsx_get_svg_icon('download.svg'); ?><?php echo esc_html_e('Downloads', 'lsx-health-plan'); ?></h3> | |
| 600 | 600 | <ul class="week-download-box-list"> | 
| 601 | 601 | <?php | 
| 602 | -				foreach ( $weekly_downloads as $weekly_download ) { | |
| 602 | +				foreach ($weekly_downloads as $weekly_download) { | |
| 603 | 603 | ?> | 
| 604 | - <li><?php echo wp_kses_post( do_shortcode( '[download id="' . $weekly_download . '"]' ) ); ?></li> | |
| 604 | +					<li><?php echo wp_kses_post(do_shortcode('[download id="' . $weekly_download . '"]')); ?></li> | |
| 605 | 605 | <?php | 
| 606 | 606 | } | 
| 607 | 607 | ?> | 
| @@ -616,7 +616,7 @@ discard block | ||
| 616 | 616 | * | 
| 617 | 617 | * @return void | 
| 618 | 618 | */ | 
| 619 | -function lsx_health_plan_items( $args = array() ) { | |
| 619 | +function lsx_health_plan_items($args = array()) { | |
| 620 | 620 | global $shortcode_args; | 
| 621 | 621 | $shortcode_args = $args; | 
| 622 | 622 | include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; | 
| @@ -628,7 +628,7 @@ discard block | ||
| 628 | 628 | * @return void | 
| 629 | 629 | */ | 
| 630 | 630 |  function lsx_health_plan_featured_video_block() { | 
| 631 | -	if ( ! post_type_exists( 'video' ) ) { | |
| 631 | +	if ( ! post_type_exists('video')) { | |
| 632 | 632 | return; | 
| 633 | 633 | } | 
| 634 | 634 | include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; | 
| @@ -640,7 +640,7 @@ discard block | ||
| 640 | 640 | * @return void | 
| 641 | 641 | */ | 
| 642 | 642 |  function lsx_health_plan_featured_recipes_block() { | 
| 643 | -	if ( ! post_type_exists( 'recipe' ) ) { | |
| 643 | +	if ( ! post_type_exists('recipe')) { | |
| 644 | 644 | return; | 
| 645 | 645 | } | 
| 646 | 646 | include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; | 
| @@ -662,7 +662,7 @@ discard block | ||
| 662 | 662 | * @return void | 
| 663 | 663 | */ | 
| 664 | 664 |  function lsx_health_plan_day_button() { | 
| 665 | -	if ( lsx_health_plan_is_day_complete() ) { | |
| 665 | +	if (lsx_health_plan_is_day_complete()) { | |
| 666 | 666 | lsx_health_plan_unlock_button(); | 
| 667 | 667 |  	} else { | 
| 668 | 668 | lsx_health_plan_complete_button(); | 
| @@ -678,9 +678,9 @@ discard block | ||
| 678 | 678 | ?> | 
| 679 | 679 | <div class="single-plan-inner-buttons"> | 
| 680 | 680 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> | 
| 681 | - <?php wp_nonce_field( 'complete', 'lsx-health-plan-actions' ); ?> | |
| 682 | - <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr( \lsx_health_plan\functions\plan\generate_section_id() ); ?>" /> | |
| 683 | - <button class="btn cta-btn" type="submit"><?php esc_html_e( 'Complete Day', 'lsx-health-plan' ); ?></button> | |
| 681 | +			<?php wp_nonce_field('complete', 'lsx-health-plan-actions'); ?> | |
| 682 | + <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr(\lsx_health_plan\functions\plan\generate_section_id()); ?>" /> | |
| 683 | +			<button class="btn cta-btn" type="submit"><?php esc_html_e('Complete Day', 'lsx-health-plan'); ?></button> | |
| 684 | 684 | </form> | 
| 685 | 685 | <?php lsx_health_plan_back_to_plan_button(); ?> | 
| 686 | 686 | </div> | 
| @@ -696,9 +696,9 @@ discard block | ||
| 696 | 696 | ?> | 
| 697 | 697 | <div class="single-plan-inner-buttons"> | 
| 698 | 698 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> | 
| 699 | - <?php wp_nonce_field( 'unlock', 'lsx-health-plan-actions' ); ?> | |
| 700 | - <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr( \lsx_health_plan\functions\plan\generate_section_id() ); ?>" /> | |
| 701 | - <button class="btn secondary-btn" type="submit"><?php esc_html_e( 'Im not done!', 'lsx-health-plan' ); ?></button> | |
| 699 | +			<?php wp_nonce_field('unlock', 'lsx-health-plan-actions'); ?> | |
| 700 | + <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr(\lsx_health_plan\functions\plan\generate_section_id()); ?>" /> | |
| 701 | +			<button class="btn secondary-btn" type="submit"><?php esc_html_e('Im not done!', 'lsx-health-plan'); ?></button> | |
| 702 | 702 | </form> | 
| 703 | 703 | <?php lsx_health_plan_back_to_plan_button(); ?> | 
| 704 | 704 | </div> | 
| @@ -712,8 +712,8 @@ discard block | ||
| 712 | 712 | * @return void | 
| 713 | 713 | */ | 
| 714 | 714 |  function lsx_health_plan_single_nav() { | 
| 715 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); | |
| 716 | -	if ( '' !== $tab_template_path ) { | |
| 715 | +	$tab_template_path = apply_filters('lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php'); | |
| 716 | +	if ('' !== $tab_template_path) { | |
| 717 | 717 | require $tab_template_path; | 
| 718 | 718 | } | 
| 719 | 719 | } | 
| @@ -725,8 +725,8 @@ discard block | ||
| 725 | 725 | * @return void | 
| 726 | 726 | */ | 
| 727 | 727 |  function lsx_health_plan_single_tabs() { | 
| 728 | - $endpoint = get_query_var( 'endpoint' ); | |
| 729 | -	switch ( $endpoint ) { | |
| 728 | +	$endpoint = get_query_var('endpoint'); | |
| 729 | +	switch ($endpoint) { | |
| 730 | 730 | case 'meal': | 
| 731 | 731 | $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; | 
| 732 | 732 | break; | 
| @@ -747,8 +747,8 @@ discard block | ||
| 747 | 747 | $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; | 
| 748 | 748 | break; | 
| 749 | 749 | } | 
| 750 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); | |
| 751 | -	if ( '' !== $tab_template_path ) { | |
| 750 | +	$tab_template_path = apply_filters('lsx_health_plan_single_tab_path', $tab_template_path); | |
| 751 | +	if ('' !== $tab_template_path) { | |
| 752 | 752 | include $tab_template_path; | 
| 753 | 753 | } | 
| 754 | 754 | } | 
| @@ -768,9 +768,9 @@ discard block | ||
| 768 | 768 | * @return recipe_type | 
| 769 | 769 | */ | 
| 770 | 770 |  function lsx_health_plan_recipe_type() { | 
| 771 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); | |
| 771 | + $term_obj_list = get_the_terms(get_the_ID(), 'recipe-type'); | |
| 772 | 772 | $recipe_type = $term_obj_list[0]->name; | 
| 773 | -	if ( ! empty( $recipe_type ) ) { | |
| 773 | +	if ( ! empty($recipe_type)) { | |
| 774 | 774 | return $recipe_type; | 
| 775 | 775 | } | 
| 776 | 776 | } | 
| @@ -782,32 +782,32 @@ discard block | ||
| 782 | 782 | * @param array $group | 
| 783 | 783 | * @return void | 
| 784 | 784 | */ | 
| 785 | -function lsx_health_plan_workout_video_play_button( $m, $group, $echo = true ) { | |
| 785 | +function lsx_health_plan_workout_video_play_button($m, $group, $echo = true) { | |
| 786 | 786 | $workout_video = ''; | 
| 787 | 787 | $giphy = ''; | 
| 788 | 788 | $youtube = ''; | 
| 789 | -	if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { | |
| 790 | - $workout_video = esc_html( $group['connected_videos'] ); | |
| 791 | - $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); | |
| 792 | - $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); | |
| 793 | - $content = get_post_field( 'post_content', $workout_video ); | |
| 789 | +	if (isset($group['connected_videos']) && '' !== $group['connected_videos']) { | |
| 790 | + $workout_video = esc_html($group['connected_videos']); | |
| 791 | + $giphy = get_post_meta($workout_video, 'video_giphy_source', true); | |
| 792 | + $youtube = esc_url(get_post_meta($workout_video, 'video_youtube_source', 1)); | |
| 793 | +		$content       = get_post_field('post_content', $workout_video); | |
| 794 | 794 | $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; | 
| 795 | 795 | |
| 796 | 796 | $modal_body = ''; | 
| 797 | -		if ( ! empty( $giphy ) ) { | |
| 798 | - $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); | |
| 797 | +		if ( ! empty($giphy)) { | |
| 798 | + $giphy = \lsx_health_plan\functions\get_video_url($giphy); | |
| 799 | 799 | $modal_body = $giphy; // WPCS: XSS OK. | 
| 800 | -		} elseif ( ! empty( $youtube ) ) { | |
| 801 | - $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. | |
| 800 | +		} elseif ( ! empty($youtube)) { | |
| 801 | + $modal_body = wp_oembed_get($youtube, array( // WPCS: XSS OK. | |
| 802 | 802 | 'width' => 480, | 
| 803 | - ) ); | |
| 803 | + )); | |
| 804 | 804 | } | 
| 805 | 805 | $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; | 
| 806 | 806 | $modal_body .= $content; | 
| 807 | - \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); | |
| 807 | +		\lsx_health_plan\functions\register_modal('workout-video-modal-' . $m, '', $modal_body); | |
| 808 | 808 | |
| 809 | -		if ( true === $echo ) { | |
| 810 | - echo wp_kses_post( $play_button ); | |
| 809 | +		if (true === $echo) { | |
| 810 | + echo wp_kses_post($play_button); | |
| 811 | 811 |  		} else { | 
| 812 | 812 | return $play_button; | 
| 813 | 813 | } | 
| @@ -821,17 +821,17 @@ discard block | ||
| 821 | 821 | */ | 
| 822 | 822 |  function lsx_health_plan_recipe_archive_description() { | 
| 823 | 823 | $description = ''; | 
| 824 | -	if ( is_post_type_archive( 'recipe' ) ) { | |
| 825 | - $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); | |
| 826 | -	} elseif ( is_post_type_archive( 'exercise' ) ) { | |
| 827 | - $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); | |
| 828 | -	} elseif ( is_tax() ) { | |
| 824 | +	if (is_post_type_archive('recipe')) { | |
| 825 | +		$description = \lsx_health_plan\functions\get_option('recipe_archive_description', ''); | |
| 826 | +	} elseif (is_post_type_archive('exercise')) { | |
| 827 | +		$description = \lsx_health_plan\functions\get_option('exercise_archive_description', ''); | |
| 828 | +	} elseif (is_tax()) { | |
| 829 | 829 | $description = get_the_archive_description(); | 
| 830 | 830 | } | 
| 831 | -	if ( '' !== $description ) { | |
| 831 | +	if ('' !== $description) { | |
| 832 | 832 | ?> | 
| 833 | 833 | <div class="lsx-hp-archive-description row"> | 
| 834 | - <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> | |
| 834 | + <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post(wpautop($description)); ?></div> | |
| 835 | 835 | </div> | 
| 836 | 836 | <?php | 
| 837 | 837 | } | 
| @@ -844,19 +844,19 @@ discard block | ||
| 844 | 844 | */ | 
| 845 | 845 |  function lsx_health_plan_workout_main_content() { | 
| 846 | 846 | // Getting translated endpoint. | 
| 847 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); | |
| 847 | +	$workout = \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'); | |
| 848 | 848 | |
| 849 | - $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); | |
| 850 | - $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); | |
| 849 | + $connected_members = get_post_meta(get_the_ID(), ($workout . '_connected_team_member'), true); | |
| 850 | + $small_description = get_post_meta(get_the_ID(), ($workout . '_short_description'), true); | |
| 851 | 851 | |
| 852 | 852 | $content = ''; | 
| 853 | -	if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { | |
| 853 | +	if ($small_description || $connected_members || lsx_health_plan_has_tips()) { | |
| 854 | 854 | $content .= '<div class="short-desc set-box set content-box entry-content">'; | 
| 855 | 855 | $content .= '<div class="the-content">'; | 
| 856 | - $content .= lsx_hp_member_connected( $connected_members, $workout ); | |
| 856 | + $content .= lsx_hp_member_connected($connected_members, $workout); | |
| 857 | 857 | $content .= '<span>' . $small_description . '</span>'; | 
| 858 | 858 | $content .= '</div>'; | 
| 859 | - $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); | |
| 859 | +		$content .= do_shortcode('[lsx_health_plan_featured_tips_block]'); | |
| 860 | 860 | $content .= '</div>'; | 
| 861 | 861 | } | 
| 862 | 862 | return $content; | 
| @@ -869,19 +869,19 @@ discard block | ||
| 869 | 869 | */ | 
| 870 | 870 |  function lsx_health_plan_meal_main_content() { | 
| 871 | 871 | // Getting translated endpoint. | 
| 872 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); | |
| 872 | +	$meal = \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'); | |
| 873 | 873 | |
| 874 | - $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); | |
| 875 | - $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); | |
| 874 | + $connected_members = get_post_meta(get_the_ID(), ($meal . '_connected_team_member'), true); | |
| 875 | + $small_description = get_post_meta(get_the_ID(), ($meal . '_short_description'), true); | |
| 876 | 876 | |
| 877 | 877 | $content_meal = ''; | 
| 878 | -	if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { | |
| 878 | +	if ($small_description || $connected_members || lsx_health_plan_has_tips()) { | |
| 879 | 879 | $content_meal .= '<div class="set-box set content-box entry-content">'; | 
| 880 | 880 | $content_meal .= '<div class="the-content">'; | 
| 881 | - $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); | |
| 881 | + $content_meal .= lsx_hp_member_connected($connected_members, $meal); | |
| 882 | 882 | $content_meal .= '<span>' . $small_description . '</span>'; | 
| 883 | 883 | $content_meal .= '</div>'; | 
| 884 | - $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); | |
| 884 | +		$content_meal .= do_shortcode('[lsx_health_plan_featured_tips_block]'); | |
| 885 | 885 | $content_meal .= '</div>'; | 
| 886 | 886 | } | 
| 887 | 887 | return $content_meal; | 
| @@ -894,21 +894,21 @@ discard block | ||
| 894 | 894 | * @param string $index | 
| 895 | 895 | * @return void | 
| 896 | 896 | */ | 
| 897 | -function lsx_health_plan_workout_tab_content( $index = 1 ) { | |
| 898 | - global $group_name,$shortcode_args; | |
| 897 | +function lsx_health_plan_workout_tab_content($index = 1) { | |
| 898 | + global $group_name, $shortcode_args; | |
| 899 | 899 | $group_name = 'workout_section_' . $index; | 
| 900 | -	if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { | |
| 901 | - $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); | |
| 900 | +	if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { | |
| 901 | +		$layout = strtolower(\lsx_health_plan\functions\get_option('workout_tab_layout', 'table')); | |
| 902 | 902 | |
| 903 | 903 | // Check for shortcode overrides. | 
| 904 | -		if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { | |
| 904 | +		if (null !== $shortcode_args && isset($shortcode_args['layout'])) { | |
| 905 | 905 | $layout = $shortcode_args['layout']; | 
| 906 | 906 | } | 
| 907 | 907 |  	} else { | 
| 908 | 908 | $layout = 'table'; | 
| 909 | 909 | } | 
| 910 | 910 | |
| 911 | -	switch ( $layout ) { | |
| 911 | +	switch ($layout) { | |
| 912 | 912 | case 'list': | 
| 913 | 913 | $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; | 
| 914 | 914 | break; | 
| @@ -921,8 +921,8 @@ discard block | ||
| 921 | 921 | $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; | 
| 922 | 922 | break; | 
| 923 | 923 | } | 
| 924 | - $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); | |
| 925 | -	if ( '' !== $tab_template_path ) { | |
| 924 | +	$tab_template_path = apply_filters('lsx_health_plan_workout_tab_content_path', $tab_template_path); | |
| 925 | +	if ('' !== $tab_template_path) { | |
| 926 | 926 | include $tab_template_path; | 
| 927 | 927 | } | 
| 928 | 928 | } | 
| @@ -933,26 +933,26 @@ discard block | ||
| 933 | 933 | * @return void | 
| 934 | 934 | */ | 
| 935 | 935 |  function lsx_health_plan_workout_sets() { | 
| 936 | -	if ( is_singular( 'workout' ) ) { | |
| 936 | +	if (is_singular('workout')) { | |
| 937 | 937 | global $connected_workouts; | 
| 938 | - $connected_workouts = array( get_the_ID() ); | |
| 938 | + $connected_workouts = array(get_the_ID()); | |
| 939 | 939 | } | 
| 940 | -	if ( is_singular( 'plan' ) ) { | |
| 940 | +	if (is_singular('plan')) { | |
| 941 | 941 | |
| 942 | 942 | global $connected_workouts; | 
| 943 | 943 | |
| 944 | - $section_key = get_query_var( 'section' ); | |
| 945 | -		if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { | |
| 946 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); | |
| 947 | -			if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { | |
| 944 | +		$section_key = get_query_var('section'); | |
| 945 | +		if ('' !== $section && \lsx_health_plan\functions\plan\has_sections()) { | |
| 946 | + $section_info = \lsx_health_plan\functions\plan\get_section_info($section_key); | |
| 947 | +			if (isset($section_info['connected_workouts']) && '' !== $section_info['connected_workouts']) { | |
| 948 | 948 | |
| 949 | - $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); | |
| 949 | + $connected_workouts = \lsx_health_plan\functions\prep_array($section_info['connected_workouts']); | |
| 950 | 950 | } | 
| 951 | 951 | } | 
| 952 | 952 | } | 
| 953 | 953 | $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; | 
| 954 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); | |
| 955 | -	if ( '' !== $template_path && ! empty( $template_path ) ) { | |
| 954 | +	$template_path = apply_filters('lsx_health_plan_workout_set_template_path', $template_path); | |
| 955 | +	if ('' !== $template_path && ! empty($template_path)) { | |
| 956 | 956 | include $template_path; | 
| 957 | 957 | } | 
| 958 | 958 | } | 
| @@ -963,11 +963,11 @@ discard block | ||
| 963 | 963 | * @param [type] $connected_workouts | 
| 964 | 964 | * @return void | 
| 965 | 965 | */ | 
| 966 | -function lsx_health_plan_warmup_sets( $connected_workouts ) { | |
| 966 | +function lsx_health_plan_warmup_sets($connected_workouts) { | |
| 967 | 967 | |
| 968 | 968 | $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; | 
| 969 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); | |
| 970 | -	if ( '' !== $template_path && ! empty( $template_path ) ) { | |
| 969 | +	$template_path = apply_filters('lsx_health_plan_workout_set_template_path', $template_path); | |
| 970 | +	if ('' !== $template_path && ! empty($template_path)) { | |
| 971 | 971 | include $template_path; | 
| 972 | 972 | } | 
| 973 | 973 | } | 
| @@ -978,46 +978,46 @@ discard block | ||
| 978 | 978 | * @param array $args | 
| 979 | 979 | * @return void | 
| 980 | 980 | */ | 
| 981 | -function lsx_hp_meal_plan_recipes( $args = array() ) { | |
| 981 | +function lsx_hp_meal_plan_recipes($args = array()) { | |
| 982 | 982 | $defaults = array( | 
| 983 | 983 | 'meal_id' => false, | 
| 984 | 984 | 'meal_time' => '', | 
| 985 | 985 | 'modal' => true, | 
| 986 | 986 | ); | 
| 987 | - $args = wp_parse_args( $args, $defaults ); | |
| 987 | + $args = wp_parse_args($args, $defaults); | |
| 988 | 988 | // Looking for recipes. | 
| 989 | - $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); | |
| 990 | -	if ( ! empty( $connected_recipes ) ) { | |
| 991 | - $query_args = array( | |
| 989 | + $connected_recipes = get_post_meta($args['meal_id'], $args['meal_time'] . '_recipes', true); | |
| 990 | +	if ( ! empty($connected_recipes)) { | |
| 991 | + $query_args = array( | |
| 992 | 992 | 'orderby' => 'date', | 
| 993 | 993 | 'order' => 'DESC', | 
| 994 | 994 | 'post_type' => 'recipe', | 
| 995 | 995 | 'post__in' => $connected_recipes, | 
| 996 | 996 | ); | 
| 997 | - $recipes = new WP_Query( $query_args ); | |
| 997 | + $recipes = new WP_Query($query_args); | |
| 998 | 998 | ?> | 
| 999 | 999 | <div class="recipes"> | 
| 1000 | 1000 | <div class="row eating-row"> | 
| 1001 | 1001 | <?php | 
| 1002 | -			if ( $recipes->have_posts() ) { | |
| 1003 | -				while ( $recipes->have_posts() ) { | |
| 1002 | +			if ($recipes->have_posts()) { | |
| 1003 | +				while ($recipes->have_posts()) { | |
| 1004 | 1004 | $recipes->the_post(); | 
| 1005 | -					if ( false !== $args['modal'] ) { | |
| 1005 | +					if (false !== $args['modal']) { | |
| 1006 | 1006 | \lsx_health_plan\functions\recipes\register_recipe_modal(); | 
| 1007 | 1007 | } | 
| 1008 | 1008 | ?> | 
| 1009 | 1009 | <div class="recipe-column"> | 
| 1010 | - <a data-toggle="modal" data-target="#recipe-modal-<?php echo esc_attr( get_the_ID() ); ?>" href="#recipe-modal-<?php echo esc_attr( get_the_ID() ); ?>" class="recipe-box box-shadow"> | |
| 1010 | + <a data-toggle="modal" data-target="#recipe-modal-<?php echo esc_attr(get_the_ID()); ?>" href="#recipe-modal-<?php echo esc_attr(get_the_ID()); ?>" class="recipe-box box-shadow"> | |
| 1011 | 1011 | <div class="recipe-feature-img"> | 
| 1012 | 1012 | <?php | 
| 1013 | 1013 | $featured_image = get_the_post_thumbnail(); | 
| 1014 | -								if ( ! empty( $featured_image ) && '' !== $featured_image ) { | |
| 1015 | - the_post_thumbnail( 'lsx-thumbnail-square', array( | |
| 1014 | +								if ( ! empty($featured_image) && '' !== $featured_image) { | |
| 1015 | +									the_post_thumbnail('lsx-thumbnail-square', array( | |
| 1016 | 1016 | 'class' => 'aligncenter', | 
| 1017 | - ) ); | |
| 1017 | + )); | |
| 1018 | 1018 |  								} else { | 
| 1019 | 1019 | ?> | 
| 1020 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . 'assets/images/placeholder.jpg' ); ?>"> | |
| 1020 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__DIR__) . 'assets/images/placeholder.jpg'); ?>"> | |
| 1021 | 1021 | <?php | 
| 1022 | 1022 | } | 
| 1023 | 1023 | ?> | 
| @@ -1043,25 +1043,25 @@ discard block | ||
| 1043 | 1043 | /** | 
| 1044 | 1044 | * Output the connected. | 
| 1045 | 1045 | */ | 
| 1046 | -function lsx_hp_recipe_plan_meta( $args = array() ) { | |
| 1046 | +function lsx_hp_recipe_plan_meta($args = array()) { | |
| 1047 | 1047 | $defaults = array(); | 
| 1048 | 1048 | $top_level_plans = array(); | 
| 1049 | 1049 | // Get meals this exercise is connected to. | 
| 1050 | - $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); | |
| 1051 | -	if ( ! empty( $plans ) ) { | |
| 1052 | - $plan = end( $plans ); | |
| 1053 | - $has_parent = wp_get_post_parent_id( $plan ); | |
| 1054 | -		if ( 0 === $has_parent ) { | |
| 1050 | + $plans = get_post_meta(get_the_ID(), 'connected_plans', true); | |
| 1051 | +	if ( ! empty($plans)) { | |
| 1052 | + $plan = end($plans); | |
| 1053 | + $has_parent = wp_get_post_parent_id($plan); | |
| 1054 | +		if (0 === $has_parent) { | |
| 1055 | 1055 | $top_level_plans[] = $plan; | 
| 1056 | -		} elseif ( false !== $top_level_plans ) { | |
| 1056 | +		} elseif (false !== $top_level_plans) { | |
| 1057 | 1057 | $top_level_plans[] = $has_parent; | 
| 1058 | 1058 | } | 
| 1059 | 1059 | } | 
| 1060 | -	if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { | |
| 1061 | - $top_level_plans = array_unique( $top_level_plans ); | |
| 1062 | - $top_level_plan = end( $top_level_plans ); | |
| 1060 | +	if ( ! empty($top_level_plans) && ('' !== $top_level_plans)) { | |
| 1061 | + $top_level_plans = array_unique($top_level_plans); | |
| 1062 | + $top_level_plan = end($top_level_plans); | |
| 1063 | 1063 | ?> | 
| 1064 | - <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> | |
| 1064 | + <span class="recipe-type recipe-parent"><?php echo esc_html(get_the_title($top_level_plan)); ?></span> | |
| 1065 | 1065 | <?php | 
| 1066 | 1066 | } | 
| 1067 | 1067 | } | 
| @@ -1074,23 +1074,23 @@ discard block | ||
| 1074 | 1074 | $top_level_plans = array(); | 
| 1075 | 1075 | |
| 1076 | 1076 | // Get workouts this exercise is connected to. | 
| 1077 | - $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); | |
| 1077 | + $workouts = get_post_meta(get_the_ID(), 'connected_workouts', true); | |
| 1078 | 1078 | |
| 1079 | -	if ( '' !== $workouts && ! is_array( $workouts ) ) { | |
| 1080 | - $workouts = array( $workouts ); | |
| 1079 | +	if ('' !== $workouts && ! is_array($workouts)) { | |
| 1080 | + $workouts = array($workouts); | |
| 1081 | 1081 | } | 
| 1082 | -	if ( ! empty( $workouts ) ) { | |
| 1083 | -		foreach ( $workouts as $workout ) { | |
| 1082 | +	if ( ! empty($workouts)) { | |
| 1083 | +		foreach ($workouts as $workout) { | |
| 1084 | 1084 | // Get the plans this workout is connected to. | 
| 1085 | - $plans = get_post_meta( $workout, 'connected_plans', true ); | |
| 1085 | + $plans = get_post_meta($workout, 'connected_plans', true); | |
| 1086 | 1086 | |
| 1087 | -			if ( '' !== $plans && ! is_array( $plans ) ) { | |
| 1088 | - $plans = array( $plans ); | |
| 1087 | +			if ('' !== $plans && ! is_array($plans)) { | |
| 1088 | + $plans = array($plans); | |
| 1089 | 1089 | } | 
| 1090 | -			if ( ! empty( $plans ) ) { | |
| 1091 | -				foreach ( $plans as $plan ) { | |
| 1092 | - $has_parent = wp_get_post_parent_id( $plan ); | |
| 1093 | -					if ( 0 === $has_parent ) { | |
| 1090 | +			if ( ! empty($plans)) { | |
| 1091 | +				foreach ($plans as $plan) { | |
| 1092 | + $has_parent = wp_get_post_parent_id($plan); | |
| 1093 | +					if (0 === $has_parent) { | |
| 1094 | 1094 | $top_level_plans = $plan; | 
| 1095 | 1095 |  					} else { | 
| 1096 | 1096 | $top_level_plans = $has_parent; | 
| @@ -1100,11 +1100,11 @@ discard block | ||
| 1100 | 1100 | } | 
| 1101 | 1101 | } | 
| 1102 | 1102 | |
| 1103 | -	if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { | |
| 1104 | - $top_level_plans = array_unique( $top_level_plans ); | |
| 1105 | - $top_level_plan = end( $top_level_plans ); | |
| 1103 | +	if ( ! empty($top_level_plans) && ('' !== $top_level_plans)) { | |
| 1104 | + $top_level_plans = array_unique($top_level_plans); | |
| 1105 | + $top_level_plan = end($top_level_plans); | |
| 1106 | 1106 | ?> | 
| 1107 | - <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> | |
| 1107 | + <span class="recipe-type recipe-parent"><?php echo esc_html(get_the_title($top_level_plan)); ?></span> | |
| 1108 | 1108 | <?php | 
| 1109 | 1109 | } | 
| 1110 | 1110 | } | 
| @@ -1115,12 +1115,12 @@ discard block | ||
| 1115 | 1115 | * @param [type] $related_content | 
| 1116 | 1116 | * @return void | 
| 1117 | 1117 | */ | 
| 1118 | -function lsx_hp_single_related( $related_content, $post_type_text ) { | |
| 1118 | +function lsx_hp_single_related($related_content, $post_type_text) { | |
| 1119 | 1119 | ?> | 
| 1120 | 1120 | <section id="lsx-hp-related"> | 
| 1121 | 1121 | <div class="row lsx-related-posts lsx-related-posts-title"> | 
| 1122 | 1122 | <div class="col-xs-12"> | 
| 1123 | - <h2 class="lsx-related-posts-headline"><?php echo esc_html( $post_type_text ); ?></h2> | |
| 1123 | + <h2 class="lsx-related-posts-headline"><?php echo esc_html($post_type_text); ?></h2> | |
| 1124 | 1124 | </div> | 
| 1125 | 1125 | </div> | 
| 1126 | 1126 | <div class="row lsx-related-posts lsx-related-posts-content"> | 
| @@ -1128,26 +1128,26 @@ discard block | ||
| 1128 | 1128 | <div class="lsx-related-posts-wrapper"> | 
| 1129 | 1129 | <?php | 
| 1130 | 1130 | $i = 0; | 
| 1131 | -					foreach ( $related_content as $article ) { | |
| 1132 | - $post_title = get_the_title( $article ); | |
| 1133 | - $post_categories = wp_get_post_categories( $article ); | |
| 1134 | - $post_link = get_permalink( $article ); | |
| 1131 | +					foreach ($related_content as $article) { | |
| 1132 | + $post_title = get_the_title($article); | |
| 1133 | + $post_categories = wp_get_post_categories($article); | |
| 1134 | + $post_link = get_permalink($article); | |
| 1135 | 1135 | |
| 1136 | 1136 | $cats = array(); | 
| 1137 | 1137 | ?> | 
| 1138 | - <article id="post-<?php echo esc_html( $article ); ?>" class="lsx-slot post"> | |
| 1138 | + <article id="post-<?php echo esc_html($article); ?>" class="lsx-slot post"> | |
| 1139 | 1139 | <div class="entry-layout lsx-hp-shadow"> | 
| 1140 | 1140 | <div class="entry-layout-content"> | 
| 1141 | 1141 | <header class="entry-header"> | 
| 1142 | 1142 | <div class="entry-image"> | 
| 1143 | - <a href="<?php echo esc_url( $post_link ); ?>" class="thumbnail"> | |
| 1143 | + <a href="<?php echo esc_url($post_link); ?>" class="thumbnail"> | |
| 1144 | 1144 | <?php | 
| 1145 | - $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); | |
| 1146 | -											if ( ! empty( $featured_image ) && '' !== $featured_image ) { | |
| 1147 | - echo wp_kses_post( $featured_image ); | |
| 1145 | + $featured_image = get_the_post_thumbnail($article, 'lsx-thumbnail-wide'); | |
| 1146 | +											if ( ! empty($featured_image) && '' !== $featured_image) { | |
| 1147 | + echo wp_kses_post($featured_image); | |
| 1148 | 1148 |  											} else { | 
| 1149 | 1149 | ?> | 
| 1150 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> | |
| 1150 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> | |
| 1151 | 1151 | <?php | 
| 1152 | 1152 | } | 
| 1153 | 1153 | ?> | 
| @@ -1155,18 +1155,18 @@ discard block | ||
| 1155 | 1155 | </div> | 
| 1156 | 1156 | <div class="entry-meta"> | 
| 1157 | 1157 | <?php | 
| 1158 | -										foreach ( $post_categories as $c ) { | |
| 1159 | - $cat = get_category( $c ); | |
| 1158 | +										foreach ($post_categories as $c) { | |
| 1159 | + $cat = get_category($c); | |
| 1160 | 1160 | /* Translators: %s: category name */ | 
| 1161 | - $cats[] = '<a href="' . esc_url( get_category_link( $cat->term_id ) ) . '" title="' . sprintf( esc_html__( 'Posts in %s', 'lsx-blog-customizer' ), $cat->name ) . '">' . $cat->name . '</a>'; | |
| 1161 | +											$cats[] = '<a href="' . esc_url(get_category_link($cat->term_id)) . '" title="' . sprintf(esc_html__('Posts in %s', 'lsx-blog-customizer'), $cat->name) . '">' . $cat->name . '</a>'; | |
| 1162 | 1162 | } | 
| 1163 | -										if ( ! empty( $cats ) ) { ?> | |
| 1164 | - <div class="post-categories"><span></span><?php echo wp_kses_post( implode( ', ', $cats ) ); ?></div> | |
| 1163 | +										if ( ! empty($cats)) { ?> | |
| 1164 | +											<div class="post-categories"><span></span><?php echo wp_kses_post(implode(', ', $cats)); ?></div> | |
| 1165 | 1165 | <?php } ?> | 
| 1166 | 1166 | </div> | 
| 1167 | 1167 | <h2 class="entry-title"> | 
| 1168 | - <a href="<?php echo esc_url( $post_link ); ?>"> | |
| 1169 | - <?php echo esc_html( $post_title ); ?> | |
| 1168 | + <a href="<?php echo esc_url($post_link); ?>"> | |
| 1169 | + <?php echo esc_html($post_title); ?> | |
| 1170 | 1170 | </a> | 
| 1171 | 1171 | </h2> | 
| 1172 | 1172 | </header> | 
| @@ -1190,27 +1190,27 @@ discard block | ||
| 1190 | 1190 | * @param [type] $connected_members | 
| 1191 | 1191 | * @return void | 
| 1192 | 1192 | */ | 
| 1193 | -function lsx_hp_member_connected( $connected_members, $post_type ) { | |
| 1194 | -	if ( ! empty( $connected_members ) ) { | |
| 1193 | +function lsx_hp_member_connected($connected_members, $post_type) { | |
| 1194 | +	if ( ! empty($connected_members)) { | |
| 1195 | 1195 | $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; | 
| 1196 | -		foreach ( $connected_members as $member ) { | |
| 1197 | - $post_link = get_permalink( $member ); | |
| 1198 | - $member_name = get_the_title( $member ); | |
| 1196 | +		foreach ($connected_members as $member) { | |
| 1197 | + $post_link = get_permalink($member); | |
| 1198 | + $member_name = get_the_title($member); | |
| 1199 | 1199 | $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; | 
| 1200 | 1200 | |
| 1201 | 1201 | $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; | 
| 1202 | 1202 | |
| 1203 | 1203 | $roles = ''; | 
| 1204 | - $terms = get_the_terms( $member, 'team_role' ); | |
| 1204 | + $terms = get_the_terms($member, 'team_role'); | |
| 1205 | 1205 | |
| 1206 | -			if ( $terms && ! is_wp_error( $terms ) ) { | |
| 1206 | +			if ($terms && ! is_wp_error($terms)) { | |
| 1207 | 1207 | $roles = array(); | 
| 1208 | 1208 | |
| 1209 | -				foreach ( $terms as $term ) { | |
| 1209 | +				foreach ($terms as $term) { | |
| 1210 | 1210 | $roles[] = $term->name; | 
| 1211 | 1211 | } | 
| 1212 | 1212 | |
| 1213 | - $roles = join( ', ', $roles ); | |
| 1213 | +				$roles = join(', ', $roles); | |
| 1214 | 1214 | } | 
| 1215 | 1215 | $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; | 
| 1216 | 1216 | |