-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoneaccess.php
More file actions
94 lines (81 loc) · 2 KB
/
oneaccess.php
File metadata and controls
94 lines (81 loc) · 2 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/**
* Plugin Name: OneAccess
* Description: OneAccess is plugin to manage user accounts across multiple sites in a WordPress.
* Author: Utsav Patel, rtCamp
* Author URI: https://rtcamp.com
* Plugin URI: https://github.com/rtCamp/OneAccess/
* Update URI: https://github.com/rtCamp/OneAccess/
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: oneaccess
* Domain Path: /languages
* Version: 1.1.1
* Requires PHP: 8.0
* Requires at least: 6.8
* Tested up to: 6.9
*
* @package OneAccess
*/
namespace OneAccess;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit();
/**
* Define the plugin constants.
*/
function constants(): void {
/**
* Version of the plugin.
*/
define( 'ONEACCESS_VERSION', '1.1.1' );
/**
* Root path to the plugin directory.
*/
define( 'ONEACCESS_DIR', plugin_dir_path( __FILE__ ) );
/**
* Root URL to the plugin directory.
*/
define( 'ONEACCESS_URL', plugin_dir_url( __FILE__ ) );
/**
* Plugin basename.
*/
define( 'ONEACCESS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
}
constants();
// If autoloader failed, we cannot proceed.
require_once __DIR__ . '/inc/Autoloader.php';
if ( ! \OneAccess\Autoloader::autoload() ) {
return;
}
/**
* Load plugin.
*/
if ( class_exists( 'OneAccess\Main' ) ) {
add_action(
'plugins_loaded',
'\OneAccess\load_plugin'
);
}
/**
* Load OneAccess plugin functionality.
*
* @return void
*/
function load_plugin(): void {
\OneAccess\Main::instance();
//phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound -- @todo remove before submitting to .org.
load_plugin_textdomain( 'oneaccess', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/**
* Activation hook.
*/
register_activation_hook(
__FILE__,
static function (): void {
if ( ! class_exists( '\OneAccess\Modules\Core\User_Roles' ) ) {
return;
}
// Update user role on activation.
\OneAccess\Modules\Core\User_Roles::update_user_role_on_activation();
}
);