<?php

/**
 * Genealogical Tree
 *
 * This is the main plugin file, which is responsible for loading the plugin,
 * defining activation and deactivation hooks, and including dependencies.
 *
 * @link              https://wordpress.org/plugins/genealogical-tree
 * @since             1.0.0
 * @package           Genealogical_Tree
 *
 * @wordpress-plugin
 * Plugin Name:       Genealogical Tree
 * Plugin URI:        https://wordpress.org/plugins/genealogical-tree
 * Description:       The ultimate solution for creating and displaying family trees and family history on WordPress.
 * Version:           2.2.8
 * Author:            ak devs
 * Author URI:        https://github.com/akdevsfr
 * License:           GPL-2.0+
 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
 * Text Domain:       genealogical-tree
 * Domain Path:       /languages
 * @fs_premium_only:   /admin/genealogical-tree-handel-import.php, /admin/genealogical-tree-handel-import-csv.php, /admin/genealogical-tree-handel-export.php, /includes/php-gedcom/, /admin/partials/genealogical-tree-meta-tree-settings-premium.php, /includes/class-genealogical-tree-api.php
 */
// Abort if this file is called directly.
if ( !defined( 'WPINC' ) ) {
    die;
}
/**
 * Autoload dependencies using Composer.
 *
 * Throws an error if the autoload file is not found to ensure the plugin
 * cannot run without required dependencies.
 *
 * @throws RuntimeException If the autoload file is missing.
 */
if ( !file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
    throw new RuntimeException('Composer autoload file not found. Please run "composer install".');
}
require_once __DIR__ . '/vendor/autoload.php';
/**
 * Freemius SDK Initialization and Setup.
 *
 * Initializes the Freemius SDK for managing plugin subscriptions and licensing.
 *
 * @return mixed The Freemius SDK instance.
 */
if ( function_exists( 'gt_fs' ) ) {
    gt_fs()->set_basename( false, __FILE__ );
} else {
    // if gt_fs not defined.
    if ( !function_exists( 'gt_fs' ) ) {
        // Create a helper function for easy SDK access.
        function gt_fs() {
            global $gt_fs;
            if ( !isset( $gt_fs ) ) {
                // Activate multisite network integration.
                if ( !defined( 'WP_FS__PRODUCT_3592_MULTISITE' ) ) {
                    define( 'WP_FS__PRODUCT_3592_MULTISITE', true );
                }
                // Include Freemius SDK.
                require_once dirname( __FILE__ ) . '/freemius/start.php';
                $gt_fs = fs_dynamic_init( array(
                    'id'               => '3592',
                    'slug'             => 'genealogical-tree',
                    'premium_slug'     => 'genealogical-tree-pro',
                    'type'             => 'plugin',
                    'public_key'       => 'pk_e7259dba96b5463b7e746506d5e2c',
                    'is_premium'       => false,
                    'premium_suffix'   => 'Pro',
                    'has_addons'       => true,
                    'has_paid_plans'   => true,
                    'trial'            => array(
                        'days'               => 7,
                        'is_require_payment' => true,
                    ),
                    'menu'             => array(
                        'slug'       => 'genealogical-tree',
                        'first-path' => '/edit-tags.php?taxonomy=gt-family-group&post_type=gt-member',
                        'support'    => false,
                    ),
                    'is_live'          => true,
                    'is_org_compliant' => true,
                ) );
            }
            return $gt_fs;
        }

        // Init Freemius.
        gt_fs();
        // Signal that SDK was initiated.
        do_action( 'gt_fs_loaded' );
    }
    /**
     * Define plugin constants.
     */
    define( 'GENEALOGICAL_TREE_VERSION', '2.2.8' );
    define( 'GENEALOGICAL_TREE_DIR_URL', plugin_dir_url( __FILE__ ) );
    define( 'GENEALOGICAL_TREE_DIR_PATH', plugin_dir_path( __FILE__ ) );
    /**
     * Registers the plugin's activation hook.
     *
     * This uses an arrow function for concise activation logic. However, for
     * improved debugging and maintainability, using a named function is generally
     * recommended (see example below).
     *
     * @since 1.0.0
     */
    register_activation_hook( __FILE__, fn() => \Zqe\Genealogical_Tree_Activator::activate() );
    /**
     * Registers the plugin's deactivation hook.
     *
     * This uses an arrow function for concise deactivation logic. While concise,
     * using a named function is generally recommended for deactivation hooks due to
     * improved debugging and documentation possibilities.
     *
     * @since 1.0.0
     */
    register_deactivation_hook( __FILE__, fn() => \Zqe\Genealogical_Tree_Deactivator::deactivate() );
    /**
     * Initializes and runs the Genealogical Tree plugin (using an arrow function).
     * This is the most concise way for simple initialization tasks.
     *
     * @since 1.0.
     */
    add_action( 'plugins_loaded', fn() => ( new \Zqe\Genealogical_Tree() )->run(), 5 );
}