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 = '';
		$html .= '';
		$html .= '';
		$html .= '';
		for( $i = 0; $i < $total_innings; $i++ ) {
			$inning = $i + 1;
			$html .= '';
		}
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $away_team );
		$html .= '';
		$html .= '';
		for( $i = 0; $i < $total_innings; $i++ ) {
			$filled = false;
			foreach( $linescore_array[ 0 ] as $inning ) {
				if ( $inning['inning'] == ( $i + 1 ) ) {
					$html .= '';
					$filled = true;
				}
			}
			if ( $filled == false ) {
				$html .= '';
			}
		}
		$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 .= '';
		} else {
			$html .= '';
		}
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $home_team );
		$html .= '';
		$html .= '';
		for( $i = 0; $i < $total_innings; $i++ ) {
			$filled = false;
			foreach( $linescore_array[ 1 ] as $inning ) {
				if ( $inning['inning'] == ( $i + 1 ) ) {
					$html .= '';
					$filled = true;
				}
			}
			if ( $filled == false ) {
				$html .= '';
			}
		}
		$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 .= '';
		} else {
			$html .= '';
		}
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '
' . $inning . 'RHEL
' . $away_team->team_location . '' . $inning[ 'runs_scored' ] . '0' . $game->game_current_away_score . '' . $game->game_away_final . '' . $hits[ 0 ]->game_away_hits . '' . $errors[ 0 ]->game_away_errors . '' . $lob[ 0 ]->game_away_lob . '
' . $home_team->team_location . '' . $inning[ 'runs_scored' ] . '0' . $game->game_current_home_score . '' . $game->game_home_final . '' . $hits[ 0 ]->game_home_hits . '' . $errors[ 0 ]->game_home_errors . '' . $lob[ 0 ]->game_home_lob . '
'; } elseif ( 'basketball' == $sport ) { foreach ( $game_info as $info ) { $html = ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( get_option( 'sports-bench-basketball-halves' ) == 0 ) { $html .= ''; $html .= ''; } if ( $info->game_home_overtime != null ) { $html .= ''; } $html .= ''; $html .= ''; $html .= ''; $html .= ''; $table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $away_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( get_option( 'sports-bench-basketball-halves' ) == 0 ) { $html .= ''; $html .= ''; } if ( $info->game_away_overtime != null ) { $html .= ''; } if ( $game->game_status == 'in_progress' ) { $html .= ''; } else { $html .= ''; } $html .= ''; $table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $home_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( get_option( 'sports-bench-basketball-halves' ) == 0 ) { $html .= ''; $html .= ''; } if ( $info->game_home_overtime != null ) { $html .= ''; } if ( $game->game_status == 'in_progress' ) { $html .= ''; } else { $html .= ''; } $html .= ''; $html .= ''; $html .= '
1234OTF
' . $away_team->get_team_photo( 'team-logo' ) . '' . $away_team->team_location . '' . $info->game_away_first_quarter . '' . $info->game_away_second_quarter . '' . $info->game_away_third_quarter . '' . $info->game_away_fourth_quarter . '' . $info->game_away_overtime . '' . $game->game_current_away_score . '' . $game->game_away_final . '
' . $home_team->get_team_photo( 'team-logo' ) . '' . $home_team->team_location . '' . $info->game_home_first_quarter . '' . $info->game_home_second_quarter . '' . $info->game_home_third_quarter . '' . $info->game_home_fourth_quarter . '' . $info->game_home_overtime . '' . $game->game_current_home_score . '' . $game->game_home_final . '
'; } } elseif ( 'football' == $sport ) { foreach( $game_info as $info ) { $html = ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $info->game_home_overtime != null ) { $html .= ''; } $html .= ''; $html .= ''; $html .= ''; $html .= ''; $table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $away_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $info->game_away_overtime != null ) { $html .= ''; } if ( $game->game_status == 'in_progress' ) { $html .= ''; } else { $html .= ''; } $html .= ''; $table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $home_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $info->game_home_overtime != null ) { $html .= ''; } if ( $game->game_status == 'in_progress' ) { $html .= ''; } else { $html .= ''; } $html .= ''; $html .= ''; $html .= '
1234OTF
' . $away_team->team_location . '' . $info->game_away_first_quarter . '' . $info->game_away_second_quarter . '' . $info->game_away_third_quarter . '' . $info->game_away_fourth_quarter . '' . $info->game_away_overtime . '' . $game->game_current_away_score . '' . $game->game_away_final . '
' . $home_team->team_location . '' . $info->game_home_first_quarter . '' . $info->game_home_second_quarter . '' . $info->game_home_third_quarter . '' . $info->game_home_fourth_quarter . '' . $info->game_home_overtime . '' . $game->game_current_home_score . '' . $game->game_home_final . '
'; } } elseif ( 'hockey' == $sport ) { foreach( $game_info as $info ) { $html = ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $info->game_home_overtime != null ) { $html .= ''; } if ( $info->game_home_shootout != null ) { $html .= ''; } $html .= ''; $html .= ''; $html .= ''; $html .= ''; $table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $away_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $info->game_away_overtime != null ) { $html .= ''; } if ( $info->game_away_shootout != null ) { $html .= ''; } if ( $game->game_status == 'in_progress' ) { $html .= ''; } else { $html .= ''; } $html .= ''; $table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $home_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $info->game_home_overtime != null ) { $html .= ''; } if ( $info->game_home_shootout != null ) { $html .= ''; } if ( $game->game_status == 'in_progress' ) { $html .= ''; } else { $html .= ''; } $html .= ''; $html .= ''; $html .= '
123OTSOF
' . $away_team->get_team_photo( 'team-logo' ) . '' . $away_team->team_name . '' . $info->game_away_first_period . '' . $info->game_away_second_period . '' . $info->game_away_third_period . '' . $info->game_away_overtime . '' . $info->game_away_shootout . '' . $game->game_current_away_score . '' . $game->game_away_final . '
' . $home_team->get_team_photo( 'team-logo' ) . '' . $home_team->team_name . '' . $info->game_home_first_period . '' . $info->game_home_second_period . '' . $info->game_home_third_period . '' . $info->game_home_overtime . '' . $info->game_home_shootout . '' . $game->game_current_home_score . '' . $game->game_home_final . '
'; } } elseif ( 'rugby' == $sport ) { foreach ( $game_info as $info ) { $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $info->game_home_extratime != null ) { $html .= ''; } if ( $info->game_home_shootout != null ) { $html .= ''; } $html .= ''; $html .= ''; $html .= ''; $html .= ''; $table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $away_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $info->game_away_extratime != null ) { $html .= ''; } if ( $info->game_away_shootout != null ) { $html .= ''; } if ( $game->game_status == 'in_progress' ) { $html .= ''; } else { $html .= ''; } $html .= ''; $table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $home_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $info->game_home_extratime != null ) { $html .= ''; } if ( $info->game_home_shootout != null ) { $html .= ''; } if ( $game->game_status == 'in_progress' ) { $html .= ''; } else { $html .= ''; } $html .= ''; $html .= ''; $html .= '
12ETSOF
' . $away_team->get_team_photo( 'team-logo' ) . '' . $away_team->team_location . '' . $info->game_away_first_half . '' . $info->game_away_second_half . '' . $info->game_away_extratime . '' . $info->game_away_shootout . '' . $game->game_current_away_score . '' . $game->game_away_final . '
' . $home_team->get_team_photo( 'team-logo' ) . '' . $home_team->team_location . '' . $info->game_home_first_half . '' . $info->game_home_second_half . '' . $info->game_home_extratime . '' . $info->game_home_shootout . '' . $game->game_current_home_score . '' . $game->game_home_final . '
'; } } elseif ( 'soccer' == $sport ) { foreach( $game_info as $info) { $home_et = $info->game_home_extratime; $home_pks = $info->game_home_pks; $html = ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $home_et != null ) { $html .= ''; } if ( $home_pks != null ) { $html .= ''; } $html .= ''; $html .= ''; $html .= ''; $html .= ''; $table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $away_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $home_et != null ) { $html .= ''; } if ( $home_pks != null ) { $html .= ''; } if ( $game->game_status == 'in_progress' ) { $html .= ''; } else { $html .= ''; } $html .= ''; $table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $home_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $home_et != null ) { $html .= ''; } if ( $home_pks != null ) { $html .= ''; } if ( $game->game_status == 'in_progress' ) { $html .= ''; } else { $html .= ''; } $html .= ''; $html .= ''; $html .= '
12ETPKsF
' . $home_team->get_team_photo( 'team-logo' ) . '' . $home_team->team_name . '' . $info->game_home_first_half . '' . $info->game_home_second_half . '' . $info->game_home_extratime . '' . $info->game_home_pks . '' . $game->game_current_home_score . '' . $game->game_home_final . '
' . $away_team->get_team_photo( 'team-logo' ) . '' . $away_team->team_name . '' . $info->game_away_first_half . '' . $info->game_away_second_half . '' . $info->game_away_extratime . '' . $info->game_away_pks . '' . $game->game_current_away_score . '' . $game->game_away_final . '
'; } } elseif ( 'volleyball' == $sport ) { if ( $game_info ) { foreach ( $game_info as $info ) { $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $info->game_home_fourth_set != null ) { $html .= ''; } if ( $info->game_home_fifth_set != null ) { $html .= ''; } $html .= ''; $html .= ''; $html .= ''; $html .= ''; $table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $away_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $info->game_away_fourth_set != null ) { $html .= ''; } if ( $info->game_away_fifth_set != null ) { $html .= ''; } if ( $game->game_status == 'in_progress' ) { $html .= ''; } else { $html .= ''; } $html .= ''; $table_row_styles = apply_filters( 'sports_bench_linescore_row', '', $home_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $info->game_home_fourth_set != null ) { $html .= ''; } if ( $info->game_home_fifth_set != null ) { $html .= ''; } if ( $game->game_status == 'in_progress' ) { $html .= ''; } else { $html .= ''; } $html .= ''; $html .= ''; $html .= '
12345F
' . $away_team->get_team_photo( 'team-logo' ) . '' . $away_team->team_location . '' . $info->game_away_first_set . '' . $info->game_away_second_set . '' . $info->game_away_third_set . '' . $info->game_away_fourth_set . '' . $info->game_away_fifth_set . '' . $game->game_current_away_score . '' . $game->game_away_final . '
' . $home_team->get_team_photo( 'team-logo' ) . '' . $home_team->team_location . '' . $info->game_home_first_set . '' . $info->game_home_second_set . '' . $info->game_home_third_set . '' . $info->game_home_fourth_set . '' . $info->game_home_fifth_set . '' . $game->game_current_home_score . '' . $game->game_home_final . '
'; } } } return $html; } add_filter( 'sports_bench_game_linescore', 'sports_bench_do_game_linescore', 10, 7 );