Add hooks for additional performance calculations
This commit is contained in:
@@ -420,8 +420,8 @@ class SP_Player_List extends SP_Secondary_Post {
|
||||
endif;
|
||||
endforeach;
|
||||
elseif ( array_key_exists( $key, $totals[ $player_id ] ) ):
|
||||
$value = floatval( $value );
|
||||
$totals[ $player_id ][ $key ] += $value;
|
||||
$add = apply_filters( 'sportspress_player_performance_add_value', floatval( $value ), $key );
|
||||
$totals[ $player_id ][ $key ] += $add;
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
@@ -601,7 +601,7 @@ class SP_Player_List extends SP_Secondary_Post {
|
||||
$placeholder = number_format( $placeholder, $stat->precision, '.', '' );
|
||||
endif;
|
||||
|
||||
$placeholders[ $player_id ][ $stat->post_name ] = $placeholder;
|
||||
$placeholders[ $player_id ][ $stat->post_name ] = apply_filters( 'sportspress_player_performance_table_placeholder', $placeholder, $stat->post_name );
|
||||
endforeach;
|
||||
|
||||
endforeach;
|
||||
|
||||
@@ -369,8 +369,8 @@ class SP_Player extends SP_Custom_Post {
|
||||
|
||||
foreach ( $player_performance as $key => $value ):
|
||||
if ( array_key_exists( $key, $totals ) ):
|
||||
$value = floatval( $value );
|
||||
$totals[ $key ] += $value;
|
||||
$add = apply_filters( 'sportspress_player_performance_add_value', floatval( $value ), $key );
|
||||
$totals[ $key ] += $add;
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
@@ -552,7 +552,7 @@ class SP_Player extends SP_Custom_Post {
|
||||
endforeach;
|
||||
|
||||
foreach ( $performance_labels as $key => $label ):
|
||||
$placeholders[ $div_id ][ $key ] = sp_array_value( $totals, $key, 0 );
|
||||
$placeholders[ $div_id ][ $key ] = apply_filters( 'sportspress_player_performance_table_placeholder', sp_array_value( $totals, $key, 0 ), $key );
|
||||
endforeach;
|
||||
|
||||
endforeach;
|
||||
|
||||
@@ -130,7 +130,7 @@ $i = 0;
|
||||
foreach ( $labels as $key => $label ):
|
||||
if ( 'name' == $key )
|
||||
continue;
|
||||
|
||||
|
||||
$format = sp_array_value( $formats, $key, 'number' );
|
||||
$placeholder = sp_get_format_placeholder( $format );
|
||||
|
||||
@@ -169,7 +169,7 @@ $i = 0;
|
||||
endif;
|
||||
|
||||
if ( 'number' === $format ):
|
||||
$add = floatval( $value );
|
||||
$add = apply_filters( 'sportspress_event_performance_add_value', floatval( $value ), $key );
|
||||
$totals[ $key ] += $add;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
@@ -96,7 +96,7 @@ if ( is_array( $teams ) ):
|
||||
$formats[ $column->post_name ] = $format;
|
||||
}
|
||||
|
||||
do_action( 'sportspress_before_event_performance' );
|
||||
do_action( 'sportspress_before_event_performance', $columns );
|
||||
|
||||
if ( $is_individual ) {
|
||||
// Combined table
|
||||
|
||||
Reference in New Issue
Block a user