Skip to content

Commit

Permalink
Improved filtering GET parameters #99
Browse files Browse the repository at this point in the history
  • Loading branch information
zahardev committed Jun 14, 2023
1 parent 282c83c commit 84cf51f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions php/classes/class-ssp-stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,10 @@ public function set_filters() {
}

// Set episode selection for charts
// Can be either integer or string 'all'
if ( isset( $_GET['episode'] ) ) {
$this->episode = sanitize_text_field( $_GET['episode'] );
$episode = sanitize_text_field( $_GET['episode'] );
$this->episode = is_numeric( $episode ) ? intval( $episode ) : 'all';
}

// Set filter selection for charts
Expand All @@ -285,13 +287,13 @@ public function load_episode_ids () {
if( $this->episode_ids ) {
$this->episode_ids .= ',';
}
$this->episode_ids .= $episode->ID;
$this->episode_ids .= intval( $episode->ID );
}
}
break;

case 'episode':
if( 'all' != $this->episode ) {
if ( 'all' != $this->episode && is_integer( $this->episode ) ) {
$this->episode_ids = $this->episode;
}
break;
Expand Down Expand Up @@ -520,7 +522,7 @@ public function stats_page () {
}
break;
case 'episode':
if( 'all' != $this->episode ) {
if ( 'all' != $this->episode && is_integer( $this->episode ) ) {
$episode_name = get_the_title( $this->episode );
if( $episode_name ) {
$title_tail = sprintf( __( 'for Episode: %s', 'seriously-simple-stats' ), '<u>' . $episode_name . '</u>' );
Expand Down

0 comments on commit 84cf51f

Please sign in to comment.