1 | <?php |
||||||
2 | /** |
||||||
3 | * The Template for displaying the single day plan and its connected items |
||||||
4 | * |
||||||
5 | * @package lsx-health-plan |
||||||
6 | */ |
||||||
7 | |||||||
8 | get_header(); ?> |
||||||
9 | |||||||
10 | <?php lsx_content_wrap_before(); ?> |
||||||
11 | |||||||
12 | <?php |
||||||
13 | $args = array( |
||||||
14 | 'post_parent' => get_the_ID(), |
||||||
15 | 'post_type' => 'plan', |
||||||
16 | ); |
||||||
17 | |||||||
18 | $plan_id = get_the_ID(); |
||||||
19 | $has_sections = \lsx_health_plan\functions\plan\has_sections( $plan_id ); |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
20 | $restricted = false; |
||||||
21 | $is_section = get_query_var( 'section', false ); |
||||||
22 | |||||||
23 | // Getting translated endpoint. |
||||||
24 | $plan = \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ); |
||||||
25 | |||||||
26 | $connected_members = get_post_meta( get_the_ID(), ( $plan . '_connected_team_member' ), true ); |
||||||
0 ignored issues
–
show
Are you sure
$plan of type array|mixed can be used in concatenation ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() It seems like
get_the_ID() can also be of type false ; however, parameter $post_id of get_post_meta() 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
![]() |
|||||||
27 | $connected_articles = get_post_meta( get_the_ID(), ( $plan . '_connected_articles' ), true ); |
||||||
28 | $small_description = get_post_meta( get_the_ID(), ( $plan . '_short_description' ), true ); |
||||||
29 | |||||||
30 | if ( ! empty( $has_sections ) && empty( $is_section ) ) { |
||||||
0 ignored issues
–
show
|
|||||||
31 | $plan_type_class = 'parent-plan'; |
||||||
32 | } |
||||||
0 ignored issues
–
show
|
|||||||
33 | if ( ! empty( $has_sections ) && ! empty( $is_section ) ) { |
||||||
0 ignored issues
–
show
|
|||||||
34 | $plan_type_class = 'child-plan'; |
||||||
35 | } |
||||||
36 | |||||||
37 | // Get the plan restrictions. |
||||||
38 | if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
||||||
0 ignored issues
–
show
|
|||||||
39 | $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
||||||
40 | } |
||||||
0 ignored issues
–
show
|
|||||||
41 | if ( false === $restricted ) { |
||||||
0 ignored issues
–
show
|
|||||||
42 | $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
||||||
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\get_progress() 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
![]() |
|||||||
43 | } |
||||||
44 | ?> |
||||||
45 | |||||||
46 | <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
||||||
47 | |||||||
48 | <?php lsx_content_before(); ?> |
||||||
49 | |||||||
50 | <main id="main" class="site-main <?php echo esc_html( $plan_type_class ); ?>" role="main"> |
||||||
51 | |||||||
52 | <?php lsx_content_top(); ?> |
||||||
53 | |||||||
54 | <div class="post-wrapper"> |
||||||
55 | <?php if ( ! empty( $has_sections ) && empty( $is_section ) ) { ?> |
||||||
0 ignored issues
–
show
|
|||||||
56 | <div class="plan-content"> |
||||||
57 | <?php the_content(); ?> |
||||||
58 | </div> |
||||||
59 | <?php } ?> |
||||||
60 | |||||||
61 | <?php |
||||||
62 | if ( ! empty( $has_sections ) ) { |
||||||
0 ignored issues
–
show
|
|||||||
63 | if ( false === $is_section ) { |
||||||
0 ignored issues
–
show
|
|||||||
64 | ?> |
||||||
65 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
||||||
66 | <div class="entry-content"> |
||||||
67 | <div class="single-plan-inner main-plan-content"> |
||||||
68 | <div class="single-plan-section-title title-lined"> |
||||||
69 | <?php lsx_get_svg_icon( 'my-plan.svg' ); ?> |
||||||
70 | <h2><?php echo esc_html_e( 'Your Plan', 'lsx-health-plan' ); ?></h2> |
||||||
71 | <?php if ( class_exists( 'LSX_Sharing' ) ) { |
||||||
0 ignored issues
–
show
|
|||||||
72 | lsx_content_sharing(); |
||||||
73 | } ?> |
||||||
0 ignored issues
–
show
|
|||||||
74 | </div> |
||||||
75 | <div class="plan"> |
||||||
76 | <div class="set-box set content-box entry-content"> |
||||||
77 | <div class="plan-top-content"> |
||||||
78 | <?php |
||||||
79 | if ( $connected_members ) { |
||||||
0 ignored issues
–
show
|
|||||||
80 | echo wp_kses_post( lsx_hp_member_connected( $connected_members, $plan ) ); |
||||||
0 ignored issues
–
show
lsx_hp_member_connected($connected_members, $plan) of type void is incompatible with the type string expected by parameter $data of wp_kses_post() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
81 | } |
||||||
0 ignored issues
–
show
|
|||||||
82 | if ( false === $restricted ) { |
||||||
0 ignored issues
–
show
|
|||||||
83 | echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . $round_progress . '" max="100"> ' . $round_progress . '% </progress><span>' . $round_progress . '%</span></span>' ); |
||||||
84 | } |
||||||
0 ignored issues
–
show
|
|||||||
85 | if ( $small_description ) { |
||||||
0 ignored issues
–
show
|
|||||||
86 | ?> |
||||||
87 | <div class="the-content"> |
||||||
88 | <span><?php echo esc_html( $small_description ); ?></span> |
||||||
89 | </div> |
||||||
90 | <?php |
||||||
91 | } |
||||||
92 | ?> |
||||||
93 | </div> |
||||||
94 | <?php |
||||||
95 | if ( lsx_health_plan_has_tips() ) { |
||||||
0 ignored issues
–
show
|
|||||||
96 | echo wp_kses_post( do_shortcode( '[lsx_health_plan_featured_tips_block]' ) ); |
||||||
97 | } ?> |
||||||
0 ignored issues
–
show
|
|||||||
98 | </div> |
||||||
99 | <div class="the-plan-content"> |
||||||
100 | <?php |
||||||
101 | echo do_shortcode( '[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]' ); |
||||||
0 ignored issues
–
show
Are you sure
get_the_ID() of type false|integer can be used in concatenation ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
102 | |||||||
103 | ?> |
||||||
104 | <div class="row status-plan-buttons main-plan-btn"> |
||||||
105 | <?php |
||||||
106 | if ( function_exists( 'wc_get_page_id' ) ) { |
||||||
0 ignored issues
–
show
|
|||||||
107 | ?> |
||||||
108 | <a class="btn border-btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a> |
||||||
0 ignored issues
–
show
It seems like
get_permalink(wc_get_page_id('myaccount')) can also be of type false ; however, parameter $data of wp_kses_post() does only seem to accept string , 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
![]() |
|||||||
109 | <?php |
||||||
110 | } |
||||||
111 | ?> |
||||||
112 | </div> |
||||||
113 | </div> |
||||||
114 | </div> |
||||||
115 | |||||||
116 | </div> |
||||||
117 | </div><!-- .entry-content --> |
||||||
118 | </article> |
||||||
119 | <?php |
||||||
120 | } else { |
||||||
121 | lsx_health_plan_single_nav(); |
||||||
122 | lsx_health_plan_single_tabs(); |
||||||
123 | } |
||||||
124 | } |
||||||
125 | ?> |
||||||
126 | </div> |
||||||
127 | |||||||
128 | <?php |
||||||
129 | // Show the buttons on the single plan tabs. |
||||||
130 | if ( ! empty( $has_sections ) && false !== $is_section ) { |
||||||
0 ignored issues
–
show
|
|||||||
131 | ?> |
||||||
132 | <div class="row status-plan-buttons"> |
||||||
133 | <?php lsx_health_plan_day_button(); ?> |
||||||
134 | </div> |
||||||
135 | <?php |
||||||
136 | } |
||||||
137 | ?> |
||||||
138 | |||||||
139 | <?php lsx_content_bottom(); ?> |
||||||
140 | |||||||
141 | <?php |
||||||
142 | if ( ! empty( $connected_articles ) ) { |
||||||
0 ignored issues
–
show
|
|||||||
143 | lsx_hp_single_related( $connected_articles, __( 'Latest articles', 'lsx-health-plan' ) ); |
||||||
144 | } |
||||||
145 | ?> |
||||||
146 | |||||||
147 | |||||||
148 | </main><!-- #main --> |
||||||
149 | |||||||
150 | <?php lsx_content_after(); ?> |
||||||
151 | |||||||
152 | </div><!-- #primary --> |
||||||
153 | |||||||
154 | <?php lsx_content_wrap_after(); ?> |
||||||
155 | |||||||
156 | <?php get_sidebar(); ?> |
||||||
157 | |||||||
158 | <?php |
||||||
159 | get_footer(); |
||||||
160 |