apply_filters( 'sports_bench_individual_game_stats', $html, $stats, $team, $away_home, $sport )

Type

Filters

Section

Game Recap

Outputs the HTML table for a team’s individual stats for a game

Parameters

  • $html, string, the current HTML for the individual stats table
  • $stats, array, the stats for the table
  • $team, Sports_Bench_Team object, the team object for the team
  • $away_home, string, whether the team is the away or home team
  • $sport, string, the sport that's being used on the site

Returns

  • string, the HTML for the individual stats table

Since: 1.5

Source: baseball-game-info.php, line 144, 165; basketball-game-info.php, line 74, 95; football-game-info.php, line 107, 138; hockey-game-info.php, line 97, 118; rugby-game-info.php, line 96, 117; soccer-game-info.php, line 94, 115; volleyball-game-info.php, line 99, 120

Example

/**
 * Returns the html for the individual stats table for a team in a game recap
 *
 * @param string $html
 *
 * @param array $stats
 *
 * @param Sports_Bench_Team $team
 *
 * @param string $team_type
 *
 * @param string $sport
 *
 * @return string, html for individual stats table
 *
 * @since 1.5
 */
function sports_bench_do_individual_game_stats( $html, $stats, $team, $team_type, $sport ) {
	if ( 'away' == $team_type ) {
		$table_class = 'away-team';
	} else {
		$table_class = 'home-team';
	}

	if ( 'baseball' == $sport ) {
		$html = '';
		$html .= '';
		$table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team );
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		foreach ( $stats as $stat ) {
			if ( $stat->game_player_position != 'P' ) {
				$player = new Sports_Bench_Player( (int)$stat->player_id );
				$player_name = $player->player_first_name . ' ' . $player->player_last_name;
				$table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team );
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
				$html .= '';
			}
		}
		$html .= '';
		$html .= '
