From 051d3e30550f77e221857226da53052a03d20c8e Mon Sep 17 00:00:00 2001 From: savvasha Date: Sat, 13 Nov 2021 07:59:02 +0200 Subject: [PATCH] Escapes based on phpcs #11 --- includes/admin/class-sp-admin-welcome.php | 4 +-- .../class-sp-admin-cpt-calendar.php | 14 +++++----- .../post-types/class-sp-admin-cpt-event.php | 24 ++++++++--------- .../post-types/class-sp-admin-cpt-list.php | 12 ++++----- .../class-sp-admin-cpt-performance.php | 2 +- .../post-types/class-sp-admin-cpt-player.php | 24 ++++++++--------- .../class-sp-admin-cpt-statistic.php | 2 +- .../post-types/class-sp-admin-cpt-table.php | 10 +++---- .../post-types/class-sp-admin-cpt-team.php | 6 ++--- .../class-sp-meta-box-event-performance.php | 26 +++++++++---------- 10 files changed, 62 insertions(+), 62 deletions(-) diff --git a/includes/admin/class-sp-admin-welcome.php b/includes/admin/class-sp-admin-welcome.php index a920b69d..dd23c65a 100644 --- a/includes/admin/class-sp-admin-welcome.php +++ b/includes/admin/class-sp-admin-welcome.php @@ -329,7 +329,7 @@ class SP_Admin_Welcome {
intro(); ?> -

Contribute to SportsPress.', 'sportspress' ), 'https://github.com/ThemeBoy/SportsPress/blob/master/CONTRIBUTING.md' ); ?>

+

Contribute to SportsPress.', 'sportspress' ) ), 'https://github.com/ThemeBoy/SportsPress/blob/master/CONTRIBUTING.md' ); ?>

