Add "Next Team" preset to league tables

This commit is contained in:
Brian Miyaji
2018-05-02 13:53:19 +10:00
parent 52f96851b1
commit 0722a9fb49
4 changed files with 140 additions and 7 deletions

View File

@@ -1290,10 +1290,10 @@ if ( !function_exists( 'sp_get_eos_safe_slug' ) ) {
}
if ( !function_exists( 'sp_solve' ) ) {
function sp_solve( $equation, $vars, $precision = 0, $default = 0 ) {
function sp_solve( $equation, $vars, $precision = 0, $default = 0, $post_id = 0 ) {
// Add a hook to alter $equation
$equation = apply_filters( 'sportspress_equation_alter', $equation, $vars );
$equation = apply_filters( 'sportspress_equation_alter', $equation, $vars, $precision, $default );
if ( $equation == null )
return $default;
@@ -1347,6 +1347,10 @@ if ( !function_exists( 'sp_solve' ) ) {
endif;
if ( $solution = apply_filters( 'sportspress_equation_solve_for_presets', null, $equation, $post_id ) ):
return $solution;
endif;
// Remove unnecessary variables from vars before calculating
unset( $vars['gamesback'] );
unset( $vars['streak'] );