lightspeeddevelopment /
lsx-health-plan
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * Template used to loop through the workout sets and display the workouts. |
||||
| 4 | * |
||||
| 5 | * @package lsx-health-plan |
||||
| 6 | */ |
||||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||||
| 7 | global $group_name, $connected_workouts, $shortcode_args; |
||||
| 8 | |||||
| 9 | // Check for any shortcode overrides. |
||||
| 10 | if ( null !== $shortcode_args && isset( $shortcode_args['include'] ) ) { |
||||
|
0 ignored issues
–
show
|
|||||
| 11 | $connected_workouts = array( get_the_ID() ); |
||||
| 12 | } |
||||
| 13 | ?> |
||||
| 14 | <div class="sets-wrapper"> |
||||
| 15 | <?php |
||||
| 16 | if ( empty( $connected_workouts ) || null === $connected_workouts ) { |
||||
|
0 ignored issues
–
show
|
|||||
| 17 | $connected_workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
||||
|
0 ignored issues
–
show
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
Loading history...
|
|||||
| 18 | if ( empty( $connected_workouts ) ) { |
||||
|
0 ignored issues
–
show
|
|||||
| 19 | $options = \lsx_health_plan\functions\get_option( 'all' ); |
||||
| 20 | if ( isset( $options['connected_workouts'] ) && '' !== $options['connected_workouts'] && ! empty( $options['connected_workouts'] ) ) { |
||||
|
0 ignored issues
–
show
|
|||||
| 21 | $connected_workouts = $options['connected_workouts']; |
||||
| 22 | if ( ! array( $connected_workouts ) ) { |
||||
|
0 ignored issues
–
show
|
|||||
| 23 | $connected_workouts = array( $connected_workouts ); |
||||
| 24 | } |
||||
| 25 | } |
||||
| 26 | } |
||||
| 27 | } |
||||
|
0 ignored issues
–
show
|
|||||
| 28 | $args = array( |
||||
| 29 | 'orderby' => 'date', |
||||
| 30 | 'order' => 'DESC', |
||||
| 31 | 'post_type' => 'workout', |
||||
| 32 | 'post__in' => $connected_workouts, |
||||
| 33 | ); |
||||
| 34 | $workouts = new WP_Query( $args ); |
||||
| 35 | |||||
| 36 | if ( $workouts->have_posts() ) { |
||||
|
0 ignored issues
–
show
|
|||||
| 37 | while ( $workouts->have_posts() ) { |
||||
|
0 ignored issues
–
show
|
|||||
| 38 | $workouts->the_post(); |
||||
| 39 | // Brings the workout post content first. |
||||
| 40 | echo wp_kses_post( lsx_health_plan_workout_main_content() ); |
||||
|
0 ignored issues
–
show
lsx_health_plan_workout_main_content() 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
Loading history...
|
|||||
| 41 | |||||
| 42 | $i = 1; |
||||
| 43 | $section_counter = 6; |
||||
| 44 | echo '<div class="sets">'; |
||||
| 45 | while ( $i <= $section_counter ) { |
||||
|
0 ignored issues
–
show
|
|||||
| 46 | |||||
| 47 | $workout_section = 'workout_section_' . ( $i ) . '_title'; |
||||
| 48 | $workout_desc = 'workout_section_' . ( $i ) . '_description'; |
||||
| 49 | |||||
| 50 | $section_title = get_post_meta( get_the_ID(), $workout_section, true ); |
||||
| 51 | $description = get_post_meta( get_the_ID(), $workout_desc, true ); |
||||
| 52 | if ( is_singular( 'workout' ) ) { |
||||
|
0 ignored issues
–
show
|
|||||
| 53 | $section_title = get_post_meta( get_queried_object_id(), $workout_section, true ); |
||||
| 54 | $description = get_post_meta( get_queried_object_id(), $workout_desc, true ); |
||||
| 55 | } |
||||
| 56 | |||||
| 57 | if ( '' === $section_title ) { |
||||
|
0 ignored issues
–
show
|
|||||
| 58 | $i++; |
||||
| 59 | continue; |
||||
| 60 | } |
||||
| 61 | ?> |
||||
| 62 | <div class="set-box set content-box"> |
||||
| 63 | <h3 class="set-title"><?php echo esc_html( $section_title ); ?></h3> |
||||
|
0 ignored issues
–
show
It seems like
$section_title can also be of type false; however, parameter $text of esc_html() 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
Loading history...
|
|||||
| 64 | <div class="set-content"> |
||||
| 65 | <p><?php echo wp_kses_post( apply_filters( 'the_content', $description ) ); ?></p> |
||||
|
0 ignored issues
–
show
It seems like
apply_filters('the_content', $description) 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
Loading history...
|
|||||
| 66 | </div> |
||||
| 67 | <?php lsx_health_plan_workout_tab_content( $i ); ?> |
||||
| 68 | </div> |
||||
| 69 | <?php |
||||
| 70 | $i++; |
||||
| 71 | } |
||||
|
0 ignored issues
–
show
|
|||||
| 72 | echo '</div>'; |
||||
| 73 | } |
||||
| 74 | ?> |
||||
| 75 | <?php } ?> |
||||
| 76 | <?php wp_reset_postdata(); ?> |
||||
| 77 | </div> |
||||
| 78 | <?php |
||||
| 79 |