1 | <?php |
||||
2 | /** |
||||
3 | * Template used to display single planf top nav. |
||||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||||
4 | * |
||||
0 ignored issues
–
show
|
|||||
5 | * @package lsx-health-plan |
||||
0 ignored issues
–
show
|
|||||
6 | */ |
||||
0 ignored issues
–
show
|
|||||
7 | |||||
8 | $plan_link = get_permalink(); |
||||
9 | $current_section = get_query_var( 'section', false ); |
||||
10 | if ( '' !== $current_section ) { |
||||
0 ignored issues
–
show
|
|||||
11 | $plan_link = \lsx_health_plan\functions\plan\get_permalink( get_the_ID(), $current_section ); |
||||
0 ignored issues
–
show
It seems like
get_the_ID() can also be of type false ; however, parameter $plan_id of lsx_health_plan\functions\plan\get_permalink() does only seem to accept integer , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
12 | } |
||||
13 | |||||
14 | if ( false !== $current_section && \lsx_health_plan\functions\plan\has_sections() ) { |
||||
0 ignored issues
–
show
|
|||||
15 | $section_info = \lsx_health_plan\functions\plan\get_section_info( $current_section ); |
||||
16 | if ( empty( $section_info ) || ( isset( $section_info['rest_day_enabled'] ) && ! empty( $section_info['rest_day_enabled'] ) && ! lsx_health_plan_has_meal() ) ) { |
||||
0 ignored issues
–
show
|
|||||
17 | return; |
||||
18 | } |
||||
19 | } |
||||
20 | |||||
21 | ?> |
||||
22 | <div id="single-plan-nav"> |
||||
23 | <ul class="nav nav-pills"> |
||||
24 | <li class="<?php lsx_health_plan_nav_class( '' ); ?>"><a class="overview-tab" href="<?php echo esc_attr( $plan_link ); ?>"><?php lsx_get_svg_icon( 'eye.svg' ); ?> <?php esc_html_e( 'Overview', 'lsx-health-plan' ); ?></a></li> |
||||
25 | <?php |
||||
26 | if ( lsx_health_plan_has_warmup() ) { |
||||
0 ignored issues
–
show
|
|||||
27 | $warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false ); |
||||
28 | if ( false === $warm_up ) { |
||||
0 ignored issues
–
show
|
|||||
29 | $warm_up = 'warm-up'; |
||||
30 | } |
||||
31 | ?> |
||||
32 | <li class="<?php lsx_health_plan_nav_class( 'warm-up' ); ?>"><a class="warm-up-tab" href="<?php echo esc_attr( $plan_link ); ?><?php echo esc_attr( $warm_up ); ?>/"><?php lsx_get_svg_icon( 'warm.svg' ); ?> <?php esc_html_e( 'Warm-up', 'lsx-health-plan' ); ?></a></li> |
||||
33 | <?php |
||||
34 | } |
||||
0 ignored issues
–
show
|
|||||
35 | if ( lsx_health_plan_has_workout() ) { |
||||
0 ignored issues
–
show
|
|||||
36 | $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false ); |
||||
37 | if ( false === $workout ) { |
||||
0 ignored issues
–
show
|
|||||
38 | $workout = 'workout'; |
||||
39 | } |
||||
40 | ?> |
||||
41 | <li class="<?php lsx_health_plan_nav_class( 'workout' ); ?>"><a class="workout-tab" href="<?php echo esc_attr( $plan_link ); ?><?php echo esc_attr( $workout ); ?>/"><?php lsx_get_svg_icon( 'work.svg' ); ?> <?php esc_html_e( 'Workout', 'lsx-health-plan' ); ?></a></li> |
||||
42 | <?php |
||||
43 | } |
||||
0 ignored issues
–
show
|
|||||
44 | if ( lsx_health_plan_has_meal() ) { |
||||
0 ignored issues
–
show
|
|||||
45 | $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
||||
46 | if ( false === $meal ) { |
||||
0 ignored issues
–
show
|
|||||
47 | $meal = 'meal'; |
||||
48 | } |
||||
49 | ?> |
||||
50 | <li class="<?php lsx_health_plan_nav_class( 'meal' ); ?>"><a class="meal-plan-tab" href="<?php echo esc_attr( $plan_link ); ?><?php echo esc_attr( $meal ); ?>/"><?php lsx_get_svg_icon( 'meal.svg' ); ?> <?php esc_html_e( 'Meal Plan', 'lsx-health-plan' ); ?></a></li> |
||||
51 | <?php |
||||
52 | } |
||||
53 | ?> |
||||
54 | </ul> |
||||
55 | </div> |
||||
56 |