apply_filters( 'sports_bench_player_stats_table', $html, $player, $sport, $seasons )
Type
Filters
Section
Players
Outputs the HTML player’s career stats table
Parameters
- $html, string, the current HTML for the player stats table
- $player, Sports_Bench_Player object, the player object for the player
- $sport, string, the sport that's being used on the site
- $seasons, array, the stats for the player
Returns
- string, the HTML for the player's career stats table
Since: 1.5
Source: baseball-player-info.php, line 106; basketball-player-info.php, line 78; football-player-info.php, line 61; hockey-player-info.php, line 79; rugby-player-info.php, line 27; soccer-game-info.php, line 66; volleyball-player-info.php, line 51
Example
/** * Returns the html for the player stats table * * @param string $html * * @param Sports_Bench_Player $player * * @param string $sport * * @param array $seasons * * @return string, html for player stats table * * @since 1.5 */ function sports_bench_do_player_stats_table( $html, $player, $sport, $seasons ) { if ( 'baseball' == $sport ) { if ( sports_bench_stat_exists( $seasons, 'AB' ) ) { $html .= '
' . __( 'Career Batting Stats', 'sports-bench' ) . ' | '; $html .= '' . __( 'AB', 'sports-bench' ) . ' | '; $html .= '' . __( 'AVG', 'sports-bench' ) . ' | '; $html .= '' . __( 'H', 'sports-bench' ) . ' | '; $html .= '' . __( 'R', 'sports-bench' ) . ' | '; $html .= '' . __( 'RBI', 'sports-bench' ) . ' | '; $html .= '' . __( '2B', 'sports-bench' ) . ' | '; $html .= '' . __( '3B', 'sports-bench' ) . ' | '; $html .= '' . __( 'HR', 'sports-bench' ) . ' | '; $html .= '' . __( 'SO', 'sports-bench' ) . ' | '; $html .= '' . __( 'BB', 'sports-bench' ) . ' | '; $html .= '' . __( 'HBP', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|---|---|---|---|---|---|---|
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $season->AB . ' | '; $html .= '' . $batting_average . ' | '; $html .= '' . $season->HITS . ' | '; $html .= '' . $season->RUNS . ' | '; $html .= '' . $season->RBI . ' | '; $html .= '' . $season->DOUBLES . ' | '; $html .= '' . $season->TRIPLES . ' | '; $html .= '' . $season->HOMERUNS . ' | '; $html .= '' . $season->STRIKEOUTS . ' | '; $html .= '' . $season->WALKS . ' | '; $html .= '' . $season->HIT_BY_PITCH . ' | '; $html .= '
' . __( 'Career Pitching Stats', 'sports-bench' ) . ' | '; $html .= '' . __( 'W-L', 'sports-bench' ) . ' | '; $html .= '' . __( 'SV', 'sports-bench' ) . ' | '; $html .= '' . __( 'IP', 'sports-bench' ) . ' | '; $html .= '' . __( 'ERA', 'sports-bench' ) . ' | '; $html .= '' . __( 'R', 'sports-bench' ) . ' | '; $html .= '' . __( 'ER', 'sports-bench' ) . ' | '; $html .= '' . __( 'H', 'sports-bench' ) . ' | '; $html .= '' . __( 'K', 'sports-bench' ) . ' | '; $html .= '' . __( 'BB', 'sports-bench' ) . ' | '; $html .= '' . __( 'HPB', 'sports-bench' ) . ' | '; $html .= '' . __( 'HR', 'sports-bench' ) . ' | '; $html .= '' . __( 'PC', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|---|---|---|---|---|---|---|---|
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $record[ 'wins' ] . '-' . $record[ 'losses' ] . ' | '; $html .= '' . sports_bench_get_pitcher_saves( (int)$season->player_id, '"' . $season->game_season . '"' ) . ' | '; $html .= '' . $season->IP . ' | '; $html .= '' . sports_bench_get_ERA( (int) $season->ER, (int) $season->IP, 9 ) . ' | '; $html .= '' . $season->RA . ' | '; $html .= '' . $season->ER . ' | '; $html .= '' . $season->HA . ' | '; $html .= '' . $season->KS . ' | '; $html .= '' . $season->BB . ' | '; $html .= '' . $season->HPB . ' | '; $html .= '' . $season->HRA . ' | '; $html .= '' . $season->PC . ' | '; $html .= '
' . sports_bench_show_stats_abbreviation_guide() . '
'; } elseif ( 'basketball' == $sport ) { $html .= ''; $html .= ' | '; $html .= ' | '; $html .= ' | '; $html .= ' | '; $html .= ' | '; $html .= ' | '; $html .= ' | '; $html .= ' | '; $html .= ' | ' . __( 'REBOUNDS', 'sports-bench' ) . ' | '; $html .= ''; $html .= ' | '; $html .= ' | '; $html .= ' | '; $html .= ' | '; $html .= ' | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
'; $html .= ' | ' . __( 'GP', 'sports-bench' ) . ' | '; $html .= '' . __( 'ST', 'sports-bench' ) . ' | '; $html .= '' . __( 'MIN', 'sports-bench' ) . ' | '; $html .= '' . __( 'FG', 'sports-bench' ) . ' | '; $html .= '' . __( '3-PT', 'sports-bench' ) . ' | '; $html .= '' . __( 'FT', 'sports-bench' ) . ' | '; $html .= '' . __( 'PTS', 'sports-bench' ) . ' | '; $html .= '' . __( 'AVG', 'sports-bench' ) . ' | '; $html .= '' . __( 'O-D', 'sports-bench' ) . ' | '; $html .= '' . __( 'TOT', 'sports-bench' ) . ' | '; $html .= '' . __( 'A', 'sports-bench' ) . ' | '; $html .= '' . __( 'S', 'sports-bench' ) . ' | '; $html .= '' . __( 'B', 'sports-bench' ) . ' | '; $html .= '' . __( 'TO', 'sports-bench' ) . ' | '; $html .= '' . __( '+/-', 'sports-bench' ) . ' | '; $html .= '
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $season->GP . ' | '; $html .= '' . $season->STARTS . ' | '; $html .= '' . $time . ' | '; $html .= '' . $season->FGM . '-' . $season->FGA . ' | '; $html .= '' . $season->TPM . '-' . $season->TPA . ' | '; $html .= '' . $season->FTM . '-' . $season->FTA . ' | '; $html .= '' . $season->PTS . ' | '; $html .= '' . sports_bench_get_points_average( $season->PTS, $season->GP ) . ' | '; $html .= '' . $season->OFF_REB . '-' . $season->DEF_REB . ' | '; $html .= '' . ( $season->OFF_REB + $season->DEF_REB ) . ' | '; $html .= '' . $season->ASSISTS . ' | '; $html .= '' . $season->STEALS . ' | '; $html .= '' . $season->BLOCKS . ' | '; $html .= '' . $season->TURNOVERS . ' | '; $html .= '' . $season->PM . ' | '; $html .= '
' . sports_bench_show_stats_abbreviation_guide() . '
'; } elseif ( 'football' == $sport ) { if ( sports_bench_stat_exists( $seasons, 'ATT' ) ) { $html .= '' . __( 'Career Passing Stats', 'sports-bench' ) . ' | '; $html .= '' . __( 'COMP', 'sports-bench' ) . ' | '; $html .= '' . __( 'ATT', 'sports-bench' ) . ' | '; $html .= '' . __( 'YARDS', 'sports-bench' ) . ' | '; $html .= '' . __( 'TD', 'sports-bench' ) . ' | '; $html .= '' . __( 'INT', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|---|
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $season->COMP . ' | '; $html .= '' . $season->ATT . ' | '; $html .= '' . $season->PASS_YD . ' | '; $html .= '' . $season->PASS_TD . ' | '; $html .= '' . $season->PASS_INT . ' | '; $html .= '
' . __( 'Career Rushing Stats', 'sports-bench' ) . ' | '; $html .= '' . __( 'RUSHES', 'sports-bench' ) . ' | '; $html .= '' . __( 'YARDS', 'sports-bench' ) . ' | '; $html .= '' . __( 'TDS', 'sports-bench' ) . ' | '; $html .= '' . __( 'FUMBLES', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $season->RUSHES . ' | '; $html .= '' . $season->RUSH_YARDS . ' | '; $html .= '' . $season->RUSH_TD . ' | '; $html .= '' . $season->RUSH_FUM . ' | '; $html .= '
' . __( 'Career Receiving Stats', 'sports-bench' ) . ' | '; $html .= '' . __( 'CATCHES', 'sports-bench' ) . ' | '; $html .= '' . __( 'YARDS', 'sports-bench' ) . ' | '; $html .= '' . __( 'TDS', 'sports-bench' ) . ' | '; $html .= '' . __( 'FUMBLES', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $season->CATCHES . ' | '; $html .= '' . $season->RECEIVE_YARDS . ' | '; $html .= '' . $season->RECEIVE_TD . ' | '; $html .= '' . $season->RECEIVE_FUM . ' | '; $html .= '
' . __( 'Career Defensive Stats', 'sports-bench' ) . ' | '; $html .= '' . __( 'TCK', 'sports-bench' ) . ' | '; $html .= '' . __( 'TFL', 'sports-bench' ) . ' | '; $html .= '' . __( 'SACKS', 'sports-bench' ) . ' | '; $html .= '' . __( 'INTS', 'sports-bench' ) . ' | '; $html .= '' . __( 'TDS', 'sports-bench' ) . ' | '; $html .= '' . __( 'FF', 'sports-bench' ) . ' | '; $html .= '' . __( 'FR', 'sports-bench' ) . ' | '; $html .= '' . __( 'BLK', 'sports-bench' ) . ' | '; $html .= '' . __( 'YDS', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|---|---|---|---|---|
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $season->TACKLES . ' | '; $html .= '' . $season->TFL . ' | '; $html .= '' . $season->SACKS . ' | '; $html .= '' . $season->INTS . ' | '; $html .= '' . $season->TDS . ' | '; $html .= '' . $season->FF . ' | '; $html .= '' . $season->FR . ' | '; $html .= '' . $season->BLOCKED . ' | '; $html .= '' . $season->YARDS . ' | '; $html .= '
' . __( 'Career Passing Stats', 'sports-bench' ) . ' | '; $html .= '' . __( 'FGM', 'sports-bench' ) . ' | '; $html .= '' . __( 'FGA', 'sports-bench' ) . ' | '; $html .= '' . __( 'XPM', 'sports-bench' ) . ' | '; $html .= '' . __( 'XPA', 'sports-bench' ) . ' | '; $html .= '' . __( 'TOUCHBACKS', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|---|
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $season->FGM . ' | '; $html .= '' . $season->FGA . ' | '; $html .= '' . $season->XPM . ' | '; $html .= '' . $season->XPA . ' | '; $html .= '' . $season->TB . ' | '; $html .= '
' . __( 'Career Receiving Stats', 'sports-bench' ) . ' | '; $html .= '' . __( 'RETURNS', 'sports-bench' ) . ' | '; $html .= '' . __( 'YARDS', 'sports-bench' ) . ' | '; $html .= '' . __( 'TDS', 'sports-bench' ) . ' | '; $html .= '' . __( 'FUMBLES', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $season->RETURNS . ' | '; $html .= '' . $season->RETURN_YARDS . ' | '; $html .= '' . $season->RETURN_TDS . ' | '; $html .= '' . $season->RETURN_FUMBLES . ' | '; $html .= '
' . sports_bench_show_stats_abbreviation_guide() . '
'; } elseif ( 'hockey' == $sport ) { if ( sports_bench_stat_exists( $player, 'GOALS' ) or sports_bench_stat_exists( $player, 'ASSISTS' ) or sports_bench_stat_exists( $player, 'PM' ) or sports_bench_stat_exists( $player, 'SOG' ) or sports_bench_stat_exists( $player, 'PEN' ) or sports_bench_stat_exists( $player, 'PEN_MIN' ) or sports_bench_stat_exists( $player, 'HITS' ) or sports_bench_stat_exists( $player, 'SHIFTS' ) or sports_bench_stat_exists( $player, 'ICE_TIME' ) or sports_bench_stat_exists( $player, 'FACE' ) or sports_bench_stat_exists( $player, 'FACE_WINS' ) ) { $html .= '' . __( 'Career Stats', 'sports-bench' ) . ' | '; $html .= '' . __( 'G', 'sports-bench' ) . ' | '; $html .= '' . __( 'A', 'sports-bench' ) . ' | '; $html .= '' . __( 'PTS', 'sports-bench' ) . ' | '; $html .= '' . __( '+/-', 'sports-bench' ) . ' | '; $html .= '' . __( 'S', 'sports-bench' ) . ' | '; $html .= '' . __( 'P', 'sports-bench' ) . ' | '; $html .= '' . __( 'PM', 'sports-bench' ) . ' | '; $html .= '' . __( 'H', 'sports-bench' ) . ' | '; $html .= '' . __( 'SFT', 'sports-bench' ) . ' | '; $html .= '' . __( 'TOI', 'sports-bench' ) . ' | '; $html .= '' . __( 'FO-FW', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|---|---|---|---|---|---|---|
' . $the_player->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $the_player->GOALS . ' | '; $html .= '' . $the_player->ASSISTS . ' | '; $html .= '' . ( $the_player->GOALS + $the_player->ASSISTS ) . ' | '; $html .= '' . $the_player->SOG . ' | '; $html .= '' . $the_player->PM . ' | '; $html .= '' . $the_player->PEN . ' | '; $html .= '' . $the_player->PEN_MIN . ' | '; $html .= '' . $the_player->HITS . ' | '; $html .= '' . $the_player->SHIFTS . ' | '; $html .= '' . $time . ' | '; $html .= '' . $the_player->FACE . '-' . $the_player->FACE_WINS . ' | '; $html .= '
' . __( 'Career Goalie Stats', 'sports-bench' ) . ' | '; $html .= '' . __( 'SF', 'sports-bench' ) . ' | '; $html .= '' . __( 'SAVES', 'sports-bench' ) . ' | '; $html .= '' . __( 'GA', 'sports-bench' ) . ' | '; $html .= '' . __( 'GAA', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|
' . $the_player->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $the_player->SHOTS_FACED . ' | '; $html .= '' . $the_player->SAVES . ' | '; $html .= '' . $the_player->GOALS_ALLOWED . ' | '; $html .= '' . sports_bench_get_goals_against_average( (int)$the_player->GOALS_ALLOWED, (int)$the_player->GP ) . ' | '; $html .= '
' . sports_bench_show_stats_abbreviation_guide() . '
'; } elseif ( 'rugby' == $sport ) { $html .= ''; $html .= ' | ' . __( 'GP', 'sports-bench' ) . ' | '; $html .= '' . __( 'T', 'sports-bench' ) . ' | '; $html .= '' . __( 'A', 'sports-bench' ) . ' | '; $html .= '' . __( 'C', 'sports-bench' ) . ' | '; $html .= '' . __( 'PG', 'sports-bench' ) . ' | '; $html .= '' . __( 'DK', 'sports-bench' ) . ' | '; $html .= '' . __( 'PTS', 'sports-bench' ) . ' | '; $html .= '' . __( 'PC', 'sports-bench' ) . ' | '; $html .= '' . __( 'MR', 'sports-bench' ) . ' | '; $html .= '' . __( 'R', 'sports-bench' ) . ' | '; $html .= '' . __( 'Y', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|---|---|---|---|---|---|---|
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $season->GP . ' | '; $html .= '' . $season->TRIES . ' | '; $html .= '' . $season->ASSISTS . ' | '; $html .= '' . $season->CONVERSIONS . ' | '; $html .= '' . $season->PK_GOALS . ' | '; $html .= '' . $season->DROP_KICKS . ' | '; $html .= '' . $season->POINTS . ' | '; $html .= '' . $season->PENALTIES_CONCEEDED . ' | '; $html .= '' . $season->METERS_RUN . ' | '; $html .= '' . $season->REDS . ' | '; $html .= '' . $season->YELLOWS . ' | '; $html .= '
' . sports_bench_show_stats_abbreviation_guide() . '
'; } elseif ( 'soccer' == $sport ) { $html .= '' . __( 'Career Stats', 'sports-bench' ) . ' | '; $html .= '' . __( 'MIN', 'sports-bench' ) . ' | '; $html .= '' . __( 'G', 'sports-bench' ) . ' | '; $html .= '' . __( 'A', 'sports-bench' ) . ' | '; $html .= '' . __( 'SH', 'sports-bench' ) . ' | '; $html .= '' . __( 'SOG', 'sports-bench' ) . ' | '; $html .= '' . __( 'F', 'sports-bench' ) . ' | '; $html .= '' . __( 'FS', 'sports-bench' ) . ' | '; $html .= '' . __( 'SF', 'sports-bench' ) . ' | '; $html .= '' . __( 'SV', 'sports-bench' ) . ' | '; $html .= '' . __( 'GA', 'sports-bench' ) . ' | '; $html .= '' . __( 'GAA', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|---|---|---|---|---|---|---|
' . $the_player->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $the_player->MINUTES. ' | '; $html .= '' . $the_player->GOALS. ' | '; $html .= '' . $the_player->ASSISTS . ' | '; $html .= '' . $the_player->SHOTS . ' | '; $html .= '' . $the_player->SOG . ' | '; $html .= '' . $the_player->FOULS . ' | '; $html .= '' . $the_player->FOULS_SUFFERED . ' | '; $html .= '' . $the_player->SHOTS_FACED . ' | '; $html .= '' . $the_player->SHOTS_SAVED . ' | '; $html .= '' . $the_player->GOALS_ALLOWED . ' | '; $html .= '' . sports_bench_get_goals_against_average( (int)$the_player->GOALS_ALLOWED, (int)$the_player->GP ) . ' | '; $html .= '
' . sports_bench_show_stats_abbreviation_guide() . '
'; } elseif ( 'volleyball' == $sport ) { $html .= ''; $html .= ' | ' . __( 'GP', 'sports-bench' ) . ' | '; $html .= '' . __( 'SP', 'sports-bench' ) . ' | '; $html .= '' . __( 'PTS', 'sports-bench' ) . ' | '; $html .= '' . __( 'HIT %', 'sports-bench' ) . ' | '; $html .= '' . __( 'K', 'sports-bench' ) . ' | '; $html .= '' . __( 'ATT', 'sports-bench' ) . ' | '; $html .= '' . __( 'HE', 'sports-bench' ) . ' | '; $html .= '' . __( 'SET E', 'sports-bench' ) . ' | '; $html .= '' . __( 'SET A', 'sports-bench' ) . ' | '; $html .= '' . __( 'S', 'sports-bench' ) . ' | '; $html .= '' . __( 'SE', 'sports-bench' ) . ' | '; $html .= '' . __( 'ACE', 'sports-bench' ) . ' | '; $html .= '' . __( 'B', 'sports-bench' ) . ' | '; $html .= '' . __( 'BA', 'sports-bench' ) . ' | '; $html .= '' . __( 'BE', 'sports-bench' ) . ' | '; $html .= '' . __( 'DIG', 'sports-bench' ) . ' | '; $html .= '' . __( 'RE', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
' . $season->game_season . ' | ' . $season_team->team_name . ' ' . $season_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $season->GP . ' | '; $html .= '' . $season->SETS_PLAYED . ' | '; $html .= '' . $season->POINTS . ' | '; $html .= '' . sports_bench_get_hitting_percentage( $season->ATTACKS, $season->KILLS, $season->HITTING_ERRORS ) . ' | '; $html .= '' . $season->KILLS . ' | '; $html .= '' . $season->ATTACKS . ' | '; $html .= '' . $season->HITTING_ERRORS . ' | '; $html .= '' . $season->SET_ERR . ' | '; $html .= '' . $season->SET_ATT . ' | '; $html .= '' . $season->SERVES . ' | '; $html .= '' . $season->SE . ' | '; $html .= '' . $season->SA . ' | '; $html .= '' . $season->BLOCKS . ' | '; $html .= '' . $season->BA . ' | '; $html .= '' . $season->BE . ' | '; $html .= '' . $season->DIGS . ' | '; $html .= '' . $season->RE . ' | '; $html .= '
' . sports_bench_show_stats_abbreviation_guide() . '
'; } else { } return $html; } add_filter( 'sports_bench_player_stats_table', 'sports_bench_do_player_stats_table', 10, 4 );