<?php

if (!defined('ABSPATH')) {
  exit; // Exit if accessed directly
}

global $bookyourtravel_theme_admin, $bookyourtravel_theme_filters;

$demos = $bookyourtravel_theme_filters->list_demo_import_files();

$ocdi_plugin_activated = class_exists('OCDI_Plugin');
?>
<div class="wrap bookyourtravel-demos-wrap bookyourtravel-wrap">
  <h1><?php echo esc_html__( 'Demos', 'bookyourtravel' ); ?></h1>
  <?php $bookyourtravel_theme_admin->render_admin_screen_tabs('demos'); ?>

  <div id="bookyourtravel-import-demos" class="bookyourtravel-import-demos">
    <div class="feature-section theme-browser rendered">
      <?php if ($ocdi_plugin_activated) {
        $pt_one_click_demo_import = OCDI\OneClickDemoImport::get_instance();
        $pt_one_click_demo_import->display_plugin_page();
      } else { ?>
      <div class="bookyourtravel-message">
        <p>
          <?php echo wp_kses(sprintf(__("Please install and activate the <a href='%s'>One Click Demo Import plugin</a> before proceeding. Demos can only be imported once this plugin is activated.", "bookyourtravel"), admin_url( 'admin.php?page=bookyourtravel-plugins')), array('a' => array('href' => array()))); ?>
        </p>
      </div>
      <?php } ?>
    </div>
  </div>

  <?php $bookyourtravel_theme_admin->render_admin_screen_footer('demos'); ?>
</div>
