diff --git a/includes/admin/importers/class-sp-importer.php b/includes/admin/importers/class-sp-importer.php index b9620a88..afe971f2 100644 --- a/includes/admin/importers/class-sp-importer.php +++ b/includes/admin/importers/class-sp-importer.php @@ -80,7 +80,8 @@ if ( class_exists( 'WP_Importer' ) ) { case 2: check_admin_referer( 'import-upload' ); if ( isset( $_POST['sp_import'] ) ): - $this->import( $_POST['sp_import'], array_values( array_filter( sp_array_value( $_POST, 'sp_columns', array( 'post_title' ) ) ) ) ); + $columns = array_filter( sp_array_value( $_POST, 'sp_columns', array( 'post_title' ) ) ); + $this->import( $_POST['sp_import'], array_values( $columns ) ); endif; break; endswitch; diff --git a/includes/admin/post-types/class-sp-admin-cpt-event.php b/includes/admin/post-types/class-sp-admin-cpt-event.php index 033072bb..df50a1a8 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-event.php +++ b/includes/admin/post-types/class-sp-admin-cpt-event.php @@ -123,7 +123,8 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT { break; case 'sp_team': $teams = (array)get_post_meta( $post_id, 'sp_team', false ); - $teams = array_unique( array_filter( $teams ) ); + $teams = array_filter( $teams ); + $teams = array_unique( $teams ); if ( empty( $teams ) ): echo '—'; else: diff --git a/includes/admin/post-types/class-sp-admin-cpt-list.php b/includes/admin/post-types/class-sp-admin-cpt-list.php index a25d6a3b..1ec1a8e4 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-list.php +++ b/includes/admin/post-types/class-sp-admin-cpt-list.php @@ -62,7 +62,8 @@ class SP_Admin_CPT_List extends SP_Admin_CPT { public function custom_columns( $column, $post_id ) { switch ( $column ): case 'sp_player': - echo sizeof( array_filter( get_post_meta( $post_id, 'sp_player' ) ) ); + $players = array_filter( get_post_meta( $post_id, 'sp_player' ) ); + echo sizeof( $players ); break; case 'sp_league': echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—'; diff --git a/includes/admin/post-types/class-sp-admin-cpt-table.php b/includes/admin/post-types/class-sp-admin-cpt-table.php index 0ed0636b..963eb706 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-table.php +++ b/includes/admin/post-types/class-sp-admin-cpt-table.php @@ -66,7 +66,8 @@ class SP_Admin_CPT_Table extends SP_Admin_CPT { echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—'; break; case 'sp_team': - echo sizeof( array_filter( get_post_meta( $post_id, 'sp_team' ) ) ); + $teams = array_filter( get_post_meta( $post_id, 'sp_team' ) ); + echo sizeof( $teams ); break; endswitch; } diff --git a/includes/class-sp-event.php b/includes/class-sp-event.php index 908f86db..6027ae5f 100644 --- a/includes/class-sp-event.php +++ b/includes/class-sp-event.php @@ -17,7 +17,8 @@ class SP_Event extends SP_Custom_Post{ $results = get_post_meta( $this->ID, 'sp_results', true ); if ( is_array( $results ) ) { foreach( $results as $result ) { - if ( count( array_filter( $result ) ) > 0 ) { + $result = array_filter( $result ); + if ( count( $result ) > 0 ) { return 'results'; } } diff --git a/includes/sp-template-hooks.php b/includes/sp-template-hooks.php index 8d409296..612d6a69 100644 --- a/includes/sp-template-hooks.php +++ b/includes/sp-template-hooks.php @@ -127,7 +127,8 @@ function sportspress_the_title( $title, $id = null ) { foreach ( $teams as $team ): $team_logos[] = get_the_post_thumbnail( $team, 'sportspress-fit-icon' ); endforeach; - if ( ! empty( array_filter( $team_logos ) ) ): + $team_logos = array_filter( $team_logos ); + if ( ! empty( $team_logos ) ): $title .= '
'; $delimiter = get_option( 'sportspress_event_teams_delimiter', 'vs' ); $title .= implode( ' ' . $delimiter . ' ', $team_logos );