<?php

// Prevent Direct Access
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

require __DIR__.'/plugins-install/class-tgm-plugin-activation.php';

function maxo_register_required_plugins() {

	$plugins = [

		[
			'name'      => 'Kirki Customizer Framework',
			'slug'      => 'kirki',
			'required'  => true,
		],
		[
			'name'      => 'Meta Box',
			'slug'      => 'meta-box',
			'required'  => true,
		],
		[
			'name'      => 'Contact Form 7',
			'slug'      => 'contact-form-7',
			'required'  => false,
		],
		[
			'name'      => 'Classic Widgets',
			'slug'      => 'classic-widgets',
			'required'  => false,
		],
		[
			'name'      => 'One Click Demo Import',
			'slug'      => 'one-click-demo-import',
			'required'  => false,
		],

	];

	if( get_locale() == 'fa_IR' || get_locale() == 'fa_AF' ){

		$plugins[] = [
			'name'      => 'Parsi Date',
			'slug'      => 'wp-parsidate',
			'required'  => false,
		];

	}

	$config = [
		'id'           => 'maxo-fa',                  // Unique ID for hashing notices for multiple instances of TGMPA.
		'default_path' => '',                         // Default absolute path to bundled plugins.
		'menu'         => 'maxo-install-plugins',     // Menu slug.
		'parent_slug'  => 'plugins.php',              // Parent menu slug.
		'capability'   => 'manage_options',           // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
		'has_notices'  => true,                       // Show admin notices or not.
		'dismissable'  => true,                       // If false, a user cannot dismiss the nag message.
		'dismiss_msg'  => '',                         // If 'dismissable' is false, this message will be output at top of nag.
		'is_automatic' => true,                       // Automatically activate plugins after installation or not.
		'message'      => '',                         // Message to output right before the plugins table.
	];

	tgmpa( $plugins, $config );
}

add_action( 'tgmpa_register', 'maxo_register_required_plugins' );
