<?php
/**
 * The Template for displaying the game play
 *
 * @package WordPress
 * @subpackage MyArcadeTheme
 */
?>
<div class="cont">
  <?php myarcadetheme_breadcrumb(); ?>

  <article itemscope="itemscope" itemtype="http://schema.org/Article">
    <div class="post-sngl post-game post-game-play">
      <header>
        <h1 itemprop="headline"><?php the_title(); ?></h1>

        <?php if ( function_exists('the_ratings') ) { ?>
          <div class="gm-vote">
            <div><?php the_ratings(); ?></div>
          </div>
        <?php } ?>

        <p>
          <span class="gm-cate"><?php echo get_the_category_list(' '); ?></span>
          <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'myarcadetheme' ), get_the_author() ); ?>" itemscope="itemscope" itemtype="http://schema.org/Person" itemprop="author">
           <span class="fa-user" itemprop="name"> <?php the_author(); ?> </span>
          </a>
          <span class="fa-calendar" itemprop="datePublished"><?php echo get_the_date('d'); ?> <?php echo get_the_date('M'); ?> , <?php echo get_the_date('Y'); ?></span> <span class="fa-comments" itemprop="commentCount"><?php echo number_format_i18n( get_comments_number() ); ?></span>
        </p>

        <figure itemprop="image"><?php myarcade_thumbnail( array( 'width' => 58, 'height' => 58, 'lazy_load' => myarcadetheme_get_option('lazy_load') ) ); ?></figure>
      </header>

      <?php do_action( 'myarcadetheme_before_game' ); ?>

      <div class="game-cn">
        <?php
        if ( function_exists( 'get_game' ) ) {
          $display = myarcadetheme_get_option( 'game_preloader_ads', 1 ) ? 'display:none;' : '';
          ?>
          <div id="myarcade_game" class="game-play" style="<?php echo $display; ?>">
            <?php
            global $mypostid; $mypostid = $post->ID;
            echo myarcade_get_leaderboard_code();
            echo get_game();
            ?>
          </div>

          <?php
          // Include game pre-loader advertisement if enabled
          if ( myarcadetheme_get_option( 'game_preloader_ads', 1 ) ) {
            if ( myarcadetheme_get_option( 'game_preloader_ads_type') == 'adsense' ) {
              get_template_part( "partials/game", "adsense-for-games" );
            }
            else {
              get_template_part( "partials/game", "default-progressbar" );
            }
          }
          ?>
          <div class="lgtbxbg-pofi"></div>
          <?php
        } ?>

        <?php get_template_part( "partials/game", "buttons" ); ?>
      </div>
    </div>
  </article>

  <div class="cntcls">
    <main class="main-cn cols-n9">

      <div class="blk-cn post-list">
        <div class="titl"><?php _e('GAME INSTRUCTIONS', 'myarcadetheme'); ?></div>
        <div class="txcn" itemprop="text">
          <?php
          $banner = myarcadetheme_get_option( 'game_content_banner' );
          if ( $banner ) : ?>
            <div class="contentbnr300">
              <?php echo $banner; ?>
            </div>
          <?php endif ?>

          <p>
            <?php
            $instructions = myarcade_instructions(false);
            if ( ! empty( $instructions ) ) {
              echo $instructions;
            }
            else {
              echo myarcadetheme_content();
            }
            ?>
          </p>

          <?php
          // Display some manage links if logged in user is an admin
          myarcadetheme_admin_links();
          ?>
        </div>
      </div>

      <?php
      if ( myarcadetheme_get_option('play_myarcadecontrols', 1 ) ) {
        // Display Game Controls if enabled
        get_template_part( "partials/game", "controls" );
      }

      if ( myarcadetheme_get_option('play_display_video', 0 ) ) {
        // Display game video if enabled
        get_template_part( "partials/game", "video" );
      }

      if ( myarcadetheme_get_option( 'play_display_screenshots', 0 )  ) {
        // Display game screenshots if enabled
        get_template_part( "partials/game", "screenshots" );
      }

      if ( myarcadetheme_get_option( 'play_game_embed_box', 1 ) ) {
        // Display game embed box if enabled
        get_template_part( "partials/game", "embed-box" );
      }

      if ( myarcadetheme_get_option( 'play_game_related_games', 1 ) ) {
        // Display related games if enabled
        myarcadetheme_related();
      }

      if ( myarcadetheme_get_option( 'play_game_comments', 1 ) ) {
        // Display comments if enabled
        comments_template();
      }
      ?>
    </main>

    <?php get_sidebar(); ?>
  </div>
</div>