<?php

define( 'naga_wpforms_min_reqiered_php', '7.4' ); // without dot (not 7.4.0)
define( 'naga_wpforms_min_reqiered_ioncube', '12' ); // without dot (not 12.0.0)

add_action( 'init', function() {
	load_textdomain( 'naga-wpforms-notices', plugin_dir_path( __FILE__ ) . 'languages/' . 'naga-wpforms-notices-fa_IR.mo' );
	if (is_rtl() && get_locale() == 'fa_IR')  load_textdomain( 'wpforms-jalali-date', plugin_dir_path( __FILE__ ) . 'languages/' . 'wpforms-jalali-date-fa_IR.mo' );
});

require_once( plugin_dir_path( __FILE__ ) . 'includes/naga-wpforms-notices.php' );

// Load NagaTheme License, RTL and Persian Files
if( version_compare( PHP_VERSION, naga_wpforms_min_reqiered_php ) >= 0 ) {
	
	if( extension_loaded( 'ionCube Loader' ) ) {
		
		if( function_exists( 'ioncube_loader_version' ) && version_compare( ioncube_loader_version(), naga_wpforms_min_reqiered_ioncube ) >= 0 ) {
			
			require_once( plugin_dir_path( __FILE__ ) . 'naga-wpforms-ic.php' );
			
		} else {
			
			add_action( 'admin_notices', 'naga_wpforms_ioncube_version_notice' );
			add_action( 'admin_init', 'naga_wpforms_deactivate_licenses' );
			
		}
			
	} else {
		
		add_action( 'admin_notices', 'naga_wpforms_ioncube_notice' );
		add_action( 'admin_init', 'naga_wpforms_deactivate_licenses' );
		
	}
} else {
	
	add_action( 'admin_notices', 'naga_wpforms_php_notice' );
	add_action( 'admin_init', 'naga_wpforms_deactivate_licenses' );

}