70 lines
1.9 KiB
PHP
70 lines
1.9 KiB
PHP
<?php
|
|
/*
|
|
* Plugin Name: e-payeye payments
|
|
* Plugin URI: https://payeye.com/
|
|
* Description: e-payeye payments for WooCommerce
|
|
* Author: PayEye
|
|
* Text Domain: e-payeye-payments
|
|
* Domain Path: /languages
|
|
* Version: 0.8.0
|
|
* Requires at least: 5.6
|
|
* Tested up to: 6.3
|
|
* WC requires at least: 5.8
|
|
* WC tested up to: 7.5
|
|
* Requires PHP: 7.2
|
|
*/
|
|
|
|
use PayEye\App;
|
|
use PayEye\Gateway\PayEyeGateway;
|
|
use PayEye\GatewayLoader;
|
|
use PayEye\Hooks;
|
|
use PayEye\Lib\Env\Config;
|
|
use PayEye\Lib\Tool\JsonHelper;
|
|
use PayEye\Shared\Helpers\PluginActiveHelper;
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
add_action('init', function () {
|
|
load_plugin_textdomain(App::pluginData()->getTextDomain(), false, App::pluginData()->getDomainPath());
|
|
GatewayLoader::internalBrowserPreActions();
|
|
});
|
|
|
|
if (!PluginActiveHelper::isWoocommercePluginActive()) {
|
|
add_action('admin_notices', function (): void { ?>
|
|
<div class="error">
|
|
<p>
|
|
<?php
|
|
printf(
|
|
__(
|
|
'The “%s” plugin cannot run without WooCommerce active. Please install and activate WooCommerce plugin.',
|
|
'e-payeye-payments'
|
|
),
|
|
App::pluginData()->getName()
|
|
) ?>
|
|
</p>
|
|
</div>
|
|
<?php
|
|
});
|
|
return;
|
|
}
|
|
|
|
Config::createFromArray(JsonHelper::getArrayFromJsonFile(App::getConfigPath()));
|
|
|
|
register_activation_hook(__FILE__, [GatewayLoader::class, 'createOrUpdateDatabase']);
|
|
|
|
Hooks::registerHooks();
|
|
|
|
add_action('plugins_loaded', function (): void {
|
|
require_once App::pluginPath() . '/src/Gateway/PayEyeGateway.php';
|
|
GatewayLoader::createOrUpdateDatabase();
|
|
});
|
|
|
|
add_filter('woocommerce_payment_gateways', function (array $gateways): array {
|
|
$gateways[] = PayEyeGateway::class;
|
|
|
|
return $gateways;
|
|
});
|