/**
     * Output the metabox
     */
    public static function output($post)
    {
        $player = new SP_Player($post);
        $leagues = get_the_terms($post->ID, 'sp_league');
        $league_num = sizeof($leagues);
        // Loop through statistics for each league
        if ($leagues) {
            $i = 0;
            foreach ($leagues as $league) {
                ?>
				<p><strong><?php 
                echo $league->name;
                ?>
</strong></p>
				<?php 
                list($columns, $data, $placeholders, $merged, $seasons_teams) = $player->data($league->term_id, true);
                self::table($post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $i == 0);
                $i++;
            }
        }
        ?>
		<p><strong><?php 
        _e('Career Total', 'sportspress');
        ?>
</strong></p>
		<?php 
        list($columns, $data, $placeholders, $merged, $seasons_teams) = $player->data(0, true);
        self::table($post->ID, 0, $columns, $data, $placeholders, $merged, $seasons_teams);
    }
コード例 #2
0
    /**
     * Output the metabox
     */
    public static function output($post)
    {
        $player = new SP_Player($post);
        $leagues = get_the_terms($post->ID, 'sp_league');
        $league_num = sizeof($leagues);
        $sections = get_option('sportspress_player_performance_sections', -1);
        if ($leagues) {
            if (-1 == $sections) {
                // Loop through statistics for each league
                $i = 0;
                foreach ($leagues as $league) {
                    ?>
					<p><strong><?php 
                    echo $league->name;
                    ?>
</strong></p>
					<?php 
                    list($columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes) = $player->data($league->term_id, true);
                    self::table($post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0);
                    $i++;
                }
            } else {
                // Determine order of sections
                if (1 == $sections) {
                    $section_order = array(1 => __('Defense', 'sportspress'), 0 => __('Offense', 'sportspress'));
                } else {
                    $section_order = array(__('Offense', 'sportspress'), __('Defense', 'sportspress'));
                }
                $s = 0;
                foreach ($section_order as $section_id => $section_label) {
                    // Loop through statistics for each league
                    $i = 0;
                    foreach ($leagues as $league) {
                        ?>
						<p><strong><?php 
                        echo $league->name;
                        ?>
 &mdash; <?php 
                        echo $section_label;
                        ?>
</strong></p>
						<?php 
                        list($columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes) = $player->data($league->term_id, true, $section_id);
                        self::table($post->ID, $league->term_id, $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes && $i == 0 && $s == 0, $s == 0);
                        $i++;
                    }
                    $s++;
                }
            }
        }
    }
