<?php

/**
 * The plugin bootstrap file
 *
 * This file is read by WordPress to generate the plugin information in the plugin
 * admin area. This file also includes all of the dependencies used by the plugin,
 * registers the activation and deactivation functions, and defines a function
 * that starts the plugin.
 *
 * @link              https://themeatelier.net
 * @since             1.4.12
 * @package           Domain_For_Sale
 *
 * @wordpress-plugin
 * Plugin Name:       Domain For Sale
 * Plugin URI:        https://wpdomainforsale.com/
 * Description:       Creative and professional auction and domain for sale WordPress Plugin.
 * Version:           3.4.1
 * Author:            ThemeAtelier
 * Author URI:        https://themeatelier.net/
 * License:           GPL-2.0+
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:       domain-for-sale
 * Domain Path:       /languages
 */

// Block Direct access
if (!defined('ABSPATH')) {
    die('You should not access this file directly!.');
}
require_once __DIR__ . '/vendor/autoload.php';

use ThemeAtelier\DomainForSale\Includes\DomainForSale;
use ThemeAtelier\DomainForSale\Includes\Domain_For_Sale_Activator;

if (!defined('DOMAIN_FOR_SALE_VERSION')) {
    define('DOMAIN_FOR_SALE_VERSION', '3.4.1');
}
if (!defined('DOMAIN_FOR_SALE_FILE')) {
    define('DOMAIN_FOR_SALE_FILE', __FILE__);
}
if (!defined('DOMAIN_FOR_SALE_DIR_PATH')) {
    define('DOMAIN_FOR_SALE_DIR_PATH', plugin_dir_path(__FILE__));
}
if (!defined('DOMAIN_FOR_SALE_DIR_URL')) {
    define('DOMAIN_FOR_SALE_DIR_URL', plugin_dir_url(__FILE__));
}
if (!defined('DOMAIN_FOR_SALE_BASENAME')) {
    define('DOMAIN_FOR_SALE_BASENAME', plugin_basename(__FILE__));
}
if (!defined('DOMAIN_FOR_SALE_DEMO_URL')) {
    define('DOMAIN_FOR_SALE_DEMO_URL', 'https://wpdomainforsale.com/');
}
if (!defined('DOMAIN_FOR_SALE_URL')) {
    define('DOMAIN_FOR_SALE_URL', plugins_url('', DOMAIN_FOR_SALE_FILE));
}
if (!defined('DOMAIN_FOR_SALE_ASSETS')) {
    define('DOMAIN_FOR_SALE_ASSETS', DOMAIN_FOR_SALE_URL . '/src/Frontend/assets/');
}
if (!defined('DOMAIN_FOR_SALE_ADMIN')) {
    define('DOMAIN_FOR_SALE_ADMIN', DOMAIN_FOR_SALE_URL . '/src/Admin');
}

/**
 * The code that runs during plugin activation.
 * This action is documented in src/Domain_For_Sale_Activator.php
 */
function activate_domain_for_sale()
{
    Domain_For_Sale_Activator::activate();
}
register_activation_hook(__FILE__, 'activate_domain_for_sale');


function domain_for_sale_run()
{
    // Launch the plugin.
    $domain_for_sale = new DomainForSale();
    $domain_for_sale->run();
}

/**
 * Pro version check.
 *
 * @return boolean
 */
include_once ABSPATH . 'wp-admin/includes/plugin.php';
if (!(is_plugin_active('domain-for-sale-pro/domain-for-sale-pro.php') || is_plugin_active_for_network('domain-for-sale-pro/domain-for-sale-pro.php'))) {
    domain_for_sale_run();
}

/**
 * Initialize the plugin tracker
 *
 * @return void
 */
function appsero_init_tracker_domain_for_sale()
{
    if (!class_exists('DfsAppSero\Client')) {
        require_once DOMAIN_FOR_SALE_DIR_PATH . 'src/Admin/appsero/Client.php';
    }
    $client = new DfsAppSero\Client('343a3d84-7b38-47f3-9225-10e5b28afaa4', 'Domain For Sale', __FILE__);
    // Active insights
    $client->insights()->init();
}
appsero_init_tracker_domain_for_sale();
