Fix function return value used in write context.

This commit is contained in:
Brian Miyaji
2014-08-26 04:12:03 +10:00
parent 7e93edfee8
commit 7cb6143089
6 changed files with 12 additions and 6 deletions

View File

@@ -80,7 +80,8 @@ if ( class_exists( 'WP_Importer' ) ) {
case 2: case 2:
check_admin_referer( 'import-upload' ); check_admin_referer( 'import-upload' );
if ( isset( $_POST['sp_import'] ) ): 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; endif;
break; break;
endswitch; endswitch;

View File

@@ -123,7 +123,8 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
break; break;
case 'sp_team': case 'sp_team':
$teams = (array)get_post_meta( $post_id, 'sp_team', false ); $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 ) ): if ( empty( $teams ) ):
echo '—'; echo '—';
else: else:

View File

@@ -62,7 +62,8 @@ class SP_Admin_CPT_List extends SP_Admin_CPT {
public function custom_columns( $column, $post_id ) { public function custom_columns( $column, $post_id ) {
switch ( $column ): switch ( $column ):
case 'sp_player': 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; break;
case 'sp_league': case 'sp_league':
echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—'; echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—';

View File

@@ -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' ) : '—'; echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—';
break; break;
case 'sp_team': 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; break;
endswitch; endswitch;
} }

View File

@@ -17,7 +17,8 @@ class SP_Event extends SP_Custom_Post{
$results = get_post_meta( $this->ID, 'sp_results', true ); $results = get_post_meta( $this->ID, 'sp_results', true );
if ( is_array( $results ) ) { if ( is_array( $results ) ) {
foreach( $results as $result ) { foreach( $results as $result ) {
if ( count( array_filter( $result ) ) > 0 ) { $result = array_filter( $result );
if ( count( $result ) > 0 ) {
return 'results'; return 'results';
} }
} }

View File

@@ -127,7 +127,8 @@ function sportspress_the_title( $title, $id = null ) {
foreach ( $teams as $team ): foreach ( $teams as $team ):
$team_logos[] = get_the_post_thumbnail( $team, 'sportspress-fit-icon' ); $team_logos[] = get_the_post_thumbnail( $team, 'sportspress-fit-icon' );
endforeach; endforeach;
if ( ! empty( array_filter( $team_logos ) ) ): $team_logos = array_filter( $team_logos );
if ( ! empty( $team_logos ) ):
$title .= '<div class="sp-event-teams">'; $title .= '<div class="sp-event-teams">';
$delimiter = get_option( 'sportspress_event_teams_delimiter', 'vs' ); $delimiter = get_option( 'sportspress_event_teams_delimiter', 'vs' );
$title .= implode( ' ' . $delimiter . ' ', $team_logos ); $title .= implode( ' ' . $delimiter . ' ', $team_logos );