<?php
/**
 * Parasut - WooCommerce
 *
 * @package     ParasutWooCommerce
 * @author      grilabs
 * @copyright   2018 @ gri
 *
 * @wordpress-plugin
 * Plugin Name: grilabs - Paraşüt WooCommerce Entegrasyonu
 * Plugin URI:  https://www.gri.net/wordpress-eklentileri/parasut
 * Description: WooCommerce satışlarınızı kolayca Paraşüt'e aktarın, e-fatura kesin!
 * Version:     1.0.6
 * WC requires at least: 6.0.0
 * WC tested up to: 8.1
 * Author:      grilabs
 * Author URI:  https://www.gri.net
 * Text Domain: grilabsparasut
 */

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

define( 'GRILABS_PARASUT_VERSION', '1.0.6' );

if ( ! defined( 'GRILABS_TECHNICAL_SUPPORT_URL' ) ) {
	define( 'GRILABS_TECHNICAL_SUPPORT_URL', 'https://www.gri.net' );
}

if ( is_array(apply_filters( 'active_plugins', get_option( 'active_plugins' ) )) && in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
	function grilabs_woocommerce_parasut_init() {
		require_once dirname( __FILE__ ) . '/init.php';
		require_once dirname( __FILE__ ) . '/hooks.php';
	}

	add_action( 'plugins_loaded', 'grilabs_woocommerce_parasut_init' );
}

register_activation_hook( dirname( __FILE__ ) . '/grilabsparasut.php', function () {
	require_once __DIR__ . '/inc/functions.php';
	install_grilabsparasut();
} );

register_deactivation_hook( dirname( __FILE__ ) . '/grilabsparasut.php', function () {
	require_once __DIR__ . '/inc/functions.php';
	uninstall_grilabsparasut();
} );

register_activation_hook( dirname( __FILE__ ) . '/grilabsparasut.php', function () {
	if ( ! wp_next_scheduled( 'grilabs_parasut_set_hourly_events' ) ) {
		wp_schedule_event( time(), 'hourly', 'grilabs_parasut_set_hourly_events' );
	}
} );

register_deactivation_hook( dirname( __FILE__ ) . '/grilabsparasut.php', function () {
	wp_clear_scheduled_hook( 'grilabs_parasut_set_hourly_events' );
} );

add_filter('grilabs_parasut_debug', '__return_true');


add_action( 'before_woocommerce_init', function() {
    if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
    }
} );