$label ): ?> $sub ): if ( ! $sub_id ) continue; $i = sp_array_value( $sub, 'sub', 0 ); $lineup_sub_relation[ $i ] = $sub_id; endforeach; $data = apply_filters( 'sportspress_event_performance_players', $data, $lineups, $subs, $mode ); $stars_type = get_option( 'sportspress_event_performance_stars_type', 0 ); foreach ( $data as $player_id => $row ): if ( ! $player_id ) continue; $name = get_the_title( $player_id ); if ( ! $name ) continue; echo ''; if ( apply_filters( 'sportspress_event_performance_show_numbers', $show_numbers, $section ) ) { $number = sp_array_value( $row, 'number', ' ' ); // Player number echo ''; } if ( $link_posts ): $permalink = get_post_permalink( $player_id ); $name = '' . $name . ''; endif; if ( $stars_type ): $player_stars = sp_array_value( $stars, $player_id, 0 ); if ( $player_stars ): switch ( $stars_type ): case 1: $name .= ' '; break; case 2: $name .= ' ' . str_repeat( '', $player_stars ) . ''; break; case 3: $name .= ' ' . $player_stars . ''; break; endswitch; endif; endif; if ( array_key_exists( $player_id, $lineup_sub_relation ) ): $name .= ' ' . sp_array_value( sp_array_value( $data, $lineup_sub_relation[ $player_id ], array() ), 'number', null ) . ''; elseif ( isset( $row['sub'] ) && $row['sub'] ): $subbed = (int) $row['sub']; $name .= ' ' . sp_array_value( sp_array_value( $data, $subbed, array() ), 'number', null ) . ''; endif; $content = ''; $position = null; foreach ( $labels as $key => $label ): if ( 'name' == $key ) continue; $format = sp_array_value( $formats, $key, 'number' ); $placeholder = sp_get_format_placeholder( $format ); if ( ! array_key_exists( $key, $totals ) ): $totals[ $key ] = $placeholder; endif; if ( 'time' === $format ): $totals[ $key ] = ' '; endif; $value = '-'; if ( $key == 'position' ): $positions = array(); if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ): $position_ids = (array) $row[ $key ]; else: $position_ids = (array) sp_get_the_term_id( $player_id, 'sp_position' ); endif; foreach ( $position_ids as $position_id ) { $player_position = get_term_by( 'id', $position_id, 'sp_position' ); if ( $player_position ) $positions[] = $player_position->name; } $positions = array_unique( $positions ); if ( sizeof( $positions ) ): $value = $position = implode( ', ', $positions ); endif; else: if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ): $value = $row[ $key ]; else: $value = $placeholder; endif; if ( 'number' === $format ): $add = apply_filters( 'sportspress_event_performance_add_value', floatval( $value ), $key ); $totals[ $key ] += $add; endif; endif; if ( $mode == 'values' ): $content .= ''; elseif ( intval( $value ) && $mode == 'icons' ): $performance_id = sp_array_value( $performance_ids, $key, null ); $icons = ''; if ( $performance_id && has_post_thumbnail( $performance_id ) ): $icons = str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $performance_id ) ) ) . ' ', intval($value) ); endif; $content .= apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, $value ); endif; endforeach; if ( isset( $position ) && $mode == 'icons' ): $name .= ' ' . $position . ''; endif; echo ''; if ( $mode == 'icons' ): echo ''; else: echo $content; endif; echo ''; $i++; endforeach; foreach ( $labels as $key => $label ): $format = sp_array_value( $formats, $key, 'number' ); if ( 'equation' === $format ): $post = get_page_by_path( $key, OBJECT, 'sp_performance' ); if ( $post ) $totals[ $key ] = sp_solve( get_post_meta( $post->ID, 'sp_equation', true ), $totals, get_post_meta( $post->ID, 'sp_precision', true ) ); endif; endforeach; ?> <>  '; } if ( $mode == 'values' ): echo ''; endif; endif; $row = sp_array_value( $data, 0, array() ); if ( $mode == 'icons' ) echo ''; }else{ echo ''; } elseif ( intval( $value ) && $mode == 'icons' ): $performance_id = sp_array_value( $performance_ids, $key, null ); $icons = ''; if ( $performance_id && has_post_thumbnail( $performance_id ) ): $icons = get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $performance_id ) ) ); endif; echo apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, 1 ) . $value . ' '; endif; endforeach; if ( $mode == 'icons' ) echo ''; ?> >
#
' . $number . '' . $value . '' . $name . '' . $content . '
' . __( 'Total', 'sportspress' ) . ''; foreach ( $labels as $key => $label ): $format = sp_array_value( $formats, $key, 'number' ); if ( 'name' == $key ) continue; if ( $key == 'position' ): $value = ' '; else: if ( $primary && $key !== $primary ): $value = ' '; elseif ( 'equation' !== $format && array_key_exists( $key, $row ) && $row[ $key ] != '' ): $value = $row[ $key ]; else: $value = apply_filters( 'sportspress_event_performance_table_total_value', sp_array_value( $totals, $key, 0 ), $data, $key ); endif; endif; if ( $mode == 'values' ): if ($key == 'position'){ echo '' . $value . '' . $value . '
$id, 'index' => $index ) ); } ?>