<?php
/**
 * Plugin Name: Easy Digital Downloads - Per Product Notifications
 * Plugin URI: https://easydigitaldownloads.com
 * Description: Integrates per product sale notification. Send sale notifications to each defined recipient.
 * Author: Easy Digital Downloads
 * Author URI: https://easydigitaldownloads.com
 * Version: 1.2.5
 * Requires at least: 5.8
 * Requires PHP 7.4
 * Text Domain: edd-per-product-notifications
 *
 * Easy Digital Downloads 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
 * any later version.
 *
 * Easy Digital Downloads 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 Easy Digital Downloads. If not, see <http://www.gnu.org/licenses/>.
 */


define( 'DRUBBAPPN_STORE_API_URL', 'https://easydigitaldownloads.com' );
define( 'DRUBBAPPN_PRODUCT_NAME', 'Per Product Notifications' );
define( 'DRUBBAPPN_DIR', plugin_dir_path( __FILE__ ) );

require_once __DIR__ . '/vendor/autoload.php';
\EDD\ExtensionUtils\v1\ExtensionLoader::loadOrQuit(
	__FILE__,
	'edd_per_product_notifications',
	array(
		'php'                    => '7.4',
		'easy-digital-downloads' => '3.2.3',
		'wp'                     => '5.8',
	)
);

/**
 * Initialize the extension.
 *
 * @since 1.2.4
 * @return void
 */
function edd_per_product_notifications() {
	include_once DRUBBAPPN_DIR . 'includes/register-settings.php';
	include_once DRUBBAPPN_DIR . 'includes/meta-box.php';
	include_once DRUBBAPPN_DIR . 'includes/admin-functions.php';
	include_once DRUBBAPPN_DIR . 'includes/deprecated.php';

	add_action(
		'edd_extension_license_init',
		function ( \EDD\Extensions\ExtensionRegistry $registry ) {
			$registry->addExtension(
				__FILE__,
				DRUBBAPPN_PRODUCT_NAME,
				57873,
				'1.2.5'
			);
		}
	);
}

/**
 * Load the textdomain.
 *
 * @since 1.2.5
 * @return void
 */
function edd_per_product_notifications_load_textdomain() {
	load_plugin_textdomain( 'edd-per-product-notifications', false, basename( __DIR__ ) . '/languages' );
}
add_action( 'init', 'edd_per_product_notifications_load_textdomain' );
