-
Notifications
You must be signed in to change notification settings - Fork 0
/
direct-credit-wp.php
66 lines (57 loc) · 2.06 KB
/
direct-credit-wp.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* @since 1.0.0
* @package Direct_Credit_WP
*
* @wordpress-plugin
* Plugin Name: Direct Credit WP
* Plugin URI: https://github.com/dllpl/direct-credit-wp
* Description: Плагин интеграции формы кредитования от Директ Кредит для вашего сайта на WP
* Version: 1.0.0
* Author: Nikita Ivanov (Nick Iv)
* Author URI: https://github.com/dllpl
* License: BSD 3-Clause License
* License URI: https://github.com/dllpl/direct-credit-wp/blob/main/LICENSE
* Text Domain: direct-credit-wp
*/
if (!defined('WPINC')) {
die;
}
add_action('rest_api_init', 'register_routes');
add_action('admin_menu', 'admin_menu_direct_credit_wp');
register_activation_hook(__FILE__, 'activate_direct_credit_wp');
register_uninstall_hook(__FILE__, 'uninstall_direct_credit_wp');
add_action('wp_enqueue_scripts', 'script_init');
/** Добавление ссылки на настройки плагина */
function admin_menu_direct_credit_wp()
{
require_once plugin_dir_path(__FILE__) . 'admin/OptionController.php';
$option = new OptionPage();
$option->addMenu();
}
/** Активация плагина */
function activate_direct_credit_wp()
{
require_once plugin_dir_path(__FILE__) . 'includes/Activator.php';
Activator::activate();
}
/** Регистрация REST API методов плагина */
function register_routes()
{
require_once plugin_dir_path(__FILE__) . 'includes/Controllers/MainRequestController.php';
$controller = new MainRestController();
$controller->registerRoutes();
}
/** Инициализация js скрипта */
function script_init()
{
require_once plugin_dir_path(__FILE__) . 'public/Controllers/PublicController.php';
$controller = new PublicController();
$controller->scriptInit();
}
/** Удаление плагина */
function uninstall_direct_credit_wp()
{
require_once plugin_dir_path(__FILE__) . 'includes/Uninstall.php';
Uninstall::uninstall();
}