コード例 #3
0
ファイル: player-list.php プロジェクト: krmkrl/SportsPress
     if (isset($orderby) && $orderby != 'number') {
         $output .= '<td class="data-rank">' . ($i + 1) . '</td>';
     } else {
         $output .= '<td class="data-number">' . sp_array_value($row, 'number', '&nbsp;') . '</td>';
     }
 }
 $name_class = '';
 if ($show_player_photo) {
     if (has_post_thumbnail($player_id)) {
         $logo = get_the_post_thumbnail($player_id, 'sportspress-fit-icon');
         $name = '<span class="player-photo">' . $logo . '</span>' . $name;
         $name_class .= ' has-photo';
     }
 }
 if ($show_player_flag) {
     $player = new SP_Player($player_id);
     $nationalities = $player->nationalities();
     if (!empty($nationalities)) {
         foreach ($nationalities as $nationality) {
             $name = '<span class="player-flag"><img src="' . plugin_dir_url(SP_PLUGIN_FILE) . 'assets/images/flags/' . strtolower($nationality) . '.png" alt="' . $nationality . '"></span>' . $name;
         }
         $name_class .= ' has-photo';
     }
 }
 if ($link_posts) {
     $permalink = get_post_permalink($player_id);
     $name = '<a href="' . $permalink . '">' . $name . '</a>';
 }
 $output .= '<td class="data-name' . $name_class . '">' . $name . '</td>';
 if (array_key_exists('team', $labels)) {
     $team = sp_array_value($row, 'team', get_post_meta($id, 'sp_team', true));
コード例 #4
0
 * @version     1.9
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
if (get_option('sportspress_player_show_details', 'yes') === 'no') {
    return;
}
if (!isset($id)) {
    $id = get_the_ID();
}
$defaults = array('show_nationality' => get_option('sportspress_player_show_nationality', 'yes') == 'yes' ? true : false, 'show_positions' => get_option('sportspress_player_show_positions', 'yes') == 'yes' ? true : false, 'show_current_teams' => get_option('sportspress_player_show_current_teams', 'yes') == 'yes' ? true : false, 'show_past_teams' => get_option('sportspress_player_show_past_teams', 'yes') == 'yes' ? true : false, 'show_leagues' => get_option('sportspress_player_show_leagues', 'no') == 'yes' ? true : false, 'show_seasons' => get_option('sportspress_player_show_seasons', 'no') == 'yes' ? true : false, 'show_nationality_flags' => get_option('sportspress_player_show_flags', 'yes') == 'yes' ? true : false, 'link_teams' => get_option('sportspress_link_teams', 'no') == 'yes' ? true : false);
extract($defaults, EXTR_SKIP);
$countries = SP()->countries->countries;
$player = new SP_Player($id);
$nationalities = $player->nationalities();
$positions = $player->positions();
$current_teams = $player->current_teams();
$past_teams = $player->past_teams();
$leagues = $player->leagues();
$seasons = $player->seasons();
$metrics_before = $player->metrics(true);
$metrics_after = $player->metrics(false);
$common = array();
if ($show_nationality && $nationalities && is_array($nationalities)) {
    $values = array();
    foreach ($nationalities as $nationality) {
        $country_name = sp_array_value($countries, $nationality, null);
        $values[] = $country_name ? ($show_nationality_flags ? '<img src="' . plugin_dir_url(SP_PLUGIN_FILE) . 'assets/images/flags/' . strtolower($nationality) . '.png" alt="' . $nationality . '"> ' : '') . $country_name : '&mdash;';
    }
コード例 #5
0
 * @version     1.8
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
if (get_option('sportspress_player_show_details', 'yes') === 'no') {
    return;
}
if (!isset($id)) {
    $id = get_the_ID();
}
$defaults = array('show_nationality_flags' => get_option('sportspress_player_show_flags', 'yes') == 'yes' ? true : false, 'link_teams' => get_option('sportspress_link_teams', 'no') == 'yes' ? true : false);
extract($defaults, EXTR_SKIP);
$countries = SP()->countries->countries;
$player = new SP_Player($id);
$nationality = $player->nationality;
$positions = $player->positions();
$current_teams = $player->current_teams();
$past_teams = $player->past_teams();
$metrics_before = $player->metrics(true);
$metrics_after = $player->metrics(false);
$common = array();
if ($nationality) {
    if (2 == strlen($nationality)) {
        $legacy = SP()->countries->legacy;
        $nationality = strtolower($nationality);
        $nationality = sp_array_value($legacy, $nationality, null);
    }
    $country_name = sp_array_value($countries, $nationality, null);
    $common[__('Nationality', 'sportspress')] = $country_name ? ($show_nationality_flags ? '<img src="' . plugin_dir_url(SP_PLUGIN_FILE) . 'assets/images/flags/' . strtolower($nationality) . '.png" alt="' . $nationality . '"> ' : '') . $country_name : '&mdash;';
コード例 #6
0
 *
 * @author 		ThemeBoy
 * @package 	SportsPress/Templates
 * @version     1.7.4
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
if ('no' === get_option('sportspress_player_show_statistics', 'yes') && 'no' === get_option('sportspress_player_show_total', 'no')) {
    return;
}
if (!isset($id)) {
    $id = get_the_ID();
}
$player = new SP_Player($id);
$scrollable = get_option('sportspress_enable_scrollable_tables', 'yes') == 'yes' ? true : false;
$sections = get_option('sportspress_player_performance_sections', -1);
$leagues = get_the_terms($id, 'sp_league');
$positions = $player->positions();
$player_sections = array();
if ($positions) {
    foreach ($positions as $position) {
        $player_sections = array_merge($player_sections, sp_get_term_sections($position->term_id));
    }
}
// Determine order of sections
if (1 == $sections) {
    $section_order = array(1 => __('Defense', 'sportspress'), 0 => __('Offense', 'sportspress'));
} elseif (0 == $sections) {
    $section_order = array(__('Offense', 'sportspress'), __('Defense', 'sportspress'));
コード例 #7
0
 *
 * @author 		ThemeBoy
 * @package 	SportsPress/Templates
 * @version     1.7.4
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
if (get_option('sportspress_player_show_statistics', 'yes') === 'no') {
    return;
}
if (!isset($id)) {
    $id = get_the_ID();
}
$player = new SP_Player($id);
$scrollable = get_option('sportspress_enable_scrollable_tables', 'yes') == 'yes' ? true : false;
$leagues = get_the_terms($id, 'sp_league');
// Loop through statistics for each league
if (is_array($leagues)) {
    foreach ($leagues as $league) {
        $data = $player->data($league->term_id);
        // The first row should be column labels
        $labels = $data[0];
        // Remove the first row to leave us with the actual data
        unset($data[0]);
        // Skip if there are no rows in the table
        if (empty($data)) {
            continue;
        }
        $output = '<h4 class="sp-table-caption">' . $league->name . '</h4>' . '<div class="sp-table-wrapper">' . '<table class="sp-player-statistics sp-data-table' . ($scrollable ? ' sp-scrollable-table' : '') . '">' . '<thead>' . '<tr>';
コード例 #8
0
 *
 * @author 		ThemeBoy
 * @package 	SportsPress/Templates
 * @version     2.0.5
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
if ('no' === get_option('sportspress_player_show_statistics', 'yes') && 'no' === get_option('sportspress_player_show_total', 'no')) {
    return;
}
if (!isset($id)) {
    $id = get_the_ID();
}
$player = new SP_Player($id);
$scrollable = get_option('sportspress_enable_scrollable_tables', 'yes') == 'yes' ? true : false;
$sections = get_option('sportspress_player_performance_sections', -1);
$show_teams = apply_filters('sportspress_player_team_statistics', true);
$leagues = get_the_terms($id, 'sp_league');
$positions = $player->positions();
$player_sections = array();
if ($positions) {
    foreach ($positions as $position) {
        $player_sections = array_merge($player_sections, sp_get_term_sections($position->term_id));
    }
}
// Determine order of sections
if (1 == $sections) {
    $section_order = array(1 => __('Defense', 'sportspress'), 0 => __('Offense', 'sportspress'));
} elseif (0 == $sections) {