<?php
/**
 * Output of the single player info.
 *
 * @package cyberpress/templates
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound

$player             = cyberpress()->get_the_player();
$player_full_name   = $player->get_full_name();
$player_gender      = $player->get_gender();
$player_age         = $player->get_age();
$player_country     = $player->get_country();
$player_site_url    = $player->get_site_url();
$player_youtube_url = $player->get_youtube_channel_url();
$player_twitch_url  = $player->get_twitch_channel_url();

if ( $player_country || $player_age || $player_gender || $player_site_url || $player_twitch_url || $player_youtube_url ) : ?>
    <ul class="cyberpress-player-info">
        <?php if ( $player_full_name ) : ?>
            <li>
                <?php
                echo wp_kses(
                    // translators: %s country.
                    sprintf( __( '<strong>Name</strong>: %s', 'cyberpress' ), esc_html( $player_full_name ) ),
                    array(
                        'strong' => array(),
                    )
                );
                ?>
            </li>
        <?php endif; ?>
        <?php if ( $player_country && $player_country['flag'] ) : ?>
            <li>
                <?php
                echo sprintf(
                    // translators: %s country.
                    wp_kses_post( __( '<strong>Country</strong>: %s', 'cyberpress' ) ),
                    wp_kses( $player_country['flag'] . ' ' . $player_country['name'], cyberpress()->get_kses_allowed_img() )
                );
                ?>
            </li>
        <?php endif; ?>
        <?php if ( $player_age ) : ?>
            <li>
                <?php
                echo wp_kses(
                    // translators: %s foundation date.
                    sprintf( __( '<strong>Age</strong>: %s years old', 'cyberpress' ), esc_html( $player_age ) ),
                    array(
                        'strong' => array(),
                    )
                );
                ?>
            </li>
        <?php endif; ?>
        <?php if ( $player_gender ) : ?>
            <li>
                <?php
                echo wp_kses(
                    // translators: %s foundation date.
                    sprintf( __( '<strong>Gender</strong>: %s', 'cyberpress' ), esc_html( $player_gender ) ),
                    array(
                        'strong' => array(),
                    )
                );
                ?>
            </li>
        <?php endif; ?>
        <?php if ( $player_site_url ) : ?>
            <li>
                <?php
                echo wp_kses(
                    // translators: %1$s - site url, %2$s - site url.
                    sprintf( __( '<strong>Site</strong>: <a href="%1$s">%2$s</a>', 'cyberpress' ), esc_url( $player_site_url ), esc_url( $player_site_url ) ),
                    array(
                        'strong' => array(),
                        'a'      => array(
                            'href' => array(),
                        ),
                    )
                );
                ?>
            </li>
        <?php endif; ?>
        <?php if ( $player_twitch_url ) : ?>
            <li>
                <?php
                echo wp_kses(
                    // translators: %1$s - site url, %2$s - site url.
                    sprintf( __( '<strong>Twitch</strong>: <a href="%1$s">%2$s</a>', 'cyberpress' ), esc_url( $player_twitch_url ), esc_url( $player_twitch_url ) ),
                    array(
                        'strong' => array(),
                        'a'      => array(
                            'href' => array(),
                        ),
                    )
                );
                ?>
            </li>
        <?php endif; ?>
        <?php if ( $player_youtube_url ) : ?>
            <li>
                <?php
                echo wp_kses(
                    // translators: %1$s - site url, %2$s - site url.
                    sprintf( __( '<strong>YouTube</strong>: <a href="%1$s">%2$s</a>', 'cyberpress' ), esc_url( $player_youtube_url ), esc_url( $player_youtube_url ) ),
                    array(
                        'strong' => array(),
                        'a'      => array(
                            'href' => array(),
                        ),
                    )
                );
                ?>
            </li>
        <?php endif; ?>
    </ul>
<?php endif; ?>
