-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
afa-submission-manager.php
62 lines (49 loc) · 2 KB
/
afa-submission-manager.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
<?php
/**
* Plugin Name: AFA - Mobile-Ready Submission Manager
* Plugin URI: https://github.com/afa-submission-manager/afa-submission-manager
* Description: Simplify form management and gain insights with our robust WordPress plugin.
* Version: 1.0.0
* Requires at least: 6.2
* Requires PHP: 7.0
* Author: claudionhangapc, marciogoes
* Author URI: https://claudionhangapc.com/
* License: GPL v2 or later
* License URI: https://claudionhangapc/gpl-2.0.html
* Text Domain: afa-submission-manager
* Domain Path: /languages
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
require __DIR__ . '/vendor/autoload.php';
define( 'AFASM_PLUGIN_FILE', __FILE__ );
define( 'AFASM_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
define( 'AFASM_PLUGIN_LANGUAGE_FOLDER', dirname( plugin_basename( __FILE__ ) ) . '/languages' );
use AFASM\Includes\Plugins\JWT\AFASM_JWT_Plugin;
use AFASM\Includes\Routes\AFASM_Route;
use AFASM\Includes\Database\AFASM_Database_Installer;
use AFASM\Includes\Admin\AFASM_Admin_Options;
use AFASM\Includes\Plugins\AFASM_Constant;
use AFASM\Includes\Plugins\AFASM_Language;
use AFASM\Includes\Plugins\Notification\AFASM_Notification_Hooks_Plugin;
/**
* Init api.
*/
function afasm_rest_init() {
$namespace = AFASM_Constant::API_NAMESPACE . '/' . AFASM_Constant::API_VERSION;
( new AFASM_Route( $namespace ) )->init();
add_filter( 'rest_pre_dispatch', array( new AFASM_JWT_Plugin(), 'validate_token_rest_pre_dispatch' ), 10, 3 );
}
/**
* Add actions
*/
add_action( 'rest_api_init', 'afasm_rest_init' );
/**
* Register hooks.
*/
register_activation_hook( AFASM_PLUGIN_FILE, array( new AFASM_Database_Installer(), 'install' ) );
( new AFASM_Admin_Options() )->init();
add_action( 'plugins_loaded', array( new AFASM_Language(), 'all_forms_load_textdomain' ) );
add_filter( 'plugin_locale', array( new AFASM_Language(), 'enforce_locale' ), 10, 2 );
( new AFASM_Notification_Hooks_Plugin() )->loads_hooks();