$player_details[$player->ID][$stat] = date_i18n(get_option('date_format'), strtotime(get_post_meta($player->ID, 'wpcm_dob', true))); break; case 'height': $player_details[$player->ID][$stat] = $height; break; case 'weight': $player_details[$player->ID][$stat] = $weight; break; case 'hometown': $player_details[$player->ID][$stat] = '<img class="flag" src="' . WPCM_URL . 'assets/images/flags/' . $natl . '.png" /> ' . $hometown; break; case 'joined': $player_details[$player->ID][$stat] = date_i18n(get_option('date_format'), strtotime($player->post_date)); break; case 'subs': $player_details[$player->ID][$stat] = get_player_subs_total($player->ID, $season, $team); break; } } } } if (array_key_exists($orderby, $player_stats_labels)) { $player_details = subval_sort($player_details, $orderby); if ($order == 'DESC') { $player_details = array_reverse($player_details); } } $count = 0; foreach ($player_details as $player_detail) { $count++; if ($limit > 0 && $count > $limit) {
/** * Player profile stats table. * * @access public * @param array * @param string $team * @param string $season * @return void */ function wpcm_profile_stats_table($stats = array(), $team = 0, $season = 0) { $id = get_the_ID(); if (array_key_exists($team, $stats)) { if (array_key_exists($season, $stats[$team])) { $stats = $stats[$team][$season]; } } $wpcm_player_stats_labels = wpcm_get_sports_stats_labels(); $stats_labels = array('appearances' => '<a title="' . __('Games Played', 'wp-club-manager') . '">' . __('GP', 'wp-club-manager') . '</a>'); $stats_labels = array_merge($stats_labels, $wpcm_player_stats_labels); ?> <table> <thead> <tr> <?php foreach ($stats_labels as $key => $val) { if (get_option('wpcm_show_stats_' . $key) == 'yes') { ?> <th><?php echo $val; ?> </th> <?php } } ?> </tr> </thead> <tbody> <tr> <?php foreach ($stats_labels as $key => $val) { if ($key == 'appearances') { if (get_option('wpcm_show_stats_appearances') == 'yes') { if (get_option('wpcm_show_stats_subs') == 'yes') { $subs = get_player_subs_total($id, $season, $team); if ($subs > 0) { $sub = ' <span class="sub-appearances">(' . $subs . ')</span>'; } else { $sub = ''; } } ?> <td><span data-index="appearances"><?php wpcm_stats_value($stats, 'total', 'appearances'); echo get_option('wpcm_show_stats_subs') == 'yes' ? $sub : ''; ?> </span></td> <?php } } elseif ($key == 'rating') { $rating = get_wpcm_stats_value($stats, 'total', 'rating'); $apps = get_wpcm_stats_value($stats, 'total', 'appearances'); $avrating = wpcm_divide($rating, $apps); if (get_option('wpcm_show_stats_rating') == 'yes') { ?> <td><span data-index="rating"><?php echo sprintf("%01.2f", round($avrating, 2)); ?> </span></td> <?php } } else { if (get_option('wpcm_show_stats_' . $key) == 'yes') { ?> <td><span data-index="<?php echo $key; ?> "><?php wpcm_stats_value($stats, 'total', $key); ?> </span></td> <?php } } } ?> </tr> </tbody> </table> <?php }