<?php
/**
 * Plugin Name: Inpost International 
 * Plugin URI: https://wordpress.org/plugins/inpost-international
 * Description: InPost International is the official free InPost app for international delivery services
 * Tags: woocommerce, inpost, shipments
 * Version: 1.1.0
 * Tested up to: 6.9
 * Requires PHP: 7.4
 * Author: iLabs.dev
 * Author URI: https://iLabs.dev
 * Text Domain: inpost-international
 * Domain Path: /lang/
 * License: GPLv3
 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
 *
 * Copyright 2025 iLabs.dev
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

define( 'INPOST_INTL_PLUGIN_VERSION', '1.1.0' );
define( 'INPOST_INTL_PLUGIN_SLUG', 'inpost_international' );
define( 'INPOST_INTL_PLUGIN_FILE', __FILE__ );
const INPOST_INTL_PLUGIN_DIR              = __DIR__;
const INPOST_INTL_PLUGIN_TEXT_LOG         = 'false';

if ( function_exists( 'inpost_intl_core' ) ) {
	return;
}

require_once __DIR__ . '/compatibility.php';

if ( inpost_intl_system_check() ) {
	require_once __DIR__ . '/vendor/autoload.php';
	require_once 'dependencies.php';

	function inpost_intl_core(): Ilabs\Inpost_International\Plugin {
		return new Ilabs\Inpost_International\Plugin();
	}

	$config = array(
		'__FILE__'    => __FILE__,
		'slug'        => 'inpost_international',
		'lang_dir'    => 'lang',
		'text_domain' => 'inpost-international',
	);

	inpost_intl_core()->execute( $config );
}

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
			);
		}
	}
);