ABHRRBISOBB
' . $player_name . ', ' . $stat->game_player_position . '' . $stat->game_player_at_bats . '' . $stat->game_player_hits . '' . $stat->game_player_runs . '' . $stat->game_player_rbis . '' . $stat->game_player_strikeouts . '' . $stat->game_player_walks . '
'; $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $stats as $stat ) { if ( $stat->game_player_position == 'P' ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; if ( $stat->game_player_decision != 'ND' ) { if ( $stat->game_player_decision == 'W' or $stat->game_player_decision == 'L' ) { $record = sports_bench_get_pitcher_record( (int)$stat->player_id, '"' . get_option( 'sports-bench-season-year' ) . '"' ); $decision = ', ' . $stat->game_player_decision . ' (' . $record[ 'wins' ] . '-' . $record[ 'losses' ] . ')'; } elseif ( $stat->game_player_decision == 'S' ) { $saves = sports_bench_get_pitcher_saves( (int)$stat->player_id, '"' . get_option( 'sports-bench-season-year' ) . '"' ); $decision = ', ' . $stat->game_player_decision . ' (' . $saves . ')'; } else { $decision = ', ' . $stat->game_player_decision; } } else { $decision = ''; } $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } } $html .= ''; $html .= '
IPRERHSOBBNP
' . $player_name . $decision . '' . $stat->game_player_innings_pitched . '' . $stat->game_player_runs_allowed . '' . $stat->game_player_earned_runs . '' . $stat->game_player_hits_allowed . '' . $stat->game_player_pitcher_strikeouts . '' . $stat->game_player_pitcher_walks . '' . $stat->game_player_pitch_count . '
'; } elseif ( 'basketball' == $sport ) { $html = ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $stats as $stat ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; if ( strlen( $stat->game_player_minutes ) == 8 ) { $minutes = substr_replace( $stat->game_player_minutes, "", 0, 3 ); } elseif ( strlen( $stat->game_player_minutes ) == 7 ) { $minutes = substr_replace( $stat->game_player_minutes, "", 0, 2 ); } elseif ( strlen( $stat->game_player_minutes ) == 6 ) { $minutes = substr_replace( $stat->game_player_minutes, "", 0, 1 ); } else { $minutes = $stat->game_player_minutes; } $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Scoring', 'sports-bench' ) . 'MINFG3-PTFT+/-PTS
' . $player_name . '' . $minutes . '' . $stat->game_player_fgm . '-' . $stat->game_player_fga . '' . $stat->game_player_3pm . '-' . $stat->game_player_3pa . '' . $stat->game_player_ftm . '-' . $stat->game_player_fta . '' . $stat->game_player_plus_minus . '' . $stat->game_player_points . '
'; $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $stats as $stat ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; $rebounds = $stat->game_player_off_rebound + $stat->game_player_def_rebound; $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'REBOUNDS', 'sports-bench' ) . '
OFFDEFTOTASTSTLBLKTOF
' . $player_name . '' . $stat->game_player_off_rebound . '' . $stat->game_player_def_rebound . '' . $rebounds . '' . $stat->game_player_assists . '' . $stat->game_player_steals . '' . $stat->game_player_blocks . '' . $stat->game_player_to . '' . $stat->game_player_fouls . '
'; } elseif ( 'football' == $sport ) { $passers = $stats[0]; $rushers = $stats[1]; $receivers = $stats[2]; $defenders = $stats[3]; $kickers = $stats[4]; $returners = $stats[5]; $html = ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $passers as $stat ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Passing', 'sports-bench' ) . 'COMPATTYARDSTDINT
' . $player_name . '' . $stat->game_player_completions . '' . $stat->game_player_attempts . '' . $stat->game_player_pass_yards . '' . $stat->game_player_pass_tds . '' . $stat->game_player_pass_ints . '
'; $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $rushers as $stat ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Rushing', 'sports-bench' ) . 'RUSHESYARDSTDFUMBLES
' . $player_name . '' . $stat->game_player_rushes . '' . $stat->game_player_rush_yards . '' . $stat->game_player_rush_tds . '' . $stat->game_player_rush_fumbles . '
'; $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $receivers as $stat ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Receiving', 'sports-bench' ) . 'RECYARDSTDFUMBLES
' . $player_name . '' . $stat->game_player_catches . '' . $stat->game_player_receiving_yards . '' . $stat->game_player_receiving_tds . '' . $stat->game_player_receiving_fumbles . '
'; $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $defenders as $stat ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Defense', 'sports-bench' ) . 'TKLTFLSPBINTTDFFFRBLKYDS
' . $player_name . '' . $stat->game_player_tackles . '' . $stat->game_player_tfl . '' . $stat->game_player_sacks . '' . $stat->game_player_pbu . '' . $stat->game_player_ints . '' . $stat->game_player_tds . '' . $stat->game_player_ff . '' . $stat->game_player_fr . '' . $stat->game_player_blocked . '' . $stat->game_player_yards . '
'; $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $kickers as $stat ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Kicking', 'sports-bench' ) . 'FGMFGAXPMXPATB
' . $player_name . '' . $stat->game_player_fgm . '' . $stat->game_player_fga . '' . $stat->game_player_xpm . '' . $stat->game_player_xpa . '' . $stat->game_player_touchbacks . '
'; $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $returners as $stat ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Kick Returns', 'sports-bench' ) . 'RETURNSYARDSTDFUM
' . $player_name . '' . $stat->game_player_returns . '' . $stat->game_player_return_yards . '' . $stat->game_player_return_tds . '' . $stat->game_player_return_fumbles . '
'; } elseif ( 'hockey' == $sport ) { $html = ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $stats as $stat ) { if ( $stat->game_player_shots_faced == 0 ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; if ( strlen( $stat->game_player_time_on_ice ) == 8 ) { $minutes = substr_replace( $stat->game_player_time_on_ice, "", 0, 3 ); } elseif ( strlen( $stat->game_player_time_on_ice ) == 7 ) { $minutes = substr_replace( $stat->game_player_time_on_ice, "", 0, 2 ); } elseif ( strlen( $stat->game_player_time_on_ice ) == 6 ) { $minutes = substr_replace( $stat->game_player_time_on_ice, "", 0, 1 ); } else { $minutes = $stat->game_player_minutes; } $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } } $html .= ''; $html .= '
GA+/-SPMHSHTOIFO-W
' . $player_name . '' . $stat->game_player_goals . '' . $stat->game_player_assists . '' . $stat->game_player_plus_minus . '' . $stat->game_player_sog . '' . $stat->game_player_pen_minutes . '' . $stat->game_player_hits . '' . $stat->game_player_shifts . '' . $minutes . '' . $stat->game_player_faceoffs . '-' . $stat->game_player_faceoff_wins . '
'; $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $stats as $stat ) { if ( $stat->game_player_shots_faced > 0 ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; if ( strlen( $stat->game_player_time_on_ice ) == 8 ) { $minutes = substr_replace( $stat->game_player_time_on_ice, "", 0, 3 ); } elseif ( strlen( $stat->game_player_time_on_ice ) == 7 ) { $minutes = substr_replace( $stat->game_player_time_on_ice, "", 0, 2 ); } elseif ( strlen( $stat->game_player_time_on_ice ) == 6 ) { $minutes = substr_replace( $stat->game_player_time_on_ice, "", 0, 1 ); } else { $minutes = $stat->game_player_minutes; } $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } } $html .= ''; $html .= '
SFSVGATOI
' . $player_name . '' . $stat->game_player_shots_faced . '' . $stat->game_player_saves . '' . $stat->game_player_goals_allowed . '' . $minutes . '
'; } elseif ( 'rugby' == $sport ) { $html = ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $stats as $stat ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'T', 'sports-bench' ) . '' . __( 'A', 'sports-bench' ) . '' . __( 'C', 'sports-bench' ) . '' . __( 'PG', 'sports-bench' ) . '' . __( 'DK', 'sports-bench' ) . '' . __( 'PTS', 'sports-bench' ) . '' . __( 'PC', 'sports-bench' ) . '' . __( 'MR', 'sports-bench' ) . '' . __( 'R', 'sports-bench' ) . '' . __( 'Y', 'sports-bench' ) . '
' . $player_name . '' . $stat->game_player_tries . '' . $stat->game_player_assists . '' . $stat->game_player_conversions . '' . $stat->game_player_penalty_goals . '' . $stat->game_player_drop_kicks . '' . $stat->game_player_points . '' . $stat->game_player_penalties_conceeded . '' . $stat->game_player_meters_run . '' . $stat->game_player_red_cards . '' . $stat->game_player_yellow_cards . '
'; } elseif ( 'soccer' == $sport ) { $html = ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $stats as $stat ) { $player = new Sports_Bench_Player( (int)$stat->game_player_id ); if ( $player->player_position != 'Keeper' ) { $player_name = $player->player_first_name . ' ' . $player->player_last_name; $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } } $html .= ''; $html .= '
MINGASHSOGFFS
' . $player_name . '' . $stat->game_player_minutes . '' . $stat->game_player_goals . '' . $stat->game_player_assists . '' . $stat->game_player_shots . '' . $stat->game_player_sog . '' . $stat->game_player_fouls . '' . $stat->game_player_fouls_suffered . '
'; $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $stats as $stat ) { $player = new Sports_Bench_Player( (int)$stat->game_player_id ); if ( $player->player_position == 'Goalkeeper' ) { $player_name = $player->player_first_name . ' ' . $player->player_last_name; $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } } $html .= ''; $html .= '
' . __( 'Goalkeepers', 'sports-bench' ) . 'MINSFSVGA
' . $player_name . '' . $stat->game_player_minutes . '' . $stat->game_player_shots_faced . '' . $stat->game_player_shots_saved . '' . $stat->game_player_goals_allowed . '
'; } elseif ( 'volleyball' == $sport ) { $html = ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $stats as $stat ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Attack', 'sports-bench' ) . 'SPPTSKHEATHIT %SSEACE
' . $player_name . '' . $stat->game_player_sets_played . '' . $stat->game_player_points . '' . $stat->game_player_kills . '' . $stat->game_player_hitting_errors . '' . $stat->game_player_attacks . '' . sports_bench_get_hitting_percentage( $stat->game_player_attacks, $stat->game_player_kills, $stat->game_player_hitting_errors) . '' . $stat->game_player_serves . '' . $stat->game_player_serve_errors . '' . $stat->game_player_aces . '
'; $html .= ''; $html .= ''; $table_head_styles = apply_filters( 'sports_bench_individual_stat_head_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ( $stats as $stat ) { $player = new Sports_Bench_Player( (int)$stat->player_id ); $player_name = $player->player_first_name . ' ' . $player->player_last_name; $table_head_styles = apply_filters( 'sports_bench_individual_stat_row', '', $team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= '
' . __( 'Defense', 'sports-bench' ) . 'SET ASET EBABBEDIGRE
' . $player_name . '' . $stat->game_player_set_attempts . '' . $stat->game_player_set_errors . '' . $stat->game_player_block_attempts . '' . $stat->game_player_blocks . '' . $stat->game_player_block_errors . '' . $stat->game_player_digs . '' . $stat->game_player_receiving_errors . '
'; } return $html; } add_filter( 'sports_bench_individual_game_stats', 'sports_bench_do_individual_game_stats', 10, 5 );