apply_filters( 'sports_bench_game_linescore', $html, $game, $away_team, $home_team, $sport, $game_info, $linescore_array )
Type
Filters
Section
Game Recap
Outputs the HTML for the linescore table for a game
Parameters
- $html, string, the current HTML for the linescore table
- $game, Sports_Bench_Game object, the game object for the selected game
- $away_team, Sports_Bench_Team object, the team object for the away team
- $home_team, Sports_Bench_Team object, the team object for the home team
- $sport, string, the sport that's being used on the site
- $game_info, array, information for the game, used for all sports but baseball
- $linescore_array, array, linescore information for the game, used only for baseball
Returns
- string, the HTML for the linescore table
Since: 1.5
Source: baseball-game-info.php, line 79; basketball-game-info.php, line 32; football-game-info.php, line 32; hockey-game-info.php, line 34; rugby-game-info.php, line 33; soccer-game-info.php, line 33; volleyball-game-info.php, line 33
Example
/** * Returns the HTML for the linescore for a game * * @param string $html * * @param Sports_Bench_Game $game * * @param Sports_Bench_Team $away_team * * @param Sports_Bench_Team $home_team * * @param string $sport * * @param array $game_info * * @param array $linescore_array * * @return string, html for the linescore * * @since 1.5 */ function sports_bench_do_game_linescore( $html, $game, $away_team, $home_team, $sport, $game_info, $linescore_array ) { if ( 'baseball' == $sport ) { $total_innings = 9; foreach( $linescore_array as $home_away ) { foreach( $home_away as $ha ) { if ( $ha[ 'inning' ] > $total_innings ) { $total_innings = $ha[ 'inning' ]; } } } $html = '
'; for( $i = 0; $i < $total_innings; $i++ ) { $inning = $i + 1; $html .= ' | ' . $inning . ' | '; } $html .= 'R | '; $html .= 'H | '; $html .= 'E | '; $html .= 'L | '; $html .= '||
---|---|---|---|---|---|---|---|
' . $away_team->team_location . ' | '; for( $i = 0; $i < $total_innings; $i++ ) { $filled = false; foreach( $linescore_array[ 0 ] as $inning ) { if ( $inning['inning'] == ( $i + 1 ) ) { $html .= '' . $inning[ 'runs_scored' ] . ' | '; $filled = true; } } if ( $filled == false ) { $html .= '0 | '; } } $hits = sports_bench_get_game_stat( $game, 'away', 'hits' ); $errors = sports_bench_get_game_stat( $game, 'away', 'errors' ); $lob = sports_bench_get_game_stat( $game, 'away', 'lob' ); if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_away_score . ' | '; } else { $html .= '' . $game->game_away_final . ' | '; } $html .= '' . $hits[ 0 ]->game_away_hits . ' | '; $html .= '' . $errors[ 0 ]->game_away_errors . ' | '; $html .= '' . $lob[ 0 ]->game_away_lob . ' | '; $html .= '
' . $home_team->team_location . ' | '; for( $i = 0; $i < $total_innings; $i++ ) { $filled = false; foreach( $linescore_array[ 1 ] as $inning ) { if ( $inning['inning'] == ( $i + 1 ) ) { $html .= '' . $inning[ 'runs_scored' ] . ' | '; $filled = true; } } if ( $filled == false ) { $html .= '0 | '; } } $hits = sports_bench_get_game_stat( $game, 'home', 'hits' ); $errors = sports_bench_get_game_stat( $game, 'home', 'errors' ); $lob = sports_bench_get_game_stat( $game, 'home', 'lob' ); if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_home_score . ' | '; } else { $html .= '' . $game->game_home_final . ' | '; } $html .= '' . $hits[ 0 ]->game_home_hits . ' | '; $html .= '' . $errors[ 0 ]->game_home_errors . ' | '; $html .= '' . $lob[ 0 ]->game_home_lob . ' | '; $html .= '
'; $html .= ' | '; $html .= ' | 1 | '; $html .= '2 | '; if ( get_option( 'sports-bench-basketball-halves' ) == 0 ) { $html .= '3 | '; $html .= '4 | '; } if ( $info->game_home_overtime != null ) { $html .= 'OT | '; } $html .= 'F | '; $html .= '|
---|---|---|---|---|---|---|---|---|
' . $away_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $away_team->team_location . ' | '; $html .= '' . $info->game_away_first_quarter . ' | '; $html .= '' . $info->game_away_second_quarter . ' | '; if ( get_option( 'sports-bench-basketball-halves' ) == 0 ) { $html .= '' . $info->game_away_third_quarter . ' | '; $html .= '' . $info->game_away_fourth_quarter . ' | '; } if ( $info->game_away_overtime != null ) { $html .= '' . $info->game_away_overtime . ' | '; } if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_away_score . ' | '; } else { $html .= '' . $game->game_away_final . ' | '; } $html .= '
' . $home_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $home_team->team_location . ' | '; $html .= '' . $info->game_home_first_quarter . ' | '; $html .= '' . $info->game_home_second_quarter . ' | '; if ( get_option( 'sports-bench-basketball-halves' ) == 0 ) { $html .= '' . $info->game_home_third_quarter . ' | '; $html .= '' . $info->game_home_fourth_quarter . ' | '; } if ( $info->game_home_overtime != null ) { $html .= '' . $info->game_home_overtime . ' | '; } if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_home_score . ' | '; } else { $html .= '' . $game->game_home_final . ' | '; } $html .= '
'; $html .= ' | '; $html .= ' | 1 | '; $html .= '2 | '; $html .= '3 | '; $html .= '4 | '; if ( $info->game_home_overtime != null ) { $html .= 'OT | '; } $html .= 'F | '; $html .= '|
---|---|---|---|---|---|---|---|---|
' . $away_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $away_team->team_location . ' | '; $html .= '' . $info->game_away_first_quarter . ' | '; $html .= '' . $info->game_away_second_quarter . ' | '; $html .= '' . $info->game_away_third_quarter . ' | '; $html .= '' . $info->game_away_fourth_quarter . ' | '; if ( $info->game_away_overtime != null ) { $html .= '' . $info->game_away_overtime . ' | '; } if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_away_score . ' | '; } else { $html .= '' . $game->game_away_final . ' | '; } $html .= '
' . $home_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $home_team->team_location . ' | '; $html .= '' . $info->game_home_first_quarter . ' | '; $html .= '' . $info->game_home_second_quarter . ' | '; $html .= '' . $info->game_home_third_quarter . ' | '; $html .= '' . $info->game_home_fourth_quarter . ' | '; if ( $info->game_home_overtime != null ) { $html .= '' . $info->game_home_overtime . ' | '; } if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_home_score . ' | '; } else { $html .= '' . $game->game_home_final . ' | '; } $html .= '
'; $html .= ' | '; $html .= ' | 1 | '; $html .= '2 | '; $html .= '3 | '; if ( $info->game_home_overtime != null ) { $html .= 'OT | '; } if ( $info->game_home_shootout != null ) { $html .= 'SO | '; } $html .= 'F | '; $html .= '|
---|---|---|---|---|---|---|---|---|
' . $away_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $away_team->team_name . ' | '; $html .= '' . $info->game_away_first_period . ' | '; $html .= '' . $info->game_away_second_period . ' | '; $html .= '' . $info->game_away_third_period . ' | '; if ( $info->game_away_overtime != null ) { $html .= '' . $info->game_away_overtime . ' | '; } if ( $info->game_away_shootout != null ) { $html .= '' . $info->game_away_shootout . ' | '; } if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_away_score . ' | '; } else { $html .= '' . $game->game_away_final . ' | '; } $html .= '
' . $home_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $home_team->team_name . ' | '; $html .= '' . $info->game_home_first_period . ' | '; $html .= '' . $info->game_home_second_period . ' | '; $html .= '' . $info->game_home_third_period . ' | '; if ( $info->game_home_overtime != null ) { $html .= '' . $info->game_home_overtime . ' | '; } if ( $info->game_home_shootout != null ) { $html .= '' . $info->game_home_shootout . ' | '; } if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_home_score . ' | '; } else { $html .= '' . $game->game_home_final . ' | '; } $html .= '
'; $html .= ' | '; $html .= ' | 1 | '; $html .= '2 | '; if ( $info->game_home_extratime != null ) { $html .= 'ET | '; } if ( $info->game_home_shootout != null ) { $html .= 'SO | '; } $html .= 'F | '; $html .= '|
---|---|---|---|---|---|---|---|
' . $away_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $away_team->team_location . ' | '; $html .= '' . $info->game_away_first_half . ' | '; $html .= '' . $info->game_away_second_half . ' | '; if ( $info->game_away_extratime != null ) { $html .= '' . $info->game_away_extratime . ' | '; } if ( $info->game_away_shootout != null ) { $html .= '' . $info->game_away_shootout . ' | '; } if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_away_score . ' | '; } else { $html .= '' . $game->game_away_final . ' | '; } $html .= '
' . $home_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $home_team->team_location . ' | '; $html .= '' . $info->game_home_first_half . ' | '; $html .= '' . $info->game_home_second_half . ' | '; if ( $info->game_home_extratime != null ) { $html .= '' . $info->game_home_extratime . ' | '; } if ( $info->game_home_shootout != null ) { $html .= '' . $info->game_home_shootout . ' | '; } if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_home_score . ' | '; } else { $html .= '' . $game->game_home_final . ' | '; } $html .= '
'; $html .= ' | '; $html .= ' | 1 | '; $html .= '2 | '; if ( $home_et != null ) { $html .= 'ET | '; } if ( $home_pks != null ) { $html .= 'PKs | '; } $html .= 'F | '; $html .= '|
---|---|---|---|---|---|---|---|
' . $home_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $home_team->team_name . ' | '; $html .= '' . $info->game_home_first_half . ' | '; $html .= '' . $info->game_home_second_half . ' | '; if ( $home_et != null ) { $html .= '' . $info->game_home_extratime . ' | '; } if ( $home_pks != null ) { $html .= '' . $info->game_home_pks . ' | '; } if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_home_score . ' | '; } else { $html .= '' . $game->game_home_final . ' | '; } $html .= '
' . $away_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $away_team->team_name . ' | '; $html .= '' . $info->game_away_first_half . ' | '; $html .= '' . $info->game_away_second_half . ' | '; if ( $home_et != null ) { $html .= '' . $info->game_away_extratime . ' | '; } if ( $home_pks != null ) { $html .= '' . $info->game_away_pks . ' | '; } if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_away_score . ' | '; } else { $html .= '' . $game->game_away_final . ' | '; } $html .= '
'; $html .= ' | '; $html .= ' | 1 | '; $html .= '2 | '; $html .= '3 | '; if ( $info->game_home_fourth_set != null ) { $html .= '4 | '; } if ( $info->game_home_fifth_set != null ) { $html .= '5 | '; } $html .= 'F | '; $html .= '|
---|---|---|---|---|---|---|---|---|
' . $away_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $away_team->team_location . ' | '; $html .= '' . $info->game_away_first_set . ' | '; $html .= '' . $info->game_away_second_set . ' | '; $html .= '' . $info->game_away_third_set . ' | '; if ( $info->game_away_fourth_set != null ) { $html .= '' . $info->game_away_fourth_set . ' | '; } if ( $info->game_away_fifth_set != null ) { $html .= '' . $info->game_away_fifth_set . ' | '; } if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_away_score . ' | '; } else { $html .= '' . $game->game_away_final . ' | '; } $html .= '
' . $home_team->get_team_photo( 'team-logo' ) . ' | '; $html .= '' . $home_team->team_location . ' | '; $html .= '' . $info->game_home_first_set . ' | '; $html .= '' . $info->game_home_second_set . ' | '; $html .= '' . $info->game_home_third_set . ' | '; if ( $info->game_home_fourth_set != null ) { $html .= '' . $info->game_home_fourth_set . ' | '; } if ( $info->game_home_fifth_set != null ) { $html .= '' . $info->game_home_fifth_set . ' | '; } if ( $game->game_status == 'in_progress' ) { $html .= '' . $game->game_current_home_score . ' | '; } else { $html .= '' . $game->game_home_final . ' | '; } $html .= '