contributors() ); ?> @@ -347,7 +347,7 @@ class SP_Admin_Welcome { intro(); ?> -

Translate SportsPress.', 'sportspress' ), 'https://translate.wordpress.org/projects/wp-plugins/sportspress' ); ?>

+

Translate SportsPress.', 'sportspress' ) ), 'https://translate.wordpress.org/projects/wp-plugins/sportspress' ); ?>

post_title ); if ( $team_id == $current_team ) : - echo ''; + echo ''; endif; echo '
'; endif; @@ -102,7 +102,7 @@ if ( ! class_exists( 'SP_Admin_CPT_Calendar' ) ) : break; case 'sp_events': $calendar = new SP_Calendar( $post_id ); - echo sizeof( $calendar->data() ); + echo esc_html( sizeof( $calendar->data() ) ); break; case 'sp_layout': echo esc_html( sp_array_value( SP()->formats->calendar, get_post_meta( $post_id, 'sp_format', true ), '—' ) ); @@ -146,7 +146,7 @@ if ( ! class_exists( 'SP_Admin_CPT_Calendar' ) ) : 'selected' => $selected, 'values' => 'ID', ); - wp_dropdown_pages( $args ); + esc_html ( wp_dropdown_pages( $args ) ); } /** diff --git a/includes/admin/post-types/class-sp-admin-cpt-event.php b/includes/admin/post-types/class-sp-admin-cpt-event.php index 4db3ca95..b126de95 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-event.php +++ b/includes/admin/post-types/class-sp-admin-cpt-event.php @@ -188,11 +188,11 @@ if ( ! class_exists( 'SP_Admin_CPT_Event' ) ) : $formats = new SP_Formats(); $event_formats = $formats->event; if ( array_key_exists( $format, $event_formats ) ) : - echo ''; + echo ''; endif; break; case 'sp_time': - echo apply_filters( 'sportspress_event_time_admin', get_post_time( 'H:i', false, $post_id, true ) ); + echo wp_kses_post( apply_filters( 'sportspress_event_time_admin', get_post_time( 'H:i', false, $post_id, true ) ) ); break; case 'sp_team': $teams = (array) get_post_meta( $post_id, 'sp_team', false ); @@ -207,7 +207,7 @@ if ( ! class_exists( 'SP_Admin_CPT_Event' ) ) : else : $results = get_post_meta( $post_id, 'sp_results', true ); $main_result = get_option( 'sportspress_primary_result', null ); - echo ''; + echo ''; echo '
'; foreach ( $teams as $team_id ) : if ( ! $team_id ) { @@ -236,7 +236,7 @@ if ( ! class_exists( 'SP_Admin_CPT_Event' ) ) : $team_results = implode( ' | ', $team_results ); endif; - echo '' . ( $team_result == '' ? '-' : apply_filters( 'sportspress_event_team_result_admin', $team_result, $post_id, $team_id ) ) . ''; + echo '' . ( $team_result == '' ? '-' : wp_kses_post( apply_filters( 'sportspress_event_team_result_admin', $team_result, $post_id, $team_id ) ) ) . ''; echo ' '; echo esc_html( $team->post_title ); echo '
'; @@ -245,23 +245,23 @@ if ( ! class_exists( 'SP_Admin_CPT_Event' ) ) : echo '
'; if ( current_user_can( 'edit_others_sp_events' ) ) { ?> -
+
$selected, 'values' => 'ID', ); - wp_dropdown_pages( $args ); + esc_html( wp_dropdown_pages( $args ) ); $selected = isset( $_REQUEST['sp_league'] ) ? sanitize_key( $_REQUEST['sp_league'] ) : null; $args = array( @@ -312,7 +312,7 @@ if ( ! class_exists( 'SP_Admin_CPT_Event' ) ) : sp_dropdown_taxonomies( $args ); $selected = isset( $_REQUEST['match_day'] ) ? sanitize_text_field( $_REQUEST['match_day'] ) : null; - echo ''; + echo ''; if ( current_user_can( 'edit_others_sp_events' ) ) { wp_nonce_field( 'sp-save-inline-results', 'sp-inline-nonce', false ); diff --git a/includes/admin/post-types/class-sp-admin-cpt-list.php b/includes/admin/post-types/class-sp-admin-cpt-list.php index d1dc656c..7b92b7c5 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-list.php +++ b/includes/admin/post-types/class-sp-admin-cpt-list.php @@ -72,22 +72,22 @@ if ( ! class_exists( 'SP_Admin_CPT_List' ) ) : $select = get_post_meta( $post_id, 'sp_select', true ); if ( 'manual' == $select ) : $players = array_filter( get_post_meta( $post_id, 'sp_player' ) ); - echo sizeof( $players ); + echo esc_html( sizeof( $players ) ); else : - _e( 'Auto', 'sportspress' ); + esc_html_e( 'Auto', 'sportspress' ); endif; break; case 'sp_league': - echo get_the_terms( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : __( 'All', 'sportspress' ); + echo get_the_terms( $post_id, 'sp_league' ) ? wp_kses_post( the_terms( $post_id, 'sp_league' ) ) : esc_html__( 'All', 'sportspress' ); break; case 'sp_season': - echo get_the_terms( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : __( 'All', 'sportspress' ); + echo get_the_terms( $post_id, 'sp_season' ) ? wp_kses_post( the_terms( $post_id, 'sp_season' ) ) : esc_html__( 'All', 'sportspress' ); break; case 'sp_team': $teams = (array) get_post_meta( $post_id, 'sp_team', false ); $teams = array_filter( $teams ); if ( empty( $teams ) ) : - echo __( 'All', 'sportspress' ); + echo esc_html__( 'All', 'sportspress' ); else : foreach ( $teams as $team_id ) : if ( ! $team_id ) { @@ -142,7 +142,7 @@ if ( ! class_exists( 'SP_Admin_CPT_List' ) ) : 'selected' => $selected, 'values' => 'ID', ); - wp_dropdown_pages( $args ); + esc_html( wp_dropdown_pages( $args ) ); } /** diff --git a/includes/admin/post-types/class-sp-admin-cpt-performance.php b/includes/admin/post-types/class-sp-admin-cpt-performance.php index 4f66d031..32e032c7 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-performance.php +++ b/includes/admin/post-types/class-sp-admin-cpt-performance.php @@ -61,7 +61,7 @@ if ( ! class_exists( 'SP_Admin_CPT_Performance' ) ) : public function custom_columns( $column, $post_id ) { switch ( $column ) : case 'sp_icon': - echo has_post_thumbnail( $post_id ) ? edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-fit-mini' ), '', '', $post_id ) : ''; + echo has_post_thumbnail( $post_id ) ? wp_kses_post( edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-fit-mini' ), '', '', $post_id ) ) : ''; break; case 'sp_key': global $post; diff --git a/includes/admin/post-types/class-sp-admin-cpt-player.php b/includes/admin/post-types/class-sp-admin-cpt-player.php index acaede58..c62c8e5b 100755 --- a/includes/admin/post-types/class-sp-admin-cpt-player.php +++ b/includes/admin/post-types/class-sp-admin-cpt-player.php @@ -102,14 +102,14 @@ if ( ! class_exists( 'SP_Admin_CPT_Player' ) ) : echo esc_html( get_post_meta( $post_id, 'sp_number', true ) ); break; case 'sp_position': - echo get_the_terms( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : '—'; + echo get_the_terms( $post_id, 'sp_position' ) ? wp_kses_post( the_terms( $post_id, 'sp_position' ) ) : '—'; break; case 'sp_team': $current_teams = get_post_meta( $post_id, 'sp_current_team', false ); $past_teams = get_post_meta( $post_id, 'sp_past_team', false ); $current_teams = array_filter( $current_teams ); $past_teams = array_filter( $past_teams ); - echo ''; + echo ''; $teams = (array) get_post_meta( $post_id, 'sp_team', false ); $teams = array_filter( $teams ); $teams = array_unique( $teams ); @@ -124,7 +124,7 @@ if ( ! class_exists( 'SP_Admin_CPT_Player' ) ) : if ( $team ) : echo esc_html( $team->post_title ); if ( in_array( $team_id, $current_teams ) ) : - echo ''; + echo ''; endif; echo '
'; endif; @@ -132,13 +132,13 @@ if ( ! class_exists( 'SP_Admin_CPT_Player' ) ) : endif; break; case 'sp_league': - echo get_the_terms( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—'; + echo get_the_terms( $post_id, 'sp_league' ) ? wp_kses_post( the_terms( $post_id, 'sp_league' ) ) : '—'; break; case 'sp_season': - echo get_the_terms( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—'; + echo get_the_terms( $post_id, 'sp_season' ) ? wp_kses_post( the_terms( $post_id, 'sp_season' ) ) : '—'; break; case 'sp_venue': - echo get_the_terms( $post_id, 'sp_venue' ) ? the_terms( $post_id, 'sp_venue' ) : '—'; + echo get_the_terms( $post_id, 'sp_venue' ) ? wp_kses_post( the_terms( $post_id, 'sp_venue' ) ) : '—'; break; endswitch; } @@ -172,7 +172,7 @@ if ( ! class_exists( 'SP_Admin_CPT_Player' ) ) : 'selected' => $selected, 'values' => 'ID', ); - wp_dropdown_pages( $args ); + esc_html( wp_dropdown_pages( $args ) ); if ( taxonomy_exists( 'sp_league' ) ) : $selected = isset( $_REQUEST['sp_league'] ) ? sanitize_key( $_REQUEST['sp_league'] ) : null; @@ -244,7 +244,7 @@ if ( ! class_exists( 'SP_Admin_CPT_Player' ) ) :
@@ -280,14 +280,14 @@ if ( ! class_exists( 'SP_Admin_CPT_Player' ) ) : ?>
- +
- +
    @@ -367,14 +367,14 @@ if ( ! class_exists( 'SP_Admin_CPT_Player' ) ) : ?>
    - +
    - +
      diff --git a/includes/admin/post-types/class-sp-admin-cpt-statistic.php b/includes/admin/post-types/class-sp-admin-cpt-statistic.php index 9e19f109..3b4739fe 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-statistic.php +++ b/includes/admin/post-types/class-sp-admin-cpt-statistic.php @@ -61,7 +61,7 @@ if ( ! class_exists( 'SP_Admin_CPT_Statistic' ) ) : public function custom_columns( $column, $post_id ) { switch ( $column ) : case 'sp_icon': - echo has_post_thumbnail( $post_id ) ? edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-fit-mini' ), '', '', $post_id ) : ''; + echo has_post_thumbnail( $post_id ) ? wp_kses_post( edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-fit-mini' ), '', '', $post_id ) ) : ''; break; case 'sp_key': global $post; diff --git a/includes/admin/post-types/class-sp-admin-cpt-table.php b/includes/admin/post-types/class-sp-admin-cpt-table.php index 5b19ca83..65a17120 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-table.php +++ b/includes/admin/post-types/class-sp-admin-cpt-table.php @@ -67,18 +67,18 @@ if ( ! class_exists( 'SP_Admin_CPT_Table' ) ) : public function custom_columns( $column, $post_id ) { switch ( $column ) : case 'sp_league': - echo get_the_terms( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—'; + echo get_the_terms( $post_id, 'sp_league' ) ? wp_kses_post( the_terms( $post_id, 'sp_league' ) ) : '—'; break; case 'sp_season': - echo get_the_terms( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—'; + echo get_the_terms( $post_id, 'sp_season' ) ? wp_kses_post( the_terms( $post_id, 'sp_season' ) ) : '—'; break; case 'sp_team': $select = get_post_meta( $post_id, 'sp_select', true ); if ( 'manual' == $select ) : $teams = array_filter( get_post_meta( $post_id, 'sp_team' ) ); - echo sizeof( $teams ); + echo esc_html( sizeof( $teams ) ); else : - _e( 'Auto', 'sportspress' ); + esc_html_e( 'Auto', 'sportspress' ); endif; break; endswitch; @@ -120,7 +120,7 @@ if ( ! class_exists( 'SP_Admin_CPT_Table' ) ) : 'selected' => $selected, 'values' => 'ID', ); - wp_dropdown_pages( $args ); + esc_html( wp_dropdown_pages( $args ) ); } /** diff --git a/includes/admin/post-types/class-sp-admin-cpt-team.php b/includes/admin/post-types/class-sp-admin-cpt-team.php index 3ab56d69..057ab716 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-team.php +++ b/includes/admin/post-types/class-sp-admin-cpt-team.php @@ -89,7 +89,7 @@ if ( ! class_exists( 'SP_Admin_CPT_Team' ) ) : public function custom_columns( $column, $post_id ) { switch ( $column ) : case 'sp_icon': - echo has_post_thumbnail( $post_id ) ? edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-fit-mini' ), '', '', $post_id ) : ''; + echo has_post_thumbnail( $post_id ) ? wp_kses_post( edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-fit-mini' ), '', '', $post_id ) ) : ''; break; case 'sp_short_name': $short_name = get_post_meta( $post_id, 'sp_short_name', true ); @@ -100,10 +100,10 @@ if ( ! class_exists( 'SP_Admin_CPT_Team' ) ) : echo $abbreviation ? esc_html( $abbreviation ) : '—'; break; case 'sp_league': - echo get_the_terms( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—'; + echo get_the_terms( $post_id, 'sp_league' ) ? wp_kses_post( the_terms( $post_id, 'sp_league' ) ) : '—'; break; case 'sp_season': - echo get_the_terms( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—'; + echo get_the_terms( $post_id, 'sp_season' ) ? wp_kses_post( the_terms( $post_id, 'sp_season' ) ) : '—'; break; endswitch; } diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php index d6b64c08..12bc88fe 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-event-performance.php @@ -157,7 +157,7 @@ class SP_Meta_Box_Event_Performance { ?>

      - + + ">

      @@ -262,7 +262,7 @@ class SP_Meta_Box_Event_Performance { ?>

      - + + ">

      @@ -353,10 +353,10 @@ class SP_Meta_Box_Event_Performance { # - + - + $label ) : ?> @@ -383,11 +383,11 @@ endforeach; ?> - + - + @@ -409,7 +409,7 @@ endforeach;   - +   @@ -424,7 +424,7 @@ endforeach; $format = sp_array_value( $formats, $column, 'number' ); $placeholder = sp_get_format_placeholder( $format ); ?> - +   @@ -459,7 +459,7 @@ endforeach; - + @@ -545,8 +545,8 @@ endforeach; - - + +