Avoid PHP warnings with PHP >= 7.2.x

Fix PHP Warning:  sizeof(): Parameter must be an array or an object that implements Countable on line 24
This commit is contained in:
savvasha
2018-09-15 17:02:54 +03:00
committed by GitHub
parent f42499ba5e
commit d83abf4b12

View File

@@ -21,7 +21,11 @@ class SP_Meta_Box_Player_Statistics {
public static function output( $post ) {
$player = new SP_Player( $post );
$leagues = $player->get_terms_sorted_by_sp_order( 'sp_league' );
$league_num = sizeof( $leagues );
if ( is_array ( $leagues ) ) {
$league_num = sizeof( $leagues );
}else{
$league_num =0;
}
$sections = get_option( 'sportspress_player_performance_sections', -1 );
$show_career_totals = 'yes' === get_option( 'sportspress_player_show_career_total', 'no' ) ? true : false;
@@ -245,4 +249,4 @@ class SP_Meta_Box_Player_Statistics {
</div>
<?php
}
}
}